aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2018-08-06 06:05:27 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2018-08-06 06:05:27 +0200
commitf078c475312b91b50f1a72d5ba8907ed8d715e15 (patch)
tree9da487c532ed9e91d58c9fbf0d3b4d1bd88a4876
parent102a156146db518f2b56eb61ba89b128faade6cc (diff)
downloadmitjafelicijan.com-f078c475312b91b50f1a72d5ba8907ed8d715e15.tar.gz
update
-rw-r--r--.jekyll-metadatabin3534 -> 7085 bytes
-rw-r--r--_config.yml2
-rw-r--r--_layouts/index.html4
-rw-r--r--_layouts/post.html8
-rw-r--r--_posts/2011-12-31-test-post.md25
-rw-r--r--_posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md260
-rw-r--r--assets/avatar.jpgbin0 -> 64453 bytes
-rw-r--r--assets/plotly-latest.min.js7
-rw-r--r--assets/site.css42
-rw-r--r--files/copy-benchmarks.tsv101
-rw-r--r--files/dev101-git-topics-1.pngbin0 -> 13317 bytes
-rw-r--r--files/dev101-git-topics-1.png.webpbin0 -> 7782 bytes
-rw-r--r--files/dev101-git-topics-2.pngbin0 -> 12260 bytes
-rw-r--r--files/dev101-git-topics-2.png.webpbin0 -> 7676 bytes
-rw-r--r--files/fuse-droplets.pngbin0 -> 42891 bytes
-rw-r--r--files/fuse-droplets.png.webpbin0 -> 26296 bytes
-rw-r--r--files/fuse-spaces.pngbin0 -> 32450 bytes
-rw-r--r--files/fuse-spaces.png.webpbin0 -> 20758 bytes
-rw-r--r--files/golang-profiling-cpu.pdfbin0 -> 16518 bytes
-rw-r--r--files/golang-profiling-mem.pdfbin0 -> 19221 bytes
-rw-r--r--files/iot-app-output.pngbin0 -> 23767 bytes
-rw-r--r--files/iot-app-output.png.webpbin0 -> 12784 bytes
-rw-r--r--files/iot-rest-example.pngbin0 -> 33912 bytes
-rw-r--r--files/iot-rest-example.png.webpbin0 -> 20186 bytes
-rw-r--r--files/iot-sqlite-db.pngbin0 -> 199821 bytes
-rw-r--r--files/iot-sqlite-db.png.webpbin0 -> 111150 bytes
-rw-r--r--files/kcachegrind.pngbin0 -> 88486 bytes
-rw-r--r--files/kcachegrind.png.webpbin0 -> 58548 bytes
-rw-r--r--files/profiling-viewer.pngbin0 -> 173672 bytes
-rw-r--r--files/profiling-viewer.png.webpbin0 -> 100708 bytes
-rw-r--r--files/simple-iot-application-overview.svg2
-rw-r--r--files/simple-iot-application.zipbin0 -> 6406 bytes
-rw-r--r--files/snakeviz.pngbin0 -> 59601 bytes
-rw-r--r--files/snakeviz.png.webpbin0 -> 43168 bytes
-rw-r--r--files/sqlite-benchmarks.tsv1001
35 files changed, 1421 insertions, 31 deletions
diff --git a/.jekyll-metadata b/.jekyll-metadata
index 8e3c389..1c9c7cf 100644
--- a/.jekyll-metadata
+++ b/.jekyll-metadata
Binary files differ
diff --git a/_config.yml b/_config.yml
index 478ce92..4d5ad31 100644
--- a/_config.yml
+++ b/_config.yml
@@ -13,7 +13,7 @@ kramdown:
13 toc_levels: 1..6 13 toc_levels: 1..6
14 smart_quotes: lsquo,rsquo,ldquo,rdquo 14 smart_quotes: lsquo,rsquo,ldquo,rdquo
15 input: GFM 15 input: GFM
16 hard_wrap: false 16 hard_wrap: true
17 footnote_nr: 1 17 footnote_nr: 1
18 show_warnings: false 18 show_warnings: false
19 syntax_highlighter: rouge 19 syntax_highlighter: rouge
diff --git a/_layouts/index.html b/_layouts/index.html
index ed369a4..7c546a2 100644
--- a/_layouts/index.html
+++ b/_layouts/index.html
@@ -23,8 +23,8 @@
23 <ul> 23 <ul>
24 {% for post in site.posts %} 24 {% for post in site.posts %}
25 <li> 25 <li>
26 {{ post.date | date: "%m/%d/%Y" }} 26 <time datetime="{{ post.date | date: '%Y-%m-%d' }}">{{ post.date | date: '%A, %B %-d, %Y' }}</time>
27 <a href="{{ post.url }}">{{ post.title }}</a> 27 <div><a href="{{ post.url }}">{{ post.title }}</a></div>
28 </li> 28 </li>
29 {% endfor %} 29 {% endfor %}
30 </ul> 30 </ul>
diff --git a/_layouts/post.html b/_layouts/post.html
index 3c80ab1..95dd3f0 100644
--- a/_layouts/post.html
+++ b/_layouts/post.html
@@ -19,7 +19,13 @@
19 {% include header.html %} 19 {% include header.html %}
20 20
21 <article> 21 <article>
22 {{ content }} 22
23 <h1>{{ page.title }}</h1>
24
25 <time datetime="{{ page.date | date: '%Y-%m-%d' }}">{{ page.date | date: '%A, %B %-d, %Y' }}</time>
26
27 {{ content }}
28
23 </article> 29 </article>
24 30
25 {% include footer.html %} 31 {% include footer.html %}
diff --git a/_posts/2011-12-31-test-post.md b/_posts/2011-12-31-test-post.md
deleted file mode 100644
index ebc76e5..0000000
--- a/_posts/2011-12-31-test-post.md
+++ /dev/null
@@ -1,25 +0,0 @@
1---
2layout: post
3title: "Test post"
4categories:
5---
6
7## okidoki
8
9Here is my page and it's awesome.
10
11```js
12console.log('asasdasd');
13```
14
15This is all ok
16
17```ruby
18def show
19 @widget = Widget(params[:id])
20 respond_to do |format|
21 format.html # show.html.erb
22 format.json { render json: @widget }
23 end
24end
25```
diff --git a/_posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md b/_posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md
new file mode 100644
index 0000000..b713b64
--- /dev/null
+++ b/_posts/2018-01-16-using-digitalocean-spaces-object-storage-with-fuse.md
@@ -0,0 +1,260 @@
1---
2layout: post
3title: "Using DigitalOcean Spaces Object Storage with FUSE"
4categories:
5---
6
7Couple of months ago [DigitalOcean](https://www.digitalocean.com) introduced new product called [Spaces](https://blog.digitalocean.com/introducing-spaces-object-storage/) which is Object Storage very similar to Amazon's S3. This really peaked my interest, because this was something I was missing and even the thought of going over the internet for such functionality was in no interest to me. Also in fashion with their previous pricing this also is very cheap and pricing page is a no-brainer compared to AWS or GCE. [Prices are clearly and precisely defined and outlined](https://www.digitalocean.com/pricing/). You must love them for that :)
8
9### Initial requirements
10
11* [Is it possible to use them as a mounted drive with FUSE?](#fuse) (tl;dr YES)
12* [Will the performance degrade over time and over different sizes of objects?](#performanse) (tl;dr NO&YES)
13* [Can storage be mounted on multiple machines at the same time and be writable?](#multiuser) (tl;dr YES)
14
15> Let me be clear. This scripts I use are made just for benchmarking and are not intended to be used in real-life situations. Besides that, I am looking into using this approaches but adding caching service in front of it and then dumping everything as an object to storage. This could potentially be some interesting post of itself. But in case you would need real-time data without eventual consistency please take this scripts as they are: not usable in such situations.
16
17## <a name="fuse"></a>Is it possible to use them as a mounted drive with FUSE?
18
19Well, actually they can be used in such manor. Because they are similar to [AWS S3](https://aws.amazon.com/s3/) many tools are available and you can find many articles and [Stackoverflow items](https://stackoverflow.com/search?q=s3+fuse).
20
21To make this work you will need DigitalOcean account. If you don't have one you will not be able to test this code. But if you have an account then you go and [create new Droplet](https://cloud.digitalocean.com/droplets/new?size=s-1vcpu-1gb&region=ams3&distro=debian&distroImage=debian-9-x64&options=private_networking,install_agent). If you click on this link you will already have preselected Debian 9 with smallest VM option.
22
23* Please be sure to add you SSH key, because we will login to this machine remotely.
24* If you change your region please remember which one you choose because we will need this information when we try to mount space to our machine.
25
26Instuctions on how to use SSH keys and how to setup them are available in article [How To Use SSH Keys with DigitalOcean Droplets](https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets).
27
28![DigitalOcean Droplets](/files/fuse-droplets.png)
29
30After we created Droplet it's time to create new Space. This is done by clicking on a button [Create](https://cloud.digitalocean.com/spaces/new) (right top corner) and selecting Spaces. Choose pronounceable ```Unique name``` because we will use it in examples below. You can either choose Private or Public, it doesn't matter in our case. And you can always change that in the future.
31
32When you have created new Space we should [generate Access key](https://cloud.digitalocean.com/settings/api/tokens). This link will guide to the page when you can generate this key. After you create new one, please save provided Key and Secret because Secret will not be shown again.
33
34![DigitalOcean Spaces](/files/fuse-spaces.png)
35
36Now that we have new Space and Access key we should SSH into our machine.
37
38```bash
39# replace IP with the ip of your newly created droplet
40ssh root@IP
41
42# this will install utilities for mounting storage objects as FUSE
43apt install s3fs
44
45# we now need to provide credentials (access key we created earlier)
46# replace KEY and SECRET with your own credentials but leave the colon between them
47# we also need to set proper permissions
48echo "KEY:SECRET" > .passwd-s3fs
49chmod 600 .passwd-s3fs
50
51# now we mount space to our machine
52# replace UNIQUE-NAME with the name you choose earlier
53# if you choose different region for your space be careful about -ourl option (ams3)
54s3fs UNIQUE-NAME /mnt/ -ourl=https://ams3.digitaloceanspaces.com -ouse_cache=/tmp
55
56# now we try to create a file
57# once you mount it may take a couple of seconds to retrieve data
58echo "Hello cruel world" > /mnt/hello.txt
59```
60
61After all this you can return to your browser and go to [DigitalOcean Spaces](https://cloud.digitalocean.com/spaces) and click on your created space. If file hello.txt is present you have successfully mounted space to your machine and wrote data to it.
62
63I choose the same region for my Droplet and my Space but you don't have to. You can have different regions. What this actually does to performance I don't know.
64
65Additional information on FUSE:
66
67* [Github project page for s3fs](https://github.com/s3fs-fuse/s3fs-fuse)
68* [FUSE - Filesystem in Userspace](https://en.wikipedia.org/wiki/Filesystem_in_Userspace)
69
70## <a name="performanse"></a>Will the performance degrade over time and over different sizes of objects?
71
72For this task I didn't want to just read and write text files or uploading images. I actually wanted to figure out if using something like SQlite is viable in this case.
73
74### Measurement experiment 1: File copy
75
76```bash
77# first we create some dummy files at different sizes
78dd if=/dev/zero of=10KB.dat bs=1024 count=10 #10KB
79dd if=/dev/zero of=100KB.dat bs=1024 count=100 #100KB
80dd if=/dev/zero of=1MB.dat bs=1024 count=1024 #1MB
81dd if=/dev/zero of=10MB.dat bs=1024 count=10240 #10MB
82
83# now we set time command to only return real
84TIMEFORMAT=%R
85
86# now lets test it
87(time cp 10KB.dat /mnt/) |& tee -a 10KB.results.txt
88
89# and now we automate
90# this will perform the same operation 100 times
91# this will output results into separated files based on objecty size
92n=0; while (( n++ < 100 )); do (time cp 10KB.dat /mnt/10KB.$n.dat) |& tee -a 10KB.results.txt; done
93n=0; while (( n++ < 100 )); do (time cp 100KB.dat /mnt/100KB.$n.dat) |& tee -a 100KB.results.txt; done
94n=0; while (( n++ < 100 )); do (time cp 1MB.dat /mnt/1MB.$n.dat) |& tee -a 1MB.results.txt; done
95n=0; while (( n++ < 100 )); do (time cp 10MB.dat /mnt/10MB.$n.dat) |& tee -a 10MB.results.txt; done
96```
97
98Files of size 100MB were not successfully transferred and ended up displaying error (cp: failed to close '/mnt/100MB.1.dat': Operation not permitted).
99
100As I suspected, object size is not really that important. Sadly I don't have the time to test performance over periods of time. But if some of you would do it please send me your data. I would be interested in seeing results.
101
102**Here are plotted results**
103
104You can download [raw result here](/files/copy-benchmarks.tsv). Measurements are in seconds.
105
106<script src="/assets/plotly-latest.min.js"></script>
107<div id="copy-benchmarks"></div>
108<script>
109(function(){
110 var request = new XMLHttpRequest();
111 request.open("GET", "/files/copy-benchmarks.tsv", true);
112 request.onload = function() {
113 if (request.status >= 200 && request.status < 400) {
114 var payload = request.responseText.trim();
115 var tsv = payload.split("\n");
116 for (var i=0; i<tsv.length; i++) { tsv[i] = tsv[i].split("\t"); }
117 var traces = [];
118 var headers = tsv[0];
119 tsv.shift();
120 Array.prototype.forEach.call(headers, function(el, idx) {
121 var x = [];
122 var y = [];
123 for (var j=0; j<tsv.length; j++) {
124 x.push(j);
125 y.push(parseFloat(tsv[j][idx].replace(",", ".")));
126 }
127 traces.push({ x: x, y: y, type: "scatter", name: el, line: { width: 1, shape: "spline" } });
128 });
129 var copy = Plotly.newPlot("copy-benchmarks", traces, { legend: {"orientation": "h"}, height: 400, margin: { l: 40, r: 0, b: 20, t: 30, pad: 0 }, yaxis: { title: "execution time in seconds", titlefont: { size: 12 } }, xaxis: { title: "fn(i)", titlefont: { size: 12 } } });
130 } else { }
131 };
132 request.onerror = function() { };
133 request.send(null);
134})();
135</script>
136
137As far as these tests show, performance is quite stable and can be predicted which is fantastic. But this is a small test and spans only over couple of hours. So you should not completely trust them.
138
139### Measurement experiment 2: SQLite performanse
140
141I was unable to use database file directly from mounted drive so this is a no-go as I suspected. So I executed code below on a local disk just to get some benchmarks. I inserted 1000 records with DROPTABLE, CREATETABLE, INSERTMANY, FETCHALL, COMMIT for 1000 times to generate statistics. As you can see performance of SQLite is quite amazing. You could then potentially just copy file to mounted drive and be done with it.
142
143```python
144import time
145import sqlite3
146import sys
147
148if len(sys.argv) < 3:
149 print("usage: python sqlite-benchmark.py DB_PATH NUM_RECORDS REPEAT")
150 exit()
151
152def data_iter(x):
153 for i in range(x):
154 yield "m" + str(i), "f" + str(i*i)
155
156header_line = "%s\t%s\t%s\t%s\t%s\n" % ("DROPTABLE", "CREATETABLE", "INSERTMANY", "FETCHALL", "COMMIT")
157with open("sqlite-benchmarks.tsv", "w") as fp:
158 fp.write(header_line)
159
160start_time = time.time()
161conn = sqlite3.connect(sys.argv[1])
162c = conn.cursor()
163end_time = time.time()
164result_time = CONNECT = end_time - start_time
165print("CONNECT: %g seconds" % (result_time))
166
167start_time = time.time()
168c.execute("PRAGMA journal_mode=WAL")
169c.execute("PRAGMA temp_store=MEMORY")
170c.execute("PRAGMA synchronous=OFF")
171result_time = PRAGMA = end_time - start_time
172print("PRAGMA: %g seconds" % (result_time))
173
174for i in range(int(sys.argv[3])):
175 print("#%i" % (i))
176
177 start_time = time.time()
178 c.execute("drop table if exists test")
179 end_time = time.time()
180 result_time = DROPTABLE = end_time - start_time
181 print("DROPTABLE: %g seconds" % (result_time))
182
183 start_time = time.time()
184 c.execute("create table if not exists test(a,b)")
185 end_time = time.time()
186 result_time = CREATETABLE = end_time - start_time
187 print("CREATETABLE: %g seconds" % (result_time))
188
189 start_time = time.time()
190 c.executemany("INSERT INTO test VALUES (?, ?)", data_iter(int(sys.argv[2])))
191 end_time = time.time()
192 result_time = INSERTMANY = end_time - start_time
193 print("INSERTMANY: %g seconds" % (result_time))
194
195 start_time = time.time()
196 c.execute("select count(*) from test")
197 res = c.fetchall()
198 end_time = time.time()
199 result_time = FETCHALL = end_time - start_time
200 print("FETCHALL: %g seconds" % (result_time))
201
202 start_time = time.time()
203 conn.commit()
204 end_time = time.time()
205 result_time = COMMIT = end_time - start_time
206 print("COMMIT: %g seconds" % (result_time))
207
208 print
209 log_line = "%f\t%f\t%f\t%f\t%f\n" % (DROPTABLE, CREATETABLE, INSERTMANY, FETCHALL, COMMIT)
210 with open("sqlite-benchmarks.tsv", "a") as fp:
211 fp.write(log_line)
212
213start_time = time.time()
214conn.close()
215end_time = time.time()
216result_time = CLOSE = end_time - start_time
217print("CLOSE: %g seconds" % (result_time))
218```
219
220You can download [raw result here](/files/sqlite-benchmarks.tsv). And again, these results are done on a local block storage and do not represent capabilities of object storage. With my current approach and state of the test code these can not be done. I would need to make Python code much more robust and check locking etc.
221
222<div id="sqlite-benchmarks"></div>
223<script>
224(function(){
225 var request = new XMLHttpRequest();
226 request.open("GET", "/files/sqlite-benchmarks.tsv", true);
227 request.onload = function() {
228 if (request.status >= 200 && request.status < 400) {
229 var payload = request.responseText.trim();
230 var tsv = payload.split("\n");
231 for (var i=0; i<tsv.length; i++) { tsv[i] = tsv[i].split("\t"); }
232 var traces = [];
233 var headers = tsv[0];
234 tsv.shift();
235 Array.prototype.forEach.call(headers, function(el, idx) {
236 var x = [];
237 var y = [];
238 for (var j=0; j<tsv.length; j++) {
239 x.push(j);
240 y.push(parseFloat(tsv[j][idx].replace(",", ".")));
241 }
242 traces.push({ x: x, y: y, type: "scatter", name: el, line: { width: 1, shape: "spline" } });
243 });
244 var sqlite = Plotly.newPlot("sqlite-benchmarks", traces, { legend: {"orientation": "h"}, height: 400, margin: { l: 50, r: 0, b: 20, t: 30, pad: 0 }, yaxis: { title: "execution time in seconds", titlefont: { size: 12 } } });
245 } else { }
246 };
247 request.onerror = function() { };
248 request.send(null);
249})();
250</script>
251
252## <a name="multiuser"></a>Can storage be mounted on multiple machines at the same time and be writable?
253
254Well, this one didn't take long to test. And the answer is **YES**. I mounted space on both machines and measured same performance on both machines. But because file is downloaded before write and then uploaded on complete there could potentially be problems is another process is trying to access the same file.
255
256## Observations and conslusion
257
258Using Spaces in this way makes it easier to access and manage files. But besides that you would need to write additional code to make this one play nice with you applications.
259
260Nevertheless, this was extremely simple to setup and use and this is just another excellent product in DigitalOcean product line. I found this exercise very valuable and am thinking about implementing some sort of mechanism for SQLite, so data can be stored on Spaces and accessed by many VM's. For a project where data doesn't need to be accessible in real-time and can have couple of minutes old data this would be very interesting. If any of you find this proposal interesting please write in a comment box below or shoot me an email and I will keep you posted.
diff --git a/assets/avatar.jpg b/assets/avatar.jpg
new file mode 100644
index 0000000..25294b8
--- /dev/null
+++ b/assets/avatar.jpg
Binary files differ
diff --git a/assets/plotly-latest.min.js b/assets/plotly-latest.min.js
new file mode 100644
index 0000000..676213b
--- /dev/null
+++ b/assets/plotly-latest.min.js
@@ -0,0 +1,7 @@
1/**
2* plotly.js v1.32.0
3* Copyright 2012-2018, Plotly, Inc.
4* All rights reserved.
5* Licensed under the MIT license
6*/
7!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 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){var r=e[o][1][t];return i(r||t)},u,u.exports,t,e,r,n)}return r[o].exports}for(var a="function"==typeof require&&require,o=0;o<n.length;o++)i(n[o]);return i}({1:[function(t,e,r){"use strict";var n=t("../src/lib"),i={"X,X div":"font-family:'Open Sans', verdana, arial, sans-serif;margin:0;padding:0;","X input,X button":"font-family:'Open Sans', verdana, arial, sans-serif;","X input:focus,X button:focus":"outline:none;","X a":"text-decoration:none;","X a:hover":"text-decoration:none;","X .crisp":"shape-rendering:crispEdges;","X .user-select-none":"-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;","X svg":"overflow:hidden;","X svg a":"fill:#447adb;","X svg a:hover":"fill:#3c6dc5;","X .main-svg":"position:absolute;top:0;left:0;pointer-events:none;","X .main-svg .draglayer":"pointer-events:all;","X .cursor-default":"cursor:default;","X .cursor-pointer":"cursor:pointer;","X .cursor-crosshair":"cursor:crosshair;","X .cursor-move":"cursor:move;","X .cursor-col-resize":"cursor:col-resize;","X .cursor-row-resize":"cursor:row-resize;","X .cursor-ns-resize":"cursor:ns-resize;","X .cursor-ew-resize":"cursor:ew-resize;","X .cursor-sw-resize":"cursor:sw-resize;","X .cursor-s-resize":"cursor:s-resize;","X .cursor-se-resize":"cursor:se-resize;","X .cursor-w-resize":"cursor:w-resize;","X .cursor-e-resize":"cursor:e-resize;","X .cursor-nw-resize":"cursor:nw-resize;","X .cursor-n-resize":"cursor:n-resize;","X .cursor-ne-resize":"cursor:ne-resize;","X .modebar":"position:absolute;top:2px;right:2px;z-index:1001;background:rgba(255,255,255,0.7);","X .modebar--hover":"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":"opacity:1;","X .modebar-group":"float:left;display:inline-block;box-sizing:border-box;margin-left:8px;position:relative;vertical-align:middle;white-space:nowrap;","X .modebar-group:first-child":"margin-left:0px;","X .modebar-btn":"position:relative;font-size:16px;padding:3px 4px;cursor:pointer;line-height:normal;box-sizing:border-box;","X .modebar-btn svg":"position:relative;top:2px;","X .modebar-btn path":"fill:rgba(0,31,95,0.3);","X .modebar-btn.active path,X .modebar-btn:hover path":"fill:rgba(0,22,72,0.5);","X .modebar-btn.modebar-btn--logo":"padding:3px 1px;","X .modebar-btn.modebar-btn--logo path":"fill:#447adb !important;","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 .select-outline":"fill:none;stroke-width:1;shape-rendering:crispEdges;","X .select-outline-1":"stroke:white;","X .select-outline-2":"stroke:black;stroke-dasharray:2px 2px;",Y:"font-family:'Open Sans';position:fixed;top:50px;right:20px;z-index:10000;font-size:10pt;max-width:180px;","Y p":"margin:0;","Y .notifier-note":"min-width:180px;max-width:250px;border:1px solid #fff;z-index:3000;margin:0;background-color:#8c97af;background-color:rgba(140,151,175,0.9);color:#fff;padding:10px;overflow-wrap:break-word;word-wrap:break-word;-ms-hyphens:auto;-webkit-hyphens:auto;hyphens:auto;","Y .notifier-close":"color:#fff;opacity:0.8;float:right;padding:0 5px;background:none;border:none;font-size:20px;font-weight:bold;line-height:20px;","Y .notifier-close:hover":"color:#444;text-decoration:none;cursor:pointer;"};for(var a in i){var o=a.replace(/^,/," ,").replace(/X/g,".js-plotly-plot .plotly").replace(/Y/g,".plotly-notifier");n.addStyleRule(o,i[a])}},{"../src/lib":738}],2:[function(t,e,r){"use strict";e.exports={undo:{width:857.1,path:"m857 350q0-87-34-166t-91-137-137-92-166-34q-96 0-183 41t-147 114q-4 6-4 13t5 11l76 77q6 5 14 5 9-1 13-7 41-53 100-82t126-29q58 0 110 23t92 61 61 91 22 111-22 111-61 91-92 61-110 23q-55 0-105-20t-90-57l77-77q17-16 8-38-10-23-33-23h-250q-15 0-25 11t-11 25v250q0 24 22 33 22 10 39-8l72-72q60 57 137 88t159 31q87 0 166-34t137-92 91-137 34-166z",ascent:850,descent:-150},home:{width:928.6,path:"m786 296v-267q0-15-11-26t-25-10h-214v214h-143v-214h-214q-15 0-25 10t-11 26v267q0 1 0 2t0 2l321 264 321-264q1-1 1-4z m124 39l-34-41q-5-5-12-6h-2q-7 0-12 3l-386 322-386-322q-7-4-13-4-7 2-12 7l-35 41q-4 5-3 13t6 12l401 334q18 15 42 15t43-15l136-114v109q0 8 5 13t13 5h107q8 0 13-5t5-13v-227l122-102q5-5 6-12t-4-13z",ascent:850,descent:-150},"camera-retro":{width:1e3,path:"m518 386q0 8-5 13t-13 5q-37 0-63-27t-26-63q0-8 5-13t13-5 12 5 5 13q0 23 16 38t38 16q8 0 13 5t5 13z m125-73q0-59-42-101t-101-42-101 42-42 101 42 101 101 42 101-42 42-101z m-572-320h858v71h-858v-71z m643 320q0 89-62 152t-152 62-151-62-63-152 63-151 151-63 152 63 62 151z m-571 358h214v72h-214v-72z m-72-107h858v143h-462l-36-71h-360v-72z m929 143v-714q0-30-21-51t-50-21h-858q-29 0-50 21t-21 51v714q0 30 21 51t50 21h858q29 0 50-21t21-51z",ascent:850,descent:-150},zoombox:{width:1e3,path:"m1000-25l-250 251c40 63 63 138 63 218 0 224-182 406-407 406-224 0-406-182-406-406s183-406 407-406c80 0 155 22 218 62l250-250 125 125z m-812 250l0 438 437 0 0-438-437 0z m62 375l313 0 0-312-313 0 0 312z",ascent:850,descent:-150},pan:{width:1e3,path:"m1000 350l-187 188 0-125-250 0 0 250 125 0-188 187-187-187 125 0 0-250-250 0 0 125-188-188 186-187 0 125 252 0 0-250-125 0 187-188 188 188-125 0 0 250 250 0 0-126 187 188z",ascent:850,descent:-150},zoom_plus:{width:1e3,path:"m1 787l0-875 875 0 0 875-875 0z m687-500l-187 0 0-187-125 0 0 187-188 0 0 125 188 0 0 187 125 0 0-187 187 0 0-125z",ascent:850,descent:-150},zoom_minus:{width:1e3,path:"m0 788l0-876 875 0 0 876-875 0z m688-500l-500 0 0 125 500 0 0-125z",ascent:850,descent:-150},autoscale:{width:1e3,path:"m250 850l-187 0-63 0 0-62 0-188 63 0 0 188 187 0 0 62z m688 0l-188 0 0-62 188 0 0-188 62 0 0 188 0 62-62 0z m-875-938l0 188-63 0 0-188 0-62 63 0 187 0 0 62-187 0z m875 188l0-188-188 0 0-62 188 0 62 0 0 62 0 188-62 0z m-125 188l-1 0-93-94-156 156 156 156 92-93 2 0 0 250-250 0 0-2 93-92-156-156-156 156 94 92 0 2-250 0 0-250 0 0 93 93 157-156-157-156-93 94 0 0 0-250 250 0 0 0-94 93 156 157 156-157-93-93 0 0 250 0 0 250z",ascent:850,descent:-150},tooltip_basic:{width:1500,path:"m375 725l0 0-375-375 375-374 0-1 1125 0 0 750-1125 0z",ascent:850,descent:-150},tooltip_compare:{width:1125,path:"m187 786l0 2-187-188 188-187 0 0 937 0 0 373-938 0z m0-499l0 1-187-188 188-188 0 0 937 0 0 376-938-1z",ascent:850,descent:-150},plotlylogo:{width:1542,path:"m0-10h182v-140h-182v140z m228 146h183v-286h-183v286z m225 714h182v-1000h-182v1000z m225-285h182v-715h-182v715z m225 142h183v-857h-183v857z m231-428h182v-429h-182v429z m225-291h183v-138h-183v138z",ascent:850,descent:-150},"z-axis":{width:1e3,path:"m833 5l-17 108v41l-130-65 130-66c0 0 0 38 0 39 0-1 36-14 39-25 4-15-6-22-16-30-15-12-39-16-56-20-90-22-187-23-279-23-261 0-341 34-353 59 3 60 228 110 228 110-140-8-351-35-351-116 0-120 293-142 474-142 155 0 477 22 477 142 0 50-74 79-163 96z m-374 94c-58-5-99-21-99-40 0-24 65-43 144-43 79 0 143 19 143 43 0 19-42 34-98 40v216h87l-132 135-133-135h88v-216z m167 515h-136v1c16 16 31 34 46 52l84 109v54h-230v-71h124v-1c-16-17-28-32-44-51l-89-114v-51h245v72z",ascent:850,descent:-150},"3d_rotate":{width:1e3,path:"m922 660c-5 4-9 7-14 11-359 263-580-31-580-31l-102 28 58-400c0 1 1 1 2 2 118 108 351 249 351 249s-62 27-100 42c88 83 222 183 347 122 16-8 30-17 44-27-2 1-4 2-6 4z m36-329c0 0 64 229-88 296-62 27-124 14-175-11 157-78 225-208 249-266 8-19 11-31 11-31 2 5 6 15 11 32-5-13-8-20-8-20z m-775-239c70-31 117-50 198-32-121 80-199 346-199 346l-96-15-58-12c0 0 55-226 155-287z m603 133l-317-139c0 0 4-4 19-14 7-5 24-15 24-15s-177-147-389 4c235-287 536-112 536-112l31-22 100 299-4-1z m-298-153c6-4 14-9 24-15 0 0-17 10-24 15z",ascent:850,descent:-150},camera:{width:1e3,path:"m500 450c-83 0-150-67-150-150 0-83 67-150 150-150 83 0 150 67 150 150 0 83-67 150-150 150z m400 150h-120c-16 0-34 13-39 29l-31 93c-6 15-23 28-40 28h-340c-16 0-34-13-39-28l-31-94c-6-15-23-28-40-28h-120c-55 0-100-45-100-100v-450c0-55 45-100 100-100h800c55 0 100 45 100 100v450c0 55-45 100-100 100z m-400-550c-138 0-250 112-250 250 0 138 112 250 250 250 138 0 250-112 250-250 0-138-112-250-250-250z m365 380c-19 0-35 16-35 35 0 19 16 35 35 35 19 0 35-16 35-35 0-19-16-35-35-35z",ascent:850,descent:-150},movie:{width:1e3,path:"m938 413l-188-125c0 37-17 71-44 94 64 38 107 107 107 187 0 121-98 219-219 219-121 0-219-98-219-219 0-61 25-117 66-156h-115c30 33 49 76 49 125 0 103-84 187-187 187s-188-84-188-187c0-57 26-107 65-141-38-22-65-62-65-109v-250c0-70 56-126 125-126h500c69 0 125 56 125 126l188-126c34 0 62 28 62 63v375c0 35-28 63-62 63z m-750 0c-69 0-125 56-125 125s56 125 125 125 125-56 125-125-56-125-125-125z m406-1c-87 0-157 70-157 157 0 86 70 156 157 156s156-70 156-156-70-157-156-157z",ascent:850,descent:-150},question:{width:857.1,path:"m500 82v107q0 8-5 13t-13 5h-107q-8 0-13-5t-5-13v-107q0-8 5-13t13-5h107q8 0 13 5t5 13z m143 375q0 49-31 91t-77 65-95 23q-136 0-207-119-9-14 4-24l74-55q4-4 10-4 9 0 14 7 30 38 48 51 19 14 48 14 27 0 48-15t21-33q0-21-11-34t-38-25q-35-16-65-48t-29-70v-20q0-8 5-13t13-5h107q8 0 13 5t5 13q0 10 12 27t30 28q18 10 28 16t25 19 25 27 16 34 7 45z m214-107q0-117-57-215t-156-156-215-58-216 58-155 156-58 215 58 215 155 156 216 58 215-58 156-156 57-215z",ascent:850,descent:-150},disk:{width:857.1,path:"m214-7h429v214h-429v-214z m500 0h72v500q0 8-6 21t-11 20l-157 156q-5 6-19 12t-22 5v-232q0-22-15-38t-38-16h-322q-22 0-37 16t-16 38v232h-72v-714h72v232q0 22 16 38t37 16h465q22 0 38-16t15-38v-232z m-214 518v178q0 8-5 13t-13 5h-107q-7 0-13-5t-5-13v-178q0-8 5-13t13-5h107q7 0 13 5t5 13z m357-18v-518q0-22-15-38t-38-16h-750q-23 0-38 16t-16 38v750q0 22 16 38t38 16h517q23 0 50-12t42-26l156-157q16-15 27-42t11-49z",ascent:850,descent:-150},lasso:{width:1031,path:"m1018 538c-36 207-290 336-568 286-277-48-473-256-436-463 10-57 36-108 76-151-13-66 11-137 68-183 34-28 75-41 114-42l-55-70 0 0c-2-1-3-2-4-3-10-14-8-34 5-45 14-11 34-8 45 4 1 1 2 3 2 5l0 0 113 140c16 11 31 24 45 40 4 3 6 7 8 11 48-3 100 0 151 9 278 48 473 255 436 462z m-624-379c-80 14-149 48-197 96 42 42 109 47 156 9 33-26 47-66 41-105z m-187-74c-19 16-33 37-39 60 50-32 109-55 174-68-42-25-95-24-135 8z m360 75c-34-7-69-9-102-8 8 62-16 128-68 170-73 59-175 54-244-5-9 20-16 40-20 61-28 159 121 317 333 354s407-60 434-217c28-159-121-318-333-355z",ascent:850,descent:-150},selectbox:{width:1e3,path:"m0 850l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-285l0-143 143 0 0 143-143 0z m857 0l0-143 143 0 0 143-143 0z m-857-286l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z m285 0l0-143 143 0 0 143-143 0z m286 0l0-143 143 0 0 143-143 0z",ascent:850,descent:-150},spikeline:{width:1e3,path:"M512 409c0-57-46-104-103-104-57 0-104 47-104 104 0 57 47 103 104 103 57 0 103-46 103-103z m-327-39l92 0 0 92-92 0z m-185 0l92 0 0 92-92 0z m370-186l92 0 0 93-92 0z m0-184l92 0 0 92-92 0z",ascent:850,descent:-150}}},{}],3:[function(t,e,r){"use strict";e.exports=t("../src/transforms/aggregate")},{"../src/transforms/aggregate":1150}],4:[function(t,e,r){"use strict";e.exports=t("../src/traces/bar")},{"../src/traces/bar":875}],5:[function(t,e,r){"use strict";e.exports=t("../src/traces/box")},{"../src/traces/box":888}],6:[function(t,e,r){"use strict";e.exports=t("../src/components/calendars")},{"../src/components/calendars":611}],7:[function(t,e,r){"use strict";e.exports=t("../src/traces/candlestick")},{"../src/traces/candlestick":897}],8:[function(t,e,r){"use strict";e.exports=t("../src/traces/carpet")},{"../src/traces/carpet":918}],9:[function(t,e,r){"use strict";e.exports=t("../src/traces/choropleth")},{"../src/traces/choropleth":933}],10:[function(t,e,r){"use strict";e.exports=t("../src/traces/contour")},{"../src/traces/contour":946}],11:[function(t,e,r){"use strict";e.exports=t("../src/traces/contourcarpet")},{"../src/traces/contourcarpet":961}],12:[function(t,e,r){"use strict";e.exports=t("../src/core")},{"../src/core":720}],13:[function(t,e,r){"use strict";e.exports=t("../src/transforms/filter")},{"../src/transforms/filter":1151}],14:[function(t,e,r){"use strict";e.exports=t("../src/transforms/groupby")},{"../src/transforms/groupby":1152}],15:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmap")},{"../src/traces/heatmap":974}],16:[function(t,e,r){"use strict";e.exports=t("../src/traces/heatmapgl")},{"../src/traces/heatmapgl":984}],17:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram")},{"../src/traces/histogram":995}],18:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2d")},{"../src/traces/histogram2d":1001}],19:[function(t,e,r){"use strict";e.exports=t("../src/traces/histogram2dcontour")},{"../src/traces/histogram2dcontour":1005}],20:[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("./pie"),t("./contour"),t("./scatterternary"),t("./violin"),t("./scatter3d"),t("./surface"),t("./mesh3d"),t("./scattergeo"),t("./choropleth"),t("./scattergl"),t("./pointcloud"),t("./heatmapgl"),t("./parcoords"),t("./scattermapbox"),t("./sankey"),t("./table"),t("./carpet"),t("./scattercarpet"),t("./contourcarpet"),t("./ohlc"),t("./candlestick")]),n.register([t("./aggregate"),t("./filter"),t("./groupby"),t("./sort")]),n.register([t("./calendars")]),e.exports=n},{"./aggregate":3,"./bar":4,"./box":5,"./calendars":6,"./candlestick":7,"./carpet":8,"./choropleth":9,"./contour":10,"./contourcarpet":11,"./core":12,"./filter":13,"./groupby":14,"./heatmap":15,"./heatmapgl":16,"./histogram":17,"./histogram2d":18,"./histogram2dcontour":19,"./mesh3d":21,"./ohlc":22,"./parcoords":23,"./pie":24,"./pointcloud":25,"./sankey":26,"./scatter3d":27,"./scattercarpet":28,"./scattergeo":29,"./scattergl":30,"./scattermapbox":31,"./scatterternary":32,"./sort":33,"./surface":34,"./table":35,"./violin":36}],21:[function(t,e,r){"use strict";e.exports=t("../src/traces/mesh3d")},{"../src/traces/mesh3d":1011}],22:[function(t,e,r){"use strict";e.exports=t("../src/traces/ohlc")},{"../src/traces/ohlc":1016}],23:[function(t,e,r){"use strict";e.exports=t("../src/traces/parcoords")},{"../src/traces/parcoords":1025}],24:[function(t,e,r){"use strict";e.exports=t("../src/traces/pie")},{"../src/traces/pie":1035}],25:[function(t,e,r){"use strict";e.exports=t("../src/traces/pointcloud")},{"../src/traces/pointcloud":1044}],26:[function(t,e,r){"use strict";e.exports=t("../src/traces/sankey")},{"../src/traces/sankey":1050}],27:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatter3d")},{"../src/traces/scatter3d":1084}],28:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattercarpet")},{"../src/traces/scattercarpet":1090}],29:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergeo")},{"../src/traces/scattergeo":1098}],30:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattergl")},{"../src/traces/scattergl":1106}],31:[function(t,e,r){"use strict";e.exports=t("../src/traces/scattermapbox")},{"../src/traces/scattermapbox":1113}],32:[function(t,e,r){"use strict";e.exports=t("../src/traces/scatterternary")},{"../src/traces/scatterternary":1121}],33:[function(t,e,r){"use strict";e.exports=t("../src/transforms/sort")},{"../src/transforms/sort":1154}],34:[function(t,e,r){"use strict";e.exports=t("../src/traces/surface")},{"../src/traces/surface":1129}],35:[function(t,e,r){"use strict";e.exports=t("../src/traces/table")},{"../src/traces/table":1137}],36:[function(t,e,r){"use strict";e.exports=t("../src/traces/violin")},{"../src/traces/violin":1144}],37:[function(t,e,r){"use strict";e.exports=function(t,e){function r(e,r,i,a){var o=1/t.clientHeight,s=o*(r-m),l=o*(i-g),u=p.flipX?1:-1,f=p.flipY?1:-1,d=Math.PI*p.rotateSpeed,y=n();if(1&e)a.shift?c.rotate(y,0,0,-s*d):c.rotate(y,u*d*s,-f*d*l,0);else if(2&e)c.pan(y,-p.translateSpeed*s*h,p.translateSpeed*l*h,0);else if(4&e){var b=p.zoomSpeed*l/window.innerHeight*(y-c.lastT())*50;c.pan(y,0,0,h*(Math.exp(b)-1))}m=r,g=i,v=a}t=t||document.body;var l=[.01,1/0];"distanceLimits"in(e=e||{})&&(l[0]=e.distanceLimits[0],l[1]=e.distanceLimits[1]),"zoomMin"in e&&(l[0]=e.zoomMin),"zoomMax"in e&&(l[1]=e.zoomMax);var c=i({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:l}),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0,f=t.clientWidth,d=t.clientHeight,p={view:c,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:c.modes,tick:function(){var e=n(),r=this.delay;c.idle(e-r),c.flush(e-(100+2*r));var i=e-2*r;c.recalcMatrix(i);for(var a=!0,o=c.computedMatrix,s=0;s<16;++s)a=a&&u[s]===o[s],u[s]=o[s];var l=t.clientWidth===f&&t.clientHeight===d;return f=t.clientWidth,d=t.clientHeight,a?!l:(h=Math.exp(c.computedRadius[0]),!0)},lookAt:function(t,e,r){c.lookAt(c.lastT(),t,e,r)},rotate:function(t,e,r){c.rotate(c.lastT(),t,e,r)},pan:function(t,e,r){c.pan(c.lastT(),t,e,r)},translate:function(t,e,r){c.translate(c.lastT(),t,e,r)}};Object.defineProperties(p,{matrix:{get:function(){return c.computedMatrix},set:function(t){return c.setMatrix(c.lastT(),t),c.computedMatrix},enumerable:!0},mode:{get:function(){return c.getMode()},set:function(t){return c.setMode(t),c.getMode()},enumerable:!0},center:{get:function(){return c.computedCenter},set:function(t){return c.lookAt(c.lastT(),t),c.computedCenter},enumerable:!0},eye:{get:function(){return c.computedEye},set:function(t){return c.lookAt(c.lastT(),null,t),c.computedEye},enumerable:!0},up:{get:function(){return c.computedUp},set:function(t){return c.lookAt(c.lastT(),null,null,t),c.computedUp},enumerable:!0},distance:{get:function(){return h},set:function(t){return c.setDistance(c.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return c.getDistanceLimits(l)},set:function(t){return c.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var m=0,g=0,v={shift:!1,control:!1,alt:!1,meta:!1};return a(t,r),t.addEventListener("touchstart",function(e){var n=s(e.changedTouches[0],t);r(0,n[0],n[1],v),r(1,n[0],n[1],v)}),t.addEventListener("touchmove",function(e){var n=s(e.changedTouches[0],t);r(1,n[0],n[1],v)}),t.addEventListener("touchend",function(e){s(e.changedTouches[0],t),r(0,m,g,v)}),o(t,function(t,e,r){var i=p.flipX?1:-1,a=p.flipY?1:-1,o=n();if(Math.abs(t)>Math.abs(e))c.rotate(o,0,0,-t*i*Math.PI*p.rotateSpeed/window.innerWidth);else{var s=p.zoomSpeed*a*e/window.innerHeight*(o-c.lastT())/100;c.pan(o,0,0,h*(Math.exp(s)-1))}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset")},{"3d-view":38,"mouse-change":453,"mouse-event-offset":454,"mouse-wheel":456,"right-now":511}],38:[function(t,e,r){"use strict";function n(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}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=i(),h=a(),f=o();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 n({turntable:u,orbit:h,matrix:f},c)};var i=t("turntable-camera-controller"),a=t("orbit-camera-controller"),o=t("matrix-camera-controller"),s=n.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;n<t[1];++n)r.push("a"+n);var i="var cc=this._controllerList;for(var i=0;i<cc.length;++i){cc[i]."+t[0]+"("+r.join()+")}";s[e]=Function.apply(null,r.concat(i))}),s.recalcMatrix=function(t){this._active.recalcMatrix(t)},s.getDistance=function(t){return this._active.getDistance(t)},s.getDistanceLimits=function(t){return this._active.getDistanceLimits(t)},s.lastT=function(){return this._active.lastT()},s.setMode=function(t){if(t!==this._mode){var e=this._controllerNames.indexOf(t);if(!(e<0)){var r=this._active,n=this._controllerList[e],i=Math.max(r.lastT(),n.lastT());r.recalcMatrix(i),n.setMatrix(i,r.computedMatrix),this._active=n,this._mode=t,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}}},s.getMode=function(){return this._mode}},{"matrix-camera-controller":451,"orbit-camera-controller":474,"turntable-camera-controller":547}],39:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-array"),t("d3-collection"),t("d3-interpolate")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3)}(this,function(t,e,r,n){"use strict";t.sankey=function(){function t(){for(var t,e=f,r=0;e.length;)t=[],e.forEach(function(e){e.x=r,e.dx=c,e.sourceLinks.forEach(function(e){t.indexOf(e.target)<0&&t.push(e.target)})}),e=t,++r;!function(t){f.forEach(function(e){e.sourceLinks.length||(e.x=t-1)})}(r),function(t){f.forEach(function(e){e.x*=t})}((h[0]-c)/(r-1))}function i(t){function n(){a.forEach(function(t){var e,r,n,a=0,o=t.length;for(t.sort(i),n=0;n<o;++n)(r=a-(e=t[n]).y)>0&&(e.y+=r),a=e.y+e.dy+u;if((r=a-u-h[1])>0)for(a=e.y-=r,n=o-2;n>=0;--n)(r=(e=t[n]).y+e.dy+u-a)>0&&(e.y-=r),a=e.y})}function i(t,e){return t.y-e.y}var a=r.nest().key(function(t){return t.x}).sortKeys(e.ascending).entries(f).map(function(t){return t.values});!function(){var t=e.min(a,function(t){return(h[1]-(t.length-1)*u)/e.sum(t,s)});a.forEach(function(e){e.forEach(function(e,r){e.y=r,e.dy=e.value*t})}),d.forEach(function(e){e.dy=e.value*t})}(),n();for(var l=1;t>0;--t)!function(t){function r(t){return o(t.target)*t.value}a.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var i=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,s);n.y+=(i-o(n))*t}})})}(l*=.99),n(),function(t){function r(t){return o(t.source)*t.value}a.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var i=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,s);n.y+=(i-o(n))*t}})})}(l),n()}function a(){function t(t,e){return t.source.y-e.source.y||t.originalIndex-e.originalIndex}function e(t,e){return t.target.y-e.target.y||t.originalIndex-e.originalIndex}f.forEach(function(r){r.sourceLinks.sort(e),r.targetLinks.sort(t)}),f.forEach(function(t){var e=0,r=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=r,r+=t.dy})})}function o(t){return t.y+t.dy/2}function s(t){return t.value}var l={},c=24,u=8,h=[1,1],f=[],d=[];return l.nodeWidth=function(t){return arguments.length?(c=+t,l):c},l.nodePadding=function(t){return arguments.length?(u=+t,l):u},l.nodes=function(t){return arguments.length?(f=t,l):f},l.links=function(t){return arguments.length?(d=t,l):d},l.size=function(t){return arguments.length?(h=t,l):h},l.layout=function(r){return f.forEach(function(t){t.sourceLinks=[],t.targetLinks=[]}),d.forEach(function(t,e){var r=t.source,n=t.target;"number"==typeof r&&(r=t.source=f[t.source]),"number"==typeof n&&(n=t.target=f[t.target]),t.originalIndex=e,r.sourceLinks.push(t),n.targetLinks.push(t)}),f.forEach(function(t){t.value=Math.max(e.sum(t.sourceLinks,s),e.sum(t.targetLinks,s))}),t(),i(r),a(),l},l.relayout=function(){return a(),l},l.link=function(){function t(t){var r=t.source.x+t.source.dx,i=t.target.x,a=n.interpolateNumber(r,i),o=a(e),s=a(1-e),l=t.source.y+t.sy,c=l+t.dy,u=t.target.y+t.ty,h=u+t.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+u+" "+i+","+u+"L"+i+","+h+"C"+s+","+h+" "+o+","+c+" "+r+","+c+"Z"}var e=.5;return t.curvature=function(r){return arguments.length?(e=+r,t):e},t},l},Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-array":115,"d3-collection":116,"d3-interpolate":120}],40:[function(t,e,r){"use strict";var n="undefined"==typeof WeakMap?t("weak-map"):WeakMap,i=t("gl-buffer"),a=t("gl-vao"),o=new n;e.exports=function(t){var e=o.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=i(t,new Float32Array([-1,-1,-1,4,4,-1]));(e=a(t,[{buffer:n,type:t.FLOAT,size:2}]))._triangleBuffer=n,o.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()}},{"gl-buffer":157,"gl-vao":272,"weak-map":568}],41:[function(t,e,r){var n=t("pad-left");e.exports=function(t,e,r){e="number"==typeof e?e:1,r=r||": ";var i=t.split(/\r?\n/),a=String(i.length+e-1).length;return i.map(function(t,i){var o=i+e,s=String(o).length;return n(o,a-s)+r+t}).join("\n")}},{"pad-left":475}],42:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(e+1),n=0;n<t.length;++n)r[n]=t[n];for(n=0;n<=t.length;++n){for(var a=t.length;a<=e;++a){for(var o=new Array(e),s=0;s<e;++s)o[s]=Math.pow(a+1-n,s);r[a]=o}if(i.apply(void 0,r))return!0}return!1}e.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[0];for(var r=t[0].length,i=[t[0]],a=[0],o=1;o<e;++o)if(i.push(t[o]),n(i,r)){if(a.push(o),a.length===r+1)return a}else i.pop();return a};var i=t("robust-orientation")},{"robust-orientation":517}],43:[function(t,e,r){"use strict";e.exports=function(t,e){return n(e).filter(function(r){for(var n=new Array(r.length),a=0;a<r.length;++a)n[a]=e[r[a]];return i(n)*t<1})};var n=t("delaunay-triangulate"),i=t("circumradius")},{circumradius:88,"delaunay-triangulate":124}],44:[function(t,e,r){e.exports=function(t,e){return i(n(t,e))};var n=t("alpha-complex"),i=t("simplicial-complex-boundary")},{"alpha-complex":43,"simplicial-complex-boundary":525}],45:[function(t,e,r){"use strict";e.exports=function(t,e){if(!t||null==t.length)throw Error("Argument should be an array");e=null==e?1:Math.floor(e);for(var r=Array(2*e),n=0;n<e;n++){for(var i=-1/0,a=1/0,o=n,s=t.length;o<s;o+=e)t[o]>i&&(i=t[o]),t[o]<a&&(a=t[o]);r[n]=a,r[e+n]=i}return r}},{}],46:[function(t,e,r){"use strict";var n=t("array-bounds");e.exports=function(t,e,r){if(!t||null==t.length)throw Error("Argument should be an array");null==e&&(e=1),null==r&&(r=n(t,e));for(var i=0;i<e;i++){var a=r[e+i],o=r[i],s=i,l=t.length;if(a===1/0&&o===-1/0)for(s=i;s<l;s+=e)t[s]=t[s]===a?1:t[s]===o?0:.5;else if(a===1/0)for(s=i;s<l;s+=e)t[s]=t[s]===a?1:0;else if(o===-1/0)for(s=i;s<l;s+=e)t[s]=t[s]===o?0:1;else{var c=a-o;for(s=i;s<l;s+=e)t[s]=(t[s]-o)/c}}return t}},{"array-bounds":45}],47:[function(t,e,r){"use strict";e.exports=function(){var t={},e=/^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(,.*)?\)$/,r=/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,?\s*(.*)?\)$/;return t.isPlainObject=function(t){return!Array.isArray(t)&&null!==t&&"object"==typeof t},t.linspace=function(t,e,r){for(var n=(e-t)/Math.max(r-1,1),i=[],a=0;a<r;a++)i.push(t+a*n);return i},t.zip3=function(t,e,r){for(var n=Math.min.apply(null,[t.length,e.length,r.length]),i=[],a=0;a<n;a++)i.push([t[a],e[a],r[a]]);return i},t.sum=function(t){function e(t){for(var n=0;n<t.length;n++)Array.isArray(t[n])?e(t[n]):r+=t[n]}var r=0;return e(t),r},t.zip=function(){for(var t=[].slice.call(arguments),e=t.map(function(t){return t.length}),r=Math.min.apply(null,e),n=[],i=0;i<r;i++){n[i]=[];for(var a=0;a<t.length;++a)n[i][a]=t[a][i]}return n},t.isEqual=function(t,e){if(t.length!==e.length)return!1;for(var r=t.length;r--;)if(t[r]!==e[r])return!1;return!0},t.copy2D=function(t){for(var e=[],r=0;r<t.length;++r){e[r]=[];for(var n=0;n<t[r].length;++n)e[r][n]=t[r][n]}return e},t.copy1D=function(t){for(var e=[],r=0;r<t.length;++r)e[r]=t[r];return e},t.str2RgbArray=function(t,n){var i,a;if("string"!=typeof t)return t;if(i=[],"#"===t[0]?(3===(t=t.substr(1)).length&&(t+=t),a=parseInt(t,16),i[0]=a>>16&255,i[1]=a>>8&255,i[2]=255&a):e.test(t)&&(a=t.match(r),i[0]=parseInt(a[1]),i[1]=parseInt(a[2]),i[2]=parseInt(a[3])),!n)for(var o=0;o<3;++o)i[o]=i[o]/255;return i},t.str2RgbaArray=function(t,n){var i,a;if("string"!=typeof t)return t;if(i=[],"#"===t[0]?(3===(t=t.substr(1)).length&&(t+=t),a=parseInt(t,16),i[0]=a>>16&255,i[1]=a>>8&255,i[2]=255&a):e.test(t)&&(a=t.match(r),i[0]=parseInt(a[1]),i[1]=parseInt(a[2]),i[2]=parseInt(a[3]),a[4]?i[3]=parseFloat(a[4]):i[3]=1),!n)for(var o=0;o<3;++o)i[o]=i[o]/255;return i},t}()},{}],48:[function(t,e,r){(function(r){"use strict";function n(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i<a;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0}function i(t){return r.Buffer&&"function"==typeof r.Buffer.isBuffer?r.Buffer.isBuffer(t):!(null==t||!t._isBuffer)}function a(t){return Object.prototype.toString.call(t)}function o(t){return!i(t)&&("function"==typeof r.ArrayBuffer&&("function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(t):!!t&&(t instanceof DataView||!!(t.buffer&&t.buffer instanceof ArrayBuffer))))}function s(t){if(v.isFunction(t)){if(x)return t.name;var e=t.toString().match(w);return e&&e[1]}}function l(t,e){return"string"==typeof t?t.length<e?t:t.slice(0,e):t}function c(t){if(x||!v.isFunction(t))return v.inspect(t);var e=s(t);return"[Function"+(e?": "+e:"")+"]"}function u(t,e,r,n,i){throw new _.AssertionError({message:r,actual:t,expected:e,operator:n,stackStartFunction:i})}function h(t,e){t||u(t,!0,e,"==",_.ok)}function f(t,e,r,s){if(t===e)return!0;if(i(t)&&i(e))return 0===n(t,e);if(v.isDate(t)&&v.isDate(e))return t.getTime()===e.getTime();if(v.isRegExp(t)&&v.isRegExp(e))return t.source===e.source&&t.global===e.global&&t.multiline===e.multiline&&t.lastIndex===e.lastIndex&&t.ignoreCase===e.ignoreCase;if(null!==t&&"object"==typeof t||null!==e&&"object"==typeof e){if(o(t)&&o(e)&&a(t)===a(e)&&!(t instanceof Float32Array||t instanceof Float64Array))return 0===n(new Uint8Array(t.buffer),new Uint8Array(e.buffer));if(i(t)!==i(e))return!1;var l=(s=s||{actual:[],expected:[]}).actual.indexOf(t);return-1!==l&&l===s.expected.indexOf(e)||(s.actual.push(t),s.expected.push(e),function(t,e,r,n){if(null===t||void 0===t||null===e||void 0===e)return!1;if(v.isPrimitive(t)||v.isPrimitive(e))return t===e;if(r&&Object.getPrototypeOf(t)!==Object.getPrototypeOf(e))return!1;var i=d(t),a=d(e);if(i&&!a||!i&&a)return!1;if(i)return t=b.call(t),e=b.call(e),f(t,e,r);var o,s,l=M(t),c=M(e);if(l.length!==c.length)return!1;for(l.sort(),c.sort(),s=l.length-1;s>=0;s--)if(l[s]!==c[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!f(t[o],e[o],r,n))return!1;return!0}(t,e,r,s))}return r?t===e:t==e}function d(t){return"[object Arguments]"==Object.prototype.toString.call(t)}function p(t,e,r){f(t,e,!0)&&u(t,e,r,"notDeepStrictEqual",p)}function m(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 g(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&&u(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!t&&v.isError(i),s=!t&&i&&!r;if((o&&a&&m(i,r)||s)&&u(i,r,"Got unwanted exception"+n),t&&i&&r&&!m(i,r)||!t&&i)throw i}var v=t("util/"),y=Object.prototype.hasOwnProperty,b=Array.prototype.slice,x="foo"===function(){}.name,_=e.exports=h,w=/\s*function\s+([^\(\s]*)\s*/;_.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 l(c(t.actual),128)+" "+t.operator+" "+l(c(t.expected),128)}(this),this.generatedMessage=!0);var e=t.stackStartFunction||u;if(Error.captureStackTrace)Error.captureStackTrace(this,e);else{var r=new Error;if(r.stack){var n=r.stack,i=s(e),a=n.indexOf("\n"+i);if(a>=0){var o=n.indexOf("\n",a+1);n=n.substring(o+1)}this.stack=n}}},v.inherits(_.AssertionError,Error),_.fail=u,_.ok=h,_.equal=function(t,e,r){t!=e&&u(t,e,r,"==",_.equal)},_.notEqual=function(t,e,r){t==e&&u(t,e,r,"!=",_.notEqual)},_.deepEqual=function(t,e,r){f(t,e,!1)||u(t,e,r,"deepEqual",_.deepEqual)},_.deepStrictEqual=function(t,e,r){f(t,e,!0)||u(t,e,r,"deepStrictEqual",_.deepStrictEqual)},_.notDeepEqual=function(t,e,r){f(t,e,!1)&&u(t,e,r,"notDeepEqual",_.notDeepEqual)},_.notDeepStrictEqual=p,_.strictEqual=function(t,e,r){t!==e&&u(t,e,r,"===",_.strictEqual)},_.notStrictEqual=function(t,e,r){t===e&&u(t,e,r,"!==",_.notStrictEqual)},_.throws=function(t,e,r){g(!0,t,e,r)},_.doesNotThrow=function(t,e,r){g(!1,t,e,r)},_.ifError=function(t){if(t)throw t};var M=Object.keys||function(t){var e=[];for(var r in t)y.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"util/":558}],49:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],50:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r<t.length;++r)e+=t[r];return e}e.exports=function(t,e){for(var r=e.length,a=new Array(r+1),o=0;o<r;++o){for(var s=new Array(r+1),l=0;l<=r;++l)s[l]=t[l][o];a[o]=s}for(a[r]=new Array(r+1),o=0;o<=r;++o)a[r][o]=1;var c=new Array(r+1);for(o=0;o<r;++o)c[o]=e[o];c[r]=1;var u=i(a,c),h=n(u[r+1]);0===h&&(h=1);var f=new Array(r+1);for(o=0;o<=r;++o)f[o]=n(u[o])/h;return f};var i=t("robust-linear-solve")},{"robust-linear-solve":516}],51:[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":61}],52:[function(t,e,r){"use strict";e.exports=function(t,e){return t[0].mul(e[1]).cmp(e[0].mul(t[1]))}},{}],53:[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":61}],54:[function(t,e,r){"use strict";function n(t,e){if(i(t))return e?c(t,n(e)):[t[0].clone(),t[1].clone()];var r,u,h=0;if(a(t))r=t.clone();else if("string"==typeof t)r=s(t);else{if(0===t)return[o(0),o(1)];if(t===Math.floor(t))r=o(t);else{for(;t!==Math.floor(t);)t*=Math.pow(2,256),h-=256;r=o(t)}}if(i(e))r.mul(e[1]),u=e[0].clone();else if(a(e))u=e.clone();else if("string"==typeof e)u=s(e);else if(e)if(e===Math.floor(e))u=o(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),h+=256;u=o(e)}else u=o(1);return h>0?r=r.ushln(h):h<0&&(u=u.ushln(-h)),l(r,u)}var i=t("./is-rat"),a=t("./lib/is-bn"),o=t("./lib/num-to-bn"),s=t("./lib/str-to-bn"),l=t("./lib/rationalize"),c=t("./div");e.exports=n},{"./div":53,"./is-rat":55,"./lib/is-bn":59,"./lib/num-to-bn":60,"./lib/rationalize":61,"./lib/str-to-bn":62}],55:[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":59}],56:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":69}],57:[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;a<e;a++)i+=r[a]*Math.pow(67108864,a);return n(t)*i}},{"./bn-sign":56}],58:[function(t,e,r){"use strict";var n=t("double-bits"),i=t("bit-twiddle").countTrailingZeros;e.exports=function(t){var e=i(n.lo(t));if(e<32)return e;var r=i(n.hi(t));return r>20?52:r+32}},{"bit-twiddle":68,"double-bits":125}],59:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":69}],60:[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":69,"double-bits":125}],61:[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);return o.cmpn(1)?[t.div(o),e.div(o)]:[t,e]}},{"./bn-sign":56,"./num-to-bn":60}],62:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":69}],63:[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":61}],64:[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":56}],65:[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":61}],66:[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;return c*(s+(f=n(l.ushln(u).divRound(r)))*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":57,"./lib/ctz":58}],67:[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)}},{}],68:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t<e)},r.max=function(t,e){return t^(t^e)&-(t<e)},r.isPow2=function(t){return!(t&t-1||!t)},r.log2=function(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,(e|=r)|t>>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 t-=t>>>1&1431655765,16843009*((t=(858993459&t)+(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<<i&255}}(i),r.reverse=function(t){return i[255&t]<<24|i[t>>>8&255]<<16|i[t>>>16&255]<<8|i[t>>>24&255]},r.interleave2=function(t,e){return t&=65535,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e&=65535,e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1},r.deinterleave2=function(t,e){return t=t>>>e&1431655765,t=858993459&(t|t>>>1),t=252645135&(t|t>>>2),t=16711935&(t|t>>>4),(t=65535&(t|t>>>16))<<16>>16},r.interleave3=function(t,e,r){return t&=1023,t=4278190335&(t|t<<16),t=251719695&(t|t<<8),t=3272356035&(t|t<<4),t=1227133513&(t|t<<2),e&=1023,e=4278190335&(e|e<<16),e=251719695&(e|e<<8),e=3272356035&(e|e<<4),e=1227133513&(e|e<<2),t|=e<<1,r&=1023,r=4278190335&(r|r<<16),r=251719695&(r|r<<8),r=3272356035&(r|r<<4),r=1227133513&(r|r<<2),t|r<<2},r.deinterleave3=function(t,e){return t=t>>>e&1227133513,t=3272356035&(t|t>>>2),t=251719695&(t|t>>>4),t=4278190335&(t|t>>>8),(t=1023&(t|t>>>16))<<22>>22},r.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>n(t)+1}},{}],69:[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"))}function o(t,e,r){for(var n=0,i=Math.min(t.length,r),a=e;a<i;a++){var o=t.charCodeAt(a)-48;n<<=4,n|=o>=49&&o<=54?o-49+10:o>=17&&o<=22?o-17+10:15&o}return n}function s(t,e,r,n){for(var i=0,a=Math.min(t.length,r),o=e;o<a;o++){var s=t.charCodeAt(o)-48;i*=n,i+=s>=49?s-49+10:s>=17?s-17+10:s}return i}function l(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<n;c++){for(var u=l>>>26,h=67108863&l,f=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=f;d++){var p=c-d|0;u+=(o=(i=0|t.words[p])*(a=0|e.words[d])+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()}function c(t,e,r){return(new u).mulp(t,e,r)}function u(t,e){this.x=t,this.y=e}function h(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 f(){h.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){h.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){h.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){h.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function g(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 v(t){g.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)}"object"==typeof e?e.exports=a:r.BN=a,a.BN=a,a.wordSize=26;var y;try{y=t("buffer").Buffer}catch(t){}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<this.length;i++)this.words[i]=0;var a,o,s=0;if("be"===r)for(i=t.length-1,a=0;i>=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i<t.length;i+=3)o=t[i]|t[i+1]<<8|t[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>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<this.length;r++)this.words[r]=0;var n,i,a=0;for(r=t.length-6,n=0;r>=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<<a&67108863,this.words[n+1]|=i>>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<<a&67108863,this.words[n+1]|=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,l=Math.min(a,a-o)+r,c=0,u=r;u<l;u+=n)c=s(t,u,u+n,e),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var h=1;for(c=s(t,u,t.length,e),u=0;u<o;u++)h*=e;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}},a.prototype.copy=function(t){t.words=new Array(this.length);for(var e=0;e<this.length;e++)t.words[e]=this.words[e];t.length=this.length,t.negative=this.negative,t.red=this.red},a.prototype.clone=function(){var t=new a(null);return this.copy(t),t},a.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},a.prototype.strip=function(){for(;this.length>1&&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?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var b=["","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"],x=[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],_=[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];a.prototype.toString=function(t,e){t=t||10,e=0|e||1;var r;if(16===t||"hex"===t){r="";for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],l=(16777215&(s<<i|a)).toString(16);r=0!==(a=s>>>24-i&16777215)||o!==this.length-1?b[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 c=x[t],u=_[t];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var f=h.modn(u).toString(t);r=(h=h.idivn(u)).isZero()?f+r:b[c-f.length]+f+r}for(this.isZero()&&(r="0"+r);r.length%e!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},a.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},a.prototype.toJSON=function(){return this.toString(16)},a.prototype.toBuffer=function(t,e){return n(void 0!==y),this.toArrayLike(y,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<a;s++)c[s]=0}else{for(s=0;s<a-i;s++)c[s]=0;for(s=0;!u.isZero();s++)o=u.andln(255),u.iushrn(8),c[a-s-1]=o}return c},Math.clz32?a.prototype._countBits=function(t){return 32-Math.clz32(t)}:a.prototype._countBits=function(t){var e=t,r=0;return e>=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;e<this.length;e++){var r=this._zeroBits(this.words[e]);if(t+=r,26!==r)break}return t},a.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},a.prototype.toTwos=function(t){return 0!==this.negative?this.abs().inotn(t).iaddn(1):this.clone()},a.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},a.prototype.isNeg=function(){return 0!==this.negative},a.prototype.neg=function(){return this.clone().ineg()},a.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},a.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var e=0;e<t.length;e++)this.words[e]=this.words[e]|t.words[e];return this.strip()},a.prototype.ior=function(t){return n(0==(this.negative|t.negative)),this.iuor(t)},a.prototype.or=function(t){return this.length>t.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;r<e.length;r++)this.words[r]=this.words[r]&t.words[r];return this.length=e.length,this.strip()},a.prototype.iand=function(t){return n(0==(this.negative|t.negative)),this.iuand(t)},a.prototype.and=function(t){return this.length>t.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;n<r.length;n++)this.words[n]=e.words[n]^r.words[n];if(this!==e)for(;n<e.length;n++)this.words[n]=e.words[n];return this.length=e.length,this.strip()},a.prototype.ixor=function(t){return n(0==(this.negative|t.negative)),this.iuxor(t)},a.prototype.xor=function(t){return this.length>t.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;i<e;i++)this.words[i]=67108863&~this.words[i];return r>0&&(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<<i:this.words[r]&~(1<<i),this.strip()},a.prototype.iadd=function(t){var e;if(0!==this.negative&&0===t.negative)return this.negative=0,e=this.isub(t),this.negative^=1,this._normSign();if(0===this.negative&&0!==t.negative)return t.negative=0,e=this.isub(t),t.negative=1,e._normSign();var r,n;this.length>t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a<n.length;a++)e=(0|r.words[a])+(0|n.words[a])+i,this.words[a]=67108863&e,i=e>>>26;for(;0!==i&&a<r.length;a++)e=(0|r.words[a])+i,this.words[a]=67108863&e,i=e>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;a<r.length;a++)this.words[a]=r.words[a];return this},a.prototype.add=function(t){var e;return 0!==t.negative&&0===this.negative?(t.negative=0,e=this.sub(t),t.negative^=1,e):0===t.negative&&0!==this.negative?(this.negative=0,e=t.sub(this),this.negative=1,e):this.length>t.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=this.cmp(t);if(0===r)return this.negative=0,this.length=1,this.words[0]=0,this;var n,i;r>0?(n=this,i=t):(n=t,i=this);for(var a=0,o=0;o<i.length;o++)a=(e=(0|n.words[o])-(0|i.words[o])+a)>>26,this.words[o]=67108863&e;for(;0!==a&&o<n.length;o++)a=(e=(0|n.words[o])+a)>>26,this.words[o]=67108863&e;if(0===a&&o<n.length&&n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this.length=Math.max(this.length,o),n!==this&&(this.negative=1),this.strip()},a.prototype.sub=function(t){return this.clone().isub(t)};var w=function(t,e,r){var n,i,a,o=t.words,s=e.words,l=r.words,c=0,u=0|o[0],h=8191&u,f=u>>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],v=8191&g,y=g>>>13,b=0|o[3],x=8191&b,_=b>>>13,w=0|o[4],M=8191&w,k=w>>>13,T=0|o[5],A=8191&T,S=T>>>13,E=0|o[6],L=8191&E,C=E>>>13,I=0|o[7],P=8191&I,D=I>>>13,z=0|o[8],O=8191&z,F=z>>>13,R=0|o[9],j=8191&R,N=R>>>13,B=0|s[0],U=8191&B,V=B>>>13,H=0|s[1],q=8191&H,G=H>>>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],ht=8191&ut,ft=ut>>>13,dt=0|s[9],pt=8191&dt,mt=dt>>>13;r.negative=t.negative^e.negative,r.length=19;var gt=(c+(n=Math.imul(h,U))|0)+((8191&(i=(i=Math.imul(h,V))+Math.imul(f,U)|0))<<13)|0;c=((a=Math.imul(f,V))+(i>>>13)|0)+(gt>>>26)|0,gt&=67108863,n=Math.imul(p,U),i=(i=Math.imul(p,V))+Math.imul(m,U)|0,a=Math.imul(m,V);var vt=(c+(n=n+Math.imul(h,q)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(f,q)|0))<<13)|0;c=((a=a+Math.imul(f,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(p,q)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,q)|0,a=a+Math.imul(m,G)|0;var yt=(c+(n=n+Math.imul(h,W)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(f,W)|0))<<13)|0;c=((a=a+Math.imul(f,X)|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(v,q)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(y,q)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,X)|0;var bt=(c+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(f,J)|0))<<13)|0;c=((a=a+Math.imul(f,K)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,V))+Math.imul(k,U)|0,a=Math.imul(k,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(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(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0;var xt=(c+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(f,$)|0))<<13)|0;c=((a=a+Math.imul(f,tt)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=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(M,q)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(k,q)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(x,W)|0,i=(i=i+Math.imul(x,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(p,$)|0,i=(i=i+Math.imul(p,tt)|0)+Math.imul(m,$)|0,a=a+Math.imul(m,tt)|0;var _t=(c+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(f,rt)|0))<<13)|0;c=((a=a+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=(i=Math.imul(L,V))+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(A,q)|0,i=(i=i+Math.imul(A,G)|0)+Math.imul(S,q)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(M,W)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(k,W)|0,a=a+Math.imul(k,X)|0,n=n+Math.imul(x,J)|0,i=(i=i+Math.imul(x,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(p,rt)|0,i=(i=i+Math.imul(p,nt)|0)+Math.imul(m,rt)|0,a=a+Math.imul(m,nt)|0;var wt=(c+(n=n+Math.imul(h,at)|0)|0)+((8191&(i=(i=i+Math.imul(h,ot)|0)+Math.imul(f,at)|0))<<13)|0;c=((a=a+Math.imul(f,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,U),i=(i=Math.imul(P,V))+Math.imul(D,U)|0,a=Math.imul(D,V),n=n+Math.imul(L,q)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(C,q)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(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(M,J)|0,i=(i=i+Math.imul(M,K)|0)+Math.imul(k,J)|0,a=a+Math.imul(k,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(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(p,at)|0,i=(i=i+Math.imul(p,ot)|0)+Math.imul(m,at)|0,a=a+Math.imul(m,ot)|0;var Mt=(c+(n=n+Math.imul(h,lt)|0)|0)+((8191&(i=(i=i+Math.imul(h,ct)|0)+Math.imul(f,lt)|0))<<13)|0;c=((a=a+Math.imul(f,ct)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,U),i=(i=Math.imul(O,V))+Math.imul(F,U)|0,a=Math.imul(F,V),n=n+Math.imul(P,q)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(D,q)|0,a=a+Math.imul(D,G)|0,n=n+Math.imul(L,W)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(C,W)|0,a=a+Math.imul(C,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(M,$)|0,i=(i=i+Math.imul(M,tt)|0)+Math.imul(k,$)|0,a=a+Math.imul(k,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(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(p,lt)|0,i=(i=i+Math.imul(p,ct)|0)+Math.imul(m,lt)|0,a=a+Math.imul(m,ct)|0;var kt=(c+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,ft)|0)+Math.imul(f,ht)|0))<<13)|0;c=((a=a+Math.imul(f,ft)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(j,U),i=(i=Math.imul(j,V))+Math.imul(N,U)|0,a=Math.imul(N,V),n=n+Math.imul(O,q)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(F,q)|0,a=a+Math.imul(F,G)|0,n=n+Math.imul(P,W)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(D,W)|0,a=a+Math.imul(D,X)|0,n=n+Math.imul(L,J)|0,i=(i=i+Math.imul(L,K)|0)+Math.imul(C,J)|0,a=a+Math.imul(C,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(M,rt)|0,i=(i=i+Math.imul(M,nt)|0)+Math.imul(k,rt)|0,a=a+Math.imul(k,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(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(p,ht)|0,i=(i=i+Math.imul(p,ft)|0)+Math.imul(m,ht)|0,a=a+Math.imul(m,ft)|0;var Tt=(c+(n=n+Math.imul(h,pt)|0)|0)+((8191&(i=(i=i+Math.imul(h,mt)|0)+Math.imul(f,pt)|0))<<13)|0;c=((a=a+Math.imul(f,mt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(j,q),i=(i=Math.imul(j,G))+Math.imul(N,q)|0,a=Math.imul(N,G),n=n+Math.imul(O,W)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(F,W)|0,a=a+Math.imul(F,X)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(D,J)|0,a=a+Math.imul(D,K)|0,n=n+Math.imul(L,$)|0,i=(i=i+Math.imul(L,tt)|0)+Math.imul(C,$)|0,a=a+Math.imul(C,tt)|0,n=n+Math.imul(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(M,at)|0,i=(i=i+Math.imul(M,ot)|0)+Math.imul(k,at)|0,a=a+Math.imul(k,ot)|0,n=n+Math.imul(x,lt)|0,i=(i=i+Math.imul(x,ct)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ct)|0,n=n+Math.imul(v,ht)|0,i=(i=i+Math.imul(v,ft)|0)+Math.imul(y,ht)|0,a=a+Math.imul(y,ft)|0;var At=(c+(n=n+Math.imul(p,pt)|0)|0)+((8191&(i=(i=i+Math.imul(p,mt)|0)+Math.imul(m,pt)|0))<<13)|0;c=((a=a+Math.imul(m,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,X))+Math.imul(N,W)|0,a=Math.imul(N,X),n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(F,J)|0,a=a+Math.imul(F,K)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(D,$)|0,a=a+Math.imul(D,tt)|0,n=n+Math.imul(L,rt)|0,i=(i=i+Math.imul(L,nt)|0)+Math.imul(C,rt)|0,a=a+Math.imul(C,nt)|0,n=n+Math.imul(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(M,lt)|0,i=(i=i+Math.imul(M,ct)|0)+Math.imul(k,lt)|0,a=a+Math.imul(k,ct)|0,n=n+Math.imul(x,ht)|0,i=(i=i+Math.imul(x,ft)|0)+Math.imul(_,ht)|0,a=a+Math.imul(_,ft)|0;var St=(c+(n=n+Math.imul(v,pt)|0)|0)+((8191&(i=(i=i+Math.imul(v,mt)|0)+Math.imul(y,pt)|0))<<13)|0;c=((a=a+Math.imul(y,mt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,K))+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(F,$)|0,a=a+Math.imul(F,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(D,rt)|0,a=a+Math.imul(D,nt)|0,n=n+Math.imul(L,at)|0,i=(i=i+Math.imul(L,ot)|0)+Math.imul(C,at)|0,a=a+Math.imul(C,ot)|0,n=n+Math.imul(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(M,ht)|0,i=(i=i+Math.imul(M,ft)|0)+Math.imul(k,ht)|0,a=a+Math.imul(k,ft)|0;var Et=(c+(n=n+Math.imul(x,pt)|0)|0)+((8191&(i=(i=i+Math.imul(x,mt)|0)+Math.imul(_,pt)|0))<<13)|0;c=((a=a+Math.imul(_,mt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(j,$),i=(i=Math.imul(j,tt))+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(F,rt)|0,a=a+Math.imul(F,nt)|0,n=n+Math.imul(P,at)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(D,at)|0,a=a+Math.imul(D,ot)|0,n=n+Math.imul(L,lt)|0,i=(i=i+Math.imul(L,ct)|0)+Math.imul(C,lt)|0,a=a+Math.imul(C,ct)|0,n=n+Math.imul(A,ht)|0,i=(i=i+Math.imul(A,ft)|0)+Math.imul(S,ht)|0,a=a+Math.imul(S,ft)|0;var Lt=(c+(n=n+Math.imul(M,pt)|0)|0)+((8191&(i=(i=i+Math.imul(M,mt)|0)+Math.imul(k,pt)|0))<<13)|0;c=((a=a+Math.imul(k,mt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(j,rt),i=(i=Math.imul(j,nt))+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(O,at)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(F,at)|0,a=a+Math.imul(F,ot)|0,n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ct)|0)+Math.imul(D,lt)|0,a=a+Math.imul(D,ct)|0,n=n+Math.imul(L,ht)|0,i=(i=i+Math.imul(L,ft)|0)+Math.imul(C,ht)|0,a=a+Math.imul(C,ft)|0;var Ct=(c+(n=n+Math.imul(A,pt)|0)|0)+((8191&(i=(i=i+Math.imul(A,mt)|0)+Math.imul(S,pt)|0))<<13)|0;c=((a=a+Math.imul(S,mt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(j,at),i=(i=Math.imul(j,ot))+Math.imul(N,at)|0,a=Math.imul(N,ot),n=n+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ct)|0)+Math.imul(F,lt)|0,a=a+Math.imul(F,ct)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(D,ht)|0,a=a+Math.imul(D,ft)|0;var It=(c+(n=n+Math.imul(L,pt)|0)|0)+((8191&(i=(i=i+Math.imul(L,mt)|0)+Math.imul(C,pt)|0))<<13)|0;c=((a=a+Math.imul(C,mt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863,n=Math.imul(j,lt),i=(i=Math.imul(j,ct))+Math.imul(N,lt)|0,a=Math.imul(N,ct),n=n+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(F,ht)|0,a=a+Math.imul(F,ft)|0;var Pt=(c+(n=n+Math.imul(P,pt)|0)|0)+((8191&(i=(i=i+Math.imul(P,mt)|0)+Math.imul(D,pt)|0))<<13)|0;c=((a=a+Math.imul(D,mt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(j,ht),i=(i=Math.imul(j,ft))+Math.imul(N,ht)|0,a=Math.imul(N,ft);var Dt=(c+(n=n+Math.imul(O,pt)|0)|0)+((8191&(i=(i=i+Math.imul(O,mt)|0)+Math.imul(F,pt)|0))<<13)|0;c=((a=a+Math.imul(F,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863;var zt=(c+(n=Math.imul(j,pt))|0)+((8191&(i=(i=Math.imul(j,mt))+Math.imul(N,pt)|0))<<13)|0;return c=((a=Math.imul(N,mt))+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,l[0]=gt,l[1]=vt,l[2]=yt,l[3]=bt,l[4]=xt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=kt,l[9]=Tt,l[10]=At,l[11]=St,l[12]=Et,l[13]=Lt,l[14]=Ct,l[15]=It,l[16]=Pt,l[17]=Dt,l[18]=zt,0!==c&&(l[19]=c,r.length++),r};Math.imul||(w=l),a.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?w(this,t,e):r<63?l(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<r.length-1;a++){var o=i;i=0;for(var s=67108863&n,l=Math.min(a,e.length-1),c=Math.max(0,a-t.length+1);c<=l;c++){var u=a-c,h=(0|t.words[u])*(0|e.words[c]),f=67108863&h;s=67108863&(f=f+s|0),i+=(o=(o=o+(h/67108864|0)|0)+(f>>>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):c(this,t,e)},u.prototype.makeRBT=function(t){for(var e=new Array(t),r=a.prototype._countBits(t)-1,n=0;n<t;n++)e[n]=this.revBin(n,r,t);return e},u.prototype.revBin=function(t,e,r){if(0===t||t===r-1)return t;for(var n=0,i=0;i<e;i++)n|=(1&t)<<e-i-1,t>>=1;return n},u.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o<a;o++)n[o]=e[t[o]],i[o]=r[t[o]]},u.prototype.transform=function(t,e,r,n,i,a){this.permute(a,t,e,r,n,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,l=Math.cos(2*Math.PI/s),c=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var h=l,f=c,d=0;d<o;d++){var p=r[u+d],m=n[u+d],g=r[u+d+o],v=n[u+d+o],y=h*g-f*v;v=h*v+f*g,g=y,r[u+d]=p+g,n[u+d]=m+v,r[u+d+o]=p-g,n[u+d+o]=m-v,d!==s&&(y=l*h-c*f,f=l*f+c*h,h=y)}},u.prototype.guessLen13b=function(t,e){var r=1|Math.max(e,t),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},u.prototype.conjugate=function(t,e,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=t[n];t[n]=t[r-n-1],t[r-n-1]=i,i=e[n],e[n]=-e[r-n-1],e[r-n-1]=-i}},u.prototype.normalize13b=function(t,e){for(var r=0,n=0;n<e/2;n++){var i=8192*Math.round(t[2*n+1]/e)+Math.round(t[2*n]/e)+r;t[n]=67108863&i,r=i<67108864?0:i/67108864|0}return t},u.prototype.convert13b=function(t,e,r,i){for(var a=0,o=0;o<e;o++)a+=0|t[o],r[2*o]=8191&a,a>>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o<i;++o)r[o]=0;n(0===a),n(0==(-8192&a))},u.prototype.stub=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=0;return e},u.prototype.mulp=function(t,e,r){var n=2*this.guessLen13b(t.length,e.length),i=this.makeRBT(n),a=this.stub(n),o=new Array(n),s=new Array(n),l=new Array(n),c=new Array(n),u=new Array(n),h=new Array(n),f=r.words;f.length=n,this.convert13b(t.words,t.length,o,n),this.convert13b(e.words,e.length,c,n),this.transform(o,a,s,l,n,i),this.transform(c,a,u,h,n,i);for(var d=0;d<n;d++){var p=s[d]*u[d]-l[d]*h[d];l[d]=s[d]*h[d]+l[d]*u[d],s[d]=p}return this.conjugate(s,l,n),this.transform(s,l,f,a,n,i),this.conjugate(f,a,n),this.normalize13b(f,n),r.negative=t.negative^e.negative,r.length=t.length+e.length,r.strip()},a.prototype.mul=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),this.mulTo(t,e)},a.prototype.mulf=function(t){var e=new a(null);return e.words=new Array(this.length+t.length),c(this,t,e)},a.prototype.imul=function(t){return this.clone().mulTo(t,this)},a.prototype.imuln=function(t){n("number"==typeof t),n(t<67108864);for(var e=0,r=0;r<this.length;r++){var i=(0|this.words[r])*t,a=(67108863&i)+(67108863&e);e>>=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<e.length;r++){var n=r/26|0,i=r%26;e[r]=(t.words[n]&1<<i)>>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n<e.length&&0===e[n];n++,r=r.sqr());if(++n<e.length)for(var i=r.sqr();n<e.length;n++,i=i.sqr())0!==e[n]&&(r=r.mul(i));return r},a.prototype.iushln=function(t){n("number"==typeof t&&t>=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<this.length;e++){var s=this.words[e]&a,l=(0|this.words[e])-s<<r;this.words[e]=l|o,o=s>>>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<i;e++)this.words[e]=0;this.length+=i}return this.strip()},a.prototype.ishln=function(t){return n(0===this.negative),this.iushln(t)},a.prototype.iushrn=function(t,e,r){n("number"==typeof t&&t>=0);var i;i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<<a,l=r;if(i-=o,i=Math.max(0,i),l){for(var c=0;c<o;c++)l.words[c]=this.words[c];l.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var u=0;for(c=this.length-1;c>=0&&(0!==u||c>=i);c--){var h=0|this.words[c];this.words[c]=u<<26-a|h>>>a,u=h&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<<e;if(this.length<=r)return!1;return!!(this.words[r]&i)},a.prototype.imaskn=function(t){n("number"==typeof t&&t>=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<<e;this.words[this.length-1]&=i}return this.strip()},a.prototype.maskn=function(t){return this.clone().imaskn(t)},a.prototype.iaddn=function(t){return n("number"==typeof t),n(t<67108864),t<0?this.isubn(-t):0!==this.negative?1===this.length&&(0|this.words[0])<t?(this.words[0]=t-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},a.prototype._iaddn=function(t){this.words[0]+=t;for(var e=0;e<this.length&&this.words[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<this.length&&this.words[e]<0;e++)this.words[e]+=67108864,this.words[e+1]-=1;return this.strip()},a.prototype.addn=function(t){return this.clone().iaddn(t)},a.prototype.subn=function(t){return this.clone().isubn(t)},a.prototype.iabs=function(){return this.negative=0,this},a.prototype.abs=function(){return this.clone().iabs()},a.prototype._ishlnsubmul=function(t,e,r){var i,a=t.length+r;this._expand(a);var o,s=0;for(i=0;i<t.length;i++){o=(0|this.words[i+r])+s;var l=(0|t.words[i])*e;s=((o-=67108863&l)>>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;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<s.length;c++)s.words[c]=0}var u=n.clone()._ishlnsubmul(i,1,l);0===u.negative&&(n=u,s&&(s.words[l]=1));for(var h=l-1;h>=0;h--){var f=67108864*(0|n.words[i.length+h])+(0|n.words[i.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(i,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(i,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}},a.prototype.divmod=function(t,e,r){if(n(!t.isZero()),this.isZero())return{div:new a(0),mod:new a(0)};var i,o,s;return 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)},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(),h=e.clone();!e.isZero();){for(var f=0,d=1;0==(e.words[0]&d)&&f<26;++f,d<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(h)),i.iushrn(1),o.iushrn(1);for(var p=0,m=1;0==(r.words[0]&m)&&p<26;++p,m<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(u),l.isub(h)),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=new a(1),o=new a(0),s=r.clone();e.cmpn(1)>0&&r.cmpn(1)>0;){for(var l=0,c=1;0==(e.words[0]&c)&&l<26;++l,c<<=1);if(l>0)for(e.iushrn(l);l-- >0;)i.isOdd()&&i.iadd(s),i.iushrn(1);for(var u=0,h=1;0==(r.words[0]&h)&&u<26;++u,h<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(o)):(r.isub(e),o.isub(i))}var f;return(f=0===e.cmpn(1)?i:o).cmpn(0)<0&&f.iadd(t),f},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<<e;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;0!==a&&o<this.length;o++){var s=0|this.words[o];a=(s+=a)>>>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=t<0;if(0!==this.negative&&!e)return-1;if(0===this.negative&&e)return 1;this.strip();var r;if(this.length>1)r=1;else{e&&(t=-t),n(t<=67108863,"Number is too big");var i=0|this.words[0];r=i===t?0:i<t?-1:1}return 0!==this.negative?0|-r:r},a.prototype.cmp=function(t){if(0!==this.negative&&0===t.negative)return-1;if(0===this.negative&&0!==t.negative)return 1;var e=this.ucmp(t);return 0!==this.negative?0|-e:e},a.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var e=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){n<i?e=-1:n>i&&(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 g(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};h.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},h.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=e<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):r.strip(),r},h.prototype.split=function(t,e){t.iushrn(this.n,0,e)},h.prototype.imulK=function(t){return t.imul(this.k)},i(f,h),f.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n<r;n++)e.words[n]=t.words[n];if(e.length=r,t.length<=9)return t.words[0]=0,void(t.length=1);var i=t.words[9];for(e.words[e.length++]=4194303&i,n=10;n<t.length;n++){var a=0|t.words[n];t.words[n-10]=(4194303&a)<<4|i>>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},f.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<t.length;r++){var n=0|t.words[r];e+=977*n,t.words[r]=67108863&e,e=64*n+(e/67108864|0)}return 0===t.words[t.length-1]&&(t.length--,0===t.words[t.length-1]&&t.length--),t},i(d,h),i(p,h),i(m,h),m.prototype.imulK=function(t){for(var e=0,r=0;r<t.length;r++){var n=19*(0|t.words[r])+e,i=67108863&n;n>>>=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 f;else if("p224"===t)e=new d;else if("p192"===t)e=new p;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new m}return M[t]=e,e},g.prototype._verify1=function(t){n(0===t.negative,"red works only with positives"),n(t.red,"red works only with red numbers")},g.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")},g.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},g.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},g.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)},g.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},g.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)},g.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},g.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},g.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},g.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},g.prototype.isqr=function(t){return this.imul(t,t.clone())},g.prototype.sqr=function(t){return this.mul(t,t)},g.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 h=this.pow(u,i),f=this.pow(t,i.addn(1).iushrn(1)),d=this.pow(t,i),p=o;0!==d.cmp(s);){for(var m=d,g=0;0!==m.cmp(s);g++)m=m.redSqr();n(g<p);var v=this.pow(h,new a(1).iushln(p-g-1));f=f.redMul(v),h=v.redSqr(),d=d.redMul(h),p=g}return f},g.prototype.invm=function(t){var e=t._invmp(this.m);return 0!==e.negative?(e.negative=0,this.imod(e).redNeg()):this.imod(e)},g.prototype.pow=function(t,e){if(e.isZero())return new a(1);if(0===e.cmpn(1))return t.clone();var r=new Array(16);r[0]=new a(1).toRed(this),r[1]=t;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],t);var i=r[0],o=0,s=0,l=e.bitLength()%26;for(0===l&&(l=26),n=e.length-1;n>=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var h=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},g.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},g.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},a.mont=function(t){return new v(t)},i(v,g),v.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},v.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},v.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)},v.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)},v.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(void 0===e||e,this)},{}],70:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e<i;++e)a+=t[e].length;var o=new Array(a),s=0;for(e=0;e<i;++e){var l=t[e],c=l.length;for(r=0;r<c;++r){var u=o[s++]=new Array(c-1),h=0;for(n=0;n<c;++n)n!==r&&(u[h++]=l[n]);if(1&r){var f=u[1];u[1]=u[0],u[0]=f}}}return o}},{}],71:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<t;++r)if(!(e[r]<=e[r+t]))return!0;return!1}function i(t,e,r,i){for(var a=0,o=0,s=0,l=t.length;s<l;++s){var c=t[s];if(!n(e,c)){for(var u=0;u<2*e;++u)r[a++]=c[u];i[o++]=s}}return o}function a(t,e,r,n){var a=t.length,o=e.length;if(!(a<=0||o<=0)){var s=t[0].length>>>1;if(!(s<=0)){var h,f=l.mallocDouble(2*s*a),d=l.mallocInt32(a);if((a=i(t,s,f,d))>0){if(1===s&&n)c.init(a),h=c.sweepComplete(s,r,0,a,f,d,0,a,f,d);else{var p=l.mallocDouble(2*s*o),m=l.mallocInt32(o);(o=i(e,s,p,m))>0&&(c.init(a+o),h=1===s?c.sweepBipartite(s,r,0,a,f,d,0,o,p,m):u(s,r,n,a,f,d,o,p,m),l.free(p),l.free(m))}l.free(f),l.free(d)}return h}}}function o(t,e){s.push([t,e])}e.exports=function(t,e,r){switch(arguments.length){case 1:return function(t){return s=[],a(t,t,o,!0),s}(t);case 2:return"function"==typeof e?a(t,t,e,!0):function(t,e){return s=[],a(t,e,o,!1),s}(t,e);case 3:return a(t,e,r,!1);default:throw new Error("box-intersect: Invalid arguments")}};var s,l=t("typedarray-pool"),c=t("./lib/sweep"),u=t("./lib/intersect")},{"./lib/intersect":73,"./lib/sweep":77,"typedarray-pool":550}],72:[function(t,e,r){"use strict";function n(t){function e(e,r){var s=function(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),s=["function ",n,"(",_.join(),"){","var ",l,"=2*",i,";"],w="for(var i="+c+","+d+"="+l+"*"+c+";i<"+u+";++i,"+d+"+="+l+"){var x0="+h+"["+a+"+"+d+"],x1="+h+"["+a+"+"+d+"+"+i+"],xi="+f+"[i];",M="for(var j="+p+","+y+"="+l+"*"+p+";j<"+m+";++j,"+y+"+="+l+"){var y0="+g+"["+a+"+"+y+"],"+(r?"y1="+g+"["+a+"+"+y+"+"+i+"],":"")+"yi="+v+"[j];";return t?s.push(w,x,":",M):s.push(M,x,":",w),r?s.push("if(y1<x0||x1<y0)continue;"):e?s.push("if(y0<=x0||x1<y0)continue;"):s.push("if(y0<x0||x1<y0)continue;"),s.push("for(var k="+a+"+1;k<"+i+";++k){var r0="+h+"[k+"+d+"],r1="+h+"[k+"+i+"+"+d+"],b0="+g+"[k+"+y+"],b1="+g+"[k+"+i+"+"+y+"];if(r1<b0||b1<r0)continue "+x+";}var "+b+"="+o+"("),e?s.push("yi,xi"):s.push("xi,yi"),s.push(");if("+b+"!==void 0)return "+b+";}}}"),{name:n,code:s.join("")}}(e,r,t);n.push(s.code),M.push("return "+s.name+"("+_.join()+");")}var r="bruteForce"+(t?"Full":"Partial"),n=[],w=_.slice();t||w.splice(3,0,s);var M=["function "+r+"("+w.join()+"){"];M.push("if("+u+"-"+c+">"+m+"-"+p+"){"),t?(e(!0,!1),M.push("}else{"),e(!1,!1)):(M.push("if("+s+"){"),e(!0,!0),M.push("}else{"),e(!0,!1),M.push("}}else{if("+s+"){"),e(!1,!0),M.push("}else{"),e(!1,!1),M.push("}")),M.push("}}return "+r);var k=n.join("")+M.join("");return new Function(k)()}var i="d",a="ax",o="vv",s="fp",l="es",c="rs",u="re",h="rb",f="ri",d="rp",p="bs",m="be",g="bb",v="bi",y="bp",b="rv",x="Q",_=[i,a,o,c,u,h,f,p,m,g,v];r.partial=n(!1),r.full=n(!0)},{}],73:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l){var c=M*t;T[c]=e,T[c+1]=r,T[c+2]=n,T[c+3]=i,T[c+4]=a,T[c+5]=o;var u=k*t;A[u]=s,A[u+1]=l}function i(t,e,r,n,i,a,o,s,l,c,u){var h=2*t,f=l*h,d=c[f+e];t:for(var p=i,m=i*h;p<a;++p,m+=h){var g=o[m+e],v=o[m+e+t];if(!(d<g||v<d)&&(!n||d!==g)){for(var y=s[p],b=e+1;b<t;++b){g=o[m+b],v=o[m+b+t];var x=c[f+b],_=c[f+b+t];if(v<x||_<g)continue t}var w;if(void 0!==(w=n?r(u,y):r(y,u)))return w}}}function a(t,e,r,n,i,a,o,s,l,c){var u=2*t,h=s*u,f=l[h+e];t:for(var d=n,p=n*u;d<i;++d,p+=u){var m=o[d];if(m!==c){var g=a[p+e],v=a[p+e+t];if(!(f<g||v<f)){for(var y=e+1;y<t;++y){g=a[p+y],v=a[p+y+t];var b=l[h+y],x=l[h+y+t];if(v<b||x<g)continue t}var _=r(m,c);if(void 0!==_)return _}}}}e.exports=function(t,e,r,l,d,S,E,L,C){!function(t,e){var r=8*s.log2(e+1)*(t+1)|0,n=s.nextPow2(M*r);T.length<n&&(o.free(T),T=o.mallocInt32(n));var i=s.nextPow2(k*r);A<i&&(o.free(A),A=o.mallocDouble(i))}(t,l+E);var I,P=0,D=2*t;for(n(P++,0,0,l,0,E,r?16:0,-1/0,1/0),r||n(P++,0,0,E,0,l,1,-1/0,1/0);P>0;){var z=(P-=1)*M,O=T[z],F=T[z+1],R=T[z+2],j=T[z+3],N=T[z+4],B=T[z+5],U=P*k,V=A[U],H=A[U+1],q=1&B,G=!!(16&B),Y=d,W=S,X=L,Z=C;if(q&&(Y=L,W=C,X=d,Z=S),!(2&B&&(R=b(t,O,F,R,Y,W,H),F>=R)||4&B&&(F=x(t,O,F,R,Y,W,V))>=R)){var J=R-F,K=N-j;if(G){if(t*J*(J+K)<g){if(void 0!==(I=h.scanComplete(t,O,e,F,R,Y,W,j,N,X,Z)))return I;continue}}else{if(t*Math.min(J,K)<p){if(void 0!==(I=c(t,O,e,q,F,R,Y,W,j,N,X,Z)))return I;continue}if(t*J*K<m){if(void 0!==(I=h.scanBipartite(t,O,e,q,F,R,Y,W,j,N,X,Z)))return I;continue}}var Q=v(t,O,F,R,Y,W,V,H);if(F<Q)if(t*(Q-F)<p){if(void 0!==(I=u(t,O+1,e,F,Q,Y,W,j,N,X,Z)))return I}else if(O===t-2){if(void 0!==(I=q?h.sweepBipartite(t,e,j,N,X,Z,F,Q,Y,W):h.sweepBipartite(t,e,F,Q,Y,W,j,N,X,Z)))return I}else n(P++,O+1,F,Q,j,N,q,-1/0,1/0),n(P++,O+1,j,N,F,Q,1^q,-1/0,1/0);if(Q<R){var $=f(t,O,j,N,X,Z),tt=X[D*$+O],et=y(t,O,$,N,X,Z,tt);if(et<N&&n(P++,O,Q,R,et,N,(4|q)+(G?16:0),tt,H),j<$&&n(P++,O,Q,R,j,$,(2|q)+(G?16:0),V,tt),$+1===et){if(void 0!==(I=G?a(t,O,e,Q,R,Y,W,$,X,Z[$]):i(t,O,e,q,Q,R,Y,W,$,X,Z[$])))return I}else if($<et){var rt;if(G){if(rt=_(t,O,Q,R,Y,W,tt),Q<rt){var nt=y(t,O,Q,rt,Y,W,tt);if(O===t-2){if(Q<nt&&void 0!==(I=h.sweepComplete(t,e,Q,nt,Y,W,$,et,X,Z)))return I;if(nt<rt&&void 0!==(I=h.sweepBipartite(t,e,nt,rt,Y,W,$,et,X,Z)))return I}else Q<nt&&n(P++,O+1,Q,nt,$,et,16,-1/0,1/0),nt<rt&&(n(P++,O+1,nt,rt,$,et,0,-1/0,1/0),n(P++,O+1,$,et,nt,rt,1,-1/0,1/0))}}else Q<(rt=q?w(t,O,Q,R,Y,W,tt):_(t,O,Q,R,Y,W,tt))&&(O===t-2?I=q?h.sweepBipartite(t,e,$,et,X,Z,Q,rt,Y,W):h.sweepBipartite(t,e,Q,rt,Y,W,$,et,X,Z):(n(P++,O+1,Q,rt,$,et,q,-1/0,1/0),n(P++,O+1,$,et,Q,rt,1^q,-1/0,1/0)))}}}}};var o=t("typedarray-pool"),s=t("bit-twiddle"),l=t("./brute"),c=l.partial,u=l.full,h=t("./sweep"),f=t("./median"),d=t("./partition"),p=128,m=1<<22,g=1<<22,v=d("!(lo>=p0)&&!(p1>=hi)",["p0","p1"]),y=d("lo===p0",["p0"]),b=d("lo<p0",["p0"]),x=d("hi<=p0",["p0"]),_=d("lo<=p0&&p0<=hi",["p0"]),w=d("lo<p0&&p0<=hi",["p0"]),M=6,k=2,T=o.mallocInt32(1024),A=o.mallocDouble(1024)},{"./brute":72,"./median":74,"./partition":75,"./sweep":77,"bit-twiddle":68,"typedarray-pool":550}],74:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){for(var o=2*t,s=o*(r+1)+e,l=r+1;l<n;++l,s+=o)for(var c=i[s],u=l,h=o*(l-1);u>r&&i[h+e]>c;--u,h-=o){for(var f=h,d=h+o,p=0;p<o;++p,++f,++d){var m=i[f];i[f]=i[d],i[d]=m}var g=a[u];a[u]=a[u-1],a[u-1]=g}}e.exports=function(t,e,r,o,s,l){if(o<=r+1)return r;for(var c=r,u=o,h=o+r>>>1,f=2*t,d=h,p=s[f*h+e];c<u;){if(u-c<a){n(t,e,c,u,s,l),p=s[f*h+e];break}var m=u-c,g=Math.random()*m+c|0,v=s[f*g+e],y=Math.random()*m+c|0,b=s[f*y+e],x=Math.random()*m+c|0,_=s[f*x+e];v<=b?_>=b?(d=y,p=b):v>=_?(d=g,p=v):(d=x,p=_):b>=_?(d=y,p=b):_>=v?(d=g,p=v):(d=x,p=_);for(var w=f*(u-1),M=f*d,k=0;k<f;++k,++w,++M){var T=s[w];s[w]=s[M],s[M]=T}var A=l[u-1];for(l[u-1]=l[d],l[d]=A,w=f*(u-1),M=f*(d=i(t,e,c,u-1,s,l,p)),k=0;k<f;++k,++w,++M)T=s[w],s[w]=s[M],s[M]=T;if(A=l[u-1],l[u-1]=l[d],l[d]=A,h<d){for(u=d-1;c<u&&s[f*(u-1)+e]===p;)u-=1;u+=1}else{if(!(d<h))break;for(c=d+1;c<u&&s[f*c+e]===p;)c+=1}}return i(t,e,r,h,s,l,s[f*h+e])};var i=t("./partition")("lo<p0",["p0"]),a=8},{"./partition":75}],75:[function(t,e,r){"use strict";e.exports=function(t,e){var r="abcdef".split("").concat(e),i=[];return t.indexOf("lo")>=0&&i.push("lo=e[k+n]"),t.indexOf("hi")>=0&&i.push("hi=e[k+o]"),r.push(n.replace("_",i.join()).replace("$",t)),Function.apply(void 0,r)};var n="for(var j=2*a,k=j*c,l=k,m=c,n=b,o=a+b,p=c;d>p;++p,k+=j){var _;if($)if(m===p)m+=1,l+=j;else{for(var s=0;j>s;++s){var t=e[k+s];e[k+s]=e[l],e[l++]=t}var u=f[p];f[p]=f[m],f[m++]=u}}return m"},{}],76:[function(t,e,r){"use strict";function n(t,e,r){for(var n=2*(t+1),i=t+1;i<=e;++i){for(var a=r[n++],o=r[n++],s=i,l=n-2;s-- >t;){var c=r[l-2],u=r[l-1];if(c<a)break;if(c===a&&u<o)break;r[l]=c,r[l+1]=u,l-=2}r[l]=a,r[l+1]=o}}function i(t,e,r){e*=2;var n=r[t*=2],i=r[t+1];r[t]=r[e],r[t+1]=r[e+1],r[e]=n,r[e+1]=i}function a(t,e,r){e*=2,r[t*=2]=r[e],r[t+1]=r[e+1]}function o(t,e,r,n){e*=2,r*=2;var i=n[t*=2],a=n[t+1];n[t]=n[e],n[t+1]=n[e+1],n[e]=n[r],n[e+1]=n[r+1],n[r]=i,n[r+1]=a}function s(t,e,r,n,i){e*=2,i[t*=2]=i[e],i[e]=r,i[t+1]=i[e+1],i[e+1]=n}function l(t,e,r){e*=2;var n=r[t*=2],i=r[e];return!(n<i)&&(n!==i||r[t+1]>r[e+1])}function c(t,e,r,n){var i=n[t*=2];return i<e||i===e&&n[t+1]<r}function u(t,e,r){var f=(e-t+1)/6|0,d=t+f,p=e-f,m=t+e>>1,g=m-f,v=m+f,y=d,b=g,x=m,_=v,w=p,M=t+1,k=e-1,T=0;l(y,b,r)&&(T=y,y=b,b=T),l(_,w,r)&&(T=_,_=w,w=T),l(y,x,r)&&(T=y,y=x,x=T),l(b,x,r)&&(T=b,b=x,x=T),l(y,_,r)&&(T=y,y=_,_=T),l(x,_,r)&&(T=x,x=_,_=T),l(b,w,r)&&(T=b,b=w,w=T),l(b,x,r)&&(T=b,b=x,x=T),l(_,w,r)&&(T=_,_=w,w=T);for(var A=r[2*b],S=r[2*b+1],E=r[2*_],L=r[2*_+1],C=2*y,I=2*x,P=2*w,D=2*d,z=2*m,O=2*p,F=0;F<2;++F){var R=r[C+F],j=r[I+F],N=r[P+F];r[D+F]=R,r[z+F]=j,r[O+F]=N}a(g,t,r),a(v,e,r);for(var B=M;B<=k;++B)if(c(B,A,S,r))B!==M&&i(B,M,r),++M;else if(!c(B,E,L,r))for(;;){if(c(k,E,L,r)){c(k,A,S,r)?(o(B,M,k,r),++M,--k):(i(B,k,r),--k);break}if(--k<B)break}s(t,M-1,A,S,r),s(e,k+1,E,L,r),M-2-t<=h?n(t,M-2,r):u(t,M-2,r),e-(k+2)<=h?n(k+2,e,r):u(k+2,e,r),k-M<=h?n(M,k,r):u(M,k,r)}e.exports=function(t,e){e<=4*h?n(0,e-1,t):u(0,e-1,t)};var h=32},{}],77:[function(t,e,r){"use strict";function n(t,e,r,n){var i=e[n],a=t[r-1];t[i]=a,e[a]=i}function i(t,e,r,n){t[r]=n,e[n]=r}e.exports={init:function(t){var e=o.nextPow2(t);c.length<e&&(a.free(c),c=a.mallocInt32(e)),u.length<e&&(a.free(u),u=a.mallocInt32(e)),h.length<e&&(a.free(h),h=a.mallocInt32(e)),f.length<e&&(a.free(f),f=a.mallocInt32(e)),d.length<e&&(a.free(d),d=a.mallocInt32(e)),p.length<e&&(a.free(p),p=a.mallocInt32(e));var r=8*e;m.length<r&&(a.free(m),m=a.mallocDouble(r))},sweepBipartite:function(t,e,r,a,o,d,p,g,v,y){for(var b=0,x=2*t,_=t-1,w=x-1,M=r;M<a;++M){var k=d[M],T=x*M;m[b++]=o[T+_],m[b++]=-(k+1),m[b++]=o[T+w],m[b++]=k}for(M=p;M<g;++M){k=y[M]+l;var A=x*M;m[b++]=v[A+_],m[b++]=-k,m[b++]=v[A+w],m[b++]=k}var S=b>>>1;s(m,S);var E=0,L=0;for(M=0;M<S;++M){var C=0|m[2*M+1];if(C>=l)n(h,f,L--,C=C-l|0);else if(C>=0)n(c,u,E--,C);else if(C<=-l){C=-C-l|0;for(var I=0;I<E;++I)if(void 0!==(P=e(c[I],C)))return P;i(h,f,L++,C)}else{for(C=-C-1|0,I=0;I<L;++I){var P;if(void 0!==(P=e(C,h[I])))return P}i(c,u,E++,C)}}},sweepComplete:function(t,e,r,a,o,l,g,v,y,b){for(var x=0,_=2*t,w=t-1,M=_-1,k=r;k<a;++k){var T=l[k]+1<<1,A=_*k;m[x++]=o[A+w],m[x++]=-T,m[x++]=o[A+M],m[x++]=T}for(k=g;k<v;++k){T=b[k]+1<<1;var S=_*k;m[x++]=y[S+w],m[x++]=1|-T,m[x++]=y[S+M],m[x++]=1|T}var E=x>>>1;s(m,E);var L=0,C=0,I=0;for(k=0;k<E;++k){var P=0|m[2*k+1],D=1&P;if(k<E-1&&P>>1==m[2*k+3]>>1&&(D=2,k+=1),P<0){for(var z=-(P>>1)-1,O=0;O<I;++O)if(void 0!==(F=e(d[O],z)))return F;if(0!==D)for(O=0;O<L;++O)if(void 0!==(F=e(c[O],z)))return F;if(1!==D)for(O=0;O<C;++O){var F;if(void 0!==(F=e(h[O],z)))return F}0===D?i(c,u,L++,z):1===D?i(h,f,C++,z):2===D&&i(d,p,I++,z)}else z=(P>>1)-1,0===D?n(c,u,L--,z):1===D?n(h,f,C--,z):2===D&&n(d,p,I--,z)}},scanBipartite:function(t,e,r,a,o,h,f,d,p,g,v,y){var b=0,x=2*t,_=e,w=e+t,M=1,k=1;a?k=l:M=l;for(var T=o;T<h;++T){var A=T+M,S=x*T;m[b++]=f[S+_],m[b++]=-A,m[b++]=f[S+w],m[b++]=A}for(T=p;T<g;++T){A=T+k;var E=x*T;m[b++]=v[E+_],m[b++]=-A}var L=b>>>1;s(m,L);var C=0;for(T=0;T<L;++T){var I=0|m[2*T+1];if(I<0){var P=!1;if((A=-I)>=l?(P=!a,A-=l):(P=!!a,A-=1),P)i(c,u,C++,A);else{var D=y[A],z=x*A,O=v[z+e+1],F=v[z+e+1+t];t:for(var R=0;R<C;++R){var j=c[R],N=x*j;if(!(F<f[N+e+1]||f[N+e+1+t]<O)){for(var B=e+2;B<t;++B)if(v[z+B+t]<f[N+B]||f[N+B+t]<v[z+B])continue t;var U,V=d[j];if(void 0!==(U=a?r(D,V):r(V,D)))return U}}}}else n(c,u,C--,I-M)}},scanComplete:function(t,e,r,n,i,a,o,u,h,f,d){for(var p=0,g=2*t,v=e,y=e+t,b=n;b<i;++b){var x=b+l,_=g*b;m[p++]=a[_+v],m[p++]=-x,m[p++]=a[_+y],m[p++]=x}for(b=u;b<h;++b){x=b+1;var w=g*b;m[p++]=f[w+v],m[p++]=-x}var M=p>>>1;s(m,M);var k=0;for(b=0;b<M;++b){var T=0|m[2*b+1];if(T<0)if((x=-T)>=l)c[k++]=x-l;else{var A=d[x-=1],S=g*x,E=f[S+e+1],L=f[S+e+1+t];t:for(var C=0;C<k;++C){var I=c[C],P=o[I];if(P===A)break;var D=g*I;if(!(L<a[D+e+1]||a[D+e+1+t]<E)){for(var z=e+2;z<t;++z)if(f[S+z+t]<a[D+z]||a[D+z+t]<f[S+z])continue t;var O=r(P,A);if(void 0!==O)return O}}}else{for(x=T-l,C=k-1;C>=0;--C)if(c[C]===x){for(z=C+1;z<k;++z)c[z-1]=c[z];break}--k}}}};var a=t("typedarray-pool"),o=t("bit-twiddle"),s=t("./sort"),l=1<<28,c=a.mallocInt32(1024),u=a.mallocInt32(1024),h=a.mallocInt32(1024),f=a.mallocInt32(1024),d=a.mallocInt32(1024),p=a.mallocInt32(1024),m=a.mallocDouble(8192)},{"./sort":76,"bit-twiddle":68,"typedarray-pool":550}],78:[function(t,e,r){"use strict";function n(t){if(t>z)throw new RangeError("Invalid typed array length");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 Error("If encoding is specified then the first argument must be a string");return s(t)}return a(t,e,r)}function a(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return t instanceof ArrayBuffer?function(t,e,r){if(e<0||t.byteLength<e)throw new RangeError("'offset' is out of bounds");if(t.byteLength<e+(r||0))throw new RangeError("'length' is out of bounds");var n;n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r);return n.__proto__=i.prototype,n}(t,e,r):"string"==typeof t?function(t,e){"string"==typeof e&&""!==e||(e="utf8");if(!i.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var r=0|u(t,e),a=n(r),o=a.write(t,e);o!==r&&(a=a.slice(0,o));return a}(t,e):function(t){if(i.isBuffer(t)){var e=0|c(t.length),r=n(e);return 0===r.length?r:(t.copy(r,0,0,e),r)}if(t){if(C(t)||"length"in t)return"number"!=typeof t.length||I(t.length)?n(0):l(t);if("Buffer"===t.type&&Array.isArray(t.data))return l(t.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t)}function o(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function s(t){return o(t),n(t<0?0:0|c(t))}function l(t){for(var e=t.length<0?0:0|c(t.length),r=n(e),i=0;i<e;i+=1)r[i]=255&t[i];return r}function c(t){if(t>=z)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+z.toString(16)+" bytes");return 0|t}function u(t,e){if(i.isBuffer(t))return t.length;if(C(t)||t instanceof ArrayBuffer)return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return S(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return E(t).length;default:if(n)return S(t).length;e=(""+e).toLowerCase(),n=!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,r<=e)return"";for(t||(t="utf8");;)switch(t){case"hex":return function(t,e,r){var n=t.length;(!e||e<0)&&(e=0);(!r||r<0||r>n)&&(r=n);for(var i="",a=e;a<r;++a)i+=function(t){return t<16?"0"+t.toString(16):t.toString(16)}(t[a]);return i}(this,e,r);case"utf8":case"utf-8":return _(this,e,r);case"ascii":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}(this,e,r);case"latin1":case"binary":return function(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}(this,e,r);case"base64":return function(t,e,r){return 0===e&&r===t.length?P.fromByteArray(t):P.fromByteArray(t.slice(e,r))}(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(t,e,r){for(var n=t.slice(e,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function f(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function d(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),r=+r,I(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:p(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):p(t,[e],r,n,a);throw new TypeError("val must be string, number or Buffer")}function p(t,e,r,n,i){function a(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}var 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}var c;if(i){var u=-1;for(c=r;c<s;c++)if(a(t,c)===a(e,-1===u?0:c-u)){if(-1===u&&(u=c),c-u+1===l)return u*o}else-1!==u&&(c-=c-u),u=-1}else for(r+l>s&&(r=s-l),c=r;c>=0;c--){for(var h=!0,f=0;f<l;f++)if(a(t,c+f)!==a(e,f)){h=!1;break}if(h)return c}return-1}function m(t,e,r,n){r=Number(r)||0;var i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;var a=e.length;if(a%2!=0)throw new TypeError("Invalid hex string");n>a/2&&(n=a/2);for(var o=0;o<n;++o){var s=parseInt(e.substr(2*o,2),16);if(I(s))return o;t[r+o]=s}return o}function g(t,e,r,n){return L(S(e,t.length-r),t,r,n)}function v(t,e,r,n){return L(function(t){for(var e=[],r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function y(t,e,r,n){return v(t,e,r,n)}function b(t,e,r,n){return L(E(e),t,r,n)}function x(t,e,r,n){return L(function(t,e){for(var r,n,i,a=[],o=0;o<t.length&&!((e-=2)<0);++o)r=t.charCodeAt(o),n=r>>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function _(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i<r;){var a=t[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,c,u,h;switch(s){case 1:a<128&&(o=a);break;case 2:128==(192&(l=t[i+1]))&&(h=(31&a)<<6|63&l)>127&&(o=h);break;case 3:l=t[i+1],c=t[i+2],128==(192&l)&&128==(192&c)&&(h=(15&a)<<12|(63&l)<<6|63&c)>2047&&(h<55296||h>57343)&&(o=h);break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],128==(192&l)&&128==(192&c)&&128==(192&u)&&(h=(15&a)<<18|(63&l)<<12|(63&c)<<6|63&u)>65535&&h<1114112&&(o=h)}}null===o?(o=65533,s=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=s}return function(t){var e=t.length;if(e<=O)return String.fromCharCode.apply(String,t);var r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=O));return r}(n)}function w(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function M(t,e,r,n,a,o){if(!i.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>a||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function k(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 T(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,4),D.write(t,e,r,n,23,4),r+4}function A(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,8),D.write(t,e,r,n,52,8),r+8}function S(t,e){e=e||1/0;for(var r,n=t.length,i=null,a=[],o=0;o<n;++o){if((r=t.charCodeAt(o))>55295&&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 E(t){return P.toByteArray(function(t){if((t=t.trim().replace(F,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function L(t,e,r,n){for(var i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function C(t){return"function"==typeof ArrayBuffer.isView&&ArrayBuffer.isView(t)}function I(t){return t!=t}var P=t("base64-js"),D=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var z=2147483647;r.kMaxLength=z,(i.TYPED_ARRAY_SUPPORT=function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()}catch(t){return!1}}())||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),"undefined"!=typeof Symbol&&Symbol.species&&i[Symbol.species]===i&&Object.defineProperty(i,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),i.poolSize=8192,i.from=function(t,e,r){return a(t,e,r)},i.prototype.__proto__=Uint8Array.prototype,i.__proto__=Uint8Array,i.alloc=function(t,e,r){return function(t,e,r){return o(t),t<=0?n(t):void 0!==e?"string"==typeof r?n(t).fill(e,r):n(t).fill(e):n(t)}(t,e,r)},i.allocUnsafe=function(t){return s(t)},i.allocUnsafeSlow=function(t){return s(t)},i.isBuffer=function(t){return null!=t&&!0===t._isBuffer},i.compare=function(t,e){if(!i.isBuffer(t)||!i.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var r=t.length,n=e.length,a=0,o=Math.min(r,n);a<o;++a)if(t[a]!==e[a]){r=t[a],n=e[a];break}return r<n?-1:n<r?1:0},i.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},i.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return i.alloc(0);var r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;var n=i.allocUnsafe(e),a=0;for(r=0;r<t.length;++r){var o=t[r];if(!i.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,a),a+=o.length}return n},i.byteLength=u,i.prototype._isBuffer=!0,i.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)f(this,e,e+1);return this},i.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)f(this,e,e+3),f(this,e+1,e+2);return this},i.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)f(this,e,e+7),f(this,e+1,e+6),f(this,e+2,e+5),f(this,e+3,e+4);return this},i.prototype.toString=function(){var t=this.length;return 0===t?"":0===arguments.length?_(this,0,t):h.apply(this,arguments)},i.prototype.equals=function(t){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===i.compare(this,t)},i.prototype.inspect=function(){var t="",e=r.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},i.prototype.compare=function(t,e,r,n,a){if(!i.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===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(e>>>=0,r>>>=0,n>>>=0,a>>>=0,this===t)return 0;for(var o=a-n,s=r-e,l=Math.min(o,s),c=this.slice(n,a),u=t.slice(e,r),h=0;h<l;++h)if(c[h]!==u[h]){o=c[h],s=u[h];break}return o<s?-1:s<o?1:0},i.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},i.prototype.indexOf=function(t,e,r){return d(this,t,e,r,!0)},i.prototype.lastIndexOf=function(t,e,r){return d(this,t,e,r,!1)},i.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=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 g(this,t,e,r);case"ascii":return v(this,t,e,r);case"latin1":case"binary":return y(this,t,e,r);case"base64":return b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},i.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var O=4096;i.prototype.slice=function(t,e){var r=this.length;t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);var n=this.subarray(t,e);return n.__proto__=i.prototype,n},i.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return n},i.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},i.prototype.readUInt8=function(t,e){return t>>>=0,e||w(t,1,this.length),this[t]},i.prototype.readUInt16LE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]|this[t+1]<<8},i.prototype.readUInt16BE=function(t,e){return t>>>=0,e||w(t,2,this.length),this[t]<<8|this[t+1]},i.prototype.readUInt32LE=function(t,e){return t>>>=0,e||w(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||w(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||w(t,e,this.length);for(var n=this[t],i=1,a=0;++a<e&&(i*=256);)n+=this[t+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},i.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||w(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*e)),a},i.prototype.readInt8=function(t,e){return t>>>=0,e||w(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},i.prototype.readInt16LE=function(t,e){t>>>=0,e||w(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||w(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||w(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||w(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||w(t,4,this.length),D.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||w(t,4,this.length),D.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||w(t,8,this.length),D.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||w(t,8,this.length),D.read(this,t,!1,52,8)},i.prototype.writeUIntLE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){M(this,t,e,r,Math.pow(2,8*r)-1,0)}var i=1,a=0;for(this[e]=255&t;++a<r&&(i*=256);)this[e+a]=t/i&255;return e+r},i.prototype.writeUIntBE=function(t,e,r,n){if(t=+t,e>>>=0,r>>>=0,!n){M(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},i.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||M(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||M(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||M(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||M(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||M(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 i=Math.pow(2,8*r-1);M(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a<r&&(o*=256);)t<0&&0===s&&0!==this[e+a-1]&&(s=1),this[e+a]=(t/o>>0)-s&255;return e+r},i.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);M(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},i.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||M(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||M(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||M(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||M(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||M(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 T(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return T(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return A(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return A(this,t,e,!1,r)},i.prototype.copy=function(t,e,r,n){if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);var i,a=n-r;if(this===t&&r<e&&e<n)for(i=a-1;i>=0;--i)t[i+e]=this[i+r];else if(a<1e3)for(i=0;i<a;++i)t[i+e]=this[i+r];else Uint8Array.prototype.set.call(t,this.subarray(r,r+a),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),1===t.length){var a=t.charCodeAt(0);a<256&&(t=a)}if(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)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o<r;++o)this[o]=t;else{var s=i.isBuffer(t)?t:new i(t,n),l=s.length;for(o=0;o<r-e;++o)this[o+e]=s[o%l]}return this};var F=/[^+/0-9A-Za-z-_]/g},{"base64-js":79,ieee754:290}],79:[function(t,e,r){"use strict";function n(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function i(t){return o[t>>18&63]+o[t>>12&63]+o[t>>6&63]+o[63&t]}function a(t,e,r){for(var n,a=[],o=e;o<r;o+=3)n=(t[o]<<16)+(t[o+1]<<8)+t[o+2],a.push(i(n));return a.join("")}r.byteLength=function(t){return 3*t.length/4-n(t)},r.toByteArray=function(t){var e,r,i,a,o,c,u=t.length;o=n(t),c=new l(3*u/4-o),i=o>0?u-4:u;var h=0;for(e=0,r=0;e<i;e+=4,r+=3)a=s[t.charCodeAt(e)]<<18|s[t.charCodeAt(e+1)]<<12|s[t.charCodeAt(e+2)]<<6|s[t.charCodeAt(e+3)],c[h++]=a>>16&255,c[h++]=a>>8&255,c[h++]=255&a;return 2===o?(a=s[t.charCodeAt(e)]<<2|s[t.charCodeAt(e+1)]>>4,c[h++]=255&a):1===o&&(a=s[t.charCodeAt(e)]<<10|s[t.charCodeAt(e+1)]<<4|s[t.charCodeAt(e+2)]>>2,c[h++]=a>>8&255,c[h++]=255&a),c},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",s=[],l=0,c=r-n;l<c;l+=16383)s.push(a(t,l,l+16383>c?c:l+16383));return 1===n?(e=t[r-1],i+=o[e>>2],i+=o[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=o[e>>10],i+=o[e>>4&63],i+=o[e<<2&63],i+="="),s.push(i),s.join("")};for(var o=[],s=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,h=c.length;u<h;++u)o[u]=c[u],s[c.charCodeAt(u)]=u;s["-".charCodeAt(0)]=62,s["_".charCodeAt(0)]=63},{}],80:[function(t,e,r){"use strict";function n(t){return[Math.min(t[0],t[1]),Math.max(t[0],t[1])]}function i(t,e){return t[0]-e[0]||t[1]-e[1]}function a(t,e,r){return e in t?t[e]:r}var o=t("./lib/monotone"),s=t("./lib/triangulation"),l=t("./lib/delaunay"),c=t("./lib/filter");e.exports=function(t,e,r){Array.isArray(e)?(r=r||{},e=e||[]):(r=e||{},e=[]);var u=!!a(r,"delaunay",!0),h=!!a(r,"interior",!0),f=!!a(r,"exterior",!0),d=!!a(r,"infinity",!1);if(!h&&!f||0===t.length)return[];var p=o(t,e);if(u||h!==f||d){for(var m=s(t.length,function(t){return t.map(n).sort(i)}(e)),g=0;g<p.length;++g){var v=p[g];m.addTriangle(v[0],v[1],v[2])}return u&&l(t,m),f?h?d?c(m,0,d):m.cells():c(m,1,d):c(m,-1)}return p}},{"./lib/delaunay":81,"./lib/filter":82,"./lib/monotone":83,"./lib/triangulation":84}],81:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){var s=e.opposite(n,a);if(!(s<0)){if(a<n){var l=n;n=a,a=l,l=o,o=s,s=l}e.isConstraint(n,a)||i(t[n],t[a],t[o],t[s])<0&&r.push(n,a)}}var i=t("robust-in-sphere")[4];t("binary-search-bounds");e.exports=function(t,e){for(var r=[],a=t.length,o=e.stars,s=0;s<a;++s)for(var l=o[s],c=1;c<l.length;c+=2)if(!((d=l[c])<s||e.isConstraint(s,d))){for(var u=l[c-1],h=-1,f=1;f<l.length;f+=2)if(l[f-1]===d){h=l[f];break}h<0||i(t[s],t[d],t[u],t[h])<0&&r.push(s,d)}for(;r.length>0;){for(var d=r.pop(),p=(u=-1,h=-1,l=o[s=r.pop()],1);p<l.length;p+=2){var m=l[p-1],g=l[p];m===d?h=g:g===d&&(u=m)}u<0||h<0||i(t[s],t[d],t[u],t[h])>=0||(e.flip(s,d),n(t,e,r,u,s,h),n(t,e,r,s,h,u),n(t,e,r,h,d,u),n(t,e,r,d,u,h))}}},{"binary-search-bounds":85,"robust-in-sphere":515}],82:[function(t,e,r){"use strict";function n(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 i(t,e){return t[0]-e[0]||t[1]-e[1]||t[2]-e[2]}var a=t("binary-search-bounds");e.exports=function(t,e,r){var a=function(t,e){for(var r=t.cells(),a=r.length,o=0;o<a;++o){var s=(v=r[o])[0],l=v[1],c=v[2];l<c?l<s&&(v[0]=l,v[1]=c,v[2]=s):c<s&&(v[0]=c,v[1]=s,v[2]=l)}r.sort(i);var u=new Array(a);for(o=0;o<u.length;++o)u[o]=0;var h=[],f=[],d=new Array(3*a),p=new Array(3*a),m=null;e&&(m=[]);var g=new n(r,d,p,u,h,f,m);for(o=0;o<a;++o)for(var v=r[o],y=0;y<3;++y){s=v[y],l=v[(y+1)%3];var b=d[3*o+y]=g.locate(l,s,t.opposite(l,s)),x=p[3*o+y]=t.isConstraint(s,l);b<0&&(x?f.push(o):(h.push(o),u[o]=1),e&&m.push([l,s,-1]))}return g}(t,r);if(0===e)return r?a.cells.concat(a.boundary):a.cells;for(var o=1,s=a.active,l=a.next,c=a.flags,u=a.cells,h=a.constraint,f=a.neighbor;s.length>0||l.length>0;){for(;s.length>0;){var d=s.pop();if(c[d]!==-o){c[d]=o,u[d];for(var p=0;p<3;++p){var m=f[3*d+p];m>=0&&0===c[m]&&(h[3*d+p]?l.push(m):(s.push(m),c[m]=o))}}}var g=l;l=s,s=g,l.length=0,o=-o}var v=function(t,e,r){for(var n=0,i=0;i<t.length;++i)e[i]===r&&(t[n++]=t[i]);return t.length=n,t}(u,c,e);return r?v.concat(a.boundary):v};n.prototype.locate=function(){var t=[0,0,0];return function(e,r,n){var o=e,s=r,l=n;return r<n?r<e&&(o=r,s=n,l=e):n<e&&(o=n,s=e,l=r),o<0?-1:(t[0]=o,t[1]=s,t[2]=l,a.eq(this.cells,t,i))}}()},{"binary-search-bounds":85}],83:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.a=t,this.b=e,this.idx=r,this.lowerIds=n,this.upperIds=i}function i(t,e,r,n){this.a=t,this.b=e,this.type=r,this.idx=n}function a(t,e){var r=t.a[0]-e.a[0]||t.a[1]-e.a[1]||t.type-e.type;return r||(t.type!==d&&(r=f(t.a,t.b,e.b))?r:t.idx-e.idx)}function o(t,e){return f(t.a,t.b,e)}function s(t,e,r,n,i){for(var a=h.lt(e,n,o),s=h.gt(e,n,o),l=a;l<s;++l){for(var c=e[l],u=c.lowerIds,d=u.length;d>1&&f(r[u[d-2]],r[u[d-1]],n)>0;)t.push([u[d-1],u[d-2],i]),d-=1;u.length=d,u.push(i);var p=c.upperIds;for(d=p.length;d>1&&f(r[p[d-2]],r[p[d-1]],n)<0;)t.push([p[d-2],p[d-1],i]),d-=1;p.length=d,p.push(i)}}function l(t,e){var r;return(r=t.a[0]<e.a[0]?f(t.a,t.b,e.a):f(e.b,e.a,t.a))?r:(r=e.b[0]<t.b[0]?f(t.a,t.b,e.b):f(e.b,e.a,t.b))||t.idx-e.idx}function c(t,e,r){var i=h.le(t,r,l),a=t[i],o=a.upperIds,s=o[o.length-1];a.upperIds=[s],t.splice(i+1,0,new n(r.a,r.b,r.idx,[s],o))}function u(t,e,r){var n=r.a;r.a=r.b,r.b=n;var i=h.eq(t,r,l),a=t[i];t[i-1].upperIds=a.upperIds,t.splice(i,1)}var h=t("binary-search-bounds"),f=t("robust-orientation")[3],d=0,p=1,m=2;e.exports=function(t,e){for(var r=t.length,o=e.length,l=[],h=0;h<r;++h)l.push(new i(t[h],null,d,h));for(h=0;h<o;++h){var f=e[h],g=t[f[0]],v=t[f[1]];g[0]<v[0]?l.push(new i(g,v,m,h),new i(v,g,p,h)):g[0]>v[0]&&l.push(new i(v,g,m,h),new i(g,v,p,h))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),b=[new n([y,1],[y,0],-1,[],[],[],[])],x=[],_=(h=0,l.length);h<_;++h){var w=l[h],M=w.type;M===d?s(x,b,t,w.a,w.idx):M===m?c(b,0,w):u(b,0,w)}return x}},{"binary-search-bounds":85,"robust-orientation":517}],84:[function(t,e,r){"use strict";function n(t,e){this.stars=t,this.edges=e}function i(t,e,r){for(var n=1,i=t.length;n<i;n+=2)if(t[n-1]===e&&t[n]===r)return t[n-1]=t[i-2],t[n]=t[i-1],void(t.length=i-2)}var a=t("binary-search-bounds");e.exports=function(t,e){for(var r=new Array(t),i=0;i<t;++i)r[i]=[];return new n(r,e)};var o=n.prototype;o.isConstraint=function(){function t(t,e){return t[0]-e[0]||t[1]-e[1]}var e=[0,0];return function(r,n){return e[0]=Math.min(r,n),e[1]=Math.max(r,n),a.eq(this.edges,e,t)>=0}}(),o.removeTriangle=function(t,e,r){var n=this.stars;i(n[t],e,r),i(n[e],r,t),i(n[r],t,e)},o.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},o.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n<i;n+=2)if(r[n]===t)return r[n-1];return-1},o.flip=function(t,e){var r=this.opposite(t,e),n=this.opposite(e,t);this.removeTriangle(t,e,r),this.removeTriangle(e,t,n),this.addTriangle(t,n,r),this.addTriangle(e,r,n)},o.edges=function(){for(var t=this.stars,e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length;a<o;a+=2)e.push([i[a],i[a+1]]);return e},o.cells=function(){for(var t=this.stars,e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],a=0,o=i.length;a<o;a+=2){var s=i[a],l=i[a+1];r<Math.min(s,l)&&e.push([r,s,l])}return e}},{"binary-search-bounds":85}],85:[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)}},{}],86:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;r<t.length;++r)for(var n=0;n<r;++n)if(t[r]<t[n])e=-e;else if(t[n]===t[r])return 0;return e}},{}],87:[function(t,e,r){"use strict";function n(t,e){for(var r=0,n=t.length,i=0;i<n;++i)r+=t[i]*e[i];return r}function i(t){var e=t.length;if(0===e)return[];t[0].length;var r=o([t.length+1,t.length+1],1),i=o([t.length+1],1);r[e][e]=0;for(var a=0;a<e;++a){for(var l=0;l<=a;++l)r[l][a]=r[a][l]=2*n(t[a],t[l]);i[a]=n(t[a],t[a])}var c=s(r,i),u=0,h=c[e+1];for(a=0;a<h.length;++a)u+=h[a];var f=new Array(e);for(a=0;a<e;++a){h=c[a];var d=0;for(l=0;l<h.length;++l)d+=h[l];f[a]=d/u}return f}function a(t){if(0===t.length)return[];for(var e=t[0].length,r=o([e]),n=i(t),a=0;a<t.length;++a)for(var s=0;s<e;++s)r[s]+=t[a][s]*n[a];return r}var o=t("dup"),s=t("robust-linear-solve");a.barycenetric=i,e.exports=a},{dup:126,"robust-linear-solve":516}],88:[function(t,e,r){e.exports=function(t){for(var e=n(t),r=0,i=0;i<t.length;++i)for(var a=t[i],o=0;o<e.length;++o)r+=Math.pow(a[o]-e[o],2);return Math.sqrt(r/t.length)};var n=t("circumcenter")},{circumcenter:87}],89:[function(t,e,r){e.exports=function(t,e,r){return e<r?t<e?e:t>r?r:t:t<r?r:t>e?e:t}},{}],90:[function(t,e,r){"use strict";function n(t){var e=m(t);return[v(e,-1/0),v(e,1/0)]}function i(t){for(var e=new Array(t.length),r=0;r<t.length;++r){var n=t[r];e[r]=[v(n[0],-1/0),v(n[1],-1/0),v(n[0],1/0),v(n[1],1/0)]}return e}function a(t,e,r){for(var i=e.length,a=new u(i),o=[],s=0;s<e.length;++s){var l=e[s],c=n(l[0]),f=n(l[1]);o.push([v(c[0],-1/0),v(f[0],-1/0),v(c[1],1/0),v(f[1],1/0)])}h(o,function(t,e){a.link(t,e)});var d=!0,p=new Array(i);for(s=0;s<i;++s){(g=a.find(s))!==s&&(d=!1,t[g]=[Math.min(t[s][0],t[g][0]),Math.min(t[s][1],t[g][1])])}if(d)return null;var m=0;for(s=0;s<i;++s){var g;(g=a.find(s))===s?(p[s]=m,t[m++]=t[s]):p[s]=-1}t.length=m;for(s=0;s<i;++s)p[s]<0&&(p[s]=p[a.find(s)]);return p}function o(t,e){return t[0]-e[0]||t[1]-e[1]}function s(t,e){var r=t[0]-e[0]||t[1]-e[1];return r||(t[2]<e[2]?-1:t[2]>e[2]?1:0)}function l(t,e,r){if(0!==t.length){if(e)for(var n=0;n<t.length;++n){var i=e[(l=t[n])[0]],a=e[l[1]];l[0]=Math.min(i,a),l[1]=Math.max(i,a)}else for(n=0;n<t.length;++n){var l;i=(l=t[n])[0],a=l[1];l[0]=Math.min(i,a),l[1]=Math.max(i,a)}r?t.sort(s):t.sort(o);var c=1;for(n=1;n<t.length;++n){var u=t[n-1],h=t[n];(h[0]!==u[0]||h[1]!==u[1]||r&&h[2]!==u[2])&&(t[c++]=h)}t.length=c}}function c(t,e,r){var n=function(t,e){for(var r=new Array(e.length),n=0;n<e.length;++n){var i=e[n],a=t[i[0]],o=t[i[1]];r[n]=[v(Math.min(a[0],o[0]),-1/0),v(Math.min(a[1],o[1]),-1/0),v(Math.max(a[0],o[0]),1/0),v(Math.max(a[1],o[1]),1/0)]}return r}(t,e),o=function(t,e,r){var n=[];return h(r,function(r,i){var a=e[r],o=e[i];if(a[0]!==o[0]&&a[0]!==o[1]&&a[1]!==o[0]&&a[1]!==o[1]){var s=t[a[0]],l=t[a[1]],c=t[o[0]],u=t[o[1]];f(s,l,c,u)&&n.push([r,i])}}),n}(t,e,n),s=i(t),c=function(t,e,r,n){var i=[];return h(r,n,function(r,n){var a=e[r];if(a[0]!==n&&a[1]!==n){var o=t[n],s=t[a[0]],l=t[a[1]];f(s,l,o,o)&&i.push([r,n])}}),i}(t,e,n,s),u=a(t,function(t,e,r,n,i){var a,o,s=t.map(function(t){return[d(t[0]),d(t[1])]});for(a=0;a<r.length;++a){var l=r[a];o=l[0];var c=l[1],u=e[o],h=e[c],f=y(g(t[u[0]]),g(t[u[1]]),g(t[h[0]]),g(t[h[1]]));if(f){var v=t.length;t.push([m(f[0]),m(f[1])]),s.push(f),n.push([o,v],[c,v])}}for(n.sort(function(t,e){if(t[0]!==e[0])return t[0]-e[0];var r=s[t[1]],n=s[e[1]];return p(r[0],n[0])||p(r[1],n[1])}),a=n.length-1;a>=0;--a){var b=e[o=(S=n[a])[0]],x=b[0],_=b[1],w=t[x],M=t[_];if((w[0]-M[0]||w[1]-M[1])<0){var k=x;x=_,_=k}b[0]=x;var T,A=b[1]=S[1];for(i&&(T=b[2]);a>0&&n[a-1][0]===o;){var S,E=(S=n[--a])[1];i?e.push([A,E,T]):e.push([A,E]),A=E}i?e.push([A,_,T]):e.push([A,_])}return s}(t,e,o,c,r));return l(e,u,r),!!u||(o.length>0||c.length>0)}e.exports=function(t,e,r){var n;if(r){n=e;for(var o=new Array(e.length),s=0;s<e.length;++s){var u=e[s];o[s]=[u[0],u[1],r[s]]}e=o}for(var h=function(t,e,r){var n=a(t,[],i(t));return l(e,n,r),!!n}(t,e,!!r);c(t,e,!!r);)h=!0;if(r&&h)for(n.length=0,r.length=0,s=0;s<e.length;++s)u=e[s],n.push([u[0],u[1]]),r.push(u[2]);return h};var u=t("union-find"),h=t("box-intersect"),f=t("robust-segment-intersect"),d=t("big-rat"),p=t("big-rat/cmp"),m=t("big-rat/to-float"),g=t("rat-vec"),v=t("nextafter"),y=t("./lib/rat-seg-intersect")},{"./lib/rat-seg-intersect":91,"big-rat":54,"big-rat/cmp":52,"big-rat/to-float":66,"box-intersect":71,nextafter:469,"rat-vec":504,"robust-segment-intersect":520,"union-find":551}],91:[function(t,e,r){"use strict";function n(t,e){return o(i(t[0],e[1]),i(t[1],e[0]))}e.exports=function(t,e,r,i){var o=l(e,t),h=l(i,r),f=n(o,h);if(0===s(f))return null;var d=n(h,l(t,r)),p=a(d,f),m=u(o,p);return c(t,m)};var i=t("big-rat/mul"),a=t("big-rat/div"),o=t("big-rat/sub"),s=t("big-rat/sign"),l=t("rat-vec/sub"),c=t("rat-vec/add"),u=t("rat-vec/muls")},{"big-rat/div":53,"big-rat/mul":63,"big-rat/sign":64,"big-rat/sub":65,"rat-vec/add":503,"rat-vec/muls":505,"rat-vec/sub":506}],92:[function(t,e,r){(function(t){var r=function(){"use strict";function e(r,i,a,o){function s(r,a){if(null===r)return null;if(0==a)return r;var h,f;if("object"!=typeof r)return r;if(e.__isArray(r))h=[];else if(e.__isRegExp(r))h=new RegExp(r.source,n(r)),r.lastIndex&&(h.lastIndex=r.lastIndex);else if(e.__isDate(r))h=new Date(r.getTime());else{if(u&&t.isBuffer(r))return h=new t(r.length),r.copy(h),h;void 0===o?(f=Object.getPrototypeOf(r),h=Object.create(f)):(h=Object.create(o),f=o)}if(i){var d=l.indexOf(r);if(-1!=d)return c[d];l.push(r),c.push(h)}for(var p in r){var m;f&&(m=Object.getOwnPropertyDescriptor(f,p)),m&&null==m.set||(h[p]=s(r[p],a-1))}return h}"object"==typeof i&&(a=i.depth,o=i.prototype,i.filter,i=i.circular);var l=[],c=[],u=void 0!==t;return void 0===i&&(i=!0),void 0===a&&(a=1/0),s(r,a)}function r(t){return Object.prototype.toString.call(t)}function n(t){var e="";return t.global&&(e+="g"),t.ignoreCase&&(e+="i"),t.multiline&&(e+="m"),e}return e.clonePrototype=function(t){if(null===t)return null;var e=function(){};return e.prototype=t,new e},e.__objToStr=r,e.__isDate=function(t){return"object"==typeof t&&"[object Date]"===r(t)},e.__isArray=function(t){return"object"==typeof t&&"[object Array]"===r(t)},e.__isRegExp=function(t){return"object"==typeof t&&"[object RegExp]"===r(t)},e.__getRegExpFlags=n,e}();"object"==typeof e&&e.exports&&(e.exports=r)}).call(this,t("buffer").Buffer)},{buffer:78}],93:[function(t,e,r){"use strict";function n(t,e){null==e&&(e=!0);var r=t[0],n=t[1],a=t[2],o=t[3];null==o&&(o=e?1:255),e&&(r*=255,n*=255,a*=255,o*=255);return 16777216*(r=255&i(r,0,255))+((n=255&i(n,0,255))<<16)+((a=255&i(a,0,255))<<8)+(o=255&i(o,0,255))}var i=t("clamp");e.exports=n,e.exports.to=n,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:89}],94:[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]}},{}],95:[function(t,e,r){(function(r){"use strict";e.exports=function(t){var e,o,s=[],l=1;if("string"==typeof t)if(n[t])s=n[t].slice(),o="rgb";else if("transparent"===t)l=0,o="rgb",s=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var c=t.slice(1);l=1,(h=c.length)<=4?(s=[parseInt(c[0]+c[0],16),parseInt(c[1]+c[1],16),parseInt(c[2]+c[2],16)],4===h&&(l=parseInt(c[3]+c[3],16)/255)):(s=[parseInt(c[0]+c[1],16),parseInt(c[2]+c[3],16),parseInt(c[4]+c[5],16)],8===h&&(l=parseInt(c[6]+c[7],16)/255)),s[0]||(s[0]=0),s[1]||(s[1]=0),s[2]||(s[2]=0),o="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var u=e[1];o=c=u.replace(/a$/,"");var h="cmyk"===c?4:"gray"===c?1:3;s=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===h?parseFloat(t)/100:"rgb"===c?255*parseFloat(t)/100:parseFloat(t);if("h"===c[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==a[t])return a[t]}return parseFloat(t)}),u===c&&s.push(1),l=void 0===s[h]?1:s[h],s=s.slice(0,h)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(s=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),o=t.match(/([a-z])/gi).join("").toLowerCase());else"number"==typeof t?(o="rgb",s=[t>>>16,(65280&t)>>>8,255&t]):i(t)?(null!=t.r?(s=[t.r,t.g,t.b],o="rgb"):null!=t.red?(s=[t.red,t.green,t.blue],o="rgb"):null!=t.h?(s=[t.h,t.s,t.l],o="hsl"):null!=t.hue&&(s=[t.hue,t.saturation,t.lightness],o="hsl"),null!=t.a?l=t.a:null!=t.alpha?l=t.alpha:null!=t.opacity&&(l=t.opacity/100)):(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(s=[t[0],t[1],t[2]],o="rgb",l=4===t.length?t[3]:1);return{space:o,values:s,alpha:l}};var n=t("color-name"),i=t("is-plain-obj"),a={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":94,"is-plain-obj":298}],96:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t,e){if(Array.isArray(t))return t;null==e&&(e=!0);var r=n(t);if(!r.space)return[];var o,s=r.values,l=s.length;for(o=0;o<l;o++)s[o]=a(s[o],0,255);if("h"===r.space[0]&&(s=i.rgb(s)),e)for(o=0;o<l;o++)s[o]/=255;return s.push(a(r.alpha,0,1)),s}},{clamp:89,"color-parse":95,"color-space/hsl":97}],97:[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,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,i=t[0]/255,a=t[1]/255,o=t[2]/255,s=Math.min(i,a,o),l=Math.max(i,a,o),c=l-s;return l===s?e=0:i===l?e=(a-o)/c:a===l?e=2+(o-i)/c:o===l&&(e=4+(i-a)/c),(e=Math.min(60*e,360))<0&&(e+=360),n=(s+l)/2,r=l===s?0:n<=.5?c/(l+s):c/(2-l-s),[e,100*r,100*n]}},{"./rgb":98}],98:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],99:[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:0,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]}]}},{}],100:[function(t,e,r){"use strict";function n(t){for(var e,r="#",n=0;n<3;++n)r+=("00"+(e=(e=t[n]).toString(16))).substr(e.length);return r}function i(t){return"rgba("+t.join(",")+")"}var a=t("arraytools"),o=t("clone"),s=t("./colorScales");e.exports=function(t){var e,r,l,c,u,h,f,d,p,m,g,v,y,b=[],x=[],_=[],w=[];if(a.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",(f=t.colormap)||(f="jet"),"string"==typeof f){if(f=f.toLowerCase(),!s[f])throw Error(f+" not a supported colorscale");h=o(s[f])}else{if(!Array.isArray(f))throw Error("unsupported colormap option",f);h=o(f)}if(h.length>p)throw new Error(f+" map requires nshades to be at least size "+h.length);for(g=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:o(t.alpha):"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1],e=h.map(function(t){return Math.round(t.index*p)}),g[0]<0&&(g[0]=0),g[1]<0&&(g[0]=0),g[0]>1&&(g[0]=1),g[1]>1&&(g[0]=1),y=0;y<e.length;++y)v=h[y].index,4===(r=h[y].rgb).length&&r[3]>=0&&r[3]<=1||(r[3]=g[0]+(g[1]-g[0])*v);for(y=0;y<e.length-1;++y)u=e[y+1]-e[y],l=h[y].rgb,c=h[y+1].rgb,b=b.concat(a.linspace(l[0],c[0],u)),x=x.concat(a.linspace(l[1],c[1],u)),_=_.concat(a.linspace(l[2],c[2],u)),w=w.concat(a.linspace(l[3],c[3],u));return b=b.map(Math.round),x=x.map(Math.round),_=_.map(Math.round),m=a.zip(b,x,_,w),"hex"===d&&(m=m.map(n)),"rgbaString"===d&&(m=m.map(i)),m}},{"./colorScales":99,arraytools:47,clone:92}],101:[function(t,e,r){"use strict";function n(t,e,r){var n=o(t[0],-e[0]),i=o(t[1],-e[1]),a=o(r[0],-e[0]),c=o(r[1],-e[1]),u=l(s(n,a),s(i,c));return u[u.length-1]>=0}e.exports=function(t,e,r,o){var s=i(e,r,o);if(0===s){var l=a(i(t,e,r)),c=a(i(t,e,o));if(l===c){if(0===l){var u=n(t,e,r);return u===n(t,e,o)?0:u?1:-1}return 0}return 0===c?l>0?-1:n(t,e,o)?-1:1:0===l?c>0?1:n(t,e,r)?1:-1:a(c-l)}var h=i(t,e,r);return h>0?s>0&&i(t,e,o)>0?1:-1:h<0?s>0||i(t,e,o)>0?1:-1:i(t,e,o)>0?1:n(t,e,r)?1:-1};var i=t("robust-orientation"),a=t("signum"),o=t("two-sum"),s=t("robust-product"),l=t("robust-sum")},{"robust-orientation":517,"robust-product":518,"robust-sum":522,signum:524,"two-sum":549}],102:[function(t,e,r){function n(t,e){return t-e}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]||i(t[0],t[1])-i(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=i(t[0],t[1]),c=i(e[0],e[1]);return i(l,t[2])-i(c,e[2])||i(l+t[2],o)-i(c+e[2],s);case 4:var u=t[0],h=t[1],f=t[2],d=t[3],p=e[0],m=e[1],g=e[2],v=e[3];return u+h+f+d-(p+m+g+v)||i(u,h,f,d)-i(p,m,g,v,p)||i(u+h,u+f,u+d,h+f,h+d,f+d)-i(p+m,p+g,p+v,m+g,m+v,g+v)||i(u+h+f,u+h+d,u+f+d,h+f+d)-i(p+m+g,p+m+v,p+g+v,m+g+v);default:for(var y=t.slice().sort(n),b=e.slice().sort(n),x=0;x<r;++x)if(a=y[x]-b[x])return a;return 0}};var i=Math.min},{}],103:[function(t,e,r){"use strict";var n=t("compare-cell"),i=t("cell-orientation");e.exports=function(t,e){return n(t,e)||i(t)-i(e)}},{"cell-orientation":86,"compare-cell":102}],104:[function(t,e,r){"use strict";var n=t("./lib/ch1d"),i=t("./lib/ch2d"),a=t("./lib/chnd");e.exports=function(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;return 0===r?[]:1===r?n(t):2===r?i(t):a(t,r)}},{"./lib/ch1d":105,"./lib/ch2d":106,"./lib/chnd":107}],105:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0,n=1;n<t.length;++n)t[n][0]<t[e][0]&&(e=n),t[n][0]>t[r][0]&&(r=n);return e<r?[[e],[r]]:e>r?[[r],[e]]:[[e]]}},{}],106:[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<r;++o){var s=e[o];i[o]=[a,s],a=s}return i};var n=t("monotone-convex-hull-2d")},{"monotone-convex-hull-2d":452}],107:[function(t,e,r){"use strict";e.exports=function(t,e){try{return n(t,!0)}catch(o){var r=i(t);if(r.length<=e)return[];var a=function(t,e){for(var r=t.length,n=new Array(r),i=0;i<e.length;++i)n[i]=t[e[i]];var a=e.length;for(i=0;i<r;++i)e.indexOf(i)<0&&(n[a++]=t[i]);return n}(t,r);return function(t,e){for(var r=t.length,n=e.length,i=0;i<r;++i)for(var a=t[i],o=0;o<a.length;++o){var s=a[o];if(s<n)a[o]=e[s];else{s-=n;for(var l=0;l<n;++l)s>=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":42,"incremental-convex-hull":291}],108:[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"}},{}],109:[function(t,e,r){function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return t<0?0:t>1?1:t}function a(t){return"%"===t[t.length-1]?n(parseFloat(t)/100*255):n(parseInt(t))}function o(t){return"%"===t[t.length-1]?i(parseFloat(t)/100):i(parseFloat(t))}function s(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}function l(t){var e=t.replace(/ /g,"").toLowerCase();if(e in c)return c[e].slice();if("#"===e[0]){if(4===e.length){return(r=parseInt(e.substr(1),16))>=0&&r<=4095?[(3840&r)>>4|(3840&r)>>8,240&r|(240&r)>>4,15&r|(15&r)<<4,1]:null}if(7===e.length){var r;return(r=parseInt(e.substr(1),16))>=0&&r<=16777215?[(16711680&r)>>16,(65280&r)>>8,255&r,1]:null}return null}var i=e.indexOf("("),l=e.indexOf(")");if(-1!==i&&l+1===e.length){var u=e.substr(0,i),h=e.substr(i+1,l-(i+1)).split(","),f=1;switch(u){case"rgba":if(4!==h.length)return null;f=o(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=o(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,p=o(h[1]),m=o(h[2]),g=m<=.5?m*(p+1):m+p-m*p,v=2*m-g;return[n(255*s(v,g,d+1/3)),n(255*s(v,g,d)),n(255*s(v,g,d-1/3)),f];default:return null}}return null}var c={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};try{r.parseCSSColor=l}catch(t){}},{}],110:[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,c=(1+2*i)*l,u=i*l,h=s*(3-2*i),f=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=c*t[d]+u*e[d]+h*r[d]+f*n[d];return a}return c*t+u*e+h*r+f*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}},{}],111:[function(t,e,r){"use strict";var n=t("./lib/thunk.js");e.exports=function(t){var e=new function(){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.pre=t.pre,e.body=t.body,e.post=t.post;var r=t.args.slice(0);e.argTypes=r;for(var i=0;i<r.length;++i){var a=r[i];if("array"===a||"object"==typeof a&&a.blockIndices){if(e.argTypes[i]="array",e.arrayArgs.push(i),e.arrayBlockIndices.push(a.blockIndices?a.blockIndices:0),e.shimArgs.push("array"+i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array args");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i<e.pre.args.length&&e.pre.args[i].count>0)throw new Error("cwise: pre() block may not reference array index");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array index");if(i<e.post.args.length&&e.post.args[i].count>0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),i<e.pre.args.length&&e.pre.args[i].lvalue)throw new Error("cwise: pre() block may not write to array shape");if(i<e.body.args.length&&e.body.args[i].lvalue)throw new Error("cwise: body() block may not write to array shape");if(i<e.post.args.length&&e.post.args[i].lvalue)throw new Error("cwise: post() block may not write to array shape")}else{if("object"!=typeof a||!a.offset)throw new Error("cwise: Unknown argument type "+r[i]);e.argTypes[i]="offset",e.offsetArgs.push({array:a.array,offset:a.offset}),e.offsetArgIndex.push(i)}}if(e.arrayArgs.length<=0)throw new Error("cwise: No array arguments specified");if(e.pre.args.length>r.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":113}],112:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a=t.length,o=e.arrayArgs.length,s=e.indexArgs.length>0,l=[],c=[],u=0,h=0;for(n=0;n<a;++n)c.push(["i",n,"=0"].join(""));for(i=0;i<o;++i)for(n=0;n<a;++n)h=u,u=t[n],0===n?c.push(["d",i,"s",n,"=t",i,"p",u].join("")):c.push(["d",i,"s",n,"=(t",i,"p",u,"-s",h,"*t",i,"p",h,")"].join(""));for(c.length>0&&l.push("var "+c.join(",")),n=a-1;n>=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"<s",u,";++i",n,"){"].join(""));for(l.push(r),n=0;n<a;++n){for(h=u,u=t[n],i=0;i<o;++i)l.push(["p",i,"+=d",i,"s",n].join(""));s&&(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,i=[],a=[],o=0;o<t.args.length;++o){var s=t.args[o];if(!(s.count<=0)){var l=new RegExp(s.name,"g"),c="",u=e.arrayArgs.indexOf(o);switch(e.argTypes[o]){case"offset":var h=e.offsetArgIndex.indexOf(o);u=e.offsetArgs[h].array,c="+q"+h;case"array":c="p"+u+c;var f="l"+o,d="a"+u;if(0===e.arrayBlockIndices[u])1===s.count?"generic"===r[u]?s.lvalue?(i.push(["var ",f,"=",d,".get(",c,")"].join("")),n=n.replace(l,f),a.push([d,".set(",c,",",f,")"].join(""))):n=n.replace(l,[d,".get(",c,")"].join("")):n=n.replace(l,[d,"[",c,"]"].join("")):"generic"===r[u]?(i.push(["var ",f,"=",d,".get(",c,")"].join("")),n=n.replace(l,f),s.lvalue&&a.push([d,".set(",c,",",f,")"].join(""))):(i.push(["var ",f,"=",d,"[",c,"]"].join("")),n=n.replace(l,f),s.lvalue&&a.push([d,"[",c,"]=",f].join("")));else{for(var p=[s.name],m=[c],g=0;g<Math.abs(e.arrayBlockIndices[u]);g++)p.push("\\s*\\[([^\\]]+)\\]"),m.push("$"+(g+1)+"*t"+u+"b"+g);if(l=new RegExp(p.join(""),"g"),c=m.join("+"),"generic"===r[u])throw new Error("cwise: Generic arrays not supported in combination with blocks!");n=n.replace(l,[d,"[",c,"]"].join(""))}break;case"scalar":n=n.replace(l,"Y"+e.scalarArgs.indexOf(o));break;case"index":n=n.replace(l,"index");break;case"shape":n=n.replace(l,"shape")}}}return[i.join("\n"),n,a.join("\n")].join("\n").trim()}var a=t("uniq");e.exports=function(t,e){for(var r=e[1].length-Math.abs(t.arrayBlockIndices[0])|0,o=new Array(t.arrayArgs.length),s=new Array(t.arrayArgs.length),l=0;l<t.arrayArgs.length;++l)s[l]=e[2*l],o[l]=e[2*l+1];var c=[],u=[],h=[],f=[],d=[];for(l=0;l<t.arrayArgs.length;++l){t.arrayBlockIndices[l]<0?(h.push(0),f.push(r),c.push(r),u.push(r+t.arrayBlockIndices[l])):(h.push(t.arrayBlockIndices[l]),f.push(t.arrayBlockIndices[l]+r),c.push(0),u.push(t.arrayBlockIndices[l]));for(var p=[],m=0;m<o[l].length;m++)h[l]<=o[l][m]&&o[l][m]<f[l]&&p.push(o[l][m]-h[l]);d.push(p)}var g=["SS"],v=["'use strict'"],y=[];for(m=0;m<r;++m)y.push(["s",m,"=SS[",m,"]"].join(""));for(l=0;l<t.arrayArgs.length;++l){for(g.push("a"+l),g.push("t"+l),g.push("p"+l),m=0;m<r;++m)y.push(["t",l,"p",m,"=t",l,"[",h[l]+m,"]"].join(""));for(m=0;m<Math.abs(t.arrayBlockIndices[l]);++m)y.push(["t",l,"b",m,"=t",l,"[",c[l]+m,"]"].join(""))}for(l=0;l<t.scalarArgs.length;++l)g.push("Y"+l);if(t.shapeArgs.length>0&&y.push("shape=SS.slice(0)"),t.indexArgs.length>0){var b=new Array(r);for(l=0;l<r;++l)b[l]="0";y.push(["index=[",b.join(","),"]"].join(""))}for(l=0;l<t.offsetArgs.length;++l){var x=t.offsetArgs[l],_=[];for(m=0;m<x.offset.length;++m)0!==x.offset[m]&&(1===x.offset[m]?_.push(["t",x.array,"p",m].join("")):_.push([x.offset[m],"*t",x.array,"p",m].join("")));0===_.length?y.push("q"+l+"=0"):y.push(["q",l,"=",_.join("+")].join(""))}var w=a([].concat(t.pre.thisVars).concat(t.body.thisVars).concat(t.post.thisVars));for((y=y.concat(w)).length>0&&v.push("var "+y.join(",")),l=0;l<t.arrayArgs.length;++l)v.push("p"+l+"|=0");t.pre.body.length>3&&v.push(i(t.pre,t,s));var M=i(t.body,t,s),k=function(t){for(var e=0,r=t[0].length;e<r;){for(var n=1;n<t.length;++n)if(t[n][e]!==t[0][e])return e;++e}return e}(d);k<r?v.push(function(t,e,r,i){for(var a=e.length,o=r.arrayArgs.length,s=r.blockSize,l=r.indexArgs.length>0,c=[],u=0;u<o;++u)c.push(["var offset",u,"=p",u].join(""));for(u=t;u<a;++u)c.push(["for(var j"+u+"=SS[",e[u],"]|0;j",u,">0;){"].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;u<o;++u){for(var h=["offset"+u],f=t;f<a;++f)h.push(["j",f,"*t",u,"p",e[f]].join(""));c.push(["p",u,"=(",h.join("+"),")"].join(""))}for(c.push(n(e,r,i)),u=t;u<a;++u)c.push("}");return c.join("\n")}(k,d[0],t,M)):v.push(n(d[0],t,M)),t.post.body.length>3&&v.push(i(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+v.join("\n")+"\n----------");var T=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",k,function(t){for(var e=new Array(t.length),r=!0,n=0;n<t.length;++n){var i=t[n],a=i.match(/\d+/);a=a?a[0]:"",0===i.charAt(0)?e[n]="u"+i.charAt(1)+a:e[n]=i.charAt(0)+a,n>0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",T,"(",g.join(","),"){",v.join("\n"),"} return ",T].join(""))()}},{uniq:552}],113:[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;u<t.arrayArgs.length;++u){var h=t.arrayArgs[u];r.push(["t",h,"=array",h,".dtype,","r",h,"=array",h,".order"].join("")),a.push("t"+h),a.push("r"+h),o.push("t"+h),o.push("r"+h+".join()"),s.push("array"+h+".data"),s.push("array"+h+".stride"),s.push("array"+h+".offset|0"),u>0&&(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;u<t.scalarArgs.length;++u)s.push("scalar"+t.scalarArgs[u]);return r.push(["type=[",o.join(","),"].join()"].join("")),r.push("proc=CACHED[type]"),e.push("var "+r.join(",")),e.push(["if(!proc){","CACHED[type]=proc=compile([",a.join(","),"])}","return proc(",s.join(","),")}"].join("")),t.debug&&console.log("-----Generated thunk:\n"+e.join("\n")+"\n----------"),new Function("compile",e.join("\n"))(n.bind(void 0,t))}},{"./compile.js":112}],114:[function(t,e,r){e.exports=t("cwise-compiler")},{"cwise-compiler":111}],115:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,e){return[t,e]}function r(t,e,r){var n=(e-t)/Math.max(0,r),i=Math.floor(Math.log(n)/Math.LN10),a=n/Math.pow(10,i);return i>=0?(a>=x?10:a>=_?5:a>=w?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=x?10:a>=_?5:a>=w?2:1)}function n(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>=x?i*=10:a>=_?i*=5:a>=w&&(i*=2),e<t?-i:i}function i(t){return t.length}var a=function(t,e){return t<e?-1:t>e?1:t>=e?0:NaN},o=function(t){return 1===t.length&&(t=function(t){return function(e,r){return a(t(e),r)}}(t)),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n<i;){var a=n+i>>>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<i;){var a=n+i>>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},s=o(a),l=s.right,c=s.left,u=function(t){return null===t?NaN:+t},h=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o<i;)isNaN(r=u(t[o]))||(l+=(n=r-s)*(r-(s+=n/++a)));else for(;++o<i;)isNaN(r=u(e(t[o],o,t)))||(l+=(n=r-s)*(r-(s+=n/++a)));if(a>1)return l/(a-1)},f=function(t,e){var r=h(t,e);return r?Math.sqrt(r):r},d=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o<a;)if(null!=(r=t[o])&&r>=r)for(n=i=r;++o<a;)null!=(r=t[o])&&(n>r&&(n=r),i<r&&(i=r))}else for(;++o<a;)if(null!=(r=e(t[o],o,t))&&r>=r)for(n=i=r;++o<a;)null!=(r=e(t[o],o,t))&&(n>r&&(n=r),i<r&&(i=r));return[n,i]},p=Array.prototype,m=p.slice,g=p.map,v=function(t){return function(){return t}},y=function(t){return t},b=function(t,e,r){t=+t,e=+e,r=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+r;for(var n=-1,i=0|Math.max(0,Math.ceil((e-t)/r)),a=new Array(i);++n<i;)a[n]=t+n*r;return a},x=Math.sqrt(50),_=Math.sqrt(10),w=Math.sqrt(2),M=function(t){return Math.ceil(Math.log(t.length)/Math.LN2)+1},k=function(t,e,r){if(null==r&&(r=u),n=t.length){if((e=+e)<=0||n<2)return+r(t[0],0,t);if(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)}},T=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(r=t[a])&&r>=r)for(n=r;++a<i;)null!=(r=t[a])&&n>r&&(n=r)}else for(;++a<i;)if(null!=(r=e(t[a],a,t))&&r>=r)for(n=r;++a<i;)null!=(r=e(t[a],a,t))&&n>r&&(n=r);return n},A=function(t){if(!(a=t.length))return[];for(var e=-1,r=T(t,i),n=new Array(r);++e<r;)for(var a,o=-1,s=n[e]=new Array(a);++o<a;)s[o]=t[o][e];return n};t.bisect=l,t.bisectRight=l,t.bisectLeft=c,t.ascending=a,t.bisector=o,t.cross=function(t,r,n){var i,a,o,s,l=t.length,c=r.length,u=new Array(l*c);for(null==n&&(n=e),i=o=0;i<l;++i)for(s=t[i],a=0;a<c;++a,++o)u[o]=n(s,r[a]);return u},t.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},t.deviation=f,t.extent=d,t.histogram=function(){function t(t){var a,o,s=t.length,c=new Array(s);for(a=0;a<s;++a)c[a]=e(t[a],a,t);var u=r(c),h=u[0],f=u[1],d=i(c,h,f);Array.isArray(d)||(d=n(h,f,d),d=b(Math.ceil(h/d)*d,Math.floor(f/d)*d,d));for(var p=d.length;d[0]<=h;)d.shift(),--p;for(;d[p-1]>f;)d.pop(),--p;var m,g=new Array(p+1);for(a=0;a<=p;++a)(m=g[a]=[]).x0=a>0?d[a-1]:h,m.x1=a<p?d[a]:f;for(a=0;a<s;++a)h<=(o=c[a])&&o<=f&&g[l(d,o,0,p)].push(t[a]);return g}var e=y,r=d,i=M;return t.value=function(r){return arguments.length?(e="function"==typeof r?r:v(r),t):e},t.domain=function(e){return arguments.length?(r="function"==typeof e?e:v([e[0],e[1]]),t):r},t.thresholds=function(e){return arguments.length?(i="function"==typeof e?e:Array.isArray(e)?v(m.call(e)):v(e),t):i},t},t.thresholdFreedmanDiaconis=function(t,e,r){return t=g.call(t,u).sort(a),Math.ceil((r-e)/(2*(k(t,.75)-k(t,.25))*Math.pow(t.length,-1/3)))},t.thresholdScott=function(t,e,r){return Math.ceil((r-e)/(3.5*f(t)*Math.pow(t.length,-1/3)))},t.thresholdSturges=M,t.max=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a<i;)if(null!=(r=t[a])&&r>=r)for(n=r;++a<i;)null!=(r=t[a])&&r>n&&(n=r)}else for(;++a<i;)if(null!=(r=e(t[a],a,t))&&r>=r)for(n=r;++a<i;)null!=(r=e(t[a],a,t))&&r>n&&(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<n;)isNaN(r=u(t[a]))?--i:o+=r;else for(;++a<n;)isNaN(r=u(e(t[a],a,t)))?--i:o+=r;if(i)return o/i},t.median=function(t,e){var r,n=t.length,i=-1,o=[];if(null==e)for(;++i<n;)isNaN(r=u(t[i]))||o.push(r);else for(;++i<n;)isNaN(r=u(e(t[i],i,t)))||o.push(r);return k(o.sort(a),.5)},t.merge=function(t){for(var e,r,n,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(r=new Array(o);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=T,t.pairs=function(t,r){null==r&&(r=e);for(var n=0,i=t.length-1,a=t[0],o=new Array(i<0?0:i);n<i;)o[n]=r(a,a=t[++n]);return o},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.quantile=k,t.range=b,t.scan=function(t,e){if(r=t.length){var r,n,i=0,o=0,s=t[o];for(null==e&&(e=a);++i<r;)(e(n=t[i],s)<0||0!==e(s,s))&&(s=n,o=i);return 0===e(s,s)?o:void 0}},t.shuffle=function(t,e,r){for(var n,i,a=(null==r?t.length:r)-(e=null==e?0:+e);a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.sum=function(t,e){var r,n=t.length,i=-1,a=0;if(null==e)for(;++i<n;)(r=+t[i])&&(a+=r);else for(;++i<n;)(r=+e(t[i],i,t))&&(a+=r);return a},t.ticks=function(t,e,n){var i,a,o,s=e<t,l=-1;if(s&&(i=t,t=e,e=i),0===(o=r(t,e,n))||!isFinite(o))return[];if(o>0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++l<i;)a[l]=(t+l)*o;else for(t=Math.floor(t*o),e=Math.ceil(e*o),a=new Array(i=Math.ceil(t-e+1));++l<i;)a[l]=(t-l)/o;return s&&a.reverse(),a},t.tickIncrement=r,t.tickStep=n,t.transpose=A,t.variance=h,t.zip=function(){return A(arguments)},Object.defineProperty(t,"__esModule",{value:!0})})},{}],116:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(){}function r(t,r){var n=new e;if(t instanceof e)t.each(function(t,e){n.set(e,t)});else if(Array.isArray(t)){var i,a=-1,o=t.length;if(null==r)for(;++a<o;)n.set(a,t[a]);else for(;++a<o;)n.set(r(i=t[a],a,t),i)}else if(t)for(var s in t)n.set(s,t[s]);return n}function n(){return{}}function i(t,e,r){t[e]=r}function a(){return r()}function o(t,e,r){t.set(e,r)}function s(){}function l(t,e){var r=new s;if(t instanceof s)t.each(function(t){r.add(t)});else if(t){var n=-1,i=t.length;if(null==e)for(;++n<i;)r.add(t[n]);else for(;++n<i;)r.add(e(t[n],n,t))}return r}e.prototype=r.prototype={constructor:e,has:function(t){return"$"+t in this},get:function(t){return this["$"+t]},set:function(t,e){return this["$"+t]=e,this},remove:function(t){var e="$"+t;return e in this&&delete this[e]},clear:function(){for(var t in this)"$"===t[0]&&delete this[t]},keys:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)"$"===e[0]&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)"$"===e[0]&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)"$"===e[0]&&++t;return t},empty:function(){for(var t in this)if("$"===t[0])return!1;return!0},each:function(t){for(var e in this)"$"===e[0]&&t(this[e],e.slice(1),this)}};var c=r.prototype;s.prototype=l.prototype={constructor:s,has:c.has,add:function(t){return t+="",this["$"+t]=t,this},remove:c.remove,clear:c.clear,values:c.keys,size:c.size,empty:c.empty,each:c.each};t.nest=function(){function t(e,n,i,a){if(n>=u.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,c,h,f=-1,d=e.length,p=u[n++],m=r(),g=i();++f<d;)(h=m.get(o=p(c=e[f])+""))?h.push(c):m.set(o,[c]);return m.each(function(e,r){a(g,r,t(e,n,i,a))}),g}function e(t,r){if(++r>u.length)return t;var n,i=h[r-1];return null!=l&&r>=u.length?n=t.entries():(n=[],t.each(function(t,i){n.push({key:i,values:e(t,r)})})),null!=i?n.sort(function(t,e){return i(t.key,e.key)}):n}var s,l,c,u=[],h=[];return c={object:function(e){return t(e,0,n,i)},map:function(e){return t(e,0,a,o)},entries:function(r){return e(t(r,0,a,o),0)},key:function(t){return u.push(t),c},sortKeys:function(t){return h[u.length-1]=t,c},sortValues:function(t){return s=t,c},rollup:function(t){return l=t,c}}},t.set=l,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})})},{}],117:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function r(){}function n(t){var e;return t=(t+"").trim().toLowerCase(),(e=E.exec(t))?(e=parseInt(e[1],16),new l(e>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1)):(e=L.exec(t))?i(parseInt(e[1],16)):(e=C.exec(t))?new l(e[1],e[2],e[3],1):(e=I.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=P.exec(t))?a(e[1],e[2],e[3],e[4]):(e=D.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=z.exec(t))?c(e[1],e[2]/100,e[3]/100,1):(e=O.exec(t))?c(e[1],e[2]/100,e[3]/100,e[4]):F.hasOwnProperty(t)?i(F[t]):"transparent"===t?new l(NaN,NaN,NaN,0):null}function i(t){return new l(t>>16&255,t>>8&255,255&t,1)}function a(t,e,r,n){return n<=0&&(t=e=r=NaN),new l(t,e,r,n)}function o(t){return t instanceof r||(t=n(t)),t?(t=t.rgb(),new l(t.r,t.g,t.b,t.opacity)):new l}function s(t,e,r,n){return 1===arguments.length?o(t):new l(t,e,r,null==n?1:n)}function l(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function c(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new h(t,e,r,n)}function u(t,e,i,a){return 1===arguments.length?function(t){if(t instanceof h)return new h(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new h;if(t instanceof h)return t;var e=(t=t.rgb()).r/255,i=t.g/255,a=t.b/255,o=Math.min(e,i,a),s=Math.max(e,i,a),l=NaN,c=s-o,u=(s+o)/2;return c?(l=e===s?(i-a)/c+6*(i<a):i===s?(a-e)/c+2:(e-i)/c+4,c/=u<.5?s+o:2-s-o,l*=60):c=u>0&&u<1?0:l,new h(l,c,u,t.opacity)}(t):new h(t,e,i,null==a?1:a)}function h(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function f(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}function d(t){if(t instanceof m)return new m(t.l,t.a,t.b,t.opacity);if(t instanceof _){var e=t.h*R;return new m(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof l||(t=o(t));var r=b(t.r),n=b(t.g),i=b(t.b),a=g((.4124564*r+.3575761*n+.1804375*i)/N),s=g((.2126729*r+.7151522*n+.072175*i)/B);return new m(116*s-16,500*(a-s),200*(s-g((.0193339*r+.119192*n+.9503041*i)/U)),t.opacity)}function p(t,e,r,n){return 1===arguments.length?d(t):new m(t,e,r,null==n?1:n)}function m(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function g(t){return t>G?Math.pow(t,1/3):t/q+V}function v(t){return t>H?t*t*t:q*(t-V)}function y(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function b(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function x(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof _)return new _(t.h,t.c,t.l,t.opacity);t instanceof m||(t=d(t));var e=Math.atan2(t.b,t.a)*j;return new _(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new _(t,e,r,null==n?1:n)}function _(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}function w(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof M)return new M(t.h,t.s,t.l,t.opacity);t instanceof l||(t=o(t));var e=t.r/255,r=t.g/255,n=t.b/255,i=(K*n+Z*e-J*r)/(K+Z-J),a=n-i,s=(X*(r-i)-Y*a)/W,c=Math.sqrt(s*s+a*a)/(X*i*(1-i)),u=c?Math.atan2(s,a)*j-120:NaN;return new M(u<0?u+360:u,c,i,t.opacity)}(t):new M(t,e,r,null==n?1:n)}function M(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}var k=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t},T="\\s*([+-]?\\d+)\\s*",A="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",S="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",E=/^#([0-9a-f]{3})$/,L=/^#([0-9a-f]{6})$/,C=new RegExp("^rgb\\("+[T,T,T]+"\\)$"),I=new RegExp("^rgb\\("+[S,S,S]+"\\)$"),P=new RegExp("^rgba\\("+[T,T,T,A]+"\\)$"),D=new RegExp("^rgba\\("+[S,S,S,A]+"\\)$"),z=new RegExp("^hsl\\("+[A,S,S]+"\\)$"),O=new RegExp("^hsla\\("+[A,S,S,A]+"\\)$"),F={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};k(r,n,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),k(l,s,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new l(this.r*t,this.g*t,this.b*t,this.opacity)},rgb:function(){return this},displayable:function(){return 0<=this.r&&this.r<=255&&0<=this.g&&this.g<=255&&0<=this.b&&this.b<=255&&0<=this.opacity&&this.opacity<=1},toString:function(){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+")")}})),k(h,u,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new h(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new h(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 l(f(t>=240?t-240:t+120,i,n),f(t,i,n),f(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}}));var R=Math.PI/180,j=180/Math.PI,N=.95047,B=1,U=1.08883,V=4/29,H=6/29,q=3*H*H,G=H*H*H;k(m,p,e(r,{brighter:function(t){return new m(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new m(this.l-18*(null==t?1:t),this.a,this.b,this.opacity)},rgb:function(){var t=(this.l+16)/116,e=isNaN(this.a)?t:t+this.a/500,r=isNaN(this.b)?t:t-this.b/200;return t=B*v(t),e=N*v(e),r=U*v(r),new l(y(3.2404542*e-1.5371385*t-.4985314*r),y(-.969266*e+1.8760108*t+.041556*r),y(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),k(_,x,e(r,{brighter:function(t){return new _(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new _(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return d(this).rgb()}}));var Y=-.29227,W=-.90649,X=1.97294,Z=X*W,J=1.78277*X,K=1.78277*Y- -.14861*W;k(M,w,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new M(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new M(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*R,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new l(255*(e+r*(-.14861*n+1.78277*i)),255*(e+r*(Y*n+W*i)),255*(e+r*(X*n)),this.opacity)}})),t.color=n,t.rgb=s,t.hsl=u,t.lab=p,t.hcl=x,t.cubehelix=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],118:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new r(i)}function r(t){this._=t}function n(t,e,r){for(var n=0,a=t.length;n<a;++n)if(t[n].name===e){t[n]=i,t=t.slice(0,n).concat(t.slice(n+1));break}return null!=r&&t.push({name:e,value:r}),t}var i={value:function(){}};r.prototype=e.prototype={constructor:r,on:function(t,e){var r,i=this._,a=function(t,e){return t.trim().split(/^|\s+/).map(function(t){var r="",n=t.indexOf(".");if(n>=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}})}(t+"",i),o=-1,s=a.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++o<s;)if(r=(t=a[o]).type)i[r]=n(i[r],t.name,e);else if(null==e)for(r in i)i[r]=n(i[r],t.name,null);return this}for(;++o<s;)if((r=(t=a[o]).type)&&(r=function(t,e){for(var r,n=0,i=t.length;n<i;++n)if((r=t[n]).name===e)return r.value}(i[r],t.name)))return r},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new r(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var r,n,i=new Array(r),a=0;a<r;++a)i[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,r=(n=this._[t]).length;a<r;++a)n[a].value.apply(e,i)},apply:function(t,e,r){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var n=this._[t],i=0,a=n.length;i<a;++i)n[i].value.apply(e,r)}},t.dispatch=e,Object.defineProperty(t,"__esModule",{value:!0})})},{}],119:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-quadtree"),t("d3-collection"),t("d3-dispatch"),t("d3-timer")):i(n.d3=n.d3||{},n.d3,n.d3,n.d3,n.d3)}(this,function(t,e,r,n,i){"use strict";function a(t){return t.x+t.vx}function o(t){return t.y+t.vy}function s(t){return t.index}function l(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function c(t){return t.x}function u(t){return t.y}var h=function(t){return function(){return t}},f=function(){return 1e-6*(Math.random()-.5)},d=10,p=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,e){function r(){var r,i,a=n.length,o=0,s=0;for(r=0;r<a;++r)o+=(i=n[r]).x,s+=i.y;for(o=o/a-t,s=s/a-e,r=0;r<a;++r)(i=n[r]).x-=o,i.y-=s}var n;return null==t&&(t=0),null==e&&(e=0),r.initialize=function(t){n=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r},t.forceCollide=function(t){function r(){function t(t,e,r,n,i){var a=t.data,o=t.r,s=m+o;if(!a)return e>d+s||n<d-s||r>p+s||i<p-s;if(a.index>h.index){var l=d-a.x-a.vx,u=p-a.y-a.vy,v=l*l+u*u;v<s*s&&(0===l&&(l=f(),v+=l*l),0===u&&(u=f(),v+=u*u),v=(s-(v=Math.sqrt(v)))/v*c,h.vx+=(l*=v)*(s=(o*=o)/(g+o)),h.vy+=(u*=v)*s,a.vx-=l*(s=1-s),a.vy-=u*s)}}for(var r,i,h,d,p,m,g,v=s.length,y=0;y<u;++y)for(i=e.quadtree(s,a,o).visitAfter(n),r=0;r<v;++r)h=s[r],m=l[h.index],g=m*m,d=h.x+h.vx,p=h.y+h.vy,i.visit(t)}function n(t){if(t.data)return t.r=l[t.data.index];for(var e=t.r=0;e<4;++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e<n;++e)r=s[e],l[r.index]=+t(r,e,s)}}var s,l,c=1,u=1;return"function"!=typeof t&&(t=h(null==t?1:+t)),r.initialize=function(t){s=t,i()},r.iterations=function(t){return arguments.length?(u=+t,r):u},r.strength=function(t){return arguments.length?(c=+t,r):c},r.radius=function(e){return arguments.length?(t="function"==typeof e?e:h(+e),i(),r):t},r},t.forceLink=function(t){function e(e){for(var r=0,n=t.length;r<y;++r)for(var i,a,s,l,u,h,d,m=0;m<n;++m)a=(i=t[m]).source,l=(s=i.target).x+s.vx-a.x-a.vx||f(),u=s.y+s.vy-a.y-a.vy||f(),l*=h=((h=Math.sqrt(l*l+u*u))-c[m])/h*e*o[m],u*=h,s.vx-=l*(d=p[m]),s.vy-=u*d,a.vx+=l*(d=1-d),a.vy+=u*d}function n(){if(u){var e,n,s=u.length,h=t.length,f=r.map(u,m);for(e=0,d=new Array(s);e<h;++e)(n=t[e]).index=e,"object"!=typeof n.source&&(n.source=l(f,n.source)),"object"!=typeof n.target&&(n.target=l(f,n.target)),d[n.source.index]=(d[n.source.index]||0)+1,d[n.target.index]=(d[n.target.index]||0)+1;for(e=0,p=new Array(h);e<h;++e)n=t[e],p[e]=d[n.source.index]/(d[n.source.index]+d[n.target.index]);o=new Array(h),i(),c=new Array(h),a()}}function i(){if(u)for(var e=0,r=t.length;e<r;++e)o[e]=+g(t[e],e,t)}function a(){if(u)for(var e=0,r=t.length;e<r;++e)c[e]=+v(t[e],e,t)}var o,c,u,d,p,m=s,g=function(t){return 1/Math.min(d[t.source.index],d[t.target.index])},v=h(30),y=1;return null==t&&(t=[]),e.initialize=function(t){u=t,n()},e.links=function(r){return arguments.length?(t=r,n(),e):t},e.id=function(t){return arguments.length?(m=t,e):m},e.iterations=function(t){return arguments.length?(y=+t,e):y},e.strength=function(t){return arguments.length?(g="function"==typeof t?t:h(+t),i(),e):g},e.distance=function(t){return arguments.length?(v="function"==typeof t?t:h(+t),a(),e):v},e},t.forceManyBody=function(){function t(t){var r,l=a.length,h=e.quadtree(a,c,u).visitAfter(n);for(s=t,r=0;r<l;++r)o=a[r],h.visit(i)}function r(){if(a){var t,e,r=a.length;for(l=new Array(r),t=0;t<r;++t)e=a[t],l[e.index]=+d(e,t,a)}}function n(t){var e,r,n,i,a,o=0;if(t.length){for(n=i=a=0;a<4;++a)(e=t[a])&&(r=e.value)&&(o+=r,n+=r*e.x,i+=r*e.y);t.x=n/o,t.y=i/o}else{(e=t).x=e.data.x,e.y=e.data.y;do{o+=l[e.data.index]}while(e=e.next)}t.value=o}function i(t,e,r,n){if(!t.value)return!0;var i=t.x-o.x,a=t.y-o.y,c=n-e,u=i*i+a*a;if(c*c/g<u)return u<m&&(0===i&&(i=f(),u+=i*i),0===a&&(a=f(),u+=a*a),u<p&&(u=Math.sqrt(p*u)),o.vx+=i*t.value*s/u,o.vy+=a*t.value*s/u),!0;if(!(t.length||u>=m)){(t.data!==o||t.next)&&(0===i&&(i=f(),u+=i*i),0===a&&(a=f(),u+=a*a),u<p&&(u=Math.sqrt(p*u)));do{t.data!==o&&(c=l[t.data.index]*s/u,o.vx+=i*c,o.vy+=a*c)}while(t=t.next)}}var a,o,s,l,d=h(-30),p=1,m=1/0,g=.81;return t.initialize=function(t){a=t,r()},t.strength=function(e){return arguments.length?(d="function"==typeof e?e:h(+e),r(),t):d},t.distanceMin=function(e){return arguments.length?(p=e*e,t):Math.sqrt(p)},t.distanceMax=function(e){return arguments.length?(m=e*e,t):Math.sqrt(m)},t.theta=function(e){return arguments.length?(g=e*e,t):Math.sqrt(g)},t},t.forceSimulation=function(t){function e(){a(),y.call("tick",l),c<u&&(v.stop(),y.call("end",l))}function a(){var e,r,n=t.length;for(c+=(f-c)*h,g.each(function(t){t(c)}),e=0;e<n;++e)null==(r=t[e]).fx?r.x+=r.vx*=m:(r.x=r.fx,r.vx=0),null==r.fy?r.y+=r.vy*=m:(r.y=r.fy,r.vy=0)}function o(){for(var e,r=0,n=t.length;r<n;++r){if(e=t[r],e.index=r,isNaN(e.x)||isNaN(e.y)){var i=d*Math.sqrt(r),a=r*p;e.x=i*Math.cos(a),e.y=i*Math.sin(a)}(isNaN(e.vx)||isNaN(e.vy))&&(e.vx=e.vy=0)}}function s(e){return e.initialize&&e.initialize(t),e}var l,c=1,u=.001,h=1-Math.pow(u,1/300),f=0,m=.6,g=r.map(),v=i.timer(e),y=n.dispatch("tick","end");return null==t&&(t=[]),o(),l={tick:a,restart:function(){return v.restart(e),l},stop:function(){return v.stop(),l},nodes:function(e){return arguments.length?(t=e,o(),g.each(s),l):t},alpha:function(t){return arguments.length?(c=+t,l):c},alphaMin:function(t){return arguments.length?(u=+t,l):u},alphaDecay:function(t){return arguments.length?(h=+t,l):+h},alphaTarget:function(t){return arguments.length?(f=+t,l):f},velocityDecay:function(t){return arguments.length?(m=1-t,l):1-m},force:function(t,e){return arguments.length>1?(null==e?g.remove(t):g.set(t,s(e)),l):g.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;c<u;++c)(o=(i=e-(s=t[c]).x)*i+(a=r-s.y)*a)<n&&(l=s,n=o);return l},on:function(t,e){return arguments.length>1?(y.on(t,e),l):y.on(t)}}},t.forceX=function(t){function e(t){for(var e,r=0,o=n.length;r<o;++r)(e=n[r]).vx+=(a[r]-e.x)*i[r]*t}function r(){if(n){var e,r=n.length;for(i=new Array(r),a=new Array(r),e=0;e<r;++e)i[e]=isNaN(a[e]=+t(n[e],e,n))?0:+o(n[e],e,n)}}var n,i,a,o=h(.1);return"function"!=typeof t&&(t=h(null==t?0:+t)),e.initialize=function(t){n=t,r()},e.strength=function(t){return arguments.length?(o="function"==typeof t?t:h(+t),r(),e):o},e.x=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),r(),e):t},e},t.forceY=function(t){function e(t){for(var e,r=0,o=n.length;r<o;++r)(e=n[r]).vy+=(a[r]-e.y)*i[r]*t}function r(){if(n){var e,r=n.length;for(i=new Array(r),a=new Array(r),e=0;e<r;++e)i[e]=isNaN(a[e]=+t(n[e],e,n))?0:+o(n[e],e,n)}}var n,i,a,o=h(.1);return"function"!=typeof t&&(t=h(null==t?0:+t)),e.initialize=function(t){n=t,r()},e.strength=function(t){return arguments.length?(o="function"==typeof t?t:h(+t),r(),e):o},e.y=function(n){return arguments.length?(t="function"==typeof n?n:h(+n),r(),e):t},e},Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-collection":116,"d3-dispatch":118,"d3-quadtree":121,"d3-timer":122}],120:[function(t,e,r){!function(n,i){"object"==typeof r&&void 0!==e?i(r,t("d3-color")):i(n.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,e){return function(r){return t+r*e}}function i(t,e){var r=e-t;return r?n(t,r>180||r<-180?r-360*Math.round(r/360):r):b(isNaN(t)?e:t)}function a(t){return 1==(t=+t)?o: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):b(isNaN(e)?r:e)}}function o(t,e){var r=e-t;return r?n(t,r):b(isNaN(t)?e:t)}function s(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;n<a;++n)i=e.rgb(r[n]),o[n]=i.r||0,s[n]=i.g||0,l[n]=i.b||0;return o=t(o),s=t(s),l=t(l),i.opacity=1,function(t){return i.r=o(t),i.g=s(t),i.b=l(t),i+""}}}function l(t,e,r,n){function i(t){return t.length?t.pop()+" ":""}return function(a,o){var s=[],l=[];return a=t(a),o=t(o),function(t,n,i,a,o,s){if(t!==i||n!==a){var l=o.push("translate(",null,e,null,r);s.push({i:l-4,x:T(t,i)},{i:l-2,x:T(n,a)})}else(i||a)&&o.push("translate("+i+e+a+r)}(a.translateX,a.translateY,o.translateX,o.translateY,s,l),function(t,e,r,a){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:T(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:T(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:T(t,r)},{i:s-2,x:T(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;++r<n;)s[(e=l[r]).i]=e.x(t);return s.join("")}}}function c(t){return((t=Math.exp(t))+1/t)/2}function u(t){return function(r,n){var i=t((r=e.hsl(r)).h,(n=e.hsl(n)).h),a=o(r.s,n.s),s=o(r.l,n.l),l=o(r.opacity,n.opacity);return function(t){return r.h=i(t),r.s=a(t),r.l=s(t),r.opacity=l(t),r+""}}}function h(t){return function(r,n){var i=t((r=e.hcl(r)).h,(n=e.hcl(n)).h),a=o(r.c,n.c),s=o(r.l,n.l),l=o(r.opacity,n.opacity);return function(t){return r.h=i(t),r.c=a(t),r.l=s(t),r.opacity=l(t),r+""}}}function f(t){return function r(n){function i(r,i){var a=t((r=e.cubehelix(r)).h,(i=e.cubehelix(i)).h),s=o(r.s,i.s),l=o(r.l,i.l),c=o(r.opacity,i.opacity);return function(t){return r.h=a(t),r.s=s(t),r.l=l(Math.pow(t,n)),r.opacity=c(t),r+""}}return n=+n,i.gamma=r,i}(1)}var d,p,m,g,v=function(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=i<e-1?t[i+2]:2*o-a;return r((n-i/e)*e,s,a,o,l)}},y=function(t){var e=t.length;return function(n){var i=Math.floor(((n%=1)<0?++n:n)*e),a=t[(i+e-1)%e],o=t[i%e],s=t[(i+1)%e],l=t[(i+2)%e];return r((n-i/e)*e,a,o,s,l)}},b=function(t){return function(){return t}},x=function t(r){function n(t,r){var n=i((t=e.rgb(t)).r,(r=e.rgb(r)).r),a=i(t.g,r.g),s=i(t.b,r.b),l=o(t.opacity,r.opacity);return function(e){return t.r=n(e),t.g=a(e),t.b=s(e),t.opacity=l(e),t+""}}var i=a(r);return n.gamma=t,n}(1),_=s(v),w=s(y),M=function(t,e){var r,n=e?e.length:0,i=t?Math.min(n,t.length):0,a=new Array(n),o=new Array(n);for(r=0;r<i;++r)a[r]=C(t[r],e[r]);for(;r<n;++r)o[r]=e[r];return function(t){for(r=0;r<i;++r)o[r]=a[r](t);return o}},k=function(t,e){var r=new Date;return t=+t,e-=t,function(n){return r.setTime(t+e*n),r}},T=function(t,e){return t=+t,e-=t,function(r){return t+e*r}},A=function(t,e){var r,n={},i={};null!==t&&"object"==typeof t||(t={}),null!==e&&"object"==typeof e||(e={});for(r in e)r in t?n[r]=C(t[r],e[r]):i[r]=e[r];return function(t){for(r in n)i[r]=n[r](t);return i}},S=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,E=new RegExp(S.source,"g"),L=function(t,e){var r,n,i,a=S.lastIndex=E.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(r=S.exec(t))&&(n=E.exec(e));)(i=n.index)>a&&(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:T(r,n)})),a=E.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?function(t){return function(e){return t(e)+""}}(l[0].x):function(t){return function(){return t}}(e):(e=l.length,function(t){for(var r,n=0;n<e;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})},C=function(t,r){var n,i=typeof r;return null==r||"boolean"===i?b(r):("number"===i?T:"string"===i?(n=e.color(r))?(r=n,x):L:r instanceof e.color?x:r instanceof Date?k:Array.isArray(r)?M:"function"!=typeof r.valueOf&&"function"!=typeof r.toString||isNaN(r)?A:T)(t,r)},I=180/Math.PI,P={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1},D=function(t,e,r,n,i,a){var o,s,l;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(l=t*r+e*n)&&(r-=t*l,n-=e*l),(s=Math.sqrt(r*r+n*n))&&(r/=s,n/=s,l/=s),t*n<e*r&&(t=-t,e=-e,l=-l,o=-o),{translateX:i,translateY:a,rotate:Math.atan2(e,t)*I,skewX:Math.atan(l)*I,scaleX:o,scaleY:s}},z=l(function(t){return"none"===t?P:(d||(d=document.createElement("DIV"),p=document.documentElement,m=document.defaultView),d.style.transform=t,t=m.getComputedStyle(p.appendChild(d),null).getPropertyValue("transform"),p.removeChild(d),t=t.slice(7,-1).split(","),D(+t[0],+t[1],+t[2],+t[3],+t[4],+t[5]))},"px, ","px)","deg)"),O=l(function(t){return null==t?P:(g||(g=document.createElementNS("http://www.w3.org/2000/svg","g")),g.setAttribute("transform",t),(t=g.transform.baseVal.consolidate())?(t=t.matrix,D(t.a,t.b,t.c,t.d,t.e,t.f)):P)},", ",")",")"),F=Math.SQRT2,R=u(i),j=u(o),N=h(i),B=h(o),U=f(i),V=f(o);t.interpolate=C,t.interpolateArray=M,t.interpolateBasis=v,t.interpolateBasisClosed=y,t.interpolateDate=k,t.interpolateNumber=T,t.interpolateObject=A,t.interpolateRound=function(t,e){return t=+t,e-=t,function(r){return Math.round(t+e*r)}},t.interpolateString=L,t.interpolateTransformCss=z,t.interpolateTransformSvg=O,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],h=s-i,f=l-a,d=h*h+f*f;if(d<1e-12)n=Math.log(u/o)/F,r=function(t){return[i+t*h,a+t*f,o*Math.exp(F*t*n)]};else{var p=Math.sqrt(d),m=(u*u-o*o+4*d)/(2*o*2*p),g=(u*u-o*o-4*d)/(2*u*2*p),v=Math.log(Math.sqrt(m*m+1)-m),y=Math.log(Math.sqrt(g*g+1)-g);n=(y-v)/F,r=function(t){var e=t*n,r=c(v),s=o/(2*p)*(r*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(F*e+v)-function(t){return((t=Math.exp(t))-1/t)/2}(v));return[i+s*h,a+s*f,o*r/c(F*e+v)]}}return r.duration=1e3*n,r},t.interpolateRgb=x,t.interpolateRgbBasis=_,t.interpolateRgbBasisClosed=w,t.interpolateHsl=R,t.interpolateHslLong=j,t.interpolateLab=function(t,r){var n=o((t=e.lab(t)).l,(r=e.lab(r)).l),i=o(t.a,r.a),a=o(t.b,r.b),s=o(t.opacity,r.opacity);return function(e){return t.l=n(e),t.a=i(e),t.b=a(e),t.opacity=s(e),t+""}},t.interpolateHcl=N,t.interpolateHclLong=B,t.interpolateCubehelix=U,t.interpolateCubehelixLong=V,t.quantize=function(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t(n/(e-1));return r},Object.defineProperty(t,"__esModule",{value:!0})})},{"d3-color":117}],121:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.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,h,f,d=t._root,p={data:n},m=t._x0,g=t._y0,v=t._x1,y=t._y1;if(!d)return t._root=p,t;for(;d.length;)if((c=e>=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o,i=d,!(d=d[h=u<<1|c]))return i[h]=p,t;if(s=+t._x.call(null,d.data),l=+t._y.call(null,d.data),e===s&&r===l)return p.next=d,i?i[h]=p:t._root=p,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(c=e>=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o}while((h=u<<1|c)==(f=(l>=o)<<1|s>=a));return i[f]=d,i[h]=p,t}function r(t){return t[0]}function n(t){return t[1]}function i(t,e,i){var o=new a(null==e?r:e,null==i?n:i,NaN,NaN,NaN,NaN);return null==t?o:o.addAll(t)}function a(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 o(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var s=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},l=i.prototype=a.prototype;l.copy=function(){var t,e,r=new a(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=o(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]=o(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,h=-1/0,f=-1/0;for(n=0;n<o;++n)isNaN(i=+this._x.call(null,r=t[n]))||isNaN(a=+this._y.call(null,r))||(s[n]=i,l[n]=a,i<c&&(c=i),i>h&&(h=i),a<u&&(u=a),a>f&&(f=a));for(h<c&&(c=this._x0,h=this._x1),f<u&&(u=this._y0,f=this._y1),this.cover(c,u).cover(h,f),n=0;n<o;++n)e(this,s[n],l[n],t[n]);return this},l.cover=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var r=this._x0,n=this._y0,i=this._x1,a=this._y1;if(isNaN(r))i=(r=Math.floor(t))+1,a=(n=Math.floor(e))+1;else{if(!(r>t||t>i||n>e||e>a))return this;var o,s,l=i-r,c=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{o=new Array(4),o[s]=c,c=o}while(l*=2,i=r+l,a=n+l,t>i||e>a);break;case 1:do{o=new Array(4),o[s]=c,c=o}while(l*=2,r=i-l,a=n+l,r>t||e>a);break;case 2:do{o=new Array(4),o[s]=c,c=o}while(l*=2,i=r+l,n=a-l,t>i||n>e);break;case 3:do{o=new Array(4),o[s]=c,c=o}while(l*=2,r=i-l,n=a-l,r>t||n>e)}this._root&&this._root.length&&(this._root=c)}return this._x0=r,this._y0=n,this._x1=i,this._y1=a,this},l.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},l.extent=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},l.find=function(t,e,r){var n,i,a,o,l,c,u,h=this._x0,f=this._y0,d=this._x1,p=this._y1,m=[],g=this._root;for(g&&m.push(new s(g,h,f,d,p)),null==r?r=1/0:(h=t-r,f=e-r,d=t+r,p=e+r,r*=r);c=m.pop();)if(!(!(g=c.node)||(i=c.x0)>d||(a=c.y0)>p||(o=c.x1)<h||(l=c.y1)<f))if(g.length){var v=(i+o)/2,y=(a+l)/2;m.push(new s(g[3],v,y,o,l),new s(g[2],i,y,v,l),new s(g[1],v,a,o,y),new s(g[0],i,a,v,y)),(u=(e>=y)<<1|t>=v)&&(c=m[m.length-1],m[m.length-1]=m[m.length-1-u],m[m.length-1-u]=c)}else{var b=t-+this._x.call(null,g.data),x=e-+this._y.call(null,g.data),_=b*b+x*x;if(_<r){var w=Math.sqrt(r=_);h=t-w,f=e-w,d=t+w,p=e+w,n=g.data}}return n},l.remove=function(t){if(isNaN(a=+this._x.call(null,t))||isNaN(o=+this._y.call(null,t)))return this;var e,r,n,i,a,o,s,l,c,u,h,f,d=this._root,p=this._x0,m=this._y0,g=this._x1,v=this._y1;if(!d)return this;if(d.length)for(;;){if((c=a>=(s=(p+g)/2))?p=s:g=s,(u=o>=(l=(m+v)/2))?m=l:v=l,e=d,!(d=d[h=u<<1|c]))return this;if(!d.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;d.data!==t;)if(n=d,!(d=d.next))return this;return(i=d.next)&&delete d.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[f]=d:this._root=d),this):(this._root=i,this)},l.removeAll=function(t){for(var e=0,r=t.length;e<r;++e)this.remove(t[e]);return this},l.root=function(){return this._root},l.size=function(){var t=0;return this.visit(function(e){if(!e.length)do{++t}while(e=e.next)}),t},l.visit=function(t){var e,r,n,i,a,o,l=[],c=this._root;for(c&&l.push(new s(c,this._x0,this._y0,this._x1,this._y1));e=l.pop();)if(!t(c=e.node,n=e.x0,i=e.y0,a=e.x1,o=e.y1)&&c.length){var u=(n+a)/2,h=(i+o)/2;(r=c[3])&&l.push(new s(r,u,h,a,o)),(r=c[2])&&l.push(new s(r,n,h,u,o)),(r=c[1])&&l.push(new s(r,u,i,a,h)),(r=c[0])&&l.push(new s(r,n,i,u,h))}return this},l.visitAfter=function(t){var e,r=[],n=[];for(this._root&&r.push(new s(this._root,this._x0,this._y0,this._x1,this._y1));e=r.pop();){var i=e.node;if(i.length){var a,o=e.x0,l=e.y0,c=e.x1,u=e.y1,h=(o+c)/2,f=(l+u)/2;(a=i[0])&&r.push(new s(a,o,l,h,f)),(a=i[1])&&r.push(new s(a,h,l,c,f)),(a=i[2])&&r.push(new s(a,o,f,h,u)),(a=i[3])&&r.push(new s(a,h,f,c,u))}n.push(e)}for(;e=n.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},l.x=function(t){return arguments.length?(this._x=t,this):this._x},l.y=function(t){return arguments.length?(this._y=t,this):this._y},t.quadtree=i,Object.defineProperty(t,"__esModule",{value:!0})})},{}],122:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.d3=t.d3||{})}(this,function(t){"use strict";function e(){return g||(b(r),g=y.now()+v)}function r(){g=0}function n(){this._call=this._time=this._next=null}function i(t,e,r){var i=new n;return i.restart(t,e,r),i}function a(){e(),++h;for(var t,r=c;r;)(t=g-r._time)>=0&&r._call.call(null,t),r=r._next;--h}function o(){g=(m=y.now())+v,h=f=0;try{a()}finally{h=0,function(){var t,e,r=c,n=1/0;for(;r;)r._call?(n>r._time&&(n=r._time),t=r,r=r._next):(e=r._next,r._next=null,r=t?t._next=e:c=e);u=t,l(n)}(),g=0}}function s(){var t=y.now(),e=t-m;e>p&&(v-=e,m=t)}function l(t){if(!h){f&&(f=clearTimeout(f));var e=t-g;e>24?(t<1/0&&(f=setTimeout(o,e)),d&&(d=clearInterval(d))):(d||(m=g,d=setInterval(s,p)),h=1,b(o))}}var c,u,h=0,f=0,d=0,p=1e3,m=0,g=0,v=0,y="object"==typeof performance&&performance.now?performance:Date,b="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};n.prototype=i.prototype={constructor:n,restart:function(t,r,n){if("function"!=typeof t)throw new TypeError("callback is not a function");n=(null==n?e():+n)+(null==r?0:+r),this._next||u===this||(u?u._next=this:c=this,u=this),this._call=t,this._time=n,l()},stop:function(){this._call&&(this._call=null,this._time=1/0,l())}};t.now=e,t.timer=i,t.timerFlush=a,t.timeout=function(t,e,r){var i=new n;return e=null==e?0:+e,i.restart(function(r){i.stop(),t(r+e)},e,r),i},t.interval=function(t,r,i){var a=new n,o=r;return null==r?(a.restart(t,r,i),a):(r=+r,i=null==i?e():+i,a.restart(function e(n){n+=o,a.restart(e,o+=r,i),t(n)},r,i),a)},Object.defineProperty(t,"__esModule",{value:!0})})},{}],123:[function(t,e,r){!function(){function t(t){return t&&(t.ownerDocument||t.document||t).documentElement}function r(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}function n(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function i(t){return null===t?NaN:+t}function a(t){return!isNaN(t)}function o(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n<i;){var a=n+i>>>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<i;){var a=n+i>>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}function s(t){return t.length}function l(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function c(){this._=Object.create(null)}function u(t){return(t+="")===ua||t[0]===ha?ha+t:t}function h(t){return(t+="")[0]===ha?t.slice(1):t}function f(t){return u(t)in this._}function d(t){return(t=u(t))in this._&&delete this._[t]}function p(){var t=[];for(var e in this._)t.push(h(e));return t}function m(){var t=0;for(var e in this._)++t;return t}function g(){for(var t in this._)return!1;return!0}function v(){this._=Object.create(null)}function y(t){return t}function b(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=fa.length;r<n;++r){var i=fa[r]+e;if(i in t)return i}}function x(){}function _(){}function w(t){function e(){for(var e,n=r,i=-1,a=n.length;++i<a;)(e=n[i].on)&&e.apply(this,arguments);return t}var r=[],n=new c;return e.on=function(e,i){var a,o=n.get(e);return arguments.length<2?o&&o.on:(o&&(o.on=null,r=r.slice(0,a=r.indexOf(o)).concat(r.slice(a+1)),n.remove(e)),i&&r.push(n.set(e,{on:i})),t)},e}function M(){$i.event.preventDefault()}function k(){for(var t,e=$i.event;t=e.sourceEvent;)e=t;return e}function T(t){for(var e=new _,r=0,n=arguments.length;++r<n;)e[arguments[r]]=w(e);return e.of=function(r,n){return function(i){try{var a=i.sourceEvent=$i.event;i.target=t,$i.event=i,e[i.type].apply(r,n)}finally{$i.event=a}}},e}function A(t){return pa(t,ya),t}function S(t){return"function"==typeof t?t:function(){return ma(t,this)}}function E(t){return"function"==typeof t?t:function(){return ga(t,this)}}function L(t,e){return t=$i.ns.qualify(t),null==e?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof e?t.local?function(){var r=e.apply(this,arguments);null==r?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,r)}:function(){var r=e.apply(this,arguments);null==r?this.removeAttribute(t):this.setAttribute(t,r)}:t.local?function(){this.setAttributeNS(t.space,t.local,e)}:function(){this.setAttribute(t,e)}}function C(t){return t.trim().replace(/\s+/g," ")}function I(t){return new RegExp("(?:^|\\s+)"+$i.requote(t)+"(?:\\s+|$)","g")}function P(t){return(t+"").trim().split(/^|\s+/)}function D(t,e){var r=(t=P(t).map(z)).length;return"function"==typeof e?function(){for(var n=-1,i=e.apply(this,arguments);++n<r;)t[n](this,i)}:function(){for(var n=-1;++n<r;)t[n](this,e)}}function z(t){var e=I(t);return function(r,n){if(i=r.classList)return n?i.add(t):i.remove(t);var i=r.getAttribute("class")||"";n?(e.lastIndex=0,e.test(i)||r.setAttribute("class",C(i+" "+t))):r.setAttribute("class",C(i.replace(e," ")))}}function O(t,e,r){return null==e?function(){this.style.removeProperty(t)}:"function"==typeof e?function(){var n=e.apply(this,arguments);null==n?this.style.removeProperty(t):this.style.setProperty(t,n,r)}:function(){this.style.setProperty(t,e,r)}}function F(t,e){return null==e?function(){delete this[t]}:"function"==typeof e?function(){var r=e.apply(this,arguments);null==r?delete this[t]:this[t]=r}:function(){this[t]=e}}function R(t){return"function"==typeof t?t:(t=$i.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var e=this.ownerDocument,r=this.namespaceURI;return r===ba&&e.documentElement.namespaceURI===ba?e.createElement(t):e.createElementNS(r,t)}}function j(){var t=this.parentNode;t&&t.removeChild(this)}function N(t){return{__data__:t}}function B(t){return function(){return va(this,t)}}function U(t,e){for(var r=0,n=t.length;r<n;r++)for(var i,a=t[r],o=0,s=a.length;o<s;o++)(i=a[o])&&e(i,o,r);return t}function V(t){return pa(t,_a),t}function H(t,e,r){function n(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}var i="__on"+t,a=t.indexOf("."),o=q;a>0&&(t=t.slice(0,a));var s=wa.get(t);return s&&(t=s,o=G),a?e?function(){var a=o(e,ea(arguments));n.call(this),this.addEventListener(t,this[i]=a,a.$=r),a._=e}:n:e?x:function(){var e,r=new RegExp("^__on([^.]+)"+$i.requote(t)+"$");for(var n in this)if(e=n.match(r)){var i=this[n];this.removeEventListener(e[1],i,i.$),delete this[n]}}}function q(t,e){return function(r){var n=$i.event;$i.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{$i.event=n}}}function G(t,e){var r=q(t,e);return function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||r.call(this,t)}}function Y(e){var n=".dragsuppress-"+ ++ka,i="click"+n,a=$i.select(r(e)).on("touchmove"+n,M).on("dragstart"+n,M).on("selectstart"+n,M);if(null==Ma&&(Ma=!("onselectstart"in e)&&b(e.style,"userSelect")),Ma){var o=t(e).style,s=o[Ma];o[Ma]="none"}return function(t){if(a.on(n,null),Ma&&(o[Ma]=s),t){var e=function(){a.on(i,null)};a.on(i,function(){M(),e()},!0),setTimeout(e,0)}}}function W(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(Ta<0){var a=r(t);if(a.scrollX||a.scrollY){var o=(n=$i.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();Ta=!(o.f||o.e),n.remove()}}return Ta?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function X(){return $i.event.changedTouches[0].identifier}function Z(t){return t>0?1:t<0?-1:0}function J(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function K(t){return t>1?0:t<-1?Ea:Math.acos(t)}function Q(t){return t>1?Ia:t<-1?-Ia:Math.asin(t)}function $(t){return((t=Math.exp(t))+1/t)/2}function tt(t){return(t=Math.sin(t/2))*t}function et(){}function rt(t,e,r){return this instanceof rt?(this.h=+t,this.s=+e,void(this.l=+r)):arguments.length<2?t instanceof rt?new rt(t.h,t.s,t.l):gt(""+t,vt,rt):new rt(t,e,r)}function nt(t,e,r){function n(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?i+(a-i)*t/60:t<180?a:t<240?i+(a-i)*(240-t)/60:i}(t))}var i,a;return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,r=r<0?0:r>1?1:r,a=r<=.5?r*(1+e):r+e-r*e,i=2*r-a,new ft(n(t+120),n(t),n(t-120))}function it(t,e,r){return this instanceof it?(this.h=+t,this.c=+e,void(this.l=+r)):arguments.length<2?t instanceof it?new it(t.h,t.c,t.l):lt(t instanceof ot?t.l:(t=yt((t=$i.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new it(t,e,r)}function at(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new ot(r,Math.cos(t*=Pa)*e,Math.sin(t)*e)}function ot(t,e,r){return this instanceof ot?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof ot?new ot(t.l,t.a,t.b):t instanceof it?at(t.h,t.c,t.l):yt((t=ft(t)).r,t.g,t.b):new ot(t,e,r)}function st(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return i=ct(i)*Ua,n=ct(n)*Va,a=ct(a)*Ha,new ft(ht(3.2404542*i-1.5371385*n-.4985314*a),ht(-.969266*i+1.8760108*n+.041556*a),ht(.0556434*i-.2040259*n+1.0572252*a))}function lt(t,e,r){return t>0?new it(Math.atan2(r,e)*Da,Math.sqrt(e*e+r*r),t):new it(NaN,NaN,t)}function ct(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ut(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ht(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ft(t,e,r){return this instanceof ft?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ft?new ft(t.r,t.g,t.b):gt(""+t,ft,nt):new ft(t,e,r)}function dt(t){return new ft(t>>16,t>>8&255,255&t)}function pt(t){return dt(t)+""}function mt(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function gt(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(xt(i[0]),xt(i[1]),xt(i[2]))}return(a=Ya.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 vt(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+(e<r?6:0):e==o?(r-t)/s+2:(t-e)/s+4,n*=60):(n=NaN,i=l>0&&l<1?0:n),new rt(n,i,l)}function yt(t,e,r){var n=ut((.4124564*(t=bt(t))+.3575761*(e=bt(e))+.1804375*(r=bt(r)))/Ua),i=ut((.2126729*t+.7151522*e+.072175*r)/Va);return ot(116*i-16,500*(n-i),200*(i-ut((.0193339*t+.119192*e+.9503041*r)/Ha)))}function bt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function xt(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}function _t(t){return"function"==typeof t?t:function(){return t}}function wt(t){return function(e,r,n){return 2===arguments.length&&"function"==typeof r&&(n=r,r=null),Mt(e,r,t,n)}}function Mt(t,e,r,n){function i(){var t,e=l.status;if(!e&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(l)||e>=200&&e<300||304===e){try{t=r.call(a,l)}catch(t){return void o.error.call(a,t)}o.load.call(a,t)}else o.error.call(a,l)}var a={},o=$i.dispatch("beforesend","progress","load","error"),s={},l=new XMLHttpRequest,c=null;return!this.XDomainRequest||"withCredentials"in l||!/^(http(s)?:)?\/\//.test(t)||(l=new XDomainRequest),"onload"in l?l.onload=l.onerror=i:l.onreadystatechange=function(){l.readyState>3&&i()},l.onprogress=function(t){var e=$i.event;$i.event=t;try{o.progress.call(a,l)}finally{$i.event=e}},a.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?s[t]:(null==e?delete s[t]:s[t]=e+"",a)},a.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",a):e},a.responseType=function(t){return arguments.length?(c=t,a):c},a.response=function(t){return r=t,a},["get","post"].forEach(function(t){a[t]=function(){return a.send.apply(a,[t].concat(ea(arguments)))}}),a.send=function(r,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),l.open(r,t,!0),null==e||"accept"in s||(s.accept=e+",*/*"),l.setRequestHeader)for(var u in s)l.setRequestHeader(u,s[u]);return null!=e&&l.overrideMimeType&&l.overrideMimeType(e),null!=c&&(l.responseType=c),null!=i&&a.on("error",i).on("load",function(t){i(null,t)}),o.beforesend.call(a,l),l.send(null==n?null:n),a},a.abort=function(){return l.abort(),a},$i.rebind(a,o,"on"),null==n?a:a.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(n))}function kt(t,e,r){var n=arguments.length;n<2&&(e=0),n<3&&(r=Date.now());var i={c:t,t:r+e,n:null};return Xa?Xa.n=i:Wa=i,Xa=i,Za||(Ja=clearTimeout(Ja),Za=1,Ka(Tt)),i}function Tt(){var t=At(),e=St()-t;e>24?(isFinite(e)&&(clearTimeout(Ja),Ja=setTimeout(Tt,e)),Za=0):(Za=1,Ka(Tt))}function At(){for(var t=Date.now(),e=Wa;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function St(){for(var t,e=Wa,r=1/0;e;)e.c?(e.t<r&&(r=e.t),e=(t=e).n):e=t?t.n=e.n:Wa=e.n;return Xa=t,r}function Et(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}function Lt(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}function Ct(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r<n-e?r:n}function i(r){return e(r=t(new ro(r-1)),1),r}function a(t,r){return e(t=new ro(+t),r),t}function o(t,n,a){var o=i(t),s=[];if(a>1)for(;o<n;)r(o)%a||s.push(new Date(+o)),e(o,1);else for(;o<n;)s.push(new Date(+o)),e(o,1);return s}t.floor=t,t.round=n,t.ceil=i,t.offset=a,t.range=o;var s=t.utc=It(t);return s.floor=s,s.round=It(n),s.ceil=It(i),s.offset=It(a),s.range=function(t,e,r){try{ro=Lt;var n=new Lt;return n._=t,o(n,e,r)}finally{ro=Date}},t}function It(t){return function(e,r){try{ro=Lt;var n=new Lt;return n._=e,t(n,r)._}finally{ro=Date}}}function Pt(t,e,r){var n=t<0?"-":"",i=(n?-t:t)+"",a=i.length;return n+(a<r?new Array(r-a+1).join(e)+i:i)}function Dt(t){return new RegExp("^(?:"+t.map($i.requote).join("|")+")","i")}function zt(t){for(var e=new c,r=-1,n=t.length;++r<n;)e.set(t[r].toLowerCase(),r);return e}function Ot(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+1));return n?(t.w=+n[0],r+n[0].length):-1}function Ft(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r));return n?(t.U=+n[0],r+n[0].length):-1}function Rt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r));return n?(t.W=+n[0],r+n[0].length):-1}function jt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+4));return n?(t.y=+n[0],r+n[0].length):-1}function Nt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+2));return n?(t.y=function(t){return t+(t>68?1900:2e3)}(+n[0]),r+n[0].length):-1}function Bt(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ut(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Vt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function Ht(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function qt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function Gt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function Yt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function Wt(t,e,r){ao.lastIndex=0;var n=ao.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function Xt(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=ca(e)/60|0,i=ca(e)%60;return r+Pt(n,"0",2)+Pt(i,"0",2)}function Zt(t,e,r){oo.lastIndex=0;var n=oo.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function Jt(t){for(var e=t.length,r=-1;++r<e;)t[r][0]=this(t[r][0]);return function(e){for(var r=0,n=t[r];!n[1](e);)n=t[++r];return n[0](e)}}function Kt(){}function Qt(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function $t(t,e){t&&uo.hasOwnProperty(t.type)&&uo[t.type](t,e)}function te(t,e,r){var n,i=-1,a=t.length-r;for(e.lineStart();++i<a;)n=t[i],e.point(n[0],n[1],n[2]);e.lineEnd()}function ee(t,e){var r=-1,n=t.length;for(e.polygonStart();++r<n;)te(t[r],e,1);e.polygonEnd()}function re(){function t(t,e){e=e*Pa/2+Ea/4;var r=(t*=Pa)-n,o=r>=0?1:-1,s=o*r,l=Math.cos(e),c=Math.sin(e),u=a*c,h=i*l+u*Math.cos(s),f=u*o*Math.sin(s);fo.add(Math.atan2(f,h)),n=t,i=l,a=c}var e,r,n,i,a;po.point=function(o,s){po.point=t,n=(e=o)*Pa,i=Math.cos(s=(r=s)*Pa/2+Ea/4),a=Math.sin(s)},po.lineEnd=function(){t(e,r)}}function ne(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 ie(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function ae(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 oe(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function se(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function le(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 ce(t){return[Math.atan2(t[1],t[0]),Q(t[2])]}function ue(t,e){return ca(t[0]-e[0])<Aa&&ca(t[1]-e[1])<Aa}function he(t,e){t*=Pa;var r=Math.cos(e*=Pa);fe(r*Math.cos(t),r*Math.sin(t),Math.sin(e))}function fe(t,e,r){vo+=(t-vo)/++mo,yo+=(e-yo)/mo,bo+=(r-bo)/mo}function de(){function t(t,i){t*=Pa;var a=Math.cos(i*=Pa),o=a*Math.cos(t),s=a*Math.sin(t),l=Math.sin(i),c=Math.atan2(Math.sqrt((c=r*l-n*s)*c+(c=n*o-e*l)*c+(c=e*s-r*o)*c),e*o+r*s+n*l);go+=c,xo+=c*(e+(e=o)),_o+=c*(r+(r=s)),wo+=c*(n+(n=l)),fe(e,r,n)}var e,r,n;Ao.point=function(i,a){i*=Pa;var o=Math.cos(a*=Pa);e=o*Math.cos(i),r=o*Math.sin(i),n=Math.sin(a),Ao.point=t,fe(e,r,n)}}function pe(){Ao.point=he}function me(){function t(t,e){t*=Pa;var r=Math.cos(e*=Pa),o=r*Math.cos(t),s=r*Math.sin(t),l=Math.sin(e),c=i*l-a*s,u=a*o-n*l,h=n*s-i*o,f=Math.sqrt(c*c+u*u+h*h),d=n*o+i*s+a*l,p=f&&-K(d)/f,m=Math.atan2(f,d);Mo+=p*c,ko+=p*u,To+=p*h,go+=m,xo+=m*(n+(n=o)),_o+=m*(i+(i=s)),wo+=m*(a+(a=l)),fe(n,i,a)}var e,r,n,i,a;Ao.point=function(o,s){e=o,r=s,Ao.point=t,o*=Pa;var l=Math.cos(s*=Pa);n=l*Math.cos(o),i=l*Math.sin(o),a=Math.sin(s),fe(n,i,a)},Ao.lineEnd=function(){t(e,r),Ao.lineEnd=pe,Ao.point=he}}function ge(t,e){function r(r,n){return r=t(r,n),e(r[0],r[1])}return t.invert&&e.invert&&(r.invert=function(r,n){return(r=e.invert(r,n))&&t.invert(r[0],r[1])}),r}function ve(){return!0}function ye(t,e,r,n,i){var a=[],o=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,r=t[0],n=t[e];if(ue(r,n)){i.lineStart();for(var s=0;s<e;++s)i.point((r=t[s])[0],r[1]);i.lineEnd()}else{var l=new xe(r,t,null,!0),c=new xe(r,null,l,!1);l.o=c,a.push(l),o.push(c),c=new xe(n,null,l=new xe(n,t,null,!1),!0),l.o=c,a.push(l),o.push(c)}}}),o.sort(e),be(a),be(o),a.length){for(var s=0,l=r,c=o.length;s<c;++s)o[s].e=l=!l;for(var u,h,f=a[0];;){for(var d=f,p=!0;d.v;)if((d=d.n)===f)return;u=d.z,i.lineStart();do{if(d.v=d.o.v=!0,d.e){if(p)for(s=0,c=u.length;s<c;++s)i.point((h=u[s])[0],h[1]);else n(d.x,d.n.x,1,i);d=d.n}else{if(p)for(s=(u=d.p.z).length-1;s>=0;--s)i.point((h=u[s])[0],h[1]);else n(d.x,d.p.x,-1,i);d=d.p}u=(d=d.o).z,p=!p}while(!d.v);i.lineEnd()}}}function be(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n<e;)i.n=r=t[n],r.p=i,i=r;i.n=r=t[0],r.p=i}}function xe(t,e,r,n){this.x=t,this.z=e,this.o=r,this.e=n,this.v=!1,this.n=this.p=null}function _e(t,e,r,n){return function(i,a){function o(e,r){var n=i(e,r);t(e=n[0],r=n[1])&&a.point(e,r)}function s(t,e){var r=i(t,e);g.point(r[0],r[1])}function l(){y.point=s,g.lineStart()}function c(){y.point=o,g.lineEnd()}function u(t,e){m.push([t,e]);var r=i(t,e);x.point(r[0],r[1])}function h(){x.lineStart(),m=[]}function f(){u(m[0][0],m[0][1]),x.lineEnd();var t,e=x.clean(),r=b.buffer(),n=r.length;if(m.pop(),p.push(m),m=null,n)if(1&e){var i,o=-1;if((n=(t=r[0]).length-1)>0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o<n;)a.point((i=t[o])[0],i[1]);a.lineEnd()}}else n>1&&2&e&&r.push(r.pop().concat(r.shift())),d.push(r.filter(we))}var d,p,m,g=e(a),v=i.invert(n[0],n[1]),y={point:o,lineStart:l,lineEnd:c,polygonStart:function(){y.point=u,y.lineStart=h,y.lineEnd=f,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=c,d=$i.merge(d);var t=function(t,e){var r=t[0],n=t[1],i=[Math.sin(r),-Math.cos(r),0],a=0,o=0;fo.reset();for(var s=0,l=e.length;s<l;++s){var c=e[s],u=c.length;if(u)for(var h=c[0],f=h[0],d=h[1]/2+Ea/4,p=Math.sin(d),m=Math.cos(d),g=1;;){g===u&&(g=0);var v=(t=c[g])[0],y=t[1]/2+Ea/4,b=Math.sin(y),x=Math.cos(y),_=v-f,w=_>=0?1:-1,M=w*_,k=M>Ea,T=p*b;if(fo.add(Math.atan2(T*w*Math.sin(M),m*x+T*Math.cos(M))),a+=k?_+w*La:_,k^f>=r^v>=r){var A=ae(ne(h),ne(t));le(A);var S=ae(i,A);le(S);var E=(k^_>=0?-1:1)*Q(S[2]);(n>E||n===E&&(A[0]||A[1]))&&(o+=k^_>=0?1:-1)}if(!g++)break;f=v,p=b,m=x,h=t}}return(a<-Aa||a<Aa&&fo<-Aa)^1&o}(v,p);d.length?(_||(a.polygonStart(),_=!0),ye(d,ke,t,r,a)):t&&(_||(a.polygonStart(),_=!0),a.lineStart(),r(null,null,1,a),a.lineEnd()),_&&(a.polygonEnd(),_=!1),d=p=null},sphere:function(){a.polygonStart(),a.lineStart(),r(null,null,1,a),a.lineEnd(),a.polygonEnd()}},b=Me(),x=e(b),_=!1;return y}}function we(t){return t.length>1}function Me(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:x,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function ke(t,e){return((t=t.x)[0]<0?t[1]-Ia-Aa:Ia-t[1])-((e=e.x)[0]<0?e[1]-Ia-Aa:Ia-e[1])}function Te(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,c=o.y,u=0,h=1,f=s.x-l,d=s.y-c;if(a=t-l,f||!(a>0)){if(a/=f,f<0){if(a<u)return;a<h&&(h=a)}else if(f>0){if(a>h)return;a>u&&(u=a)}if(a=r-l,f||!(a<0)){if(a/=f,f<0){if(a>h)return;a>u&&(u=a)}else if(f>0){if(a<u)return;a<h&&(h=a)}if(a=e-c,d||!(a>0)){if(a/=d,d<0){if(a<u)return;a<h&&(h=a)}else if(d>0){if(a>h)return;a>u&&(u=a)}if(a=n-c,d||!(a<0)){if(a/=d,d<0){if(a>h)return;a>u&&(u=a)}else if(d>0){if(a<u)return;a<h&&(h=a)}return u>0&&(i.a={x:l+u*f,y:c+u*d}),h<1&&(i.b={x:l+h*f,y:c+h*d}),i}}}}}}function Ae(t,e,r,n){function i(n,i){return ca(n[0]-t)<Aa?i>0?0:3:ca(n[0]-r)<Aa?i>0?2:1:ca(n[1]-e)<Aa?i>0?1:0:i>0?3:2}function a(t,e){return o(t.x,e.x)}function o(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]}return function(s){function l(a,s,l,c){var u=0,h=0;if(null==a||(u=i(a,l))!==(h=i(s,l))||o(a,s)<0^l>0)do{c.point(0===u||3===u?t:r,u>1?n:e)}while((u=(u+l+4)%4)!==h);else c.point(s[0],s[1])}function c(i,a){return t<=i&&i<=r&&e<=a&&a<=n}function u(t,e){c(t,e)&&s.point(t,e)}function h(t,e){var r=c(t=Math.max(-Eo,Math.min(Eo,t)),e=Math.max(-Eo,Math.min(Eo,e)));if(d&&p.push([t,e]),_)m=t,g=e,v=r,_=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&x)s.point(t,e);else{var n={a:{x:y,y:b},b:{x:t,y:e}};T(n)?(x||(s.lineStart(),s.point(n.a.x,n.a.y)),s.point(n.b.x,n.b.y),r||s.lineEnd(),w=!1):r&&(s.lineStart(),s.point(t,e),w=!1)}y=t,b=e,x=r}var f,d,p,m,g,v,y,b,x,_,w,M=s,k=Me(),T=Te(t,e,r,n),A={point:u,lineStart:function(){A.point=h,d&&d.push(p=[]),_=!0,x=!1,y=b=NaN},lineEnd:function(){f&&(h(m,g),v&&x&&k.rejoin(),f.push(k.buffer())),A.point=u,x&&s.lineEnd()},polygonStart:function(){s=k,f=[],d=[],w=!0},polygonEnd:function(){s=M,f=$i.merge(f);var e=function(t){for(var e=0,r=d.length,n=t[1],i=0;i<r;++i)for(var a,o=1,s=d[i],l=s.length,c=s[0];o<l;++o)a=s[o],c[1]<=n?a[1]>n&&J(c,a,t)>0&&++e:a[1]<=n&&J(c,a,t)<0&&--e,c=a;return 0!==e}([t,n]),r=w&&e,i=f.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),l(null,null,1,s),s.lineEnd()),i&&ye(f,a,e,l,s),s.polygonEnd()),f=d=p=null}};return A}}function Se(t){var e=0,r=Ea/3,n=Ne(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*Ea/180,r=t[1]*Ea/180):[e/Ea*180,r/Ea*180]},i}function Ee(t,e){function r(t,e){var r=Math.sqrt(a-2*i*Math.sin(e))/i;return[r*Math.sin(t*=i),o-r*Math.cos(t)]}var n=Math.sin(t),i=(n+Math.sin(e))/2,a=1+n*(2*i-n),o=Math.sqrt(a)/i;return r.invert=function(t,e){var r=o-e;return[Math.atan2(t,r)/i,Q((a-(t*t+r*r)*i*i)/(2*i))]},r}function Le(){function t(t,e){Co+=i*t-n*e,n=t,i=e}var e,r,n,i;Oo.point=function(a,o){Oo.point=t,e=n=a,r=i=o},Oo.lineEnd=function(){t(e,r)}}function Ce(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Ie(t,e){vo+=t,yo+=e,++bo}function Pe(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);xo+=o*(e+t)/2,_o+=o*(r+n)/2,wo+=o,Ie(e=t,r=n)}var e,r;Ro.point=function(n,i){Ro.point=t,Ie(e=n,r=i)}}function De(){Ro.point=Ie}function ze(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);xo+=o*(n+t)/2,_o+=o*(i+e)/2,wo+=o,Mo+=(o=i*t-n*e)*(n+t),ko+=o*(i+e),To+=3*o,Ie(n=t,i=e)}var e,r,n,i;Ro.point=function(a,o){Ro.point=t,Ie(e=n=a,r=i=o)},Ro.lineEnd=function(){t(e,r)}}function Oe(t){function e(e){return(a?function(e){function n(r,n){r=t(r,n),e.point(r[0],r[1])}function i(){y=NaN,M.point=o,e.lineStart()}function o(n,i){var o=ne([n,i]),s=t(n,i);r(y,b,v,x,_,w,y=s[0],b=s[1],v=n,x=o[0],_=o[1],w=o[2],a,e),e.point(y,b)}function s(){M.point=n,e.lineEnd()}function l(){i(),M.point=c,M.lineEnd=u}function c(t,e){o(h=t,e),f=y,d=b,p=x,m=_,g=w,M.point=o}function u(){r(y,b,v,x,_,w,f,d,h,p,m,g,a,e),M.lineEnd=s,s()}var h,f,d,p,m,g,v,y,b,x,_,w,M={point:n,lineStart:i,lineEnd:s,polygonStart:function(){e.polygonStart(),M.lineStart=l},polygonEnd:function(){e.polygonEnd(),M.lineStart=i}};return M}:function(e){return Re(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})})(e)}function r(e,a,o,s,l,c,u,h,f,d,p,m,g,v){var y=u-e,b=h-a,x=y*y+b*b;if(x>4*n&&g--){var _=s+d,w=l+p,M=c+m,k=Math.sqrt(_*_+w*w+M*M),T=Math.asin(M/=k),A=ca(ca(M)-1)<Aa||ca(o-f)<Aa?(o+f)/2:Math.atan2(w,_),S=t(A,T),E=S[0],L=S[1],C=E-e,I=L-a,P=b*C-y*I;(P*P/x>n||ca((y*C+b*I)/x-.5)>.3||s*d+l*p+c*m<i)&&(r(e,a,o,s,l,c,E,L,A,_/=k,w/=k,M,g,v),v.point(E,L),r(E,L,A,_,w,M,u,h,f,d,p,m,g,v))}}var n=.5,i=Math.cos(30*Pa),a=16;return e.precision=function(t){return arguments.length?(a=(n=t*t)>0&&16,e):Math.sqrt(n)},e}function Fe(t){this.stream=t}function Re(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 je(t){return Ne(function(){return t})()}function Ne(t){function e(t){return t=o(t[0]*Pa,t[1]*Pa),[t[0]*h+s,l-t[1]*h]}function r(){o=ge(a=He(g,v,b),i);var t=i(p,m);return s=f-t[0]*h,l=d+t[1]*h,n()}function n(){return c&&(c.valid=!1,c=null),e}var i,a,o,s,l,c,u=Oe(function(t,e){return t=i(t,e),[t[0]*h+s,l-t[1]*h]}),h=150,f=480,d=250,p=0,m=0,g=0,v=0,b=0,x=So,_=y,w=null,M=null;return e.stream=function(t){return c&&(c.valid=!1),c=Be(x(a,u(_(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(x=null==t?(w=t,So):function(t){function e(t,e){return Math.cos(t)*Math.cos(e)>i}function r(t,e,r){var n=[1,0,0],a=ae(ne(t),ne(e)),o=ie(a,a),s=a[0],l=o-s*s;if(!l)return!r&&t;var c=i*o/l,u=-i*s/l,h=ae(n,a),f=se(n,c);oe(f,se(a,u));var d=h,p=ie(f,d),m=ie(d,d),g=p*p-m*(ie(f,f)-1);if(!(g<0)){var v=Math.sqrt(g),y=se(d,(-p-v)/m);if(oe(y,f),y=ce(y),!r)return y;var b,x=t[0],_=e[0],w=t[1],M=e[1];_<x&&(b=x,x=_,_=b);var k=_-x,T=ca(k-Ea)<Aa;if(!T&&M<w&&(b=w,w=M,M=b),T||k<Aa?T?w+M>0^y[1]<(ca(y[0]-x)<Aa?w:M):w<=y[1]&&y[1]<=M:k>Ea^(x<=y[0]&&y[0]<=_)){var A=se(d,(-p+v)/m);return oe(A,f),[y,ce(A)]}}}function n(e,r){var n=a?t:Ea-t,i=0;return e<-n?i|=1:e>n&&(i|=2),r<-n?i|=4:r>n&&(i|=8),i}var i=Math.cos(t),a=i>0,o=ca(i)>Aa;return _e(e,function(t){var i,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(h,f){var d,p=[h,f],m=e(h,f),g=a?m?0:n(h,f):m?n(h+(h<0?Ea:-Ea),f):0;if(!i&&(c=l=m)&&t.lineStart(),m!==l&&(d=r(i,p),(ue(i,d)||ue(p,d))&&(p[0]+=Aa,p[1]+=Aa,m=e(p[0],p[1]))),m!==l)u=0,m?(t.lineStart(),d=r(p,i),t.point(d[0],d[1])):(d=r(i,p),t.point(d[0],d[1]),t.lineEnd()),i=d;else if(o&&i&&a^m){var v;g&s||!(v=r(p,i,!0))||(u=0,a?(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])))}!m||i&&ue(i,p)||t.point(p[0],p[1]),i=p,l=m,s=g},lineEnd:function(){l&&t.lineEnd(),i=null},clean:function(){return u|(c&&l)<<1}}},We(t,6*Pa),a?[0,-t]:[-Ea,t-Ea])}((w=+t)*Pa),n()):w},e.clipExtent=function(t){return arguments.length?(M=t,_=t?Ae(t[0][0],t[0][1],t[1][0],t[1][1]):y,n()):M},e.scale=function(t){return arguments.length?(h=+t,r()):h},e.translate=function(t){return arguments.length?(f=+t[0],d=+t[1],r()):[f,d]},e.center=function(t){return arguments.length?(p=t[0]%360*Pa,m=t[1]%360*Pa,r()):[p*Da,m*Da]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Pa,v=t[1]%360*Pa,b=t.length>2?t[2]%360*Pa:0,r()):[g*Da,v*Da,b*Da]},$i.rebind(e,u,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.invert&&function(t){return(t=o.invert((t[0]-s)/h,(l-t[1])/h))&&[t[0]*Da,t[1]*Da]},r()}}function Be(t){return Re(t,function(e,r){t.point(e*Pa,r*Pa)})}function Ue(t,e){return[t,e]}function Ve(t,e){return[t>Ea?t-La:t<-Ea?t+La:t,e]}function He(t,e,r){return t?e||r?ge(Ge(t),Ye(e,r)):Ge(t):e||r?Ye(e,r):Ve}function qe(t){return function(e,r){return e+=t,[e>Ea?e-La:e<-Ea?e+La:e,r]}}function Ge(t){var e=qe(t);return e.invert=qe(-t),e}function Ye(t,e){function r(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,c=Math.sin(e),u=c*n+s*i;return[Math.atan2(l*a-u*o,s*n-c*i),Q(u*a+l*o)]}var n=Math.cos(t),i=Math.sin(t),a=Math.cos(e),o=Math.sin(e);return r.invert=function(t,e){var r=Math.cos(e),s=Math.cos(t)*r,l=Math.sin(t)*r,c=Math.sin(e),u=c*a-l*o;return[Math.atan2(l*a+c*o,s*n+u*i),Q(u*n-s*i)]},r}function We(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Xe(r,i),a=Xe(r,a),(o>0?i<a:i>a)&&(i+=o*La)):(i=t+o*La,a=t-.5*l);for(var c,u=i;o>0?u>a:u<a;u-=l)s.point((c=ce([r,-n*Math.cos(u),-n*Math.sin(u)]))[0],c[1])}}function Xe(t,e){var r=ne(e);r[0]-=t,le(r);var n=K(-r[1]);return((-r[2]<0?-n:n)+2*Math.PI-Aa)%(2*Math.PI)}function Ze(t,e,r){var n=$i.range(t,e-Aa,r).concat(e);return function(t){return n.map(function(e){return[t,e]})}}function Je(t,e,r){var n=$i.range(t,e-Aa,r).concat(e);return function(t){return n.map(function(e){return[e,t]})}}function Ke(t){return t.source}function Qe(t){return t.target}function $e(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}function tr(t,e){function r(t,e){o>0?e<-Ia+Aa&&(e=-Ia+Aa):e>Ia-Aa&&(e=Ia-Aa);var r=o/Math.pow(i(e),a);return[r*Math.sin(a*t),o-r*Math.cos(a*t)]}var n=Math.cos(t),i=function(t){return Math.tan(Ea/4+t/2)},a=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),o=n*Math.pow(i(t),a)/a;return a?(r.invert=function(t,e){var r=o-e,n=Z(a)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/a,2*Math.atan(Math.pow(o/n,1/a))-Ia]},r):rr}function er(t,e){function r(t,e){var r=a-e;return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),a=n/i+t;return ca(i)<Aa?Ue:(r.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/i,a-Z(i)*Math.sqrt(t*t+r*r)]},r)}function rr(t,e){return[t,Math.log(Math.tan(Ea/4+e/2))]}function nr(t){var e,r=je(t),n=r.scale,i=r.translate,a=r.clipExtent;return r.scale=function(){var t=n.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.translate=function(){var t=i.apply(r,arguments);return t===r?e?r.clipExtent(null):r:t},r.clipExtent=function(t){var o=a.apply(r,arguments);if(o===r){if(e=null==t){var s=Ea*n(),l=i();a([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(o=null);return o},r.clipExtent(null)}function ir(t,e){return[Math.log(Math.tan(Ea/4+e/2)),-t]}function ar(t){return t[0]}function or(t){return t[1]}function sr(t){for(var e=t.length,r=[0,1],n=2,i=2;i<e;i++){for(;n>1&&J(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function lr(t,e){return t[0]-e[0]||t[1]-e[1]}function cr(t,e,r){return(r[0]-e[0])*(t[1]-e[1])<(r[1]-e[1])*(t[0]-e[0])}function ur(t,e,r,n){var i=t[0],a=r[0],o=e[0]-i,s=n[0]-a,l=t[1],c=r[1],u=e[1]-l,h=n[1]-c,f=(s*(l-c)-h*(i-a))/(h*o-s*u);return[i+f*o,l+f*u]}function hr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function fr(t){var e=Ko.pop()||new function(){Sr(this),this.edge=this.site=this.circle=null};return e.site=t,e}function dr(t){_r(t),Xo.remove(t),Ko.push(t),Sr(t)}function pr(t){var e=t.circle,r=e.x,n=e.cy,i={x:r,y:n},a=t.P,o=t.N,s=[t];dr(t);for(var l=a;l.circle&&ca(r-l.circle.x)<Aa&&ca(n-l.circle.cy)<Aa;)a=l.P,s.unshift(l),dr(l),l=a;s.unshift(l),_r(l);for(var c=o;c.circle&&ca(r-c.circle.x)<Aa&&ca(n-c.circle.cy)<Aa;)o=c.N,s.push(c),dr(c),c=o;s.push(c),_r(c);var u,h=s.length;for(u=1;u<h;++u)c=s[u],l=s[u-1],kr(c.edge,l.site,c.site,i);l=s[0],(c=s[h-1]).edge=Mr(l.site,c.site,null,i),xr(l),xr(c)}function mr(t){for(var e,r,n,i,a=t.x,o=t.y,s=Xo._;s;)if((n=gr(s,o)-a)>Aa)s=s.L;else{if(!((i=a-function(t,e){var r=t.N;if(r)return gr(r,e);var n=t.site;return n.y===e?n.x:1/0}(s,o))>Aa)){n>-Aa?(e=s.P,r=s):i>-Aa?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=fr(t);if(Xo.insert(e,l),e||r){if(e===r)return _r(e),r=fr(e.site),Xo.insert(l,r),l.edge=r.edge=Mr(e.site,l.site),xr(e),void xr(r);if(r){_r(e),_r(r);var c=e.site,u=c.x,h=c.y,f=t.x-u,d=t.y-h,p=r.site,m=p.x-u,g=p.y-h,v=2*(f*g-d*m),y=f*f+d*d,b=m*m+g*g,x={x:(g*y-d*b)/v+u,y:(f*b-m*y)/v+h};kr(r.edge,c,p,x),l.edge=Mr(c,t,null,x),r.edge=Mr(t,p,null,x),xr(e),xr(r)}else l.edge=Mr(e.site,l.site)}}function gr(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,h=1/a-1/c,f=u/c;return h?(-f+Math.sqrt(f*f-2*h*(u*u/(-2*c)-l+c/2+i-a/2)))/h+n:(n+s)/2}function vr(t){this.site=t,this.edges=[]}function yr(t){for(var e,r,n,i,a,o,s,l,c,u,h=t[0][0],f=t[1][0],d=t[0][1],p=t[1][1],m=Wo,g=m.length;g--;)if((a=m[g])&&a.prepare())for(l=(s=a.edges).length,o=0;o<l;)n=(u=s[o].end()).x,i=u.y,e=(c=s[++o%l].start()).x,r=c.y,(ca(n-e)>Aa||ca(i-r)>Aa)&&(s.splice(o,0,new Tr(function(t,e,r){var n=new wr(t,null);return n.a=e,n.b=r,Yo.push(n),n}(a.site,u,ca(n-h)<Aa&&p-i>Aa?{x:h,y:ca(e-h)<Aa?r:p}:ca(i-p)<Aa&&f-n>Aa?{x:ca(r-p)<Aa?e:f,y:p}:ca(n-f)<Aa&&i-d>Aa?{x:f,y:ca(e-f)<Aa?r:d}:ca(i-d)<Aa&&n-h>Aa?{x:ca(r-d)<Aa?e:h,y:d}:null),a.site,null)),++l)}function br(t,e){return e.angle-t.angle}function xr(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,h=2*(l*(g=a.y-s)-c*u);if(!(h>=-Sa)){var f=l*l+c*c,d=u*u+g*g,p=(g*f-c*d)/h,m=(l*d-u*f)/h,g=m+s,v=Qo.pop()||new function(){Sr(this),this.x=this.y=this.arc=this.site=this.cy=null};v.arc=t,v.site=i,v.x=p+o,v.y=g+Math.sqrt(p*p+m*m),v.cy=g,t.circle=v;for(var y=null,b=Jo._;b;)if(v.y<b.y||v.y===b.y&&v.x<=b.x){if(!b.L){y=b.P;break}b=b.L}else{if(!b.R){y=b;break}b=b.R}Jo.insert(y,v),y||(Zo=v)}}}}function _r(t){var e=t.circle;e&&(e.P||(Zo=e.N),Jo.remove(e),Qo.push(e),Sr(e),t.circle=null)}function wr(t,e){this.l=t,this.r=e,this.a=this.b=null}function Mr(t,e,r,n){var i=new wr(t,e);return Yo.push(i),r&&kr(i,t,e,r),n&&kr(i,e,t,n),Wo[t.i].edges.push(new Tr(i,t,e)),Wo[e.i].edges.push(new Tr(i,e,t)),i}function kr(t,e,r,n){t.a||t.b?t.l===r?t.b=n:t.a=n:(t.a=n,t.l=e,t.r=r)}function Tr(t,e,r){var n=t.a,i=t.b;this.edge=t,this.site=e,this.angle=r?Math.atan2(r.y-e.y,r.x-e.x):t.l===e?Math.atan2(i.x-n.x,n.y-i.y):Math.atan2(n.x-i.x,i.y-n.y)}function Ar(){this._=null}function Sr(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Er(t,e){var r=e,n=e.R,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.R=n.L,r.R&&(r.R.U=r),n.L=r}function Lr(t,e){var r=e,n=e.L,i=r.U;i?i.L===r?i.L=n:i.R=n:t._=n,n.U=i,r.U=n,r.L=n.R,r.L&&(r.L.U=r),n.R=r}function Cr(t){for(;t.L;)t=t.L;return t}function Ir(t,e){var r,n,i,a=t.sort(Pr).pop();for(Yo=[],Wo=new Array(t.length),Xo=new Ar,Jo=new Ar;;)if(i=Zo,a&&(!i||a.y<i.y||a.y===i.y&&a.x<i.x))a.x===r&&a.y===n||(Wo[a.i]=new vr(a),mr(a),r=a.x,n=a.y),a=t.pop();else{if(!i)break;pr(i.arc)}e&&(function(t){for(var e,r=Yo,n=Te(t[0][0],t[0][1],t[1][0],t[1][1]),i=r.length;i--;)(!function(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],c=e[1][1],u=t.l,h=t.r,f=u.x,d=u.y,p=h.x,m=h.y,g=(f+p)/2,v=(d+m)/2;if(m===d){if(g<o||g>=s)return;if(f>p){if(a){if(a.y>=c)return}else a={x:g,y:l};r={x:g,y:c}}else{if(a){if(a.y<l)return}else a={x:g,y:c};r={x:g,y:l}}}else if(n=(f-p)/(m-d),i=v-n*g,n<-1||n>1)if(f>p){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<l)return}else a={x:(c-i)/n,y:c};r={x:(l-i)/n,y:l}}else if(d<m){if(a){if(a.x>=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.x<o)return}else a={x:s,y:n*s+i};r={x:o,y:n*o+i}}return t.a=a,t.b=r,!0}(e=r[i],t)||!n(e)||ca(e.a.x-e.b.x)<Aa&&ca(e.a.y-e.b.y)<Aa)&&(e.a=e.b=null,r.splice(i,1))}(e),yr(e));var o={cells:Wo,edges:Yo};return Xo=Jo=Yo=Wo=null,o}function Pr(t,e){return e.y-t.y||e.x-t.x}function Dr(t){return t.x}function zr(t){return t.y}function Or(t,e,r,n,i,a){if(!t(e,r,n,i,a)){var o=.5*(r+i),s=.5*(n+a),l=e.nodes;l[0]&&Or(t,l[0],r,n,o,s),l[1]&&Or(t,l[1],o,n,i,s),l[2]&&Or(t,l[2],r,s,o,a),l[3]&&Or(t,l[3],o,s,i,a)}}function Fr(t,e){t=$i.rgb(t),e=$i.rgb(e);var r=t.r,n=t.g,i=t.b,a=e.r-r,o=e.g-n,s=e.b-i;return function(t){return"#"+mt(Math.round(r+a*t))+mt(Math.round(n+o*t))+mt(Math.round(i+s*t))}}function Rr(t,e){var r,n={},i={};for(r in t)r in e?n[r]=Br(t[r],e[r]):i[r]=t[r];for(r in e)r in t||(i[r]=e[r]);return function(t){for(r in n)i[r]=n[r](t);return i}}function jr(t,e){return t=+t,e=+e,function(r){return t*(1-r)+e*r}}function Nr(t,e){var r,n,i,a=ts.lastIndex=es.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(r=ts.exec(t))&&(n=es.exec(e));)(i=n.index)>a&&(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:jr(r,n)})),a=es.lastIndex;return a<e.length&&(i=e.slice(a),s[o]?s[o]+=i:s[++o]=i),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var r,n=0;n<e;++n)s[(r=l[n]).i]=r.x(t);return s.join("")})}function Br(t,e){for(var r,n=$i.interpolators.length;--n>=0&&!(r=$i.interpolators[n](t,e)););return r}function Ur(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r<s;++r)n.push(Br(t[r],e[r]));for(;r<a;++r)i[r]=t[r];for(;r<o;++r)i[r]=e[r];return function(t){for(r=0;r<s;++r)i[r]=n[r](t);return i}}function Vr(t){return function(e){return 1-t(1-e)}}function Hr(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function qr(t){return t*t}function Gr(t){return t*t*t}function Yr(t){return 1-Math.cos(t*Ia)}function Wr(t){return Math.pow(2,10*(t-1))}function Xr(t){return 1-Math.sqrt(1-t*t)}function Zr(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 Jr(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function Kr(t){var e=[t.a,t.b],r=[t.c,t.d],n=$r(e),i=Qr(e,r),a=$r(function(t,e,r){return t[0]+=r*e[0],t[1]+=r*e[1],t}(r,e,-i))||0;e[0]*r[1]<r[0]*e[1]&&(e[0]*=-1,e[1]*=-1,n*=-1,i*=-1),this.rotate=(n?Math.atan2(e[1],e[0]):Math.atan2(-r[0],r[1]))*Da,this.translate=[t.e,t.f],this.scale=[n,a],this.skew=a?Math.atan2(i,a)*Da:0}function Qr(t,e){return t[0]*e[0]+t[1]*e[1]}function $r(t){var e=Math.sqrt(Qr(t,t));return e&&(t[0]/=e,t[1]/=e),e}function tn(t){return t.length?t.pop()+",":""}function en(t,e){var r=[],n=[];return t=$i.transform(t),e=$i.transform(e),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:jr(t[0],e[0])},{i:i-2,x:jr(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(t.translate,e.translate,r,n),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(tn(r)+"rotate(",null,")")-2,x:jr(t,e)})):e&&r.push(tn(r)+"rotate("+e+")")}(t.rotate,e.rotate,r,n),function(t,e,r,n){t!==e?n.push({i:r.push(tn(r)+"skewX(",null,")")-2,x:jr(t,e)}):e&&r.push(tn(r)+"skewX("+e+")")}(t.skew,e.skew,r,n),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(tn(r)+"scale(",null,",",null,")");n.push({i:i-4,x:jr(t[0],e[0])},{i:i-2,x:jr(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(tn(r)+"scale("+e+")")}(t.scale,e.scale,r,n),t=e=null,function(t){for(var e,i=-1,a=n.length;++i<a;)r[(e=n[i]).i]=e.x(t);return r.join("")}}function rn(t,e){return e=(e-=t=+t)||1/e,function(r){return(r-t)/e}}function nn(t,e){return e=(e-=t=+t)||1/e,function(r){return Math.max(0,Math.min(1,(r-t)/e))}}function an(t){for(var e=t.source,r=t.target,n=function(t,e){if(t===e)return t;var r=on(t),n=on(e),i=r.pop(),a=n.pop(),o=null;for(;i===a;)o=i,i=r.pop(),a=n.pop();return o}(e,r),i=[e];e!==n;)e=e.parent,i.push(e);for(var a=i.length;r!==n;)i.splice(a,0,r),r=r.parent;return i}function on(t){for(var e=[],r=t.parent;null!=r;)e.push(t),t=r,r=r.parent;return e.push(t),e}function sn(t){t.fixed|=2}function ln(t){t.fixed&=-7}function cn(t){t.fixed|=4,t.px=t.x,t.py=t.y}function un(t){t.fixed&=-5}function hn(t,e,r){var n=0,i=0;if(t.charge=0,!t.leaf)for(var a,o=t.nodes,s=o.length,l=-1;++l<s;)null!=(a=o[l])&&(hn(a,e,r),t.charge+=a.charge,n+=a.charge*a.cx,i+=a.charge*a.cy);if(t.point){t.leaf||(t.point.x+=Math.random()-.5,t.point.y+=Math.random()-.5);var c=e*r[t.point.index];t.charge+=t.pointCharge=c,n+=c*t.point.x,i+=c*t.point.y}t.cx=n/t.charge,t.cy=i/t.charge}function fn(t,e){return $i.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=yn,t}function dn(t,e){for(var r=[t];null!=(t=r.pop());)if(e(t),(i=t.children)&&(n=i.length))for(var n,i;--n>=0;)r.push(i[n])}function pn(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<i;)r.push(a[o]);for(;null!=(t=n.pop());)e(t)}function mn(t){return t.children}function gn(t){return t.value}function vn(t,e){return e.value-t.value}function yn(t){return $i.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}function bn(t){return t.x}function xn(t){return t.y}function _n(t,e,r){t.y0=e,t.y=r}function wn(t){return $i.range(t.length)}function Mn(t){for(var e=-1,r=t[0].length,n=[];++e<r;)n[e]=0;return n}function kn(t){for(var e,r=1,n=0,i=t[0][1],a=t.length;r<a;++r)(e=t[r][1])>i&&(n=r,i=e);return n}function Tn(t){return t.reduce(An,0)}function An(t,e){return t+e[1]}function Sn(t,e){return En(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function En(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 Ln(t){return[$i.min(t),$i.max(t)]}function Cn(t,e){return t.value-e.value}function In(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Pn(t,e){t._pack_next=e,e._pack_prev=t}function Dn(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 zn(t){function e(t){u=Math.min(t.x-t.r,u),h=Math.max(t.x+t.r,h),f=Math.min(t.y-t.r,f),d=Math.max(t.y+t.r,d)}if((r=t.children)&&(c=r.length)){var r,n,i,a,o,s,l,c,u=1/0,h=-1/0,f=1/0,d=-1/0;if(r.forEach(On),n=r[0],n.x=-n.r,n.y=0,e(n),c>1&&(i=r[1],i.x=i.r,i.y=0,e(i),c>2))for(jn(n,i,a=r[2]),e(a),In(n,a),n._pack_prev=a,In(a,i),i=n._pack_next,o=3;o<c;o++){jn(n,i,a=r[o]);var p=0,m=1,g=1;for(s=i._pack_next;s!==i;s=s._pack_next,m++)if(Dn(s,a)){p=1;break}if(1==p)for(l=n._pack_prev;l!==s._pack_prev&&!Dn(l,a);l=l._pack_prev,g++);p?(m<g||m==g&&i.r<n.r?Pn(n,i=s):Pn(n=l,i),o--):(In(n,a),i=a,e(a))}var v=(u+h)/2,y=(f+d)/2,b=0;for(o=0;o<c;o++)(a=r[o]).x-=v,a.y-=y,b=Math.max(b,a.r+Math.sqrt(a.x*a.x+a.y*a.y));t.r=b,r.forEach(Fn)}}function On(t){t._pack_next=t._pack_prev=t}function Fn(t){delete t._pack_next,delete t._pack_prev}function Rn(t,e,r,n){var i=t.children;if(t.x=e+=n*t.x,t.y=r+=n*t.y,t.r*=n,i)for(var a=-1,o=i.length;++a<o;)Rn(i[a],e,r,n)}function jn(t,e,r){var n=t.r+r.r,i=e.x-t.x,a=e.y-t.y;if(n&&(i||a)){var o=e.r+r.r,s=i*i+a*a,l=.5+((n*=n)-(o*=o))/(2*s),c=Math.sqrt(Math.max(0,2*o*(n+s)-(n-=s)*n-o*o))/(2*s);r.x=t.x+l*i+c*a,r.y=t.y+l*a-c*i}else r.x=t.x+n,r.y=t.y}function Nn(t,e){return t.parent==e.parent?1:2}function Bn(t){var e=t.children;return e.length?e[0]:t.t}function Un(t){var e,r=t.children;return(e=r.length)?r[e-1]:t.t}function Vn(t){var e=t.children;return e&&e.length?Vn(e[0]):t}function Hn(t){var e,r=t.children;return r&&(e=r.length)?Hn(r[e-1]):t}function qn(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function Gn(t,e){var r=t.x+e[3],n=t.y+e[0],i=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return i<0&&(r+=i/2,i=0),a<0&&(n+=a/2,a=0),{x:r,y:n,dx:i,dy:a}}function Yn(t){var e=t[0],r=t[t.length-1];return e<r?[e,r]:[r,e]}function Wn(t){return t.rangeExtent?t.rangeExtent():Yn(t.range())}function Xn(t,e,r,n){var i=r(t[0],t[1]),a=n(e[0],e[1]);return function(t){return a(i(t))}}function Zn(t,e){var r,n=0,i=t.length-1,a=t[n],o=t[i];return o<a&&(r=n,n=i,i=r,r=a,a=o,o=r),t[n]=e.floor(a),t[i]=e.ceil(o),t}function Jn(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:fs}function Kn(t,e,r,n){var i=[],a=[],o=0,s=Math.min(t.length,e.length)-1;for(t[s]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<=s;)i.push(r(t[o-1],t[o])),a.push(n(e[o-1],e[o]));return function(e){var r=$i.bisect(t,e,1,s)-1;return a[r](i[r](e))}}function Qn(t,e,r,n){function i(){var i=Math.min(t.length,e.length)>2?Kn:Xn,l=n?nn:rn;return o=i(t,e,l,r),s=i(e,t,l,Br),a}function a(t){return o(t)}var o,s;return a.invert=function(t){return s(t)},a.domain=function(e){return arguments.length?(t=e.map(Number),i()):t},a.range=function(t){return arguments.length?(e=t,i()):e},a.rangeRound=function(t){return a.range(t).interpolate(Jr)},a.clamp=function(t){return arguments.length?(n=t,i()):n},a.interpolate=function(t){return arguments.length?(r=t,i()):r},a.ticks=function(e){return ri(t,e)},a.tickFormat=function(e,r){return ni(t,e,r)},a.nice=function(e){return ti(t,e),i()},a.copy=function(){return Qn(t,e,r,n)},i()}function $n(t,e){return $i.rebind(t,e,"range","rangeRound","interpolate","clamp")}function ti(t,e){return Zn(t,Jn(ei(t,e)[2])),Zn(t,Jn(ei(t,e)[2])),t}function ei(t,e){null==e&&(e=10);var r=Yn(t),n=r[1]-r[0],i=Math.pow(10,Math.floor(Math.log(n/e)/Math.LN10)),a=e/n*i;return a<=.15?i*=10:a<=.35?i*=5:a<=.75&&(i*=2),r[0]=Math.ceil(r[0]/i)*i,r[1]=Math.floor(r[1]/i)*i+.5*i,r[2]=i,r}function ri(t,e){return $i.range.apply($i,ei(t,e))}function ni(t,e,r){var n=ei(t,e);if(r){var i=$a.exec(r);if(i.shift(),"s"===i[8]){var a=$i.formatPrefix(Math.max(ca(n[0]),ca(n[1])));return i[7]||(i[7]="."+ii(a.scale(n[2]))),i[8]="f",r=$i.format(i.join("")),function(t){return r(a.scale(t))+a.symbol}}i[7]||(i[7]="."+function(t,e){var r=ii(e[2]);return t in ds?Math.abs(r-ii(Math.max(ca(e[0]),ca(e[1]))))+ +("e"!==t):r-2*("%"===t)}(i[8],n)),r=i.join("")}else r=",."+ii(n[2])+"f";return $i.format(r)}function ii(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}function ai(t,e,r,n){function i(t){return(r?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(e)}function a(t){return r?Math.pow(e,t):-Math.pow(e,-t)}function o(e){return t(i(e))}return o.invert=function(e){return a(t.invert(e))},o.domain=function(e){return arguments.length?(r=e[0]>=0,t.domain((n=e.map(Number)).map(i)),o):n},o.base=function(r){return arguments.length?(e=+r,t.domain(n.map(i)),o):e},o.nice=function(){var e=Zn(n.map(i),r?Math:ms);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Yn(n),o=[],s=t[0],l=t[1],c=Math.floor(i(s)),u=Math.ceil(i(l)),h=e%1?2:e;if(isFinite(u-c)){if(r){for(;c<u;c++)for(var f=1;f<h;f++)o.push(a(c)*f);o.push(a(c))}else for(o.push(a(c));c++<u;)for(f=h-1;f>0;f--)o.push(a(c)*f);for(c=0;o[c]<s;c++);for(u=o.length;o[u-1]>l;u--);o=o.slice(c,u)}return o},o.tickFormat=function(t,r){if(!arguments.length)return ps;arguments.length<2?r=ps:"function"!=typeof r&&(r=$i.format(r));var n=Math.max(1,e*t/o.ticks().length);return function(t){var o=t/a(Math.round(i(t)));return o*e<e-.5&&(o*=e),o<=n?r(t):""}},o.copy=function(){return ai(t.copy(),e,r,n)},$n(o,t)}function oi(t,e,r){function n(e){return t(i(e))}var i=si(e),a=si(1/e);return n.invert=function(e){return a(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain((r=e.map(Number)).map(i)),n):r},n.ticks=function(t){return ri(r,t)},n.tickFormat=function(t,e){return ni(r,t,e)},n.nice=function(t){return n.domain(ti(r,t))},n.exponent=function(o){return arguments.length?(i=si(e=o),a=si(1/e),t.domain(r.map(i)),n):e},n.copy=function(){return oi(t.copy(),e,r)},$n(n,t)}function si(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function li(t,e){function r(r){return a[((i.get(r)||("range"===e.t?i.set(r,t.push(r)):NaN))-1)%a.length]}function n(e,r){return $i.range(t.length).map(function(t){return e+r*t})}var i,a,o;return r.domain=function(n){if(!arguments.length)return t;t=[],i=new c;for(var a,o=-1,s=n.length;++o<s;)i.has(a=n[o])||i.set(a,t.push(a));return r[e.t].apply(r,e.a)},r.range=function(t){return arguments.length?(a=t,o=0,e={t:"range",a:arguments},r):a},r.rangePoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],c=i[1],u=t.length<2?(l=(l+c)/2,0):(c-l)/(t.length-1+s);return a=n(l+u*s/2,u),o=0,e={t:"rangePoints",a:arguments},r},r.rangeRoundPoints=function(i,s){arguments.length<2&&(s=0);var l=i[0],c=i[1],u=t.length<2?(l=c=Math.round((l+c)/2),0):(c-l)/(t.length-1+s)|0;return a=n(l+Math.round(u*s/2+(c-l-(t.length-1+s)*u)/2),u),o=0,e={t:"rangeRoundPoints",a:arguments},r},r.rangeBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var c=i[1]<i[0],u=i[c-0],h=(i[1-c]-u)/(t.length-s+2*l);return a=n(u+h*l,h),c&&a.reverse(),o=h*(1-s),e={t:"rangeBands",a:arguments},r},r.rangeRoundBands=function(i,s,l){arguments.length<2&&(s=0),arguments.length<3&&(l=s);var c=i[1]<i[0],u=i[c-0],h=i[1-c],f=Math.floor((h-u)/(t.length-s+2*l));return a=n(u+Math.round((h-u-(t.length-s)*f)/2),f),c&&a.reverse(),o=Math.round(f*(1-s)),e={t:"rangeRoundBands",a:arguments},r},r.rangeBand=function(){return o},r.rangeExtent=function(){return Yn(e.a[0])},r.copy=function(){return li(t,e)},r.domain(t)}function ci(t,e){function r(){var r=0,n=e.length;for(s=[];++r<n;)s[r-1]=$i.quantile(t,r/n);return o}function o(t){if(!isNaN(t=+t))return e[$i.bisect(s,t)]}var s;return o.domain=function(e){return arguments.length?(t=e.map(i).filter(a).sort(n),r()):t},o.range=function(t){return arguments.length?(e=t,r()):e},o.quantiles=function(){return s},o.invertExtent=function(r){return(r=e.indexOf(r))<0?[NaN,NaN]:[r>0?s[r-1]:t[0],r<s.length?s[r]:t[t.length-1]]},o.copy=function(){return ci(t,e)},r()}function ui(t,e,r){function n(e){return r[Math.max(0,Math.min(o,Math.floor(a*(e-t))))]}function i(){return a=r.length/(e-t),o=r.length-1,n}var a,o;return n.domain=function(r){return arguments.length?(t=+r[0],e=+r[r.length-1],i()):[t,e]},n.range=function(t){return arguments.length?(r=t,i()):r},n.invertExtent=function(e){return e=r.indexOf(e),e=e<0?NaN:e/a+t,[e,e+1/a]},n.copy=function(){return ui(t,e,r)},i()}function hi(t,e){function r(r){if(r<=r)return e[$i.bisect(t,r)]}return r.domain=function(e){return arguments.length?(t=e,r):t},r.range=function(t){return arguments.length?(e=t,r):e},r.invertExtent=function(r){return r=e.indexOf(r),[t[r-1],t[r]]},r.copy=function(){return hi(t,e)},r}function fi(t){function e(t){return+t}return e.invert=e,e.domain=e.range=function(r){return arguments.length?(t=r.map(e),e):t},e.ticks=function(e){return ri(t,e)},e.tickFormat=function(e,r){return ni(t,e,r)},e.copy=function(){return fi(t)},e}function di(){return 0}function pi(t){return t.innerRadius}function mi(t){return t.outerRadius}function gi(t){return t.startAngle}function vi(t){return t.endAngle}function yi(t){return t&&t.padAngle}function bi(t,e,r,n){return(t-r)*e-(e-n)*t>0?0:1}function xi(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,h=t[1]+c,f=e[0]+l,d=e[1]+c,p=(u+f)/2,m=(h+d)/2,g=f-u,v=d-h,y=g*g+v*v,b=r-n,x=u*d-f*h,_=(v<0?-1:1)*Math.sqrt(Math.max(0,b*b*y-x*x)),w=(x*v-g*_)/y,M=(-x*g-v*_)/y,k=(x*v+g*_)/y,T=(-x*g+v*_)/y,A=w-p,S=M-m,E=k-p,L=T-m;return A*A+S*S>E*E+L*L&&(w=k,M=T),[[w-l,M-c],[w*r/b,M*r/b]]}function _i(t){function e(e){function o(){c.push("M",a(t(u),s))}for(var l,c=[],u=[],h=-1,f=e.length,d=_t(r),p=_t(n);++h<f;)i.call(this,l=e[h],h)?u.push([+d.call(this,l,h),+p.call(this,l,h)]):u.length&&(o(),u=[]);return u.length&&o(),c.length?c.join(""):null}var r=ar,n=or,i=ve,a=wi,o=a.key,s=.7;return e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e.defined=function(t){return arguments.length?(i=t,e):i},e.interpolate=function(t){return arguments.length?(o="function"==typeof t?a=t:(a=_s.get(t)||wi).key,e):o},e.tension=function(t){return arguments.length?(s=t,e):s},e}function wi(t){return t.length>1?t.join("L"):t+"Z"}function Mi(t){return t.join("L")+"Z"}function ki(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("V",(n=t[e])[1],"H",n[0]);return i.join("")}function Ti(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n=t[e])[0],"V",n[1]);return i.join("")}function Ai(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return wi(t);var r=t.length!=e.length,n="",i=t[0],a=t[1],o=e[0],s=o,l=1;if(r&&(n+="Q"+(a[0]-2*o[0]/3)+","+(a[1]-2*o[1]/3)+","+a[0]+","+a[1],i=t[1],l=2),e.length>1){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;c<e.length;c++,l++)a=t[l],s=e[c],n+="S"+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1]}if(r){var u=t[l];n+="Q"+(a[0]+2*s[0]/3)+","+(a[1]+2*s[1]/3)+","+u[0]+","+u[1]}return n}function Si(t,e){for(var r,n=[],i=(1-e)/2,a=t[0],o=t[1],s=1,l=t.length;++s<l;)r=a,a=o,o=t[s],n.push([i*(o[0]-r[0]),i*(o[1]-r[1])]);return n}function Ei(t){if(t.length<3)return wi(t);var e=1,r=t.length,n=t[0],i=n[0],a=n[1],o=[i,i,i,(n=t[1])[0]],s=[a,a,a,n[1]],l=[i,",",a,"L",Li(ks,o),",",Li(ks,s)];for(t.push(t[r-1]);++e<=r;)n=t[e],o.shift(),o.push(n[0]),s.shift(),s.push(n[1]),Ci(l,o,s);return t.pop(),l.push("L",n),l.join("")}function Li(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}function Ci(t,e,r){t.push("C",Li(ws,e),",",Li(ws,r),",",Li(Ms,e),",",Li(Ms,r),",",Li(ks,e),",",Li(ks,r))}function Ii(t,e){return(e[1]-t[1])/(e[0]-t[0])}function Pi(t){for(var e,r,n,i,a=[],o=function(t){for(var e=0,r=t.length-1,n=[],i=t[0],a=t[1],o=n[0]=Ii(i,a);++e<r;)n[e]=(o+(o=Ii(i=a,a=t[e+1])))/2;return n[e]=o,n}(t),s=-1,l=t.length-1;++s<l;)e=Ii(t[s],t[s+1]),ca(e)<Aa?o[s]=o[s+1]=0:(i=(r=o[s]/e)*r+(n=o[s+1]/e)*n)>9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n);for(s=-1;++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}function Di(t){for(var e,r,n,i=-1,a=t.length;++i<a;)r=(e=t[i])[0],n=e[1]-Ia,e[0]=r*Math.cos(n),e[1]=r*Math.sin(n);return t}function zi(t){function e(e){function l(){m.push("M",s(t(v),h),u,c(t(g.reverse()),h),"Z")}for(var f,d,p,m=[],g=[],v=[],y=-1,b=e.length,x=_t(r),_=_t(i),w=r===n?function(){return d}:_t(n),M=i===a?function(){return p}:_t(a);++y<b;)o.call(this,f=e[y],y)?(g.push([d=+x.call(this,f,y),p=+_.call(this,f,y)]),v.push([+w.call(this,f,y),+M.call(this,f,y)])):g.length&&(l(),g=[],v=[]);return g.length&&l(),m.length?m.join(""):null}var r=ar,n=ar,i=0,a=or,o=ve,s=wi,l=s.key,c=s,u="L",h=.7;return e.x=function(t){return arguments.length?(r=n=t,e):n},e.x0=function(t){return arguments.length?(r=t,e):r},e.x1=function(t){return arguments.length?(n=t,e):n},e.y=function(t){return arguments.length?(i=a=t,e):a},e.y0=function(t){return arguments.length?(i=t,e):i},e.y1=function(t){return arguments.length?(a=t,e):a},e.defined=function(t){return arguments.length?(o=t,e):o},e.interpolate=function(t){return arguments.length?(l="function"==typeof t?s=t:(s=_s.get(t)||wi).key,c=s.reverse||s,u=s.closed?"M":"L",e):l},e.tension=function(t){return arguments.length?(h=t,e):h},e}function Oi(t){return t.radius}function Fi(t){return[t.x,t.y]}function Ri(){return 64}function ji(){return"circle"}function Ni(t){var e=Math.sqrt(t/Ea);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}function Bi(t){return function(){var e,r,n;(e=this[t])&&(n=e[r=e.active])&&(n.timer.c=null,n.timer.t=NaN,--e.count?delete e[r]:delete this[t],e.active+=.5,n.event&&n.event.interrupt.call(this,this.__data__,n.index))}}function Ui(t,e,r){return pa(t,Is),t.namespace=e,t.id=r,t}function Vi(t,e,r,n){var i=t.id,a=t.namespace;return U(t,"function"==typeof r?function(t,o,s){t[a][i].tween.set(e,n(r.call(t,t.__data__,o,s)))}:(r=n(r),function(t){t[a][i].tween.set(e,r)}))}function Hi(t){return null==t&&(t=""),function(){this.textContent=t}}function qi(t){return null==t?"__transition__":"__transition_"+t+"__"}function Gi(t,e,r,n,i){function a(t){var e=m.delay;if(u.t=e+l,e<=t)return o(t-e);u.c=o}function o(r){var i=p.active,a=p[i];a&&(a.timer.c=null,a.timer.t=NaN,--p.count,delete p[i],a.event&&a.event.interrupt.call(t,t.__data__,a.index));for(var o in p)if(+o<n){var c=p[o];c.timer.c=null,c.timer.t=NaN,--p.count,delete p[o]}u.c=s,kt(function(){return u.c&&s(r||1)&&(u.c=null,u.t=NaN),1},0,l),p.active=n,m.event&&m.event.start.call(t,t.__data__,e),d=[],m.tween.forEach(function(r,n){(n=n.call(t,t.__data__,e))&&d.push(n)}),f=m.ease,h=m.duration}function s(i){for(var a=i/h,o=f(a),s=d.length;s>0;)d[--s].call(t,o);if(a>=1)return m.event&&m.event.end.call(t,t.__data__,e),--p.count?delete p[n]:delete t[r],1}var l,u,h,f,d,p=t[r]||(t[r]={active:0,count:0}),m=p[n];m||(l=i.time,u=kt(a,0,l),m=p[n]={tween:new c,time:l,timer:u,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++p.count)}function Yi(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function Wi(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function Xi(t){return t.toISOString()}function Zi(t,e,r){function n(e){return t(e)}function i(t,r){var n=(t[1]-t[0])/r,i=$i.bisect(Bs,n);return i==Bs.length?[e.year,ei(t.map(function(t){return t/31536e6}),r)[2]]:i?e[n/Bs[i-1]<Bs[i]/n?i-1:i]:[Hs,ei(t,r)[2]]}return n.invert=function(e){return Ji(t.invert(e))},n.domain=function(e){return arguments.length?(t.domain(e),n):t.domain().map(Ji)},n.nice=function(t,e){function r(r){return!isNaN(r)&&!t.range(r,Ji(+r+1),e).length}var a=n.domain(),o=Yn(a),s=null==t?i(o,10):"number"==typeof t&&i(o,t);return s&&(t=s[0],e=s[1]),n.domain(Zn(a,e>1?{floor:function(e){for(;r(e=t.floor(e));)e=Ji(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=Ji(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Yn(n.domain()),a=null==t?i(r,10):"number"==typeof t?i(r,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(r[0],Ji(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return Zi(t.copy(),e,r)},$n(n,t)}function Ji(t){return new Date(t)}function Ki(t){return JSON.parse(t.responseText)}function Qi(t){var e=ra.createRange();return e.selectNode(ra.body),e.createContextualFragment(t.responseText)}var $i={version:"3.5.17"},ta=[].slice,ea=function(t){return ta.call(t)},ra=this.document;if(ra)try{ea(ra.documentElement.childNodes)[0].nodeType}catch(t){ea=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}),ra)try{ra.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var na=this.Element.prototype,ia=na.setAttribute,aa=na.setAttributeNS,oa=this.CSSStyleDeclaration.prototype,sa=oa.setProperty;na.setAttribute=function(t,e){ia.call(this,t,e+"")},na.setAttributeNS=function(t,e,r){aa.call(this,t,e,r+"")},oa.setProperty=function(t,e,r){sa.call(this,t,e+"",r)}}$i.ascending=n,$i.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},$i.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<a;)null!=(n=t[i])&&r>n&&(r=n)}else{for(;++i<a;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<a;)null!=(n=e.call(t,t[i],i))&&r>n&&(r=n)}return r},$i.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i<a;)if(null!=(n=t[i])&&n>=n){r=n;break}for(;++i<a;)null!=(n=t[i])&&n>r&&(r=n)}else{for(;++i<a;)if(null!=(n=e.call(t,t[i],i))&&n>=n){r=n;break}for(;++i<a;)null!=(n=e.call(t,t[i],i))&&n>r&&(r=n)}return r},$i.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a<o;)if(null!=(n=t[a])&&n>=n){r=i=n;break}for(;++a<o;)null!=(n=t[a])&&(r>n&&(r=n),i<n&&(i=n))}else{for(;++a<o;)if(null!=(n=e.call(t,t[a],a))&&n>=n){r=i=n;break}for(;++a<o;)null!=(n=e.call(t,t[a],a))&&(r>n&&(r=n),i<n&&(i=n))}return[r,i]},$i.sum=function(t,e){var r,n=0,i=t.length,o=-1;if(1===arguments.length)for(;++o<i;)a(r=+t[o])&&(n+=r);else for(;++o<i;)a(r=+e.call(t,t[o],o))&&(n+=r);return n},$i.mean=function(t,e){var r,n=0,o=t.length,s=-1,l=o;if(1===arguments.length)for(;++s<o;)a(r=i(t[s]))?n+=r:--l;else for(;++s<o;)a(r=i(e.call(t,t[s],s)))?n+=r:--l;if(l)return n/l},$i.quantile=function(t,e){var r=(t.length-1)*e+1,n=Math.floor(r),i=+t[n-1],a=r-n;return a?i+a*(t[n]-i):i},$i.median=function(t,e){var r,o=[],s=t.length,l=-1;if(1===arguments.length)for(;++l<s;)a(r=i(t[l]))&&o.push(r);else for(;++l<s;)a(r=i(e.call(t,t[l],l)))&&o.push(r);if(o.length)return $i.quantile(o.sort(n),.5)},$i.variance=function(t,e){var r,n,o=t.length,s=0,l=0,c=-1,u=0;if(1===arguments.length)for(;++c<o;)a(r=i(t[c]))&&(l+=(n=r-s)*(r-(s+=n/++u)));else for(;++c<o;)a(r=i(e.call(t,t[c],c)))&&(l+=(n=r-s)*(r-(s+=n/++u)));if(u>1)return l/(u-1)},$i.deviation=function(){var t=$i.variance.apply(this,arguments);return t?Math.sqrt(t):t};var la=o(n);$i.bisectLeft=la.left,$i.bisect=$i.bisectRight=la.right,$i.bisector=function(t){return o(1===t.length?function(e,r){return n(t(e),r)}:t)},$i.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},$i.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},$i.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e<r;)i[e]=[n,n=t[++e]];return i},$i.transpose=function(t){if(!(i=t.length))return[];for(var e=-1,r=$i.min(t,s),n=new Array(r);++e<r;)for(var i,a=-1,o=n[e]=new Array(i);++a<i;)o[a]=t[a][e];return n},$i.zip=function(){return $i.transpose(arguments)},$i.keys=function(t){var e=[];for(var r in t)e.push(r);return e},$i.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},$i.entries=function(t){var e=[];for(var r in t)e.push({key:r,value:t[r]});return e},$i.merge=function(t){for(var e,r,n,i=t.length,a=-1,o=0;++a<i;)o+=t[a].length;for(r=new Array(o);--i>=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var ca=Math.abs;$i.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=function(t){for(var e=1;t*e%1;)e*=10;return e}(ca(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)<e;)i.push(n/a);return i},$i.map=function(t,e){var r=new c;if(t instanceof c)t.forEach(function(t,e){r.set(t,e)});else if(Array.isArray(t)){var n,i=-1,a=t.length;if(1===arguments.length)for(;++i<a;)r.set(i,t[i]);else for(;++i<a;)r.set(e.call(t,n=t[i],i),n)}else for(var o in t)r.set(o,t[o]);return r};var ua="__proto__",ha="\0";l(c,{has:f,get:function(t){return this._[u(t)]},set:function(t,e){return this._[u(t)]=e},remove:d,keys:p,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:h(e),value:this._[e]});return t},size:m,empty:g,forEach:function(t){for(var e in this._)t.call(this,h(e),this._[e])}}),$i.nest=function(){function t(e,o,s){if(s>=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,h,f,d=-1,p=o.length,m=a[s++],g=new c;++d<p;)(f=g.get(l=m(u=o[d])))?f.push(u):g.set(l,[u]);return e?(u=e(),h=function(r,n){u.set(r,t(e,n,s))}):(u={},h=function(r,n){u[r]=t(e,n,s)}),g.forEach(h),u}function e(t,r){if(r>=a.length)return t;var n=[],i=o[r++];return t.forEach(function(t,i){n.push({key:t,values:e(i,r)})}),i?n.sort(function(t,e){return i(t.key,e.key)}):n}var r,n,i={},a=[],o=[];return i.map=function(e,r){return t(r,e,0)},i.entries=function(r){return e(t($i.map,r,0),0)},i.key=function(t){return a.push(t),i},i.sortKeys=function(t){return o[a.length-1]=t,i},i.sortValues=function(t){return r=t,i},i.rollup=function(t){return n=t,i},i},$i.set=function(t){var e=new v;if(t)for(var r=0,n=t.length;r<n;++r)e.add(t[r]);return e},l(v,{has:f,add:function(t){return this._[u(t+="")]=!0,t},remove:d,values:p,size:m,empty:g,forEach:function(t){for(var e in this._)t.call(this,h(e))}}),$i.behavior={},$i.rebind=function(t,e){for(var r,n=1,i=arguments.length;++n<i;)t[r=arguments[n]]=function(t,e,r){return function(){var n=r.apply(e,arguments);return n===e?t:n}}(t,e,e[r]);return t};var fa=["webkit","ms","moz","Moz","o","O"];$i.dispatch=function(){for(var t=new _,e=-1,r=arguments.length;++e<r;)t[arguments[e]]=w(t);return t},_.prototype.on=function(t,e){var r=t.indexOf("."),n="";if(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}},$i.event=null,$i.requote=function(t){return t.replace(da,"\\$&")};var da=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,pa={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},ma=function(t,e){return e.querySelector(t)},ga=function(t,e){return e.querySelectorAll(t)},va=function(t,e){var r=t.matches||t[b(t,"matchesSelector")];return(va=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(ma=function(t,e){return Sizzle(t,e)[0]||null},ga=Sizzle,va=Sizzle.matchesSelector),$i.selection=function(){return $i.select(ra.documentElement)};var ya=$i.selection.prototype=[];ya.select=function(t){var e,r,n,i,a=[];t=S(t);for(var o=-1,s=this.length;++o<s;){a.push(e=[]),e.parentNode=(n=this[o]).parentNode;for(var l=-1,c=n.length;++l<c;)(i=n[l])?(e.push(r=t.call(i,i.__data__,l,o)),r&&"__data__"in i&&(r.__data__=i.__data__)):e.push(null)}return A(a)},ya.selectAll=function(t){var e,r,n=[];t=E(t);for(var i=-1,a=this.length;++i<a;)for(var o=this[i],s=-1,l=o.length;++s<l;)(r=o[s])&&(n.push(e=ea(t.call(r,r.__data__,s,i))),e.parentNode=r);return A(n)};var ba="http://www.w3.org/1999/xhtml",xa={svg:"http://www.w3.org/2000/svg",xhtml:ba,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};$i.ns={prefix:xa,qualify:function(t){var e=t.indexOf(":"),r=t;return e>=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),xa.hasOwnProperty(r)?{space:xa[r],local:t}:t}},ya.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return(t=$i.ns.qualify(t)).local?r.getAttributeNS(t.space,t.local):r.getAttribute(t)}for(e in t)this.each(L(e,t[e]));return this}return this.each(L(t,e))},ya.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=P(t)).length,i=-1;if(e=r.classList){for(;++i<n;)if(!e.contains(t[i]))return!1}else for(e=r.getAttribute("class");++i<n;)if(!I(t[i]).test(e))return!1;return!0}for(e in t)this.each(D(e,t[e]));return this}return this.each(D(t,e))},ya.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){i<2&&(e="");for(n in t)this.each(O(n,t[n],e));return this}if(i<2){var a=this.node();return r(a).getComputedStyle(a,null).getPropertyValue(t)}n=""}return this.each(O(t,e,n))},ya.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(F(e,t[e]));return this}return this.each(F(t,e))},ya.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},ya.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},ya.append=function(t){return t=R(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},ya.insert=function(t,e){return t=R(t),e=S(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},ya.remove=function(){return this.each(j)},ya.data=function(t,e){function r(t,r){var n,i,a,o=t.length,h=r.length,f=Math.min(o,h),d=new Array(h),p=new Array(h),m=new Array(o);if(e){var g,v=new c,y=new Array(o);for(n=-1;++n<o;)(i=t[n])&&(v.has(g=e.call(i,i.__data__,n))?m[n]=i:v.set(g,i),y[n]=g);for(n=-1;++n<h;)(i=v.get(g=e.call(r,a=r[n],n)))?!0!==i&&(d[n]=i,i.__data__=a):p[n]=N(a),v.set(g,!0);for(n=-1;++n<o;)n in y&&!0!==v.get(y[n])&&(m[n]=t[n])}else{for(n=-1;++n<f;)i=t[n],a=r[n],i?(i.__data__=a,d[n]=i):p[n]=N(a);for(;n<h;++n)p[n]=N(r[n]);for(;n<o;++n)m[n]=t[n]}p.update=d,p.parentNode=d.parentNode=m.parentNode=t.parentNode,s.push(p),l.push(d),u.push(m)}var n,i,a=-1,o=this.length;if(!arguments.length){for(t=new Array(o=(n=this[0]).length);++a<o;)(i=n[a])&&(t[a]=i.__data__);return t}var s=V([]),l=A([]),u=A([]);if("function"==typeof t)for(;++a<o;)r(n=this[a],t.call(n,n.parentNode.__data__,a));else for(;++a<o;)r(n=this[a],t);return l.enter=function(){return s},l.exit=function(){return u},l},ya.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},ya.filter=function(t){var e,r,n,i=[];"function"!=typeof t&&(t=B(t));for(var a=0,o=this.length;a<o;a++){i.push(e=[]),e.parentNode=(r=this[a]).parentNode;for(var s=0,l=r.length;s<l;s++)(n=r[s])&&t.call(n,n.__data__,s,a)&&e.push(n)}return A(i)},ya.order=function(){for(var t=-1,e=this.length;++t<e;)for(var r,n=this[t],i=n.length-1,a=n[i];--i>=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},ya.sort=function(t){t=function(t){return arguments.length||(t=n),function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}.apply(this,arguments);for(var e=-1,r=this.length;++e<r;)this[e].sort(t);return this.order()},ya.each=function(t){return U(this,function(e,r,n){t.call(e,e.__data__,r,n)})},ya.call=function(t){var e=ea(arguments);return t.apply(e[0]=this,e),this},ya.empty=function(){return!this.node()},ya.node=function(){for(var t=0,e=this.length;t<e;t++)for(var r=this[t],n=0,i=r.length;n<i;n++){var a=r[n];if(a)return a}return null},ya.size=function(){var t=0;return U(this,function(){++t}),t};var _a=[];$i.selection.enter=V,$i.selection.enter.prototype=_a,_a.append=ya.append,_a.empty=ya.empty,_a.node=ya.node,_a.call=ya.call,_a.size=ya.size,_a.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s<l;){n=(i=this[s]).update,o.push(e=[]),e.parentNode=i.parentNode;for(var c=-1,u=i.length;++c<u;)(a=i[c])?(e.push(n[c]=r=t.call(i.parentNode,a.__data__,c,s)),r.__data__=a.__data__):e.push(null)}return A(o)},_a.insert=function(t,e){return arguments.length<2&&(e=function(t){var e,r;return function(n,i,a){var o,s=t[a].update,l=s.length;for(a!=r&&(r=a,e=0),i>=e&&(e=i+1);!(o=s[e])&&++e<l;);return o}}(this)),ya.insert.call(this,t,e)},$i.select=function(e){var r;return"string"==typeof e?(r=[ma(e,ra)]).parentNode=ra.documentElement:(r=[e]).parentNode=t(e),A([r])},$i.selectAll=function(t){var e;return"string"==typeof t?(e=ea(ga(t,ra))).parentNode=ra.documentElement:(e=ea(t)).parentNode=null,A([e])},ya.on=function(t,e,r){var n=arguments.length;if(n<3){if("string"!=typeof t){n<2&&(e=!1);for(r in t)this.each(H(r,t[r],e));return this}if(n<2)return(n=this.node()["__on"+t])&&n._;r=!1}return this.each(H(t,e,r))};var wa=$i.map({mouseenter:"mouseover",mouseleave:"mouseout"});ra&&wa.forEach(function(t){"on"+t in ra&&wa.remove(t)});var Ma,ka=0;$i.mouse=function(t){return W(t,k())};var Ta=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;$i.touch=function(t,e,r){if(arguments.length<3&&(r=e,e=k().changedTouches),e)for(var n,i=0,a=e.length;i<a;++i)if((n=e[i]).identifier===r)return W(t,n)},$i.behavior.drag=function(){function t(){this.on("mousedown.drag",a).on("touchstart.drag",o)}function e(t,e,r,a,o){return function(){var s,l=$i.event.target.correspondingElement||$i.event.target,c=this.parentNode,u=n.of(this,arguments),h=0,f=t(),d=".drag"+(null==f?"":"-"+f),p=$i.select(r(l)).on(a+d,function(){var t,r,n=e(c,f);n&&(t=n[0]-g[0],r=n[1]-g[1],h|=t|r,g=n,u({type:"drag",x:n[0]+s[0],y:n[1]+s[1],dx:t,dy:r}))}).on(o+d,function(){e(c,f)&&(p.on(a+d,null).on(o+d,null),m(h),u({type:"dragend"}))}),m=Y(l),g=e(c,f);s=i?[(s=i.apply(this,arguments)).x-g[0],s.y-g[1]]:[0,0],u({type:"dragstart"})}}var n=T(t,"drag","dragstart","dragend"),i=null,a=e(x,$i.mouse,r,"mousemove","mouseup"),o=e(X,$i.touch,y,"touchmove","touchend");return t.origin=function(e){return arguments.length?(i=e,t):i},$i.rebind(t,n,"on")},$i.touches=function(t,e){return arguments.length<2&&(e=k().touches),e?ea(e).map(function(e){var r=W(t,e);return r.identifier=e.identifier,r}):[]};var Aa=1e-6,Sa=Aa*Aa,Ea=Math.PI,La=2*Ea,Ca=La-Aa,Ia=Ea/2,Pa=Ea/180,Da=180/Ea,za=Math.SQRT2;$i.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,h=l-a,f=u*u+h*h;if(f<Sa)n=Math.log(c/o)/za,r=function(t){return[i+t*u,a+t*h,o*Math.exp(za*t*n)]};else{var d=Math.sqrt(f),p=(c*c-o*o+4*f)/(2*o*2*d),m=(c*c-o*o-4*f)/(2*c*2*d),g=Math.log(Math.sqrt(p*p+1)-p),v=Math.log(Math.sqrt(m*m+1)-m);n=(v-g)/za,r=function(t){var e=t*n,r=$(g),s=o/(2*d)*(r*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(za*e+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[i+s*u,a+s*h,o*r/$(za*e+g)]}}return r.duration=1e3*n,r},$i.behavior.zoom=function(){function t(t){t.on(C,u).on(Fa+".zoom",f).on("dblclick.zoom",d).on(D,h)}function e(t){return[(t[0]-k.x)/k.k,(t[1]-k.y)/k.k]}function n(t){k.k=Math.max(S[0],Math.min(S[1],t))}function i(t,e){e=function(t){return[t[0]*k.k+k.x,t[1]*k.k+k.y]}(e),k.x+=t[0]-e[0],k.y+=t[1]-e[1]}function a(e,r,a,o){e.__chart__={x:k.x,y:k.y,k:k.k},n(Math.pow(2,o)),i(m=r,a),e=$i.select(e),E>0&&(e=e.transition().duration(E)),e.call(t.event)}function o(){x&&x.domain(b.range().map(function(t){return(t-k.x)/k.k}).map(b.invert)),w&&w.domain(_.range().map(function(t){return(t-k.y)/k.k}).map(_.invert))}function s(t){L++||t({type:"zoomstart"})}function l(t){o(),t({type:"zoom",scale:k.k,translate:[k.x,k.y]})}function c(t){--L||(t({type:"zoomend"}),m=null)}function u(){var t=this,n=z.of(t,arguments),a=0,o=$i.select(r(t)).on(I,function(){a=1,i($i.mouse(t),u),l(n)}).on(P,function(){o.on(I,null).on(P,null),h(a),c(n)}),u=e($i.mouse(t)),h=Y(t);Cs.call(t),s(n)}function h(){function t(){var t=$i.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function r(){var e=$i.event.target;$i.select(e).on(x,o).on(_,f),w.push(e);for(var r=$i.event.changedTouches,n=0,i=r.length;n<i;++n)g[r[n].identifier]=null;var s=t(),l=Date.now();if(1===s.length){if(l-y<500){var c=s[0];a(p,c,g[c.identifier],Math.floor(Math.log(k.k)/Math.LN2)+1),M()}y=l}else if(s.length>1){c=s[0];var u=s[1],h=c[0]-u[0],d=c[1]-u[1];v=h*h+d*d}}function o(){var t,e,r,a,o=$i.touches(p);Cs.call(p);for(var s=0,c=o.length;s<c;++s,a=null)if(r=o[s],a=g[r.identifier]){if(e)break;t=r,e=a}if(a){var u=(u=r[0]-t[0])*u+(u=r[1]-t[1])*u,h=v&&Math.sqrt(u/v);t=[(t[0]+r[0])/2,(t[1]+r[1])/2],e=[(e[0]+a[0])/2,(e[1]+a[1])/2],n(h*d)}y=null,i(t,e),l(m)}function f(){if($i.event.touches.length){for(var e=$i.event.changedTouches,r=0,n=e.length;r<n;++r)delete g[e[r].identifier];for(var i in g)return void t()}$i.selectAll(w).on(b,null),T.on(C,u).on(D,h),A(),c(m)}var d,p=this,m=z.of(p,arguments),g={},v=0,b=".zoom-"+$i.event.changedTouches[0].identifier,x="touchmove"+b,_="touchend"+b,w=[],T=$i.select(p),A=Y(p);r(),s(m),T.on(C,null).on(D,r)}function f(){var t=z.of(this,arguments);v?clearTimeout(v):(Cs.call(this),p=e(m=g||$i.mouse(this)),s(t)),v=setTimeout(function(){v=null,c(t)},50),M(),n(Math.pow(2,.002*Oa())*k.k),i(m,p),l(t)}function d(){var t=$i.mouse(this),r=Math.log(k.k)/Math.LN2;a(this,t,e(t),$i.event.shiftKey?Math.ceil(r)-1:Math.floor(r)+1)}var p,m,g,v,y,b,x,_,w,k={x:0,y:0,k:1},A=[960,500],S=Ra,E=250,L=0,C="mousedown.zoom",I="mousemove.zoom",P="mouseup.zoom",D="touchstart.zoom",z=T(t,"zoomstart","zoom","zoomend");return Fa||(Fa="onwheel"in ra?(Oa=function(){return-$i.event.deltaY*($i.event.deltaMode?120:1)},"wheel"):"onmousewheel"in ra?(Oa=function(){return $i.event.wheelDelta},"mousewheel"):(Oa=function(){return-$i.event.detail},"MozMousePixelScroll")),t.event=function(t){t.each(function(){var t=z.of(this,arguments),e=k;Es?$i.select(this).transition().each("start.zoom",function(){k=this.__chart__||{x:0,y:0,k:1},s(t)}).tween("zoom:zoom",function(){var r=A[0],n=A[1],i=m?m[0]:r/2,a=m?m[1]:n/2,o=$i.interpolateZoom([(i-k.x)/k.k,(a-k.y)/k.k,r/k.k],[(i-e.x)/e.k,(a-e.y)/e.k,r/e.k]);return function(e){var n=o(e),s=r/n[2];this.__chart__=k={x:i-n[0]*s,y:a-n[1]*s,k:s},l(t)}}).each("interrupt.zoom",function(){c(t)}).each("end.zoom",function(){c(t)}):(this.__chart__=k,s(t),l(t),c(t))})},t.translate=function(e){return arguments.length?(k={x:+e[0],y:+e[1],k:k.k},o(),t):[k.x,k.y]},t.scale=function(e){return arguments.length?(k={x:k.x,y:k.y,k:null},n(+e),o(),t):k.k},t.scaleExtent=function(e){return arguments.length?(S=null==e?Ra:[+e[0],+e[1]],t):S},t.center=function(e){return arguments.length?(g=e&&[+e[0],+e[1]],t):g},t.size=function(e){return arguments.length?(A=e&&[+e[0],+e[1]],t):A},t.duration=function(e){return arguments.length?(E=+e,t):E},t.x=function(e){return arguments.length?(x=e,b=e.copy(),k={x:0,y:0,k:1},t):x},t.y=function(e){return arguments.length?(w=e,_=e.copy(),k={x:0,y:0,k:1},t):w},$i.rebind(t,z,"on")};var Oa,Fa,Ra=[0,1/0];$i.color=et,et.prototype.toString=function(){return this.rgb()+""},$i.hsl=rt;var ja=rt.prototype=new et;ja.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new rt(this.h,this.s,this.l/t)},ja.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new rt(this.h,this.s,t*this.l)},ja.rgb=function(){return nt(this.h,this.s,this.l)},$i.hcl=it;var Na=it.prototype=new et;Na.brighter=function(t){return new it(this.h,this.c,Math.min(100,this.l+Ba*(arguments.length?t:1)))},Na.darker=function(t){return new it(this.h,this.c,Math.max(0,this.l-Ba*(arguments.length?t:1)))},Na.rgb=function(){return at(this.h,this.c,this.l).rgb()},$i.lab=ot;var Ba=18,Ua=.95047,Va=1,Ha=1.08883,qa=ot.prototype=new et;qa.brighter=function(t){return new ot(Math.min(100,this.l+Ba*(arguments.length?t:1)),this.a,this.b)},qa.darker=function(t){return new ot(Math.max(0,this.l-Ba*(arguments.length?t:1)),this.a,this.b)},qa.rgb=function(){return st(this.l,this.a,this.b)},$i.rgb=ft;var Ga=ft.prototype=new et;Ga.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b;return e||r||n?(e&&e<30&&(e=30),r&&r<30&&(r=30),n&&n<30&&(n=30),new ft(Math.min(255,e/t),Math.min(255,r/t),Math.min(255,n/t))):new ft(30,30,30)},Ga.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new ft(t*this.r,t*this.g,t*this.b)},Ga.hsl=function(){return vt(this.r,this.g,this.b)},Ga.toString=function(){return"#"+mt(this.r)+mt(this.g)+mt(this.b)};var Ya=$i.map({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});Ya.forEach(function(t,e){Ya.set(t,dt(e))}),$i.functor=_t,$i.xhr=wt(y),$i.dsv=function(t,e){function r(t,r,a){arguments.length<3&&(a=r,r=null);var o=Mt(t,e,null==r?n:i(r),a);return o.row=function(t){return arguments.length?o.response(null==(r=t)?n:i(t)):r},o}function n(t){return r.parse(t.responseText)}function i(t){return function(e){return r.parse(e.responseText,t)}}function a(e){return e.map(o).join(t)}function o(t){return s.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}var s=new RegExp('["'+t+"\n]"),l=t.charCodeAt(0);return r.parse=function(t,e){var n;return r.parseRows(t,function(t,r){if(n)return n(t,r-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,r){return e(i(t),r)}:i})},r.parseRows=function(t,e){function r(){if(u>=c)return o;if(i)return i=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++<c;)if(34===t.charCodeAt(r)){if(34!==t.charCodeAt(r+1))break;++r}u=r+2;return 13===(n=t.charCodeAt(r+1))?(i=!0,10===t.charCodeAt(r+2)&&++u):10===n&&(i=!0),t.slice(e+1,r).replace(/""/g,'"')}for(;u<c;){var n,s=1;if(10===(n=t.charCodeAt(u++)))i=!0;else if(13===n)i=!0,10===t.charCodeAt(u)&&(++u,++s);else if(n!==l)continue;return t.slice(e,u-s)}return t.slice(e)}for(var n,i,a={},o={},s=[],c=t.length,u=0,h=0;(n=r())!==o;){for(var f=[];n!==a&&n!==o;)f.push(n),n=r();e&&null==(f=e(f,h++))||s.push(f)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new v,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(o).join(t)].concat(e.map(function(e){return i.map(function(t){return o(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(a).join("\n")},r},$i.csv=$i.dsv(",","text/csv"),$i.tsv=$i.dsv("\t","text/tab-separated-values");var Wa,Xa,Za,Ja,Ka=this[b(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};$i.timer=function(){kt.apply(this,arguments)},$i.timer.flush=function(){At(),St()},$i.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var Qa=["y","z","a","f","p","n","\xb5","m","","k","M","G","T","P","E","Z","Y"].map(function(t,e){var r=Math.pow(10,3*ca(8-e));return{scale:e>8?function(t){return t/r}:function(t){return t*r},symbol:t}});$i.formatPrefix=function(t,e){var r=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=$i.round(t,Et(t,e))),r=1+Math.floor(1e-12+Math.log(t)/Math.LN10),r=Math.max(-24,Math.min(24,3*Math.floor((r-1)/3)))),Qa[8+r/3]};var $a=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,to=$i.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(t,e){return(t=$i.round(t,Et(t,e))).toFixed(Math.max(0,Math.min(20,Et(t*(1+1e-15),e))))}}),eo=$i.time={},ro=Date;Lt.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(){no.setUTCDate.apply(this._,arguments)},setDay:function(){no.setUTCDay.apply(this._,arguments)},setFullYear:function(){no.setUTCFullYear.apply(this._,arguments)},setHours:function(){no.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){no.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){no.setUTCMinutes.apply(this._,arguments)},setMonth:function(){no.setUTCMonth.apply(this._,arguments)},setSeconds:function(){no.setUTCSeconds.apply(this._,arguments)},setTime:function(){no.setTime.apply(this._,arguments)}};var no=Date.prototype;eo.year=Ct(function(t){return(t=eo.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),eo.years=eo.year.range,eo.years.utc=eo.year.utc.range,eo.day=Ct(function(t){var e=new ro(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}),eo.days=eo.day.range,eo.days.utc=eo.day.utc.range,eo.dayOfYear=function(t){var e=eo.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=eo[t]=Ct(function(t){return(t=eo.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=eo.year(t).getDay();return Math.floor((eo.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});eo[t+"s"]=r.range,eo[t+"s"].utc=r.utc.range,eo[t+"OfYear"]=function(t){var r=eo.year(t).getDay();return Math.floor((eo.dayOfYear(t)+(r+e)%7)/7)}}),eo.week=eo.sunday,eo.weeks=eo.sunday.range,eo.weeks.utc=eo.sunday.utc.range,eo.weekOfYear=eo.sundayOfYear;var io={"-":"",_:" ",0:"0"},ao=/^\s*\d+/,oo=/^%/;$i.locale=function(t){return{numberFormat:function(t){var e=t.decimal,r=t.thousands,n=t.grouping,i=t.currency,a=n&&r?function(t,e){for(var i=t.length,a=[],o=0,s=n[0],l=0;i>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(i-=s,i+s)),!((l+=s+1)>e));)s=n[o=(o+1)%n.length];return a.reverse().join(r)}:y;return function(t){var r=$a.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",c=r[5],u=+r[6],h=r[7],f=r[8],d=r[9],p=1,m="",g="",v=!1,y=!0;switch(f&&(f=+f.substring(1)),(c||"0"===n&&"="===o)&&(c=n="0",o="="),d){case"n":h=!0,d="g";break;case"%":p=100,g="%",d="f";break;case"p":p=100,g="%",d="r";break;case"b":case"o":case"x":case"X":"#"===l&&(m="0"+d.toLowerCase());case"c":y=!1;case"d":v=!0,f=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=i[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=to.get(d)||function(t){return t+""};var b=c&&h;return function(t){var r=g;if(v&&t%1)return"";var i=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===s?"":s;if(p<0){var l=$i.formatPrefix(t,f);t=l.scale(t),r=l.symbol+g}else t*=p;var x,_,w=(t=d(t,f)).lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(x=t,_=""):(x=t.substring(0,M),_=t.substring(M))}else x=t.substring(0,w),_=e+t.substring(w+1);!c&&h&&(x=a(x,1/0));var k=m.length+x.length+_.length+(b?0:i.length),T=k<u?new Array(k=u-k+1).join(n):"";return b&&(x=a(T+x,T.length?u-_.length:1/0)),i+=m,t=x+_,("<"===o?i+t+T:">"===o?T+i+t:"^"===o?T.substring(0,k>>=1)+i+t+T.substring(k):i+(b?t:T+t))+r}}}(t),timeFormat:function(t){function e(t){function e(e){for(var r,i,a,o=[],s=-1,l=0;++s<n;)37===t.charCodeAt(s)&&(o.push(t.slice(l,s)),null!=(i=io[r=t.charAt(++s)])&&(r=t.charAt(++s)),(a=x[r])&&(r=a(e,null==i?"e"===r?" ":"0":i)),o.push(r),l=s+1);return o.push(t.slice(l,s)),o.join("")}var n=t.length;return e.parse=function(e){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(r(n,t,e,0)!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var i=null!=n.Z&&ro!==Lt,a=new(i?Lt:ro);return"j"in n?a.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),a.setFullYear(n.y,0,1),a.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(a.getDay()+5)%7:n.w+7*n.U-(a.getDay()+6)%7)):a.setFullYear(n.y,n.m,n.d),a.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),i?a._:a},e.toString=function(){return t},e}function r(t,e,r,n){for(var i,a,o,s=0,l=e.length,c=r.length;s<l;){if(n>=c)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=_[o in io?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}var n=t.dateTime,i=t.date,a=t.time,o=t.periods,s=t.days,l=t.shortDays,c=t.months,u=t.shortMonths;e.multi=(e.utc=function(t){function r(t){try{var e=new(ro=Lt);return e._=t,n(e)}finally{ro=Date}}var n=e(t);return r.parse=function(t){try{ro=Lt;var e=n.parse(t);return e&&e._}finally{ro=Date}},r.toString=n.toString,r}).multi=Jt;var h=$i.map(),f=Dt(s),d=zt(s),p=Dt(l),m=zt(l),g=Dt(c),v=zt(c),y=Dt(u),b=zt(u);o.forEach(function(t,e){h.set(t.toLowerCase(),e)});var x={a:function(t){return l[t.getDay()]},A:function(t){return s[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return c[t.getMonth()]},c:e(n),d:function(t,e){return Pt(t.getDate(),e,2)},e:function(t,e){return Pt(t.getDate(),e,2)},H:function(t,e){return Pt(t.getHours(),e,2)},I:function(t,e){return Pt(t.getHours()%12||12,e,2)},j:function(t,e){return Pt(1+eo.dayOfYear(t),e,3)},L:function(t,e){return Pt(t.getMilliseconds(),e,3)},m:function(t,e){return Pt(t.getMonth()+1,e,2)},M:function(t,e){return Pt(t.getMinutes(),e,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,e){return Pt(t.getSeconds(),e,2)},U:function(t,e){return Pt(eo.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Pt(eo.mondayOfYear(t),e,2)},x:e(i),X:e(a),y:function(t,e){return Pt(t.getFullYear()%100,e,2)},Y:function(t,e){return Pt(t.getFullYear()%1e4,e,4)},Z:Xt,"%":function(){return"%"}},_={a:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=m.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){y.lastIndex=0;var n=y.exec(e.slice(r));return n?(t.m=b.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,n){return r(t,x.c.toString(),e,n)},d:Vt,e:Vt,H:qt,I:qt,j:Ht,L:Wt,m:Ut,M:Gt,p:function(t,e,r){var n=h.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:Yt,U:Ft,w:Ot,W:Rt,x:function(t,e,n){return r(t,x.x.toString(),e,n)},X:function(t,e,n){return r(t,x.X.toString(),e,n)},y:Nt,Y:jt,Z:Bt,"%":Zt};return e}(t)}};var so=$i.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});$i.format=so.numberFormat,$i.geo={},Kt.prototype={s:0,t:0,add:function(t){Qt(t,this.t,lo),Qt(lo.s,this.s,this),this.s?this.t+=lo.t:this.s=lo.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var lo=new Kt;$i.geo.stream=function(t,e){t&&co.hasOwnProperty(t.type)?co[t.type](t,e):$t(t,e)};var co={Feature:function(t,e){$t(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n<i;)$t(r[n].geometry,e)}},uo={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)t=r[n],e.point(t[0],t[1],t[2])},LineString:function(t,e){te(t.coordinates,e,0)},MultiLineString:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)te(r[n],e,0)},Polygon:function(t,e){ee(t.coordinates,e)},MultiPolygon:function(t,e){for(var r=t.coordinates,n=-1,i=r.length;++n<i;)ee(r[n],e)},GeometryCollection:function(t,e){for(var r=t.geometries,n=-1,i=r.length;++n<i;)$t(r[n],e)}};$i.geo.area=function(t){return ho=0,$i.geo.stream(t,po),ho};var ho,fo=new Kt,po={sphere:function(){ho+=4*Ea},point:x,lineStart:x,lineEnd:x,polygonStart:function(){fo.reset(),po.lineStart=re},polygonEnd:function(){var t=2*fo;ho+=t<0?4*Ea+t:t,po.lineStart=po.lineEnd=po.point=x}};$i.geo.bounds=function(){function t(t,e){b.push(x=[u=t,f=t]),e<h&&(h=e),e>d&&(d=e)}function e(e,r){var n=ne([e*Pa,r*Pa]);if(v){var i=ae(v,n),a=ae([i[1],-i[0],0],i);le(a),a=ce(a);var o=e-p,l=o>0?1:-1,c=a[0]*Da*l,m=ca(o)>180;if(m^(l*p<c&&c<l*e)){(g=a[1]*Da)>d&&(d=g)}else if(c=(c+360)%360-180,m^(l*p<c&&c<l*e)){var g;(g=-a[1]*Da)<h&&(h=g)}else r<h&&(h=r),r>d&&(d=r);m?e<p?s(u,e)>s(u,f)&&(f=e):s(e,f)>s(u,f)&&(u=e):f>=u?(e<u&&(u=e),e>f&&(f=e)):e>p?s(u,e)>s(u,f)&&(f=e):s(e,f)>s(u,f)&&(u=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){x[0]=u,x[1]=f,_.point=t,v=null}function i(t,r){if(v){var n=t-p;y+=ca(n)>180?n+(n>0?360:-360):n}else m=t,g=r;po.point(t,r),e(t,r)}function a(){po.lineStart()}function o(){i(m,g),po.lineEnd(),ca(y)>Aa&&(u=-(f=180)),x[0]=u,x[1]=f,v=null}function s(t,e){return(e-=t)<0?e+360:e}function l(t,e){return t[0]-e[0]}function c(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}var u,h,f,d,p,m,g,v,y,b,x,_={point:t,lineStart:r,lineEnd:n,polygonStart:function(){_.point=i,_.lineStart=a,_.lineEnd=o,y=0,po.polygonStart()},polygonEnd:function(){po.polygonEnd(),_.point=t,_.lineStart=r,_.lineEnd=n,fo<0?(u=-(f=180),h=-(d=90)):y>Aa?d=90:y<-Aa&&(h=-90),x[0]=u,x[1]=f}};return function(t){d=f=-(u=h=1/0),b=[],$i.geo.stream(t,_);if(i=b.length){b.sort(l);for(var e=1,r=[p=b[0]];e<i;++e)c((a=b[e])[0],p)||c(a[1],p)?(s(p[0],a[1])>s(p[0],p[1])&&(p[1]=a[1]),s(a[0],p[1])>s(p[0],p[1])&&(p[0]=a[0])):r.push(p=a);for(var n,i,a,o=-1/0,p=(e=0,r[i=r.length-1]);e<=i;p=a,++e)a=r[e],(n=s(p[1],a[0]))>o&&(o=n,u=a[0],f=p[1])}return b=x=null,u===1/0||h===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,h],[f,d]]}}(),$i.geo.centroid=function(t){mo=go=vo=yo=bo=xo=_o=wo=Mo=ko=To=0,$i.geo.stream(t,Ao);var e=Mo,r=ko,n=To,i=e*e+r*r+n*n;return i<Sa&&(e=xo,r=_o,n=wo,go<Aa&&(e=vo,r=yo,n=bo),(i=e*e+r*r+n*n)<Sa)?[NaN,NaN]:[Math.atan2(r,e)*Da,Q(n/Math.sqrt(i))*Da]};var mo,go,vo,yo,bo,xo,_o,wo,Mo,ko,To,Ao={sphere:x,point:he,lineStart:de,lineEnd:pe,polygonStart:function(){Ao.lineStart=me},polygonEnd:function(){Ao.lineStart=de}},So=_e(ve,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?Ea:-Ea,l=ca(a-r);ca(l-Ea)<Aa?(t.point(r,n=(n+o)/2>0?Ia:-Ia),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=Ea&&(ca(r-i)<Aa&&(r-=i*Aa),ca(a-s)<Aa&&(a-=s*Aa),n=function(t,e,r,n){var i,a,o=Math.sin(t-r);return ca(o)>Aa?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*Ia,n.point(-Ea,i),n.point(0,i),n.point(Ea,i),n.point(Ea,0),n.point(Ea,-i),n.point(0,-i),n.point(-Ea,-i),n.point(-Ea,0),n.point(-Ea,i);else if(ca(t[0]-e[0])>Aa){var a=t[0]<e[0]?Ea:-Ea;i=r*a/2,n.point(-a,i),n.point(0,i),n.point(a,i)}else n.point(e[0],e[1])},[-Ea,-Ea/2]),Eo=1e9;$i.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),i=a(t),i.valid=!0,i},extent:function(s){return arguments.length?(a=Ae(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]])},($i.geo.conicEqualArea=function(){return Se(Ee)}).raw=Ee,$i.geo.albers=function(){return $i.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},$i.geo.albersUsa=function(){function t(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}var e,r,n,i,a=$i.geo.albers(),o=$i.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=$i.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};return t.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)},t.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()}}},t.precision=function(e){return arguments.length?(a.precision(e),o.precision(e),s.precision(e),t):a.precision()},t.scale=function(e){return arguments.length?(a.scale(e),o.scale(.35*e),s.scale(e),t.translate(a.translate())):a.scale()},t.translate=function(e){if(!arguments.length)return a.translate();var c=a.scale(),u=+e[0],h=+e[1];return r=a.translate(e).clipExtent([[u-.455*c,h-.238*c],[u+.455*c,h+.238*c]]).stream(l).point,n=o.translate([u-.307*c,h+.201*c]).clipExtent([[u-.425*c+Aa,h+.12*c+Aa],[u-.214*c-Aa,h+.234*c-Aa]]).stream(l).point,i=s.translate([u-.205*c,h+.212*c]).clipExtent([[u-.214*c+Aa,h+.166*c+Aa],[u-.115*c-Aa,h+.234*c-Aa]]).stream(l).point,t},t.scale(1070)};var Lo,Co,Io,Po,Do,zo,Oo={point:x,lineStart:x,lineEnd:x,polygonStart:function(){Co=0,Oo.lineStart=Le},polygonEnd:function(){Oo.lineStart=Oo.lineEnd=Oo.point=x,Lo+=ca(Co/2)}},Fo={point:function(t,e){t<Io&&(Io=t),t>Do&&(Do=t),e<Po&&(Po=e),e>zo&&(zo=e)},lineStart:x,lineEnd:x,polygonStart:x,polygonEnd:x},Ro={point:Ie,lineStart:Pe,lineEnd:De,polygonStart:function(){Ro.lineStart=ze},polygonEnd:function(){Ro.point=Ie,Ro.lineStart=Pe,Ro.lineEnd=De}};$i.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),$i.geo.stream(t,o)),a.result()}function e(){return o=null,t}var r,n,i,a,o,s=4.5;return t.area=function(t){return Lo=0,$i.geo.stream(t,i(Oo)),Lo},t.centroid=function(t){return vo=yo=bo=xo=_o=wo=Mo=ko=To=0,$i.geo.stream(t,i(Ro)),To?[Mo/To,ko/To]:wo?[xo/wo,_o/wo]:bo?[vo/bo,yo/bo]:[NaN,NaN]},t.bounds=function(t){return Do=zo=-(Io=Po=1/0),$i.geo.stream(t,i(Fo)),[[Io,Po],[Do,zo]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||function(t){var e=Oe(function(e,r){return t([e*Da,r*Da])});return function(t){return Be(e(t))}}(t):y,e()):r},t.context=function(t){return arguments.length?(a=null==(n=t)?new function(){function t(t,e){o.push("M",t,",",e,a)}function e(t,e){o.push("M",t,",",e),s.point=r}function r(t,e){o.push("L",t,",",e)}function n(){s.point=t}function i(){o.push("Z")}var a=Ce(4.5),o=[],s={point:t,lineStart:function(){s.point=e},lineEnd:n,polygonStart:function(){s.lineEnd=i},polygonEnd:function(){s.lineEnd=n,s.point=t},pointRadius:function(t){return a=Ce(t),s},result:function(){if(o.length){var t=o.join("");return o=[],t}}};return s}:new function(t){function e(e,r){t.moveTo(e+o,r),t.arc(e,r,o,0,La)}function r(e,r){t.moveTo(e,r),s.point=n}function n(e,r){t.lineTo(e,r)}function i(){s.point=e}function a(){t.closePath()}var o=4.5,s={point:e,lineStart:function(){s.point=r},lineEnd:i,polygonStart:function(){s.lineEnd=a},polygonEnd:function(){s.lineEnd=i,s.point=e},pointRadius:function(t){return o=t,s},result:x};return s}(t),"function"!=typeof s&&a.pointRadius(s),e()):n},t.pointRadius=function(e){return arguments.length?(s="function"==typeof e?e:(a.pointRadius(+e),+e),t):s},t.projection($i.geo.albersUsa()).context(null)},$i.geo.transform=function(t){return{stream:function(e){var r=new Fe(e);for(var n in t)r[n]=t[n];return r}}},Fe.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},$i.geo.projection=je,$i.geo.projectionMutator=Ne,($i.geo.equirectangular=function(){return je(Ue)}).raw=Ue.invert=Ue,$i.geo.rotation=function(t){function e(e){return e=t(e[0]*Pa,e[1]*Pa),e[0]*=Da,e[1]*=Da,e}return t=He(t[0]%360*Pa,t[1]*Pa,t.length>2?t[2]*Pa:0),e.invert=function(e){return e=t.invert(e[0]*Pa,e[1]*Pa),e[0]*=Da,e[1]*=Da,e},e},Ve.invert=Ue,$i.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=He(-t[0]*Pa,-t[1]*Pa,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=Da,t[1]*=Da}}),{type:"Polygon",coordinates:[i]}}var e,r,n=[0,0],i=6;return t.origin=function(e){return arguments.length?(n=e,t):n},t.angle=function(n){return arguments.length?(r=We((e=+n)*Pa,i*Pa),t):e},t.precision=function(n){return arguments.length?(r=We(e*Pa,(i=+n)*Pa),t):i},t.angle(90)},$i.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Pa,i=t[1]*Pa,a=e[1]*Pa,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),c=Math.cos(i),u=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=c*u-l*h*s)*r),l*u+c*h*s)},$i.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return $i.range(Math.ceil(a/g)*g,i,g).map(f).concat($i.range(Math.ceil(c/v)*v,l,v).map(d)).concat($i.range(Math.ceil(n/p)*p,r,p).filter(function(t){return ca(t%g)>Aa}).map(u)).concat($i.range(Math.ceil(s/m)*m,o,m).filter(function(t){return ca(t%v)>Aa}).map(h))}var r,n,i,a,o,s,l,c,u,h,f,d,p=10,m=p,g=90,v=360,y=2.5;return t.lines=function(){return e().map(function(t){return{type:"LineString",coordinates:t}})},t.outline=function(){return{type:"Polygon",coordinates:[f(a).concat(d(l).slice(1),f(i).reverse().slice(1),d(c).reverse().slice(1))]}},t.extent=function(e){return arguments.length?t.majorExtent(e).minorExtent(e):t.minorExtent()},t.majorExtent=function(e){return arguments.length?(a=+e[0][0],i=+e[1][0],c=+e[0][1],l=+e[1][1],a>i&&(e=a,a=i,i=e),c>l&&(e=c,c=l,l=e),t.precision(y)):[[a,c],[i,l]]},t.minorExtent=function(e){return arguments.length?(n=+e[0][0],r=+e[1][0],s=+e[0][1],o=+e[1][1],n>r&&(e=n,n=r,r=e),s>o&&(e=s,s=o,o=e),t.precision(y)):[[n,s],[r,o]]},t.step=function(e){return arguments.length?t.majorStep(e).minorStep(e):t.minorStep()},t.majorStep=function(e){return arguments.length?(g=+e[0],v=+e[1],t):[g,v]},t.minorStep=function(e){return arguments.length?(p=+e[0],m=+e[1],t):[p,m]},t.precision=function(e){return arguments.length?(y=+e,u=Ze(s,o,90),h=Je(n,r,y),f=Ze(c,l,90),d=Je(a,i,y),t):y},t.majorExtent([[-180,-90+Aa],[180,90-Aa]]).minorExtent([[-180,-80-Aa],[180,80+Aa]])},$i.geo.greatArc=function(){function t(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}var e,r,n=Ke,i=Qe;return t.distance=function(){return $i.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},t.source=function(r){return arguments.length?(n=r,e="function"==typeof r?null:r,t):n},t.target=function(e){return arguments.length?(i=e,r="function"==typeof e?null:e,t):i},t.precision=function(){return arguments.length?t:0},t},$i.geo.interpolate=function(t,e){return function(t,e,r,n){var i=Math.cos(e),a=Math.sin(e),o=Math.cos(n),s=Math.sin(n),l=i*Math.cos(t),c=i*Math.sin(t),u=o*Math.cos(r),h=o*Math.sin(r),f=2*Math.asin(Math.sqrt(tt(n-e)+i*o*tt(r-t))),d=1/Math.sin(f),p=f?function(t){var e=Math.sin(t*=f)*d,r=Math.sin(f-t)*d,n=r*l+e*u,i=r*c+e*h,o=r*a+e*s;return[Math.atan2(i,n)*Da,Math.atan2(o,Math.sqrt(n*n+i*i))*Da]}:function(){return[t*Da,e*Da]};return p.distance=f,p}(t[0]*Pa,t[1]*Pa,e[0]*Pa,e[1]*Pa)},$i.geo.length=function(t){return jo=0,$i.geo.stream(t,No),jo};var jo,No={sphere:x,point:x,lineStart:function(){function t(t,i){var a=Math.sin(i*=Pa),o=Math.cos(i),s=ca((t*=Pa)-e),l=Math.cos(s);jo+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=n*a-r*o*l)*s),r*a+n*o*l),e=t,r=a,n=o}var e,r,n;No.point=function(i,a){e=i*Pa,r=Math.sin(a*=Pa),n=Math.cos(a),No.point=t},No.lineEnd=function(){No.point=No.lineEnd=x}},lineEnd:x,polygonStart:x,polygonEnd:x},Bo=$e(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});($i.geo.azimuthalEqualArea=function(){return je(Bo)}).raw=Bo;var Uo=$e(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},y);($i.geo.azimuthalEquidistant=function(){return je(Uo)}).raw=Uo,($i.geo.conicConformal=function(){return Se(tr)}).raw=tr,($i.geo.conicEquidistant=function(){return Se(er)}).raw=er;var Vo=$e(function(t){return 1/t},Math.atan);($i.geo.gnomonic=function(){return je(Vo)}).raw=Vo,rr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Ia]},($i.geo.mercator=function(){return nr(rr)}).raw=rr;var Ho=$e(function(){return 1},Math.asin);($i.geo.orthographic=function(){return je(Ho)}).raw=Ho;var qo=$e(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});($i.geo.stereographic=function(){return je(qo)}).raw=qo,ir.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Ia]},($i.geo.transverseMercator=function(){var t=nr(ir),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):(t=e(),[t[1],-t[0]])},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):(t=r(),[t[0],t[1],t[2]-90])},r([0,0,90])}).raw=ir,$i.geom={},$i.geom.hull=function(t){function e(t){if(t.length<3)return[];var e,i=_t(r),a=_t(n),o=t.length,s=[],l=[];for(e=0;e<o;e++)s.push([+i.call(this,t[e],e),+a.call(this,t[e],e),e]);for(s.sort(lr),e=0;e<o;e++)l.push([s[e][0],-s[e][1]]);var c=sr(s),u=sr(l),h=u[0]===c[0],f=u[u.length-1]===c[c.length-1],d=[];for(e=c.length-1;e>=0;--e)d.push(t[s[c[e]][2]]);for(e=+h;e<u.length-f;++e)d.push(t[s[u[e]][2]]);return d}var r=ar,n=or;return arguments.length?e(t):(e.x=function(t){return arguments.length?(r=t,e):r},e.y=function(t){return arguments.length?(n=t,e):n},e)},$i.geom.polygon=function(t){return pa(t,Go),t};var Go=$i.geom.polygon.prototype=[];Go.area=function(){for(var t,e=-1,r=this.length,n=this[r-1],i=0;++e<r;)t=n,n=this[e],i+=t[1]*n[0]-t[0]*n[1];return.5*i},Go.centroid=function(t){var e,r,n=-1,i=this.length,a=0,o=0,s=this[i-1];for(arguments.length||(t=-1/(6*this.area()));++n<i;)e=s,s=this[n],r=e[0]*s[1]-s[0]*e[1],a+=(e[0]+s[0])*r,o+=(e[1]+s[1])*r;return[a*t,o*t]},Go.clip=function(t){for(var e,r,n,i,a,o,s=hr(t),l=-1,c=this.length-hr(this),u=this[c-1];++l<c;){for(e=t.slice(),t.length=0,i=this[l],a=e[(n=e.length-s)-1],r=-1;++r<n;)cr(o=e[r],u,i)?(cr(a,u,i)||t.push(ur(a,o,u,i)),t.push(o)):cr(a,u,i)&&t.push(ur(a,o,u,i)),a=o;s&&t.push(t[0]),u=i}return t};var Yo,Wo,Xo,Zo,Jo,Ko=[],Qo=[];vr.prototype.prepare=function(){for(var t,e=this.edges,r=e.length;r--;)(t=e[r].edge).b&&t.a||e.splice(r,1);return e.sort(br),e.length},Tr.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},Ar.prototype={insert:function(t,e){var r,n,i;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;r=t}else this._?(t=Cr(this._),e.P=null,e.N=t,t.P=t.L=e,r=t):(e.P=e.N=null,this._=e,r=null);for(e.L=e.R=null,e.U=r,e.C=!0,t=e;r&&r.C;)r===(n=r.U).L?(i=n.R)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.R&&(Er(this,r),r=(t=r).U),r.C=!1,n.C=!0,Lr(this,n)):(i=n.L)&&i.C?(r.C=i.C=!1,n.C=!0,t=n):(t===r.L&&(Lr(this,r),r=(t=r).U),r.C=!1,n.C=!0,Er(this,n)),r=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,r,n,i=t.U,a=t.L,o=t.R;if(r=a?o?Cr(o):a:o,i?i.L===t?i.L=r:i.R=r:this._=r,a&&o?(n=r.C,r.C=t.C,r.L=a,a.U=r,r!==o?(i=r.U,r.U=t.U,t=r.R,i.L=t,r.R=o,o.U=r):(r.U=i,i=r,t=r.R)):(n=t.C,t=r),t&&(t.U=i),!n)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===i.L){if((e=i.R).C&&(e.C=!1,i.C=!0,Er(this,i),e=i.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Lr(this,e),e=i.R),e.C=i.C,i.C=e.R.C=!1,Er(this,i),t=this._;break}}else if((e=i.L).C&&(e.C=!1,i.C=!0,Lr(this,i),e=i.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Er(this,e),e=i.L),e.C=i.C,i.C=e.L.C=!1,Lr(this,i),t=this._;break}e.C=!0,t=i,i=i.U}while(!t.C);t&&(t.C=!1)}}},$i.geom.voronoi=function(t){function e(t){var e=new Array(t.length),n=s[0][0],i=s[0][1],a=s[1][0],o=s[1][1];return Ir(r(t),s).cells.forEach(function(r,s){var l=r.edges,c=r.site;(e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):c.x>=n&&c.x<=a&&c.y>=i&&c.y<=o?[[n,o],[a,o],[a,i],[n,i]]:[]).point=t[s]}),e}function r(t){return t.map(function(t,e){return{x:Math.round(a(t,e)/Aa)*Aa,y:Math.round(o(t,e)/Aa)*Aa,i:e}})}var n=ar,i=or,a=n,o=i,s=$o;return t?e(t):(e.links=function(t){return Ir(r(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},e.triangles=function(t){var e=[];return Ir(r(t)).cells.forEach(function(r,n){for(var i,a=r.site,o=r.edges.sort(br),s=-1,l=o.length,c=o[l-1].edge,u=c.l===a?c.r:c.l;++s<l;)c,i=u,u=(c=o[s].edge).l===a?c.r:c.l,n<i.i&&n<u.i&&function(t,e,r){return(t.x-r.x)*(e.y-t.y)-(t.x-e.x)*(r.y-t.y)}(a,i,u)<0&&e.push([t[n],t[i.i],t[u.i]])}),e},e.x=function(t){return arguments.length?(a=_t(n=t),e):n},e.y=function(t){return arguments.length?(o=_t(i=t),e):i},e.clipExtent=function(t){return arguments.length?(s=null==t?$o:t,e):s===$o?null:s},e.size=function(t){return arguments.length?e.clipExtent(t&&[[0,0],t]):s===$o?null:s&&s[1]},e)};var $o=[[-1e6,-1e6],[1e6,1e6]];$i.geom.delaunay=function(t){return $i.geom.voronoi().triangles(t)},$i.geom.quadtree=function(t,e,r,n,i){function a(t){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(ca(l-r)+ca(u-n)<.01)c(t,e,r,n,i,a,o,s);else{var h=t.point;t.x=t.y=t.point=null,c(t,h,l,u,i,a,o,s),c(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else c(t,e,r,n,i,a,o,s)}function c(t,e,r,n,i,o,s,l){var c=.5*(i+s),u=.5*(o+l),h=r>=c,f=n>=u,d=f<<1|h;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),h?i=c:s=c,f?o=u:l=u,a(t,e,r,n,i,o,s,l)}var u,h,f,d,p,m,g,v,y,b=_t(s),x=_t(l);if(null!=e)m=e,g=r,v=n,y=i;else if(v=y=-(m=g=1/0),h=[],f=[],p=t.length,o)for(d=0;d<p;++d)(u=t[d]).x<m&&(m=u.x),u.y<g&&(g=u.y),u.x>v&&(v=u.x),u.y>y&&(y=u.y),h.push(u.x),f.push(u.y);else for(d=0;d<p;++d){var _=+b(u=t[d],d),w=+x(u,d);_<m&&(m=_),w<g&&(g=w),_>v&&(v=_),w>y&&(y=w),h.push(_),f.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var T={leaf:!0,nodes:[],point:null,x:null,y:null};if(T.add=function(t){a(T,t,+b(t,++d),+x(t,d),m,g,v,y)},T.visit=function(t){Or(t,T,m,g,v,y)},T.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(c,u,h,f,d){if(!(u>a||h>o||f<n||d<i)){if(p=c.point){var p,m=e-c.x,g=r-c.y,v=m*m+g*g;if(v<l){var y=Math.sqrt(l=v);n=e-y,i=r-y,a=e+y,o=r+y,s=p}}for(var b=c.nodes,x=.5*(u+f),_=.5*(h+d),w=(r>=_)<<1|e>=x,M=w+4;w<M;++w)if(c=b[3&w])switch(3&w){case 0:t(c,u,h,x,_);break;case 1:t(c,x,h,f,_);break;case 2:t(c,u,_,x,d);break;case 3:t(c,x,_,f,d)}}}(t,n,i,a,o),s}(T,t[0],t[1],m,g,v,y)},d=-1,null==e){for(;++d<p;)a(T,t[d],h[d],f[d],m,g,v,y);--d}else t.forEach(T.add);return h=f=t=u=null,T}var o,s=ar,l=or;return(o=arguments.length)?(s=Dr,l=zr,3===o&&(i=r,n=e,r=e=0),a(t)):(a.x=function(t){return arguments.length?(s=t,a):s},a.y=function(t){return arguments.length?(l=t,a):l},a.extent=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=+t[0][0],r=+t[0][1],n=+t[1][0],i=+t[1][1]),a):null==e?null:[[e,r],[n,i]]},a.size=function(t){return arguments.length?(null==t?e=r=n=i=null:(e=r=0,n=+t[0],i=+t[1]),a):null==e?null:[n-e,i-r]},a)},$i.interpolateRgb=Fr,$i.interpolateObject=Rr,$i.interpolateNumber=jr,$i.interpolateString=Nr;var ts=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,es=new RegExp(ts.source,"g");$i.interpolate=Br,$i.interpolators=[function(t,e){var r=typeof e;return("string"===r?Ya.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?Fr:Nr:e instanceof et?Fr:Array.isArray(e)?Ur:"object"===r&&isNaN(e)?Rr:jr)(t,e)}],$i.interpolateArray=Ur;var rs=function(){return y},ns=$i.map({linear:rs,poly:function(t){return function(e){return Math.pow(e,t)}},quad:function(){return qr},cubic:function(){return Gr},sin:function(){return Yr},exp:function(){return Wr},circle:function(){return Xr},elastic:function(t,e){var r;return arguments.length<2&&(e=.45),arguments.length?r=e/La*Math.asin(1/t):(t=1,r=e/4),function(n){return 1+t*Math.pow(2,-10*n)*Math.sin((n-r)*La/e)}},back:function(t){return t||(t=1.70158),function(e){return e*e*((t+1)*e-t)}},bounce:function(){return Zr}}),is=$i.map({in:y,out:Vr,"in-out":Hr,"out-in":function(t){return Hr(Vr(t))}});$i.ease=function(t){var e=t.indexOf("-"),r=e>=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=ns.get(r)||rs,n=is.get(n)||y,function(t){return function(e){return e<=0?0:e>=1?1:t(e)}}(n(r.apply(null,ta.call(arguments,1))))},$i.interpolateHcl=function(t,e){t=$i.hcl(t),e=$i.hcl(e);var r=t.h,n=t.c,i=t.l,a=e.h-r,o=e.c-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.c:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return at(r+a*t,n+o*t,i+s*t)+""}},$i.interpolateHsl=function(t,e){t=$i.hsl(t),e=$i.hsl(e);var r=t.h,n=t.s,i=t.l,a=e.h-r,o=e.s-n,s=e.l-i;return isNaN(o)&&(o=0,n=isNaN(n)?e.s:n),isNaN(a)?(a=0,r=isNaN(r)?e.h:r):a>180?a-=360:a<-180&&(a+=360),function(t){return nt(r+a*t,n+o*t,i+s*t)+""}},$i.interpolateLab=function(t,e){t=$i.lab(t),e=$i.lab(e);var r=t.l,n=t.a,i=t.b,a=e.l-r,o=e.a-n,s=e.b-i;return function(t){return st(r+a*t,n+o*t,i+s*t)+""}},$i.interpolateRound=Jr,$i.transform=function(t){var e=ra.createElementNS($i.ns.prefix.svg,"g");return($i.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Kr(r?r.matrix:as)})(t)},Kr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var as={a:1,b:0,c:0,d:1,e:0,f:0};$i.interpolateTransform=en,$i.layout={},$i.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r<n;)e.push(an(t[r]));return e}},$i.layout.chord=function(){function t(){var t,c,h,f,d,p={},m=[],g=$i.range(a),v=[];for(r=[],n=[],t=0,f=-1;++f<a;){for(c=0,d=-1;++d<a;)c+=i[f][d];m.push(c),v.push($i.range(a)),t+=c}for(o&&g.sort(function(t,e){return o(m[t],m[e])}),s&&v.forEach(function(t,e){t.sort(function(t,r){return s(i[e][t],i[e][r])})}),t=(La-u*a)/t,c=0,f=-1;++f<a;){for(h=c,d=-1;++d<a;){var y=g[f],b=v[y][d],x=i[y][b],_=c,w=c+=x*t;p[y+"-"+b]={index:y,subindex:b,startAngle:_,endAngle:w,value:x}}n[y]={index:y,startAngle:h,endAngle:c,value:m[y]},c+=u}for(f=-1;++f<a;)for(d=f-1;++d<a;){var M=p[f+"-"+d],k=p[d+"-"+f];(M.value||k.value)&&r.push(M.value<k.value?{source:k,target:M}:{source:M,target:k})}l&&e()}function e(){r.sort(function(t,e){return l((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}var r,n,i,a,o,s,l,c={},u=0;return c.matrix=function(t){return arguments.length?(a=(i=t)&&i.length,r=n=null,c):i},c.padding=function(t){return arguments.length?(u=t,r=n=null,c):u},c.sortGroups=function(t){return arguments.length?(o=t,r=n=null,c):o},c.sortSubgroups=function(t){return arguments.length?(s=t,r=null,c):s},c.sortChords=function(t){return arguments.length?(l=t,r&&e(),c):l},c.chords=function(){return r||t(),r},c.groups=function(){return n||t(),n},c},$i.layout.force=function(){function t(t){return function(e,r,n,i){if(e.point!==t){var a=e.cx-t.x,o=e.cy-t.y,s=i-r,l=a*a+o*o;if(s*s/v<l){if(l<m){var c=e.charge/l;t.px-=a*c,t.py-=o*c}return!0}if(e.point&&l&&l<m){c=e.pointCharge/l;t.px-=a*c,t.py-=o*c}}return!e.charge}}function e(t){t.px=$i.event.x,t.py=$i.event.y,l.resume()}var r,n,i,a,o,s,l={},c=$i.dispatch("start","tick","end"),u=[1,1],h=.9,f=os,d=ss,p=-30,m=ls,g=.1,v=.64,b=[],x=[];return l.tick=function(){if((i*=.99)<.005)return r=null,c.end({type:"end",alpha:i=0}),!0;var e,n,l,f,d,m,v,y,_,w=b.length,M=x.length;for(n=0;n<M;++n)f=(l=x[n]).source,(m=(y=(d=l.target).x-f.x)*y+(_=d.y-f.y)*_)&&(y*=m=i*o[n]*((m=Math.sqrt(m))-a[n])/m,_*=m,d.x-=y*(v=f.weight+d.weight?f.weight/(f.weight+d.weight):.5),d.y-=_*v,f.x+=y*(v=1-v),f.y+=_*v);if((v=i*g)&&(y=u[0]/2,_=u[1]/2,n=-1,v))for(;++n<w;)(l=b[n]).x+=(y-l.x)*v,l.y+=(_-l.y)*v;if(p)for(hn(e=$i.geom.quadtree(b),i,s),n=-1;++n<w;)(l=b[n]).fixed||e.visit(t(l));for(n=-1;++n<w;)(l=b[n]).fixed?(l.x=l.px,l.y=l.py):(l.x-=(l.px-(l.px=l.x))*h,l.y-=(l.py-(l.py=l.y))*h);c.tick({type:"tick",alpha:i})},l.nodes=function(t){return arguments.length?(b=t,l):b},l.links=function(t){return arguments.length?(x=t,l):x},l.size=function(t){return arguments.length?(u=t,l):u},l.linkDistance=function(t){return arguments.length?(f="function"==typeof t?t:+t,l):f},l.distance=l.linkDistance,l.linkStrength=function(t){return arguments.length?(d="function"==typeof t?t:+t,l):d},l.friction=function(t){return arguments.length?(h=+t,l):h},l.charge=function(t){return arguments.length?(p="function"==typeof t?t:+t,l):p},l.chargeDistance=function(t){return arguments.length?(m=t*t,l):Math.sqrt(m)},l.gravity=function(t){return arguments.length?(g=+t,l):g},l.theta=function(t){return arguments.length?(v=t*t,l):Math.sqrt(v)},l.alpha=function(t){return arguments.length?(t=+t,i?t>0?i=t:(r.c=null,r.t=NaN,r=null,c.end({type:"end",alpha:i=0})):t>0&&(c.start({type:"start",alpha:i=t}),r=kt(l.tick)),l):i},l.start=function(){function t(t,n){if(!r){for(r=new Array(i),l=0;l<i;++l)r[l]=[];for(l=0;l<c;++l){var a=x[l];r[a.source.index].push(a.target),r[a.target.index].push(a.source)}}for(var o,s=r[e],l=-1,u=s.length;++l<u;)if(!isNaN(o=s[l][t]))return o;return Math.random()*n}var e,r,n,i=b.length,c=x.length,h=u[0],m=u[1];for(e=0;e<i;++e)(n=b[e]).index=e,n.weight=0;for(e=0;e<c;++e)"number"==typeof(n=x[e]).source&&(n.source=b[n.source]),"number"==typeof n.target&&(n.target=b[n.target]),++n.source.weight,++n.target.weight;for(e=0;e<i;++e)n=b[e],isNaN(n.x)&&(n.x=t("x",h)),isNaN(n.y)&&(n.y=t("y",m)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(a=[],"function"==typeof f)for(e=0;e<c;++e)a[e]=+f.call(this,x[e],e);else for(e=0;e<c;++e)a[e]=f;if(o=[],"function"==typeof d)for(e=0;e<c;++e)o[e]=+d.call(this,x[e],e);else for(e=0;e<c;++e)o[e]=d;if(s=[],"function"==typeof p)for(e=0;e<i;++e)s[e]=+p.call(this,b[e],e);else for(e=0;e<i;++e)s[e]=p;return l.resume()},l.resume=function(){return l.alpha(.1)},l.stop=function(){return l.alpha(0)},l.drag=function(){if(n||(n=$i.behavior.drag().origin(y).on("dragstart.force",sn).on("drag.force",e).on("dragend.force",ln)),!arguments.length)return n;this.on("mouseover.force",cn).on("mouseout.force",un).call(n)},$i.rebind(l,c,"on")};var os=20,ss=1,ls=1/0;$i.layout.hierarchy=function(){function t(i){var a,o=[i],s=[];for(i.depth=0;null!=(a=o.pop());)if(s.push(a),(c=r.call(t,a,a.depth))&&(l=c.length)){for(var l,c,u;--l>=0;)o.push(u=c[l]),u.parent=a,u.depth=a.depth+1;n&&(a.value=0),a.children=c}else n&&(a.value=+n.call(t,a,a.depth)||0),delete a.children;return pn(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=vn,r=mn,n=gn;return t.sort=function(r){return arguments.length?(e=r,t):e},t.children=function(e){return arguments.length?(r=e,t):r},t.value=function(e){return arguments.length?(n=e,t):n},t.revalue=function(e){return n&&(dn(e,function(t){t.children&&(t.value=0)}),pn(e,function(e){var r;e.children||(e.value=+n.call(t,e,e.depth)||0),(r=e.parent)&&(r.value+=e.value)})),e},t},$i.layout.partition=function(){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;++c<o;)t(s=a[c],r,l=s.value*n,i),r+=l}}function e(t){var r=t.children,n=0;if(r&&(i=r.length))for(var i,a=-1;++a<i;)n=Math.max(n,e(r[a]));return 1+n}function r(r,a){var o=n.call(this,r,a);return t(o[0],0,i[0],i[1]/e(o[0])),o}var n=$i.layout.hierarchy(),i=[1,1];return r.size=function(t){return arguments.length?(i=t,r):i},fn(r,n)},$i.layout.pie=function(){function t(o){var s,l=o.length,c=o.map(function(r,n){return+e.call(t,r,n)}),u=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-u,f=Math.min(Math.abs(h)/l,+("function"==typeof a?a.apply(this,arguments):a)),d=f*(h<0?-1:1),p=$i.sum(c),m=p?(h-l*d)/p:0,g=$i.range(l),v=[];return null!=r&&g.sort(r===cs?function(t,e){return c[e]-c[t]}:function(t,e){return r(o[t],o[e])}),g.forEach(function(t){v[t]={data:o[t],value:s=c[t],startAngle:u,endAngle:u+=s*m+d,padAngle:f}}),v}var e=Number,r=cs,n=0,i=La,a=0;return t.value=function(r){return arguments.length?(e=r,t):e},t.sort=function(e){return arguments.length?(r=e,t):r},t.startAngle=function(e){return arguments.length?(n=e,t):n},t.endAngle=function(e){return arguments.length?(i=e,t):i},t.padAngle=function(e){return arguments.length?(a=e,t):a},t};var cs={};$i.layout.stack=function(){function t(s,l){if(!(f=s.length))return s;var c=s.map(function(r,n){return e.call(t,r,n)}),u=c.map(function(e){return e.map(function(e,r){return[a.call(t,e,r),o.call(t,e,r)]})}),h=r.call(t,u,l);c=$i.permute(c,h),u=$i.permute(u,h);var f,d,p,m,g=n.call(t,u,l),v=c[0].length;for(p=0;p<v;++p)for(i.call(t,c[0][p],m=g[p],u[0][p][1]),d=1;d<f;++d)i.call(t,c[d][p],m+=u[d-1][p][1],u[d][p][1]);return s}var e=y,r=wn,n=Mn,i=_n,a=bn,o=xn;return t.values=function(r){return arguments.length?(e=r,t):e},t.order=function(e){return arguments.length?(r="function"==typeof e?e:us.get(e)||wn,t):r},t.offset=function(e){return arguments.length?(n="function"==typeof e?e:hs.get(e)||Mn,t):n},t.x=function(e){return arguments.length?(a=e,t):a},t.y=function(e){return arguments.length?(o=e,t):o},t.out=function(e){return arguments.length?(i=e,t):i},t};var us=$i.map({"inside-out":function(t){var e,r,n=t.length,i=t.map(kn),a=t.map(Tn),o=$i.range(n).sort(function(t,e){return i[t]-i[e]}),s=0,l=0,c=[],u=[];for(e=0;e<n;++e)r=o[e],s<l?(s+=a[r],c.push(r)):(l+=a[r],u.push(r));return u.reverse().concat(c)},reverse:function(t){return $i.range(t.length).reverse()},default:wn}),hs=$i.map({silhouette:function(t){var e,r,n,i=t.length,a=t[0].length,o=[],s=0,l=[];for(r=0;r<a;++r){for(e=0,n=0;e<i;e++)n+=t[e][r][1];n>s&&(s=n),o.push(n)}for(r=0;r<a;++r)l[r]=(s-o[r])/2;return l},wiggle:function(t){var e,r,n,i,a,o,s,l,c,u=t.length,h=t[0],f=h.length,d=[];for(d[0]=l=c=0,r=1;r<f;++r){for(e=0,i=0;e<u;++e)i+=t[e][r][1];for(e=0,a=0,s=h[r][0]-h[r-1][0];e<u;++e){for(n=0,o=(t[e][r][1]-t[e][r-1][1])/(2*s);n<e;++n)o+=(t[n][r][1]-t[n][r-1][1])/s;a+=o*t[e][r][1]}d[r]=l-=i?a/i*s:0,l<c&&(c=l)}for(r=0;r<f;++r)d[r]-=c;return d},expand:function(t){var e,r,n,i=t.length,a=t[0].length,o=1/i,s=[];for(r=0;r<a;++r){for(e=0,n=0;e<i;e++)n+=t[e][r][1];if(n)for(e=0;e<i;e++)t[e][r][1]/=n;else for(e=0;e<i;e++)t[e][r][1]=o}for(r=0;r<a;++r)s[r]=0;return s},zero:Mn});$i.layout.histogram=function(){function t(t,a){for(var o,s,l=[],c=t.map(r,this),u=n.call(this,c,a),h=i.call(this,u,c,a),f=(a=-1,c.length),d=h.length-1,p=e?1:1/f;++a<d;)(o=l[a]=[]).dx=h[a+1]-(o.x=h[a]),o.y=0;if(d>0)for(a=-1;++a<f;)(s=c[a])>=u[0]&&s<=u[1]&&((o=l[$i.bisect(h,s,1,d)-1]).y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Ln,i=Sn;return t.value=function(e){return arguments.length?(r=e,t):r},t.range=function(e){return arguments.length?(n=_t(e),t):n},t.bins=function(e){return arguments.length?(i="number"==typeof e?function(t){return En(t,e)}:_t(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},$i.layout.pack=function(){function t(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,pn(s,function(t){t.r=+u(t.value)}),pn(s,zn),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;pn(s,function(t){t.r+=h}),pn(s,zn),pn(s,function(t){t.r-=h})}return Rn(s,l/2,c/2,e?1:1/Math.max(2*s.r/l,2*s.r/c)),o}var e,r=$i.layout.hierarchy().sort(Cn),n=0,i=[1,1];return t.size=function(e){return arguments.length?(i=e,t):i},t.radius=function(r){return arguments.length?(e=null==r||"function"==typeof r?r:+r,t):e},t.padding=function(e){return arguments.length?(n=+e,t):n},fn(t,r)},$i.layout.tree=function(){function t(t,l){var c=i.call(this,t,l),u=c[0],h=function(t){var e,r={A:null,children:[t]},n=[r];for(;null!=(e=n.pop());)for(var i,a=e.children,o=0,s=a.length;o<s;++o)n.push((a[o]=i={_:a[o],parent:e,children:(i=a[o].children)&&i.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=i);return r.children[0]}(u);if(pn(h,e),h.parent.m=-h.z,dn(h,r),s)dn(u,n);else{var f=u,d=u,p=u;dn(u,function(t){t.x<f.x&&(f=t),t.x>d.x&&(d=t),t.depth>p.depth&&(p=t)});var m=a(f,d)/2-f.x,g=o[0]/(d.x+a(d,f)/2+m),v=o[1]/(p.depth||1);dn(u,function(t){t.x=(t.x+m)*g,t.y=t.depth*v})}return c}function e(t){var e=t.children,r=t.parent.children,n=t.i?r[t.i-1]:null;if(e.length){!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)}(t);var i=(e[0].z+e[e.length-1].z)/2;n?(t.z=n.z+a(t._,n._),t.m=t.z-i):t.z=i}else n&&(t.z=n.z+a(t._,n._));t.parent.A=function(t,e,r){if(e){for(var n,i=t,o=t,s=e,l=i.parent.children[0],c=i.m,u=o.m,h=s.m,f=l.m;s=Un(s),i=Bn(i),s&&i;)l=Bn(l),(o=Un(o)).a=t,(n=s.z+h-i.z-c+a(s._,i._))>0&&(!function(t,e,r){var n=r/(e.i-t.i);e.c-=n,e.s+=r,t.c+=n,e.z+=r,e.m+=r}(function(t,e,r){return t.a.parent===e.parent?t.a:r}(s,t,r),t,n),c+=n,u+=n),h+=s.m,c+=i.m,f+=l.m,u+=o.m;s&&!Un(o)&&(o.t=s,o.m+=h-u),i&&!Bn(l)&&(l.t=i,l.m+=c-f,r=t)}return r}(t,n,t.parent.A||r[0])}function r(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function n(t){t.x*=o[0],t.y=t.depth*o[1]}var i=$i.layout.hierarchy().sort(null).value(null),a=Nn,o=[1,1],s=null;return t.separation=function(e){return arguments.length?(a=e,t):a},t.size=function(e){return arguments.length?(s=null==(o=e)?n:null,t):s?null:o},t.nodeSize=function(e){return arguments.length?(s=null==(o=e)?null:n,t):s?o:null},fn(t,i)},$i.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],c=0;pn(l,function(t){var e=t.children;e&&e.length?(t.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(e),t.y=function(t){return 1+$i.max(t,function(t){return t.y})}(e)):(t.x=o?c+=r(t,o):0,t.y=0,o=t)});var u=Vn(l),h=Hn(l),f=u.x-r(u,h)/2,d=h.x+r(h,u)/2;return pn(l,i?function(t){t.x=(t.x-l.x)*n[0],t.y=(l.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(d-f)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=$i.layout.hierarchy().sort(null).value(null),r=Nn,n=[1,1],i=!1;return t.separation=function(e){return arguments.length?(r=e,t):r},t.size=function(e){return arguments.length?(i=null==(n=e),t):i?null:n},t.nodeSize=function(e){return arguments.length?(i=null!=(n=e),t):i?n:null},fn(t,e)},$i.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i<a;)n=(r=t[i]).value*(e<0?0:e),r.area=isNaN(n)||n<=0?0:n}function e(r){var i=r.children;if(i&&i.length){var a,o,s,l=u(r),c=[],h=i.slice(),p=1/0,m="slice"===f?l.dx:"dice"===f?l.dy:"slice-dice"===f?1&r.depth?l.dy:l.dx:Math.min(l.dx,l.dy);for(t(h,l.dx*l.dy/r.value),c.area=0;(s=h.length)>0;)c.push(a=h[s-1]),c.area+=a.area,"squarify"!==f||(o=function(t,e){var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;for(;++o<s;)(r=t[o].area)&&(r<a&&(a=r),r>i&&(i=r));return n*=n,e*=e,n?Math.max(e*i*d/n,n/(e*a*d)):1/0}(c,m))<=p?(h.pop(),p=o):(c.area-=c.pop().area,n(c,m,l,!1),m=Math.min(l.dx,l.dy),c.length=c.area=0,p=1/0);c.length&&(n(c,m,l,!0),c.length=c.area=0),i.forEach(e)}}function r(e){var i=e.children;if(i&&i.length){var a,o=u(e),s=i.slice(),l=[];for(t(s,o.dx*o.dy/e.value),l.area=0;a=s.pop();)l.push(a),l.area+=a.area,null!=a.z&&(n(l,a.z?o.dx:o.dy,o,!s.length),l.length=l.area=0);i.forEach(r)}}function n(t,e,r,n){var i,a=-1,o=t.length,l=r.x,c=r.y,u=e?s(t.area/e):0;if(e==r.dx){for((n||u>r.dy)&&(u=r.dy);++a<o;)(i=t[a]).x=l,i.y=c,i.dy=u,l+=i.dx=Math.min(r.x+r.dx-l,u?s(i.area/u):0);i.z=!0,i.dx+=r.x+r.dx-l,r.y+=u,r.dy-=u}else{for((n||u>r.dx)&&(u=r.dx);++a<o;)(i=t[a]).x=l,i.y=c,i.dx=u,c+=i.dy=Math.min(r.y+r.dy-c,u?s(i.area/u):0);i.z=!1,i.dy+=r.y+r.dy-c,r.x+=u,r.dx-=u}}function i(n){var i=a||o(n),s=i[0];return s.x=s.y=0,s.value?(s.dx=l[0],s.dy=l[1]):s.dx=s.dy=0,a&&o.revalue(s),t([s],s.dx*s.dy/s.value),(a?r:e)(s),h&&(a=i),i}var a,o=$i.layout.hierarchy(),s=Math.round,l=[1,1],c=null,u=qn,h=!1,f="squarify",d=.5*(1+Math.sqrt(5));return i.size=function(t){return arguments.length?(l=t,i):l},i.padding=function(t){function e(e){return Gn(e,t)}if(!arguments.length)return c;var r;return u=null==(c=t)?qn:"function"==(r=typeof t)?function(e){var r=t.call(i,e,e.depth);return null==r?qn(e):Gn(e,"number"==typeof r?[r,r,r,r]:r)}:"number"===r?(t=[t,t,t,t],e):e,i},i.round=function(t){return arguments.length?(s=t?Math.round:Number,i):s!=Number},i.sticky=function(t){return arguments.length?(h=t,a=null,i):h},i.ratio=function(t){return arguments.length?(d=t,i):d},i.mode=function(t){return arguments.length?(f=t+"",i):f},fn(i,o)},$i.random={normal:function(t,e){var r=arguments.length;return r<2&&(e=1),r<1&&(t=0),function(){var r,n,i;do{i=(r=2*Math.random()-1)*r+(n=2*Math.random()-1)*n}while(!i||i>1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=$i.random.normal.apply($i,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=$i.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;r<t;r++)e+=Math.random();return e}}},$i.scale={};var fs={floor:y,ceil:y};$i.scale.linear=function(){return Qn([0,1],[0,1],Br,!1)};var ds={s:1,g:1,p:1,r:1,e:1};$i.scale.log=function(){return ai($i.scale.linear().domain([0,1]),10,!0,[1,10])};var ps=$i.format(".0e"),ms={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};$i.scale.pow=function(){return oi($i.scale.linear(),1,[0,1])},$i.scale.sqrt=function(){return $i.scale.pow().exponent(.5)},$i.scale.ordinal=function(){return li([],{t:"range",a:[[]]})},$i.scale.category10=function(){return $i.scale.ordinal().range(gs)},$i.scale.category20=function(){return $i.scale.ordinal().range(vs)},$i.scale.category20b=function(){return $i.scale.ordinal().range(ys)},$i.scale.category20c=function(){return $i.scale.ordinal().range(bs)};var gs=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(pt),vs=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(pt),ys=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(pt),bs=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(pt);$i.scale.quantile=function(){return ci([],[])},$i.scale.quantize=function(){return ui(0,1,[0,1])},$i.scale.threshold=function(){return hi([.5],[0,1])},$i.scale.identity=function(){return fi([0,1])},$i.svg={},$i.svg.arc=function(){function t(){var t=Math.max(0,+r.apply(this,arguments)),c=Math.max(0,+n.apply(this,arguments)),u=o.apply(this,arguments)-Ia,h=s.apply(this,arguments)-Ia,f=Math.abs(h-u),d=u>h?0:1;if(c<t&&(p=c,c=t,t=p),f>=Ca)return e(c,d)+(t?e(t,1-d):"")+"Z";var p,m,g,v,y,b,x,_,w,M,k,T,A=0,S=0,E=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===xs?Math.sqrt(t*t+c*c):+a.apply(this,arguments),d||(S*=-1),c&&(S=Q(g/c*Math.sin(v))),t&&(A=Q(g/t*Math.sin(v)))),c){y=c*Math.cos(u+S),b=c*Math.sin(u+S),x=c*Math.cos(h-S),_=c*Math.sin(h-S);var L=Math.abs(h-u-2*S)<=Ea?0:1;if(S&&bi(y,b,x,_)===d^L){var C=(u+h)/2;y=c*Math.cos(C),b=c*Math.sin(C),x=_=null}}else y=b=0;if(t){w=t*Math.cos(h-A),M=t*Math.sin(h-A),k=t*Math.cos(u+A),T=t*Math.sin(u+A);var I=Math.abs(u-h+2*A)<=Ea?0:1;if(A&&bi(w,M,k,T)===1-d^I){var P=(u+h)/2;w=t*Math.cos(P),M=t*Math.sin(P),k=T=null}}else w=M=0;if(f>Aa&&(p=Math.min(Math.abs(c-t)/2,+i.apply(this,arguments)))>.001){m=t<c^d?0:1;var D=p,z=p;if(f<Ea){var O=null==k?[w,M]:null==x?[y,b]:ur([y,b],[k,T],[x,_],[w,M]),F=y-O[0],R=b-O[1],j=x-O[0],N=_-O[1],B=1/Math.sin(Math.acos((F*j+R*N)/(Math.sqrt(F*F+R*R)*Math.sqrt(j*j+N*N)))/2),U=Math.sqrt(O[0]*O[0]+O[1]*O[1]);z=Math.min(p,(t-U)/(B-1)),D=Math.min(p,(c-U)/(B+1))}if(null!=x){var V=xi(null==k?[w,M]:[k,T],[y,b],c,D,d),H=xi([x,_],[w,M],c,D,d);p===D?E.push("M",V[0],"A",D,",",D," 0 0,",m," ",V[1],"A",c,",",c," 0 ",1-d^bi(V[1][0],V[1][1],H[1][0],H[1][1]),",",d," ",H[1],"A",D,",",D," 0 0,",m," ",H[0]):E.push("M",V[0],"A",D,",",D," 0 1,",m," ",H[0])}else E.push("M",y,",",b);if(null!=k){var q=xi([y,b],[k,T],t,-z,d),G=xi([w,M],null==x?[y,b]:[x,_],t,-z,d);p===z?E.push("L",G[0],"A",z,",",z," 0 0,",m," ",G[1],"A",t,",",t," 0 ",d^bi(G[1][0],G[1][1],q[1][0],q[1][1]),",",1-d," ",q[1],"A",z,",",z," 0 0,",m," ",q[0]):E.push("L",G[0],"A",z,",",z," 0 0,",m," ",q[0])}else E.push("L",w,",",M)}else E.push("M",y,",",b),null!=x&&E.push("A",c,",",c," 0 ",L,",",d," ",x,",",_),E.push("L",w,",",M),null!=k&&E.push("A",t,",",t," 0 ",I,",",1-d," ",k,",",T);return E.push("Z"),E.join("")}function e(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}var r=pi,n=mi,i=di,a=xs,o=gi,s=vi,l=yi;return t.innerRadius=function(e){return arguments.length?(r=_t(e),t):r},t.outerRadius=function(e){return arguments.length?(n=_t(e),t):n},t.cornerRadius=function(e){return arguments.length?(i=_t(e),t):i},t.padRadius=function(e){return arguments.length?(a=e==xs?xs:_t(e),t):a},t.startAngle=function(e){return arguments.length?(o=_t(e),t):o},t.endAngle=function(e){return arguments.length?(s=_t(e),t):s},t.padAngle=function(e){return arguments.length?(l=_t(e),t):l},t.centroid=function(){var t=(+r.apply(this,arguments)+ +n.apply(this,arguments))/2,e=(+o.apply(this,arguments)+ +s.apply(this,arguments))/2-Ia;return[Math.cos(e)*t,Math.sin(e)*t]},t};var xs="auto";$i.svg.line=function(){return _i(y)};var _s=$i.map({linear:wi,"linear-closed":Mi,step:function(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e<r;)i.push("H",(n[0]+(n=t[e])[0])/2,"V",n[1]);return r>1&&i.push("H",n[0]),i.join("")},"step-before":ki,"step-after":Ti,basis:Ei,"basis-open":function(t){if(t.length<4)return wi(t);for(var e,r=[],n=-1,i=t.length,a=[0],o=[0];++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);for(r.push(Li(ks,a)+","+Li(ks,o)),--n;++n<i;)e=t[n],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),Ci(r,a,o);return r.join("")},"basis-closed":function(t){for(var e,r,n=-1,i=t.length,a=i+4,o=[],s=[];++n<4;)r=t[n%i],o.push(r[0]),s.push(r[1]);for(e=[Li(ks,o),",",Li(ks,s)],--n;++n<a;)r=t[n%i],o.shift(),o.push(r[0]),s.shift(),s.push(r[1]),Ci(e,o,s);return e.join("")},bundle:function(t,e){var r=t.length-1;if(r)for(var n,i,a=t[0][0],o=t[0][1],s=t[r][0]-a,l=t[r][1]-o,c=-1;++c<=r;)i=c/r,(n=t[c])[0]=e*n[0]+(1-e)*(a+i*s),n[1]=e*n[1]+(1-e)*(o+i*l);return Ei(t)},cardinal:function(t,e){return t.length<3?wi(t):t[0]+Ai(t,Si(t,e))},"cardinal-open":function(t,e){return t.length<4?wi(t):t[1]+Ai(t.slice(1,-1),Si(t,e))},"cardinal-closed":function(t,e){return t.length<3?Mi(t):t[0]+Ai((t.push(t[0]),t),Si([t[t.length-2]].concat(t,[t[1]]),e))},monotone:function(t){return t.length<3?wi(t):t[0]+Ai(t,Pi(t))}});_s.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var ws=[0,2/3,1/3,0],Ms=[0,1/3,2/3,0],ks=[0,1/6,2/3,1/6];$i.svg.line.radial=function(){var t=_i(Di);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},ki.reverse=Ti,Ti.reverse=ki,$i.svg.area=function(){return zi(y)},$i.svg.area.radial=function(){var t=zi(Di);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},$i.svg.chord=function(){function t(t,o){var s=e(this,i,t,o),l=e(this,a,t,o);return"M"+s.p0+r(s.r,s.p1,s.a1-s.a0)+(function(t,e){return t.a0==e.a0&&t.a1==e.a1}(s,l)?n(s.r,s.p1,s.r,s.p0):n(s.r,s.p1,l.r,l.p0)+r(l.r,l.p1,l.a1-l.a0)+n(l.r,l.p1,s.r,s.p0))+"Z"}function e(t,e,r,n){var i=e.call(t,r,n),a=o.call(t,i,n),c=s.call(t,i,n)-Ia,u=l.call(t,i,n)-Ia;return{r:a,a0:c,a1:u,p0:[a*Math.cos(c),a*Math.sin(c)],p1:[a*Math.cos(u),a*Math.sin(u)]}}function r(t,e,r){return"A"+t+","+t+" 0 "+ +(r>Ea)+",1 "+e}function n(t,e,r,n){return"Q 0,0 "+n}var i=Ke,a=Qe,o=Oi,s=gi,l=vi;return t.radius=function(e){return arguments.length?(o=_t(e),t):o},t.source=function(e){return arguments.length?(i=_t(e),t):i},t.target=function(e){return arguments.length?(a=_t(e),t):a},t.startAngle=function(e){return arguments.length?(s=_t(e),t):s},t.endAngle=function(e){return arguments.length?(l=_t(e),t):l},t},$i.svg.diagonal=function(){function t(t,i){var a=e.call(this,t,i),o=r.call(this,t,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(n))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}var e=Ke,r=Qe,n=Fi;return t.source=function(r){return arguments.length?(e=_t(r),t):e},t.target=function(e){return arguments.length?(r=_t(e),t):r},t.projection=function(e){return arguments.length?(n=e,t):n},t},$i.svg.diagonal.radial=function(){var t=$i.svg.diagonal(),e=Fi,r=t.projection;return t.projection=function(t){return arguments.length?r(function(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Ia;return[r*Math.cos(n),r*Math.sin(n)]}}(e=t)):e},t},$i.svg.symbol=function(){function t(t,n){return(Ts.get(e.call(this,t,n))||Ni)(r.call(this,t,n))}var e=ji,r=Ri;return t.type=function(r){return arguments.length?(e=_t(r),t):e},t.size=function(e){return arguments.length?(r=_t(e),t):r},t};var Ts=$i.map({circle:Ni,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*Ss)),r=e*Ss;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/As),r=e*As/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/As),r=e*As/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});$i.svg.symbolTypes=Ts.keys();var As=Math.sqrt(3),Ss=Math.tan(30*Pa);ya.transition=function(t){for(var e,r,n=Es||++Ps,i=qi(t),a=[],o=Ls||{time:Date.now(),ease:function(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)},delay:0,duration:250},s=-1,l=this.length;++s<l;){a.push(e=[]);for(var c=this[s],u=-1,h=c.length;++u<h;)(r=c[u])&&Gi(r,u,i,n,o),e.push(r)}return Ui(a,i,n)},ya.interrupt=function(t){return this.each(null==t?Cs:Bi(qi(t)))};var Es,Ls,Cs=Bi(qi()),Is=[],Ps=0;Is.call=ya.call,Is.empty=ya.empty,Is.node=ya.node,Is.size=ya.size,$i.transition=function(t,e){return t&&t.transition?Es?t.transition(e):t:$i.selection().transition(t)},$i.transition.prototype=Is,Is.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=S(t);for(var s=-1,l=this.length;++s<l;){o.push(e=[]);for(var c=this[s],u=-1,h=c.length;++u<h;)(n=c[u])&&(r=t.call(n,n.__data__,u,s))?("__data__"in n&&(r.__data__=n.__data__),Gi(r,u,a,i,n[a][i]),e.push(r)):e.push(null)}return Ui(o,a,i)},Is.selectAll=function(t){var e,r,n,i,a,o=this.id,s=this.namespace,l=[];t=E(t);for(var c=-1,u=this.length;++c<u;)for(var h=this[c],f=-1,d=h.length;++f<d;)if(n=h[f]){a=n[s][o],r=t.call(n,n.__data__,f,c),l.push(e=[]);for(var p=-1,m=r.length;++p<m;)(i=r[p])&&Gi(i,p,s,o,a),e.push(i)}return Ui(l,s,o)},Is.filter=function(t){var e,r,n=[];"function"!=typeof t&&(t=B(t));for(var i=0,a=this.length;i<a;i++){n.push(e=[]);for(var o,s=0,l=(o=this[i]).length;s<l;s++)(r=o[s])&&t.call(r,r.__data__,s,i)&&e.push(r)}return Ui(n,this.namespace,this.id)},Is.tween=function(t,e){var r=this.id,n=this.namespace;return arguments.length<2?this.node()[n][r].tween.get(t):U(this,null==e?function(e){e[n][r].tween.remove(t)}:function(i){i[n][r].tween.set(t,e)})},Is.attr=function(t,e){function r(){this.removeAttribute(a)}function n(){this.removeAttributeNS(a.space,a.local)}if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var i="transform"==t?en:Br,a=$i.ns.qualify(t);return Vi(this,"attr."+t,e,a.local?function(t){return null==t?n:(t+="",function(){var e,r=this.getAttributeNS(a.space,a.local);return r!==t&&(e=i(r,t),function(t){this.setAttributeNS(a.space,a.local,e(t))})})}:function(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(a);return r!==t&&(e=i(r,t),function(t){this.setAttribute(a,e(t))})})})},Is.attrTween=function(t,e){var r=$i.ns.qualify(t);return this.tween("attr."+t,r.local?function(t,n){var i=e.call(this,t,n,this.getAttributeNS(r.space,r.local));return i&&function(t){this.setAttributeNS(r.space,r.local,i(t))}}:function(t,n){var i=e.call(this,t,n,this.getAttribute(r));return i&&function(t){this.setAttribute(r,i(t))}})},Is.style=function(t,e,n){function i(){this.style.removeProperty(t)}var a=arguments.length;if(a<3){if("string"!=typeof t){a<2&&(e="");for(n in t)this.style(n,t[n],e);return this}n=""}return Vi(this,"style."+t,e,function(e){return null==e?i:(e+="",function(){var i,a=r(this).getComputedStyle(this,null).getPropertyValue(t);return a!==e&&(i=Br(a,e),function(e){this.style.setProperty(t,i(e),n)})})})},Is.styleTween=function(t,e,n){return arguments.length<3&&(n=""),this.tween("style."+t,function(i,a){var o=e.call(this,i,a,r(this).getComputedStyle(this,null).getPropertyValue(t));return o&&function(e){this.style.setProperty(t,o(e),n)}})},Is.text=function(t){return Vi(this,"text",t,Hi)},Is.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},Is.ease=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].ease:("function"!=typeof t&&(t=$i.ease.apply($i,arguments)),U(this,function(n){n[r][e].ease=t}))},Is.delay=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].delay:U(this,"function"==typeof t?function(n,i,a){n[r][e].delay=+t.call(n,n.__data__,i,a)}:(t=+t,function(n){n[r][e].delay=t}))},Is.duration=function(t){var e=this.id,r=this.namespace;return arguments.length<1?this.node()[r][e].duration:U(this,"function"==typeof t?function(n,i,a){n[r][e].duration=Math.max(1,t.call(n,n.__data__,i,a))}:(t=Math.max(1,t),function(n){n[r][e].duration=t}))},Is.each=function(t,e){var r=this.id,n=this.namespace;if(arguments.length<2){var i=Ls,a=Es;try{Es=r,U(this,function(e,i,a){Ls=e[n][r],t.call(e,e.__data__,i,a)})}finally{Ls=i,Es=a}}else U(this,function(i){var a=i[n][r];(a.event||(a.event=$i.dispatch("start","end","interrupt"))).on(t,e)});return this},Is.transition=function(){for(var t,e,r,n=this.id,i=++Ps,a=this.namespace,o=[],s=0,l=this.length;s<l;s++){o.push(t=[]);for(var c,u=0,h=(c=this[s]).length;u<h;u++)(e=c[u])&&Gi(e,u,a,i,{time:(r=e[a][n]).time,ease:r.ease,delay:r.delay+r.duration,duration:r.duration}),t.push(e)}return Ui(o,a,i)},$i.svg.axis=function(){function t(t){t.each(function(){var t,c=$i.select(this),u=this.__chart__||r,h=this.__chart__=r.copy(),f=null==l?h.ticks?h.ticks.apply(h,s):h.domain():l,d=null==e?h.tickFormat?h.tickFormat.apply(h,s):y:e,p=c.selectAll(".tick").data(f,h),m=p.enter().insert("g",".domain").attr("class","tick").style("opacity",Aa),g=$i.transition(p.exit()).style("opacity",Aa).remove(),v=$i.transition(p.order()).style("opacity",1),b=Math.max(i,0)+o,x=Wn(h),_=c.selectAll(".domain").data([0]),w=(_.enter().append("path").attr("class","domain"),$i.transition(_));m.append("line"),m.append("text");var M,k,T,A,S=m.select("line"),E=v.select("line"),L=p.select("text").text(d),C=m.select("text"),I=v.select("text"),P="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(t=Yi,M="x",T="y",k="x2",A="y2",L.attr("dy",P<0?"0em":".71em").style("text-anchor","middle"),w.attr("d","M"+x[0]+","+P*a+"V0H"+x[1]+"V"+P*a)):(t=Wi,M="y",T="x",k="y2",A="x2",L.attr("dy",".32em").style("text-anchor",P<0?"end":"start"),w.attr("d","M"+P*a+","+x[0]+"H0V"+x[1]+"H"+P*a)),S.attr(A,P*i),C.attr(T,P*b),E.attr(k,0).attr(A,P*i),I.attr(M,0).attr(T,P*b),h.rangeBand){var D=h,z=D.rangeBand()/2;u=h=function(t){return D(t)+z}}else u.rangeBand?u=h:g.call(t,h,u);m.call(t,u,h),v.call(t,h,h)})}var e,r=$i.scale.linear(),n=Ds,i=6,a=6,o=3,s=[10],l=null;return t.scale=function(e){return arguments.length?(r=e,t):r},t.orient=function(e){return arguments.length?(n=e in zs?e+"":Ds,t):n},t.ticks=function(){return arguments.length?(s=ea(arguments),t):s},t.tickValues=function(e){return arguments.length?(l=e,t):l},t.tickFormat=function(r){return arguments.length?(e=r,t):e},t.tickSize=function(e){var r=arguments.length;return r?(i=+e,a=+arguments[r-1],t):i},t.innerTickSize=function(e){return arguments.length?(i=+e,t):i},t.outerTickSize=function(e){return arguments.length?(a=+e,t):a},t.tickPadding=function(e){return arguments.length?(o=+e,t):o},t.tickSubdivide=function(){return arguments.length&&t},t};var Ds="bottom",zs={top:1,right:1,bottom:1,left:1};$i.svg.brush=function(){function t(r){r.each(function(){var r=$i.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",a).on("touchstart.brush",a),o=r.selectAll(".background").data([0]);o.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),r.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var s=r.selectAll(".resize").data(m,y);s.exit().remove(),s.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Os[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),s.style("display",t.empty()?"none":null);var l,h=$i.transition(r),f=$i.transition(o);c&&(l=Wn(c),f.attr("x",l[0]).attr("width",l[1]-l[0]),n(h)),u&&(l=Wn(u),f.attr("y",l[0]).attr("height",l[1]-l[0]),i(h)),e(h)})}function e(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+h[+/e$/.test(t)]+","+f[+/^s/.test(t)]+")"})}function n(t){t.select(".extent").attr("x",h[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",h[1]-h[0])}function i(t){t.select(".extent").attr("y",f[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",f[1]-f[0])}function a(){function a(){var t=$i.mouse(b),r=!1;y&&(t[0]+=y[0],t[1]+=y[1]),S||($i.event.altKey?(v||(v=[(h[0]+h[1])/2,(f[0]+f[1])/2]),L[0]=h[+(t[0]<v[0])],L[1]=f[+(t[1]<v[1])]):v=null),T&&m(t,c,0)&&(n(w),r=!0),A&&m(t,u,1)&&(i(w),r=!0),r&&(e(w),_({type:"brush",mode:S?"move":"resize"}))}function m(t,e,r){var n,i,a=Wn(e),l=a[0],c=a[1],u=L[r],m=r?f:h,g=m[1]-m[0];if(S&&(l-=u,c-=g+u),n=(r?p:d)?Math.max(l,Math.min(c,t[r])):t[r],S?i=(n+=u)+g:(v&&(u=Math.max(l,Math.min(c,2*v[r]-n))),u<n?(i=n,n=u):i=u),m[0]!=n||m[1]!=i)return r?s=null:o=null,m[0]=n,m[1]=i,!0}function g(){a(),w.style("pointer-events","all").selectAll(".resize").style("display",t.empty()?"none":null),$i.select("body").style("cursor",null),C.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),E(),_({type:"brushend"})}var v,y,b=this,x=$i.select($i.event.target),_=l.of(b,arguments),w=$i.select(b),k=x.datum(),T=!/^(n|s)$/.test(k)&&c,A=!/^(e|w)$/.test(k)&&u,S=x.classed("extent"),E=Y(b),L=$i.mouse(b),C=$i.select(r(b)).on("keydown.brush",function(){32==$i.event.keyCode&&(S||(v=null,L[0]-=h[1],L[1]-=f[1],S=2),M())}).on("keyup.brush",function(){32==$i.event.keyCode&&2==S&&(L[0]+=h[1],L[1]+=f[1],S=0,M())});if($i.event.changedTouches?C.on("touchmove.brush",a).on("touchend.brush",g):C.on("mousemove.brush",a).on("mouseup.brush",g),w.interrupt().selectAll("*").interrupt(),S)L[0]=h[0]-L[0],L[1]=f[0]-L[1];else if(k){var I=+/w$/.test(k),P=+/^n/.test(k);y=[h[1-I]-L[0],f[1-P]-L[1]],L[0]=h[I],L[1]=f[P]}else $i.event.altKey&&(v=L.slice());w.style("pointer-events","none").selectAll(".resize").style("display",null),$i.select("body").style("cursor",x.style("cursor")),_({type:"brushstart"}),a()}var o,s,l=T(t,"brushstart","brush","brushend"),c=null,u=null,h=[0,0],f=[0,0],d=!0,p=!0,m=Fs[0];return t.event=function(t){t.each(function(){var t=l.of(this,arguments),e={x:h,y:f,i:o,j:s},r=this.__chart__||e;this.__chart__=e,Es?$i.select(this).transition().each("start.brush",function(){o=r.i,s=r.j,h=r.x,f=r.y,t({type:"brushstart"})}).tween("brush:brush",function(){var r=Ur(h,e.x),n=Ur(f,e.y);return o=s=null,function(i){h=e.x=r(i),f=e.y=n(i),t({type:"brush",mode:"resize"})}}).each("end.brush",function(){o=e.i,s=e.j,t({type:"brush",mode:"resize"}),t({type:"brushend"})}):(t({type:"brushstart"}),t({type:"brush",mode:"resize"}),t({type:"brushend"}))})},t.x=function(e){return arguments.length?(c=e,m=Fs[!c<<1|!u],t):c},t.y=function(e){return arguments.length?(u=e,m=Fs[!c<<1|!u],t):u},t.clamp=function(e){return arguments.length?(c&&u?(d=!!e[0],p=!!e[1]):c?d=!!e:u&&(p=!!e),t):c&&u?[d,p]:c?d:u?p:null},t.extent=function(e){var r,n,i,a,l;return arguments.length?(c&&(r=e[0],n=e[1],u&&(r=r[0],n=n[0]),o=[r,n],c.invert&&(r=c(r),n=c(n)),n<r&&(l=r,r=n,n=l),r==h[0]&&n==h[1]||(h=[r,n])),u&&(i=e[0],a=e[1],c&&(i=i[1],a=a[1]),s=[i,a],u.invert&&(i=u(i),a=u(a)),a<i&&(l=i,i=a,a=l),i==f[0]&&a==f[1]||(f=[i,a])),t):(c&&(o?(r=o[0],n=o[1]):(r=h[0],n=h[1],c.invert&&(r=c.invert(r),n=c.invert(n)),n<r&&(l=r,r=n,n=l))),u&&(s?(i=s[0],a=s[1]):(i=f[0],a=f[1],u.invert&&(i=u.invert(i),a=u.invert(a)),a<i&&(l=i,i=a,a=l))),c&&u?[[r,i],[n,a]]:c?[r,n]:u&&[i,a])},t.clear=function(){return t.empty()||(h=[0,0],f=[0,0],o=s=null),t},t.empty=function(){return!!c&&h[0]==h[1]||!!u&&f[0]==f[1]},$i.rebind(t,l,"on")};var Os={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Fs=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Rs=eo.format=so.timeFormat,js=Rs.utc,Ns=js("%Y-%m-%dT%H:%M:%S.%LZ");Rs.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Xi:Ns,Xi.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Xi.toString=Ns.toString,eo.second=Ct(function(t){return new ro(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),eo.seconds=eo.second.range,eo.seconds.utc=eo.second.utc.range,eo.minute=Ct(function(t){return new ro(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),eo.minutes=eo.minute.range,eo.minutes.utc=eo.minute.utc.range,eo.hour=Ct(function(t){var e=t.getTimezoneOffset()/60;return new ro(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),eo.hours=eo.hour.range,eo.hours.utc=eo.hour.utc.range,eo.month=Ct(function(t){return(t=eo.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),eo.months=eo.month.range,eo.months.utc=eo.month.utc.range;var Bs=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Us=[[eo.second,1],[eo.second,5],[eo.second,15],[eo.second,30],[eo.minute,1],[eo.minute,5],[eo.minute,15],[eo.minute,30],[eo.hour,1],[eo.hour,3],[eo.hour,6],[eo.hour,12],[eo.day,1],[eo.day,2],[eo.week,1],[eo.month,1],[eo.month,3],[eo.year,1]],Vs=Rs.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",ve]]),Hs={range:function(t,e,r){return $i.range(Math.ceil(t/r)*r,+e,r).map(Ji)},floor:y,ceil:y};Us.year=eo.year,eo.scale=function(){return Zi($i.scale.linear(),Us,Vs)};var qs=Us.map(function(t){return[t[0].utc,t[1]]}),Gs=js.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",ve]]);qs.year=eo.year.utc,eo.scale.utc=function(){return Zi($i.scale.linear(),qs,Gs)},$i.text=wt(function(t){return t.responseText}),$i.json=function(t,e){return Mt(t,"application/json",Ki,e)},$i.html=function(t,e){return Mt(t,"text/html",Qi,e)},$i.xml=wt(function(t){return t.responseXML}),"object"==typeof e&&e.exports?e.exports=$i:this.d3=$i}()},{}],124:[function(t,e,r){"use strict";function n(t,e){this.point=t,this.index=e}function i(t,e){for(var r=t.point,n=e.point,i=r.length,a=0;a<i;++a){var o=n[a]-r[a];if(o)return o}return 0}var a=t("incremental-convex-hull"),o=t("uniq");e.exports=function(t,e){var r=t.length;if(0===r)return[];var s=t[0].length;if(s<1)return[];if(1===s)return function(t,e,r){if(1===t)return r?[[-1,0]]:[];var n=e.map(function(t,e){return[t[0],e]});n.sort(function(t,e){return t[0]-e[0]});for(var i=new Array(t-1),a=1;a<t;++a){var o=n[a-1],s=n[a];i[a-1]=[o[1],s[1]]}return r&&i.push([-1,i[0][1]],[i[t-1][1],-1]),i}(r,t,e);for(var l=new Array(r),c=1,u=0;u<r;++u){for(var h=t[u],f=new Array(s+1),d=0,p=0;p<s;++p){var m=h[p];f[p]=m,d+=m*m}f[s]=d,l[u]=new n(f,u),c=Math.max(d,c)}o(l,i),r=l.length;var g=new Array(r+s+1),v=new Array(r+s+1),y=(s+1)*(s+1)*c,b=new Array(s+1);for(u=0;u<=s;++u)b[u]=0;for(b[s]=y,g[0]=b.slice(),v[0]=-1,u=0;u<=s;++u)(f=b.slice())[u]=1,g[u+1]=f,v[u+1]=-1;for(u=0;u<r;++u){var x=l[u];g[u+s+1]=x.point,v[u+s+1]=x.index}var _=a(g,!1);if(_=e?_.filter(function(t){for(var e=0,r=0;r<=s;++r){var n=v[t[r]];if(n<0&&++e>=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}),1&s)for(u=0;u<_.length;++u)f=(x=_[u])[0],x[0]=x[1],x[1]=f;return _}},{"incremental-convex-hull":291,uniq:552}],125:[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]]};function a(t,e){return i[0]=t,i[1]=e,n[0]}e.exports.pack=a;function o(t){return n[0]=t,i[0]}e.exports.lo=o;function s(t){return n[0]=t,i[1]}e.exports.hi=s}else if(1072693248===i[0]){e.exports=function(t){return n[0]=t,[i[1],i[0]]};function l(t,e){return i[1]=t,i[0]=e,n[0]}e.exports.pack=l;function c(t){return n[0]=t,i[1]}e.exports.lo=c;function u(t){return n[0]=t,i[0]}e.exports.hi=u}else r=!1}if(!r){var h=new t(8);e.exports=function(t){return h.writeDoubleLE(t,0,!0),[h.readUInt32LE(0,!0),h.readUInt32LE(4,!0)]};function f(t,e){return h.writeUInt32LE(t,0,!0),h.writeUInt32LE(e,4,!0),h.readDoubleLE(0,!0)}e.exports.pack=f;function d(t){return h.writeDoubleLE(t,0,!0),h.readUInt32LE(0,!0)}e.exports.lo=d;function p(t){return h.writeDoubleLE(t,0,!0),h.readUInt32LE(4,!0)}e.exports.hi=p}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:78}],126:[function(t,e,r){"use strict";function n(t,e,r){var i=0|t[r];if(i<=0)return[];var a,o=new Array(i);if(r===t.length-1)for(a=0;a<i;++a)o[a]=e;else for(a=0;a<i;++a)o[a]=n(t,e,r+1);return o}e.exports=function(t,e){switch(void 0===e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n<t;++n)r[n]=e;return r}(0|t,e);break;case"object":if("number"==typeof t.length)return n(t,e,0)}return[]}},{}],127:[function(t,e,r){"use strict";function n(t,e,r){r=r||2;var n=e&&e.length,l=n?e[0]*r:t.length,u=i(t,0,l,r,!0),h=[];if(!u)return h;var f,m,g,v,y,b,x;if(n&&(u=function(t,e,r,n){var o,l,u,h,f,m=[];for(o=0,l=e.length;o<l;o++)u=e[o]*n,h=o<l-1?e[o+1]*n:t.length,(f=i(t,u,h,n,!1))===f.next&&(f.steiner=!0),m.push(function(t){var e=t,r=t;do{e.x<r.x&&(r=e),e=e.next}while(e!==t);return r}(f));for(m.sort(s),o=0;o<m.length;o++)!function(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){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.next.x?n:n.next}}n=n.next}while(n!==e);if(!r)return null;if(i===o)return r.prev;var l,u=r,h=r.x,f=r.y,p=1/0;for(n=r.next;n!==u;)i>=n.x&&n.x>=h&&c(a<f?i:o,a,h,f,a<f?o:i,a,n.x,n.y)&&((l=Math.abs(a-n.y)/(i-n.x))<p||l===p&&n.x>r.x)&&d(n,t)&&(r=n,p=l),n=n.next;return r}(t,e)){var r=p(e,t);a(r,r.next)}}(m[o],r),r=a(r,r.next);return r}(t,e,u,r)),t.length>80*r){f=g=t[0],m=v=t[1];for(var _=r;_<l;_+=r)y=t[_],b=t[_+1],y<f&&(f=y),b<m&&(m=b),y>g&&(g=y),b>v&&(v=b);x=Math.max(g-f,v-m)}return o(u,h,r,f,m,x),h}function i(t,e,r,n,i){var a,o;if(i===y(t,e,r,n)>0)for(a=e;a<r;a+=n)o=m(a,t[a],t[a+1],o);else for(a=r-n;a>=e;a-=n)o=m(a,t[a],t[a+1],o);return o&&h(o,o.next)&&(g(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||!h(n,n.next)&&0!==u(n.prev,n,n.next))n=n.next;else{if(g(n),(n=e=n.prev)===n.next)return null;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,s,m){if(t){!m&&s&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=l(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;e<c&&(s++,n=n.nextZ);e++);for(l=c;s>0||l>0&&n;)0===s?(i=n,n=n.nextZ,l--):0!==l&&n?r.z<=n.z?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--):(i=r,r=r.nextZ,s--),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,s);for(var v,y,b=t;t.prev!==t.next;)if(v=t.prev,y=t.next,s?function(t,e,r,n){var i=t.prev,a=t,o=t.next;if(u(i,a,o)>=0)return!1;var s=i.x<a.x?i.x<o.x?i.x:o.x:a.x<o.x?a.x:o.x,h=i.y<a.y?i.y<o.y?i.y:o.y:a.y<o.y?a.y:o.y,f=i.x>a.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,d=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,p=l(s,h,e,r,n),m=l(f,d,e,r,n),g=t.nextZ;for(;g&&g.z<=m;){if(g!==t.prev&&g!==t.next&&c(i.x,i.y,a.x,a.y,o.x,o.y,g.x,g.y)&&u(g.prev,g,g.next)>=0)return!1;g=g.nextZ}g=t.prevZ;for(;g&&g.z>=p;){if(g!==t.prev&&g!==t.next&&c(i.x,i.y,a.x,a.y,o.x,o.y,g.x,g.y)&&u(g.prev,g,g.next)>=0)return!1;g=g.prevZ}return!0}(t,n,i,s):function(t){var e=t.prev,r=t,n=t.next;if(u(e,r,n)>=0)return!1;var i=t.next.next;for(;i!==t.prev;){if(c(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&u(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}(t))e.push(v.i/r),e.push(t.i/r),e.push(y.i/r),g(t),t=y.next,b=y.next;else if((t=y)===b){m?1===m?o(t=function(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!h(i,a)&&f(i,n,n.next,a)&&d(i,a)&&d(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),g(n),g(n.next),n=t=a),n=n.next}while(n!==t);return n}(t,e,r),e,r,n,i,s,2):2===m&&function(t,e,r,n,i,s){var l=t;do{for(var c=l.next.next;c!==l.prev;){if(l.i!==c.i&&function(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&&f(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&d(t,e)&&d(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&&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)}(l,c)){var u=p(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)}(t,e,r,n,i,s):o(a(t),e,r,n,i,s,1);break}}}function s(t,e){return t.x-e.x}function l(t,e,r,n,i){return t=32767*(t-r)/i,e=32767*(e-n)/i,t=16711935&(t|t<<8),t=252645135&(t|t<<4),t=858993459&(t|t<<2),t=1431655765&(t|t<<1),e=16711935&(e|e<<8),e=252645135&(e|e<<4),e=858993459&(e|e<<2),e=1431655765&(e|e<<1),t|e<<1}function c(t,e,r,n,i,a,o,s){return(i-o)*(e-s)-(t-o)*(a-s)>=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function u(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function h(t,e){return t.x===e.x&&t.y===e.y}function f(t,e,r,n){return!!(h(t,e)&&h(r,n)||h(t,n)&&h(r,e))||u(t,e,r)>0!=u(t,e,n)>0&&u(r,n,t)>0!=u(r,n,e)>0}function d(t,e){return u(t.prev,t,t.next)<0?u(t,e,t.next)>=0&&u(t,t.prev,e)>=0:u(t,e,t.prev)<0||u(t,t.next,e)<0}function p(t,e){var r=new v(t.i,t.x,t.y),n=new v(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 v(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 g(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 v(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 y(t,e,r,n){for(var i=0,a=e,o=r-n;a<r;a+=n)i+=(t[o]-t[a])*(t[a+1]+t[o+1]),o=a;return i}e.exports=n,n.deviation=function(t,e,r,n){var i=e&&e.length,a=i?e[0]*r:t.length,o=Math.abs(y(t,0,a,r));if(i)for(var s=0,l=e.length;s<l;s++){var c=e[s]*r,u=s<l-1?e[s+1]*r:t.length;o-=Math.abs(y(t,c,u,r))}var h=0;for(s=0;s<n.length;s+=3){var f=n[s]*r,d=n[s+1]*r,p=n[s+2]*r;h+=Math.abs((t[f]-t[p])*(t[d+1]-t[f+1])-(t[f]-t[d])*(t[p+1]-t[f+1]))}return 0===o&&0===h?0:Math.abs((h-o)/o)},n.flatten=function(t){for(var e=t[0][0].length,r={vertices:[],holes:[],dimensions:e},n=0,i=0;i<t.length;i++){for(var a=0;a<t[i].length;a++)for(var o=0;o<e;o++)r.vertices.push(t[i][a][o]);i>0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],128:[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<r;++i){var a=t[i];e=Math.max(e,a[0],a[1])}e=1+(0|e)}e|=0;var o=new Array(e);for(i=0;i<e;++i)o[i]=[];for(i=0;i<r;++i)o[(a=t[i])[0]].push(a[1]),o[a[1]].push(a[0]);for(var s=0;s<e;++s)n(o[s],function(t,e){return t-e});return o};var n=t("uniq")},{uniq:552}],129:[function(t,e,r){(function(n,i){!function(t,n){"object"==typeof r&&void 0!==e?e.exports=n():t.ES6Promise=n()}(this,function(){"use strict";function e(t){return"function"==typeof t}function r(){var t=setTimeout;return function(){return t(a,1)}}function a(){for(var t=0;t<T;t+=2){(0,z[t])(z[t+1]),z[t]=void 0,z[t+1]=void 0}T=0}function o(){try{var e=t("vertx");return A=e.runOnLoop||e.runOnContext,function(){A(a)}}catch(t){return r()}}function s(t,e){var r=arguments,n=this,i=new this.constructor(c);void 0===i[F]&&x(i);var a=n._state;return a?function(){var t=r[a-1];E(function(){return b(a,i,t,n._result)})}():g(n,i,t,e),i}function l(t){if(t&&"object"==typeof t&&t.constructor===this)return t;var e=new this(c);return f(e,t),e}function c(){}function u(t){try{return t.then}catch(t){return B.error=t,B}}function h(t,r,n){r.constructor===t.constructor&&n===s&&r.constructor.resolve===l?function(t,e){e._state===j?p(t,e._result):e._state===N?m(t,e._result):g(e,void 0,function(e){return f(t,e)},function(e){return m(t,e)})}(t,r):n===B?m(t,B.error):void 0===n?p(t,r):e(n)?function(t,e,r){E(function(t){var n=!1,i=function(t,e,r,n){try{t.call(e,r,n)}catch(t){return t}}(r,e,function(r){n||(n=!0,e!==r?f(t,r):p(t,r))},function(e){n||(n=!0,m(t,e))},t._label);!n&&i&&(n=!0,m(t,i))},t)}(t,r,n):p(t,r)}function f(t,e){t===e?m(t,new TypeError("You cannot resolve a promise with itself")):!function(t){return"function"==typeof t||"object"==typeof t&&null!==t}(e)?p(t,e):h(t,e,u(e))}function d(t){t._onerror&&t._onerror(t._result),v(t)}function p(t,e){t._state===R&&(t._result=e,t._state=j,0!==t._subscribers.length&&E(v,t))}function m(t,e){t._state===R&&(t._state=N,t._result=e,E(d,t))}function g(t,e,r,n){var i=t._subscribers,a=i.length;t._onerror=null,i[a]=e,i[a+j]=r,i[a+N]=n,0===a&&t._state&&E(v,t)}function v(t){var e=t._subscribers,r=t._state;if(0!==e.length){for(var n=void 0,i=void 0,a=t._result,o=0;o<e.length;o+=3)n=e[o],i=e[o+r],n?b(r,n,i,a):i(a);t._subscribers.length=0}}function y(){this.error=null}function b(t,r,n,i){var a=e(n),o=void 0,s=void 0,l=void 0,c=void 0;if(a){if((o=function(t,e){try{return t(e)}catch(t){return U.error=t,U}}(n,i))===U?(c=!0,s=o.error,o=null):l=!0,r===o)return void m(r,new TypeError("A promises callback cannot return that same promise."))}else o=i,l=!0;r._state!==R||(a&&l?f(r,o):c?m(r,s):t===j?p(r,o):t===N&&m(r,o))}function x(t){t[F]=V++,t._state=void 0,t._result=void 0,t._subscribers=[]}function _(t,e){this._instanceConstructor=t,this.promise=new t(c),this.promise[F]||x(this.promise),k(e)?(this._input=e,this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?p(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&p(this.promise,this._result))):m(this.promise,new Error("Array Methods must be provided an Array"))}function w(t){this[F]=V++,this._result=this._state=void 0,this._subscribers=[],c!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof w?function(t,e){try{e(function(e){f(t,e)},function(e){m(t,e)})}catch(e){m(t,e)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}function M(){var t=void 0;if(void 0!==i)t=i;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(t){throw new Error("polyfill failed because global object is unavailable in this environment")}var e=t.Promise;if(e){var r=null;try{r=Object.prototype.toString.call(e.resolve())}catch(t){}if("[object Promise]"===r&&!e.cast)return}t.Promise=w}var k=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)},T=0,A=void 0,S=void 0,E=function(t,e){z[T]=t,z[T+1]=e,2===(T+=2)&&(S?S(a):O())},L="undefined"!=typeof window?window:void 0,C=L||{},I=C.MutationObserver||C.WebKitMutationObserver,P="undefined"==typeof self&&void 0!==n&&"[object process]"==={}.toString.call(n),D="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,z=new Array(1e3),O=void 0;O=P?function(){return n.nextTick(a)}:I?function(){var t=0,e=new I(a),r=document.createTextNode("");return e.observe(r,{characterData:!0}),function(){r.data=t=++t%2}}():D?function(){var t=new MessageChannel;return t.port1.onmessage=a,function(){return t.port2.postMessage(0)}}():void 0===L&&"function"==typeof t?o():r();var F=Math.random().toString(36).substring(16),R=void 0,j=1,N=2,B=new y,U=new y,V=0;return _.prototype._enumerate=function(){for(var t=this.length,e=this._input,r=0;this._state===R&&r<t;r++)this._eachEntry(e[r],r)},_.prototype._eachEntry=function(t,e){var r=this._instanceConstructor,n=r.resolve;if(n===l){var i=u(t);if(i===s&&t._state!==R)this._settledAt(t._state,e,t._result);else if("function"!=typeof i)this._remaining--,this._result[e]=t;else if(r===w){var a=new r(c);h(a,t,i),this._willSettleAt(a,e)}else this._willSettleAt(new r(function(e){return e(t)}),e)}else this._willSettleAt(n(t),e)},_.prototype._settledAt=function(t,e,r){var n=this.promise;n._state===R&&(this._remaining--,t===N?m(n,r):this._result[e]=r),0===this._remaining&&p(n,this._result)},_.prototype._willSettleAt=function(t,e){var r=this;g(t,void 0,function(t){return r._settledAt(j,e,t)},function(t){return r._settledAt(N,e,t)})},w.all=function(t){return new _(this,t).promise},w.race=function(t){var e=this;return k(t)?new e(function(r,n){for(var i=t.length,a=0;a<i;a++)e.resolve(t[a]).then(r,n)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})},w.resolve=l,w.reject=function(t){var e=new this(c);return m(e,t),e},w._setScheduler=function(t){S=t},w._setAsap=function(t){E=t},w._asap=E,w.prototype={constructor:w,then:s,catch:function(t){return this.then(null,t)}},M(),w.polyfill=M,w.Promise=w,w})}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:496}],130:[function(t,e,r){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function a(t){return"object"==typeof t&&null!==t}function o(t){return void 0===t}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(t){if(!function(t){return"number"==typeof t}(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},n.prototype.emit=function(t){var e,r,n,s,l,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var u=new Error('Uncaught, unspecified "error" event. ('+e+")");throw u.context=e,u}if(r=this._events[t],o(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(a(r))for(s=Array.prototype.slice.call(arguments,1),n=(c=r.slice()).length,l=0;l<n;l++)c[l].apply(this,s);return!0},n.prototype.addListener=function(t,e){var r;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(r=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&r>0&&this._events[t].length>r&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(t,e){function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var n=!1;return r.listener=e,this.on(t,r),this},n.prototype.removeListener=function(t,e){var r,n,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],o=r.length,n=-1,r===e||i(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(r)){for(s=o;s-- >0;)if(r[s]===e||r[s].listener&&r[s].listener===e){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},n.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],i(r))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},n.prototype.listeners=function(t){return this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},n.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},n.listenerCount=function(t,e){return t.listenerCount(e)}},{}],131:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=e||0,i=r||1;return[[t[12]+t[0],t[13]+t[1],t[14]+t[2],t[15]+t[3]],[t[12]-t[0],t[13]-t[1],t[14]-t[2],t[15]-t[3]],[t[12]+t[4],t[13]+t[5],t[14]+t[6],t[15]+t[7]],[t[12]-t[4],t[13]-t[5],t[14]-t[6],t[15]-t[7]],[n*t[12]+t[8],n*t[13]+t[9],n*t[14]+t[10],n*t[15]+t[11]],[i*t[12]-t[8],i*t[13]-t[9],i*t[14]-t[10],i*t[15]-t[11]]]}},{}],132:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&function(t){for(var e,r=t.length,n=0;n<r;n++)if(((e=t.charCodeAt(n))<9||e>13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],133:[function(t,e,r){"use strict";function n(t){if(!t)return"true";var e=t[0];if(t.length<=1)return"any"===e?"false":"true";return"("+("=="===e?a(t[1],t[2],"===",!1):"!="===e?a(t[1],t[2],"!==",!1):"<"===e||">"===e||"<="===e||">="===e?a(t[1],t[2],e,!0):"any"===e?o(t.slice(1),"||"):"all"===e?o(t.slice(1),"&&"):"none"===e?c(o(t.slice(1),"||")):"in"===e?s(t[1],t.slice(2)):"!in"===e?c(s(t[1],t.slice(2))):"has"===e?l(t[1]):"!has"===e?c(l([t[1]])):"true")+")"}function i(t){return"$type"===t?"f.type":"$id"===t?"f.id":"p["+JSON.stringify(t)+"]"}function a(t,e,r,n){var a=i(t),o="$type"===t?h.indexOf(e):JSON.stringify(e);return(n?"typeof "+a+"=== typeof "+o+"&&":"")+a+r+o}function o(t,e){return t.map(n).join(e)}function s(t,e){"$type"===t&&(e=e.map(function(t){return h.indexOf(t)}));var r=JSON.stringify(e.sort(u)),n=i(t);return e.length<=200?r+".indexOf("+n+") !== -1":"function(v, a, i, j) {while (i <= j) { var m = (i + j) >> 1; if (a[m] === v) return true; if (a[m] > v) j = m - 1; else i = m + 1;}return false; }("+n+", "+r+",0,"+(e.length-1)+")"}function l(t){return JSON.stringify(t)+" in p"}function c(t){return"!("+t+")"}function u(t,e){return t<e?-1:t>e?1:0}e.exports=function(t){return new Function("f","var p = (f && f.properties || {}); return "+n(t))};var h=["Unknown","Point","LineString","Polygon"]},{}],134:[function(t,e,r){"use strict";function n(t,e,r){return Math.min(e,Math.max(t,r))}function i(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n<this.dimension;++n)this.bounds[0][n]=-1/0,this.bounds[1][n]=1/0;this._state=t.slice().reverse(),this._velocity=e.slice().reverse(),this._time=[r],this._scratch=[t.slice(),t.slice(),t.slice(),t.slice(),t.slice()]}function a(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=0;return e}e.exports=function(t,e,r){switch(arguments.length){case 0:return new i([0],[0],0);case 1:return"number"==typeof t?new i(n=a(t),n,0):new i(t,a(t.length),0);case 2:if("number"==typeof e){var n;return new i(t,n=a(t.length),+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new i(t,e,r)}};var o=t("cubic-hermite"),s=t("binary-search-bounds"),l=i.prototype;l.flush=function(t){var e=s.gt(this._time,t)-1;e<=0||(this._time.splice(0,e),this._state.splice(0,e*this.dimension),this._velocity.splice(0,e*this.dimension))},l.curve=function(t){var e=this._time,r=e.length,i=s.le(e,t),a=this._scratch[0],l=this._state,c=this._velocity,u=this.dimension,h=this.bounds;if(i<0)for(var f=u-1,d=0;d<u;++d,--f)a[d]=l[f];else if(i>=r-1){f=l.length-1;var p=t-e[r-1];for(d=0;d<u;++d,--f)a[d]=l[f]+p*c[f]}else{f=u*(i+1)-1;var m=e[i],g=e[i+1]-m||1,v=this._scratch[1],y=this._scratch[2],b=this._scratch[3],x=this._scratch[4],_=!0;for(d=0;d<u;++d,--f)v[d]=l[f],b[d]=c[f]*g,y[d]=l[f+u],x[d]=c[f+u]*g,_=_&&v[d]===y[d]&&b[d]===x[d]&&0===b[d];if(_)for(d=0;d<u;++d)a[d]=v[d];else o(v,b,y,x,(t-m)/g,a)}var w=h[0],M=h[1];for(d=0;d<u;++d)a[d]=n(w[d],M[d],a[d]);return a},l.dcurve=function(t){var e=this._time,r=e.length,n=s.le(e,t),i=this._scratch[0],a=this._state,l=this._velocity,c=this.dimension;if(n>=r-1)for(var u=a.length-1,h=(e[r-1],0);h<c;++h,--u)i[h]=l[u];else{u=c*(n+1)-1;var f=e[n],d=e[n+1]-f||1,p=this._scratch[1],m=this._scratch[2],g=this._scratch[3],v=this._scratch[4],y=!0;for(h=0;h<c;++h,--u)p[h]=a[u],g[h]=l[u]*d,m[h]=a[u+c],v[h]=l[u+c]*d,y=y&&p[h]===m[h]&&g[h]===v[h]&&0===g[h];if(y)for(h=0;h<c;++h)i[h]=0;else{o.derivative(p,g,m,v,(t-f)/d,i);for(h=0;h<c;++h)i[h]/=d}}return i},l.lastT=function(){var t=this._time;return t[t.length-1]},l.stable=function(){for(var t=this._velocity,e=t.length,r=this.dimension-1;r>=0;--r)if(t[--e])return!1;return!0},l.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t<e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=this.bounds,l=s[0],c=s[1];this._time.push(e,t);for(var u=0;u<2;++u)for(var h=0;h<r;++h)i.push(i[o++]),a.push(0);this._time.push(t);for(h=r;h>0;--h)i.push(n(l[h-1],c[h-1],arguments[h])),a.push(0)}},l.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t<e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.length-this.dimension,s=t-e,l=this.bounds,c=l[0],u=l[1],h=s>1e-6?1/s:0;this._time.push(t);for(var f=r;f>0;--f){var d=n(c[f-1],u[f-1],arguments[f]);i.push(d),a.push((d-i[o++])*h)}}},l.set=function(t){var e=this.dimension;if(!(t<this.lastT()||arguments.length!==e+1)){var r=this._state,i=this._velocity,a=this.bounds,o=a[0],s=a[1];this._time.push(t);for(var l=e;l>0;--l)r.push(n(o[l-1],s[l-1],arguments[l])),i.push(0)}},l.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var i=this._state,a=this._velocity,o=i.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 d=arguments[f];i.push(n(l[f-1],c[f-1],i[o++]+d)),a.push(d*h)}}},l.idle=function(t){var e=this.lastT();if(!(t<e)){var r=this.dimension,i=this._state,a=this._velocity,o=i.length-r,s=this.bounds,l=s[0],c=s[1],u=t-e;this._time.push(t);for(var h=r-1;h>=0;--h)i.push(n(l[h],c[h],i[o]+u*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":67,"cubic-hermite":110}],135:[function(t,e,r){"use strict";var n=t("tiny-sdf"),i=t("optical-properties");e.exports=function(t){var e,r,o=(t=t||{}).canvas||document.createElement("canvas"),s=t.family||"sans-serif",l=t.shape||[512,512],c=t.step||[32,32],u=parseFloat(t.size)||16,h=t.chars||[32,126],f=Math.floor((c[0]-u)/2),d=t.radius||1.5*f,p=new n(u,f,d,0,s),m=null==t.align?"optical":t.align,g=null==t.fit||1==t.fit?.5:t.fit;if(Array.isArray(h)){if(2===h.length&&"number"==typeof h[0]&&"number"==typeof h[1]){var v=[];for(e=h[0],r=0;e<=h[1];e++)v[r++]=String.fromCharCode(e);h=v}}else h=String(h).split("");l=l.slice(),o.width=l[0],o.height=l[1];var y=o.getContext("2d");y.fillStyle="#000",y.fillRect(0,0,o.width,o.height),y.textBaseline="middle";var b=c[0],x=c[1],_=0,w=0,M=u/x,k=Math.min(h.length,Math.floor(l[0]/b)*Math.ceil(l[1]/x)),T=p.ctx.textAlign,A=p.buffer,S=p.middle;for(p.ctx.textAlign="center",p.buffer=p.size/2,e=0;e<k;e++)if(h[e]){var E=function(t,e,r){if(a[e]&&a[e][t])return a[e][t];var n=i(t,{size:200,fontSize:200*r,fontFamily:e});a[e]||(a[e]={});var o={center:[n.center[0]/200,n.center[1]/200],bounds:n.bounds.map(function(t){return t/200}),radius:n.radius/200};return a[e][t]=o,o}(h[e],s,M),L=1,C=[0,0];if(g){var I=g;Array.isArray(g)&&(I=g[e]);var P=.5*(E.bounds[3]-E.bounds[1]),D=.5*(E.bounds[2]-E.bounds[0]),z=Math.max(P,D),O=Math.sqrt(P*P+D*D);L=x*I/((.333*E.radius+.333*z+.333*O)*x*2),p.ctx.font=u*L+"px "+s}else p.ctx.font=u+"px "+s;m&&(C="optical"===m||!0===m?[.5*b-b*E.center[0],.5*x-x*E.center[1]]:[.5*b-b*(E.bounds[2]+E.bounds[0])*.5,.5*x-x*(E.bounds[3]+E.bounds[1])*.5],p.middle=S+C[1]*L);var F=p.draw(h[e]);y.putImageData(F,_+C[0]*L,w),(_+=c[0])>l[0]-c[0]&&(_=0,w+=c[1])}return p.ctx.textAlign=T,p.buffer=A,p.middle=S,o};var a={}},{"optical-properties":472,"tiny-sdf":542}],136:[function(t,e,r){"use strict";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}function l(t,e){if(e.left){if(r=l(t,e.left))return r}var r;return(r=t(e.key,e.value))||(e.right?l(t,e.right):void 0)}function c(t,e,r,n){if(e(t,n.key)<=0){if(n.left){if(i=c(t,e,r,n.left))return i}var i;if(i=r(n.key,n.value))return i}if(n.right)return c(t,e,r,n.right)}function u(t,e,r,n,i){var a,o=r(t,i.key),s=r(e,i.key);if(o<=0){if(i.left&&(a=u(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 u(t,e,r,n,i.right)}function h(t,e){this.tree=t,this._stack=e}function f(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}e.exports=function(t){return new s(t||function(t,e){return t<e?-1:t>e?1:0},null)};var d=0,p=1,m=s.prototype;Object.defineProperty(m,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(m,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(m,"length",{get:function(){return this.root?this.root._count:0}}),m.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(d,t,e,null,null,1));for(var h=l.length-2;h>=0;--h){i=l[h];c[h]<=0?l[h]=new n(i._color,i.key,i.value,l[h+1],i.right,i._count+1):l[h]=new n(i._color,i.key,i.value,i.left,l[h+1],i._count+1)}for(h=l.length-1;h>1;--h){var f=l[h-1];i=l[h];if(f._color===p||i._color===p)break;var m=l[h-2];if(m.left===f)if(f.left===i){if(!(g=m.right)||g._color!==d){if(m._color=d,m.left=f.right,f._color=p,f.right=m,l[h-2]=f,l[h-1]=i,o(m),o(f),h>=3){(v=l[h-3]).left===m?v.left=f:v.right=f}break}f._color=p,m.right=a(p,g),m._color=d,h-=1}else{if(!(g=m.right)||g._color!==d){if(f.right=i.left,m._color=d,m.left=i.right,i._color=p,i.left=f,i.right=m,l[h-2]=i,l[h-1]=f,o(m),o(f),o(i),h>=3){(v=l[h-3]).left===m?v.left=i:v.right=i}break}f._color=p,m.right=a(p,g),m._color=d,h-=1}else if(f.right===i){if(!(g=m.left)||g._color!==d){if(m._color=d,m.right=f.left,f._color=p,f.left=m,l[h-2]=f,l[h-1]=i,o(m),o(f),h>=3){(v=l[h-3]).right===m?v.right=f:v.left=f}break}f._color=p,m.left=a(p,g),m._color=d,h-=1}else{var g;if(!(g=m.left)||g._color!==d){if(f.left=i.right,m._color=d,m.right=i.left,i._color=p,i.right=f,i.left=m,l[h-2]=i,l[h-1]=f,o(m),o(f),o(i),h>=3){var v;(v=l[h-3]).right===m?v.right=i:v.left=i}break}f._color=p,m.left=a(p,g),m._color=d,h-=1}}return l[0]._color=p,new s(r,l[0])},m.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return l(t,this.root);case 2:return c(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return u(e,r,this._compare,t,this.root)}},Object.defineProperty(m,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new h(this,t)}}),Object.defineProperty(m,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new h(this,t)}}),m.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.left._count){e=e.left;continue}t-=e.left._count}if(!t)return new h(this,r);if(t-=1,!e.right)break;if(t>=e.right._count)break;e=e.right}return new h(this,[])},m.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)},m.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)},m.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)},m.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)},m.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,[])},m.remove=function(t){var e=this.find(t);return e?e.remove():this},m.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 g=h.prototype;Object.defineProperty(g,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(g,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),g.clone=function(){return new h(this.tree,this._stack.slice())},g.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((r=e[e.length-1])._color===d){var h=e[e.length-2];h.left===r?h.left=null:h.right===r&&(h.right=null),e.pop();for(l=0;l<e.length;++l)e[l]._count--;return new s(this.tree._compare,e[0])}if(r.left||r.right){r.left?f(r,r.left):r.right&&f(r,r.right),r._color=p;for(l=0;l<e.length-1;++l)e[l]._count--;return new s(this.tree._compare,e[0])}if(1===e.length)return new s(this.tree._compare,null);for(l=0;l<e.length;++l)e[l]._count--;var m=e[e.length-2];return function(t){for(var e,r,n,s,l=t.length-1;l>=0;--l){if(e=t[l],0===l)return void(e._color=p);if((r=t[l-1]).left===e){if((n=r.right).right&&n.right._color===d)return n=r.right=i(n),s=n.right=i(n.right),r.right=n.left,n.left=r,n.right=s,n._color=r._color,e._color=p,r._color=p,s._color=p,o(r),o(n),l>1&&((c=t[l-2]).left===r?c.left=n:c.right=n),void(t[l-1]=n);if(n.left&&n.left._color===d)return n=r.right=i(n),s=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=p,n._color=p,e._color=p,o(r),o(n),o(s),l>1&&((c=t[l-2]).left===r?c.left=s:c.right=s),void(t[l-1]=s);if(n._color===p){if(r._color===d)return r._color=p,void(r.right=a(d,n));r.right=a(d,n);continue}n=i(n),r.right=n.left,n.left=r,n._color=r._color,r._color=d,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+1<t.length?t[l+1]=e:t.push(e),l+=2}else{if((n=r.left).left&&n.left._color===d)return n=r.left=i(n),s=n.left=i(n.left),r.left=n.right,n.right=r,n.left=s,n._color=r._color,e._color=p,r._color=p,s._color=p,o(r),o(n),l>1&&((c=t[l-2]).right===r?c.right=n:c.left=n),void(t[l-1]=n);if(n.right&&n.right._color===d)return n=r.left=i(n),s=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=p,n._color=p,e._color=p,o(r),o(n),o(s),l>1&&((c=t[l-2]).right===r?c.right=s:c.left=s),void(t[l-1]=s);if(n._color===p){if(r._color===d)return r._color=p,void(r.left=a(d,n));r.left=a(d,n);continue}if(n=i(n),r.left=n.right,n.right=r,n._color=r._color,r._color=d,o(r),o(n),l>1){var c;(c=t[l-2]).right===r?c.right=n:c.left=n}t[l-1]=n,t[l]=r,l+1<t.length?t[l+1]=e:t.push(e),l+=2}}}(e),m.left===r?m.left=null:m.right=null,new s(this.tree._compare,e[0])},Object.defineProperty(g,"key",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(g,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(g,"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}),g.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(g,"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}}),g.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])},g.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(g,"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}})},{}],137:[function(t,e,r){function n(t){if(t<0)return Number("0/0");for(var e=o[0],r=o.length-1;r>0;--r)e+=o[r]/(t+r);var n=t+a+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}var i=[.9999999999998099,676.5203681218851,-1259.1392167224028,771.3234287776531,-176.6150291621406,12.507343278686905,-.13857109526572012,9984369578019572e-21,1.5056327351493116e-7],a=607/128,o=[.9999999999999971,57.15623566586292,-59.59796035547549,14.136097974741746,-.4919138160976202,3399464998481189e-20,4652362892704858e-20,-9837447530487956e-20,.0001580887032249125,-.00021026444172410488,.00021743961811521265,-.0001643181065367639,8441822398385275e-20,-26190838401581408e-21,36899182659531625e-22];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(n(e));e-=1;for(var r=i[0],a=1;a<9;a++)r+=i[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=n},{}],138:[function(t,e,r){function n(t){var e=0;if(t&&t.length>0){e+=Math.abs(i(t[0]));for(var r=1;r<t.length;r++)e-=Math.abs(i(t[r]))}return e}function i(t){var e=0;if(t.length>2){for(var r,n,i=0;i<t.length-1;i++)r=t[i],e+=a((n=t[i+1])[0]-r[0])*(2+Math.sin(a(r[1]))+Math.sin(a(n[1])));e=e*o.RADIUS*o.RADIUS/2}return e}function a(t){return t*Math.PI/180}var o=t("wgs84");e.exports.geometry=function(t){if("Polygon"===t.type)return n(t.coordinates);if("MultiPolygon"===t.type){for(var e=0,r=0;r<t.coordinates.length;r++)e+=n(t.coordinates[r]);return e}return null},e.exports.ring=i},{wgs84:574}],139:[function(t,e,r){function n(t,e){switch(t&&t.type||null){case"FeatureCollection":return t.features=t.features.map(i(n,e)),t;case"Feature":return t.geometry=n(t.geometry,e),t;case"Polygon":case"MultiPolygon":return function(t,e){"Polygon"===t.type?t.coordinates=a(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(i(a,e)));return t}(t,e);default:return t}}function i(t,e){return function(r){return t(r,e)}}function a(t,e){e=!!e,t[0]=o(t[0],!e);for(var r=1;r<t.length;r++)t[r]=o(t[r],e);return t}function o(t,e){return function(t){return s.ring(t)>=0}(t)===e?t:t.reverse()}var s=t("geojson-area");e.exports=n},{"geojson-area":138}],140:[function(t,e,r){"use strict";function n(t,e,r,n,i){return e.length&&(e.area=r,e.dist=n,void 0!==i&&(e.outer=i),t.push(e)),[]}e.exports=function(t,e,r,a,o,s,l,c){if(r/=e,a/=e,l>=r&&c<=a)return t;if(l>a||c<r)return null;for(var u=[],h=0;h<t.length;h++){var f,d,p=t[h],m=p.geometry,g=p.type;if(f=p.min[o],d=p.max[o],f>=r&&d<=a)u.push(p);else if(!(f>a||d<r)){var v=1===g?function(t,e,r,n){for(var i=[],a=0;a<t.length;a++){var o=t[a],s=o[n];s>=e&&s<=r&&i.push(o)}return i}(m,r,a,o):function(t,e,r,i,a,o){for(var s=[],l=0;l<t.length;l++){var c,u,h,f=0,d=0,p=null,m=t[l],g=m.area,v=m.dist,y=m.outer,b=m.length,x=[];for(u=0;u<b-1;u++)c=p||m[u],p=m[u+1],f=d||c[i],d=p[i],f<e?d>r?(x.push(a(c,p,e),a(c,p,r)),o||(x=n(s,x,g,v,y))):d>=e&&x.push(a(c,p,e)):f>r?d<e?(x.push(a(c,p,r),a(c,p,e)),o||(x=n(s,x,g,v,y))):d<=r&&x.push(a(c,p,r)):(x.push(c),d<e?(x.push(a(c,p,e)),o||(x=n(s,x,g,v,y))):d>r&&(x.push(a(c,p,r)),o||(x=n(s,x,g,v,y))));c=m[b-1],(f=c[i])>=e&&f<=r&&x.push(c),h=x[x.length-1],o&&h&&(x[0][0]!==h[0]||x[0][1]!==h[1])&&x.push(x[0]),n(s,x,g,v,y)}return s}(m,r,a,o,s,3===g);v.length&&u.push(i(p.tags,g,v,p.id))}}return u.length?u:null};var i=t("./feature")},{"./feature":142}],141:[function(t,e,r){"use strict";function n(t,e,r){if(null!==e.geometry){var o,l,c,u,h=e.geometry,f=h.type,d=h.coordinates,p=e.properties,m=e.id;if("Point"===f)t.push(s(p,1,[a(d)],m));else if("MultiPoint"===f)t.push(s(p,1,i(d),m));else if("LineString"===f)t.push(s(p,2,[i(d,r)],m));else if("MultiLineString"===f||"Polygon"===f){for(c=[],o=0;o<d.length;o++)u=i(d[o],r),"Polygon"===f&&(u.outer=0===o),c.push(u);t.push(s(p,"Polygon"===f?3:2,c,m))}else if("MultiPolygon"===f){for(c=[],o=0;o<d.length;o++)for(l=0;l<d[o].length;l++)(u=i(d[o][l],r)).outer=0===l,c.push(u);t.push(s(p,3,c,m))}else{if("GeometryCollection"!==f)throw new Error("Input data is not a valid GeoJSON object.");for(o=0;o<h.geometries.length;o++)n(t,{geometry:h.geometries[o],properties:p},r)}}}function i(t,e){for(var r=[],n=0;n<t.length;n++)r.push(a(t[n]));return e&&(o(r,e),function(t){for(var e,r,n=0,i=0,a=0;a<t.length-1;a++)e=r||t[a],r=t[a+1],n+=e[0]*r[1]-r[0]*e[1],i+=Math.abs(r[0]-e[0])+Math.abs(r[1]-e[1]);t.area=Math.abs(n/2),t.dist=i}(r)),r}function a(t){var e=Math.sin(t[1]*Math.PI/180),r=t[0]/360+.5,n=.5-.25*Math.log((1+e)/(1-e))/Math.PI;return n=n<0?0:n>1?1:n,[r,n,0]}e.exports=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i<t.features.length;i++)n(r,t.features[i],e);else"Feature"===t.type?n(r,t,e):n(r,{geometry:t},e);return r};var o=t("./simplify"),s=t("./feature")},{"./feature":142,"./simplify":144}],142:[function(t,e,r){"use strict";function n(t,e,r){for(var n,i=0;i<r.length;i++)n=r[i],t[0]=Math.min(n[0],t[0]),e[0]=Math.max(n[0],e[0]),t[1]=Math.min(n[1],t[1]),e[1]=Math.max(n[1],e[1])}e.exports=function(t,e,r,i){var a={id:i||null,type:e,geometry:r,tags:t||null,min:[1/0,1/0],max:[-1/0,-1/0]};return function(t){var e=t.geometry,r=t.min,i=t.max;if(1===t.type)n(r,i,e);else for(var a=0;a<e.length;a++)n(r,i,e[a])}(a),a}},{}],143:[function(t,e,r){"use strict";function n(t,e){var r=(e=this.options=function(t,e){for(var r in e)t[r]=e[r];return t}(Object.create(this.options),e)).debug;r&&console.time("preprocess data");var n=1<<e.maxZoom,i=l(t,e.tolerance/(n*e.extent));this.tiles={},this.tileCoords=[],r&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",e.indexMaxZoom,e.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),(i=h(i,e.buffer/e.extent,a)).length&&this.splitTile(i,0,0,0),r&&(i.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}function i(t,e,r){return 32*((1<<t)*r+e)+t}function a(t,e,r){return[r,(r-t[0])*(e[1]-t[1])/(e[0]-t[0])+t[1],1]}function o(t,e,r){return[(r-t[1])*(e[0]-t[0])/(e[1]-t[1])+t[0],r,1]}function s(t,e,r){var n=t.source;if(1!==n.length)return!1;var i=n[0];if(3!==i.type||i.geometry.length>1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o<a;o++){var s=c.point(i.geometry[0][o],e,t.z2,t.x,t.y);if(s[0]!==-r&&s[0]!==e+r||s[1]!==-r&&s[1]!==e+r)return!1}return!0}e.exports=function(t,e){return new n(t,e)};var l=t("./convert"),c=t("./transform"),u=t("./clip"),h=t("./wrap"),f=t("./tile");n.prototype.options={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,solidChildren:!1,tolerance:3,extent:4096,buffer:64,debug:0},n.prototype.splitTile=function(t,e,r,n,l,c,h){for(var d=[t,e,r,n],p=this.options,m=p.debug,g=null;d.length;){n=d.pop(),r=d.pop(),e=d.pop(),t=d.pop();var v=1<<e,y=i(e,r,n),b=this.tiles[y],x=e===p.maxZoom?0:p.tolerance/(v*p.extent);if(!b&&(m>1&&console.time("creation"),b=this.tiles[y]=f(t,v,r,n,x,e===p.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),m)){m>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,b.numFeatures,b.numPoints,b.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(b.source=t,l){if(e===p.maxZoom||e===l)continue;var w=1<<l-e;if(r!==Math.floor(c/w)||n!==Math.floor(h/w))continue}else if(e===p.indexMaxZoom||b.numPoints<=p.indexMaxPoints)continue;if(p.solidChildren||!s(b,p.extent,p.buffer)){b.source=null,m>1&&console.time("clipping");var M,k,T,A,S,E,L=.5*p.buffer/p.extent,C=.5-L,I=.5+L,P=1+L;M=k=T=A=null,S=u(t,v,r-L,r+I,0,a,b.min[0],b.max[0]),E=u(t,v,r+C,r+P,0,a,b.min[0],b.max[0]),S&&(M=u(S,v,n-L,n+I,1,o,b.min[1],b.max[1]),k=u(S,v,n+C,n+P,1,o,b.min[1],b.max[1])),E&&(T=u(E,v,n-L,n+I,1,o,b.min[1],b.max[1]),A=u(E,v,n+C,n+P,1,o,b.min[1],b.max[1])),m>1&&console.timeEnd("clipping"),t.length&&(d.push(M||[],e+1,2*r,2*n),d.push(k||[],e+1,2*r,2*n+1),d.push(T||[],e+1,2*r+1,2*n),d.push(A||[],e+1,2*r+1,2*n+1))}else l&&(g=e)}return g},n.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,o=n.debug,l=1<<t,u=i(t,e=(e%l+l)%l,r);if(this.tiles[u])return c.tile(this.tiles[u],a);o>1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var h,f=t,d=e,p=r;!h&&f>0;)f--,d=Math.floor(d/2),p=Math.floor(p/2),h=this.tiles[i(f,d,p)];if(!h||!h.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",f,d,p),s(h,a,n.buffer))return c.tile(h,a);o>1&&console.time("drilling down");var m=this.splitTile(h.source,f,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var g=1<<t-m;u=i(m,Math.floor(e/g),Math.floor(r/g))}return this.tiles[u]?c.tile(this.tiles[u],a):null}},{"./clip":140,"./convert":141,"./tile":145,"./transform":146,"./wrap":147}],144:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i,a,o=e*e,s=0,l=t.length-1,c=[];for(t[s][2]=1,t[l][2]=1;l;){for(n=0,r=s+1;r<l;r++)(i=function(t,e,r){var n=e[0],i=e[1],a=r[0],o=r[1],s=t[0],l=t[1],c=a-n,u=o-i;if(0!==c||0!==u){var h=((s-n)*c+(l-i)*u)/(c*c+u*u);h>1?(n=a,i=o):h>0&&(n+=c*h,i+=u*h)}return c=s-n,u=l-i,c*c+u*u}(t[r],t[s],t[l]))>n&&(a=r,n=i);n>o?(t[a][2]=n,c.push(s),c.push(a),s=a):(l=c.pop(),s=c.pop())}}},{}],145:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){for(var o={features:[],numPoints:0,numSimplified:0,numFeatures:0,source:null,x:r,y:n,z2:e,transformed:!1,min:[2,1],max:[-1,0]},s=0;s<t.length;s++){o.numFeatures++,function(t,e,r,n){var i,a,o,s,l=e.geometry,c=e.type,u=[],h=r*r;if(1===c)for(i=0;i<l.length;i++)u.push(l[i]),t.numPoints++,t.numSimplified++;else for(i=0;i<l.length;i++)if(o=l[i],n||!(2===c&&o.dist<r||3===c&&o.area<h)){var f=[];for(a=0;a<o.length;a++)s=o[a],(n||s[2]>h)&&(f.push(s),t.numSimplified++),t.numPoints++;3===c&&function(t,e){(function(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i<a;o=i++)e=t[i],r=t[o],n+=(r[0]-e[0])*(e[1]+r[1]);return n})(t)<0===e&&t.reverse()}(f,o.outer),u.push(f)}else t.numPoints+=o.length;if(u.length){var d={geometry:u,type:c,tags:e.tags||null};null!==e.id&&(d.id=e.id),t.features.push(d)}}(o,t[s],i,a);var l=t[s].min,c=t[s].max;l[0]<o.min[0]&&(o.min[0]=l[0]),l[1]<o.min[1]&&(o.min[1]=l[1]),c[0]>o.max[0]&&(o.max[0]=c[0]),c[1]>o.max[1]&&(o.max[1]=c[1])}return o}},{}],146:[function(t,e,r){"use strict";function n(t,e,r,n,i){return[Math.round(e*(t[0]*r-n)),Math.round(e*(t[1]*r-i))]}r.tile=function(t,e){if(t.transformed)return t;var r,i,a,o=t.z2,s=t.x,l=t.y;for(r=0;r<t.features.length;r++){var c=t.features[r],u=c.geometry;if(1===c.type)for(i=0;i<u.length;i++)u[i]=n(u[i],e,o,s,l);else for(i=0;i<u.length;i++){var h=u[i];for(a=0;a<h.length;a++)h[a]=n(h[a],e,o,s,l)}}return t.transformed=!0,t},r.point=n},{}],147:[function(t,e,r){"use strict";function n(t,e){for(var r=[],n=0;n<t.length;n++){var a,s=t[n],l=s.type;if(1===l)a=i(s.geometry,e);else{a=[];for(var c=0;c<s.geometry.length;c++)a.push(i(s.geometry[c],e))}r.push(o(s.tags,l,a,s.id))}return r}function i(t,e){var r=[];r.area=t.area,r.dist=t.dist;for(var n=0;n<t.length;n++)r.push([t[n][0]+e,t[n][1],t[n][2]]);return r}var a=t("./clip"),o=t("./feature");e.exports=function(t,e,r){var i=t,o=a(t,1,-1-e,e,0,r,-1,2),s=a(t,1,1-e,2+e,0,r,-1,2);return(o||s)&&(i=a(t,1,-e,1+e,0,r,-1,2)||[],o&&(i=n(o,1).concat(i)),s&&(i=i.concat(n(s,-1)))),i}},{"./clip":140,"./feature":142}],148:[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;o<a.length;o++)if(n=r.getContext(a[o],i))return n}catch(t){n=null}return n||null}},{}],149:[function(t,e,r){"use strict";function n(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function i(t){this.gl=t,this.pixelRatio=1,this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.autoTicks=!0,this.tickSpacing=[1,1,1],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[10,10,10],this.lastCubeProps={cubeEdges:[0,0,0],axis:[0,0,0]},this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont="sans-serif",this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[10,10,10],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[0,0,0],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!1,!1,!1],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._firstInit=!0,this._text=null,this._lines=null,this._background=c(t)}function a(){this.primalOffset=[0,0,0],this.primalMinor=[0,0,0],this.mirrorOffset=[0,0,0],this.mirrorMinor=[0,0,0]}function o(t,e,r,n,i){for(var a=t.primalOffset,o=t.primalMinor,s=t.mirrorOffset,l=t.mirrorMinor,c=n[e],u=0;u<3;++u)if(e!==u){var h=a,f=s,d=o,p=l;c&1<<u&&(h=s,f=a,d=l,p=o),h[u]=r[0][u],f[u]=r[1][u],i[u]>0?(d[u]=-1,p[u]=0):(d[u]=0,p[u]=1)}}e.exports=function(t,e){var r=new i(t);return r.update(e),r};var s=t("./lib/text.js"),l=t("./lib/lines.js"),c=t("./lib/background.js"),u=t("./lib/cube.js"),h=t("./lib/ticks.js"),f=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),d=i.prototype;d.update=function(t){function e(e,r,n){if(n in t){var i,a=t[n],o=this[n];(e?Array.isArray(a)&&Array.isArray(a[0]):Array.isArray(a))?this[n]=i=[r(a[0]),r(a[1]),r(a[2])]:this[n]=i=[r(a),r(a),r(a)];for(var s=0;s<3;++s)if(i[s]!==o[s])return!0}return!1}t=t||{};var r,n=e.bind(this,!1,Number),i=e.bind(this,!1,Boolean),a=e.bind(this,!1,String),o=e.bind(this,!0,function(t){if(Array.isArray(t)){if(3===t.length)return[+t[0],+t[1],+t[2],1];if(4===t.length)return[+t[0],+t[1],+t[2],+t[3]]}return[0,0,0,1]}),c=!1,u=!1;if("bounds"in t)for(var f=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)f[d][p]!==this.bounds[d][p]&&(u=!0),this.bounds[d][p]=f[d][p];if("ticks"in t){r=t.ticks,c=!0,this.autoTicks=!1;for(d=0;d<3;++d)this.tickSpacing[d]=0}else n("tickSpacing")&&(this.autoTicks=!0,u=!0);if(this._firstInit&&("ticks"in t||"tickSpacing"in t||(this.autoTicks=!0),u=!0,c=!0,this._firstInit=!1),u&&this.autoTicks&&(r=h.create(this.bounds,this.tickSpacing),c=!0),c){for(d=0;d<3;++d)r[d].sort(function(t,e){return t.x-e.x});h.equal(r,this.ticks)?c=!1:this.ticks=r}i("tickEnable"),a("tickFont")&&(c=!0),n("tickSize"),n("tickAngle"),n("tickPad"),o("tickColor");var m=a("labels");a("labelFont")&&(m=!0),i("labelEnable"),n("labelSize"),n("labelPad"),o("labelColor"),i("lineEnable"),i("lineMirror"),n("lineWidth"),o("lineColor"),i("lineTickEnable"),i("lineTickMirror"),n("lineTickLength"),n("lineTickWidth"),o("lineTickColor"),i("gridEnable"),n("gridWidth"),o("gridColor"),i("zeroEnable"),o("zeroLineColor"),n("zeroLineWidth"),i("backgroundEnable"),o("backgroundColor"),this._text?this._text&&(m||c)&&this._text.update(this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont):this._text=s(this.gl,this.bounds,this.labels,this.labelFont,this.ticks,this.tickFont),this._lines&&c&&(this._lines.dispose(),this._lines=null),this._lines||(this._lines=l(this.gl,this.bounds,this.ticks))};var p=[new a,new a,new a],m=[0,0,0],g={model:f,view:f,projection:f};d.isOpaque=function(){return!0},d.isTransparent=function(){return!1},d.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],b=[0,0,0];d.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||f,i=t.view||f,a=t.projection||f,s=this.bounds,l=u(r,i,a,s),c=l.cubeEdges,h=l.axis,d=i[12],x=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*d+a[7]*x+a[11]*_+a[15]*w)/e.drawingBufferHeight,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=c[k],this.lastCubeProps.axis[k]=h[k];var T=p;for(k=0;k<3;++k)o(p[k],k,this.bounds,c,h);e=this.gl;var A=m;for(k=0;k<3;++k)this.backgroundEnable[k]?A[k]=h[k]:A[k]=0;this._background.draw(r,i,a,s,A,this.backgroundColor),this._lines.bind(r,i,a,this);for(k=0;k<3;++k){var S=[0,0,0];h[k]>0?S[k]=s[1][k]:S[k]=s[0][k];for(var E=0;E<2;++E){var L=(k+1+E)%3,C=(k+1+(1^E))%3;this.gridEnable[L]&&this._lines.drawGrid(L,C,this.bounds,S,this.gridColor[L],this.gridWidth[L]*this.pixelRatio)}for(E=0;E<2;++E){L=(k+1+E)%3,C=(k+1+(1^E))%3;this.zeroEnable[C]&&s[0][C]<=0&&s[1][C]>=0&&this._lines.drawZero(L,C,this.bounds,S,this.zeroLineColor[C],this.zeroLineWidth[C]*this.pixelRatio)}}for(k=0;k<3;++k){this.lineEnable[k]&&this._lines.drawAxisLine(k,this.bounds,T[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,T[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);var I=n(v,T[k].primalMinor),P=n(y,T[k].mirrorMinor),D=this.lineTickLength;for(E=0;E<3;++E){var z=M/r[5*E];I[E]*=D[E]*z,P[E]*=D[E]*z}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,T[k].primalOffset,I,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,T[k].mirrorOffset,P,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(k=0;k<3;++k){var O=T[k].primalMinor,F=n(b,T[k].primalOffset);for(E=0;E<3;++E)this.lineTickEnable[k]&&(F[E]+=M*O[E]*Math.max(this.lineTickLength[E],0)/r[5*E]);if(this.tickEnable[k]){for(E=0;E<3;++E)F[E]+=M*O[E]*this.tickPad[E]/r[5*E];this._text.drawTicks(k,this.tickSize[k],this.tickAngle[k],F,this.tickColor[k])}if(this.labelEnable[k]){for(E=0;E<3;++E)F[E]+=M*O[E]*this.labelPad[E]/r[5*E];F[k]+=.5*(s[0][k]+s[1][k]),this._text.drawLabel(k,this.labelSize[k],this.labelAngle[k],F,this.labelColor[k])}}},d.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":150,"./lib/cube.js":151,"./lib/lines.js":152,"./lib/text.js":154,"./lib/ticks.js":155}],150:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}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],d=-1;d<=1;d+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),h[l]=d,f[l]=d;for(var p=-1;p<=1;p+=2){h[c]=p;for(var m=-1;m<=1;m+=2)h[u]=m,e.push(h[0],h[1],h[2],f[0],f[1],f[2]),s+=1}var g=c;c=u,u=g}var v=i(t,new Float32Array(e)),y=i(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),b=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),x=o(t);return x.attributes.position.location=0,x.attributes.normal.location=1,new n(t,v,b,x)};var i=t("gl-buffer"),a=t("gl-vao"),o=t("./shaders").bg,s=n.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),l.disable(l.POLYGON_OFFSET_FILL)}},s.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders":153,"gl-buffer":157,"gl-vao":272}],151:[function(t,e,r){"use strict";function n(t,e,r){for(var n=0;n<4;++n){t[n]=r[12+n];for(var i=0;i<3;++i)t[n]+=e[i]*r[4*i+n]}}function i(t){for(var e=0;e<p.length;++e)if((t=s.positive(t,p[e])).length<3)return 0;var r=t[0],n=r[0]/r[3],i=r[1]/r[3],a=0;for(e=1;e+1<t.length;++e){var o=t[e],l=t[e+1],c=o[0]/o[3]-n,u=o[1]/o[3]-i,h=l[0]/l[3]-n,f=l[1]/l[3]-i;a+=Math.abs(c*f-u*h)}return a}e.exports=function(t,e,r,s){o(c,e,t),o(c,r,c);for(var p=0,y=0;y<2;++y){f[2]=s[y][2];for(var b=0;b<2;++b){f[1]=s[b][1];for(var x=0;x<2;++x)f[0]=s[x][0],n(u[p],f,c),p+=1}}var _=-1;for(y=0;y<8;++y){for(var w=u[y][3],M=0;M<3;++M)h[y][M]=u[y][M]/w;w<0&&(_<0?_=y:h[y][2]<h[_][2]&&(_=y))}if(_<0){_=0;for(var k=0;k<3;++k){for(var T=(k+2)%3,A=(k+1)%3,S=-1,E=-1,L=0;L<2;++L){var C=(P=L<<k)+(L<<T)+(1-L<<A),I=P+(1-L<<T)+(L<<A);l(h[P],h[C],h[I],d)<0||(L?S=1:E=1)}if(S<0||E<0)E>S&&(_|=1<<k);else{for(L=0;L<2;++L){C=(P=L<<k)+(L<<T)+(1-L<<A),I=P+(1-L<<T)+(L<<A);var P,D=i([u[P],u[C],u[I],u[P+(1<<T)+(1<<A)]]);L?S=D:E=D}E>S&&(_|=1<<k)}}}var z=7^_,O=-1;for(y=0;y<8;++y)y!==_&&y!==z&&(O<0?O=y:h[O][1]>h[y][1]&&(O=y));var F=-1;for(y=0;y<3;++y)(j=O^1<<y)!==_&&j!==z&&(F<0&&(F=j),(A=h[j])[0]<h[F][0]&&(F=j));var R=-1;for(y=0;y<3;++y){var j;(j=O^1<<y)!==_&&j!==z&&j!==F&&(R<0&&(R=j),(A=h[j])[0]>h[R][0]&&(R=j))}var N=m;N[0]=N[1]=N[2]=0,N[a.log2(F^O)]=O&F,N[a.log2(O^R)]=O&R;var B=7^R;B===_||B===z?(B=7^F,N[a.log2(R^B)]=B&R):N[a.log2(F^B)]=B&F;var U=g,V=_;for(k=0;k<3;++k)U[k]=V&1<<k?-1:1;return v};var a=t("bit-twiddle"),o=t("gl-mat4/multiply"),s=(t("gl-mat4/invert"),t("split-polygon")),l=t("robust-orientation"),c=new Array(16),u=(new Array(16),new Array(8)),h=new Array(8),f=new Array(3),d=[0,0,0];!function(){for(var t=0;t<8;++t)u[t]=[1,1,1,1],h[t]=[1,1,1]}();var p=[[0,0,1,0,0],[0,0,-1,1,0],[0,-1,0,1,0],[0,1,0,1,0],[-1,0,0,1,0],[1,0,0,1,0]],m=[1,1,1],g=[0,0,0],v={cubeEdges:m,axis:g}},{"bit-twiddle":68,"gl-mat4/invert":182,"gl-mat4/multiply":184,"robust-orientation":517,"split-polygon":535}],152:[function(t,e,r){"use strict";function n(t){return t[0]=t[1]=t[2]=0,t}function i(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t}function a(t,e,r,n,i,a,o,s){this.gl=t,this.vertBuffer=e,this.vao=r,this.shader=n,this.tickCount=i,this.tickOffset=a,this.gridCount=o,this.gridOffset=s}e.exports=function(t,e,r){var n=[],i=[0,0,0],c=[0,0,0],u=[0,0,0],h=[0,0,0];n.push(0,0,1,0,1,1,0,0,-1,0,0,-1,0,1,1,0,1,-1);for(var f=0;f<3;++f){for(var d=n.length/3|0,p=0;p<r[f].length;++p){var m=+r[f][p].x;n.push(m,0,1,m,1,1,m,0,-1,m,0,-1,m,1,1,m,1,-1)}var g=n.length/3|0;i[f]=d,c[f]=g-d,d=n.length/3|0;for(var v=0;v<r[f].length;++v)m=+r[f][v].x,n.push(m,0,1,m,1,1,m,0,-1,m,0,-1,m,1,1,m,1,-1);g=n.length/3|0,u[f]=d,h[f]=g-d}var y=o(t,new Float32Array(n)),b=s(t,[{buffer:y,type:t.FLOAT,size:3,stride:0,offset:0}]),x=l(t);return x.attributes.position.location=0,new a(t,y,b,x,c,i,h,u)};var o=t("gl-buffer"),s=t("gl-vao"),l=t("./shaders").line,c=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=[1,1],p=a.prototype;p.bind=function(t,e,r){this.shader.bind(),this.shader.uniforms.model=t,this.shader.uniforms.view=e,this.shader.uniforms.projection=r,d[0]=this.gl.drawingBufferWidth,d[1]=this.gl.drawingBufferHeight,this.shader.uniforms.screenShape=d,this.vao.bind()},p.drawAxisLine=function(t,e,r,a,o){var s=n(u);this.shader.uniforms.majorAxis=u,s[t]=e[1][t]-e[0][t],this.shader.uniforms.minorAxis=s;var l=i(f,r);l[t]+=e[0][t],this.shader.uniforms.offset=l,this.shader.uniforms.lineWidth=o,this.shader.uniforms.color=a;(c=n(h))[(t+2)%3]=1,this.shader.uniforms.screenAxis=c,this.vao.draw(this.gl.TRIANGLES,6);var c;(c=n(h))[(t+1)%3]=1,this.shader.uniforms.screenAxis=c,this.vao.draw(this.gl.TRIANGLES,6)},p.drawAxisTicks=function(t,e,r,i,a){if(this.tickCount[t]){var o=n(c);o[t]=1,this.shader.uniforms.majorAxis=o,this.shader.uniforms.offset=e,this.shader.uniforms.minorAxis=r,this.shader.uniforms.color=i,this.shader.uniforms.lineWidth=a;var s=n(h);s[t]=1,this.shader.uniforms.screenAxis=s,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}},p.drawGrid=function(t,e,r,a,o,s){if(this.gridCount[t]){var l=n(u);l[e]=r[1][e]-r[0][e],this.shader.uniforms.minorAxis=l;var d=i(f,a);d[e]+=r[0][e],this.shader.uniforms.offset=d;var p=n(c);p[t]=1,this.shader.uniforms.majorAxis=p;var m=n(h);m[t]=1,this.shader.uniforms.screenAxis=m,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=o,this.vao.draw(this.gl.TRIANGLES,this.gridCount[t],this.gridOffset[t])}},p.drawZero=function(t,e,r,a,o,s){var l=n(u);this.shader.uniforms.majorAxis=l,l[t]=r[1][t]-r[0][t],this.shader.uniforms.minorAxis=l;var c=i(f,a);c[t]+=r[0][t],this.shader.uniforms.offset=c;var d=n(h);d[e]=1,this.shader.uniforms.screenAxis=d,this.shader.uniforms.lineWidth=s,this.shader.uniforms.color=o,this.vao.draw(this.gl.TRIANGLES,6)},p.dispose=function(){this.vao.dispose(),this.vertBuffer.dispose(),this.shader.dispose()}},{"./shaders":153,"gl-buffer":157,"gl-vao":272}],153:[function(t,e,r){"use strict";var n=t("gl-shader");r.line=function(t){return n(t,"#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, majorAxis, minorAxis, screenAxis;\nuniform float lineWidth;\nuniform vec2 screenShape;\n\nvec3 project(vec3 p) {\n vec4 pp = projection * view * model * vec4(p, 1.0);\n return pp.xyz / max(pp.w, 0.0001);\n}\n\nvoid main() {\n vec3 major = position.x * majorAxis;\n vec3 minor = position.y * minorAxis;\n\n vec3 vPosition = major + minor + offset;\n vec3 pPosition = project(vPosition);\n vec3 offset = project(vPosition + screenAxis * position.z);\n\n vec2 screen = normalize((offset - pPosition).xy * screenShape) / screenShape;\n\n gl_Position = vec4(pPosition + vec3(0.5 * screen * lineWidth, 0), 1.0);\n}\n","precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}",null,[{name:"position",type:"vec3"}])};r.text=function(t){return n(t,"#define GLSLIFY 1\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\nuniform vec3 offset, axis;\nuniform float scale, angle, pixelScale;\nuniform vec2 resolution;\n\nvoid main() { \n //Compute plane offset\n vec2 planeCoord = position.xy * pixelScale;\n mat2 planeXform = scale * mat2(cos(angle), sin(angle),\n -sin(angle), cos(angle));\n vec2 viewOffset = 2.0 * planeXform * planeCoord / resolution;\n\n //Compute world offset\n float axisDistance = position.z;\n vec3 dataPosition = axisDistance * axis + offset;\n vec4 worldPosition = model * vec4(dataPosition, 1);\n \n //Compute clip position\n vec4 viewPosition = view * worldPosition;\n vec4 clipPosition = projection * viewPosition;\n clipPosition /= clipPosition.w;\n\n //Apply text offset in clip coordinates\n clipPosition += vec4(viewOffset, 0, 0);\n\n //Done\n gl_Position = clipPosition;\n}","precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}",null,[{name:"position",type:"vec3"}])};r.bg=function(t){return n(t,"#define GLSLIFY 1\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 if(dot(normal, enable) > 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 colors[3];\n\nvarying vec3 colorChannel;\n\nvoid main() {\n gl_FragColor = colorChannel.x * colors[0] + \n colorChannel.y * colors[1] +\n colorChannel.z * colors[2];\n}",null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])}},{"gl-shader":256}],154:[function(t,e,r){(function(r){"use strict";function n(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}e.exports=function(t,e,r,o,l,c){var u=i(t),h=a(t,[{buffer:u,size:3}]),f=s(t);f.attributes.position.location=0;var d=new n(t,f,u,h);return d.update(e,r,o,l,c),d};var i=t("gl-buffer"),a=t("gl-vao"),o=t("vectorize-text"),s=t("./shaders").text,l=window||r.global||{},c=l.__TEXT_CACHE||{};l.__TEXT_CACHE={};var u=n.prototype,h=[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,h[0]=this.gl.drawingBufferWidth,h[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=h},u.update=function(t,e,r,n,i){function a(t,e,r,n){var i=c[r];i||(i=c[r]={});var a=i[e];a||(a=i[e]=function(t,e){try{return o(t,e)}catch(t){return console.warn("error vectorizing text:",t),{cells:[],positions:[]}}}(e,{triangles:!0,font:r,textAlign:"center",textBaseline:"middle"}));for(var l=(n||12)/12,u=a.positions,h=a.cells,f=0,d=h.length;f<d;++f)for(var p=h[f],m=2;m>=0;--m){var g=u[p[m]];s.push(l*g[0],-l*g[1],t)}}this.gl;for(var s=[],l=[0,0,0],u=[0,0,0],h=[0,0,0],f=[0,0,0],d=0;d<3;++d){h[d]=s.length/3|0,a(.5*(t[0][d]+t[1][d]),e[d],r),f[d]=(s.length/3|0)-h[d],l[d]=s.length/3|0;for(var p=0;p<n[d].length;++p)n[d][p].text&&a(n[d][p].x,n[d][p].text,n[d][p].font||i,n[d][p].fontSize||12);u[d]=(s.length/3|0)-l[d]}this.buffer.update(s),this.tickOffset=l,this.tickCount=u,this.labelOffset=h,this.labelCount=f};var f=[0,0,0];u.drawTicks=function(t,e,r,n,i){if(this.tickCount[t]){var a=f;a[0]=a[1]=a[2]=0,a[t]=1,this.shader.uniforms.axis=a,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.tickCount[t],this.tickOffset[t])}};var d=[0,0,0];u.drawLabel=function(t,e,r,n,i){this.labelCount[t]&&(this.shader.uniforms.axis=d,this.shader.uniforms.color=i,this.shader.uniforms.angle=r,this.shader.uniforms.scale=e,this.shader.uniforms.offset=n,this.vao.draw(this.gl.TRIANGLES,this.labelCount[t],this.labelOffset[t]))},u.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()}}).call(this,t("_process"))},{"./shaders":153,_process:496,"gl-buffer":157,"gl-vao":272,"vectorize-text":563}],155:[function(t,e,r){"use strict";function n(t,e){var r=t+"",n=r.indexOf("."),i=0;n>=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 h=""+c;h.length<i;)h="0"+h;return u+"."+h}return u}r.create=function(t,e){for(var r=[],i=0;i<3;++i){for(var a=[],o=(t[0][i],t[1][i],0);o*e[i]<=t[1][i];++o)a.push({x:o*e[i],text:n(e[i],o)});for(o=-1;o*e[i]>=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;n<t[r].length;++n){var i=t[r][n],a=e[r][n];if(i.x!==a.x||i.text!==a.text||i.font!==a.font||i.fontColor!==a.fontColor||i.fontSize!==a.fontSize||i.dx!==a.dx||i.dy!==a.dy)return!1}}return!0}},{}],156:[function(t,e,r){"use strict";function n(t,e,r){this.lo=t,this.hi=e,this.pixelsPerDataUnit=r}function i(t,e,r,n,i){for(var a=0;a<3;++a){for(var o=d,s=p,l=0;l<3;++l)s[l]=o[l]=r[l];s[3]=o[3]=1,s[a]+=1,u(s,s,e),s[3]<0&&(t[a]=1/0),o[a]-=1,u(o,o,e),o[3]<0&&(t[a]=1/0);var c=(o[0]/o[3]-s[0]/s[3])*n,h=(o[1]/o[3]-s[1]/s[3])*i;t[a]=.25*Math.sqrt(c*c+h*h)}return t}e.exports=function(t,e,r,n,u){var d=e.model||h,p=e.view||h,v=e.projection||h,y=t.bounds,b=(u=u||s(d,p,v,y)).axis;u.edges,l(f,p,d),l(f,v,f);for(var x=m,_=0;_<3;++_)x[_].lo=1/0,x[_].hi=-1/0,x[_].pixelsPerDataUnit=1/0;var w=a(c(f,f));c(f,f);for(var M=0;M<3;++M){var k=(M+1)%3,T=(M+2)%3,A=g;t:for(_=0;_<2;++_){var S=[];if(b[M]<0!=!!_){A[M]=y[_][M];for(var E=0;E<2;++E){A[k]=y[E^_][k];for(var L=0;L<2;++L)A[T]=y[L^E^_][T],S.push(A.slice())}for(E=0;E<w.length;++E){if(0===S.length)continue t;S=o.positive(S,w[E])}for(E=0;E<S.length;++E){T=S[E];var C=i(g,f,T,r,n);for(L=0;L<3;++L)x[L].lo=Math.min(x[L].lo,T[L]),x[L].hi=Math.max(x[L].hi,T[L]),L!==M&&(x[L].pixelsPerDataUnit=Math.min(x[L].pixelsPerDataUnit,Math.abs(C[L])))}}}}return x};var a=t("extract-frustum-planes"),o=t("split-polygon"),s=t("./lib/cube.js"),l=t("gl-mat4/multiply"),c=t("gl-mat4/transpose"),u=t("gl-vec4/transformMat4"),h=new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),f=new Float32Array(16),d=[0,0,0,1],p=[0,0,0,1],m=[new n(1/0,-1/0,1/0),new n(1/0,-1/0,1/0),new n(1/0,-1/0,1/0)],g=[0,0,0]},{"./lib/cube.js":151,"extract-frustum-planes":131,"gl-mat4/multiply":184,"gl-mat4/transpose":192,"gl-vec4/transformMat4":278,"split-polygon":535}],157:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}function i(t,e,r,n,i,a){var o=i.length*i.BYTES_PER_ELEMENT;if(a<0)return t.bufferData(e,i,n),o;if(o+a>r)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function a(t,e){for(var r=o.malloc(t.length,e),n=t.length,i=0;i<n;++i)r[i]=t[i];return r}var o=t("typedarray-pool"),s=t("ndarray-ops"),l=t("ndarray"),c=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"],u=n.prototype;u.bind=function(){this.gl.bindBuffer(this.type,this.handle)},u.unbind=function(){this.gl.bindBuffer(this.type,null)},u.dispose=function(){this.gl.deleteBuffer(this.handle)},u.update=function(t,e){if("number"!=typeof e&&(e=-1),this.bind(),"object"==typeof t&&void 0!==t.shape){var r=t.dtype;if(c.indexOf(r)<0&&(r="float32"),this.type===this.gl.ELEMENT_ARRAY_BUFFER){r=gl.getExtension("OES_element_index_uint")&&"uint16"!==r?"uint32":"uint16"}if(r===t.dtype&&function(t,e){for(var r=1,n=e.length-1;n>=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=i(this.gl,this.type,this.length,this.usage,t.data,e):this.length=i(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=o.malloc(t.size,r),u=l(n,t.shape);s.assign(u,t),this.length=i(this.gl,this.type,this.length,this.usage,e<0?n:n.subarray(0,t.size),e),o.free(n)}}else if(Array.isArray(t)){var h;h=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=i(this.gl,this.type,this.length,this.usage,e<0?h:h.subarray(0,t.length),e),o.free(h)}else if("object"==typeof t&&"number"==typeof t.length)this.length=i(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,i){if(r=r||t.ARRAY_BUFFER,i=i||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(i!==t.DYNAMIC_DRAW&&i!==t.STATIC_DRAW&&i!==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=new n(t,r,t.createBuffer(),0,i);return a.update(e),a}},{ndarray:468,"ndarray-ops":462,"typedarray-pool":550}],158:[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"}},{}],159:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":158}],160:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.shader=e,this.bufferHi=r,this.bufferLo=n,this.bounds=[1/0,1/0,-1/0,-1/0],this.numPoints=0,this.color=[0,0,0,1]}var i=t("gl-shader"),a=t("gl-buffer"),o=t("typedarray-pool"),s=t("./lib/shaders");e.exports=function(t,e){var r=new n(t,i(t.gl,s.vertex,s.fragment),a(t.gl),a(t.gl));return r.update(e),t.addObject(r),r};var l=[[1,0,0,1,0,0],[1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,-1,0,0],[-1,0,0,1,0,0],[1,0,0,1,0,0],[1,0,-1,0,0,1],[1,0,-1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,-1],[1,0,1,0,0,1],[1,0,-1,0,0,1],[-1,0,-1,0,0,1],[-1,0,-1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,-1],[-1,0,1,0,0,1],[-1,0,-1,0,0,1],[0,1,1,0,0,0],[0,1,-1,0,0,0],[0,-1,-1,0,0,0],[0,-1,-1,0,0,0],[0,1,1,0,0,0],[0,-1,1,0,0,0],[0,1,0,-1,1,0],[0,1,0,-1,-1,0],[0,1,0,1,-1,0],[0,1,0,1,1,0],[0,1,0,-1,1,0],[0,1,0,1,-1,0],[0,-1,0,-1,1,0],[0,-1,0,-1,-1,0],[0,-1,0,1,-1,0],[0,-1,0,1,1,0],[0,-1,0,-1,1,0],[0,-1,0,1,-1,0]],c=n.prototype;c.draw=function(){var t=new Float32Array([0,0]),e=new Float32Array([0,0]),r=new Float32Array([0,0]),n=new Float32Array([0,0]),i=[1,1];return function(){var a=this.plot,o=this.shader,s=this.bounds,c=this.numPoints;if(c){var u=a.gl,h=a.dataBox,f=a.viewBox,d=a.pixelRatio,p=s[2]-s[0],m=s[3]-s[1],g=h[2]-h[0],v=h[3]-h[1],y=2*p/g,b=2*m/v,x=(s[0]-h[0]-.5*g)/p,_=(s[1]-h[1]-.5*v)/m;t[0]=y,t[1]=b,e[0]=y-t[0],e[1]=b-t[1],r[0]=x,r[1]=_,n[0]=x-r[0],n[1]=_-r[1];var w=f[2]-f[0],M=f[3]-f[1];i[0]=2*d/w,i[1]=2*d/M,o.bind(),o.uniforms.scaleHi=t,o.uniforms.scaleLo=e,o.uniforms.translateHi=r,o.uniforms.translateLo=n,o.uniforms.pixelScale=i,o.uniforms.color=this.color,this.bufferLo.bind(),o.attributes.positionLo.pointer(u.FLOAT,!1,16,0),this.bufferHi.bind(),o.attributes.positionHi.pointer(u.FLOAT,!1,16,0),o.attributes.pixelOffset.pointer(u.FLOAT,!1,16,8),u.drawArrays(u.TRIANGLES,0,c*l.length)}}}(),c.drawPick=function(t){return t},c.pick=function(){return null},c.update=function(t){var e,r,n,i=(t=t||{}).positions||[],a=t.errors||[],s=1;"lineWidth"in t&&(s=+t.lineWidth);var c=5;"capSize"in t&&(c=+t.capSize),this.color=(t.color||[0,0,0,1]).slice();var u=this.bounds=[1/0,1/0,-1/0,-1/0],h=this.numPoints=i.length>>1;for(e=0;e<h;++e)r=i[2*e],n=i[2*e+1],u[0]=Math.min(r,u[0]),u[1]=Math.min(n,u[1]),u[2]=Math.max(r,u[2]),u[3]=Math.max(n,u[3]);u[2]===u[0]&&(u[2]+=1),u[3]===u[1]&&(u[3]+=1);var f=1/(u[2]-u[0]),d=1/(u[3]-u[1]),p=u[0],m=u[1],g=o.mallocFloat64(h*l.length*4),v=o.mallocFloat32(h*l.length*4),y=o.mallocFloat32(h*l.length*4),b=0;for(e=0;e<h;++e){r=i[2*e],n=i[2*e+1];for(var x=a[4*e],_=a[4*e+1],w=a[4*e+2],M=a[4*e+3],k=0;k<l.length;++k){var T=l[k],A=T[0],S=T[1];A<0?A*=x:A>0&&(A*=_),S<0?S*=w:S>0&&(S*=M),g[b++]=f*(r-p+A),g[b++]=d*(n-m+S),g[b++]=s*T[2]+(c+s)*T[4],g[b++]=s*T[3]+(c+s)*T[5]}}for(e=0;e<g.length;e++)v[e]=g[e],y[e]=g[e]-v[e];this.bufferHi.update(v),this.bufferLo.update(y),o.free(g)},c.dispose=function(){this.plot.removeObject(this),this.shader.dispose(),this.bufferHi.dispose(),this.bufferLo.dispose()}},{"./lib/shaders":161,"gl-buffer":157,"gl-shader":256,"typedarray-pool":550}],161:[function(t,e,r){e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi;\nattribute vec2 positionLo;\nattribute vec2 pixelOffset;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo, pixelScale;\n\nvec2 project(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\nvoid main() {\n vec3 scrPosition = vec3(\n project(scaleHi, translateHi, scaleLo, translateLo, positionHi, positionLo),\n 1);\n gl_Position = vec4(\n scrPosition.xy + scrPosition.z * pixelScale * pixelOffset,\n 0,\n scrPosition.z);\n}\n",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}\n"}},{}],162:[function(t,e,r){"use strict";function n(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}function i(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])}function a(t,e,r,n){for(var i=h[n],a=0;a<i.length;++a){var o=i[a];t.push(e[0],e[1],e[2],r[0],r[1],r[2],r[3],o[0],o[1],o[2])}return i.length}e.exports=function(t){var e=t.gl,r=o(e),i=s(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}]),a=l(e);a.attributes.position.location=0,a.attributes.color.location=1,a.attributes.offset.location=2;var c=new n(e,r,i,a);return c.update(t),c};var o=t("gl-buffer"),s=t("gl-vao"),l=t("./shaders/index"),c=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],u=n.prototype;u.isOpaque=function(){return this.opacity>=1},u.isTransparent=function(){return this.opacity<1},u.drawTransparent=u.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||c,i=r.projection=t.projection||c;r.model=t.model||c,r.clipBounds=this.clipBounds,r.opacity=this.opacity;var a=n[12],o=n[13],s=n[14],l=n[15],u=this.pixelRatio*(i[3]*a+i[7]*o+i[11]*s+i[15]*l)/e.drawingBufferHeight;this.vao.bind();for(var h=0;h<3;++h)e.lineWidth(this.lineWidth[h]),r.capSize=this.capSize[h]*u,this.lineCount[h]&&e.drawArrays(e.LINES,this.lineOffset[h],this.lineCount[h]);this.vao.unbind()};var h=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}();u.update=function(t){"lineWidth"in(t=t||{})&&(this.lineWidth=t.lineWidth,Array.isArray(this.lineWidth)||(this.lineWidth=[this.lineWidth,this.lineWidth,this.lineWidth])),"capSize"in t&&(this.capSize=t.capSize,Array.isArray(this.capSize)||(this.capSize=[this.capSize,this.capSize,this.capSize])),"opacity"in t&&(this.opacity=t.opacity);var e=t.color||[[0,0,0],[0,0,0],[0,0,0]],r=t.position,n=t.error;if(Array.isArray(e[0])||(e=[e,e,e]),r&&n){var o=[],s=r.length,l=0;this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.lineCount=[0,0,0];for(var c=0;c<3;++c){this.lineOffset[c]=l;t:for(var u=0;u<s;++u){for(var h=r[u],f=0;f<3;++f)if(isNaN(h[f])||!isFinite(h[f]))continue t;var d=n[u],p=e[c];if(Array.isArray(p[0])&&(p=e[u]),3===p.length&&(p=[p[0],p[1],p[2],1]),!isNaN(d[0][c])&&!isNaN(d[1][c])){if(d[0][c]<0){(m=h.slice())[c]+=d[0][c],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,p,c)}if(d[1][c]>0){var m;(m=h.slice())[c]+=d[1][c],o.push(h[0],h[1],h[2],p[0],p[1],p[2],p[3],0,0,0,m[0],m[1],m[2],p[0],p[1],p[2],p[3],0,0,0),i(this.bounds,m),l+=2+a(o,m,p,c)}}}this.lineCount[c]=l-this.lineOffset[c]}this.buffer.update(o)}},u.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()}},{"./shaders/index":164,"gl-buffer":157,"gl-vao":272}],163:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n<t.length-1;n++)r.push(t[n],e[n]||"");return r.push(t[n]),r.join("")}},{}],164:[function(t,e,r){"use strict";var n=t("glslify"),i=t("gl-shader"),a=n(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, offset;\nattribute vec4 color;\nuniform mat4 model, view, projection;\nuniform float capSize;\nvarying vec4 fragColor;\nvarying vec3 fragPosition;\n\nvoid main() {\n vec4 worldPosition = model * vec4(position, 1.0);\n worldPosition = (worldPosition / worldPosition.w) + vec4(capSize * offset, 0.0);\n gl_Position = projection * view * worldPosition;\n fragColor = color;\n fragPosition = position;\n}"]),o=n(["precision mediump float;\n#define GLSLIFY 1\nuniform vec3 clipBounds[2];\nuniform float opacity;\nvarying vec3 fragPosition;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(fragPosition, clipBounds[0])) || any(greaterThan(fragPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = opacity * fragColor;\n}"]);e.exports=function(t){return i(t,a,o,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])}},{"gl-shader":256,glslify:163}],165:[function(t,e,r){"use strict";function n(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function i(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function a(t){switch(t){case h:throw new Error("gl-fbo: Framebuffer unsupported");case f:throw new Error("gl-fbo: Framebuffer incomplete attachment");case d:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case p:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function o(t,e,r,n,i,a){if(!n)return null;var o=u(t,e,r,i,n);return o.magFilter=t.NEAREST,o.minFilter=t.NEAREST,o.mipSamples=1,o.bind(),t.framebufferTexture2D(t.FRAMEBUFFER,a,t.TEXTURE_2D,o.handle,0),o}function s(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 l(t,e,r,l,c,u,h,f){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=f,this.color=new Array(c);for(var d=0;d<c;++d)this.color[d]=null;this._color_rb=null,this.depth=null,this._depth_rb=null,this._colorType=l,this._useDepth=u,this._useStencil=h;var p=this,g=[0|e,0|r];Object.defineProperties(g,{0:{get:function(){return p._shape[0]},set:function(t){return p.width=t}},1:{get:function(){return p._shape[1]},set:function(t){return p.height=t}}}),this._shapeVector=g,function(t){var e=n(t.gl),r=t.gl,l=t.handle=r.createFramebuffer(),c=t._shape[0],u=t._shape[1],h=t.color.length,f=t._ext,d=t._useStencil,p=t._useDepth,g=t._colorType;r.bindFramebuffer(r.FRAMEBUFFER,l);for(var v=0;v<h;++v)t.color[v]=o(r,c,u,g,r.RGBA,r.COLOR_ATTACHMENT0+v);0===h?(t._color_rb=s(r,c,u,r.RGBA4,r.COLOR_ATTACHMENT0),f&&f.drawBuffersWEBGL(m[0])):h>1&&f.drawBuffersWEBGL(m[h]);var y=r.getExtension("WEBGL_depth_texture");y?d?t.depth=o(r,c,u,y.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p&&(t.depth=o(r,c,u,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):p&&d?t._depth_rb=s(r,c,u,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):p?t._depth_rb=s(r,c,u,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):d&&(t._depth_rb=s(r,c,u,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var b=r.checkFramebufferStatus(r.FRAMEBUFFER);if(b!==r.FRAMEBUFFER_COMPLETE){for(t._destroyed=!0,r.bindFramebuffer(r.FRAMEBUFFER,null),r.deleteFramebuffer(t.handle),t.handle=null,t.depth&&(t.depth.dispose(),t.depth=null),t._depth_rb&&(r.deleteRenderbuffer(t._depth_rb),t._depth_rb=null),v=0;v<t.color.length;++v)t.color[v].dispose(),t.color[v]=null;t._color_rb&&(r.deleteRenderbuffer(t._color_rb),t._color_rb=null),i(r,e),a(b)}i(r,e)}(this)}function c(t,e,r){if(t._destroyed)throw new Error("gl-fbo: Can't resize destroyed FBO");if(t._shape[0]!==e||t._shape[1]!==r){var o=t.gl,s=o.getParameter(o.MAX_RENDERBUFFER_SIZE);if(e<0||e>s||r<0||r>s)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var l=n(o),c=0;c<t.color.length;++c)t.color[c].shape=t._shape;t._color_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._color_rb),o.renderbufferStorage(o.RENDERBUFFER,o.RGBA4,t._shape[0],t._shape[1])),t.depth&&(t.depth.shape=t._shape),t._depth_rb&&(o.bindRenderbuffer(o.RENDERBUFFER,t._depth_rb),t._useDepth&&t._useStencil?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_STENCIL,t._shape[0],t._shape[1]):t._useDepth?o.renderbufferStorage(o.RENDERBUFFER,o.DEPTH_COMPONENT16,t._shape[0],t._shape[1]):t._useStencil&&o.renderbufferStorage(o.RENDERBUFFER,o.STENCIL_INDEX,t._shape[0],t._shape[1])),o.bindFramebuffer(o.FRAMEBUFFER,t.handle);var u=o.checkFramebufferStatus(o.FRAMEBUFFER);u!==o.FRAMEBUFFER_COMPLETE&&(t.dispose(),i(o,l),a(u)),i(o,l)}}var u=t("gl-texture2d");e.exports=function(t,e,r,n){h||(h=t.FRAMEBUFFER_UNSUPPORTED,f=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,d=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,p=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var i=t.getExtension("WEBGL_draw_buffers");if(!m&&i&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);m=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;a<n;++a)i[a]=t.COLOR_ATTACHMENT0+a;for(a=n;a<r;++a)i[a]=t.NONE;m[n]=i}}(t,i),Array.isArray(e)&&(n=r,r=0|e[1],e=0|e[0]),"number"!=typeof e)throw new Error("gl-fbo: Missing shape parameter");var a=t.getParameter(t.MAX_RENDERBUFFER_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-fbo: Parameters are too large for FBO");var o=1;if("color"in(n=n||{})){if((o=Math.max(0|n.color,0))<0)throw new Error("gl-fbo: Must specify a nonnegative number of colors");if(o>1){if(!i)throw new Error("gl-fbo: Multiple draw buffer extension not supported");if(o>t.getParameter(i.MAX_COLOR_ATTACHMENTS_WEBGL))throw new Error("gl-fbo: Context does not support "+o+" draw buffers")}}var s=t.UNSIGNED_BYTE,c=t.getExtension("OES_texture_float");if(n.float&&o>0){if(!c)throw new Error("gl-fbo: Context does not support floating point textures");s=t.FLOAT}else n.preferFloat&&o>0&&c&&(s=t.FLOAT);var u=!0;"depth"in n&&(u=!!n.depth);var g=!1;return"stencil"in n&&(g=!!n.stencil),new l(t,e,r,s,o,u,g,i)};var h,f,d,p,m=null,g=l.prototype;Object.defineProperties(g,{shape:{get:function(){return this._destroyed?[0,0]:this._shapeVector},set:function(t){if(Array.isArray(t)||(t=[0|t,0|t]),2!==t.length)throw new Error("gl-fbo: Shape vector must be length 2");var e=0|t[0],r=0|t[1];return c(this,e,r),[e,r]},enumerable:!1},width:{get:function(){return this._destroyed?0:this._shape[0]},set:function(t){return t|=0,c(this,t,this._shape[1]),t},enumerable:!1},height:{get:function(){return this._destroyed?0:this._shape[1]},set:function(t){return t|=0,c(this,this._shape[0],t),t},enumerable:!1}}),g.bind=function(){if(!this._destroyed){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,this.handle),t.viewport(0,0,this._shape[0],this._shape[1])}},g.dispose=function(){if(!this._destroyed){this._destroyed=!0;var t=this.gl;t.deleteFramebuffer(this.handle),this.handle=null,this.depth&&(this.depth.dispose(),this.depth=null),this._depth_rb&&(t.deleteRenderbuffer(this._depth_rb),this._depth_rb=null);for(var e=0;e<this.color.length;++e)this.color[e].dispose(),this.color[e]=null;this._color_rb&&(t.deleteRenderbuffer(this._color_rb),this._color_rb=null)}}},{"gl-texture2d":268}],166:[function(t,e,r){var n=t("sprintf-js").sprintf,i=t("gl-constants/lookup"),a=t("glsl-shader-name"),o=t("add-line-numbers");e.exports=function(t,e,r){"use strict";var s=a(e)||"of unknown name (see npm glsl-shader-name)",l="unknown type";void 0!==r&&(l=r===i.FRAGMENT_SHADER?"fragment":"vertex");for(var c=n("Error compiling %s shader %s:\n",l,s),u=n("%s%s",c,t),h=t.split("\n"),f={},d=0;d<h.length;d++){var p=h[d];if(""!==p){var m=parseInt(p.split(":")[2]);if(isNaN(m))throw new Error(n("Could not parse error: %s",p));f[m]=p}}var g=o(e).split("\n");for(d=0;d<g.length;d++)if((f[d+3]||f[d+2]||f[d+1])&&(c+=g[d]+"\n",f[d+1])){var v=f[d+1];v=v.substr(v.split(":",3).join(":").length+1).trim(),c+=n("^^^ %s\n\n",v)}return{long:c.trim(),short:u.trim()}}},{"add-line-numbers":41,"gl-constants/lookup":159,"glsl-shader-name":280,"sprintf-js":536}],167:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.weightBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.xData=[],this.yData=[],this.shape=[0,0],this.bounds=[1/0,1/0,-1/0,-1/0],this.pickOffset=0}e.exports=function(t,e){var r=t.gl,i=new n(t,s(r,c.vertex,c.fragment),s(r,c.pickVertex,c.pickFragment),l(r),l(r),l(r),l(r));return i.update(e),t.addObject(i),i};var i=t("binary-search-bounds"),a=t("iota-array"),o=t("typedarray-pool"),s=t("gl-shader"),l=t("gl-buffer"),c=t("./lib/shaders"),u=n.prototype,h=[0,0,1,0,0,1,1,0,1,1,0,1];u.draw=function(){var t=[1,0,0,0,1,0,0,0,1];return function(){var e=this.plot,r=this.shader,n=this.bounds,i=this.numVertices;if(!(i<=0)){var a=e.gl,o=e.dataBox,s=n[2]-n[0],l=n[3]-n[1],c=o[2]-o[0],u=o[3]-o[1];t[0]=2*s/c,t[4]=2*l/u,t[6]=2*(n[0]-o[0])/c-1,t[7]=2*(n[1]-o[1])/u-1,r.bind();var h=r.uniforms;h.viewTransform=t,h.shape=this.shape;var f=r.attributes;this.positionBuffer.bind(),f.position.pointer(),this.weightBuffer.bind(),f.weight.pointer(a.UNSIGNED_BYTE,!1),this.colorBuffer.bind(),f.color.pointer(a.UNSIGNED_BYTE,!0),a.drawArrays(a.TRIANGLES,0,i)}}}(),u.drawPick=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=this.plot,i=this.pickShader,a=this.bounds,o=this.numVertices;if(!(o<=0)){var s=n.gl,l=n.dataBox,c=a[2]-a[0],u=a[3]-a[1],h=l[2]-l[0],f=l[3]-l[1];t[0]=2*c/h,t[4]=2*u/f,t[6]=2*(a[0]-l[0])/h-1,t[7]=2*(a[1]-l[1])/f-1;for(var d=0;d<4;++d)e[d]=r>>8*d&255;this.pickOffset=r,i.bind();var p=i.uniforms;p.viewTransform=t,p.pickOffset=e,p.shape=this.shape;var m=i.attributes;return this.positionBuffer.bind(),m.position.pointer(),this.weightBuffer.bind(),m.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),m.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),u.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(r<n||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]]}},u.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||a(e[0]),n=t.y||a(e[1]),s=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var l=t.colorLevels||[0],c=t.colorValues||[0,0,0,1],u=l.length,f=this.bounds,d=f[0]=r[0],p=f[1]=n[0],m=1/((f[2]=r[r.length-1])-d),g=1/((f[3]=n[n.length-1])-p),v=e[0],y=e[1];this.shape=[v,y];var b=(v-1)*(y-1)*(h.length>>>1);this.numVertices=b;for(var x=o.mallocUint8(4*b),_=o.mallocFloat32(2*b),w=o.mallocUint8(2*b),M=o.mallocUint32(b),k=0,T=0;T<y-1;++T)for(var A=g*(n[T]-p),S=g*(n[T+1]-p),E=0;E<v-1;++E)for(var L=m*(r[E]-d),C=m*(r[E+1]-d),I=0;I<h.length;I+=2){var P,D,z,O,F=h[I],R=h[I+1],j=s[(T+R)*v+(E+F)],N=i.le(l,j);if(N<0)P=c[0],D=c[1],z=c[2],O=c[3];else if(N===u-1)P=c[4*u-4],D=c[4*u-3],z=c[4*u-2],O=c[4*u-1];else{var B=(j-l[N])/(l[N+1]-l[N]),U=1-B,V=4*N,H=4*(N+1);P=U*c[V]+B*c[H],D=U*c[V+1]+B*c[H+1],z=U*c[V+2]+B*c[H+2],O=U*c[V+3]+B*c[H+3]}x[4*k]=255*P,x[4*k+1]=255*D,x[4*k+2]=255*z,x[4*k+3]=255*O,_[2*k]=.5*L+.5*C,_[2*k+1]=.5*A+.5*S,w[2*k]=F,w[2*k+1]=R,M[k]=T*v+E,k+=1}this.positionBuffer.update(_),this.weightBuffer.update(w),this.colorBuffer.update(x),this.idBuffer.update(M),o.free(_),o.free(x),o.free(w),o.free(M)},u.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.weightBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":168,"binary-search-bounds":169,"gl-buffer":157,"gl-shader":256,"iota-array":294,"typedarray-pool":550}],168:[function(t,e,r){"use strict";e.exports={fragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = vec4(fragColor.rgb * fragColor.a, fragColor.a);\n}\n",vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position;\nattribute vec4 color;\nattribute vec2 weight;\n\nuniform vec2 shape;\nuniform mat3 viewTransform;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vPosition = viewTransform * vec3( position + (weight-.5)/(shape-1.) , 1.0);\n fragColor = color;\n gl_Position = vec4(vPosition.xy, 0, vPosition.z);\n}\n",pickFragment:"precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragId;\nvarying vec2 vWeight;\n\nuniform vec2 shape;\nuniform vec4 pickOffset;\n\nvoid main() {\n vec2 d = step(.5, vWeight);\n vec4 id = fragId + pickOffset;\n id.x += d.x + d.y*shape.x;\n\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 gl_FragColor = id/255.;\n}\n",pickVertex:"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"}},{}],169:[function(t,e,r){arguments[4][85][0].apply(r,arguments)},{dup:85}],170:[function(t,e,r){r.lineVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi, dLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec2 direction;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvec2 project_2_1(vec2 scHi, vec2 scLo, vec2 posHi, vec2 posLo) {\n return scHi * posHi\n + scLo * posHi\n + scHi * posLo\n + scLo * posLo;\n}\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 dir = project_2_1(scaleHi, scaleLo, dHi, dLo);\n vec2 n = 0.5 * width * normalize(screenShape.yx * vec2(dir.y, -dir.x)) / screenShape.xy;\n vec2 tangent = normalize(screenShape.xy * dir);\n if(dir.x < 0.0 || (dir.x == 0.0 && dir.y < 0.0)) {\n direction = -tangent;\n } else {\n direction = tangent;\n }\n gl_Position = vec4(p + n, 0.0, 1.0);\n}",r.lineFragment="precision highp float;\n#define GLSLIFY 1\n\nuniform vec4 color;\nuniform vec2 screenShape;\nuniform sampler2D dashPattern;\nuniform float dashLength;\n\nvarying vec2 direction;\n\nvoid main() {\n float t = fract(dot(direction, gl_FragCoord.xy) / dashLength);\n vec4 pcolor = color * texture2D(dashPattern, vec2(t, 0.0)).r;\n gl_FragColor = vec4(pcolor.rgb * pcolor.a, pcolor.a);\n}",r.mitreVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo;\nuniform float radius;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n gl_Position = vec4(p, 0.0, 1.0);\n gl_PointSize = radius;\n}",r.mitreFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n if(length(gl_PointCoord.xy - 0.5) > 0.25) {\n discard;\n }\n gl_FragColor = vec4(color.rgb, color.a);\n}",r.pickVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\nattribute vec4 pick0, pick1;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, screenShape;\nuniform float width;\n\nvarying vec4 pickA, pickB;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n vec2 n = width * normalize(screenShape.yx * vec2(dHi.y, -dHi.x)) / screenShape.xy;\n gl_Position = vec4(p + n, 0, 1);\n pickA = pick0;\n pickB = pick1;\n}",r.pickFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 pickOffset;\n\nvarying vec4 pickA, pickB;\n\nvoid main() {\n vec4 fragId = vec4(pickA.xyz, 0.0);\n if(pickB.w > pickA.w) {\n fragId.xyz = pickB.xyz;\n }\n\n fragId += pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n gl_FragColor = fragId / 255.0;\n}",r.fillVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aHi, aLo, dHi;\n\nuniform vec2 scaleHi, translateHi, scaleLo, translateLo, projectAxis;\nuniform float projectValue, depth;\n\n\nvec2 project_1_0(vec2 scHi, vec2 trHi, vec2 scLo, vec2 trLo, vec2 posHi, vec2 posLo) {\n return (posHi + trHi) * scHi\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo;\n}\n\n\nvoid main() {\n vec2 p = project_1_0(scaleHi, translateHi, scaleLo, translateLo, aHi, aLo);\n if(dHi.y < 0.0 || (dHi.y == 0.0 && dHi.x < 0.0)) {\n if(dot(p, projectAxis) < projectValue) {\n p = p * (1.0 - abs(projectAxis)) + projectAxis * projectValue;\n }\n }\n gl_Position = vec4(p, depth, 1);\n}",r.fillFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = vec4(color.rgb * color.a, color.a);\n}"},{}],171:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l){this.plot=t,this.dashPattern=e,this.lineBufferHi=r,this.lineBufferLo=n,this.pickBuffer=i,this.lineShader=a,this.mitreShader=o,this.fillShader=s,this.pickShader=l,this.usingDashes=!1,this.bounds=[1/0,1/0,-1/0,-1/0],this.width=1,this.color=[0,0,1,1],this.fill=[!1,!1,!1,!1],this.fillColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.data=null,this.numPoints=0,this.vertCount=0,this.pickOffset=0}e.exports=function(t,e){var r=t.gl,s=a(r),l=a(r),u=a(r),h=new n(t,o(r,[1,1]),s,l,u,i(r,c.lineVertex,c.lineFragment),i(r,c.mitreVertex,c.mitreFragment),i(r,c.fillVertex,c.fillFragment),i(r,c.pickVertex,c.pickFragment));return t.addObject(h),h.update(e),h};var i=t("gl-shader"),a=t("gl-buffer"),o=t("gl-texture2d"),s=t("ndarray"),l=t("typedarray-pool"),c=t("./lib/shaders"),u=n.prototype;u.setProjectionModel=function(){var t={scaleHi:new Float32Array([0,0]),scaleLo:new Float32Array([0,0]),translateHi:new Float32Array([0,0]),translateLo:new Float32Array([0,0]),screenShape:[0,0]};return function(){var e=this.bounds,r=this.plot.viewBox,n=this.plot.dataBox,i=e[2]-e[0],a=e[3]-e[1],o=n[2]-n[0],s=n[3]-n[1],l=r[2]-r[0],c=r[3]-r[1],u=2*i/o,h=2*a/s,f=(e[0]-n[0]-.5*o)/i,d=(e[1]-n[1]-.5*s)/a;return t.scaleHi[0]=u,t.scaleHi[1]=h,t.scaleLo[0]=u-t.scaleHi[0],t.scaleLo[1]=h-t.scaleHi[1],t.translateHi[0]=f,t.translateHi[1]=d,t.translateLo[0]=f-t.translateHi[0],t.translateLo[1]=d-t.translateHi[1],t.screenShape[0]=l,t.screenShape[1]=c,t}}(),u.setProjectionUniforms=function(t,e){t.scaleHi=e.scaleHi,t.scaleLo=e.scaleLo,t.translateHi=e.translateHi,t.translateLo=e.translateLo,t.screenShape=e.screenShape},u.draw=function(){var t=[1,0],e=[-1,0],r=[0,1],n=[0,-1];return function(){var i=this.vertCount;if(i){var a=this.setProjectionModel(),o=this.plot,s=this.width,l=o.gl,c=o.pixelRatio,u=this.color,h=this.fillShader.attributes;this.lineBufferLo.bind(),h.aLo.pointer(l.FLOAT,!1,16,0),this.lineBufferHi.bind();var f=this.fill;if(f[0]||f[1]||f[2]||f[3]){var d=this.fillShader;d.bind();var p=d.uniforms;this.setProjectionUniforms(p,a),p.depth=o.nextDepthValue(),h.aHi.pointer(l.FLOAT,!1,16,0),h.dHi.pointer(l.FLOAT,!1,16,8),l.depthMask(!0),l.enable(l.DEPTH_TEST);var m=this.fillColor;f[0]&&(p.color=m[0],p.projectAxis=e,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),f[1]&&(p.color=m[1],p.projectAxis=n,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),f[2]&&(p.color=m[2],p.projectAxis=t,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),f[3]&&(p.color=m[3],p.projectAxis=r,p.projectValue=1,l.drawArrays(l.TRIANGLES,0,i)),l.depthMask(!1),l.disable(l.DEPTH_TEST)}var g=this.lineShader;g.bind(),this.lineBufferLo.bind(),g.attributes.aLo.pointer(l.FLOAT,!1,16,0),g.attributes.dLo.pointer(l.FLOAT,!1,16,8),this.lineBufferHi.bind();var v=g.uniforms;this.setProjectionUniforms(v,a),v.color=u,v.width=s*c,v.dashPattern=this.dashPattern.bind(),v.dashLength=this.dashLength*c;var y=g.attributes;if(y.aHi.pointer(l.FLOAT,!1,16,0),y.dHi.pointer(l.FLOAT,!1,16,8),l.drawArrays(l.TRIANGLES,0,i),s>2&&!this.usingDashes){var b=this.mitreShader;this.lineBufferLo.bind(),b.attributes.aLo.pointer(l.FLOAT,!1,48,0),this.lineBufferHi.bind(),b.bind();var x=b.uniforms;this.setProjectionUniforms(x,a),x.color=u,x.radius=s*c,b.attributes.aHi.pointer(l.FLOAT,!1,48,0),l.drawArrays(l.POINTS,0,i/3|0)}}}}(),u.drawPick=function(){var t=[0,0,0,0];return function(e){var r=this.vertCount,n=this.numPoints;if(this.pickOffset=e,!r)return e+n;var i=this.setProjectionModel(),a=this.plot,o=this.width,s=a.gl,l=a.pickPixelRatio,c=this.pickShader,u=this.pickBuffer;t[0]=255&e,t[1]=e>>>8&255,t[2]=e>>>16&255,t[3]=e>>>24,c.bind();var h=c.uniforms;this.setProjectionUniforms(h,i),h.width=o*l,h.pickOffset=t;var f=c.attributes;return this.lineBufferHi.bind(),f.aHi.pointer(s.FLOAT,!1,16,0),f.dHi.pointer(s.FLOAT,!1,16,8),this.lineBufferLo.bind(),f.aLo.pointer(s.FLOAT,!1,16,0),u.bind(),f.pick0.pointer(s.UNSIGNED_BYTE,!1,8,0),f.pick1.pointer(s.UNSIGNED_BYTE,!1,8,4),s.drawArrays(s.TRIANGLES,0,r),e+n}}(),u.pick=function(t,e,r){var n=this.pickOffset,i=this.numPoints;if(r<n||r>=n+i)return null;var a=r-n,o=this.data;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}},u.update=function(t){t=t||{};var e,r,n,i,a,c=this.plot.gl;this.color=(t.color||[0,0,1,1]).slice(),this.width=+(t.width||1),this.fill=(t.fill||[!1,!1,!1,!1]).slice(),this.fillColor=function(t){return t.map(function(t){return t.slice()})}(t.fillColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var u=t.dashes||[1],h=0;for(e=0;e<u.length;++e)h+=u[e];var f=l.mallocUint8(h);n=0;var d=255;for(e=0;e<u.length;++e){for(r=0;r<u[e];++r)f[n++]=d;d^=255}this.dashPattern.dispose(),this.usingDashes=u.length>1,this.dashPattern=o(c,s(f,[h,1,4],[1,0,0])),this.dashPattern.minFilter=c.NEAREST,this.dashPattern.magFilter=c.NEAREST,this.dashLength=h,l.free(f);var p=t.positions;this.data=p;var m=this.bounds;m[0]=m[1]=1/0,m[2]=m[3]=-1/0;var g=this.numPoints=p.length>>>1;if(0!==g){for(e=0;e<g;++e)i=p[2*e],a=p[2*e+1],isNaN(i)||isNaN(a)||(m[0]=Math.min(m[0],i),m[1]=Math.min(m[1],a),m[2]=Math.max(m[2],i),m[3]=Math.max(m[3],a));m[0]===m[2]&&(m[2]+=1),m[3]===m[1]&&(m[3]+=1);var v=l.mallocFloat64(24*(g-1)),y=l.mallocFloat32(24*(g-1)),b=l.mallocFloat32(24*(g-1)),x=l.mallocUint32(12*(g-1)),_=y.length,w=x.length;n=g;for(var M=0;n>1;){var k=--n;i=p[2*n],a=p[2*n+1];var T=k-1,A=p[2*T],S=p[2*T+1];if(!(isNaN(i)||isNaN(a)||isNaN(A)||isNaN(S))){M+=1,i=(i-m[0])/(m[2]-m[0]),a=(a-m[1])/(m[3]-m[1]);var E=(A=(A-m[0])/(m[2]-m[0]))-i,L=(S=(S-m[1])/(m[3]-m[1]))-a,C=k|1<<24,I=k-1,P=k,D=k-1|1<<24;v[--_]=-L,v[--_]=-E,v[--_]=a,v[--_]=i,x[--w]=C,x[--w]=I,v[--_]=L,v[--_]=E,v[--_]=S,v[--_]=A,x[--w]=P,x[--w]=D,v[--_]=-L,v[--_]=-E,v[--_]=S,v[--_]=A,x[--w]=P,x[--w]=D,v[--_]=L,v[--_]=E,v[--_]=S,v[--_]=A,x[--w]=P,x[--w]=D,v[--_]=-L,v[--_]=-E,v[--_]=a,v[--_]=i,x[--w]=C,x[--w]=I,v[--_]=L,v[--_]=E,v[--_]=a,v[--_]=i,x[--w]=C,x[--w]=I}}for(e=0;e<v.length;e++)y[e]=v[e],b[e]=v[e]-y[e];this.vertCount=6*M,this.lineBufferHi.update(y.subarray(_)),this.lineBufferLo.update(b.subarray(_)),this.pickBuffer.update(x.subarray(w)),l.free(v),l.free(y),l.free(b),l.free(x)}},u.dispose=function(){this.plot.removeObject(this),this.lineBufferLo.dispose(),this.lineBufferHi.dispose(),this.pickBuffer.dispose(),this.lineShader.dispose(),this.mitreShader.dispose(),this.fillShader.dispose(),this.pickShader.dispose(),this.dashPattern.dispose()}},{"./lib/shaders":170,"gl-buffer":157,"gl-shader":256,"gl-texture2d":268,ndarray:468,"typedarray-pool":550}],172:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, nextPosition;\nattribute float arcLength, lineWidth;\nattribute vec4 color;\n\nuniform vec2 screenShape;\nuniform float pixelRatio;\nuniform mat4 model, view, projection;\n\nvarying vec4 fragColor;\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\n\nvoid main() {\n vec4 projected = projection * view * model * vec4(position, 1.0);\n vec4 tangentClip = projection * view * model * vec4(nextPosition - position, 0.0);\n vec2 tangent = normalize(screenShape * tangentClip.xy);\n vec2 offset = 0.5 * pixelRatio * lineWidth * vec2(tangent.y, -tangent.x) / screenShape;\n\n gl_Position = vec4(projected.xy + projected.w * offset, projected.zw);\n\n worldPosition = position;\n pixelArcLength = arcLength;\n fragColor = color;\n}\n",a=[{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 n(t,i,"precision mediump float;\n#define GLSLIFY 1\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(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\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",null,a)},r.createPickShader=function(t){return n(t,i,"precision mediump float;\n#define GLSLIFY 1\n\n#define FLOAT_MAX 1.70141184e38\n#define FLOAT_MIN 1.17549435e-38\n\nlowp vec4 encode_float_1_0(highp float v) {\n highp float av = abs(v);\n\n //Handle special cases\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n //Compute exponent and mantissa\n highp float e = floor(log2(av));\n highp float m = av * pow(2.0, -e) - 1.0;\n \n //Unpack mantissa\n c[1] = floor(128.0 * m);\n m -= c[1] / 128.0;\n c[2] = floor(32768.0 * m);\n m -= c[2] / 32768.0;\n c[3] = floor(8388608.0 * m);\n \n //Unpack exponent\n highp float ebias = e + 127.0;\n c[0] = floor(ebias / 2.0);\n ebias -= c[0] * 2.0;\n c[1] += floor(ebias) * 128.0; \n\n //Unpack sign bit\n c[0] += 128.0 * step(0.0, -v);\n\n //Scale back to range\n return c / 255.0;\n}\n\n\n\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1_0(pixelArcLength).xyz);\n}",null,a)}},{"gl-shader":256}],173:[function(t,e,r){"use strict";function n(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 i(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 a(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function o(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}e.exports=function(t){var e=t.gl||t.scene&&t.scene.gl,r=p(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 n=m(e);n.attributes.position.location=0,n.attributes.nextPosition.location=1,n.attributes.arcLength.location=2,n.attributes.lineWidth.location=3,n.attributes.color.location=4;for(var i=s(e),a=l(e,[{buffer:i,size:3,offset:0,stride:48},{buffer:i,size:3,offset:12,stride:48},{buffer:i,size:1,offset:24,stride:48},{buffer:i,size:1,offset:28,stride:48},{buffer:i,size:4,offset:32,stride:48}]),u=f(new Array(1024),[256,1,4]),h=0;h<1024;++h)u.data[h]=255;var d=c(e,u);d.wrap=e.REPEAT;var g=new o(e,r,n,i,a,d);return g.update(t),g};var s=t("gl-buffer"),l=t("gl-vao"),c=t("gl-texture2d"),u=t("glsl-read-float"),h=t("binary-search-bounds"),f=t("ndarray"),d=t("./lib/shaders"),p=d.createShader,m=d.createPickShader,g=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],v=o.prototype;v.isTransparent=function(){return this.opacity<1},v.isOpaque=function(){return this.opacity>=1},v.pickSlots=1,v.setPickBase=function(t){this.pickId=t},v.drawTransparent=v.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,clipBounds:i(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)},v.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||g,view:t.view||g,projection:t.projection||g,pickId:this.pickId,clipBounds:i(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount)},v.update=function(t){var e,r;this.dirty=!0;var i=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var a=t.position||t.positions;if(a){var o=t.color||t.colors||[0,0,0,1],s=t.lineWidth||1,l=[],c=[],u=[],d=0,p=0,m=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],g=!1;t:for(e=1;e<a.length;++e){var v=a[e-1],y=a[e];for(c.push(d),u.push(v.slice()),r=0;r<3;++r){if(isNaN(v[r])||isNaN(y[r])||!isFinite(v[r])||!isFinite(y[r])){if(!i&&l.length>0){for(var b=0;b<24;++b)l.push(l[l.length-12]);p+=2,g=!0}continue t}m[0][r]=Math.min(m[0][r],v[r],y[r]),m[1][r]=Math.max(m[1][r],v[r],y[r])}var x,_;Array.isArray(o[0])?(x=o[e-1],_=o[e]):x=_=o,3===x.length&&(x=[x[0],x[1],x[2],1]),3===_.length&&(_=[_[0],_[1],_[2],1]);var w;w=Array.isArray(s)?s[e-1]:s;var M=d;if(d+=n(v,y),g){for(r=0;r<2;++r)l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3]);p+=2,g=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,x[0],x[1],x[2],x[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,x[0],x[1],x[2],x[3],y[0],y[1],y[2],v[0],v[1],v[2],d,-w,_[0],_[1],_[2],_[3],y[0],y[1],y[2],v[0],v[1],v[2],d,w,_[0],_[1],_[2],_[3]),p+=4}if(this.buffer.update(l),c.push(d),u.push(a[a.length-1].slice()),this.bounds=m,this.vertexCount=p,this.points=u,this.arcLength=c,"dashes"in t){var k=t.dashes.slice();for(k.unshift(0),e=1;e<k.length;++e)k[e]=k[e-1]+k[e];var T=f(new Array(1024),[256,1,4]);for(e=0;e<256;++e){for(r=0;r<4;++r)T.set(e,0,r,0);1&h.le(k,k[k.length-1]*e/255)?T.set(e,0,0,0):T.set(e,0,0,255)}this.texture.setPixels(T)}}},v.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},v.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=u(t.value[0],t.value[1],t.value[2],0),r=h.le(this.arcLength,e);if(r<0)return null;if(r===this.arcLength.length-1)return new a(this.arcLength[this.arcLength.length-1],this.points[this.points.length-1].slice(),r);for(var n=this.points[r],i=this.points[Math.min(r+1,this.points.length-1)],o=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),s=1-o,l=[0,0,0],c=0;c<3;++c)l[c]=s*n[c]+o*i[c];var f=Math.min(o<.5?r:r+1,this.points.length-1);return new a(e,l,f,this.points[f])}},{"./lib/shaders":172,"binary-search-bounds":67,"gl-buffer":157,"gl-texture2d":268,"gl-vao":272,"glsl-read-float":279,ndarray:468}],174:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*a-i*n;return o?(o=1/o,t[0]=a*o,t[1]=-n*o,t[2]=-i*o,t[3]=r*o,t):null}},{}],175:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=u*o-s*c,f=-u*a+s*l,d=c*a-o*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-u*n+i*c)*p,t[2]=(s*n-i*o)*p,t[3]=f*p,t[4]=(u*r-i*l)*p,t[5]=(-s*r+i*a)*p,t[6]=d*p,t[7]=(-c*r+n*l)*p,t[8]=(o*r-n*a)*p,t):null}},{}],176:[function(t,e,r){e.exports=function(t){var e=new Float32Array(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}},{}],177:[function(t,e,r){e.exports=function(){var t=new Float32Array(16);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}},{}],178:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],f=t[11],d=t[12],p=t[13],m=t[14],g=t[15];return(e*o-r*a)*(h*g-f*m)-(e*s-n*a)*(u*g-f*p)+(e*l-i*a)*(u*m-h*p)+(r*s-n*o)*(c*g-f*d)-(r*l-i*o)*(c*m-h*d)+(n*l-i*s)*(c*p-u*d)}},{}],179:[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,s=n+n,l=i+i,c=r*o,u=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[1]=u+v,t[2]=f-g,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=d+m,t[7]=0,t[8]=f+g,t[9]=d-m,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}},{}],180:[function(t,e,r){e.exports=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,l=i+i,c=a+a,u=n*s,h=n*l,f=n*c,d=i*l,p=i*c,m=a*c,g=o*s,v=o*l,y=o*c;return t[0]=1-(d+m),t[1]=h+y,t[2]=f-v,t[3]=0,t[4]=h-y,t[5]=1-(u+m),t[6]=p+g,t[7]=0,t[8]=f+v,t[9]=p-g,t[10]=1-(u+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}},{}],181:[function(t,e,r){e.exports=function(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}},{}],182:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,b=r*l-i*o,x=r*c-a*o,_=n*l-i*s,w=n*c-a*s,M=i*c-a*l,k=u*m-h*p,T=u*g-f*p,A=u*v-d*p,S=h*g-f*m,E=h*v-d*m,L=f*v-d*g,C=y*L-b*E+x*S+_*A-w*T+M*k;return C?(C=1/C,t[0]=(s*L-l*E+c*S)*C,t[1]=(i*E-n*L-a*S)*C,t[2]=(m*M-g*w+v*_)*C,t[3]=(f*w-h*M-d*_)*C,t[4]=(l*A-o*L-c*T)*C,t[5]=(r*L-i*A+a*T)*C,t[6]=(g*x-p*M-v*b)*C,t[7]=(u*M-f*x+d*b)*C,t[8]=(o*E-s*A+c*k)*C,t[9]=(n*A-r*E-a*k)*C,t[10]=(p*w-m*x+v*y)*C,t[11]=(h*x-u*w-d*y)*C,t[12]=(s*T-o*S-l*k)*C,t[13]=(r*S-n*T+i*k)*C,t[14]=(m*b-p*_-g*y)*C,t[15]=(u*_-h*b+f*y)*C,t):null}},{}],183:[function(t,e,r){var n=t("./identity");e.exports=function(t,e,r,i){var a,o,s,l,c,u,h,f,d,p,m=e[0],g=e[1],v=e[2],y=i[0],b=i[1],x=i[2],_=r[0],w=r[1],M=r[2];return Math.abs(m-_)<1e-6&&Math.abs(g-w)<1e-6&&Math.abs(v-M)<1e-6?n(t):(h=m-_,f=g-w,d=v-M,p=1/Math.sqrt(h*h+f*f+d*d),h*=p,f*=p,d*=p,a=b*d-x*f,o=x*h-y*d,s=y*f-b*h,(p=Math.sqrt(a*a+o*o+s*s))?(a*=p=1/p,o*=p,s*=p):(a=0,o=0,s=0),l=f*s-d*o,c=d*a-h*s,u=h*o-f*a,(p=Math.sqrt(l*l+c*c+u*u))?(l*=p=1/p,c*=p,u*=p):(l=0,c=0,u=0),t[0]=a,t[1]=l,t[2]=h,t[3]=0,t[4]=o,t[5]=c,t[6]=f,t[7]=0,t[8]=s,t[9]=u,t[10]=d,t[11]=0,t[12]=-(a*m+o*g+s*v),t[13]=-(l*m+c*g+u*v),t[14]=-(h*m+f*g+d*v),t[15]=1,t)}},{"./identity":181}],184:[function(t,e,r){e.exports=function(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],h=e[8],f=e[9],d=e[10],p=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*m,t[1]=b*i+x*l+_*f+w*g,t[2]=b*a+x*c+_*d+w*v,t[3]=b*o+x*u+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*m,t[5]=b*i+x*l+_*f+w*g,t[6]=b*a+x*c+_*d+w*v,t[7]=b*o+x*u+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*m,t[9]=b*i+x*l+_*f+w*g,t[10]=b*a+x*c+_*d+w*v,t[11]=b*o+x*u+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*m,t[13]=b*i+x*l+_*f+w*g,t[14]=b*a+x*c+_*d+w*v,t[15]=b*o+x*u+_*p+w*y,t}},{}],185:[function(t,e,r){e.exports=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t}},{}],186:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w,M,k,T,A,S,E=n[0],L=n[1],C=n[2],I=Math.sqrt(E*E+L*L+C*C);return Math.abs(I)<1e-6?null:(I=1/I,E*=I,L*=I,C*=I,i=Math.sin(r),a=Math.cos(r),o=1-a,s=e[0],l=e[1],c=e[2],u=e[3],h=e[4],f=e[5],d=e[6],p=e[7],m=e[8],g=e[9],v=e[10],y=e[11],b=E*E*o+a,x=L*E*o+C*i,_=C*E*o-L*i,w=E*L*o-C*i,M=L*L*o+a,k=C*L*o+E*i,T=E*C*o+L*i,A=L*C*o-E*i,S=C*C*o+a,t[0]=s*b+h*x+m*_,t[1]=l*b+f*x+g*_,t[2]=c*b+d*x+v*_,t[3]=u*b+p*x+y*_,t[4]=s*w+h*M+m*k,t[5]=l*w+f*M+g*k,t[6]=c*w+d*M+v*k,t[7]=u*w+p*M+y*k,t[8]=s*T+h*A+m*S,t[9]=l*T+f*A+g*S,t[10]=c*T+d*A+v*S,t[11]=u*T+p*A+y*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)}},{}],187:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*i+c*n,t[5]=o*i+u*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=c*i-a*n,t[9]=u*i-o*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t}},{}],188:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[8],u=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i-c*n,t[1]=o*i-u*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=a*n+c*i,t[9]=o*n+u*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t}},{}],189:[function(t,e,r){e.exports=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[4],u=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i+c*n,t[1]=o*i+u*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=c*i-a*n,t[5]=u*i-o*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t}},{}],190:[function(t,e,r){e.exports=function(t,e,r){var n=r[0],i=r[1],a=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}},{}],191:[function(t,e,r){e.exports=function(t,e,r){var n,i,a,o,s,l,c,u,h,f,d,p,m=r[0],g=r[1],v=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*m+s*g+h*v+e[12],t[13]=i*m+l*g+f*v+e[13],t[14]=a*m+c*g+d*v+e[14],t[15]=o*m+u*g+p*v+e[15]),t}},{}],192:[function(t,e,r){e.exports=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],a=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=a,t[11]=e[14],t[12]=i,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t}},{}],193:[function(t,e,r){"use strict";e.exports=function(t,e){switch(e.length){case 0:break;case 1:t[0]=1/e[0];break;case 4:n(t,e);break;case 9:i(t,e);break;case 16:a(t,e);break;default:throw new Error("currently supports matrices up to 4x4")}return t};var n=t("gl-mat2/invert"),i=t("gl-mat3/invert"),a=t("gl-mat4/invert")},{"gl-mat2/invert":174,"gl-mat3/invert":175,"gl-mat4/invert":182}],194:[function(t,e,r){r.glMatrix=t("./gl-matrix/common.js"),r.mat2=t("./gl-matrix/mat2.js"),r.mat2d=t("./gl-matrix/mat2d.js"),r.mat3=t("./gl-matrix/mat3.js"),r.mat4=t("./gl-matrix/mat4.js"),r.quat=t("./gl-matrix/quat.js"),r.vec2=t("./gl-matrix/vec2.js"),r.vec3=t("./gl-matrix/vec3.js"),r.vec4=t("./gl-matrix/vec4.js")},{"./gl-matrix/common.js":195,"./gl-matrix/mat2.js":196,"./gl-matrix/mat2d.js":197,"./gl-matrix/mat3.js":198,"./gl-matrix/mat4.js":199,"./gl-matrix/quat.js":200,"./gl-matrix/vec2.js":201,"./gl-matrix/vec3.js":202,"./gl-matrix/vec4.js":203}],195:[function(t,e,r){var n={};n.EPSILON=1e-6,n.ARRAY_TYPE="undefined"!=typeof Float32Array?Float32Array:Array,n.RANDOM=Math.random,n.ENABLE_SIMD=!1,n.SIMD_AVAILABLE=n.ARRAY_TYPE===Float32Array&&"SIMD"in this,n.USE_SIMD=n.ENABLE_SIMD&&n.SIMD_AVAILABLE,n.setMatrixArrayType=function(t){n.ARRAY_TYPE=t};var i=Math.PI/180;n.toRadian=function(t){return t*i},n.equals=function(t,e){return Math.abs(t-e)<=n.EPSILON*Math.max(1,Math.abs(t),Math.abs(e))},e.exports=n},{}],196:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t},i.fromValues=function(t,e,r,i){var a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.transpose=function(t,e){if(t===e){var r=e[1];t[1]=e[2],t[2]=r}else t[0]=e[0],t[1]=e[2],t[2]=e[1],t[3]=e[3];return t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r*a-i*n;return o?(o=1/o,t[0]=a*o,t[1]=-n*o,t[2]=-i*o,t[3]=r*o,t):null},i.adjoint=function(t,e){var r=e[0];return t[0]=e[3],t[1]=-e[1],t[2]=-e[2],t[3]=r,t},i.determinant=function(t){return t[0]*t[3]-t[2]*t[1]},i.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],c=r[2],u=r[3];return t[0]=n*s+a*l,t[1]=i*s+o*l,t[2]=n*c+a*u,t[3]=i*c+o*u,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+a*s,t[1]=i*l+o*s,t[2]=n*-s+a*l,t[3]=i*-s+o*l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1];return t[0]=n*s,t[1]=i*s,t[2]=a*l,t[3]=o*l,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t},i.str=function(t){return"mat2("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2))},i.LDU=function(t,e,r,n){return t[2]=n[2]/n[0],r[0]=n[0],r[1]=n[1],r[3]=n[3]-t[2]*r[1],[t,e,r]},i.add=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},i.subtract=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},i.sub=i.subtract,i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=e[0],l=e[1],c=e[2],u=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},i.multiplyScalar=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},i.multiplyScalarAndAdd=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},e.exports=i},{"./common.js":195}],197:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(6);return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(6);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},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0,t},i.fromValues=function(t,e,r,i,a,o){var s=new n.ARRAY_TYPE(6);return s[0]=t,s[1]=e,s[2]=r,s[3]=i,s[4]=a,s[5]=o,s},i.set=function(t,e,r,n,i,a,o){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=r*a-n*i;return l?(l=1/l,t[0]=a*l,t[1]=-n*l,t[2]=-i*l,t[3]=r*l,t[4]=(i*s-a*o)*l,t[5]=(n*o-r*s)*l,t):null},i.determinant=function(t){return t[0]*t[3]-t[1]*t[2]},i.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=r[0],u=r[1],h=r[2],f=r[3],d=r[4],p=r[5];return t[0]=n*c+a*u,t[1]=i*c+o*u,t[2]=n*h+a*f,t[3]=i*h+o*f,t[4]=n*d+a*p+s,t[5]=i*d+o*p+l,t},i.mul=i.multiply,i.rotate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=Math.sin(r),u=Math.cos(r);return t[0]=n*u+a*c,t[1]=i*u+o*c,t[2]=n*-c+a*u,t[3]=i*-c+o*u,t[4]=s,t[5]=l,t},i.scale=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=r[0],u=r[1];return t[0]=n*c,t[1]=i*c,t[2]=a*u,t[3]=o*u,t[4]=s,t[5]=l,t},i.translate=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=r[0],u=r[1];return t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=n*c+a*u+s,t[5]=i*c+o*u+l,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=-r,t[3]=n,t[4]=0,t[5]=0,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=e[1],t[4]=0,t[5]=0,t},i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=e[0],t[5]=e[1],t},i.str=function(t){return"mat2d("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+1)},i.add=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[4]=e[4]+r[4],t[5]=e[5]+r[5],t},i.subtract=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[4]=e[4]-r[4],t[5]=e[5]-r[5],t},i.sub=i.subtract,i.multiplyScalar=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[4]=e[4]*r,t[5]=e[5]*r,t},i.multiplyScalarAndAdd=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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=e[0],u=e[1],h=e[2],f=e[3],d=e[4],p=e[5];return Math.abs(r-c)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(c))&&Math.abs(i-u)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(u))&&Math.abs(a-h)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(h))&&Math.abs(o-f)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(f))&&Math.abs(s-d)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(d))&&Math.abs(l-p)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(p))},e.exports=i},{"./common.js":195}],198:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(9);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromMat4=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[4],t[4]=e[5],t[5]=e[6],t[6]=e[8],t[7]=e[9],t[8]=e[10],t},i.clone=function(t){var e=new n.ARRAY_TYPE(9);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},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},i.fromValues=function(t,e,r,i,a,o,s,l,c){var u=new n.ARRAY_TYPE(9);return u[0]=t,u[1]=e,u[2]=r,u[3]=i,u[4]=a,u[5]=o,u[6]=s,u[7]=l,u[8]=c,u},i.set=function(t,e,r,n,i,a,o,s,l,c){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=c,t},i.identity=function(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},i.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=u*o-s*c,f=-u*a+s*l,d=c*a-o*l,p=r*h+n*f+i*d;return p?(p=1/p,t[0]=h*p,t[1]=(-u*n+i*c)*p,t[2]=(s*n-i*o)*p,t[3]=f*p,t[4]=(u*r-i*l)*p,t[5]=(-s*r+i*a)*p,t[6]=d*p,t[7]=(-c*r+n*l)*p,t[8]=(o*r-n*a)*p,t):null},i.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8];return t[0]=o*u-s*c,t[1]=i*c-n*u,t[2]=n*s-i*o,t[3]=s*l-a*u,t[4]=r*u-i*l,t[5]=i*a-r*s,t[6]=a*c-o*l,t[7]=n*l-r*c,t[8]=r*o-n*a,t},i.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8];return e*(c*a-o*l)+r*(-c*i+o*s)+n*(l*i-a*s)},i.multiply=function(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],h=e[8],f=r[0],d=r[1],p=r[2],m=r[3],g=r[4],v=r[5],y=r[6],b=r[7],x=r[8];return t[0]=f*n+d*o+p*c,t[1]=f*i+d*s+p*u,t[2]=f*a+d*l+p*h,t[3]=m*n+g*o+v*c,t[4]=m*i+g*s+v*u,t[5]=m*a+g*l+v*h,t[6]=y*n+b*o+x*c,t[7]=y*i+b*s+x*u,t[8]=y*a+b*l+x*h,t},i.mul=i.multiply,i.translate=function(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],h=e[8],f=r[0],d=r[1];return t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=f*n+d*o+c,t[7]=f*i+d*s+u,t[8]=f*a+d*l+h,t},i.rotate=function(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],h=e[8],f=Math.sin(r),d=Math.cos(r);return t[0]=d*n+f*o,t[1]=d*i+f*s,t[2]=d*a+f*l,t[3]=d*o-f*n,t[4]=d*s-f*i,t[5]=d*l-f*a,t[6]=c,t[7]=u,t[8]=h,t},i.scale=function(t,e,r){var n=r[0],i=r[1];return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=i*e[3],t[4]=i*e[4],t[5]=i*e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t},i.fromTranslation=function(t,e){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=1,t[5]=0,t[6]=e[0],t[7]=e[1],t[8]=1,t},i.fromRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=-r,t[4]=n,t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=e[1],t[5]=0,t[6]=0,t[7]=0,t[8]=1,t},i.fromMat2d=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=0,t[3]=e[2],t[4]=e[3],t[5]=0,t[6]=e[4],t[7]=e[5],t[8]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[3]=u-v,t[6]=f+g,t[1]=u+v,t[4]=1-c-p,t[7]=d-m,t[2]=f-g,t[5]=d+m,t[8]=1-c-h,t},i.normalFromMat4=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,b=r*l-i*o,x=r*c-a*o,_=n*l-i*s,w=n*c-a*s,M=i*c-a*l,k=u*m-h*p,T=u*g-f*p,A=u*v-d*p,S=h*g-f*m,E=h*v-d*m,L=f*v-d*g,C=y*L-b*E+x*S+_*A-w*T+M*k;return C?(C=1/C,t[0]=(s*L-l*E+c*S)*C,t[1]=(l*A-o*L-c*T)*C,t[2]=(o*E-s*A+c*k)*C,t[3]=(i*E-n*L-a*S)*C,t[4]=(r*L-i*A+a*T)*C,t[5]=(n*A-r*E-a*k)*C,t[6]=(m*M-g*w+v*_)*C,t[7]=(g*x-p*M-v*b)*C,t[8]=(p*w-m*x+v*y)*C,t):null},i.str=function(t){return"mat3("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2))},i.add=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[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t},i.subtract=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[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t},i.sub=i.subtract,i.multiplyScalar=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[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t},i.multiplyScalarAndAdd=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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],f=e[0],d=e[1],p=e[2],m=e[3],g=e[4],v=e[5],y=t[6],b=e[7],x=e[8];return Math.abs(r-f)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(f))&&Math.abs(i-d)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-p)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(p))&&Math.abs(o-m)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(m))&&Math.abs(s-g)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(l-v)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(v))&&Math.abs(c-y)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(y))&&Math.abs(u-b)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(b))&&Math.abs(h-x)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(x))},e.exports=i},{"./common.js":195}],199:[function(t,e,r){var n=t("./common.js"),i={scalar:{},SIMD:{}};i.create=function(){var t=new n.ARRAY_TYPE(16);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},i.clone=function(t){var e=new n.ARRAY_TYPE(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},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.fromValues=function(t,e,r,i,a,o,s,l,c,u,h,f,d,p,m,g){var v=new n.ARRAY_TYPE(16);return v[0]=t,v[1]=e,v[2]=r,v[3]=i,v[4]=a,v[5]=o,v[6]=s,v[7]=l,v[8]=c,v[9]=u,v[10]=h,v[11]=f,v[12]=d,v[13]=p,v[14]=m,v[15]=g,v},i.set=function(t,e,r,n,i,a,o,s,l,c,u,h,f,d,p,m,g){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=l,t[8]=c,t[9]=u,t[10]=h,t[11]=f,t[12]=d,t[13]=p,t[14]=m,t[15]=g,t},i.identity=function(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},i.scalar.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[3],a=e[6],o=e[7],s=e[11];t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=r,t[6]=e[9],t[7]=e[13],t[8]=n,t[9]=a,t[11]=e[14],t[12]=i,t[13]=o,t[14]=s}else t[0]=e[0],t[1]=e[4],t[2]=e[8],t[3]=e[12],t[4]=e[1],t[5]=e[5],t[6]=e[9],t[7]=e[13],t[8]=e[2],t[9]=e[6],t[10]=e[10],t[11]=e[14],t[12]=e[3],t[13]=e[7],t[14]=e[11],t[15]=e[15];return t},i.SIMD.transpose=function(t,e){var r,n,i,a,o,s,l,c,u,h;return r=SIMD.Float32x4.load(e,0),n=SIMD.Float32x4.load(e,4),i=SIMD.Float32x4.load(e,8),a=SIMD.Float32x4.load(e,12),o=SIMD.Float32x4.shuffle(r,n,0,1,4,5),s=SIMD.Float32x4.shuffle(i,a,0,1,4,5),l=SIMD.Float32x4.shuffle(o,s,0,2,4,6),c=SIMD.Float32x4.shuffle(o,s,1,3,5,7),SIMD.Float32x4.store(t,0,l),SIMD.Float32x4.store(t,4,c),o=SIMD.Float32x4.shuffle(r,n,2,3,6,7),s=SIMD.Float32x4.shuffle(i,a,2,3,6,7),u=SIMD.Float32x4.shuffle(o,s,0,2,4,6),h=SIMD.Float32x4.shuffle(o,s,1,3,5,7),SIMD.Float32x4.store(t,8,u),SIMD.Float32x4.store(t,12,h),t},i.transpose=n.USE_SIMD?i.SIMD.transpose:i.scalar.transpose,i.scalar.invert=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15],y=r*s-n*o,b=r*l-i*o,x=r*c-a*o,_=n*l-i*s,w=n*c-a*s,M=i*c-a*l,k=u*m-h*p,T=u*g-f*p,A=u*v-d*p,S=h*g-f*m,E=h*v-d*m,L=f*v-d*g,C=y*L-b*E+x*S+_*A-w*T+M*k;return C?(C=1/C,t[0]=(s*L-l*E+c*S)*C,t[1]=(i*E-n*L-a*S)*C,t[2]=(m*M-g*w+v*_)*C,t[3]=(f*w-h*M-d*_)*C,t[4]=(l*A-o*L-c*T)*C,t[5]=(r*L-i*A+a*T)*C,t[6]=(g*x-p*M-v*b)*C,t[7]=(u*M-f*x+d*b)*C,t[8]=(o*E-s*A+c*k)*C,t[9]=(n*A-r*E-a*k)*C,t[10]=(p*w-m*x+v*y)*C,t[11]=(h*x-u*w-d*y)*C,t[12]=(s*T-o*S-l*k)*C,t[13]=(r*S-n*T+i*k)*C,t[14]=(m*b-p*_-g*y)*C,t[15]=(u*_-h*b+f*y)*C,t):null},i.SIMD.invert=function(t,e){var r,n,i,a,o,s,l,c,u,h,f=SIMD.Float32x4.load(e,0),d=SIMD.Float32x4.load(e,4),p=SIMD.Float32x4.load(e,8),m=SIMD.Float32x4.load(e,12);return o=SIMD.Float32x4.shuffle(f,d,0,1,4,5),n=SIMD.Float32x4.shuffle(p,m,0,1,4,5),r=SIMD.Float32x4.shuffle(o,n,0,2,4,6),n=SIMD.Float32x4.shuffle(n,o,1,3,5,7),o=SIMD.Float32x4.shuffle(f,d,2,3,6,7),a=SIMD.Float32x4.shuffle(p,m,2,3,6,7),i=SIMD.Float32x4.shuffle(o,a,0,2,4,6),a=SIMD.Float32x4.shuffle(a,o,1,3,5,7),o=SIMD.Float32x4.mul(i,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.mul(n,o),l=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(SIMD.Float32x4.mul(n,o),s),l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),l),l=SIMD.Float32x4.swizzle(l,2,3,0,1),o=SIMD.Float32x4.mul(n,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),s),u=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),u),u=SIMD.Float32x4.swizzle(u,2,3,0,1),o=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(n,2,3,0,1),a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),i=SIMD.Float32x4.swizzle(i,2,3,0,1),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),s),c=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),o=SIMD.Float32x4.mul(r,n),o=SIMD.Float32x4.swizzle(o,1,0,3,2),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(i,o),u),o=SIMD.Float32x4.swizzle(o,2,3,0,1),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(i,o)),o=SIMD.Float32x4.mul(r,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),c),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),l),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.mul(r,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),l),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),u),h=SIMD.Float32x4.mul(r,s),h=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(h,2,3,0,1),h),h=SIMD.Float32x4.add(SIMD.Float32x4.swizzle(h,1,0,3,2),h),o=SIMD.Float32x4.reciprocalApproximation(h),h=SIMD.Float32x4.sub(SIMD.Float32x4.add(o,o),SIMD.Float32x4.mul(h,SIMD.Float32x4.mul(o,o))),(h=SIMD.Float32x4.swizzle(h,0,0,0,0))?(SIMD.Float32x4.store(t,0,SIMD.Float32x4.mul(h,s)),SIMD.Float32x4.store(t,4,SIMD.Float32x4.mul(h,l)),SIMD.Float32x4.store(t,8,SIMD.Float32x4.mul(h,c)),SIMD.Float32x4.store(t,12,SIMD.Float32x4.mul(h,u)),t):null},i.invert=n.USE_SIMD?i.SIMD.invert:i.scalar.invert,i.scalar.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=e[4],s=e[5],l=e[6],c=e[7],u=e[8],h=e[9],f=e[10],d=e[11],p=e[12],m=e[13],g=e[14],v=e[15];return t[0]=s*(f*v-d*g)-h*(l*v-c*g)+m*(l*d-c*f),t[1]=-(n*(f*v-d*g)-h*(i*v-a*g)+m*(i*d-a*f)),t[2]=n*(l*v-c*g)-s*(i*v-a*g)+m*(i*c-a*l),t[3]=-(n*(l*d-c*f)-s*(i*d-a*f)+h*(i*c-a*l)),t[4]=-(o*(f*v-d*g)-u*(l*v-c*g)+p*(l*d-c*f)),t[5]=r*(f*v-d*g)-u*(i*v-a*g)+p*(i*d-a*f),t[6]=-(r*(l*v-c*g)-o*(i*v-a*g)+p*(i*c-a*l)),t[7]=r*(l*d-c*f)-o*(i*d-a*f)+u*(i*c-a*l),t[8]=o*(h*v-d*m)-u*(s*v-c*m)+p*(s*d-c*h),t[9]=-(r*(h*v-d*m)-u*(n*v-a*m)+p*(n*d-a*h)),t[10]=r*(s*v-c*m)-o*(n*v-a*m)+p*(n*c-a*s),t[11]=-(r*(s*d-c*h)-o*(n*d-a*h)+u*(n*c-a*s)),t[12]=-(o*(h*g-f*m)-u*(s*g-l*m)+p*(s*f-l*h)),t[13]=r*(h*g-f*m)-u*(n*g-i*m)+p*(n*f-i*h),t[14]=-(r*(s*g-l*m)-o*(n*g-i*m)+p*(n*l-i*s)),t[15]=r*(s*f-l*h)-o*(n*f-i*h)+u*(n*l-i*s),t},i.SIMD.adjoint=function(t,e){var r,n,i,a,o,s,l,c,u,h=SIMD.Float32x4.load(e,0),f=SIMD.Float32x4.load(e,4),d=SIMD.Float32x4.load(e,8),p=SIMD.Float32x4.load(e,12);return o=SIMD.Float32x4.shuffle(h,f,0,1,4,5),n=SIMD.Float32x4.shuffle(d,p,0,1,4,5),r=SIMD.Float32x4.shuffle(o,n,0,2,4,6),n=SIMD.Float32x4.shuffle(n,o,1,3,5,7),o=SIMD.Float32x4.shuffle(h,f,2,3,6,7),a=SIMD.Float32x4.shuffle(d,p,2,3,6,7),i=SIMD.Float32x4.shuffle(o,a,0,2,4,6),a=SIMD.Float32x4.shuffle(a,o,1,3,5,7),o=SIMD.Float32x4.mul(i,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.mul(n,o),l=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(SIMD.Float32x4.mul(n,o),s),l=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),l),l=SIMD.Float32x4.swizzle(l,2,3,0,1),o=SIMD.Float32x4.mul(n,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),s),u=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),u),u=SIMD.Float32x4.swizzle(u,2,3,0,1),o=SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(n,2,3,0,1),a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),i=SIMD.Float32x4.swizzle(i,2,3,0,1),s=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),s),c=SIMD.Float32x4.mul(r,o),o=SIMD.Float32x4.swizzle(o,2,3,0,1),s=SIMD.Float32x4.sub(s,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(r,o),c),c=SIMD.Float32x4.swizzle(c,2,3,0,1),o=SIMD.Float32x4.mul(r,n),o=SIMD.Float32x4.swizzle(o,1,0,3,2),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(SIMD.Float32x4.mul(i,o),u),o=SIMD.Float32x4.swizzle(o,2,3,0,1),c=SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,o),c),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(i,o)),o=SIMD.Float32x4.mul(r,a),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(i,o)),c=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),c),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(i,o),l),c=SIMD.Float32x4.sub(c,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.mul(r,i),o=SIMD.Float32x4.swizzle(o,1,0,3,2),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(a,o),l),u=SIMD.Float32x4.sub(u,SIMD.Float32x4.mul(n,o)),o=SIMD.Float32x4.swizzle(o,2,3,0,1),l=SIMD.Float32x4.sub(l,SIMD.Float32x4.mul(a,o)),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(n,o),u),SIMD.Float32x4.store(t,0,s),SIMD.Float32x4.store(t,4,l),SIMD.Float32x4.store(t,8,c),SIMD.Float32x4.store(t,12,u),t},i.adjoint=n.USE_SIMD?i.SIMD.adjoint:i.scalar.adjoint,i.determinant=function(t){var e=t[0],r=t[1],n=t[2],i=t[3],a=t[4],o=t[5],s=t[6],l=t[7],c=t[8],u=t[9],h=t[10],f=t[11],d=t[12],p=t[13],m=t[14],g=t[15];return(e*o-r*a)*(h*g-f*m)-(e*s-n*a)*(u*g-f*p)+(e*l-i*a)*(u*m-h*p)+(r*s-n*o)*(c*g-f*d)-(r*l-i*o)*(c*m-h*d)+(n*l-i*s)*(c*p-u*d)},i.SIMD.multiply=function(t,e,r){var n=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),a=SIMD.Float32x4.load(e,8),o=SIMD.Float32x4.load(e,12),s=SIMD.Float32x4.load(r,0),l=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,2,2,2,2),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(s,3,3,3,3),o))));SIMD.Float32x4.store(t,0,l);var c=SIMD.Float32x4.load(r,4),u=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,2,2,2,2),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(c,3,3,3,3),o))));SIMD.Float32x4.store(t,4,u);var h=SIMD.Float32x4.load(r,8),f=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,2,2,2,2),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(h,3,3,3,3),o))));SIMD.Float32x4.store(t,8,f);var d=SIMD.Float32x4.load(r,12),p=SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,0,0,0,0),n),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,1,1,1,1),i),SIMD.Float32x4.add(SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,2,2,2,2),a),SIMD.Float32x4.mul(SIMD.Float32x4.swizzle(d,3,3,3,3),o))));return SIMD.Float32x4.store(t,12,p),t},i.scalar.multiply=function(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],h=e[8],f=e[9],d=e[10],p=e[11],m=e[12],g=e[13],v=e[14],y=e[15],b=r[0],x=r[1],_=r[2],w=r[3];return t[0]=b*n+x*s+_*h+w*m,t[1]=b*i+x*l+_*f+w*g,t[2]=b*a+x*c+_*d+w*v,t[3]=b*o+x*u+_*p+w*y,b=r[4],x=r[5],_=r[6],w=r[7],t[4]=b*n+x*s+_*h+w*m,t[5]=b*i+x*l+_*f+w*g,t[6]=b*a+x*c+_*d+w*v,t[7]=b*o+x*u+_*p+w*y,b=r[8],x=r[9],_=r[10],w=r[11],t[8]=b*n+x*s+_*h+w*m,t[9]=b*i+x*l+_*f+w*g,t[10]=b*a+x*c+_*d+w*v,t[11]=b*o+x*u+_*p+w*y,b=r[12],x=r[13],_=r[14],w=r[15],t[12]=b*n+x*s+_*h+w*m,t[13]=b*i+x*l+_*f+w*g,t[14]=b*a+x*c+_*d+w*v,t[15]=b*o+x*u+_*p+w*y,t},i.multiply=n.USE_SIMD?i.SIMD.multiply:i.scalar.multiply,i.mul=i.multiply,i.scalar.translate=function(t,e,r){var n,i,a,o,s,l,c,u,h,f,d,p,m=r[0],g=r[1],v=r[2];return e===t?(t[12]=e[0]*m+e[4]*g+e[8]*v+e[12],t[13]=e[1]*m+e[5]*g+e[9]*v+e[13],t[14]=e[2]*m+e[6]*g+e[10]*v+e[14],t[15]=e[3]*m+e[7]*g+e[11]*v+e[15]):(n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],c=e[6],u=e[7],h=e[8],f=e[9],d=e[10],p=e[11],t[0]=n,t[1]=i,t[2]=a,t[3]=o,t[4]=s,t[5]=l,t[6]=c,t[7]=u,t[8]=h,t[9]=f,t[10]=d,t[11]=p,t[12]=n*m+s*g+h*v+e[12],t[13]=i*m+l*g+f*v+e[13],t[14]=a*m+c*g+d*v+e[14],t[15]=o*m+u*g+p*v+e[15]),t},i.SIMD.translate=function(t,e,r){var n=SIMD.Float32x4.load(e,0),i=SIMD.Float32x4.load(e,4),a=SIMD.Float32x4.load(e,8),o=SIMD.Float32x4.load(e,12),s=SIMD.Float32x4(r[0],r[1],r[2],0);e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11]),n=SIMD.Float32x4.mul(n,SIMD.Float32x4.swizzle(s,0,0,0,0)),i=SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(s,1,1,1,1)),a=SIMD.Float32x4.mul(a,SIMD.Float32x4.swizzle(s,2,2,2,2));var l=SIMD.Float32x4.add(n,SIMD.Float32x4.add(i,SIMD.Float32x4.add(a,o)));return SIMD.Float32x4.store(t,12,l),t},i.translate=n.USE_SIMD?i.SIMD.translate:i.scalar.translate,i.scalar.scale=function(t,e,r){var n=r[0],i=r[1],a=r[2];return t[0]=e[0]*n,t[1]=e[1]*n,t[2]=e[2]*n,t[3]=e[3]*n,t[4]=e[4]*i,t[5]=e[5]*i,t[6]=e[6]*i,t[7]=e[7]*i,t[8]=e[8]*a,t[9]=e[9]*a,t[10]=e[10]*a,t[11]=e[11]*a,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.SIMD.scale=function(t,e,r){var n,i,a,o=SIMD.Float32x4(r[0],r[1],r[2],0);return n=SIMD.Float32x4.load(e,0),SIMD.Float32x4.store(t,0,SIMD.Float32x4.mul(n,SIMD.Float32x4.swizzle(o,0,0,0,0))),i=SIMD.Float32x4.load(e,4),SIMD.Float32x4.store(t,4,SIMD.Float32x4.mul(i,SIMD.Float32x4.swizzle(o,1,1,1,1))),a=SIMD.Float32x4.load(e,8),SIMD.Float32x4.store(t,8,SIMD.Float32x4.mul(a,SIMD.Float32x4.swizzle(o,2,2,2,2))),t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t},i.scale=n.USE_SIMD?i.SIMD.scale:i.scalar.scale,i.rotate=function(t,e,r,i){var a,o,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w,M,k,T,A,S,E,L=i[0],C=i[1],I=i[2],P=Math.sqrt(L*L+C*C+I*I);return Math.abs(P)<n.EPSILON?null:(P=1/P,L*=P,C*=P,I*=P,a=Math.sin(r),o=Math.cos(r),s=1-o,l=e[0],c=e[1],u=e[2],h=e[3],f=e[4],d=e[5],p=e[6],m=e[7],g=e[8],v=e[9],y=e[10],b=e[11],x=L*L*s+o,_=C*L*s+I*a,w=I*L*s-C*a,M=L*C*s-I*a,k=C*C*s+o,T=I*C*s+L*a,A=L*I*s+C*a,S=C*I*s-L*a,E=I*I*s+o,t[0]=l*x+f*_+g*w,t[1]=c*x+d*_+v*w,t[2]=u*x+p*_+y*w,t[3]=h*x+m*_+b*w,t[4]=l*M+f*k+g*T,t[5]=c*M+d*k+v*T,t[6]=u*M+p*k+y*T,t[7]=h*M+m*k+b*T,t[8]=l*A+f*S+g*E,t[9]=c*A+d*S+v*E,t[10]=u*A+p*S+y*E,t[11]=h*A+m*S+b*E,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t)},i.scalar.rotateX=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[4],o=e[5],s=e[6],l=e[7],c=e[8],u=e[9],h=e[10],f=e[11];return e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=a*i+c*n,t[5]=o*i+u*n,t[6]=s*i+h*n,t[7]=l*i+f*n,t[8]=c*i-a*n,t[9]=u*i-o*n,t[10]=h*i-s*n,t[11]=f*i-l*n,t},i.SIMD.rotateX=function(t,e,r){var n=SIMD.Float32x4.splat(Math.sin(r)),i=SIMD.Float32x4.splat(Math.cos(r));e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);var a=SIMD.Float32x4.load(e,4),o=SIMD.Float32x4.load(e,8);return SIMD.Float32x4.store(t,4,SIMD.Float32x4.add(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),SIMD.Float32x4.store(t,8,SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,n))),t},i.rotateX=n.USE_SIMD?i.SIMD.rotateX:i.scalar.rotateX,i.scalar.rotateY=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[8],u=e[9],h=e[10],f=e[11];return e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i-c*n,t[1]=o*i-u*n,t[2]=s*i-h*n,t[3]=l*i-f*n,t[8]=a*n+c*i,t[9]=o*n+u*i,t[10]=s*n+h*i,t[11]=l*n+f*i,t},i.SIMD.rotateY=function(t,e,r){var n=SIMD.Float32x4.splat(Math.sin(r)),i=SIMD.Float32x4.splat(Math.cos(r));e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);var a=SIMD.Float32x4.load(e,0),o=SIMD.Float32x4.load(e,8);return SIMD.Float32x4.store(t,0,SIMD.Float32x4.sub(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),SIMD.Float32x4.store(t,8,SIMD.Float32x4.add(SIMD.Float32x4.mul(a,n),SIMD.Float32x4.mul(o,i))),t},i.rotateY=n.USE_SIMD?i.SIMD.rotateY:i.scalar.rotateY,i.scalar.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),a=e[0],o=e[1],s=e[2],l=e[3],c=e[4],u=e[5],h=e[6],f=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=a*i+c*n,t[1]=o*i+u*n,t[2]=s*i+h*n,t[3]=l*i+f*n,t[4]=c*i-a*n,t[5]=u*i-o*n,t[6]=h*i-s*n,t[7]=f*i-l*n,t},i.SIMD.rotateZ=function(t,e,r){var n=SIMD.Float32x4.splat(Math.sin(r)),i=SIMD.Float32x4.splat(Math.cos(r));e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);var a=SIMD.Float32x4.load(e,0),o=SIMD.Float32x4.load(e,4);return SIMD.Float32x4.store(t,0,SIMD.Float32x4.add(SIMD.Float32x4.mul(a,i),SIMD.Float32x4.mul(o,n))),SIMD.Float32x4.store(t,4,SIMD.Float32x4.sub(SIMD.Float32x4.mul(o,i),SIMD.Float32x4.mul(a,n))),t},i.rotateZ=n.USE_SIMD?i.SIMD.rotateZ:i.scalar.rotateZ,i.fromTranslation=function(t,e){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]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},i.fromScaling=function(t,e){return t[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromRotation=function(t,e,r){var i,a,o,s=r[0],l=r[1],c=r[2],u=Math.sqrt(s*s+l*l+c*c);return Math.abs(u)<n.EPSILON?null:(u=1/u,s*=u,l*=u,c*=u,i=Math.sin(e),a=Math.cos(e),o=1-a,t[0]=s*s*o+a,t[1]=l*s*o+c*i,t[2]=c*s*o-l*i,t[3]=0,t[4]=s*l*o-c*i,t[5]=l*l*o+a,t[6]=c*l*o+s*i,t[7]=0,t[8]=s*c*o+l*i,t[9]=l*c*o-s*i,t[10]=c*c*o+a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t)},i.fromXRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromYRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.fromZRotation=function(t,e){var r=Math.sin(e),n=Math.cos(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,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},i.fromRotationTranslation=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,l=i+i,c=a+a,u=n*s,h=n*l,f=n*c,d=i*l,p=i*c,m=a*c,g=o*s,v=o*l,y=o*c;return t[0]=1-(d+m),t[1]=h+y,t[2]=f-v,t[3]=0,t[4]=h-y,t[5]=1-(u+m),t[6]=p+g,t[7]=0,t[8]=f+v,t[9]=p-g,t[10]=1-(u+d),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.getTranslation=function(t,e){return t[0]=e[12],t[1]=e[13],t[2]=e[14],t},i.getRotation=function(t,e){var r=e[0]+e[5]+e[10],n=0;return r>0?(n=2*Math.sqrt(r+1),t[3]=.25*n,t[0]=(e[6]-e[9])/n,t[1]=(e[8]-e[2])/n,t[2]=(e[1]-e[4])/n):e[0]>e[5]&e[0]>e[10]?(n=2*Math.sqrt(1+e[0]-e[5]-e[10]),t[3]=(e[6]-e[9])/n,t[0]=.25*n,t[1]=(e[1]+e[4])/n,t[2]=(e[8]+e[2])/n):e[5]>e[10]?(n=2*Math.sqrt(1+e[5]-e[0]-e[10]),t[3]=(e[8]-e[2])/n,t[0]=(e[1]+e[4])/n,t[1]=.25*n,t[2]=(e[6]+e[9])/n):(n=2*Math.sqrt(1+e[10]-e[0]-e[5]),t[3]=(e[1]-e[4])/n,t[0]=(e[8]+e[2])/n,t[1]=(e[6]+e[9])/n,t[2]=.25*n),t},i.fromRotationTranslationScale=function(t,e,r,n){var i=e[0],a=e[1],o=e[2],s=e[3],l=i+i,c=a+a,u=o+o,h=i*l,f=i*c,d=i*u,p=a*c,m=a*u,g=o*u,v=s*l,y=s*c,b=s*u,x=n[0],_=n[1],w=n[2];return t[0]=(1-(p+g))*x,t[1]=(f+b)*x,t[2]=(d-y)*x,t[3]=0,t[4]=(f-b)*_,t[5]=(1-(h+g))*_,t[6]=(m+v)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-v)*w,t[10]=(1-(h+p))*w,t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t},i.fromRotationTranslationScaleOrigin=function(t,e,r,n,i){var a=e[0],o=e[1],s=e[2],l=e[3],c=a+a,u=o+o,h=s+s,f=a*c,d=a*u,p=a*h,m=o*u,g=o*h,v=s*h,y=l*c,b=l*u,x=l*h,_=n[0],w=n[1],M=n[2],k=i[0],T=i[1],A=i[2];return t[0]=(1-(m+v))*_,t[1]=(d+x)*_,t[2]=(p-b)*_,t[3]=0,t[4]=(d-x)*w,t[5]=(1-(f+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+b)*M,t[9]=(g-y)*M,t[10]=(1-(f+m))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*T+t[8]*A),t[13]=r[1]+T-(t[1]*k+t[5]*T+t[9]*A),t[14]=r[2]+A-(t[2]*k+t[6]*T+t[10]*A),t[15]=1,t},i.fromQuat=function(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=r+r,s=n+n,l=i+i,c=r*o,u=n*o,h=n*s,f=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-h-p,t[1]=u+v,t[2]=f-g,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=d+m,t[7]=0,t[8]=f+g,t[9]=d-m,t[10]=1-c-h,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},i.frustum=function(t,e,r,n,i,a,o){var s=1/(r-e),l=1/(i-n),c=1/(a-o);return t[0]=2*a*s,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=2*a*l,t[6]=0,t[7]=0,t[8]=(r+e)*s,t[9]=(i+n)*l,t[10]=(o+a)*c,t[11]=-1,t[12]=0,t[13]=0,t[14]=o*a*2*c,t[15]=0,t},i.perspective=function(t,e,r,n,i){var a=1/Math.tan(e/2),o=1/(n-i);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=(i+n)*o,t[11]=-1,t[12]=0,t[13]=0,t[14]=2*i*n*o,t[15]=0,t},i.perspectiveFromFieldOfView=function(t,e,r,n){var i=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),o=Math.tan(e.leftDegrees*Math.PI/180),s=Math.tan(e.rightDegrees*Math.PI/180),l=2/(o+s),c=2/(i+a);return t[0]=l,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=c,t[6]=0,t[7]=0,t[8]=-(o-s)*l*.5,t[9]=(i-a)*c*.5,t[10]=n/(r-n),t[11]=-1,t[12]=0,t[13]=0,t[14]=n*r/(r-n),t[15]=0,t},i.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},i.lookAt=function(t,e,r,a){var o,s,l,c,u,h,f,d,p,m,g=e[0],v=e[1],y=e[2],b=a[0],x=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(g-w)<n.EPSILON&&Math.abs(v-M)<n.EPSILON&&Math.abs(y-k)<n.EPSILON?i.identity(t):(f=g-w,d=v-M,p=y-k,m=1/Math.sqrt(f*f+d*d+p*p),f*=m,d*=m,p*=m,o=x*p-_*d,s=_*f-b*p,l=b*d-x*f,(m=Math.sqrt(o*o+s*s+l*l))?(o*=m=1/m,s*=m,l*=m):(o=0,s=0,l=0),c=d*l-p*s,u=p*o-f*l,h=f*s-d*o,(m=Math.sqrt(c*c+u*u+h*h))?(c*=m=1/m,u*=m,h*=m):(c=0,u=0,h=0),t[0]=o,t[1]=c,t[2]=f,t[3]=0,t[4]=s,t[5]=u,t[6]=d,t[7]=0,t[8]=l,t[9]=h,t[10]=p,t[11]=0,t[12]=-(o*g+s*v+l*y),t[13]=-(c*g+u*v+h*y),t[14]=-(f*g+d*v+p*y),t[15]=1,t)},i.str=function(t){return"mat4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+", "+t[4]+", "+t[5]+", "+t[6]+", "+t[7]+", "+t[8]+", "+t[9]+", "+t[10]+", "+t[11]+", "+t[12]+", "+t[13]+", "+t[14]+", "+t[15]+")"},i.frob=function(t){return Math.sqrt(Math.pow(t[0],2)+Math.pow(t[1],2)+Math.pow(t[2],2)+Math.pow(t[3],2)+Math.pow(t[4],2)+Math.pow(t[5],2)+Math.pow(t[6],2)+Math.pow(t[7],2)+Math.pow(t[8],2)+Math.pow(t[9],2)+Math.pow(t[10],2)+Math.pow(t[11],2)+Math.pow(t[12],2)+Math.pow(t[13],2)+Math.pow(t[14],2)+Math.pow(t[15],2))},i.add=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[4]=e[4]+r[4],t[5]=e[5]+r[5],t[6]=e[6]+r[6],t[7]=e[7]+r[7],t[8]=e[8]+r[8],t[9]=e[9]+r[9],t[10]=e[10]+r[10],t[11]=e[11]+r[11],t[12]=e[12]+r[12],t[13]=e[13]+r[13],t[14]=e[14]+r[14],t[15]=e[15]+r[15],t},i.subtract=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[4]=e[4]-r[4],t[5]=e[5]-r[5],t[6]=e[6]-r[6],t[7]=e[7]-r[7],t[8]=e[8]-r[8],t[9]=e[9]-r[9],t[10]=e[10]-r[10],t[11]=e[11]-r[11],t[12]=e[12]-r[12],t[13]=e[13]-r[13],t[14]=e[14]-r[14],t[15]=e[15]-r[15],t},i.sub=i.subtract,i.multiplyScalar=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[4]=e[4]*r,t[5]=e[5]*r,t[6]=e[6]*r,t[7]=e[7]*r,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12]*r,t[13]=e[13]*r,t[14]=e[14]*r,t[15]=e[15]*r,t},i.multiplyScalarAndAdd=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[4]=e[4]+r[4]*n,t[5]=e[5]+r[5]*n,t[6]=e[6]+r[6]*n,t[7]=e[7]+r[7]*n,t[8]=e[8]+r[8]*n,t[9]=e[9]+r[9]*n,t[10]=e[10]+r[10]*n,t[11]=e[11]+r[11]*n,t[12]=e[12]+r[12]*n,t[13]=e[13]+r[13]*n,t[14]=e[14]+r[14]*n,t[15]=e[15]+r[15]*n,t},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]&&t[4]===e[4]&&t[5]===e[5]&&t[6]===e[6]&&t[7]===e[7]&&t[8]===e[8]&&t[9]===e[9]&&t[10]===e[10]&&t[11]===e[11]&&t[12]===e[12]&&t[13]===e[13]&&t[14]===e[14]&&t[15]===e[15]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],l=t[5],c=t[6],u=t[7],h=t[8],f=t[9],d=t[10],p=t[11],m=t[12],g=t[13],v=t[14],y=t[15],b=e[0],x=e[1],_=e[2],w=e[3],M=e[4],k=e[5],T=e[6],A=e[7],S=e[8],E=e[9],L=e[10],C=e[11],I=e[12],P=e[13],D=e[14],z=e[15];return Math.abs(r-b)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(b))&&Math.abs(i-x)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(x))&&Math.abs(a-_)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(_))&&Math.abs(o-w)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(w))&&Math.abs(s-M)<=n.EPSILON*Math.max(1,Math.abs(s),Math.abs(M))&&Math.abs(l-k)<=n.EPSILON*Math.max(1,Math.abs(l),Math.abs(k))&&Math.abs(c-T)<=n.EPSILON*Math.max(1,Math.abs(c),Math.abs(T))&&Math.abs(u-A)<=n.EPSILON*Math.max(1,Math.abs(u),Math.abs(A))&&Math.abs(h-S)<=n.EPSILON*Math.max(1,Math.abs(h),Math.abs(S))&&Math.abs(f-E)<=n.EPSILON*Math.max(1,Math.abs(f),Math.abs(E))&&Math.abs(d-L)<=n.EPSILON*Math.max(1,Math.abs(d),Math.abs(L))&&Math.abs(p-C)<=n.EPSILON*Math.max(1,Math.abs(p),Math.abs(C))&&Math.abs(m-I)<=n.EPSILON*Math.max(1,Math.abs(m),Math.abs(I))&&Math.abs(g-P)<=n.EPSILON*Math.max(1,Math.abs(g),Math.abs(P))&&Math.abs(v-D)<=n.EPSILON*Math.max(1,Math.abs(v),Math.abs(D))&&Math.abs(y-z)<=n.EPSILON*Math.max(1,Math.abs(y),Math.abs(z))},e.exports=i},{"./common.js":195}],200:[function(t,e,r){var n=t("./common.js"),i=t("./mat3.js"),a=t("./vec3.js"),o=t("./vec4.js"),s={};s.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.rotationTo=function(){var t=a.create(),e=a.fromValues(1,0,0),r=a.fromValues(0,1,0);return function(n,i,o){var l=a.dot(i,o);return l<-.999999?(a.cross(t,e,i),a.length(t)<1e-6&&a.cross(t,r,i),a.normalize(t,t),s.setAxisAngle(n,t,Math.PI),n):l>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(a.cross(t,i,o),n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=1+l,s.normalize(n,n))}}(),s.setAxes=function(){var t=i.create();return function(e,r,n,i){return t[0]=n[0],t[3]=n[1],t[6]=n[2],t[1]=i[0],t[4]=i[1],t[7]=i[2],t[2]=-r[0],t[5]=-r[1],t[8]=-r[2],s.normalize(e,s.fromMat3(e,t))}}(),s.clone=o.clone,s.fromValues=o.fromValues,s.copy=o.copy,s.set=o.set,s.identity=function(t){return t[0]=0,t[1]=0,t[2]=0,t[3]=1,t},s.setAxisAngle=function(t,e,r){r*=.5;var n=Math.sin(r);return t[0]=n*e[0],t[1]=n*e[1],t[2]=n*e[2],t[3]=Math.cos(r),t},s.getAxisAngle=function(t,e){var r=2*Math.acos(e[3]),n=Math.sin(r/2);return 0!=n?(t[0]=e[0]/n,t[1]=e[1]/n,t[2]=e[2]/n):(t[0]=1,t[1]=0,t[2]=0),r},s.add=o.add,s.multiply=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=r[0],l=r[1],c=r[2],u=r[3];return t[0]=n*u+o*s+i*c-a*l,t[1]=i*u+o*l+a*s-n*c,t[2]=a*u+o*c+n*l-i*s,t[3]=o*u-n*s-i*l-a*c,t},s.mul=s.multiply,s.scale=o.scale,s.rotateX=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+o*s,t[1]=i*l+a*s,t[2]=a*l-i*s,t[3]=o*l-n*s,t},s.rotateY=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l-a*s,t[1]=i*l+o*s,t[2]=a*l+n*s,t[3]=o*l-i*s,t},s.rotateZ=function(t,e,r){r*=.5;var n=e[0],i=e[1],a=e[2],o=e[3],s=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*s,t[1]=i*l-n*s,t[2]=a*l+o*s,t[3]=o*l-a*s,t},s.calculateW=function(t,e){var r=e[0],n=e[1],i=e[2];return t[0]=r,t[1]=n,t[2]=i,t[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),t},s.dot=o.dot,s.lerp=o.lerp,s.slerp=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],g=r[3];return(a=c*d+u*p+h*m+f*g)<0&&(a=-a,d=-d,p=-p,m=-m,g=-g),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),t[0]=s*c+l*d,t[1]=s*u+l*p,t[2]=s*h+l*m,t[3]=s*f+l*g,t},s.sqlerp=function(){var t=s.create(),e=s.create();return function(r,n,i,a,o,l){return s.slerp(t,n,o,l),s.slerp(e,i,a,l),s.slerp(r,t,e,2*l*(1-l)),r}}(),s.invert=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,s=o?1/o:0;return t[0]=-r*s,t[1]=-n*s,t[2]=-i*s,t[3]=a*s,t},s.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},s.length=o.length,s.len=s.length,s.squaredLength=o.squaredLength,s.sqrLen=s.squaredLength,s.normalize=o.normalize,s.fromMat3=function(t,e){var r,n=e[0]+e[4]+e[8];if(n>0)r=Math.sqrt(n+1),t[3]=.5*r,r=.5/r,t[0]=(e[5]-e[7])*r,t[1]=(e[6]-e[2])*r,t[2]=(e[1]-e[3])*r;else{var i=0;e[4]>e[0]&&(i=1),e[8]>e[3*i+i]&&(i=2);var a=(i+1)%3,o=(i+2)%3;r=Math.sqrt(e[3*i+i]-e[3*a+a]-e[3*o+o]+1),t[i]=.5*r,r=.5/r,t[3]=(e[3*a+o]-e[3*o+a])*r,t[a]=(e[3*a+i]+e[3*i+a])*r,t[o]=(e[3*o+i]+e[3*i+o])*r}return t},s.str=function(t){return"quat("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},s.exactEquals=o.exactEquals,s.equals=o.equals,e.exports=s},{"./common.js":195,"./mat3.js":198,"./vec3.js":202,"./vec4.js":203}],201:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(2);return t[0]=0,t[1]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(2);return e[0]=t[0],e[1]=t[1],e},i.fromValues=function(t,e){var r=new n.ARRAY_TYPE(2);return r[0]=t,r[1]=e,r},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t},i.set=function(t,e,r){return t[0]=e,t[1]=r,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t},i.min=function(t,e,r){return t[0]=Math.min(e[0],r[0]),t[1]=Math.min(e[1],r[1]),t},i.max=function(t,e,r){return t[0]=Math.max(e[0],r[0]),t[1]=Math.max(e[1],r[1]),t},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t},i.scaleAndAdd=function(t,e,r,n){return t[0]=e[0]+r[0]*n,t[1]=e[1]+r[1]*n,t},i.distance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return Math.sqrt(r*r+n*n)},i.dist=i.distance,i.squaredDistance=function(t,e){var r=e[0]-t[0],n=e[1]-t[1];return r*r+n*n},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1];return Math.sqrt(e*e+r*r)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1];return e*e+r*r},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i),t[0]=e[0]*i,t[1]=e[1]*i),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]},i.cross=function(t,e,r){var n=e[0]*r[1]-e[1]*r[0];return t[0]=t[1]=0,t[2]=n,t},i.lerp=function(t,e,r,n){var i=e[0],a=e[1];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI;return t[0]=Math.cos(r)*e,t[1]=Math.sin(r)*e,t},i.transformMat2=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i,t[1]=r[1]*n+r[3]*i,t},i.transformMat2d=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[2]*i+r[4],t[1]=r[1]*n+r[3]*i+r[5],t},i.transformMat3=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[3]*i+r[6],t[1]=r[1]*n+r[4]*i+r[7],t},i.transformMat4=function(t,e,r){var n=e[0],i=e[1];return t[0]=r[0]*n+r[4]*i+r[12],t[1]=r[1]*n+r[5]*i+r[13],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=2),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],a(t,t,o),e[s]=t[0],e[s+1]=t[1];return e}}(),i.str=function(t){return"vec2("+t[0]+", "+t[1]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]},i.equals=function(t,e){var r=t[0],i=t[1],a=e[0],o=e[1];return Math.abs(r-a)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(a))&&Math.abs(i-o)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(o))},e.exports=i},{"./common.js":195}],202:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(3);return t[0]=0,t[1]=0,t[2]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(3);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e},i.fromValues=function(t,e,r){var i=new n.ARRAY_TYPE(3);return i[0]=t,i[1]=e,i[2]=r,i},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t},i.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},i.add=function(t,e,r){return t[0]=e[0]+r[0],t[1]=e[1]+r[1],t[2]=e[2]+r[2],t},i.subtract=function(t,e,r){return t[0]=e[0]-r[0],t[1]=e[1]-r[1],t[2]=e[2]-r[2],t},i.sub=i.subtract,i.multiply=function(t,e,r){return t[0]=e[0]*r[0],t[1]=e[1]*r[1],t[2]=e[2]*r[2],t},i.mul=i.multiply,i.divide=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t},i.min=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},i.max=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},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t},i.scale=function(t,e,r){return t[0]=e[0]*r,t[1]=e[1]*r,t[2]=e[2]*r,t},i.scaleAndAdd=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},i.distance=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)},i.dist=i.distance,i.squaredDistance=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},i.sqrDist=i.squaredDistance,i.length=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},i.inverse=function(t,e){return t[0]=1/e[0],t[1]=1/e[1],t[2]=1/e[2],t},i.normalize=function(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},i.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},i.lerp=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t},i.hermite=function(t,e,r,n,i,a){var o=a*a,s=o*(2*a-3)+1,l=o*(a-2)+a,c=o*(a-1),u=o*(3-2*a);return t[0]=e[0]*s+r[0]*l+n[0]*c+i[0]*u,t[1]=e[1]*s+r[1]*l+n[1]*c+i[1]*u,t[2]=e[2]*s+r[2]*l+n[2]*c+i[2]*u,t},i.bezier=function(t,e,r,n,i,a){var o=1-a,s=o*o,l=a*a,c=s*o,u=3*a*s,h=3*l*o,f=l*a;return t[0]=e[0]*c+r[0]*u+n[0]*h+i[0]*f,t[1]=e[1]*c+r[1]*u+n[1]*h+i[1]*f,t[2]=e[2]*c+r[2]*u+n[2]*h+i[2]*f,t},i.random=function(t,e){e=e||1;var r=2*n.RANDOM()*Math.PI,i=2*n.RANDOM()-1,a=Math.sqrt(1-i*i)*e;return t[0]=Math.cos(r)*a,t[1]=Math.sin(r)*a,t[2]=i*e,t},i.transformMat4=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},i.transformMat3=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},i.transformQuat=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,h=c*i+l*n-o*a,f=c*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=u*c+d*-o+h*-l-f*-s,t[1]=h*c+d*-s+f*-o-u*-l,t[2]=f*c+d*-l+u*-s-h*-o,t},i.rotateX=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateY=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.rotateZ=function(t,e,r,n){var i=[],a=[];return i[0]=e[0]-r[0],i[1]=e[1]-r[1],i[2]=e[2]-r[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],t[0]=a[0]+r[0],t[1]=a[1]+r[1],t[2]=a[2]+r[2],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=3),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}}(),i.angle=function(t,e){var r=i.fromValues(t[0],t[1],t[2]),n=i.fromValues(e[0],e[1],e[2]);i.normalize(r,r),i.normalize(n,n);var a=i.dot(r,n);return a>1?0:Math.acos(a)},i.str=function(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]},i.equals=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.EPSILON*Math.max(1,Math.abs(r),Math.abs(o))&&Math.abs(i-s)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(s))&&Math.abs(a-l)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))},e.exports=i},{"./common.js":195}],203:[function(t,e,r){var n=t("./common.js"),i={};i.create=function(){var t=new n.ARRAY_TYPE(4);return t[0]=0,t[1]=0,t[2]=0,t[3]=0,t},i.clone=function(t){var e=new n.ARRAY_TYPE(4);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e},i.fromValues=function(t,e,r,i){var a=new n.ARRAY_TYPE(4);return a[0]=t,a[1]=e,a[2]=r,a[3]=i,a},i.copy=function(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t},i.set=function(t,e,r,n,i){return t[0]=e,t[1]=r,t[2]=n,t[3]=i,t},i.add=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},i.subtract=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},i.sub=i.subtract,i.multiply=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},i.mul=i.multiply,i.divide=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},i.div=i.divide,i.ceil=function(t,e){return t[0]=Math.ceil(e[0]),t[1]=Math.ceil(e[1]),t[2]=Math.ceil(e[2]),t[3]=Math.ceil(e[3]),t},i.floor=function(t,e){return t[0]=Math.floor(e[0]),t[1]=Math.floor(e[1]),t[2]=Math.floor(e[2]),t[3]=Math.floor(e[3]),t},i.min=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},i.max=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},i.round=function(t,e){return t[0]=Math.round(e[0]),t[1]=Math.round(e[1]),t[2]=Math.round(e[2]),t[3]=Math.round(e[3]),t},i.scale=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},i.scaleAndAdd=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},i.distance=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)},i.dist=i.distance,i.squaredDistance=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},i.sqrDist=i.squaredDistance,i.length=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)},i.len=i.length,i.squaredLength=function(t){var e=t[0],r=t[1],n=t[2],i=t[3];return e*e+r*r+n*n+i*i},i.sqrLen=i.squaredLength,i.negate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t},i.inverse=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},i.normalize=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;return o>0&&(o=1/Math.sqrt(o),t[0]=r*o,t[1]=n*o,t[2]=i*o,t[3]=a*o),t},i.dot=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]},i.lerp=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},i.random=function(t,e){return e=e||1,t[0]=n.RANDOM(),t[1]=n.RANDOM(),t[2]=n.RANDOM(),t[3]=n.RANDOM(),i.normalize(t,t),i.scale(t,t,e),t},i.transformMat4=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},i.transformQuat=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,h=c*i+l*n-o*a,f=c*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=u*c+d*-o+h*-l-f*-s,t[1]=h*c+d*-s+f*-o-u*-l,t[2]=f*c+d*-l+u*-s-h*-o,t[3]=e[3],t},i.forEach=function(){var t=i.create();return function(e,r,n,i,a,o){var s,l;for(r||(r=4),n||(n=0),l=i?Math.min(i*r+n,e.length):e.length,s=n;s<l;s+=r)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],t[3]=e[s+3],a(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2],e[s+3]=t[3];return e}}(),i.str=function(t){return"vec4("+t[0]+", "+t[1]+", "+t[2]+", "+t[3]+")"},i.exactEquals=function(t,e){return t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]},i.equals=function(t,e){var r=t[0],i=t[1],a=t[2],o=t[3],s=e[0],l=e[1],c=e[2],u=e[3];return Math.abs(r-s)<=n.EPSILON*Math.max(1,Math.abs(r),Math.abs(s))&&Math.abs(i-l)<=n.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=n.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(o-u)<=n.EPSILON*Math.max(1,Math.abs(o),Math.abs(u))},e.exports=i},{"./common.js":195}],204:[function(t,e,r){"use strict";function n(t,e){for(var r=[0,0,0,0],n=0;n<4;++n)for(var i=0;i<4;++i)r[i]+=t[4*n+i]*e[n];return r}function i(t,e,r,i,a){for(var o=n(i,n(r,n(e,[t[0],t[1],t[2],1]))),s=0;s<3;++s)o[s]/=o[3];return[.5*a[0]*(1+o[0]),.5*a[1]*(1-o[1])]}var a=t("barycentric"),o=t("polytope-closest-point/lib/closest_point_2d.js");e.exports=function(t,e,r,n,s,l){if(1===t.length)return[0,t[0].slice()];for(var c=new Array(t.length),u=0;u<t.length;++u)c[u]=i(t[u],r,n,s,l);var h=0,f=1/0;for(u=0;u<c.length;++u){for(var d=0,p=0;p<2;++p)d+=Math.pow(c[u][p]-e[p],2);d<f&&(f=d,h=u)}var m=function(t,e){if(2===t.length){for(var r=0,n=0,i=0;i<2;++i)r+=Math.pow(e[i]-t[0][i],2),n+=Math.pow(e[i]-t[1][i],2);return r=Math.sqrt(r),n=Math.sqrt(n),r+n<1e-6?[1,0]:[n/(r+n),r/(n+r)]}if(3===t.length){var s=[0,0];return o(t[0],t[1],t[2],e,s),a(t,s)}return[]}(c,e),g=0;for(u=0;u<3;++u){if(m[u]<-.001||m[u]>1.0001)return null;g+=m[u]}return Math.abs(g-1)>.001?null:[h,function(t,e){for(var r=[0,0,0],n=0;n<t.length;++n)for(var i=t[n],a=e[n],o=0;o<3;++o)r[o]+=a*i[o];return r}(t,m),m]}},{barycentric:50,"polytope-closest-point/lib/closest_point_2d.js":495}],205:[function(t,e,r){var n="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(f_position, clipBounds[0])) || \n any(greaterThan(f_position, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId, f_id.xyz);\n}";r.meshShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, normal;\nattribute vec4 color;\nattribute vec2 uv;\n\nuniform mat4 model\n , view\n , projection;\nuniform vec3 eyePosition\n , lightPosition;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n vec4 m_position = model * vec4(position, 1.0);\n vec4 t_position = view * m_position;\n gl_Position = projection * t_position;\n f_color = color;\n f_normal = normal;\n f_data = position;\n f_eyeDirection = eyePosition - position;\n f_lightDirection = lightPosition - position;\n f_uv = uv;\n}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(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\n\n\nfloat cookTorranceSpecular_1_1(\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_2_0(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\n\nuniform vec3 clipBounds[2];\nuniform float roughness\n , fresnel\n , kambient\n , kdiffuse\n , kspecular\n , opacity;\nuniform sampler2D texture;\n\nvarying vec3 f_normal\n , f_lightDirection\n , f_eyeDirection\n , f_data;\nvarying vec4 f_color;\nvarying vec2 f_uv;\n\nvoid main() {\n if(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(f_normal);\n vec3 L = normalize(f_lightDirection);\n vec3 V = normalize(f_eyeDirection);\n \n if(!gl_FrontFacing) {\n N = -N;\n }\n\n float specular = cookTorranceSpecular_1_1(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}",attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.wireShader={vertex:"precision mediump 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}",fragment:"precision mediump float;\n#define GLSLIFY 1\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(any(lessThan(f_data, clipBounds[0])) || \n any(greaterThan(f_data, clipBounds[1]))) {\n discard;\n }\n\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},r.pointShader={vertex:"precision mediump float;\n#define GLSLIFY 1\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(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n }\n gl_PointSize = pointSize;\n f_color = color;\n f_uv = uv;\n}",fragment:"precision mediump 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}",attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},r.pickShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n f_id = id;\n f_position = position;\n}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},r.pointPickShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute float pointSize;\nattribute vec4 id;\n\nuniform mat4 model, view, projection;\nuniform vec3 clipBounds[2];\n\nvarying vec3 f_position;\nvarying vec4 f_id;\n\nvoid main() {\n if(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1]))) {\n gl_Position = vec4(0,0,0,0);\n } else {\n gl_Position = projection * view * model * vec4(position, 1.0);\n gl_PointSize = pointSize;\n }\n f_id = id;\n f_position = position;\n}",fragment:n,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},r.contourShader={vertex:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\n\nuniform mat4 model, view, projection;\n\nvoid main() {\n gl_Position = projection * view * model * vec4(position, 1.0);\n}",fragment:"precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n",attributes:[{name:"position",type:"vec3"}]}},{}],206:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w,k,T,A,S){this.gl=t,this.cells=[],this.positions=[],this.intensity=[],this.texture=e,this.dirty=!0,this.triShader=r,this.lineShader=n,this.pointShader=i,this.pickShader=a,this.pointPickShader=o,this.contourShader=s,this.trianglePositions=l,this.triangleColors=u,this.triangleNormals=f,this.triangleUVs=h,this.triangleIds=c,this.triangleVAO=d,this.triangleCount=0,this.lineWidth=1,this.edgePositions=p,this.edgeColors=g,this.edgeUVs=v,this.edgeIds=m,this.edgeVAO=y,this.edgeCount=0,this.pointPositions=b,this.pointColors=_,this.pointUVs=w,this.pointSizes=k,this.pointIds=x,this.pointVAO=T,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=A,this.contourVAO=S,this.contourCount=0,this.contourColor=[0,0,0],this.contourEnable=!0,this.pickId=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lightPosition=[1e5,1e5,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.opacity=1,this._model=M,this._view=M,this._projection=M,this._resolution=[1,1]}var i=t("gl-shader"),a=t("gl-buffer"),o=t("gl-vao"),s=t("gl-texture2d"),l=t("normals"),c=t("gl-mat4/multiply"),u=t("gl-mat4/invert"),h=t("ndarray"),f=t("colormap"),d=t("simplicial-complex-contour"),p=t("typedarray-pool"),m=t("./lib/shaders"),g=t("./lib/closest-point"),v=m.meshShader,y=m.wireShader,b=m.pointShader,x=m.pickShader,_=m.pointPickShader,w=m.contourShader,M=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],k=n.prototype;k.isOpaque=function(){return this.opacity>=1},k.isTransparent=function(){return this.opacity<1},k.pickSlots=1,k.setPickBase=function(t){this.pickId=t},k.highlight=function(t){if(t&&this.contourEnable){for(var e=d(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;l<a;++l)for(var c=r[l],u=0;u<2;++u){var h=c[0];2===c.length&&(h=c[u]);for(var f=n[h][0],m=n[h][1],g=i[h],v=1-g,y=this.positions[f],b=this.positions[m],x=0;x<3;++x)o[s++]=g*y[x]+v*b[x]}this.contourCount=s/3|0,this.contourPositions.update(o.subarray(0,s)),p.free(o)}else this.contourCount=0},k.update=function(t){t=t||{};var e=this.gl;this.dirty=!0,"contourEnable"in t&&(this.contourEnable=t.contourEnable),"contourColor"in t&&(this.contourColor=t.contourColor),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"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),t.texture?(this.texture.dispose(),this.texture=s(e,t.texture)):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=f({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 h(r,[256,256,4],[4,0,1])}(t.colormap)),this.texture.generateMipmap());var r=t.cells,n=t.positions;if(n&&r){var i=[],a=[],o=[],c=[],u=[],d=[],p=[],m=[],g=[],v=[],y=[],b=[],x=[],_=[];this.cells=r,this.positions=n;var w=t.vertexNormals,M=t.cellNormals,k=void 0===t.vertexNormalsEpsilon?1e-6:t.vertexNormalsEpsilon,T=void 0===t.faceNormalsEpsilon?1e-6:t.faceNormalsEpsilon;t.useFacetNormals&&!M&&(M=l.faceNormals(r,n,T)),M||w||(w=l.vertexNormals(r,n,k));var A=t.vertexColors,S=t.cellColors,E=t.meshColor||[1,1,1,1],L=t.vertexUVs,C=t.vertexIntensity,I=t.cellUVs,P=t.cellIntensity,D=1/0,z=-1/0;if(!L&&!I)if(C)if(t.vertexIntensityBounds)D=+t.vertexIntensityBounds[0],z=+t.vertexIntensityBounds[1];else for(var O=0;O<C.length;++O){var F=C[O];D=Math.min(D,F),z=Math.max(z,F)}else if(P)for(O=0;O<P.length;++O){F=P[O];D=Math.min(D,F),z=Math.max(z,F)}else for(O=0;O<n.length;++O){F=n[O][2];D=Math.min(D,F),z=Math.max(z,F)}this.intensity=C||(P?function(t,e,r){for(var n=new Array(e),i=0;i<e;++i)n[i]=0;var a=t.length;for(i=0;i<a;++i)for(var o=t[i],s=0;s<o.length;++s)n[o[s]]=r[i];return n}(r,n.length,P):function(t){for(var e=t.length,r=new Array(e),n=0;n<e;++n)r[n]=t[n][2];return r}(n));var R=t.pointSizes,j=t.pointSize||1;this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];for(O=0;O<n.length;++O)for(var N=n[O],B=0;B<3;++B)!isNaN(N[B])&&isFinite(N[B])&&(this.bounds[0][B]=Math.min(this.bounds[0][B],N[B]),this.bounds[1][B]=Math.max(this.bounds[1][B],N[B]));var U=0,V=0,H=0;t:for(O=0;O<r.length;++O){var q=r[O];switch(q.length){case 1:for(N=n[Y=q[0]],B=0;B<3;++B)if(isNaN(N[B])||!isFinite(N[B]))continue t;v.push(N[0],N[1],N[2]);3===(W=A?A[Y]:S?S[O]:E).length?y.push(W[0],W[1],W[2],1):y.push(W[0],W[1],W[2],W[3]);X=L?L[Y]:C?[(C[Y]-D)/(z-D),0]:I?I[O]:P?[(P[O]-D)/(z-D),0]:[(N[2]-D)/(z-D),0],b.push(X[0],X[1]),R?x.push(R[Y]):x.push(j),_.push(O),H+=1;break;case 2:for(B=0;B<2;++B){N=n[Y=q[B]];for(var G=0;G<3;++G)if(isNaN(N[G])||!isFinite(N[G]))continue t}for(B=0;B<2;++B){N=n[Y=q[B]];d.push(N[0],N[1],N[2]);3===(W=A?A[Y]:S?S[O]:E).length?p.push(W[0],W[1],W[2],1):p.push(W[0],W[1],W[2],W[3]);X=L?L[Y]:C?[(C[Y]-D)/(z-D),0]:I?I[O]:P?[(P[O]-D)/(z-D),0]:[(N[2]-D)/(z-D),0],m.push(X[0],X[1]),g.push(O)}V+=1;break;case 3:for(B=0;B<3;++B)for(N=n[Y=q[B]],G=0;G<3;++G)if(isNaN(N[G])||!isFinite(N[G]))continue t;for(B=0;B<3;++B){var Y;N=n[Y=q[B]];i.push(N[0],N[1],N[2]);var W;3===(W=A?A[Y]:S?S[O]:E).length?a.push(W[0],W[1],W[2],1):a.push(W[0],W[1],W[2],W[3]);var X;X=L?L[Y]:C?[(C[Y]-D)/(z-D),0]:I?I[O]:P?[(P[O]-D)/(z-D),0]:[(N[2]-D)/(z-D),0],c.push(X[0],X[1]);var Z;Z=w?w[Y]:M[O],o.push(Z[0],Z[1],Z[2]),u.push(O)}U+=1}}this.pointCount=H,this.edgeCount=V,this.triangleCount=U,this.pointPositions.update(v),this.pointColors.update(y),this.pointUVs.update(b),this.pointSizes.update(x),this.pointIds.update(new Uint32Array(_)),this.edgePositions.update(d),this.edgeColors.update(p),this.edgeUVs.update(m),this.edgeIds.update(new Uint32Array(g)),this.trianglePositions.update(i),this.triangleColors.update(a),this.triangleUVs.update(c),this.triangleNormals.update(o),this.triangleIds.update(new Uint32Array(u))}},k.drawTransparent=k.draw=function(t){t=t||{};for(var e=this.gl,r=t.model||M,n=t.view||M,i=t.projection||M,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);var s={model:r,view:n,projection:i,clipBounds:a,kambient:this.ambientLight,kdiffuse:this.diffuseLight,kspecular:this.specularLight,roughness:this.roughness,fresnel:this.fresnel,eyePosition:[0,0,0],lightPosition:[0,0,0],opacity:this.opacity,contourColor:this.contourColor,texture:0};this.texture.bind(0);var l=new Array(16);c(l,s.view,s.model),c(l,s.projection,l),u(l,l);for(o=0;o<3;++o)s.eyePosition[o]=l[12+o]/l[15];var h=l[15];for(o=0;o<3;++o)h+=this.lightPosition[o]*l[4*o+3];for(o=0;o<3;++o){for(var f=l[12+o],d=0;d<3;++d)f+=l[4*d+o]*this.lightPosition[d];s.lightPosition[o]=f/h}if(this.triangleCount>0){(p=this.triShader).bind(),p.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()}if(this.edgeCount>0&&this.lineWidth>0){(p=this.lineShader).bind(),p.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()}if(this.pointCount>0){(p=this.pointShader).bind(),p.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind()}if(this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0){var p;(p=this.contourShader).bind(),p.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||M,n=t.view||M,i=t.projection||M,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255};if((l=this.pickShader).bind(),l.uniforms=s,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0){var l;(l=this.pointPickShader).bind(),l.uniforms=s,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;a<r.length;++a)i[a]=n[r[a]];var o=g(i,[t.coord[0],this._resolution[1]-t.coord[1]],this._model,this._view,this._projection,this._resolution);if(!o)return null;var s=o[2],l=0;for(a=0;a<r.length;++a)l+=s[a]*this.intensity[r[a]];return{position:o[1],index:r[o[0]],cell:r,cellId:e,intensity:l,dataCoordinate:this.positions[r[o[0]]]}},k.dispose=function(){this.texture.dispose(),this.triShader.dispose(),this.lineShader.dispose(),this.pointShader.dispose(),this.pickShader.dispose(),this.pointPickShader.dispose(),this.triangleVAO.dispose(),this.trianglePositions.dispose(),this.triangleColors.dispose(),this.triangleUVs.dispose(),this.triangleNormals.dispose(),this.triangleIds.dispose(),this.edgeVAO.dispose(),this.edgePositions.dispose(),this.edgeColors.dispose(),this.edgeUVs.dispose(),this.edgeIds.dispose(),this.pointVAO.dispose(),this.pointPositions.dispose(),this.pointColors.dispose(),this.pointUVs.dispose(),this.pointSizes.dispose(),this.pointIds.dispose(),this.contourVAO.dispose(),this.contourPositions.dispose(),this.contourShader.dispose()},e.exports=function(t,e){1===arguments.length&&(t=(e=t).gl);var r=function(t){var e=i(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}(t),l=function(t){var e=i(t,y.vertex,y.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e}(t),c=function(t){var e=i(t,b.vertex,b.fragment);return e.attributes.position.location=0,e.attributes.color.location=2,e.attributes.uv.location=3,e.attributes.pointSize.location=4,e}(t),u=function(t){var e=i(t,x.vertex,x.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e}(t),f=function(t){var e=i(t,_.vertex,_.fragment);return e.attributes.position.location=0,e.attributes.id.location=1,e.attributes.pointSize.location=4,e}(t),d=function(t){var e=i(t,w.vertex,w.fragment);return e.attributes.position.location=0,e}(t),p=s(t,h(new Uint8Array([255,255,255,255]),[1,1,4]));p.generateMipmap(),p.minFilter=t.LINEAR_MIPMAP_LINEAR,p.magFilter=t.LINEAR;var m=a(t),g=a(t),M=a(t),k=a(t),T=a(t),A=o(t,[{buffer:m,type:t.FLOAT,size:3},{buffer:T,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:g,type:t.FLOAT,size:4},{buffer:M,type:t.FLOAT,size:2},{buffer:k,type:t.FLOAT,size:3}]),S=a(t),E=a(t),L=a(t),C=a(t),I=o(t,[{buffer:S,type:t.FLOAT,size:3},{buffer:C,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:E,type:t.FLOAT,size:4},{buffer:L,type:t.FLOAT,size:2}]),P=a(t),D=a(t),z=a(t),O=a(t),F=a(t),R=o(t,[{buffer:P,type:t.FLOAT,size:3},{buffer:F,type:t.UNSIGNED_BYTE,size:4,normalized:!0},{buffer:D,type:t.FLOAT,size:4},{buffer:z,type:t.FLOAT,size:2},{buffer:O,type:t.FLOAT,size:1}]),j=a(t),N=new n(t,p,r,l,c,u,f,d,m,T,g,M,k,A,S,C,E,L,I,P,F,D,z,O,R,j,o(t,[{buffer:j,type:t.FLOAT,size:3}]));return N.update(e),N}},{"./lib/closest-point":204,"./lib/shaders":205,colormap:100,"gl-buffer":157,"gl-mat4/invert":182,"gl-mat4/multiply":184,"gl-shader":256,"gl-texture2d":268,"gl-vao":272,ndarray:468,normals:470,"simplicial-complex-contour":526,"typedarray-pool":550}],207:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}e.exports=function(t){var e=t.gl;return new n(t,i(e,[0,0,0,1,1,0,1,1]),a(e,o.boxVert,o.lineFrag))};var i=t("gl-buffer"),a=t("gl-shader"),o=t("./shaders"),s=n.prototype;s.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},s.drawBox=function(){var t=[0,0],e=[0,0];return function(r,n,i,a,o){var s=this.plot,l=this.shader,c=s.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=a,l.uniforms.lo=t,l.uniforms.hi=e,l.uniforms.color=o,c.drawArrays(c.TRIANGLE_STRIP,0,4)}}(),s.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":210,"gl-buffer":157,"gl-shader":213}],208:[function(t,e,r){"use strict";function n(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function i(t,e){return t-e}e.exports=function(t){var e=t.gl;return new n(t,a(e),o(e,l.gridVert,l.gridFrag),o(e,l.tickVert,l.gridFrag))};var a=t("gl-buffer"),o=t("gl-shader"),s=t("binary-search-bounds"),l=t("./shaders"),c=n.prototype;c.draw=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){for(var n=this.plot,i=this.vbo,a=this.shader,o=this.ticks,s=n.gl,l=n._tickBounds,c=n.dataBox,u=n.viewBox,h=n.gridLineWidth,f=n.gridLineColor,d=n.gridLineEnable,p=n.pixelRatio,m=0;m<2;++m){var g=l[m],v=l[m+2]-g,y=.5*(c[m+2]+c[m]),b=c[m+2]-c[m];e[m]=2*v/b,t[m]=2*(g-y)/b}a.bind(),i.bind(),a.attributes.dataCoord.pointer(),a.uniforms.dataShift=t,a.uniforms.dataScale=e;var x=0;for(m=0;m<2;++m){r[0]=r[1]=0,r[m]=1,a.uniforms.dataAxis=r,a.uniforms.lineWidth=h[m]/(u[m+2]-u[m])*p,a.uniforms.color=f[m];var _=6*o[m].length;d[m]&&_&&s.drawArrays(s.TRIANGLES,x,_),x+=_}}}(),c.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],a=[0,0],o=[0,0];return function(){for(var l=this.plot,c=this.vbo,u=this.tickShader,h=this.ticks,f=l.gl,d=l._tickBounds,p=l.dataBox,m=l.viewBox,g=l.pixelRatio,v=l.screenBox,y=v[2]-v[0],b=v[3]-v[1],x=m[2]-m[0],_=m[3]-m[1],w=0;w<2;++w){var M=d[w],k=d[w+2]-M,T=.5*(p[w+2]+p[w]),A=p[w+2]-p[w];e[w]=2*k/A,t[w]=2*(M-T)/A}e[0]*=x/y,t[0]*=x/y,e[1]*=_/b,t[1]*=_/b,u.bind(),c.bind(),u.attributes.dataCoord.pointer();var S=u.uniforms;S.dataShift=t,S.dataScale=e;var E=l.tickMarkLength,L=l.tickMarkWidth,C=l.tickMarkColor,I=6*h[0].length,P=Math.min(s.ge(h[0],(p[0]-d[0])/(d[2]-d[0]),i),h[0].length),D=Math.min(s.gt(h[0],(p[2]-d[0])/(d[2]-d[0]),i),h[0].length),z=0+6*P,O=6*Math.max(0,D-P),F=Math.min(s.ge(h[1],(p[1]-d[1])/(d[3]-d[1]),i),h[1].length),R=Math.min(s.gt(h[1],(p[3]-d[1])/(d[3]-d[1]),i),h[1].length),j=I+6*F,N=6*Math.max(0,R-F);a[0]=2*(m[0]-E[1])/y-1,a[1]=(m[3]+m[1])/b-1,o[0]=E[1]*g/y,o[1]=L[1]*g/b,N&&(S.color=C[1],S.tickScale=o,S.dataAxis=n,S.screenOffset=a,f.drawArrays(f.TRIANGLES,j,N)),a[0]=(m[2]+m[0])/y-1,a[1]=2*(m[1]-E[0])/b-1,o[0]=L[0]*g/y,o[1]=E[0]*g/b,O&&(S.color=C[0],S.tickScale=o,S.dataAxis=r,S.screenOffset=a,f.drawArrays(f.TRIANGLES,z,O)),a[0]=2*(m[2]+E[3])/y-1,a[1]=(m[3]+m[1])/b-1,o[0]=E[3]*g/y,o[1]=L[3]*g/b,N&&(S.color=C[3],S.tickScale=o,S.dataAxis=n,S.screenOffset=a,f.drawArrays(f.TRIANGLES,j,N)),a[0]=(m[2]+m[0])/y-1,a[1]=2*(m[3]+E[2])/b-1,o[0]=L[2]*g/y,o[1]=E[2]*g/b,O&&(S.color=C[2],S.tickScale=o,S.dataAxis=r,S.screenOffset=a,f.drawArrays(f.TRIANGLES,z,O))}}(),c.update=function(){var t=[1,1,-1,-1,1,-1],e=[1,-1,1,1,-1,-1];return function(r){for(var n=r.ticks,i=r.bounds,a=new Float32Array(18*(n[0].length+n[1].length)),o=(this.plot.zeroLineEnable,0),s=[[],[]],l=0;l<2;++l)for(var c=s[l],u=n[l],h=i[l],f=i[l+2],d=0;d<u.length;++d){var p=(u[d].x-h)/(f-h);c.push(p);for(var m=0;m<6;++m)a[o++]=p,a[o++]=t[m],a[o++]=e[m]}this.ticks=s,this.vbo.update(a)}}(),c.dispose=function(){this.vbo.dispose(),this.shader.dispose(),this.tickShader.dispose()}},{"./shaders":210,"binary-search-bounds":212,"gl-buffer":157,"gl-shader":213}],209:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r}e.exports=function(t){var e=t.gl;return new n(t,i(e,[-1,-1,-1,1,1,-1,1,1]),a(e,o.lineVert,o.lineFrag))};var i=t("gl-buffer"),a=t("gl-shader"),o=t("./shaders"),s=n.prototype;s.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},s.drawLine=function(){var t=[0,0],e=[0,0];return function(r,n,i,a,o,s){var l=this.plot,c=this.shader,u=l.gl;t[0]=r,t[1]=n,e[0]=i,e[1]=a,c.uniforms.start=t,c.uniforms.end=e,c.uniforms.width=o*l.pixelRatio,c.uniforms.color=s,u.drawArrays(u.TRIANGLE_STRIP,0,4)}}(),s.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":210,"gl-buffer":157,"gl-shader":213}],210:[function(t,e,r){"use strict";var n="precision lowp float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = vec4(color.xyz * color.w, color.w);\n}\n";e.exports={lineVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 start, end;\nuniform float width;\n\nvec2 perp(vec2 v) {\n return vec2(v.y, -v.x);\n}\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n vec2 delta = normalize(perp(start - end));\n vec2 offset = mix(start, end, 0.5 * (coord.y+1.0));\n gl_Position = vec4(screen(offset + 0.5 * width * delta * coord.x), 0, 1);\n}\n",lineFrag:n,textVert:"#define GLSLIFY 1\nattribute vec3 textCoordinate;\n\nuniform vec2 dataScale, dataShift, dataAxis, screenOffset, textScale;\nuniform float angle;\n\nvoid main() {\n float dataOffset = textCoordinate.z;\n vec2 glyphOffset = textCoordinate.xy;\n mat2 glyphMatrix = mat2(cos(angle), sin(angle), -sin(angle), cos(angle));\n vec2 screenCoordinate = dataAxis * (dataScale * dataOffset + dataShift) +\n glyphMatrix * glyphOffset * textScale + screenOffset;\n gl_Position = vec4(screenCoordinate, 0, 1);\n}\n",textFrag:n,gridVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 dataCoord;\n\nuniform vec2 dataAxis, dataShift, dataScale;\nuniform float lineWidth;\n\nvoid main() {\n vec2 pos = dataAxis * (dataScale * dataCoord.x + dataShift);\n pos += 10.0 * dataCoord.y * vec2(dataAxis.y, -dataAxis.x) + dataCoord.z * lineWidth;\n gl_Position = vec4(pos, 0, 1);\n}\n",gridFrag:n,boxVert:"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 coord;\n\nuniform vec4 screenBox;\nuniform vec2 lo, hi;\n\nvec2 screen(vec2 v) {\n return 2.0 * (v - screenBox.xy) / (screenBox.zw - screenBox.xy) - 1.0;\n}\n\nvoid main() {\n gl_Position = vec4(screen(mix(lo, hi, coord)), 0, 1);\n}\n",tickVert:"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"}},{}],211:[function(t,e,r){"use strict";function n(t,e,r){this.plot=t,this.vbo=e,this.shader=r,this.tickOffset=[[],[]],this.tickX=[[],[]],this.labelOffset=[0,0],this.labelCount=[0,0]}e.exports=function(t){var e=t.gl;return new n(t,i(e),a(e,l.textVert,l.textFrag))};var i=t("gl-buffer"),a=t("gl-shader"),o=t("text-cache"),s=t("binary-search-bounds"),l=t("./shaders"),c=n.prototype;c.drawTicks=function(){var t=[0,0],e=[0,0],r=[0,0];return function(n){var i=this.plot,a=this.shader,o=this.tickX[n],l=this.tickOffset[n],c=i.gl,u=i.viewBox,h=i.dataBox,f=i.screenBox,d=i.pixelRatio,p=i.tickEnable,m=i.tickPad,g=i.tickColor,v=i.tickAngle,y=i.labelEnable,b=i.labelPad,x=i.labelColor,_=i.labelAngle,w=this.labelOffset[n],M=this.labelCount[n],k=s.lt(o,h[n]),T=s.le(o,h[n+2]);t[0]=t[1]=0,t[n]=1,e[n]=(u[2+n]+u[n])/(f[2+n]-f[n])-1;var A=2/f[2+(1^n)]-f[1^n];e[1^n]=A*u[1^n]-1,p[n]&&(e[1^n]-=A*d*m[n],k<T&&l[T]>l[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n],a.uniforms.angle=v[n],c.drawArrays(c.TRIANGLES,l[k],l[T]-l[k]))),y[n]&&M&&(e[1^n]-=A*d*b[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=_[n],c.drawArrays(c.TRIANGLES,w,M)),e[1^n]=A*u[2+(1^n)]-1,p[n+2]&&(e[1^n]+=A*d*m[n+2],k<T&&l[T]>l[k]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n+2],a.uniforms.angle=v[n+2],c.drawArrays(c.TRIANGLES,l[k],l[T]-l[k]))),y[n+2]&&M&&(e[1^n]+=A*d*b[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=_[n+2],c.drawArrays(c.TRIANGLES,w,M))}}(),c.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)}}}(),c.bind=function(){var t=[0,0],e=[0,0],r=[0,0];return function(){var n=this.plot,i=this.shader,a=n._tickBounds,o=n.dataBox,s=n.screenBox,l=n.viewBox;i.bind();for(var c=0;c<2;++c){var u=a[c],h=a[c+2]-u,f=.5*(o[c+2]+o[c]),d=o[c+2]-o[c],p=l[c],m=l[c+2]-p,g=s[c],v=s[c+2]-g;e[c]=2*h/d*m/v,t[c]=2*(u-f)/d*m/v}r[1]=2*n.pixelRatio/(s[3]-s[1]),r[0]=r[1]*(s[3]-s[1])/(s[2]-s[0]),i.uniforms.dataScale=e,i.uniforms.dataShift=t,i.uniforms.textScale=r,this.vbo.bind(),i.attributes.textCoordinate.pointer()}}(),c.update=function(t){var e,r,n,i,a,s=[],l=t.ticks,c=t.bounds;for(a=0;a<2;++a){var u=[Math.floor(s.length/3)],h=[-1/0],f=l[a];for(e=0;e<f.length;++e){var d=f[e],p=d.x,m=d.text,g=d.font||"sans-serif";i=d.fontSize||12;for(var v=1/(c[a+2]-c[a]),y=c[a],b=m.split("\n"),x=0;x<b.length;x++)for(n=o(g,b[x]).data,r=0;r<n.length;r+=2)s.push(n[r]*i,-n[r+1]*i-x*i*1.2,(p-y)*v);u.push(Math.floor(s.length/3)),h.push(p)}this.tickOffset[a]=u,this.tickX[a]=h}for(a=0;a<2;++a){for(this.labelOffset[a]=Math.floor(s.length/3),n=o(t.labelFont[a],t.labels[a],{textAlign:"center"}).data,i=t.labelSize[a],e=0;e<n.length;e+=2)s.push(n[e]*i,-n[e+1]*i,0);this.labelCount[a]=Math.floor(s.length/3)-this.labelOffset[a]}for(this.titleOffset=Math.floor(s.length/3),n=o(t.titleFont,t.title).data,i=t.titleSize,e=0;e<n.length;e+=2)s.push(n[e]*i,-n[e+1]*i,0);this.titleCount=Math.floor(s.length/3)-this.titleOffset,this.vbo.update(s)},c.dispose=function(){this.vbo.dispose(),this.shader.dispose()}},{"./shaders":210,"binary-search-bounds":212,"gl-buffer":157,"gl-shader":213,"text-cache":541}],212:[function(t,e,r){arguments[4][85][0].apply(r,arguments)},{dup:85}],213:[function(t,e,r){"use strict";function n(t){this.gl=t,this.gl.lastAttribCount=0,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}var a=t("./lib/create-uniforms"),o=t("./lib/create-attributes"),s=t("./lib/reflect"),l=t("./lib/shader-cache"),c=t("./lib/runtime-reflect"),u=t("./lib/GLError"),h=n.prototype;h.bind=function(){this.program||this._relink();var t,e=this.gl.getProgramParameter(this.program,this.gl.ACTIVE_ATTRIBUTES),r=this.gl.lastAttribCount;if(e>r)for(t=r;t<e;t++)this.gl.enableVertexAttribArray(t);else if(r>e)for(t=e;t<r;t++)this.gl.disableVertexAttribArray(t);this.gl.lastAttribCount=e,this.gl.useProgram(this.program)},h.dispose=function(){for(var t=this.gl.lastAttribCount,e=0;e<t;e++)this.gl.disableVertexAttribArray(e);this.gl.lastAttribCount=0,this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},h.update=function(t,e,r,n){function h(){d.program=l.program(p,d._vref,d._fref,_,w);for(var t=0;t<r.length;++t)E[t]=p.getUniformLocation(d.program,r[t].name)}if(!e||1===arguments.length){var f=t;t=f.vertex,e=f.fragment,r=f.uniforms,n=f.attributes}var d=this,p=d.gl,m=d._vref;d._vref=l.shader(p,p.VERTEX_SHADER,t),m&&m.dispose(),d.vertShader=d._vref.shader;var g=this._fref;if(d._fref=l.shader(p,p.FRAGMENT_SHADER,e),g&&g.dispose(),d.fragShader=d._fref.shader,!r||!n){var v=p.createProgram();if(p.attachShader(v,d.fragShader),p.attachShader(v,d.vertShader),p.linkProgram(v),!p.getProgramParameter(v,p.LINK_STATUS)){var y=p.getProgramInfoLog(v);throw new u(y,"Error linking program:"+y)}r=r||c.uniforms(p,v),n=n||c.attributes(p,v),p.deleteProgram(v)}(n=n.slice()).sort(i);var b,x=[],_=[],w=[];for(b=0;b<n.length;++b){var M=n[b];if(M.type.indexOf("mat")>=0){for(var k=0|M.type.charAt(M.type.length-1),T=new Array(k),A=0;A<k;++A)T[A]=w.length,_.push(M.name+"["+A+"]"),"number"==typeof M.location?w.push(M.location+A):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[A]?w.push(0|M.location[A]):w.push(-1);x.push({name:M.name,type:M.type,locations:T})}else x.push({name:M.name,type:M.type,locations:[w.length]}),_.push(M.name),"number"==typeof M.location?w.push(0|M.location):w.push(-1)}var S=0;for(b=0;b<w.length;++b)if(w[b]<0){for(;w.indexOf(S)>=0;)S+=1;w[b]=S}var E=new Array(r.length);h(),d._relink=h,d.types={uniforms:s(r),attributes:s(n)},d.attributes=o(p,d,x,w),Object.defineProperty(d,"uniforms",a(p,d,r,E))},e.exports=function(t,e,r,i,a){var o=new n(t);return o.update(e,r,i,a),o}},{"./lib/GLError":214,"./lib/create-attributes":215,"./lib/create-uniforms":216,"./lib/reflect":217,"./lib/runtime-reflect":218,"./lib/shader-cache":219}],214:[function(t,e,r){function n(t,e,r){this.shortMessage=e||"",this.longMessage=r||"",this.rawError=t||"",this.message="gl-shader: "+(e||t||"")+(r?"\n"+r:""),this.stack=(new Error).stack}(n.prototype=new Error).name="GLError",n.prototype.constructor=n,e.exports=n},{}],215:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}function i(t,e,r,i,a,o,s){for(var l=["gl","v"],c=[],u=0;u<a;++u)l.push("x"+u),c.push("x"+u);l.push("if(x0.length===void 0){return gl.vertexAttrib"+a+"f(v,"+c.join()+")}else{return gl.vertexAttrib"+a+"fv(v,x0)}");var h=Function.apply(null,l),f=new n(t,e,r,i,a,h);Object.defineProperty(o,s,{set:function(e){return t.disableVertexAttribArray(i[r]),h(t,i[r],e),e},get:function(){return f},enumerable:!0})}function a(t,e,r,n,a,o,s){for(var l=new Array(a),c=new Array(a),u=0;u<a;++u)i(t,e,r[u],n,a,l,u),c[u]=l[u];Object.defineProperty(l,"location",{set:function(t){if(Array.isArray(t))for(var e=0;e<a;++e)c[e].location=t[e];else for(e=0;e<a;++e)c[e].location=t+e;return t},get:function(){for(var t=new Array(a),e=0;e<a;++e)t[e]=n[r[e]];return t},enumerable:!0}),l.pointer=function(e,i,o,s){e=e||t.FLOAT,i=!!i,o=o||a*a,s=s||0;for(var l=0;l<a;++l){var c=n[r[l]];t.vertexAttribPointer(c,a,e,i,o,s+l*a),t.enableVertexAttribArray(c)}};var h=new Array(a),f=t["vertexAttrib"+a+"fv"];Object.defineProperty(o,s,{set:function(e){for(var i=0;i<a;++i){var o=n[r[i]];if(t.disableVertexAttribArray(o),Array.isArray(e[0]))f.call(t,o,e[i]);else{for(var s=0;s<a;++s)h[s]=e[a*i+s];f.call(t,o,h)}}return e},get:function(){return l},enumerable:!0})}e.exports=function(t,e,r,n){for(var s={},l=0,c=r.length;l<c;++l){var u=r[l],h=u.name,f=u.type,d=u.locations;switch(f){case"bool":case"int":case"float":i(t,e,d[0],n,1,s,h);break;default:if(f.indexOf("vec")>=0){if((p=f.charCodeAt(f.length-1)-48)<2||p>4)throw new o("","Invalid data type for attribute "+h+": "+f);i(t,e,d[0],n,p,s,h)}else{if(!(f.indexOf("mat")>=0))throw new o("","Unknown data type for attribute "+h+": "+f);var p;if((p=f.charCodeAt(f.length-1)-48)<2||p>4)throw new o("","Invalid data type for attribute "+h+": "+f);a(t,e,d,n,p,s,h)}}}return s};var o=t("./GLError"),s=n.prototype;s.pointer=function(t,e,r,n){var i=this._gl,a=this._locations[this._index];i.vertexAttribPointer(a,this._dimension,t||i.FLOAT,!!e,r||0,n||0),i.enableVertexAttribArray(a)},s.set=function(t,e,r,n){return this._constFunc(this._locations[this._index],t,e,r,n)},Object.defineProperty(s,"location",{get:function(){return this._locations[this._index]},set:function(t){return t!==this._locations[this._index]&&(this._locations[this._index]=0|t,this._wrapper.program=null),0|t}})},{"./GLError":214}],216:[function(t,e,r){"use strict";function n(t){return new Function("y","return function(){return y}")(t)}function i(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=e;return r}var a=t("./reflect"),o=t("./GLError");e.exports=function(t,e,r,s){function l(t,e,r){switch(r){case"bool":case"int":case"sampler2D":case"samplerCube":return"gl.uniform1i(locations["+e+"],obj"+t+")";case"float":return"gl.uniform1f(locations["+e+"],obj"+t+")";default:var n=r.indexOf("vec");if(!(0<=n&&n<=1&&r.length===4+n)){if(0===r.indexOf("mat")&&4===r.length){if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new o("","Invalid uniform dimension type for matrix "+name+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new o("","Unknown uniform data type for "+name+": "+r)}var i;if((i=r.charCodeAt(r.length-1)-48)<2||i>4)throw new o("","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 o("","Unrecognized data type for vector "+name+": "+r)}}}function c(t,e){if("object"!=typeof e)return[[t,e]];var r=[];for(var n in e){var i=e[n],a=t;parseInt(n)+""===n?a+="["+n+"]":a+="."+n,"object"==typeof i?r.push.apply(r,c(a,i)):r.push([a,i])}return r}function u(e){for(var n=["return function updateProperty(obj){"],i=c("",e),a=0;a<i.length;++a){var o=i[a],u=o[0],h=o[1];s[h]&&n.push(l(u,h,r[h].type))}return n.push("return obj}"),new Function("gl","locations",n.join("\n"))(t,s)}function h(a,l,c){if("object"==typeof c){var h=f(c);Object.defineProperty(a,l,{get:n(h),set:u(c),enumerable:!0,configurable:!1})}else s[c]?Object.defineProperty(a,l,{get:function(r){return new Function("gl","wrapper","locations","return function(){return gl.getUniform(wrapper.program,locations["+r+"])}")(t,e,s)}(c),set:u(c),enumerable:!0,configurable:!1}):a[l]=function(t){switch(t){case"bool":return!1;case"int":case"sampler2D":case"samplerCube":case"float":return 0;default:var e=t.indexOf("vec");if(0<=e&&e<=1&&t.length===4+e){if((r=t.charCodeAt(t.length-1)-48)<2||r>4)throw new o("","Invalid data type");return"b"===t.charAt(0)?i(r,!1):i(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 o("","Invalid uniform dimension type for matrix "+name+": "+t);return i(r*r,0)}throw new o("","Unknown uniform data type for "+name+": "+t)}}(r[c].type)}function f(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r<t.length;++r)h(e,r,t[r])}else{e={};for(var n in t)h(e,n,t[n])}return e}var d=a(r,!0);return{get:n(f(d)),set:u(d),enumerable:!0,configurable:!0}}},{"./GLError":214,"./reflect":217}],217:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r={},n=0;n<t.length;++n)for(var i=t[n].name.split("."),a=r,o=0;o<i.length;++o){var s=i[o].split("[");if(s.length>1){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l<s.length;++l){var c=parseInt(s[l]);l<s.length-1||o<i.length-1?(c in a||(l<s.length-1?a[c]=[]:a[c]={}),a=a[c]):a[c]=e?n:t[n].type}}else o<i.length-1?(s[0]in a||(a[s[0]]={}),a=a[s[0]]):a[s[0]]=e?n:t[n].type}return r}},{}],218:[function(t,e,r){"use strict";function n(t,e){if(!a){var r=Object.keys(i);a={};for(var n=0;n<r.length;++n){var o=r[n];a[t[o]]=i[o]}}return a[e]}r.uniforms=function(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS),i=[],a=0;a<r;++a){var o=t.getActiveUniform(e,a);if(o){var s=n(t,o.type);if(o.size>1)for(var l=0;l<o.size;++l)i.push({name:o.name.replace("[0]","["+l+"]"),type:s});else i.push({name:o.name,type:s})}}return i},r.attributes=function(t,e){for(var r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES),i=[],a=0;a<r;++a){var o=t.getActiveAttrib(e,a);o&&i.push({name:o.name,type:n(t,o.type)})}return i};var i={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube"},a=null},{}],219:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.id=t,this.src=e,this.type=r,this.shader=n,this.count=a,this.programs=[],this.cache=o}function i(t){this.gl=t,this.shaders=[{},{}],this.programs={}}function a(t){var e=l.get(t);return e||(e=new i(t),l.set(t,e)),e}r.shader=function(t,e,r){return a(t).getShaderReference(e,r)},r.program=function(t,e,r,n,i){return a(t).getProgram(e,r,n,i)};var o=t("./GLError"),s=t("gl-format-compiler-error"),l=new("undefined"==typeof WeakMap?t("weakmap-shim"):WeakMap),c=0;n.prototype.dispose=function(){if(0==--this.count){for(var t=this.cache,e=t.gl,r=this.programs,n=0,i=r.length;n<i;++n){var a=t.programs[r[n]];a&&(delete t.programs[n],e.deleteProgram(a))}e.deleteShader(this.shader),delete t.shaders[this.type===e.FRAGMENT_SHADER|0][this.src]}};var u=i.prototype;u.getShaderReference=function(t,e){var r=this.gl,i=this.shaders[t===r.FRAGMENT_SHADER|0],a=i[e];if(a&&r.isShader(a.shader))a.count+=1;else{var l=function(t,e,r){var n=t.createShader(e);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var i=t.getShaderInfoLog(n);try{var a=s(i,r,e)}catch(t){throw console.warn("Failed to format compiler error: "+t),new o(i,"Error compiling shader:\n"+i)}throw new o(i,a.short,a.long)}return n}(r,t,e);a=i[e]=new n(c++,e,t,l,[],1,this)}return a},u.getProgram=function(t,e,r,n){var i=[t.id,e.id,r.join(":"),n.join(":")].join("@"),a=this.programs[i];return a&&this.gl.isProgram(a)||(this.programs[i]=a=function(t,e,r,n,i){var a=t.createProgram();t.attachShader(a,e),t.attachShader(a,r);for(var s=0;s<n.length;++s)t.bindAttribLocation(a,i[s],n[s]);if(t.linkProgram(a),!t.getProgramParameter(a,t.LINK_STATUS)){var l=t.getProgramInfoLog(a);throw new o(l,"Error linking program: "+l)}return a}(this.gl,t.shader,e.shader,r,n),t.programs.push(i),e.programs.push(i)),a}},{"./GLError":214,"gl-format-compiler-error":166,"weakmap-shim":571}],220:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.pickBuffer=e,this.screenBox=[0,0,t.drawingBufferWidth,t.drawingBufferHeight],this.viewBox=[0,0,0,0],this.dataBox=[-10,-10,10,10],this.gridLineEnable=[!0,!0],this.gridLineWidth=[1,1],this.gridLineColor=[[0,0,0,1],[0,0,0,1]],this.pixelRatio=1,this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickEnable=[!0,!0,!0,!0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[15,15,15,15],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelEnable=[!0,!0,!0,!0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.titleCenter=[0,0],this.titleEnable=!0,this.titleAngle=0,this.titleColor=[0,0,0,1],this.borderColor=[0,0,0,0],this.backgroundColor=[0,0,0,0],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[4,4],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderLineEnable=[!0,!0,!0,!0],this.borderLineWidth=[2,2,2,2],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.grid=null,this.text=null,this.line=null,this.box=null,this.objects=[],this.overlays=[],this._tickBounds=[1/0,1/0,-1/0,-1/0],this.static=!1,this.dirty=!1,this.pickDirty=!1,this.pickDelay=120,this.pickRadius=10,this._pickTimeout=null,this._drawPick=this.drawPick.bind(this),this._depthCounter=0}function i(t){for(var e=t.slice(),r=0;r<e.length;++r)e[r]=e[r].slice();return e}function a(t,e){return t.x-e.x}e.exports=function(t){var e=t.gl,r=new n(e,o(e,[e.drawingBufferWidth,e.drawingBufferHeight]));return r.grid=s(r),r.text=l(r),r.line=c(r),r.box=u(r),r.update(t),r};var o=t("gl-select-static"),s=t("./lib/grid"),l=t("./lib/text"),c=t("./lib/line"),u=t("./lib/box"),h=n.prototype;h.setDirty=function(){this.dirty=this.pickDirty=!0},h.setOverlayDirty=function(){this.dirty=!0},h.nextDepthValue=function(){return this._depthCounter++/65536},h.draw=function(){var t=this.gl,e=this.screenBox,r=this.viewBox,n=this.dataBox,i=this.pixelRatio,a=this.grid,o=this.line,s=this.text,l=this.objects;if(this._depthCounter=0,this.pickDirty&&(this._pickTimeout&&clearTimeout(this._pickTimeout),this.pickDirty=!1,this._pickTimeout=setTimeout(this._drawPick,this.pickDelay)),this.dirty){if(this.dirty=!1,t.bindFramebuffer(t.FRAMEBUFFER,null),t.enable(t.SCISSOR_TEST),t.disable(t.DEPTH_TEST),t.depthFunc(t.LESS),t.depthMask(!1),t.enable(t.BLEND),t.blendEquation(t.FUNC_ADD,t.FUNC_ADD),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),this.borderColor){t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]);var c=this.borderColor;t.clearColor(c[0]*c[3],c[1]*c[3],c[2]*c[3],c[3]),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT)}t.scissor(r[0],r[1],r[2]-r[0],r[3]-r[1]),t.viewport(r[0],r[1],r[2]-r[0],r[3]-r[1]);var u=this.backgroundColor;t.clearColor(u[0]*u[3],u[1]*u[3],u[2]*u[3],u[3]),t.clear(t.COLOR_BUFFER_BIT),a.draw();var h=this.zeroLineEnable,f=this.zeroLineColor,d=this.zeroLineWidth;if(h[0]||h[1]){o.bind();for(var p=0;p<2;++p)if(h[p]&&n[p]<=0&&n[p+2]>=0){var m=e[p]-n[p]*(e[p+2]-e[p])/(n[p+2]-n[p]);0===p?o.drawLine(m,e[1],m,e[3],d[p],f[p]):o.drawLine(e[0],m,e[2],m,d[p],f[p])}}for(p=0;p<l.length;++p)l[p].draw();t.viewport(e[0],e[1],e[2]-e[0],e[3]-e[1]),t.scissor(e[0],e[1],e[2]-e[0],e[3]-e[1]),this.grid.drawTickMarks(),o.bind();var g=this.borderLineEnable,v=this.borderLineWidth,y=this.borderLineColor;g[1]&&o.drawLine(r[0],r[1]-.5*v[1]*i,r[0],r[3]+.5*v[3]*i,v[1],y[1]),g[0]&&o.drawLine(r[0]-.5*v[0]*i,r[1],r[2]+.5*v[2]*i,r[1],v[0],y[0]),g[3]&&o.drawLine(r[2],r[1]-.5*v[1]*i,r[2],r[3]+.5*v[3]*i,v[3],y[3]),g[2]&&o.drawLine(r[0]-.5*v[0]*i,r[3],r[2]+.5*v[2]*i,r[3],v[2],y[2]),s.bind();for(p=0;p<2;++p)s.drawTicks(p);this.titleEnable&&s.drawTitle();var b=this.overlays;for(p=0;p<b.length;++p)b[p].draw();t.disable(t.SCISSOR_TEST),t.disable(t.BLEND),t.depthMask(!0)}},h.drawPick=function(){if(!this.static){var t=this.pickBuffer;this.gl;this._pickTimeout=null,t.begin();for(var e=1,r=this.objects,n=0;n<r.length;++n)e=r[n].drawPick(e);t.end()}},h.pick=function(t,e){if(!this.static){var r=this.pixelRatio,n=this.pickPixelRatio,i=this.viewBox,a=0|Math.round((t-i[0]/r)*n),o=0|Math.round((e-i[1]/r)*n),s=this.pickBuffer.query(a,o,this.pickRadius);if(!s)return null;for(var l=s.id+(s.value[0]<<8)+(s.value[1]<<16)+(s.value[2]<<24),c=this.objects,u=0;u<c.length;++u){var h=c[u].pick(a,o,l);if(h)return h}return null}},h.setScreenBox=function(t){var e=this.screenBox,r=this.pixelRatio;e[0]=0|Math.round(t[0]*r),e[1]=0|Math.round(t[1]*r),e[2]=0|Math.round(t[2]*r),e[3]=0|Math.round(t[3]*r),this.setDirty()},h.setDataBox=function(t){var e=this.dataBox;(e[0]!==t[0]||e[1]!==t[1]||e[2]!==t[2]||e[3]!==t[3])&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],this.setDirty())},h.setViewBox=function(t){var e=this.pixelRatio,r=this.viewBox;r[0]=0|Math.round(t[0]*e),r[1]=0|Math.round(t[1]*e),r[2]=0|Math.round(t[2]*e),r[3]=0|Math.round(t[3]*e);var n=this.pickPixelRatio;this.pickBuffer.shape=[0|Math.round((t[2]-t[0])*n),0|Math.round((t[3]-t[1])*n)],this.setDirty()},h.update=function(t){t=t||{};var e=this.gl;this.pixelRatio=t.pixelRatio||1;var r=this.pixelRatio;this.pickPixelRatio=Math.max(r,1),this.setScreenBox(t.screenBox||[0,0,e.drawingBufferWidth/r,e.drawingBufferHeight/r]);this.screenBox;this.setViewBox(t.viewBox||[.125*(this.screenBox[2]-this.screenBox[0])/r,.125*(this.screenBox[3]-this.screenBox[1])/r,.875*(this.screenBox[2]-this.screenBox[0])/r,.875*(this.screenBox[3]-this.screenBox[1])/r]);var n=this.viewBox,o=(n[2]-n[0])/(n[3]-n[1]);this.setDataBox(t.dataBox||[-10,-10/o,10,10/o]),this.borderColor=!1!==t.borderColor&&(t.borderColor||[0,0,0,0]).slice(),this.backgroundColor=(t.backgroundColor||[0,0,0,0]).slice(),this.gridLineEnable=(t.gridLineEnable||[!0,!0]).slice(),this.gridLineWidth=(t.gridLineWidth||[1,1]).slice(),this.gridLineColor=i(t.gridLineColor||[[.5,.5,.5,1],[.5,.5,.5,1]]),this.zeroLineEnable=(t.zeroLineEnable||[!0,!0]).slice(),this.zeroLineWidth=(t.zeroLineWidth||[4,4]).slice(),this.zeroLineColor=i(t.zeroLineColor||[[0,0,0,1],[0,0,0,1]]),this.tickMarkLength=(t.tickMarkLength||[0,0,0,0]).slice(),this.tickMarkWidth=(t.tickMarkWidth||[0,0,0,0]).slice(),this.tickMarkColor=i(t.tickMarkColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.titleCenter=(t.titleCenter||[.5*(n[0]+n[2])/r,(n[3]+120)/r]).slice(),this.titleEnable=!("titleEnable"in t&&!t.titleEnable),this.titleAngle=t.titleAngle||0,this.titleColor=(t.titleColor||[0,0,0,1]).slice(),this.labelPad=(t.labelPad||[15,15,15,15]).slice(),this.labelAngle=(t.labelAngle||[0,Math.PI/2,0,3*Math.PI/2]).slice(),this.labelEnable=(t.labelEnable||[!0,!0,!0,!0]).slice(),this.labelColor=i(t.labelColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.tickPad=(t.tickPad||[15,15,15,15]).slice(),this.tickAngle=(t.tickAngle||[0,0,0,0]).slice(),this.tickEnable=(t.tickEnable||[!0,!0,!0,!0]).slice(),this.tickColor=i(t.tickColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]),this.borderLineEnable=(t.borderLineEnable||[!0,!0,!0,!0]).slice(),this.borderLineWidth=(t.borderLineWidth||[2,2,2,2]).slice(),this.borderLineColor=i(t.borderLineColor||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]);var s=t.ticks||[[],[]],l=this._tickBounds;l[0]=l[1]=1/0,l[2]=l[3]=-1/0;for(var c=0;c<2;++c){var u=s[c].slice(0);0!==u.length&&(u.sort(a),l[c]=Math.min(l[c],u[0].x),l[c+2]=Math.max(l[c+2],u[u.length-1].x))}this.grid.update({bounds:l,ticks:s}),this.text.update({bounds:l,ticks:s,labels:t.labels||["x","y"],labelSize:t.labelSize||[12,12],labelFont:t.labelFont||["sans-serif","sans-serif"],title:t.title||"",titleSize:t.titleSize||18,titleFont:t.titleFont||"sans-serif"}),this.static=!!t.static,this.setDirty()},h.dispose=function(){this.box.dispose(),this.grid.dispose(),this.text.dispose(),this.line.dispose();for(var t=this.objects.length-1;t>=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},h.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},h.removeObject=function(t){for(var e=this.objects,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setDirty();break}},h.addOverlay=function(t){this.overlays.indexOf(t)<0&&(this.overlays.push(t),this.setOverlayDirty())},h.removeOverlay=function(t){for(var e=this.overlays,r=0;r<e.length;++r)if(e[r]===t){e.splice(r,1),this.setOverlayDirty();break}}},{"./lib/box":207,"./lib/grid":208,"./lib/line":209,"./lib/text":211,"gl-select-static":255}],221:[function(t,e,r){var n=t("gl-shader");e.exports=function(t){return n(t,"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}","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}",null,[{name:"position",type:"vec2"}])}},{"gl-shader":256}],222:[function(t,e,r){"use strict";function n(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 i(t){return"boolean"!=typeof t||t}e.exports=function(t){function e(){if(!b&&U.autoResize){var t=x.parentNode,e=1,r=1;t&&t!==document.body?(e=t.clientWidth,r=t.clientHeight):(e=window.innerWidth,r=window.innerHeight);var n=0|Math.ceil(e*U.pixelRatio),i=0|Math.ceil(r*U.pixelRatio);if(n!==x.width||i!==x.height){x.width=n,x.height=i;var a=x.style;a.position=a.position||"absolute",a.left="0px",a.top="0px",a.width=e+"px",a.height=r+"px",O=!0}}}function r(){for(var t=I.length,e=z.length,r=0;r<e;++r)D[r]=0;t:for(r=0;r<t;++r){var n=I[r],i=n.pickSlots;if(i){for(var a=0;a<e;++a)if(D[a]+i<255){P[r]=a,n.setPickBase(D[a]+1),D[a]+=i;continue t}var o=c(_,B);P[r]=e,z.push(o),D.push(i),n.setPickBase(1),e+=1}else P[r]=-1}for(;e>0&&0===D[e-1];)D.pop(),z.pop().dispose()}function g(){if(U.contextLost)return!0;_.isContextLost()&&(U.contextLost=!0,U.mouseListener.enabled=!1,U.selection.object=null,U.oncontextloss&&U.oncontextloss())}function v(){if(!g()){e();var t=U.camera.tick();N.view=U.camera.matrix,O=O||t,F=F||t,E.pixelRatio=U.pixelRatio,C.pixelRatio=U.pixelRatio;var r=I.length,i=G[0],a=G[1];i[0]=i[1]=i[2]=1/0,a[0]=a[1]=a[2]=-1/0;for(var o=0;o<r;++o){(L=I[o]).pixelRatio=U.pixelRatio,L.axes=U.axes,O=O||!!L.dirty,F=F||!!L.dirty;var l=L.bounds;if(l)for(var c=l[0],u=l[1],f=0;f<3;++f)i[f]=Math.min(i[f],c[f]),a[f]=Math.max(a[f],u[f])}var p=U.bounds;if(U.autoBounds)for(f=0;f<3;++f){if(a[f]<i[f])i[f]=-1,a[f]=1;else{i[f]===a[f]&&(i[f]-=1,a[f]+=1);var m=.05*(a[f]-i[f]);i[f]=i[f]-m,a[f]=a[f]+m}p[0][f]=i[f],p[1][f]=a[f]}var v=!1;for(f=0;f<3;++f)v=v||Y[0][f]!==p[0][f]||Y[1][f]!==p[1][f],Y[0][f]=p[0][f],Y[1][f]=p[1][f];if(F=F||v,O=O||v){if(v){var y=[0,0,0];for(o=0;o<3;++o)y[o]=n((p[1][o]-p[0][o])/10);E.autoTicks?E.update({bounds:p,tickSpacing:y}):E.update({bounds:p})}var b=_.drawingBufferWidth,x=_.drawingBufferHeight;for(B[0]=b,B[1]=x,V[0]=0|Math.max(b/U.pixelRatio,1),V[1]=0|Math.max(x/U.pixelRatio,1),d(R,U.fovy,b/x,U.zNear,U.zFar),o=0;o<16;++o)j[o]=0;j[15]=1;var w=0;for(o=0;o<3;++o)w=Math.max(w,p[1][o]-p[0][o]);for(o=0;o<3;++o)U.autoScale?j[5*o]=U.aspect[o]/(p[1][o]-p[0][o]):j[5*o]=1/w,U.autoCenter&&(j[12+o]=.5*-j[5*o]*(p[0][o]+p[1][o]));for(o=0;o<r;++o)(L=I[o]).axesBounds=p,U.clipToBounds&&(L.clipBounds=p);M.object&&(U.snapToData?C.position=M.dataCoordinate:C.position=M.dataPosition,C.bounds=p),F&&(F=!1,function(){if(!g()){_.colorMask(!0,!0,!0,!0),_.depthMask(!0),_.disable(_.BLEND),_.enable(_.DEPTH_TEST);for(var t=I.length,e=z.length,r=0;r<e;++r){var n=z[r];n.shape=V,n.begin();for(var i=0;i<t;++i)if(P[i]===r){var a=I[i];a.drawPick&&(a.pixelRatio=1,a.drawPick(N))}n.end()}}}()),U.axesPixels=s(U.axes,N,b,x),U.onrender&&U.onrender(),_.bindFramebuffer(_.FRAMEBUFFER,null),_.viewport(0,0,b,x);var A=U.clearColor;_.clearColor(A[0],A[1],A[2],A[3]),_.clear(_.COLOR_BUFFER_BIT|_.DEPTH_BUFFER_BIT),_.depthMask(!0),_.colorMask(!0,!0,!0,!0),_.enable(_.DEPTH_TEST),_.depthFunc(_.LEQUAL),_.disable(_.BLEND),_.disable(_.CULL_FACE);var S=!1;for(E.enable&&(S=S||E.isTransparent(),E.draw(N)),C.axes=E,M.object&&C.draw(N),_.disable(_.CULL_FACE),o=0;o<r;++o)(L=I[o]).axes=E,L.pixelRatio=U.pixelRatio,L.isOpaque&&L.isOpaque()&&L.draw(N),L.isTransparent&&L.isTransparent()&&(S=!0);if(S){for(k.shape=B,k.bind(),_.clear(_.DEPTH_BUFFER_BIT),_.colorMask(!1,!1,!1,!1),_.depthMask(!0),_.depthFunc(_.LESS),E.enable&&E.isTransparent()&&E.drawTransparent(N),o=0;o<r;++o)(L=I[o]).isOpaque&&L.isOpaque()&&L.draw(N);for(_.enable(_.BLEND),_.blendEquation(_.FUNC_ADD),_.blendFunc(_.ONE,_.ONE_MINUS_SRC_ALPHA),_.colorMask(!0,!0,!0,!0),_.depthMask(!1),_.clearColor(0,0,0,0),_.clear(_.COLOR_BUFFER_BIT),E.isTransparent()&&E.drawTransparent(N),o=0;o<r;++o){var L;(L=I[o]).isTransparent&&L.isTransparent()&&L.drawTransparent(N)}_.bindFramebuffer(_.FRAMEBUFFER,null),_.blendFunc(_.ONE,_.ONE_MINUS_SRC_ALPHA),_.disable(_.DEPTH_TEST),T.bind(),k.color[0].bind(0),T.uniforms.accumBuffer=0,h(_),_.disable(_.BLEND)}for(O=!1,o=0;o<r;++o)I[o].dirty=!1}}}function y(){b||U.contextLost||(requestAnimationFrame(y),v())}var b=!1,x=((t=t||{}).pixelRatio||parseFloat(window.devicePixelRatio),t.canvas);x||(x=document.createElement("canvas"),t.container?t.container.appendChild(x):document.body.appendChild(x));var _=t.gl;if(_||(_=function(t,e){var r=null;try{(r=t.getContext("webgl",e))||(r=t.getContext("experimental-webgl",e))}catch(t){return null}return r}(x,t.glOptions||{premultipliedAlpha:!0,antialias:!0})),!_)throw new Error("webgl not supported");var w=t.bounds||[[-10,-10,-10],[10,10,10]],M=new function(){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},k=u(_,[_.drawingBufferWidth,_.drawingBufferHeight],{preferFloat:!m}),T=p(_),A=t.camera||{eye:[2,0,0],center:[0,0,0],up:[0,1,0],zoomMin:.1,zoomMax:100,mode:"turntable"},S=t.axes||{},E=o(_,S);E.enable=!S.disable;var L=t.spikes||{},C=l(_,L),I=[],P=[],D=[],z=[],O=!0,F=!0,R=new Array(16),j=new Array(16),N={view:null,projection:R,model:j},B=(F=!0,[_.drawingBufferWidth,_.drawingBufferHeight]),U={gl:_,contextLost:!1,pixelRatio:t.pixelRatio||parseFloat(window.devicePixelRatio),canvas:x,selection:M,camera:a(x,A),axes:E,axesPixels:null,spikes:C,bounds:w,objects:I,shape:B,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:i(t.autoResize),autoBounds:i(t.autoBounds),autoScale:!!t.autoScale,autoCenter:i(t.autoCenter),clipToBounds:i(t.clipToBounds),snapToData:!!t.snapToData,onselect:t.onselect||null,onrender:t.onrender||null,onclick:t.onclick||null,cameraParams:N,oncontextloss:null,mouseListener:null},V=[_.drawingBufferWidth/U.pixelRatio|0,_.drawingBufferHeight/U.pixelRatio|0];U.autoResize&&e(),window.addEventListener("resize",e),U.update=function(t){b||(t=t||{},O=!0,F=!0)},U.add=function(t){b||(t.axes=E,I.push(t),P.push(-1),O=!0,F=!0,r())},U.remove=function(t){if(!b){var e=I.indexOf(t);e<0||(I.splice(e,1),P.pop(),O=!0,F=!0,r())}},U.dispose=function(){if(!b&&(b=!0,window.removeEventListener("resize",e),x.removeEventListener("webglcontextlost",g),U.mouseListener.enabled=!1,!U.contextLost)){E.dispose(),C.dispose();for(var t=0;t<I.length;++t)I[t].dispose();for(k.dispose(),t=0;t<z.length;++t)z[t].dispose();T.dispose(),_=null,E=null,C=null,I=[]}};var H=!1,q=0;U.mouseListener=f(x,function(t,e,r){if(!b){var n=z.length,i=I.length,a=M.object;M.distance=1/0,M.mouse[0]=e,M.mouse[1]=r,M.object=null,M.screen=null,M.dataCoordinate=M.dataPosition=null;var o=!1;if(t&&q)H=!0;else{H&&(F=!0),H=!1;for(var s=0;s<n;++s){var l=z[s].query(e,V[1]-r-1,U.pickRadius);if(l){if(l.distance>M.distance)continue;for(var c=0;c<i;++c){var u=I[c];if(P[c]===s){var h=u.pick(l);h&&(M.buttons=t,M.screen=l.coord,M.distance=l.distance,M.object=u,M.index=h.distance,M.dataPosition=h.position,M.dataCoordinate=h.dataCoordinate,M.data=h,o=!0)}}}}}a&&a!==M.object&&(a.highlight&&a.highlight(null),O=!0),M.object&&(M.object.highlight&&M.object.highlight(M.data),O=!0),(o=o||M.object!==a)&&U.onselect&&U.onselect(M),1&t&&!(1&q)&&U.onclick&&U.onclick(M),q=t}}),x.addEventListener("webglcontextlost",g);var G=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],Y=[G[0].slice(),G[1].slice()];return y(),U.redraw=function(){b||(O=!0,v())},U};var a=t("3d-view-controls"),o=t("gl-axes3d"),s=t("gl-axes3d/properties"),l=t("gl-spikes3d"),c=t("gl-select-static"),u=t("gl-fbo"),h=t("a-big-triangle"),f=t("mouse-change"),d=t("gl-mat4/perspective"),p=t("./lib/shader"),m=t("is-mobile")()},{"./lib/shader":221,"3d-view-controls":37,"a-big-triangle":40,"gl-axes3d":149,"gl-axes3d/properties":156,"gl-fbo":165,"gl-mat4/perspective":185,"gl-select-static":255,"gl-spikes3d":265,"is-mobile":297,"mouse-change":453}],223:[function(t,e,r){r.pointVertex="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}",r.pointFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\nuniform float pointCloud;\n\nvoid main() {\n float radius;\n vec4 baseColor;\n if(pointCloud != 0.0) { // pointCloud is truthy\n if(centerFraction == 1.0) {\n gl_FragColor = color;\n } else {\n gl_FragColor = mix(borderColor, color, centerFraction);\n }\n } else {\n radius = length(2.0 * gl_PointCoord.xy - 1.0);\n if(radius > 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="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="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"},{}],224:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./lib/GLError":225,"./lib/create-attributes":226,"./lib/create-uniforms":227,"./lib/reflect":228,"./lib/runtime-reflect":229,"./lib/shader-cache":230,dup:213}],225:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],226:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{"./GLError":225,dup:215}],227:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":225,"./reflect":228,dup:216}],228:[function(t,e,r){arguments[4][217][0].apply(r,arguments)},{dup:217}],229:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{dup:218}],230:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{"./GLError":225,dup:219,"gl-format-compiler-error":166,"weakmap-shim":571}],231:[function(t,e,r){"use strict";function n(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}var i=t("gl-shader"),a=t("gl-buffer"),o=t("typedarray-pool"),s=t("./lib/shader");e.exports=function(t,e){var r=t.gl,o=new n(t,a(r),a(r),i(r,s.pointVertex,s.pointFragment),i(r,s.pickVertex,s.pickFragment));return o.update(e),t.addObject(o),o};var l=n.prototype;l.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},l.update=function(t){function e(e,r){return e in t?t[e]:r}var r;t=t||{},this.sizeMin=e("sizeMin",.5),this.sizeMax=e("sizeMax",20),this.color=e("color",[1,0,0,1]).slice(),this.areaRatio=e("areaRatio",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.blend=e("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,s=t.positions,l=i?s:o.mallocFloat32(s.length),c=a?t.idToIndex:o.mallocInt32(n);if(i||l.set(s),!a)for(l.set(s),r=0;r<n;r++)c[r]=r;this.points=s,this.offsetBuffer.update(l),this.pickBuffer.update(c),i||o.free(l),a||o.free(c),this.pointCount=n,this.pickOffset=0},l.unifiedDraw=function(){var t=[1,0,0,0,1,0,0,0,1],e=[0,0,0,0];return function(r){var n=void 0!==r,i=n?this.pickShader:this.shader,a=this.plot.gl,o=this.plot.dataBox;if(0===this.pointCount)return r;var s=o[2]-o[0],l=o[3]-o[1],c=function(t,e){var r,n=0,i=t.length>>>1;for(r=0;r<i;r++){var a=t[2*r],o=t[2*r+1];a>=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,o),u=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(c,.33333)));t[0]=2/s,t[4]=2/l,t[6]=-2*o[0]/s-1,t[7]=-2*o[1]/l-1,this.offsetBuffer.bind(),i.bind(),i.attributes.position.pointer(),i.uniforms.matrix=t,i.uniforms.color=this.color,i.uniforms.borderColor=this.borderColor,i.uniforms.pointCloud=u<5,i.uniforms.pointSize=u,i.uniforms.centerFraction=Math.min(1,Math.max(0,Math.sqrt(1-this.areaRatio))),n&&(e[0]=255&r,e[1]=r>>8&255,e[2]=r>>16&255,e[3]=r>>24&255,this.pickBuffer.bind(),i.attributes.pickId.pointer(a.UNSIGNED_BYTE),i.uniforms.pickOffset=e,this.pickOffset=r);var h=a.getParameter(a.BLEND),f=a.getParameter(a.DITHER);return h&&!this.blend&&a.disable(a.BLEND),f&&a.disable(a.DITHER),a.drawArrays(a.POINTS,0,this.pointCount),h&&!this.blend&&a.enable(a.BLEND),f&&a.enable(a.DITHER),r+this.pointCount}}(),l.draw=l.unifiedDraw,l.drawPick=l.unifiedDraw,l.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r<n||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":223,"gl-buffer":157,"gl-shader":224,"typedarray-pool":550}],232:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],h=e[2],f=e[3],d=r[0],p=r[1],m=r[2],g=r[3];return(a=c*d+u*p+h*m+f*g)<0&&(a=-a,d=-d,p=-p,m=-m,g=-g),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),t[0]=s*c+l*d,t[1]=s*u+l*p,t[2]=s*h+l*m,t[3]=s*f+l*g,t}},{}],233:[function(t,e,r){"use strict";e.exports={vertex:"precision highp float;\n#define GLSLIFY 1\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nattribute vec2 positionHi, positionLo;\nattribute float size, border;\nattribute vec2 char, color;\n\n//this is 64-bit form of scale and translate\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pixelRatio;\nuniform vec4 viewBox;\nuniform sampler2D palette;\n\nvarying vec4 charColor, borderColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\n\nvoid main() {\n charColor = texture2D(palette, vec2(color.x / 255., 0));\n borderColor = texture2D(palette, vec2(color.y / 255., 0));\n\n gl_PointSize = size * pixelRatio;\n pointSize = size * pixelRatio;\n\n charId = char;\n borderWidth = border;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n\n pointCoord = viewBox.xy + (viewBox.zw - viewBox.xy) * (gl_Position.xy * .5 + .5);\n}\n",fragment:"precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D chars;\nuniform vec2 charsShape;\nuniform float charsStep, pixelRatio, charOffset;\n\nvarying vec4 borderColor;\nvarying vec4 charColor;\nvarying vec2 charId;\nvarying vec2 pointCoord;\nvarying float pointSize;\nvarying float borderWidth;\n\nvoid main() {\n\tvec2 pointUV = (pointCoord - gl_FragCoord.xy + pointSize * .5) / pointSize;\n\tpointUV.x = 1. - pointUV.x;\n\tvec2 texCoord = ((charId + pointUV) * charsStep) / charsShape;\n\tfloat dist = texture2D(chars, texCoord).r;\n\n\t//max-distance alpha\n\tif (dist < 1e-2)\n\t\tdiscard;\n\n\tfloat gamma = .0045 * charsStep / pointSize;\n\n //null-border case\n \tif (borderWidth * borderColor.a == 0.) {\n\t\tfloat charAmt = smoothstep(.748 - gamma, .748 + gamma, dist);\n\t\tgl_FragColor = vec4(charColor.rgb, charAmt*charColor.a);\n\t\treturn;\n\t}\n\n\tfloat dif = 5. * pixelRatio * borderWidth / pointSize;\n\tfloat borderLevel = .748 - dif * .5;\n\tfloat charLevel = .748 + dif * .5;\n\n\tfloat borderAmt = smoothstep(borderLevel - gamma, borderLevel + gamma, dist);\n\tfloat charAmt = smoothstep(charLevel - gamma, charLevel + gamma, dist);\n\n\tvec4 color = borderColor;\n\tcolor.a *= borderAmt;\n\n\tgl_FragColor = mix(color, charColor, charAmt);\n}\n",pickVertex:"precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 id;\nattribute float size;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform vec4 pickOffset;\nuniform float pixelRatio;\n\nvarying vec4 fragColor;\n\n\nvec4 computePosition_1_0(vec2 posHi, vec2 posLo, vec2 scHi, vec2 scLo, vec2 trHi, vec2 trLo) {\n return vec4((posHi + trHi) * scHi\n \t\t\t//FIXME: this thingy does not give noticeable precision gain, need test\n + (posLo + trLo) * scHi\n + (posHi + trHi) * scLo\n + (posLo + trLo) * scLo\n , 0, 1);\n}\n\n\nvoid main() {\n vec4 fragId = id + pickOffset;\n\n fragId.y += floor(fragId.x / 256.0);\n fragId.x -= floor(fragId.x / 256.0) * 256.0;\n\n fragId.z += floor(fragId.y / 256.0);\n fragId.y -= floor(fragId.y / 256.0) * 256.0;\n\n fragId.w += floor(fragId.z / 256.0);\n fragId.z -= floor(fragId.z / 256.0) * 256.0;\n\n fragColor = fragId / 255.0;\n\n gl_PointSize = size * .25 * pixelRatio;\n\n gl_Position = computePosition_1_0(\n positionHi, positionLo,\n scaleHi, scaleLo,\n translateHi, translateLo);\n}\n",pickFragment:"precision lowp float;\n#define GLSLIFY 1\nvarying vec4 fragColor;\nvoid main() {\n gl_FragColor = fragColor;\n}\n"}},{}],234:[function(t,e,r){arguments[4][85][0].apply(r,arguments)},{dup:85}],235:[function(t,e,r){arguments[4][213][0].apply(r,arguments)},{"./lib/GLError":236,"./lib/create-attributes":237,"./lib/create-uniforms":238,"./lib/reflect":239,"./lib/runtime-reflect":240,"./lib/shader-cache":241,dup:213}],236:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],237:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{"./GLError":236,dup:215}],238:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":236,"./reflect":239,dup:216}],239:[function(t,e,r){arguments[4][217][0].apply(r,arguments)},{dup:217}],240:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{dup:218}],241:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{"./GLError":236,dup:219,"gl-format-compiler-error":166,"weakmap-shim":571}],242:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){for(var o=t+1;o<=e;++o){for(var s=r[o],l=n[2*o],c=n[2*o+1],u=i[o],h=a[o],f=o;f>t;){var d=r[f-1],p=n[2*(f-1)];if((d-s||l-p)>=0)break;r[f]=d,n[2*f]=p,n[2*f+1]=n[2*f-1],i[f]=i[f-1],a[f]=a[f-1],f-=1}r[f]=s,n[2*f]=l,n[2*f+1]=c,i[f]=u,a[f]=h}}function i(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],c=i[t],u=a[t];r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e],r[e]=o,n[2*e]=s,n[2*e+1]=l,i[e]=c,a[e]=u}function a(t,e,r,n,i,a){r[t]=r[e],n[2*t]=n[2*e],n[2*t+1]=n[2*e+1],i[t]=i[e],a[t]=a[e]}function o(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],c=i[2*t+1],u=a[t],h=o[t];n[t]=n[e],i[2*t]=i[2*e],i[2*t+1]=i[2*e+1],a[t]=a[e],o[t]=o[e],n[e]=n[r],i[2*e]=i[2*r],i[2*e+1]=i[2*r+1],a[e]=a[r],o[e]=o[r],n[r]=s,i[2*r]=l,i[2*r+1]=c,a[r]=u,o[r]=h}function s(t,e,r,n,i,a,o,s,l,c,u){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],c[t]=c[e],u[t]=u[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,c[e]=a,u[e]=o}function l(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function c(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}function u(t,e,r,f,d,p){var m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,b=y-m,x=y+m,_=g,w=b,M=y,k=x,T=v,A=t+1,S=e-1,E=0;l(_,w,r,f,d)&&(E=_,_=w,w=E),l(k,T,r,f,d)&&(E=k,k=T,T=E),l(_,M,r,f,d)&&(E=_,_=M,M=E),l(w,M,r,f,d)&&(E=w,w=M,M=E),l(_,k,r,f,d)&&(E=_,_=k,k=E),l(M,k,r,f,d)&&(E=M,M=k,k=E),l(w,T,r,f,d)&&(E=w,w=T,T=E),l(w,M,r,f,d)&&(E=w,w=M,M=E),l(k,T,r,f,d)&&(E=k,k=T,T=E);var L=r[w],C=f[2*w],I=f[2*w+1],P=d[w],D=p[w],z=r[k],O=f[2*k],F=f[2*k+1],R=d[k],j=p[k],N=_,B=M,U=T,V=g,H=y,q=v,G=r[N],Y=r[B],W=r[U];r[V]=G,r[H]=Y,r[q]=W;for(var X=0;X<2;++X){var Z=f[2*N+X],J=f[2*B+X],K=f[2*U+X];f[2*V+X]=Z,f[2*H+X]=J,f[2*q+X]=K}var Q=d[N],$=d[B],tt=d[U];d[V]=Q,d[H]=$,d[q]=tt;var et=p[N],rt=p[B],nt=p[U];p[V]=et,p[H]=rt,p[q]=nt,a(b,t,r,f,d,p),a(x,e,r,f,d,p);for(var it=A;it<=S;++it)if(c(it,L,C,0,P,r,f,d))it!==A&&i(it,A,r,f,d,p),++A;else if(!c(it,z,O,0,R,r,f,d))for(;;){if(c(S,z,O,0,R,r,f,d)){c(S,L,C,0,P,r,f,d)?(o(it,A,S,r,f,d,p),++A,--S):(i(it,S,r,f,d,p),--S);break}if(--S<it)break}s(t,A-1,L,C,I,P,D,r,f,d,p),s(e,S+1,z,O,F,R,j,r,f,d,p),A-2-t<=h?n(t,A-2,r,f,d,p):u(t,A-2,r,f,d,p),e-(S+2)<=h?n(S+2,e,r,f,d,p):u(S+2,e,r,f,d,p),S-A<=h?n(A,S,r,f,d,p):u(A,S,r,f,d,p)}e.exports=function(t,e,r,i,a){a<=4*h?n(0,a-1,t,e,r,i):u(0,a-1,t,e,r,i)};var h=32},{}],243:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){for(var l=r,c=r;c<n;++c){var u=t[2*c],h=t[2*c+1],f=e[c];i<=u&&u<=o&&a<=h&&h<=s&&(c===l?l+=1:(t[2*c]=t[2*l],t[2*c+1]=t[2*l+1],e[c]=e[l],t[2*l]=u,t[2*l+1]=h,e[l]=f,l+=1))}return l}function i(t,e,r){this.pixelSize=t,this.offset=e,this.count=r}var a=t("typedarray-pool"),o=t("./lib/sort");e.exports=function(t,e,r,s){function l(i,a,o,s,c,u){var h=.5*o,f=s+1,d=c-s;r[_]=d,x[_++]=u;for(var p=0;p<2;++p)for(var m=0;m<2;++m){var g=i+p*h,v=a+m*h,y=n(t,e,f,c,g,v,g+h,v+h);if(y!==f){if(y-f>=Math.max(.9*d,32)){var b=c+s>>>1;l(g,v,h,f,b,u+1),f=b}l(g,v,h,f,y,u+1),f=y}}}var c=t.length>>>1;if(c<1)return[];for(var u=1/0,h=1/0,f=-1/0,d=-1/0,p=0;p<c;++p){var m=t[2*p],g=t[2*p+1];u=Math.min(u,m),f=Math.max(f,m),h=Math.min(h,g),d=Math.max(d,g),e[p]=p}u===f&&(f+=1+Math.abs(f)),h===d&&(d+=1+Math.abs(f));var v=1/(f-u),y=1/(d-h),b=Math.max(f-u,d-h);(s=s||[0,0,0,0])[0]=u,s[1]=h,s[2]=f,s[3]=d;var x=a.mallocInt32(c),_=0;l(u,h,b,0,c,0),o(x,t,e,r,c);var w=[],M=0,k=c;for(_=c-1;_>=0;--_){t[2*_]=(t[2*_]-u)*v,t[2*_+1]=(t[2*_+1]-h)*y;var T=x[_];T!==M&&(w.push(new i(b*Math.pow(.5,T),_+1,k-(_+1))),k=_+1,M=T)}return w.push(new i(b*Math.pow(.5,T+1),0,k)),a.free(x),w}},{"./lib/sort":242,"typedarray-pool":550}],244:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){this.plot=t,this.shader=e,this.pickShader=r,this.positionBuffer=n,this.sizeBuffer=i,this.colorBuffer=a,this.idBuffer=o,this.charBuffer=s,this.pointCount=0,this.pickOffset=0,this.points=null,this.scales=[],this.xCoords=[],this.charCanvas=document.createElement("canvas"),this.charTexture=d(this.plot.gl,this.charCanvas),this.charStep=400,this.charFit=.255,this.snapThreshold=1e4,this.paletteTexture=d(this.plot.gl,[256,1])}e.exports=function(t,e){var r=t.gl,i=new n(t,s(r,u.vertex,u.fragment),s(r,u.pickVertex,u.pickFragment),l(r),l(r),l(r),l(r),l(r));return i.update(e),t.addObject(i),i};var i,a,o,s=t("gl-shader"),l=t("gl-buffer"),c=t("typedarray-pool"),u=t("./lib/shaders"),h=t("snap-points-2d"),f=t("font-atlas-sdf"),d=t("gl-texture2d"),p=t("color-id"),m=t("ndarray"),g=t("clamp"),v=t("binary-search-bounds"),y=n.prototype,b=new Float32Array([0,0]),x=new Float32Array([0,0]),_=new Float32Array([0,0]),w=new Float32Array([0,0]),M=[0,0],k=[0,0,0,0];y.drawPick=function(t){var e=void 0!==t,r=this.plot,n=this.pointCount,s=n>this.snapThreshold;if(!n)return t;(function(){var t=this.plot,e=t.viewBox,r=t.dataBox,n=t.pixelRatio,s=r[2]-r[0],l=r[3]-r[1],c=2/s,u=2/l,h=-r[0]-.5*s,f=-r[1]-.5*l;b[0]=c,x[0]=c-b[0],b[1]=u,x[1]=u-b[1],_[0]=h,w[0]=h-_[0],_[1]=f,w[1]=f-_[1];var d=e[2]-e[0],p=e[3]-e[1];i=Math.min(s/d,l/p),M[0]=2*n/d,M[1]=2*n/p,a=r[0],o=r[2]}).call(this);var l=r.gl,c=e?this.pickShader:this.shader,u=l.isEnabled(l.BLEND);if(c.bind(),e){this.pickOffset=t;for(var h=0;h<4;++h)k[h]=t>>8*h&255;c.uniforms.pickOffset=k,this.idBuffer.bind(),c.attributes.id.pointer(l.UNSIGNED_BYTE,!1)}else l.blendFuncSeparate(l.SRC_ALPHA,l.ONE_MINUS_SRC_ALPHA,l.ONE,l.ONE_MINUS_SRC_ALPHA),l.blendColor(0,0,0,1),u||l.enable(l.BLEND),this.colorBuffer.bind(),c.attributes.color.pointer(l.UNSIGNED_BYTE,!1),this.charBuffer.bind(),c.attributes.char.pointer(l.UNSIGNED_BYTE,!1),c.uniforms.chars=this.charTexture.bind(0),c.uniforms.charsShape=[this.charCanvas.width,this.charCanvas.height],c.uniforms.charsStep=this.charStep,c.uniforms.palette=this.paletteTexture.bind(1);this.sizeBuffer.bind(),c.attributes.size.pointer(l.FLOAT,!1,8,0),e||c.attributes.border.pointer(l.FLOAT,!1,8,4),this.positionBuffer.bind(),c.attributes.positionHi.pointer(l.FLOAT,!1,16,0),c.attributes.positionLo.pointer(l.FLOAT,!1,16,8),c.uniforms.pixelRatio=r.pixelRatio,c.uniforms.scaleHi=b,c.uniforms.scaleLo=x,c.uniforms.translateHi=_,c.uniforms.translateLo=w,c.uniforms.viewBox=r.viewBox;var f=this.scales;if(s)for(var d=f.length-1;d>=0;d--){var p=f[d];if(!(p.pixelSize&&p.pixelSize<1.25*i&&d>1)){var m=p.offset,g=p.count+m,y=v.ge(this.xCoords,a,m,g-1),T=v.lt(this.xCoords,o,y,g-1)+1;T>y&&l.drawArrays(l.POINTS,y,T-y)}}else l.drawArrays(l.POINTS,0,n);if(e)return t+n;u?l.blendFunc(l.ONE,l.ONE_MINUS_SRC_ALPHA):l.disable(l.BLEND)},y.draw=y.drawPick,y.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r<n||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]]}},y.update=function(t){var e=(t=t||{}).positions||[],r=t.colors||[],n=t.glyphs||[],i=t.sizes||[],a=t.borderWidths||[],o=t.borderColors||[],s=this.plot.gl,l=this.pointCount,u=l>this.snapThreshold;if(null!=t.positions){this.points=e,u=(l=this.points.length/2)>this.snapThreshold;var d=c.mallocFloat32(2*l),v=c.mallocFloat64(2*l),y=c.mallocUint32(l),b=c.mallocFloat32(4*l);v.set(this.points),u&&(this.i2idx&&c.free(this.i2idx),this.i2idx=c.mallocInt32(l),this.scales=h(v,this.i2idx,d)),this.pointCount=l;for(var x=0;x<l;++x){var _=u?this.i2idx[x]:x;y[x]=_;var w=e[2*_],M=e[2*_+1];b[4*x]=w,b[4*x+1]=M,b[4*x+2]=w-b[4*x],b[4*x+3]=M-b[4*x+1],this.xCoords[x]=w}this.idBuffer.update(y),this.positionBuffer.update(b),c.free(b),c.free(y),c.free(v),c.free(d)}for(var k=c.mallocFloat32(2*l),T=c.mallocUint8(2*l),A=c.mallocUint8(2*l),S={},E=[],L=[],C=[],I=(x=0,l),P=0;x<I;++x){var D=[255*r[4*x],255*r[4*x+1],255*r[4*x+2],255*r[4*x+3]];null==S[W=p(D,!1)]&&(S[W]=P++,L.push(D[0]),L.push(D[1]),L.push(D[2]),L.push(D[3])),E.push(W),o&&o.length&&(null==S[W=p(D=[255*o[4*x],255*o[4*x+1],255*o[4*x+2],255*o[4*x+3]],!1)]&&(S[W]=P++,L.push(D[0]),L.push(D[1]),L.push(D[2]),L.push(D[3])),C.push(W))}var z={};for(x=0,I=l,P=0;x<I;x++){null==z[J=n[x]]&&(z[J]=P++)}var O=0;for(x=0,I=i.length;x<I;++x)i[x]>O&&(O=i[x]);var F=this.charStep;this.charStep=g(Math.ceil(4*O),128,768);var R=Object.keys(z),j=this.charStep,N=Math.floor(j/2),B=s.getParameter(s.MAX_TEXTURE_SIZE),U=B/j*(B/j),V=Math.min(B,j*R.length),H=Math.min(B,j*Math.ceil(j*R.length/B)),q=Math.floor(V/j);R.length>U&&console.warn("gl-scatter2d-fancy: number of characters is more than maximum texture size. Try reducing it."),this.chars&&this.chars+""==R+""&&this.charStep==F||(this.charCanvas=f({canvas:this.charCanvas,family:"sans-serif",size:N,shape:[V,H],step:[j,j],chars:R,align:!0,fit:this.charFit}),this.chars=R);for(x=0;x<l;++x){var G=i[_=u?this.i2idx[x]:x],Y=a[_];k[2*x]=2*G,k[2*x+1]=Y;var W,X=S[W=E[_]];T[2*x]=X;var Z=S[C[_]];T[2*x+1]=Z;var J,K=z[J=n[_]];A[2*x+1]=Math.floor(K/q),A[2*x]=K%q}this.sizeBuffer.update(k),this.colorBuffer.update(T),this.charBuffer.update(A),this.charTexture.shape=[this.charCanvas.width,this.charCanvas.height],this.charCanvas&&this.charCanvas.width&&this.charTexture.setPixels(this.charCanvas),this.paletteTexture.setPixels(m(L.slice(0,1024),[256,1,4])),c.free(k),c.free(T),c.free(A)},y.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBuffer.dispose(),this.sizeBuffer.dispose(),this.colorBuffer.dispose(),this.idBuffer.dispose(),this.charBuffer.dispose(),this.plot.removeObject(this)}},{"./lib/shaders":233,"binary-search-bounds":234,clamp:89,"color-id":93,"font-atlas-sdf":135,"gl-buffer":157,"gl-shader":235,"gl-texture2d":268,ndarray:468,"snap-points-2d":243,"typedarray-pool":550}],245:[function(t,e,r){r.pointVertex="precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 positionHi, positionLo;\nattribute float weight;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize, useWeight;\n\nvarying float fragWeight;\n\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nvoid main() {\n gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragWeight = mix(1.0, weight, useWeight);\n}",r.pointFragment="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color, borderColor;\nuniform float centerFraction;\n\nvarying float fragWeight;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float radius = length(2.0*gl_PointCoord.xy-1.0);\n if(radius > 1.0) {\n discard;\n }\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, fragWeight);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}\n",r.pickVertex="precision highp float;\n#define GLSLIFY 1\n\nvec4 pfx_1_0(vec2 scaleHi, vec2 scaleLo, vec2 translateHi, vec2 translateLo, vec2 positionHi, vec2 positionLo) {\n return vec4((positionHi + translateHi) * scaleHi\n + (positionLo + translateLo) * scaleHi\n + (positionHi + translateHi) * scaleLo\n + (positionLo + translateLo) * scaleLo, 0.0, 1.0);\n}\n\nattribute vec2 positionHi, positionLo;\nattribute vec4 pickId;\n\nuniform vec2 scaleHi, scaleLo, translateHi, translateLo;\nuniform float pointSize;\nuniform vec4 pickOffset;\n\nvarying vec4 fragId;\n\nvoid main() {\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 gl_Position = pfx_1_0(scaleHi, scaleLo, translateHi, translateLo, positionHi, positionLo);\n gl_PointSize = pointSize;\n fragId = id;\n}",r.pickFragment="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}"},{}],246:[function(t,e,r){arguments[4][85][0].apply(r,arguments)},{dup:85}],247:[function(t,e,r){arguments[4][242][0].apply(r,arguments)},{dup:242}],248:[function(t,e,r){arguments[4][243][0].apply(r,arguments)},{"./lib/sort":247,dup:243,"typedarray-pool":550}],249:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){this.plot=t,this.positionBufferHi=e,this.positionBufferLo=r,this.pickBuffer=n,this.weightBuffer=i,this.shader=a,this.pickShader=o,this.scales=[],this.size=12,this.borderSize=1,this.pointCount=0,this.color=[1,0,0,1],this.borderColor=[0,0,0,1],this.bounds=[1/0,1/0,-1/0,-1/0],this.pickOffset=0,this.points=null,this.xCoords=null,this.snapPoints=!0}var i=t("gl-shader"),a=t("gl-buffer"),o=t("binary-search-bounds"),s=t("snap-points-2d"),l=t("typedarray-pool"),c=t("./lib/shader"),u=t("array-normalize"),h=t("array-bounds");e.exports=function(t,e){var r=t.gl,o=new n(t,a(r),a(r),a(r),a(r),i(r,c.pointVertex,c.pointFragment),i(r,c.pickVertex,c.pickFragment));return o.update(e),t.addObject(o),o};var f=n.prototype,d=new Float32Array(2),p=new Float32Array(2),m=new Float32Array(2),g=new Float32Array(2),v=[0,0,0,0];f.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.positionBufferHi.dispose(),this.positionBufferLo.dispose(),this.pickBuffer.dispose(),this.xCoords&&l.free(this.xCoords),this.plot.removeObject(this)},f.update=function(t){function e(e,r){return e in t?t[e]:r}if(t=t||{},this.size=e("size",12),this.color=e("color",[1,0,0,1]).slice(),this.borderSize=e("borderSize",1),this.borderColor=e("borderColor",[0,0,0,1]).slice(),this.snapPoints=e("snapPoints",!0),null!=t.positions){this.xCoords&&l.free(this.xCoords),this.points=t.positions;var r=this.points.length>>>1,n=l.mallocInt32(r),i=l.mallocFloat32(r),a=l.mallocFloat64(2*r);if(a.set(this.points),this.snapPoints)this.scales=s(a,n,i,this.bounds);else{this.bounds=h(a,2),u(a,2,this.bounds);for(var o=0;o<r;o++)n[o]=o,i[o]=1}var c=l.mallocFloat64(r),f=l.mallocFloat32(2*r),d=l.mallocFloat32(2*r);f.set(a);o=0;for(var p=0;o<r;o++,p+=2)d[p]=a[p]-f[p],d[p+1]=a[p+1]-f[p+1],c[o]=a[p];this.positionBufferHi.update(f),this.positionBufferLo.update(d),this.pickBuffer.update(n),this.weightBuffer.update(i),l.free(f),l.free(d),l.free(i),l.free(a),l.free(n),this.xCoords=c,this.pointCount=r,this.pickOffset=0}},f.draw=function(t){var e=void 0!==t,r=this.plot,n=e?this.pickShader:this.shader,i=this.scales,a=this.positionBufferHi,o=this.positionBufferLo,s=this.pickBuffer,l=this.bounds,c=this.size,u=this.borderSize,h=r.gl,f=e?r.pickPixelRatio:r.pixelRatio,y=r.viewBox,b=r.dataBox;if(0===this.pointCount)return t;var x=l[2]-l[0],_=l[3]-l[1],w=b[2]-b[0],M=b[3]-b[1],k=(y[2]-y[0])*f/r.pixelRatio,T=(y[3]-y[1])*f/r.pixelRatio,A=this.pixelSize=Math.min(w/k,M/T),S=2*x/w,E=2*_/M;d[0]=S,d[1]=E,p[0]=S-d[0],p[1]=E-d[1];var L=(l[0]-b[0]-.5*w)/x,C=(l[1]-b[1]-.5*M)/_;m[0]=L,m[1]=C,g[0]=L-m[0],g[1]=C-m[1],n.bind(),n.uniforms.scaleHi=d,n.uniforms.scaleLo=p,n.uniforms.translateHi=m,n.uniforms.translateLo=g,n.uniforms.color=this.color,n.uniforms.borderColor=this.borderColor,n.uniforms.pointSize=f*(c+u),n.uniforms.centerFraction=0===this.borderSize?2:c/(c+u+1.25),a.bind(),n.attributes.positionHi.pointer(),o.bind(),n.attributes.positionLo.pointer(),e?(this.pickOffset=t,v[0]=255&t,v[1]=t>>8&255,v[2]=t>>16&255,v[3]=t>>24&255,n.uniforms.pickOffset=v,s.bind(),n.attributes.pickId.pointer(h.UNSIGNED_BYTE)):(n.uniforms.useWeight=1,this.weightBuffer.bind(),n.attributes.weight.pointer());var I=!0;if(this.snapPoints)for(var P=i.length-1;P>=0;P--){var D=i[P];if(!(D.pixelSize<A&&P>1)){var z=this.getVisibleRange(D),O=z[0],F=z[1];F>O&&h.drawArrays(h.POINTS,O,F-O),!e&&I&&(I=!1,n.uniforms.useWeight=0)}}else h.drawArrays(h.POINTS,0,this.pointCount);return t+this.pointCount},f.getVisibleRange=function(t){var e=this.plot.dataBox,r=this.bounds,n=this.pixelSize,i=this.size,a=this.plot.pixelRatio,s=r[2]-r[0];r[3],r[1];if(!t)for(var l=this.scales.length-1;l>=0&&((t=this.scales[l]).pixelSize<n&&l>1);l--);var c=this.xCoords,u=(e[0]-r[0]-n*i*a)/s,h=(e[2]-r[0]+n*i*a)/s,f=t.offset,d=t.count+f,p=o.ge(c,u,f,d-1);return[p,o.lt(c,h,p,d-1)+1]},f.drawPick=f.draw,f.pick=function(t,e,r){var n=r-this.pickOffset;return n<0||n>=this.pointCount?null:{object:this,pointId:n,dataCoord:[this.points[2*n],this.points[2*n+1]]}}},{"./lib/shader":245,"array-bounds":45,"array-normalize":46,"binary-search-bounds":246,"gl-buffer":157,"gl-shader":256,"snap-points-2d":248,"typedarray-pool":550}],250:[function(t,e,r){"use strict";var n=t("vectorize-text");e.exports=function(t,e){var r=i[e];if(r||(r=i[e]={}),t in r)return r[t];for(var a=n(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),o=n(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),s=[[1/0,1/0],[-1/0,-1/0]],l=0;l<a.positions.length;++l)for(var c=a.positions[l],u=0;u<2;++u)s[0][u]=Math.min(s[0][u],c[u]),s[1][u]=Math.max(s[1][u],c[u]);return r[t]=[o,a,s]};var i={}},{"vectorize-text":563}],251:[function(t,e,r){function n(t,e){var r=i(t,e),n=r.attributes;return n.position.location=0,n.color.location=1,n.glyph.location=2,n.id.location=3,r}var i=t("gl-shader"),a="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position;\nattribute vec4 color;\nattribute vec2 glyph;\nattribute vec4 id;\n\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(any(lessThan(position, clipBounds[0])) || \n any(greaterThan(position, clipBounds[1])) ) {\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="precision mediump float;\n#define GLSLIFY 1\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(any(lessThan(position, clipBounds[0])) || any(greaterThan(position, clipBounds[1]))) {\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="precision mediump float;\n#define GLSLIFY 1\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(any(lessThan(position, clipBounds[0])) ||\n any(greaterThan(position, clipBounds[1])) ) {\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="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float opacity;\n\nvarying vec4 interpColor;\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) ||\n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = interpColor * opacity;\n }\n}\n",c="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 fragClipBounds[2];\nuniform float pickGroup;\n\nvarying vec4 pickId;\nvarying vec3 dataCoordinate;\n\nvoid main() {\n if(any(lessThan(dataCoordinate, fragClipBounds[0])) || \n any(greaterThan(dataCoordinate, fragClipBounds[1])) ) {\n discard;\n } else {\n gl_FragColor = vec4(pickGroup, pickId.bgr);\n }\n}",u=[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"glyph",type:"vec2"},{name:"id",type:"vec4"}],h={vertex:a,fragment:l,attributes:u},f={vertex:o,fragment:l,attributes:u},d={vertex:s,fragment:l,attributes:u},p={vertex:a,fragment:c,attributes:u},m={vertex:o,fragment:c,attributes:u},g={vertex:s,fragment:c,attributes:u};r.createPerspective=function(t){return n(t,h)},r.createOrtho=function(t){return n(t,f)},r.createProject=function(t){return n(t,d)},r.createPickPerspective=function(t){return n(t,p)},r.createPickOrtho=function(t){return n(t,m)},r.createPickProject=function(t){return n(t,g)}},{"gl-shader":256}],252:[function(t,e,r){"use strict";function n(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 i(t,e,r,i){return n(i,i),n(i,i),n(i,i)}function a(t,e,r,n,i,a,o,s,l,c,u,h){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.lineWidth=0,this.projectScale=[2/3,2/3,2/3],this.projectOpacity=[1,1,1],this.pickId=0,this.pickPerspectiveShader=c,this.pickOrthoShader=u,this.pickProjectShader=h,this.points=[],this._selectResult=new function(t,e){this.index=t,this.dataCoordinate=this.position=e}(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}function o(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 l(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,a){var c,u=e.axesProject,h=e.gl,f=t.uniforms,d=r.model||v,m=r.view||v,g=r.projection||v,y=e.axesBounds,S=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);c=e.axes?e.axes.lastCubeProps.axis:[1,1,1],b[0]=2/h.drawingBufferWidth,b[1]=2/h.drawingBufferHeight,t.bind(),f.view=m,f.projection=g,f.screenSize=b,f.highlightId=e.highlightId,f.highlightScale=e.highlightScale,f.clipBounds=S,f.pickGroup=e.pickId/255,f.pixelRatio=e.pixelRatio;for(var E=0;E<3;++E)if(u[E]&&e.projectOpacity[E]<1===n){f.scale=e.projectScale[E],f.opacity=e.projectOpacity[E];for(var L=k,C=0;C<16;++C)L[C]=0;for(C=0;C<4;++C)L[5*C]=1;L[5*E]=0,c[E]<0?L[12+E]=y[0][E]:L[12+E]=y[1][E],p(L,d,L),f.model=L;var I=(E+1)%3,P=(E+2)%3,D=o(x),z=o(_);D[I]=1,z[P]=1;var O=i(0,0,0,s(w,D)),F=i(0,0,0,s(M,z));if(Math.abs(O[1])>Math.abs(F[1])){var R=O;O=F,F=R,R=D,D=z,z=R;var j=I;I=P,P=j}O[0]<0&&(D[I]=-1),F[1]>0&&(z[P]=-1);var N=0,B=0;for(C=0;C<4;++C)N+=Math.pow(d[4*I+C],2),B+=Math.pow(d[4*P+C],2);D[I]/=Math.sqrt(N),z[P]/=Math.sqrt(B),f.axes[0]=D,f.axes[1]=z,f.fragClipBounds[0]=l(T,S[0],E,-1e8),f.fragClipBounds[1]=l(T,S[1],E,1e8),e.vao.draw(h.TRIANGLES,e.vertexCount),e.lineWidth>0&&(h.lineWidth(e.lineWidth),e.vao.draw(h.LINES,e.lineVertexCount,e.vertexCount))}}function u(t,e,r,n,i,a){var o=r.gl;if(r.vao.bind(),i===r.opacity<1||a){t.bind();var s=t.uniforms;s.model=n.model||v,s.view=n.view||v,s.projection=n.projection||v,b[0]=2/o.drawingBufferWidth,b[1]=2/o.drawingBufferHeight,s.screenSize=b,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=S,s.clipBounds=r.axes.bounds,s.opacity=r.opacity,s.pickGroup=r.pickId/255,s.pixelRatio=r.pixelRatio,r.vao.draw(o.TRIANGLES,r.vertexCount),r.lineWidth>0&&(o.lineWidth(r.lineWidth),r.vao.draw(o.LINES,r.lineVertexCount,r.vertexCount))}c(e,r,n,i),r.vao.unbind()}var h=t("gl-buffer"),f=t("gl-vao"),d=t("typedarray-pool"),p=t("gl-mat4/multiply"),m=t("./lib/shaders"),g=t("./lib/glyphs"),v=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];e.exports=function(t){var e=t.gl,r=m.createPerspective(e),n=m.createOrtho(e),i=m.createProject(e),o=m.createPickPerspective(e),s=m.createPickOrtho(e),l=m.createPickProject(e),c=h(e),u=h(e),d=h(e),p=h(e),g=new a(e,r,n,i,c,u,d,p,f(e,[{buffer:c,size:3,type:e.FLOAT},{buffer:u,size:4,type:e.FLOAT},{buffer:d,size:2,type:e.FLOAT},{buffer:p,size:4,type:e.UNSIGNED_BYTE,normalized:!0}]),o,s,l);return g.update(t),g};var y=a.prototype;y.pickSlots=1,y.setPickBase=function(t){this.pickId=t},y.isTransparent=function(){if(this.opacity<1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]<1)return!0;return!1},y.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var b=[0,0],x=[0,0,0],_=[0,0,0],w=[0,0,0,1],M=[0,0,0,1],k=v.slice(),T=[0,0,0],A=[[0,0,0],[0,0,0]],S=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];y.draw=function(t){u(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},y.drawTransparent=function(t){u(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},y.drawPick=function(t){u(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,this.pickProjectShader,this,t,!1,!0)},y.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=t.value[2]+(t.value[1]<<8)+(t.value[0]<<16);if(e>=this.pointCount||e<0)return null;var r=this.points[e],n=this._selectResult;n.index=e;for(var i=0;i<3;++i)n.position[i]=n.dataCoordinate[i]=r[i];return n},y.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]},y.update=function(t){if("perspective"in(t=t||{})&&(this.useOrtho=!t.perspective),"orthographic"in t&&(this.useOrtho=!!t.orthographic),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"project"in t)if(Array.isArray(t.project))this.axesProject=t.project;else{var e=!!t.project;this.axesProject=[e,e,e]}if("projectScale"in t)if(Array.isArray(t.projectScale))this.projectScale=t.projectScale.slice();else{var r=+t.projectScale;this.projectScale=[r,r,r]}if("projectOpacity"in t)if(Array.isArray(t.projectOpacity))this.projectOpacity=t.projectOpacity.slice();else{r=+t.projectOpacity;this.projectOpacity=[r,r,r]}"opacity"in t&&(this.opacity=t.opacity),this.dirty=!0;var n=t.position;if(n){var i=t.font||"normal",a=t.alignment||[0,0],o=[1/0,1/0,1/0],s=[-1/0,-1/0,-1/0],l=t.glyph,c=t.color,u=t.size,h=t.angle,f=t.lineColor,p=0,m=0,v=0,y=n.length;t:for(var b=0;b<y;++b){for(var x=n[b],_=0;_<3;++_)if(isNaN(x[_])||!isFinite(x[_]))continue t;var w=(R=Array.isArray(l)?g(l[b],i):g(l||"\u25cf",i))[0],M=R[1],k=R[2];m+=3*w.cells.length,v+=2*M.edges.length}var T=m+v,A=d.mallocFloat(3*T),S=d.mallocFloat(4*T),E=d.mallocFloat(2*T),L=d.mallocUint32(T),C=[0,a[1]],I=0,P=m,D=[0,0,0,1],z=[0,0,0,1],O=Array.isArray(c)&&Array.isArray(c[0]),F=Array.isArray(f)&&Array.isArray(f[0]);t:for(b=0;b<y;++b){for(x=n[b],_=0;_<3;++_){if(isNaN(x[_])||!isFinite(x[_])){p+=1;continue t}s[_]=Math.max(s[_],x[_]),o[_]=Math.min(o[_],x[_])}var R;w=(R=Array.isArray(l)?g(l[b],i):g(l||"\u25cf",i))[0],M=R[1],k=R[2];if(Array.isArray(c)){if(3===(j=O?c[b]:c).length){for(_=0;_<3;++_)D[_]=j[_];D[3]=1}else if(4===j.length)for(_=0;_<4;++_)D[_]=j[_]}else D[0]=D[1]=D[2]=0,D[3]=1;if(Array.isArray(f)){var j;if(3===(j=F?f[b]:f).length){for(_=0;_<3;++_)z[_]=j[_];z[_]=1}else if(4===j.length)for(_=0;_<4;++_)z[_]=j[_]}else z[0]=z[1]=z[2]=0,z[3]=1;var N=.5;Array.isArray(u)?N=+u[b]:u?N=+u:this.useOrtho&&(N=12);var B=0;Array.isArray(h)?B=+h[b]:h&&(B=+h);var U=Math.cos(B),V=Math.sin(B);for(x=n[b],_=0;_<3;++_)s[_]=Math.max(s[_],x[_]),o[_]=Math.min(o[_],x[_]);a[0]<0?C[0]=a[0]*(1+k[1][0]):a[0]>0&&(C[0]=-a[0]*(1+k[0][0]));var H=w.cells,q=w.positions;for(_=0;_<H.length;++_)for(var G=H[_],Y=0;Y<3;++Y){for(var W=0;W<3;++W)A[3*I+W]=x[W];for(W=0;W<4;++W)S[4*I+W]=D[W];L[I]=p;var X=q[G[Y]];E[2*I]=N*(U*X[0]-V*X[1]+C[0]),E[2*I+1]=N*(V*X[0]+U*X[1]+C[1]),I+=1}for(H=M.edges,q=M.positions,_=0;_<H.length;++_)for(G=H[_],Y=0;Y<2;++Y){for(W=0;W<3;++W)A[3*P+W]=x[W];for(W=0;W<4;++W)S[4*P+W]=z[W];L[P]=p;X=q[G[Y]];E[2*P]=N*(U*X[0]-V*X[1]+C[0]),E[2*P+1]=N*(V*X[0]+U*X[1]+C[1]),P+=1}p+=1}this.vertexCount=m,this.lineVertexCount=v,this.pointBuffer.update(A),this.colorBuffer.update(S),this.glyphBuffer.update(E),this.idBuffer.update(new Uint32Array(L)),d.free(A),d.free(S),d.free(E),d.free(L),this.bounds=[o,s],this.points=n,this.pointCount=n.length}},y.dispose=function(){this.shader.dispose(),this.orthoShader.dispose(),this.pickPerspectiveShader.dispose(),this.pickOrthoShader.dispose(),this.vao.dispose(),this.pointBuffer.dispose(),this.colorBuffer.dispose(),this.glyphBuffer.dispose(),this.idBuffer.dispose()}},{"./lib/glyphs":250,"./lib/shaders":251,"gl-buffer":157,"gl-mat4/multiply":184,"gl-vao":272,"typedarray-pool":550}],253:[function(t,e,r){"use strict";r.boxVertex="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="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec4 color;\n\nvoid main() {\n gl_FragColor = color;\n}\n"},{}],254:[function(t,e,r){"use strict";function n(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}var i=t("gl-shader"),a=t("gl-buffer"),o=t("./lib/shaders");e.exports=function(t,e){var r=t.gl,s=new n(t,a(r,[0,0,0,1,1,0,1,1]),i(r,o.boxVertex,o.boxFragment));return s.update(e),t.addOverlay(s),s};var s=n.prototype;s.draw=function(){if(this.enabled){var t=this.plot,e=this.selectBox,r=this.borderWidth,n=(this.innerFill,this.innerColor),i=(this.outerFill,this.outerColor),a=this.borderColor,o=t.box,s=t.screenBox,l=t.dataBox,c=t.viewBox,u=t.pixelRatio,h=(e[0]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],f=(e[1]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1],d=(e[2]-l[0])*(c[2]-c[0])/(l[2]-l[0])+c[0],p=(e[3]-l[1])*(c[3]-c[1])/(l[3]-l[1])+c[1];if(h=Math.max(h,c[0]),f=Math.max(f,c[1]),d=Math.min(d,c[2]),p=Math.min(p,c[3]),!(d<h||p<f)){o.bind();var m=s[2]-s[0],g=s[3]-s[1];if(this.outerFill&&(o.drawBox(0,0,m,f,i),o.drawBox(0,f,h,p,i),o.drawBox(0,p,m,g,i),o.drawBox(d,f,m,p,i)),this.innerFill&&o.drawBox(h,f,d,p,n),r>0){var v=r*u;o.drawBox(h-v,f-v,d+v,f+v,a),o.drawBox(h-v,p-v,d+v,p+v,a),o.drawBox(h-v,f-v,h+v,p+v,a),o.drawBox(d-v,f-v,d+v,p+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":253,"gl-buffer":157,"gl-shader":256}],255:[function(t,e,r){"use strict";function n(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)}}e.exports=function(t,e){return new n(t,i(t,e),a.mallocUint8(e[0]*e[1]*4))};var i=t("gl-fbo"),a=t("typedarray-pool"),o=t("ndarray"),s=t("bit-twiddle").nextPow2,l=t("cwise/lib/wrapper")({args:["array",{offset:[0,0,1],array:0},{offset:[0,0,2],array:0},{offset:[0,0,3],array:0},"scalar","scalar","index"],pre:{body:"{this_closestD2=1e8,this_closestX=-1,this_closestY=-1}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},body:{body:"{if(_inline_46_arg0_<255||_inline_46_arg1_<255||_inline_46_arg2_<255||_inline_46_arg3_<255){var _inline_46_l=_inline_46_arg4_-_inline_46_arg6_[0],_inline_46_a=_inline_46_arg5_-_inline_46_arg6_[1],_inline_46_f=_inline_46_l*_inline_46_l+_inline_46_a*_inline_46_a;_inline_46_f<this_closestD2&&(this_closestD2=_inline_46_f,this_closestX=_inline_46_arg6_[0],this_closestY=_inline_46_arg6_[1])}}",args:[{name:"_inline_46_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg1_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg4_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg5_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_46_arg6_",lvalue:!1,rvalue:!0,count:4}],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:["_inline_46_a","_inline_46_f","_inline_46_l"]},post:{body:"{return[this_closestX,this_closestY,this_closestD2]}",args:[],thisVars:["this_closestD2","this_closestX","this_closestY"],localVars:[]},debug:!1,funcName:"cwise",blockSize:64}),c=n.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(s(r*e*4)),i=0;i<r*e*4;++i)n[i]=255}return t}}}),c.begin=function(){var t=this.gl;this.shape;t&&(this.fbo.bind(),t.clearColor(1,1,1,1),t.clear(t.COLOR_BUFFER_BIT|t.DEPTH_BUFFER_BIT))},c.end=function(){var t=this.gl;t&&(t.bindFramebuffer(t.FRAMEBUFFER,null),this._readTimeout||clearTimeout(this._readTimeout),this._readTimeout=setTimeout(this._readCallback,1))},c.query=function(t,e,r){if(!this.gl)return null;var n=this.fbo.shape.slice();t|=0,e|=0,"number"!=typeof r&&(r=1);var i=0|Math.min(Math.max(t-r,0),n[0]),a=0|Math.min(Math.max(t+r,0),n[0]),s=0|Math.min(Math.max(e-r,0),n[1]),c=0|Math.min(Math.max(e+r,0),n[1]);if(a<=i||c<=s)return null;var u=[a-i,c-s],h=o(this.buffer,[u[0],u[1],4],[4,4*n[0],1],4*(i+n[0]*s)),f=l(h.hi(u[0],u[1],1),r,r),d=f[0],p=f[1];if(d<0||Math.pow(this.radius,2)<f[2])return null;return new function(t,e,r,n,i){this.coord=[t,e],this.id=r,this.value=n,this.distance=i}(d+i|0,p+s|0,h.get(d,p,0),[h.get(d,p,1),h.get(d,p,2),h.get(d,p,3)],Math.sqrt(f[2]))},c.dispose=function(){this.gl&&(this.fbo.dispose(),a.free(this.buffer),this.gl=null,this._readTimeout&&clearTimeout(this._readTimeout))}},{"bit-twiddle":68,"cwise/lib/wrapper":114,"gl-fbo":165,ndarray:468,"typedarray-pool":550}],256:[function(t,e,r){"use strict";function n(t){this.gl=t,this._vref=this._fref=this._relink=this.vertShader=this.fragShader=this.program=this.attributes=this.uniforms=this.types=null}function i(t,e){return t.name<e.name?-1:1}var a=t("./lib/create-uniforms"),o=t("./lib/create-attributes"),s=t("./lib/reflect"),l=t("./lib/shader-cache"),c=t("./lib/runtime-reflect"),u=t("./lib/GLError"),h=n.prototype;h.bind=function(){this.program||this._relink(),this.gl.useProgram(this.program)},h.dispose=function(){this._fref&&this._fref.dispose(),this._vref&&this._vref.dispose(),this.attributes=this.types=this.vertShader=this.fragShader=this.program=this._relink=this._fref=this._vref=null},h.update=function(t,e,r,n){function h(){d.program=l.program(p,d._vref,d._fref,x,_);for(var t=0;t<r.length;++t)E[t]=p.getUniformLocation(d.program,r[t].name)}if(!e||1===arguments.length){var f=t;t=f.vertex,e=f.fragment,r=f.uniforms,n=f.attributes}var d=this,p=d.gl,m=d._vref;d._vref=l.shader(p,p.VERTEX_SHADER,t),m&&m.dispose(),d.vertShader=d._vref.shader;var g=this._fref;if(d._fref=l.shader(p,p.FRAGMENT_SHADER,e),g&&g.dispose(),d.fragShader=d._fref.shader,!r||!n){var v=p.createProgram();if(p.attachShader(v,d.fragShader),p.attachShader(v,d.vertShader),p.linkProgram(v),!p.getProgramParameter(v,p.LINK_STATUS)){var y=p.getProgramInfoLog(v);throw new u(y,"Error linking program:"+y)}r=r||c.uniforms(p,v),n=n||c.attributes(p,v),p.deleteProgram(v)}(n=n.slice()).sort(i);for(var b=[],x=[],_=[],w=0;w<n.length;++w){var M=n[w];if(M.type.indexOf("mat")>=0){for(var k=0|M.type.charAt(M.type.length-1),T=new Array(k),A=0;A<k;++A)T[A]=_.length,x.push(M.name+"["+A+"]"),"number"==typeof M.location?_.push(M.location+A):Array.isArray(M.location)&&M.location.length===k&&"number"==typeof M.location[A]?_.push(0|M.location[A]):_.push(-1);b.push({name:M.name,type:M.type,locations:T})}else b.push({name:M.name,type:M.type,locations:[_.length]}),x.push(M.name),"number"==typeof M.location?_.push(0|M.location):_.push(-1)}var S=0;for(w=0;w<_.length;++w)if(_[w]<0){for(;_.indexOf(S)>=0;)S+=1;_[w]=S}var E=new Array(r.length);h(),d._relink=h,d.types={uniforms:s(r),attributes:s(n)},d.attributes=o(p,d,b,_),Object.defineProperty(d,"uniforms",a(p,d,r,E))},e.exports=function(t,e,r,i,a){var o=new n(t);return o.update(e,r,i,a),o}},{"./lib/GLError":257,"./lib/create-attributes":258,"./lib/create-uniforms":259,"./lib/reflect":260,"./lib/runtime-reflect":261,"./lib/shader-cache":262}],257:[function(t,e,r){arguments[4][214][0].apply(r,arguments)},{dup:214}],258:[function(t,e,r){arguments[4][215][0].apply(r,arguments)},{"./GLError":257,dup:215}],259:[function(t,e,r){arguments[4][216][0].apply(r,arguments)},{"./GLError":257,"./reflect":260,dup:216}],260:[function(t,e,r){arguments[4][217][0].apply(r,arguments)},{dup:217}],261:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{dup:218}],262:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{"./GLError":257,dup:219,"gl-format-compiler-error":166,"weakmap-shim":571}],263:[function(t,e,r){"use strict";function n(t){this.plot=t,this.enable=[!0,!0,!1,!1],this.width=[1,1,1,1],this.color=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.center=[1/0,1/0]}e.exports=function(t,e){var r=new n(t);return r.update(e),t.addOverlay(r),r};var i=n.prototype;i.update=function(t){t=t||{},this.enable=(t.enable||[!0,!0,!1,!1]).slice(),this.width=(t.width||[1,1,1,1]).slice(),this.color=(t.color||[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]]).map(function(t){return t.slice()}),this.center=(t.center||[1/0,1/0]).slice(),this.plot.setOverlayDirty()},i.draw=function(){var t=this.enable,e=this.width,r=this.color,n=this.center,i=this.plot,a=i.line,o=i.dataBox,s=i.viewBox;if(a.bind(),o[0]<=n[0]&&n[0]<=o[2]&&o[1]<=n[1]&&n[1]<=o[3]){var l=s[0]+(n[0]-o[0])/(o[2]-o[0])*(s[2]-s[0]),c=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,c,s[0],c,e[0],r[0]),t[1]&&a.drawLine(l,c,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,c,s[2],c,e[2],r[2]),t[3]&&a.drawLine(l,c,l,s[3],e[3],r[3])}},i.dispose=function(){this.plot.removeOverlay(this)}},{}],264:[function(t,e,r){"use strict";var n=t("gl-shader");e.exports=function(t){return n(t,"precision mediump float;\n#define GLSLIFY 1\n\nattribute vec3 position, color;\nattribute float weight;\n\nuniform mat4 model, view, projection;\nuniform vec3 coordinates[3];\nuniform vec4 colors[3];\nuniform vec2 screenShape;\nuniform float lineWidth;\n\nvarying vec4 fragColor;\n\nvoid main() {\n vec3 vertexPosition = mix(coordinates[0],\n mix(coordinates[2], coordinates[1], 0.5 * (position + 1.0)), abs(position));\n\n vec4 clipPos = projection * view * model * vec4(vertexPosition, 1.0);\n vec2 clipOffset = (projection * view * model * vec4(color, 0.0)).xy;\n vec2 delta = weight * clipOffset * screenShape;\n vec2 lineOffset = normalize(vec2(delta.y, -delta.x)) / screenShape;\n\n gl_Position = vec4(clipPos.xy + clipPos.w * 0.5 * lineWidth * lineOffset, clipPos.z, clipPos.w);\n fragColor = color.x * colors[0] + color.y * colors[1] + color.z * colors[2];\n}\n","precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}",null,[{name:"position",type:"vec3"},{name:"color",type:"vec3"},{name:"weight",type:"float"}])}},{"gl-shader":256}],265:[function(t,e,r){"use strict";function n(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n,this.pixelRatio=1,this.bounds=[[-1e3,-1e3,-1e3],[1e3,1e3,1e3]],this.position=[0,0,0],this.lineWidth=[2,2,2],this.colors=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.enabled=[!0,!0,!0],this.drawSides=[!0,!0,!0],this.axes=null}var i=t("gl-buffer"),a=t("gl-vao"),o=t("./shaders/index");e.exports=function(t,e){function r(t,e,r,n,i,a){var o=[t,e,r,0,0,0,1];o[n+3]=1,o[n]=i,s.push.apply(s,o),o[6]=-1,s.push.apply(s,o),o[n]=a,s.push.apply(s,o),s.push.apply(s,o),o[6]=1,s.push.apply(s,o),o[n]=i,s.push.apply(s,o)}var s=[];r(0,0,0,0,0,1),r(0,0,0,1,0,1),r(0,0,0,2,0,1),r(1,0,0,1,-1,1),r(1,0,0,2,-1,1),r(0,1,0,0,-1,1),r(0,1,0,2,-1,1),r(0,0,1,0,-1,1),r(0,0,1,1,-1,1);var l=i(t,s),c=a(t,[{type:t.FLOAT,buffer:l,size:3,offset:0,stride:28},{type:t.FLOAT,buffer:l,size:3,offset:12,stride:28},{type:t.FLOAT,buffer:l,size:1,offset:24,stride:28}]),u=o(t);u.attributes.position.location=0,u.attributes.color.location=1,u.attributes.weight.location=2;var h=new n(t,l,c,u);return h.update(e),h};var s=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],l=n.prototype,c=[0,0,0],u=[0,0,0],h=[0,0];l.isTransparent=function(){return!1},l.drawTransparent=function(t){},l.draw=function(t){var e=this.gl,r=this.vao,n=this.shader;r.bind(),n.bind();var i,a=t.model||s,o=t.view||s,l=t.projection||s;this.axes&&(i=this.axes.lastCubeProps.axis);for(var f=c,d=u,p=0;p<3;++p)i&&i[p]<0?(f[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(f[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);h[0]=e.drawingBufferWidth,h[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o,n.uniforms.projection=l,n.uniforms.coordinates=[this.position,f,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=h;for(p=0;p<3;++p)n.uniforms.lineWidth=this.lineWidth[p]*this.pixelRatio,this.enabled[p]&&(r.draw(e.TRIANGLES,6,6*p),this.drawSides[p]&&r.draw(e.TRIANGLES,12,18+12*p));r.unbind()},l.update=function(t){t&&("bounds"in t&&(this.bounds=t.bounds),"position"in t&&(this.position=t.position),"lineWidth"in t&&(this.lineWidth=t.lineWidth),"colors"in t&&(this.colors=t.colors),"enabled"in t&&(this.enabled=t.enabled),"drawSides"in t&&(this.drawSides=t.drawSides))},l.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()}},{"./shaders/index":264,"gl-buffer":157,"gl-vao":272}],266:[function(t,e,r){var n=t("gl-shader"),i="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute vec3 f;\nattribute vec3 normal;\n\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 worldCoordinate = vec3(uv.zw, f.x);\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",a="precision mediump float;\n#define GLSLIFY 1\n\nfloat beckmannDistribution_2_0(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\n\n\nfloat beckmannSpecular_1_1(\n vec3 lightDirection,\n vec3 viewDirection,\n vec3 surfaceNormal,\n float roughness) {\n return beckmannDistribution_2_0(dot(surfaceNormal, normalize(lightDirection + viewDirection)), roughness);\n}\n\n\n\nuniform vec3 lowerBound, upperBound;\nuniform float contourTint;\nuniform vec4 contourColor;\nuniform sampler2D colormap;\nuniform vec3 clipBounds[2];\nuniform float roughness, fresnel, kambient, kdiffuse, kspecular, opacity;\nuniform float vertexColor;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n if (kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = max(beckmannSpecular_1_1(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n",o="precision mediump float;\n#define GLSLIFY 1\n\nattribute vec4 uv;\nattribute float f;\n\nuniform mat3 permutation;\nuniform mat4 model, view, projection;\nuniform float height, zOffset;\nuniform sampler2D colormap;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 lightDirection, eyeDirection, surfaceNormal;\nvarying vec4 vColor;\n\nvoid main() {\n vec3 dataCoordinate = permutation * vec3(uv.xy, height);\n vec4 worldPosition = model * vec4(dataCoordinate, 1.0);\n\n vec4 clipPosition = projection * view * worldPosition;\n clipPosition.z = clipPosition.z + zOffset;\n\n gl_Position = clipPosition;\n value = f;\n kill = -1.0;\n worldCoordinate = dataCoordinate;\n planeCoordinate = uv.zw;\n\n vColor = texture2D(colormap, vec2(value, value));\n\n //Don't do lighting for contours\n surfaceNormal = vec3(1,0,0);\n eyeDirection = vec3(0,1,0);\n lightDirection = vec3(0,0,1);\n}\n",s="precision mediump float;\n#define GLSLIFY 1\n\nuniform vec2 shape;\nuniform vec3 clipBounds[2];\nuniform float pickId;\n\nvarying float value, kill;\nvarying vec3 worldCoordinate;\nvarying vec2 planeCoordinate;\nvarying vec3 surfaceNormal;\n\nvec2 splitFloat(float v) {\n float vh = 255.0 * v;\n float upper = floor(vh);\n float lower = fract(vh);\n return vec2(upper / 255.0, floor(lower * 16.0) / 16.0);\n}\n\nvoid main() {\n if(kill > 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n vec2 ux = splitFloat(planeCoordinate.x / shape.x);\n vec2 uy = splitFloat(planeCoordinate.y / shape.y);\n gl_FragColor = vec4(pickId, ux.x, uy.x, ux.y + (uy.y/16.0));\n}\n";r.createShader=function(t){var e=n(t,i,a,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,s,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,o,a,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,o,s,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e}},{"gl-shader":256}],267:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u,h,f,d){this.gl=t,this.shape=e,this.bounds=r,this.intensityBounds=[],this._shader=n,this._pickShader=i,this._coordinateBuffer=a,this._vao=o,this._colorMap=s,this._contourShader=l,this._contourPickShader=c,this._contourBuffer=u,this._contourVAO=h,this._contourOffsets=[[],[],[]],this._contourCounts=[[],[],[]],this._vertexCount=0,this._pickResult=new function(t,e,r,n,i){this.position=t,this.index=e,this.uv=r,this.level=n,this.dataCoordinate=i}([0,0,0],[0,0],[0,0],[0,0,0],[0,0,0]),this._dynamicBuffer=f,this._dynamicVAO=d,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=[y(p.mallocFloat(1024),[0,0]),y(p.mallocFloat(1024),[0,0]),y(p.mallocFloat(1024),[0,0])],this.pickId=1,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.snapToData=!1,this.opacity=1,this.lightPosition=[10,1e4,0],this.ambientLight=.8,this.diffuseLight=.8,this.specularLight=2,this.roughness=.5,this.fresnel=1.5,this.vertexColor=0,this.dirty=!0}function i(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||O,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=F.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],x(l,t.model,l);var c=F.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 F.showSurface=o,F.showContour=s,F}function a(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=R;n.model=t.model||C,n.view=t.view||C,n.projection=t.projection||C,n.lowerBound=[this.bounds[0][0],this.bounds[0][1],this.colorBounds[0]||this.bounds[0][2]],n.upperBound=[this.bounds[1][0],this.bounds[1][1],this.colorBounds[1]||this.bounds[1][2]],n.contourColor=this.contourColor[0],n.inverseModel=_(n.inverseModel,n.model);for(var a=0;a<2;++a)for(var o=n.clipBounds[a],s=0;s<3;++s)o[s]=Math.min(Math.max(this.clipBounds[a][s],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=N,n.vertexColor=this.vertexColor;var l=j;for(x(l,n.view,n.model),x(l,n.projection,l),_(l,l),a=0;a<3;++a)n.eyePosition[a]=l[12+a]/l[15];var c=l[15];for(a=0;a<3;++a)c+=this.lightPosition[a]*l[4*a+3];for(a=0;a<3;++a){var u=l[12+a];for(s=0;s<3;++s)u+=l[4*s+a]*this.lightPosition[s];n.lightPosition[a]=u/c}var h=i(n,this);if(h.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),a=0;a<3;++a)this.surfaceProject[a]&&this.vertexCount&&(this._shader.uniforms.model=h.projections[a],this._shader.uniforms.clipBounds=h.clipBounds[a],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(h.showContour&&!e){var f=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,f.bind(),f.uniforms=n;var d=this._contourVAO;for(d.bind(),a=0;a<3;++a)for(f.uniforms.permutation=P[a],r.lineWidth(this.contourWidth[a]),s=0;s<this.contourLevels[a].length;++s)this._contourCounts[a][s]&&(s===this.highlightLevel[a]?(f.uniforms.contourColor=this.highlightColor[a],f.uniforms.contourTint=this.highlightTint[a]):0!==s&&s-1!==this.highlightLevel[a]||(f.uniforms.contourColor=this.contourColor[a],f.uniforms.contourTint=this.contourTint[a]),f.uniforms.height=this.contourLevels[a][s],d.draw(r.LINES,this._contourCounts[a][s],this._contourOffsets[a][s]));for(a=0;a<3;++a)for(f.uniforms.model=h.projections[a],f.uniforms.clipBounds=h.clipBounds[a],s=0;s<3;++s)if(this.contourProject[a][s]){f.uniforms.permutation=P[s],r.lineWidth(this.contourWidth[s]);for(var p=0;p<this.contourLevels[s].length;++p)p===this.highlightLevel[s]?(f.uniforms.contourColor=this.highlightColor[s],f.uniforms.contourTint=this.highlightTint[s]):0!==p&&p-1!==this.highlightLevel[s]||(f.uniforms.contourColor=this.contourColor[s],f.uniforms.contourTint=this.contourTint[s]),f.uniforms.height=this.contourLevels[s][p],d.draw(r.LINES,this._contourCounts[s][p],this._contourOffsets[s][p])}for((d=this._dynamicVAO).bind(),a=0;a<3;++a)if(0!==this._dynamicCounts[a])for(f.uniforms.model=n.model,f.uniforms.clipBounds=n.clipBounds,f.uniforms.permutation=P[a],r.lineWidth(this.dynamicWidth[a]),f.uniforms.contourColor=this.dynamicColor[a],f.uniforms.contourTint=this.dynamicTint[a],f.uniforms.height=this.dynamicLevel[a],d.draw(r.LINES,this._dynamicCounts[a],this._dynamicOffsets[a]),s=0;s<3;++s)this.contourProject[s][a]&&(f.uniforms.model=h.projections[s],f.uniforms.clipBounds=h.clipBounds[s],d.draw(r.LINES,this._dynamicCounts[a],this._dynamicOffsets[a]));d.unbind()}}function o(t,e){var r=e.shape.slice(),n=t.shape.slice();g.assign(t.lo(1,1).hi(r[0],r[1]),e),g.assign(t.lo(1).hi(r[0],1),e.hi(r[0],1)),g.assign(t.lo(1,n[1]-1).hi(r[0],1),e.lo(0,r[1]-1).hi(r[0],1)),g.assign(t.lo(0,1).hi(1,r[1]),e.hi(1)),g.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))}function s(t,e){return Array.isArray(t)?[e(t[0]),e(t[1]),e(t[2])]:[e(t),e(t),e(t)]}function l(t){return Array.isArray(t)?3===t.length?[t[0],t[1],t[2],1]:[t[0],t[1],t[2],t[3]]:[0,0,0,1]}function c(t){if(Array.isArray(t)){if(Array.isArray(t))return[l(t[0]),l(t[1]),l(t[2])];var e=l(t);return[e.slice(),e.slice(),e.slice()]}}e.exports=function(t){var e=t.gl,r=T(e),i=S(e),a=A(e),o=E(e),s=h(e),l=f(e,[{buffer:s,size:4,stride:L,offset:0},{buffer:s,size:3,stride:L,offset:16},{buffer:s,size:3,stride:L,offset:28}]),c=h(e),u=f(e,[{buffer:c,size:4,stride:20,offset:0},{buffer:c,size:1,stride:20,offset:16}]),p=h(e),m=f(e,[{buffer:p,size:2,type:e.FLOAT}]),g=d(e,1,D,e.RGBA,e.UNSIGNED_BYTE);g.minFilter=e.LINEAR,g.magFilter=e.LINEAR;var v=new n(e,[0,0],[[0,0,0],[0,0,0]],r,i,s,l,g,a,o,c,u,p,m),y={levels:[[],[],[]]};for(var b in t)y[b]=t[b];return y.colormap=y.colormap||"jet",v.update(y),v};var u=t("bit-twiddle"),h=t("gl-buffer"),f=t("gl-vao"),d=t("gl-texture2d"),p=t("typedarray-pool"),m=t("colormap"),g=t("ndarray-ops"),v=t("ndarray-pack"),y=t("ndarray"),b=t("surface-nets"),x=t("gl-mat4/multiply"),_=t("gl-mat4/invert"),w=t("binary-search-bounds"),M=t("ndarray-gradient"),k=t("./lib/shaders"),T=k.createShader,A=k.createContourShader,S=k.createPickShader,E=k.createPickContourShader,L=40,C=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],I=[[0,0],[0,1],[1,0],[1,1],[1,0],[0,1]],P=[[0,0,0,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(){for(var t=0;t<3;++t){var e=P[t],r=(t+2)%3;e[(t+1)%3+0]=1,e[r+3]=1,e[t+6]=1}}();var D=256,z=n.prototype;z.isTransparent=function(){return this.opacity<1},z.isOpaque=function(){if(this.opacity>=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},z.pickSlots=1,z.setPickBase=function(t){this.pickId=t};var O=[0,0,0],F={showSurface:!1,showContour:!1,projections:[C.slice(),C.slice(),C.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]},R={model:C,view:C,projection:C,inverseModel:C.slice(),lowerBound:[0,0,0],upperBound:[0,0,0],colorMap:0,clipBounds:[[0,0,0],[0,0,0]],height:0,contourTint:0,contourColor:[0,0,0,1],permutation:[1,0,0,0,1,0,0,0,1],zOffset:-1e-4,kambient:1,kdiffuse:1,kspecular:1,lightPosition:[1e3,1e3,1e3],eyePosition:[0,0,0],roughness:1,fresnel:1,opacity:1,vertexColor:0},j=C.slice(),N=[1,0,0,0,1,0,0,0,1];z.draw=function(t){return a.call(this,t,!1)},z.drawTransparent=function(t){return a.call(this,t,!0)};var B={model:C,view:C,projection:C,inverseModel:C,clipBounds:[[0,0,0],[0,0,0]],height:0,shape:[0,0],pickId:0,lowerBound:[0,0,0],upperBound:[0,0,0],zOffset:0,permutation:[1,0,0,0,1,0,0,0,1],lightPosition:[0,0,0],eyePosition:[0,0,0]};z.drawPick=function(t){t=t||{};var e=this.gl;e.disable(e.CULL_FACE);var r=B;r.model=t.model||C,r.view=t.view||C,r.projection=t.projection||C,r.shape=this._field[2].shape,r.pickId=this.pickId/255,r.lowerBound=this.bounds[0],r.upperBound=this.bounds[1],r.permutation=N;for(var n=0;n<2;++n)for(var a=r.clipBounds[n],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[n][o],-1e8),1e8);var s=i(r,this);if(s.showSurface){for(this._pickShader.bind(),this._pickShader.uniforms=r,this._vao.bind(),this._vao.draw(e.TRIANGLES,this._vertexCount),n=0;n<3;++n)this.surfaceProject[n]&&(this._pickShader.uniforms.model=s.projections[n],this._pickShader.uniforms.clipBounds=s.clipBounds[n],this._vao.draw(e.TRIANGLES,this._vertexCount));this._vao.unbind()}if(s.showContour){var l=this._contourPickShader;l.bind(),l.uniforms=r;var c=this._contourVAO;for(c.bind(),o=0;o<3;++o)for(e.lineWidth(this.contourWidth[o]),l.uniforms.permutation=P[o],n=0;n<this.contourLevels[o].length;++n)this._contourCounts[o][n]&&(l.uniforms.height=this.contourLevels[o][n],c.draw(e.LINES,this._contourCounts[o][n],this._contourOffsets[o][n]));for(n=0;n<3;++n)for(l.uniforms.model=s.projections[n],l.uniforms.clipBounds=s.clipBounds[n],o=0;o<3;++o)if(this.contourProject[n][o]){l.uniforms.permutation=P[o],e.lineWidth(this.contourWidth[o]);for(var u=0;u<this.contourLevels[o].length;++u)this._contourCounts[o][u]&&(l.uniforms.height=this.contourLevels[o][u],c.draw(e.LINES,this._contourCounts[o][u],this._contourOffsets[o][u]))}c.unbind()}},z.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=this._field[2].shape,r=this._pickResult,n=e[0]*(t.value[0]+(t.value[2]>>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 h=u?a:1-a,f=0;f<2;++f)for(var d=i+u,p=s+f,m=h*(f?l:1-l),g=0;g<3;++g)c[g]+=this._field[g].get(d,p)*m;for(var v=this._pickResult.level,y=0;y<3;++y)if(v[y]=w.le(this.contourLevels[y],c[y]),v[y]<0)this.contourLevels[y].length>0&&(v[y]=0);else if(v[y]<this.contourLevels[y].length-1){var b=this.contourLevels[y][v[y]],x=this.contourLevels[y][v[y]+1];Math.abs(b-c[y])>Math.abs(x-c[y])&&(v[y]+=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],g=0;g<3;++g)r.dataCoordinate[g]=this._field[g].get(r.index[0],r.index[1]);return r},z.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=s(t.contourWidth,Number)),"showContour"in t&&(this.showContour=s(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=s(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=c(t.contourColor)),"contourProject"in t&&(this.contourProject=s(t.contourProject,function(t){return s(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=c(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=s(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=s(t.dynamicWidth,Number)),"opacity"in t&&(this.opacity=t.opacity),"colorBounds"in t&&(this.colorBounds=t.colorBounds),"vertexColor"in t&&(this.vertexColor=t.vertexColor?1:0);var e=t.field||t.coords&&t.coords[2]||null,r=!1;if(e||(e=this._field[2].shape[0]||this._field[2].shape[2]?this._field[2].lo(1,1).hi(this._field[2].shape[0]-2,this._field[2].shape[1]-2):this._field[2].hi(0,0)),"field"in t||"coords"in t){var n=(e.shape[0]+2)*(e.shape[1]+2);n>this._field[2].data.length&&(p.freeFloat(this._field[2].data),this._field[2].data=p.mallocFloat(u.nextPow2(n))),this._field[2]=y(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),o(this._field[2],e),this.shape=e.shape.slice();for(var i=this.shape,a=0;a<2;++a)this._field[2].size>this._field[a].data.length&&(p.freeFloat(this._field[a].data),this._field[a].data=p.mallocFloat(this._field[2].size)),this._field[a]=y(this._field[a].data,[i[0]+2,i[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(a=0;a<2;++a){var h=l[a];for(w=0;w<2;++w)if(h.shape[w]!==i[w])throw new Error("gl-surface: coords have incorrect shape");o(this._field[a],h)}}else if(t.ticks){var f=t.ticks;if(!Array.isArray(f)||2!==f.length)throw new Error("gl-surface: invalid ticks");for(a=0;a<2;++a){var d=f[a];if((Array.isArray(d)||d.length)&&(d=y(d)),d.shape[0]!==i[a])throw new Error("gl-surface: invalid tick length");var x=y(d.data,i);x.stride[a]=d.stride[0],x.stride[1^a]=0,o(this._field[a],x)}}else{for(a=0;a<2;++a){var _=[0,0];_[a]=1,this._field[a]=y(this._field[a].data,[i[0]+2,i[1]+2],_,0)}this._field[0].set(0,0,0);for(var w=0;w<i[0];++w)this._field[0].set(w+1,0,w);for(this._field[0].set(i[0]+1,0,i[0]-1),this._field[1].set(0,0,0),w=0;w<i[1];++w)this._field[1].set(0,w+1,w);this._field[1].set(0,i[1]+1,i[1]-1)}var k=this._field,T=y(p.mallocFloat(3*k[2].size*2),[3,i[0]+2,i[1]+2,2]);for(a=0;a<3;++a)M(T.pick(a),k[a],"mirror");var A=y(p.mallocFloat(3*k[2].size),[i[0]+2,i[1]+2,3]);for(a=0;a<i[0]+2;++a)for(w=0;w<i[1]+2;++w){var S=T.get(0,a,w,0),E=T.get(0,a,w,1),L=T.get(1,a,w,0),C=T.get(1,a,w,1),P=T.get(2,a,w,0),z=T.get(2,a,w,1),O=L*z-C*P,F=P*E-z*S,R=S*C-E*L,j=Math.sqrt(O*O+F*F+R*R);j<1e-8?(j=Math.max(Math.abs(O),Math.abs(F),Math.abs(R)))<1e-8?(R=1,F=O=0,j=1):j=1/j:j=1/Math.sqrt(j),A.set(a,w,0,O*j),A.set(a,w,1,F*j),A.set(a,w,2,R*j)}p.free(T.data);var N=[1/0,1/0,1/0],B=[-1/0,-1/0,-1/0],U=1/0,V=-1/0,H=(i[0]-1)*(i[1]-1)*6,q=p.mallocFloat(u.nextPow2(10*H)),G=0,Y=0;for(a=0;a<i[0]-1;++a)t:for(w=0;w<i[1]-1;++w){for(var W=0;W<2;++W)for(var X=0;X<2;++X)for(var Z=0;Z<3;++Z){var J=this._field[Z].get(1+a+W,1+w+X);if(isNaN(J)||!isFinite(J))continue t}for(Z=0;Z<6;++Z){var K=a+I[Z][0],Q=w+I[Z][1],$=this._field[0].get(K+1,Q+1),tt=this._field[1].get(K+1,Q+1),et=J=this._field[2].get(K+1,Q+1);O=A.get(K+1,Q+1,0),F=A.get(K+1,Q+1,1),R=A.get(K+1,Q+1,2),t.intensity&&(et=t.intensity.get(K,Q)),q[G++]=K,q[G++]=Q,q[G++]=$,q[G++]=tt,q[G++]=J,q[G++]=0,q[G++]=et,q[G++]=O,q[G++]=F,q[G++]=R,N[0]=Math.min(N[0],$),N[1]=Math.min(N[1],tt),N[2]=Math.min(N[2],J),U=Math.min(U,et),B[0]=Math.max(B[0],$),B[1]=Math.max(B[1],tt),B[2]=Math.max(B[2],J),V=Math.max(V,et),Y+=1}}for(t.intensityBounds&&(U=+t.intensityBounds[0],V=+t.intensityBounds[1]),a=6;a<G;a+=10)q[a]=(q[a]-U)/(V-U);this._vertexCount=Y,this._coordinateBuffer.update(q.subarray(0,G)),p.freeFloat(q),p.free(A.data),this.bounds=[N,B],this.intensity=t.intensity||this._field[2],this.intensityBounds[0]===U&&this.intensityBounds[1]===V||(r=!0),this.intensityBounds=[U,V]}if("levels"in t){var rt=t.levels;for(rt=Array.isArray(rt[0])?rt.slice():[[],[],rt],a=0;a<3;++a)rt[a]=rt[a].slice(),rt.sort(function(t,e){return t-e});t:for(a=0;a<3;++a){if(rt[a].length!==this.contourLevels[a].length){r=!0;break}for(w=0;w<rt[a].length;++w)if(rt[a][w]!==this.contourLevels[a][w]){r=!0;break t}}this.contourLevels=rt}if(r){k=this._field,i=this.shape;for(var nt=[],it=0;it<3;++it){rt=this.contourLevels[it];var at=[],ot=[],st=[0,0,0];for(a=0;a<rt.length;++a){var lt=b(this._field[it],rt[a]);at.push(nt.length/5|0),Y=0;t:for(w=0;w<lt.cells.length;++w){var ct=lt.cells[w];for(Z=0;Z<2;++Z){var ut=lt.positions[ct[Z]],ht=ut[0],ft=0|Math.floor(ht),dt=ht-ft,pt=ut[1],mt=0|Math.floor(pt),gt=pt-mt,vt=!1;e:for(var yt=0;yt<3;++yt){st[yt]=0;var bt=(it+yt+1)%3;for(W=0;W<2;++W){var xt=W?dt:1-dt;for(K=0|Math.min(Math.max(ft+W,0),i[0]),X=0;X<2;++X){var _t=X?gt:1-gt;if(Q=0|Math.min(Math.max(mt+X,0),i[1]),J=yt<2?this._field[bt].get(K,Q):(this.intensity.get(K,Q)-this.intensityBounds[0])/(this.intensityBounds[1]-this.intensityBounds[0]),!isFinite(J)||isNaN(J)){vt=!0;break e}var wt=xt*_t;st[yt]+=wt*J}}}if(vt){if(Z>0){for(var Mt=0;Mt<5;++Mt)nt.pop();Y-=1}continue t}nt.push(st[0],st[1],ut[0],ut[1],st[2]),Y+=1}}ot.push(Y)}this._contourOffsets[it]=at,this._contourCounts[it]=ot}var kt=p.mallocFloat(nt.length);for(a=0;a<nt.length;++a)kt[a]=nt[a];this._contourBuffer.update(kt),p.freeFloat(kt)}t.colormap&&this._colorMap.setPixels(function(t){var e=v([m({colormap:t,nshades:D,format:"rgba"}).map(function(t){return[t[0],t[1],t[2],255*t[3]]})]);return g.divseq(e,255),e}(t.colormap))},z.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)p.freeFloat(this._field[t].data)},z.highlight=function(t){if(!t)return this._dynamicCounts=[0,0,0],this.dyanamicLevel=[NaN,NaN,NaN],void(this.highlightLevel=[-1,-1,-1]);for(var e=0;e<3;++e)this.enableHighlight[e]?this.highlightLevel[e]=t.level[e]:this.highlightLevel[e]=-1;var r;if(r=this.snapToData?t.dataCoordinate:t.position,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=p.mallocFloat(12*i[0]*i[1]),o=0;o<3;++o)if(this.enableDynamic[o]){this.dynamicLevel[o]=r[o];var s=(o+1)%3,l=(o+2)%3,c=this._field[o],u=this._field[s],h=this._field[l],f=(this.intensity,b(c,r[o])),d=f.cells,m=f.positions;for(this._dynamicOffsets[o]=n,e=0;e<d.length;++e)for(var g=d[e],v=0;v<2;++v){var y=m[g[v]],x=+y[0],_=0|x,w=0|Math.min(_+1,i[0]),M=x-_,k=1-M,T=+y[1],A=0|T,S=0|Math.min(A+1,i[1]),E=T-A,L=1-E,C=k*L,I=k*E,P=M*L,D=M*E,z=C*u.get(_,A)+I*u.get(_,S)+P*u.get(w,A)+D*u.get(w,S),O=C*h.get(_,A)+I*h.get(_,S)+P*h.get(w,A)+D*h.get(w,S);if(isNaN(z)||isNaN(O)){v&&(n-=1);break}a[2*n+0]=z,a[2*n+1]=O,n+=1}this._dynamicCounts[o]=n-this._dynamicOffsets[o]}else this.dynamicLevel[o]=NaN,this._dynamicCounts[o]=0;this._dynamicBuffer.update(a.subarray(0,2*n)),p.freeFloat(a)}}},{"./lib/shaders":266,"binary-search-bounds":67,"bit-twiddle":68,colormap:100,"gl-buffer":157,"gl-mat4/invert":182,"gl-mat4/multiply":184,"gl-texture2d":268,"gl-vao":272,ndarray:468,"ndarray-gradient":459,"ndarray-ops":462,"ndarray-pack":463,"surface-nets":540,"typedarray-pool":550}],268:[function(t,e,r){"use strict";function n(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}function i(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 a(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}function o(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 s(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 l(t,e,r,n,i){var o=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>o||r<0||r>o)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 l=s(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new a(t,l,e,r,n,i)}var c=t("ndarray"),u=t("ndarray-ops"),h=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(f||function(t){f=[t.LINEAR,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_NEAREST],d=[t.NEAREST,t.LINEAR,t.NEAREST_MIPMAP_NEAREST,t.NEAREST_MIPMAP_LINEAR,t.LINEAR_MIPMAP_NEAREST,t.LINEAR_MIPMAP_LINEAR],p=[t.REPEAT,t.CLAMP_TO_EDGE,t.MIRRORED_REPEAT]}(t),"number"==typeof arguments[1])return l(t,arguments[1],arguments[2],arguments[3]||t.RGBA,arguments[4]||t.UNSIGNED_BYTE);if(Array.isArray(arguments[1]))return l(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=n(e)?e:e.raw;if(r)return function(t,e,r,n,i,o){var l=s(t);return t.texImage2D(t.TEXTURE_2D,0,i,i,o,e),new a(t,l,r,n,i,o)}(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 function(t,e){var r=e.dtype,n=e.shape.slice(),i=t.getParameter(t.MAX_TEXTURE_SIZE);if(n[0]<0||n[0]>i||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var l=o(n,e.stride.slice()),f=0;"float32"===r?f=t.FLOAT:"float64"===r?(f=t.FLOAT,l=!1,r="float32"):"uint8"===r?f=t.UNSIGNED_BYTE:(f=t.UNSIGNED_BYTE,l=!1,r="uint8");var d=0;if(2===n.length)d=t.LUMINANCE,n=[n[0],n[1],1],e=c(e.data,n,[e.stride[0],e.stride[1],1],e.offset);else{if(3!==n.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===n[2])d=t.ALPHA;else if(2===n[2])d=t.LUMINANCE_ALPHA;else if(3===n[2])d=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");d=t.RGBA}}f!==t.FLOAT||t.getExtension("OES_texture_float")||(f=t.UNSIGNED_BYTE,l=!1);var p,g,v=e.size;if(l)p=0===e.offset&&e.data.length===v?e.data:e.data.subarray(e.offset,e.offset+v);else{var y=[n[2],n[2]*n[0],1];g=h.malloc(v,r);var b=c(g,n,y,0);"float32"!==r&&"float64"!==r||f!==t.UNSIGNED_BYTE?u.assign(b,e):m(b,e),p=g.subarray(0,v)}var x=s(t);return t.texImage2D(t.TEXTURE_2D,0,d,n[0],n[1],0,d,f,p),l||h.free(g),new a(t,x,n[0],n[1],d,f)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var f=null,d=null,p=null,m=function(t,e){u.muls(t,e,255)},g=a.prototype;Object.defineProperties(g,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&f.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),d.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&&f.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),d.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(),p.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(),p.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(p.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 i(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return t|=0,i(this,t,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,i(this,this._shape[0],t),t}}}),g.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},g.dispose=function(){this.gl.deleteTexture(this.handle)},g.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)},g.setPixels=function(t,e,r,i){var a=this.gl;this.bind(),Array.isArray(e)?(i=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),i=i||0;var s=n(t)?t:t.raw;if(s){this._mipLevels.indexOf(i)<0?(a.texImage2D(a.TEXTURE_2D,0,this.format,this.format,this.type,s),this._mipLevels.push(i)):a.texSubImage2D(a.TEXTURE_2D,i,e,r,this.format,this.type,s)}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]>>>i||r+t.shape[0]>this._shape[0]>>>i||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,n,i,a,s,l){var f=l.dtype,d=l.shape.slice();if(d.length<2||d.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var p=0,g=0,v=o(d,l.stride.slice());if("float32"===f?p=t.FLOAT:"float64"===f?(p=t.FLOAT,v=!1,f="float32"):"uint8"===f?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,v=!1,f="uint8"),2===d.length)g=t.LUMINANCE,d=[d[0],d[1],1],l=c(l.data,d,[l.stride[0],l.stride[1],1],l.offset);else{if(3!==d.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===d[2])g=t.ALPHA;else if(2===d[2])g=t.LUMINANCE_ALPHA;else if(3===d[2])g=t.RGB;else{if(4!==d[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");g=t.RGBA}d[2]}if(g!==t.LUMINANCE&&g!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(g=i),g!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var y=l.size,b=s.indexOf(n)<0;if(b&&s.push(n),p===a&&v)0===l.offset&&l.data.length===y?b?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,l.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,l.data):b?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,l.data.subarray(l.offset,l.offset+y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,l.data.subarray(l.offset,l.offset+y));else{var x;x=a===t.FLOAT?h.mallocFloat32(y):h.mallocUint8(y);var _=c(x,d,[d[2],d[2]*d[0],1]);p===t.FLOAT&&a===t.UNSIGNED_BYTE?m(_,l):u.assign(_,l),b?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,x.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,x.subarray(0,y)),a===t.FLOAT?h.freeFloat32(x):h.freeUint8(x)}}(a,e,r,i,this.format,this.type,this._mipLevels,t)}}},{ndarray:468,"ndarray-ops":462,"typedarray-pool":550}],269:[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;i<r.length;++i){var a=r[i];if(a.buffer){var o=a.buffer,s=a.size||4,l=a.type||t.FLOAT,c=!!a.normalized,u=a.stride||0,h=a.offset||0;o.bind(),t.enableVertexAttribArray(i),t.vertexAttribPointer(i,s,l,c,u,h)}else{if("number"==typeof a)t.vertexAttrib1f(i,a);else if(1===a.length)t.vertexAttrib1f(i,a[0]);else if(2===a.length)t.vertexAttrib2f(i,a[0],a[1]);else if(3===a.length)t.vertexAttrib3f(i,a[0],a[1],a[2]);else{if(4!==a.length)throw new Error("gl-vao: Invalid vertex attribute");t.vertexAttrib4f(i,a[0],a[1],a[2],a[3])}t.disableVertexAttribArray(i)}}for(;i<n;++i)t.disableVertexAttribArray(i)}else for(t.bindBuffer(t.ARRAY_BUFFER,null),i=0;i<n;++i)t.disableVertexAttribArray(i)}},{}],270:[function(t,e,r){"use strict";function n(t){this.gl=t,this._elements=null,this._attributes=null,this._elementsType=t.UNSIGNED_SHORT}var i=t("./do-bind.js");n.prototype.bind=function(){i(this.gl,this._elements,this._attributes)},n.prototype.update=function(t,e,r){this._elements=e,this._attributes=t,this._elementsType=r||this.gl.UNSIGNED_SHORT},n.prototype.dispose=function(){},n.prototype.unbind=function(){},n.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._elements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=function(t){return new n(t)}},{"./do-bind.js":269}],271:[function(t,e,r){"use strict";function n(t,e,r,n,i,a){this.location=t,this.dimension=e,this.a=r,this.b=n,this.c=i,this.d=a}function i(t,e,r){this.gl=t,this._ext=e,this.handle=r,this._attribs=[],this._useElements=!1,this._elementsType=t.UNSIGNED_SHORT}var a=t("./do-bind.js");n.prototype.bind=function(t){switch(this.dimension){case 1:t.vertexAttrib1f(this.location,this.a);break;case 2:t.vertexAttrib2f(this.location,this.a,this.b);break;case 3:t.vertexAttrib3f(this.location,this.a,this.b,this.c);break;case 4:t.vertexAttrib4f(this.location,this.a,this.b,this.c,this.d)}},i.prototype.bind=function(){this._ext.bindVertexArrayOES(this.handle);for(var t=0;t<this._attribs.length;++t)this._attribs[t].bind(this.gl)},i.prototype.unbind=function(){this._ext.bindVertexArrayOES(null)},i.prototype.dispose=function(){this._ext.deleteVertexArrayOES(this.handle)},i.prototype.update=function(t,e,r){if(this.bind(),a(this.gl,e,t),this.unbind(),this._attribs.length=0,t)for(var i=0;i<t.length;++i){var o=t[i];"number"==typeof o?this._attribs.push(new n(i,1,o)):Array.isArray(o)&&this._attribs.push(new n(i,o.length,o[0],o[1],o[2],o[3]))}this._useElements=!!e,this._elementsType=r||this.gl.UNSIGNED_SHORT},i.prototype.draw=function(t,e,r){r=r||0;var n=this.gl;this._useElements?n.drawElements(t,e,this._elementsType,r):n.drawArrays(t,r,e)},e.exports=function(t,e){return new i(t,e,e.createVertexArrayOES())}},{"./do-bind.js":269}],272:[function(t,e,r){"use strict";var n=t("./lib/vao-native.js"),i=t("./lib/vao-emulated.js");e.exports=function(t,e,r,a){var o,s=t.createVertexArray?new function(t){this.bindVertexArrayOES=t.bindVertexArray.bind(t),this.createVertexArrayOES=t.createVertexArray.bind(t),this.deleteVertexArrayOES=t.deleteVertexArray.bind(t)}(t):t.getExtension("OES_vertex_array_object");return(o=s?n(t,s):i(t)).update(e,r,a),o}},{"./lib/vao-emulated.js":270,"./lib/vao-native.js":271}],273:[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}},{}],274:[function(t,e,r){e.exports=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}},{}],275:[function(t,e,r){e.exports=function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)}},{}],276:[function(t,e,r){e.exports=function(t,e,r,n){var i=e[0],a=e[1],o=e[2];return t[0]=i+n*(r[0]-i),t[1]=a+n*(r[1]-a),t[2]=o+n*(r[2]-o),t}},{}],277:[function(t,e,r){e.exports=function(t,e){var r=e[0],n=e[1],i=e[2],a=r*r+n*n+i*i;return a>0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}},{}],278:[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}},{}],279:[function(t,e,r){e.exports=function(t,e,r,a){return n[0]=a,n[1]=r,n[2]=e,n[3]=t,i[0]};var n=new Uint8Array(4),i=new Float32Array(n.buffer)},{}],280:[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;r<e.length;r++){var a=e[r];if("preprocessor"===a.type){var o=a.data.match(/\#define\s+SHADER_NAME(_B64)?\s+(.+)$/);if(o&&o[2]){var s=o[1],l=o[2];return(s?i(l):l).trim()}}}}},{"atob-lite":49,"glsl-tokenizer":287}],281:[function(t,e,r){e.exports=function(t){function e(t){t.length&&P.push({type:w[C],data:t,position:O,line:D,column:z})}function r(t){E=0,S=(j+=t).length;for(var r;T=j[E],E<S;){switch(r=E,C){case u:E="/"===T&&"*"===A?(I.push(T),e(I.join("")),C=l,E+1):(I.push(T),A=T,E+1);break;case h:case f:E=M();break;case d:E=function(){if("."===A&&/\d/.test(T))return C=m,E;if("/"===A&&"*"===T)return C=u,E;if("/"===A&&"/"===T)return C=h,E;if("."===T&&I.length){for(;k(I););return C=m,E}if(";"===T||")"===T||"("===T){if(I.length)for(;k(I););return e(T),C=l,E+1}var t=2===I.length&&"="!==T;if(/[\w_\d\s]/.test(T)||t){for(;k(I););return C=l,E}return I.push(T),A=T,E+1}();break;case p:E="."===T?(I.push(T),C=m,A=T,E+1):/[eE]/.test(T)?(I.push(T),C=m,A=T,E+1):"x"===T&&1===I.length&&"0"===I[0]?(C=_,I.push(T),A=T,E+1):/[^\d]/.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case _:E=/[^a-fA-F0-9]/.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case m:"f"===T&&(I.push(T),A=T,E+=1),E=/[eE]/.test(T)?(I.push(T),A=T,E+1):"-"===T&&/[eE]/.test(A)?(I.push(T),A=T,E+1):/[^\d]/.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case c:E=function(){if(/[^\d\w_]/.test(T)){var t=I.join("");return C=B.indexOf(t)>-1?y:N.indexOf(t)>-1?v:g,e(I.join("")),C=l,E}return I.push(T),A=T,E+1}();break;case b:E=/[^\s]/g.test(T)?(e(I.join("")),C=l,E):(I.push(T),A=T,E+1);break;case l:I=I.length?[]:I,E="/"===A&&"*"===T?(O=L+E-1,C=u,A=T,E+1):"/"===A&&"/"===T?(O=L+E-1,C=h,A=T,E+1):"#"===T?(C=f,O=L+E,E):/\s/.test(T)?(C=b,O=L+E,E):(F=/\d/.test(T),R=/[^\w_]/.test(T),O=L+E,C=F?p:R?d:c,E)}if(r!==E)switch(j[r]){case"\n":z=0,++D;break;default:++z}}return L+=E,j=j.slice(E),P}function M(){return"\r"!==T&&"\n"!==T||"\\"===A?(I.push(T),A=T,E+1):(e(I.join("")),C=l,E)}function k(t){for(var r,n,a=0;;){if(r=i.indexOf(t.slice(0,t.length+a).join("")),n=i[r],-1===r){if(a--+t.length>0)continue;n=t.slice(0,1).join("")}return e(n),O+=n.length,(I=I.slice(n.length)).length}}var T,A,S,E=0,L=0,C=l,I=[],P=[],D=1,z=0,O=0,F=!1,R=!1,j="",N=a,B=n;return"300 es"===(t=t||{}).version&&(N=s,B=o),function(t){return P=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):(I.length&&e(I.join("")),C=x,e("(eof)"),P)}};var n=t("./lib/literals"),i=t("./lib/operators"),a=t("./lib/builtins"),o=t("./lib/literals-300es"),s=t("./lib/builtins-300es"),l=999,c=9999,u=0,h=1,f=2,d=3,p=4,m=5,g=6,v=7,y=8,b=9,x=10,_=11,w=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":283,"./lib/builtins-300es":282,"./lib/literals":285,"./lib/literals-300es":284,"./lib/operators":286}],282:[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":283}],283:[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"]},{}],284:[function(t,e,r){var n=t("./literals");e.exports=n.slice().concat(["layout","centroid","smooth","case","mat2x2","mat2x3","mat2x4","mat3x2","mat3x3","mat3x4","mat4x2","mat4x3","mat4x4","uint","uvec2","uvec3","uvec4","samplerCubeShadow","sampler2DArray","sampler2DArrayShadow","isampler2D","isampler3D","isamplerCube","isampler2DArray","usampler2D","usampler3D","usamplerCube","usampler2DArray","coherent","restrict","readonly","writeonly","resource","atomic_uint","noperspective","patch","sample","subroutine","common","partition","active","filter","image1D","image2D","image3D","imageCube","iimage1D","iimage2D","iimage3D","iimageCube","uimage1D","uimage2D","uimage3D","uimageCube","image1DArray","image2DArray","iimage1DArray","iimage2DArray","uimage1DArray","uimage2DArray","image1DShadow","image2DShadow","image1DArrayShadow","image2DArrayShadow","imageBuffer","iimageBuffer","uimageBuffer","sampler1DArray","sampler1DArrayShadow","isampler1D","isampler1DArray","usampler1D","usampler1DArray","isampler2DRect","usampler2DRect","samplerBuffer","isamplerBuffer","usamplerBuffer","sampler2DMS","isampler2DMS","usampler2DMS","sampler2DMSArray","isampler2DMSArray","usampler2DMSArray"])},{"./literals":285}],285:[function(t,e,r){e.exports=["precision","highp","mediump","lowp","attribute","const","uniform","varying","break","continue","do","for","while","if","else","in","out","inout","float","int","void","bool","true","false","discard","return","mat2","mat3","mat4","vec2","vec3","vec4","ivec2","ivec3","ivec4","bvec2","bvec3","bvec4","sampler1D","sampler2D","sampler3D","samplerCube","sampler1DShadow","sampler2DShadow","struct","asm","class","union","enum","typedef","template","this","packed","goto","switch","default","inline","noinline","volatile","public","static","extern","external","interface","long","short","double","half","fixed","unsigned","input","output","hvec2","hvec3","hvec4","dvec2","dvec3","dvec4","fvec2","fvec3","fvec4","sampler2DRect","sampler3DRect","sampler2DRectShadow","sizeof","cast","namespace","using"]},{}],286:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],287:[function(t,e,r){var n=t("./index");e.exports=function(t,e){var r=n(e),i=[];return i=i.concat(r(t)),i=i.concat(r(null))}},{"./index":281}],288:[function(t,e,r){"use strict";function n(t,e,r){var n=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var a=new Int32Array(this.arrayBuffer);t=a[0],e=a[1],r=a[2],this.d=e+2*r;for(var o=0;o<this.d*this.d;o++){var s=a[i+o],l=a[i+o+1];n.push(s===l?null:a.subarray(s,l))}var c=a[i+n.length],u=a[i+n.length+1];this.keys=a.subarray(c,u),this.bboxes=a.subarray(u),this.insert=this._insertReadonly}else{this.d=e+2*r;for(var h=0;h<this.d*this.d;h++)n.push([]);this.keys=[],this.bboxes=[]}this.n=e,this.extent=t,this.padding=r,this.scale=e/t,this.uid=0;var f=r/e*t;this.min=-f,this.max=t+f}e.exports=n;var i=3;n.prototype.insert=function(t,e,r,n,i){this._forEachCell(e,r,n,i,this._insertCell,this.uid++),this.keys.push(t),this.bboxes.push(e),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},n.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},n.prototype._insertCell=function(t,e,r,n,i,a){this.cells[i].push(a)},n.prototype.query=function(t,e,r,n){var i=this.min,a=this.max;if(t<=i&&e<=i&&a<=r&&a<=n)return Array.prototype.slice.call(this.keys);var o=[],s={};return this._forEachCell(t,e,r,n,this._queryCell,o,s),o},n.prototype._queryCell=function(t,e,r,n,i,a,o){var s=this.cells[i];if(null!==s)for(var l=this.keys,c=this.bboxes,u=0;u<s.length;u++){var h=s[u];if(void 0===o[h]){var f=4*h;t<=c[f+2]&&e<=c[f+3]&&r>=c[f+0]&&n>=c[f+1]?(o[h]=!0,a.push(l[h])):o[h]=!1}}},n.prototype._forEachCell=function(t,e,r,n,i,a,o){for(var s=this._convertToCellCoord(t),l=this._convertToCellCoord(e),c=this._convertToCellCoord(r),u=this._convertToCellCoord(n),h=s;h<=c;h++)for(var f=l;f<=u;f++){var d=this.d*f+h;if(i.call(this,t,e,r,n,d,a,o))return}},n.prototype._convertToCellCoord=function(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))},n.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,e=i+this.cells.length+1+1,r=0,n=0;n<this.cells.length;n++)r+=this.cells[n].length;var a=new Int32Array(e+r+this.keys.length+this.bboxes.length);a[0]=this.extent,a[1]=this.n,a[2]=this.padding;for(var o=e,s=0;s<t.length;s++){var l=t[s];a[i+s]=o,a.set(l,o),o+=l.length}return a[i+t.length]=o,a.set(this.keys,o),o+=this.keys.length,a[i+t.length+1]=o,a.set(this.bboxes,o),o+=this.bboxes.length,a.buffer}},{}],289:[function(t,e,r){(function(r){"use strict";var n,i=t("is-browser");n="function"==typeof r.matchMedia?!r.matchMedia("(hover: none)").matches:i,e.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"is-browser":295}],290:[function(t,e,r){r.read=function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<<s)-1,c=l>>1,u=-7,h=r?i-1:0,f=r?-1:1,d=t[e+h];for(h+=f,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+t[e+h],h+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+h],h+=f,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),a-=c}return(d?-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<<c)-1,h=u>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,p=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=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,i),o+=h):(s=e*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<<i|s,c+=i;c>0;t[r+d]=255&o,d+=p,o/=256,c-=8);t[r+d-p]|=128*m}},{}],291:[function(t,e,r){"use strict";function n(t,e,r){this.vertices=t,this.adjacent=e,this.boundary=r,this.lastVisited=-1}function i(t,e,r){this.vertices=t,this.cell=e,this.index=r}function a(t,e){return l(t.vertices,e.vertices)}function o(t,e,r){this.dimension=t,this.vertices=e,this.simplices=r,this.interior=r.filter(function(t){return!t.boundary}),this.tuple=new Array(t+1);for(var n=0;n<=t;++n)this.tuple[n]=this.vertices[n];var i=c[t];i||(i=c[t]=function(t){for(var e=["function orient(){var tuple=this.tuple;return test("],r=0;r<=t;++r)r>0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=s[t+1];return i||(i=s),n(i)}(t)),this.orient=i}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 a=t.slice(0,i+1),l=s.apply(void 0,a);if(0===l)throw new Error("Input not in general position");for(var c=new Array(i+1),u=0;u<=i;++u)c[u]=u;l<0&&(c[0]=1,c[1]=0);var h=new n(c,new Array(i+1),!1),f=h.adjacent,d=new Array(i+2);for(u=0;u<=i;++u){for(var p=c.slice(),m=0;m<=i;++m)m===u&&(p[m]=-1);var g=p[0];p[0]=p[1],p[1]=g;var v=new n(p,new Array(i+1),!0);f[u]=v,d[u]=v}for(d[i+1]=h,u=0;u<=i;++u){p=f[u].vertices;var y=f[u].adjacent;for(m=0;m<=i;++m){var b=p[m];if(b<0)y[m]=h;else for(var x=0;x<=i;++x)f[x].vertices.indexOf(b)<0&&(y[m]=f[x])}}var _=new o(i,a,d),w=!!e;for(u=i+1;u<r;++u)_.insert(t[u],w);return _.boundary()};var s=t("robust-orientation"),l=t("simplicial-complex").compareCells;n.prototype.flip=function(){var t=this.vertices[0];this.vertices[0]=this.vertices[1],this.vertices[1]=t;var e=this.adjacent[0];this.adjacent[0]=this.adjacent[1],this.adjacent[1]=e};var c=[],u=o.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,h=0;h<=r;++h){var f=u[h];i[h]=f<0?e:a[f]}var d=this.orient();if(d>0)return c;c.lastVisited=-n,0===d&&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 h=c[u];if(!(h.lastVisited>=r)){var f=a[u];a[u]=t;var d=this.orient();if(a[u]=f,d<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,o=this.dimension,s=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 d=(e=h.pop()).vertices,p=e.adjacent,m=d.indexOf(r);if(!(m<0))for(var g=0;g<=o;++g)if(g!==m){var v=p[g];if(v.boundary&&!(v.lastVisited>=r)){var y=v.vertices;if(v.lastVisited!==-r){for(var b=0,x=0;x<=o;++x)y[x]<0?(b=x,l[x]=t):l[x]=s[y[x]];if(this.orient()>0){y[b]=r,v.boundary=!1,c.push(v),h.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var _=v.adjacent,w=d.slice(),M=p.slice(),k=new n(w,M,!0);u.push(k);var T=_.indexOf(e);if(!(T<0)){_[T]=k,M[m]=v,w[g]=-1,M[g]=e,p[g]=k,k.flip();for(x=0;x<=o;++x){var A=w[x];if(!(A<0||A===r)){for(var S=new Array(o-1),E=0,L=0;L<=o;++L){var C=w[L];C<0||L===x||(S[E++]=C)}f.push(new i(S,k,x))}}}}}}f.sort(a);for(g=0;g+1<f.length;g+=2){var I=f[g],P=f[g+1],D=I.index,z=P.index;D<0||z<0||(I.cell.adjacent[I.index]=P.cell,P.cell.adjacent[P.index]=I.cell)}},u.insert=function(t,e){var r=this.vertices;r.push(t);var n=this.walk(t,e);if(n){for(var i=this.dimension,a=this.tuple,o=0;o<=i;++o){var s=n.vertices[o];a[o]=s<0?t:r[s]}var l=this.orient(a);l<0||(0!==l||(n=this.handleBoundaryDegeneracy(n,t)))&&this.addPeaks(t,n)}},u.boundary=function(){for(var t=this.dimension,e=[],r=this.simplices,n=r.length,i=0;i<n;++i){var a=r[i];if(a.boundary){for(var o=new Array(t),s=a.vertices,l=0,c=0,u=0;u<=t;++u)s[u]>=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":517,"simplicial-complex":528}],292:[function(t,e,r){"use strict";function n(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}function i(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 a(t,e){var r=p(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 o(t,e){var r=t.intervals([]);r.push(e),a(t,r)}function s(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?v:(r.splice(n,1),a(t,r),y)}function l(t,e,r){for(var n=0;n<t.length&&t[n][0]<=e;++n){var i=r(t[n]);if(i)return i}}function c(t,e,r){for(var n=t.length-1;n>=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function u(t,e){for(var r=0;r<t.length;++r){var n=e(t[r]);if(n)return n}}function h(t,e){return t-e}function f(t,e){var r=t[0]-e[0];return r||t[1]-e[1]}function d(t,e){var r=t[1]-e[1];return r||t[0]-e[0]}function p(t){if(0===t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t[r][0],t[r][1]);e.sort(h);var i=e[e.length>>1],a=[],o=[],s=[];for(r=0;r<t.length;++r){var l=t[r];l[1]<i?a.push(l):i<l[0]?o.push(l):s.push(l)}var c=s,u=s.slice();return c.sort(f),u.sort(d),new n(i,p(a),p(o),c,u)}function m(t){this.root=t}var g=t("binary-search-bounds"),v=0,y=1;e.exports=function(t){return t&&0!==t.length?new m(p(t)):new m(null)};var b=n.prototype;b.intervals=function(t){return t.push.apply(t,this.leftPoints),this.left&&this.left.intervals(t),this.right&&this.right.intervals(t),t},b.insert=function(t){var e=this.count-this.leftPoints.length;if(this.count+=1,t[1]<this.mid)this.left?4*(this.left.count+1)>3*(e+1)?o(this,t):this.left.insert(t):this.left=p([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?o(this,t):this.right.insert(t):this.right=p([t]);else{var r=g.ge(this.leftPoints,t,f),n=g.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},b.remove=function(t){var e=this.count-this.leftPoints;if(t[1]<this.mid){if(!this.left)return v;if(4*(this.right?this.right.count:0)>3*(e-1))return s(this,t);return 2===(o=this.left.remove(t))?(this.left=null,this.count-=1,y):(o===y&&(this.count-=1),o)}if(t[0]>this.mid){if(!this.right)return v;if(4*(this.left?this.left.count:0)>3*(e-1))return s(this,t);return 2===(o=this.right.remove(t))?(this.right=null,this.count-=1,y):(o===y&&(this.count-=1),o)}if(1===this.count)return this.leftPoints[0]===t?2:v;if(1===this.leftPoints.length&&this.leftPoints[0]===t){if(this.left&&this.right){for(var r=this,n=this.left;n.right;)r=n,n=n.right;if(r===this)n.right=this.right;else{var a=this.left,o=this.right;r.count-=n.count,r.right=n.left,n.left=a,n.right=o}i(this,n),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?i(this,this.left):i(this,this.right);return y}for(a=g.ge(this.leftPoints,t,f);a<this.leftPoints.length&&this.leftPoints[a][0]===t[0];++a)if(this.leftPoints[a]===t){this.count-=1,this.leftPoints.splice(a,1);for(o=g.ge(this.rightPoints,t,d);o<this.rightPoints.length&&this.rightPoints[o][1]===t[1];++o)if(this.rightPoints[o]===t)return this.rightPoints.splice(o,1),y}return v},b.queryPoint=function(t,e){if(t<this.mid){if(this.left){if(r=this.left.queryPoint(t,e))return r}return l(this.leftPoints,t,e)}if(t>this.mid){if(this.right){var r;if(r=this.right.queryPoint(t,e))return r}return c(this.rightPoints,t,e)}return u(this.leftPoints,e)},b.queryInterval=function(t,e,r){if(t<this.mid&&this.left){if(n=this.left.queryInterval(t,e,r))return n}if(e>this.mid&&this.right){var n;if(n=this.right.queryInterval(t,e,r))return n}return e<this.mid?l(this.leftPoints,e,r):t>this.mid?c(this.rightPoints,t,r):u(this.leftPoints,r)};var x=m.prototype;x.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},x.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==v}return!1},x.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},x.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(x,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(x,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":67}],293:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r<t.length;++r)e[t[r]]=r;return e}},{}],294:[function(t,e,r){"use strict";e.exports=function(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=r;return e}},{}],295:[function(t,e,r){e.exports=!0},{}],296:[function(t,e,r){function n(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}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)}},{}],297:[function(t,e,r){e.exports=function(t){return t||"undefined"==typeof navigator||(t=navigator.userAgent),t&&t.headers&&"string"==typeof t.headers["user-agent"]&&(t=t.headers["user-agent"]),"string"==typeof t&&(/(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(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))}},{}],298:[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({}))}},{}],299:[function(t,e,r){"use strict";function n(t,e,r,n,a){e=e||function(t){return t[0]},r=r||function(t){return t[1]},a=a||Array,this.nodeSize=n||64,this.points=t,this.ids=new a(t.length),this.coords=new a(2*t.length);for(var o=0;o<t.length;o++)this.ids[o]=o,this.coords[2*o]=e(t[o]),this.coords[2*o+1]=r(t[o]);i(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}var i=t("./sort"),a=t("./range"),o=t("./within");e.exports=function(t,e,r,i,a){return new n(t,e,r,i,a)},n.prototype={range:function(t,e,r,n){return a(this.ids,this.coords,t,e,r,n,this.nodeSize)},within:function(t,e,r){return o(this.ids,this.coords,t,e,r,this.nodeSize)}}},{"./range":300,"./sort":301,"./within":302}],300:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a,o){for(var s,l,c=[0,t.length-1,0],u=[];c.length;){var h=c.pop(),f=c.pop(),d=c.pop();if(f-d<=o)for(var p=d;p<=f;p++)s=e[2*p],l=e[2*p+1],s>=r&&s<=i&&l>=n&&l<=a&&u.push(t[p]);else{var m=Math.floor((d+f)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=a&&u.push(t[m]);var g=(h+1)%2;(0===h?r<=s:n<=l)&&(c.push(d),c.push(m-1),c.push(g)),(0===h?i>=s:a>=l)&&(c.push(m+1),c.push(f),c.push(g))}}return u}},{}],301:[function(t,e,r){"use strict";function n(t,e,r,a,o,s){if(!(o-a<=r)){var l=Math.floor((a+o)/2);i(t,e,l,a,o,s%2),n(t,e,r,a,l-1,s+1),n(t,e,r,l+1,o,s+1)}}function i(t,e,r,n,o,s){for(;o>n;){if(o-n>600){var l=o-n+1,c=r-n+1,u=Math.log(l),h=.5*Math.exp(2*u/3),f=.5*Math.sqrt(u*h*(l-h)/l)*(c-l/2<0?-1:1);i(t,e,r,Math.max(n,Math.floor(r-c*h/l+f)),Math.min(o,Math.floor(r+(l-c)*h/l+f)),s)}var d=e[2*r+s],p=n,m=o;for(a(t,e,n,r),e[2*o+s]>d&&a(t,e,n,o);p<m;){for(a(t,e,p,m),p++,m--;e[2*p+s]<d;)p++;for(;e[2*m+s]>d;)m--}e[2*n+s]===d?a(t,e,n,m):a(t,e,++m,o),m<=r&&(n=m+1),r<=m&&(o=m-1)}}function a(t,e,r,n){o(t,r,n),o(e,2*r,2*n),o(e,2*r+1,2*n+1)}function o(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],302:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}e.exports=function(t,e,r,i,a,o){for(var s=[0,t.length-1,0],l=[],c=a*a;s.length;){var u=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var d=f;d<=h;d++)n(e[2*d],e[2*d+1],r,i)<=c&&l.push(t[d]);else{var p=Math.floor((f+h)/2),m=e[2*p],g=e[2*p+1];n(m,g,r,i)<=c&&l.push(t[p]);var v=(u+1)%2;(0===u?r-a<=m:i-a<=g)&&(s.push(f),s.push(p-1),s.push(v)),(0===u?r+a>=m:i+a>=g)&&(s.push(p+1),s.push(h),s.push(v))}}return l}},{}],303:[function(t,e,r){"use strict";function n(t,e){var r;if(u(t)){var l,c=t.stops&&"object"==typeof t.stops[0][0],h=c||void 0!==t.property,f=c||!h,d=t.type||e||"exponential";if("exponential"===d)l=o;else if("interval"===d)l=a;else if("categorical"===d)l=i;else{if("identity"!==d)throw new Error('Unknown function type "'+d+'"');l=s}if(c){for(var p={},m=[],g=0;g<t.stops.length;g++){var v=t.stops[g];void 0===p[v[0].zoom]&&(p[v[0].zoom]={zoom:v[0].zoom,type:t.type,property:t.property,stops:[]}),p[v[0].zoom].stops.push([v[0].value,v[1]])}for(var y in p)m.push([p[y].zoom,n(p[y])]);(r=function(e,r){return o({stops:m,base:t.base},e)(e,r)}).isFeatureConstant=!1,r.isZoomConstant=!1}else f?((r=function(e){return l(t,e)}).isFeatureConstant=!0,r.isZoomConstant=!1):((r=function(e,r){return l(t,r[t.property])}).isFeatureConstant=!1,r.isZoomConstant=!0)}else(r=function(){return t}).isFeatureConstant=!0,r.isZoomConstant=!0;return r}function i(t,e){for(var r=0;r<t.stops.length;r++)if(e===t.stops[r][0])return t.stops[r][1];return t.stops[0][1]}function a(t,e){for(var r=0;r<t.stops.length&&!(e<t.stops[r][0]);r++);return t.stops[Math.max(r-1,0)][1]}function o(t,e){for(var r=void 0!==t.base?t.base:1,n=0;!(n>=t.stops.length||e<=t.stops[n][0]);)n++;return 0===n?t.stops[n][1]:n===t.stops.length?t.stops[n-1][1]:l(e,r,t.stops[n-1][0],t.stops[n][0],t.stops[n-1][1],t.stops[n][1])}function s(t,e){return e}function l(t,e,r,n,i,a){return"function"==typeof i?function(){var o=i.apply(void 0,arguments),s=a.apply(void 0,arguments);return l(t,e,r,n,o,s)}:i.length?function(t,e,r,n,i,a){for(var o=[],s=0;s<i.length;s++)o[s]=c(t,e,r,n,i[s],a[s]);return o}(t,e,r,n,i,a):c(t,e,r,n,i,a)}function c(t,e,r,n,i,a){var o,s=n-r,l=t-r;return o=1===e?l/s:(Math.pow(e,l)-1)/(Math.pow(e,s)-1),i*(1-o)+a*o}function u(t){return"object"==typeof t&&(t.stops||"identity"===t.type)}e.exports.isFunctionDefinition=u,e.exports.interpolated=function(t){return n(t,"exponential")},e.exports["piecewise-constant"]=function(t){return n(t,"interval")}},{}],304:[function(t,e,r){t("path");e.exports={debug:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 1);\n}\n"},fill:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_FragColor = color * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},circle:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n float t = smoothstep(1.0 - max(blur, v_antialiasblur), 1.0, length(v_extrude));\n gl_FragColor = color * (1.0 - t) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform bool u_scale_with_map;\nuniform vec2 u_extrude_scale;\nuniform float u_devicepixelratio;\n\nattribute vec2 a_pos;\n\n#pragma mapbox: define lowp vec4 color\n#pragma mapbox: define mediump float radius\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_extrude;\nvarying lowp float v_antialiasblur;\n\nvoid main(void) {\n #pragma mapbox: initialize lowp vec4 color\n #pragma mapbox: initialize mediump float radius\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // unencode the extrusion vector that we snuck into the a_pos vector\n v_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0);\n\n vec2 extrude = v_extrude * radius * u_extrude_scale;\n // multiply a_pos by 0.5, since we had it * 2 in order to sneak\n // in extrusion data\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5), 0, 1);\n\n if (u_scale_with_map) {\n gl_Position.xy += extrude;\n } else {\n gl_Position.xy += extrude * gl_Position.w;\n }\n\n // This is a minimum blur distance that serves as a faux-antialiasing for\n // the circle. since blur is a ratio of the circle's size and the intent is\n // to keep the blur at roughly 1px, the two are inversely related.\n v_antialiasblur = 1.0 / u_devicepixelratio / radius;\n}\n"},line:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform float u_blur;\n\nvarying vec2 v_linewidth;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\nuniform mediump float u_blur;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_blur;\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_fade;\nuniform float u_opacity;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float x_a = mod(v_linesofar / u_pattern_size_a.x, 1.0);\n float x_b = mod(v_linesofar / u_pattern_size_b.x, 1.0);\n float y_a = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_linewidth.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a, u_pattern_br_a, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b, u_pattern_br_b, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n alpha *= u_opacity;\n\n gl_FragColor = color * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform mediump float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n v_linesofar = a_linesofar;\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},linesdfpattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\n\nuniform float u_blur;\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_linewidth.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_linewidth.t) or when fading out\n // (v_linewidth.s)\n float blur = u_blur * v_gamma_scale;\n float alpha = clamp(min(dist - (v_linewidth.t - blur), v_linewidth.s - dist) / blur, 0.0, 1.0);\n\n float sdfdist_a = texture2D(u_image, v_tex_a).a;\n float sdfdist_b = texture2D(u_image, v_tex_b).a;\n float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix);\n alpha *= smoothstep(0.5 - u_sdfgamma, 0.5 + u_sdfgamma, sdfdist);\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n// floor(127 / 2) == 63.0\n// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is\n// stored in a byte (-128..127). we scale regular normals up to length 63, but\n// there are also \"special\" normals that have a bigger length (of up to 126 in\n// this case).\n// #define scale 63.0\n#define scale 0.015873016\n\n// We scale the distance before adding it to the buffers so that we can store\n// long distances for long segments. Use this value to unscale the distance.\n#define LINE_DISTANCE_SCALE 2.0\n\nattribute vec2 a_pos;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform mediump float u_linewidth;\nuniform mediump float u_gapwidth;\nuniform mediump float u_antialiasing;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform float u_extra;\nuniform mat2 u_antialiasingmatrix;\nuniform mediump float u_offset;\n\nvarying vec2 v_normal;\nvarying vec2 v_linewidth;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE;\n\n // We store the texture normals in the most insignificant bit\n // transform y so that 0 => -1 and 1 => 1\n // In the texture normal, x is 0 if the normal points straight up/down and 1 if it's a round cap\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = mod(a_pos, 2.0);\n normal.y = sign(normal.y - 0.5);\n v_normal = normal;\n\n float inset = u_gapwidth + (u_gapwidth > 0.0 ? u_antialiasing : 0.0);\n float outset = u_gapwidth + u_linewidth * (u_gapwidth > 0.0 ? 2.0 : 1.0) + u_antialiasing;\n\n // Scale the extrusion vector down to a normal and then up by the line width\n // of this vertex.\n mediump vec2 dist = outset * a_extrude * scale;\n\n // Calculate the offset when drawing a line that is to the side of the actual line.\n // We do this by creating a vector that points towards the extrude, but rotate\n // it when we're drawing round end points (a_direction = -1 or 1) since their\n // extrude vector points in another direction.\n mediump float u = 0.5 * a_direction;\n mediump float t = 1.0 - abs(u);\n mediump vec2 offset = u_offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n // Remove the texture normal bit of the position before scaling it with the\n // model/view matrix.\n gl_Position = u_matrix * vec4(floor(a_pos * 0.5) + (offset + dist) / u_ratio, 0.0, 1.0);\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n // position of y on the screen\n float y = gl_Position.y / gl_Position.w;\n\n // how much features are squished in the y direction by the tilt\n float squish_scale = length(a_extrude) / length(u_antialiasingmatrix * a_extrude);\n\n // how much features are squished in all directions by the perspectiveness\n float perspective_scale = 1.0 / (1.0 - min(y * u_extra, 0.9));\n\n v_linewidth = vec2(outset, inset);\n v_gamma_scale = perspective_scale * squish_scale;\n}\n"},outline:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n gl_FragColor = outline_color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},outlinepattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n // find distance to outline for alpha interpolation\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = smoothstep(1.0, 0.0, dist);\n \n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},pattern:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity;\nuniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a, u_pattern_br_a, imagecoord);\n vec4 color1 = texture2D(u_image, pos);\n\n vec2 imagecoord_b = mod(v_pos_b, 1.0);\n vec2 pos2 = mix(u_pattern_tl_b, u_pattern_br_b, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_pattern_size_a;\nuniform vec2 u_pattern_size_b;\nuniform vec2 u_pixel_coord_upper;\nuniform vec2 u_pixel_coord_lower;\nuniform float u_scale_a;\nuniform float u_scale_b;\nuniform float u_tile_units_to_pixels;\n\nattribute vec2 a_pos;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n vec2 scaled_size_a = u_scale_a * u_pattern_size_a;\n vec2 scaled_size_b = u_scale_b * u_pattern_size_b;\n\n // the correct offset needs to be calculated.\n //\n // The offset depends on how many pixels are between the world origin and\n // the edge of the tile:\n // vec2 offset = mod(pixel_coord, size)\n //\n // At high zoom levels there are a ton of pixels between the world origin\n // and the edge of the tile. The glsl spec only guarantees 16 bits of\n // precision for highp floats. We need more than that.\n //\n // The pixel_coord is passed in as two 16 bit values:\n // pixel_coord_upper = floor(pixel_coord / 2^16)\n // pixel_coord_lower = mod(pixel_coord, 2^16)\n //\n // The offset is calculated in a series of steps that should preserve this precision:\n vec2 offset_a = mod(mod(mod(u_pixel_coord_upper, scaled_size_a) * 256.0, scaled_size_a) * 256.0 + u_pixel_coord_lower, scaled_size_a);\n vec2 offset_b = mod(mod(mod(u_pixel_coord_upper, scaled_size_b) * 256.0, scaled_size_b) * 256.0 + u_pixel_coord_lower, scaled_size_b);\n\n v_pos_a = (u_tile_units_to_pixels * a_pos + offset_a) / scaled_size_a;\n v_pos_b = (u_tile_units_to_pixels * a_pos + offset_b) / scaled_size_b;\n}\n"},raster:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_opacity0;\nuniform float u_opacity1;\nuniform sampler2D u_image0;\nuniform sampler2D u_image1;\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nuniform float u_brightness_low;\nuniform float u_brightness_high;\n\nuniform float u_saturation_factor;\nuniform float u_contrast_factor;\nuniform vec3 u_spin_weights;\n\nvoid main() {\n\n // read and cross-fade colors from the main and parent tiles\n vec4 color0 = texture2D(u_image0, v_pos0);\n vec4 color1 = texture2D(u_image1, v_pos1);\n vec4 color = color0 * u_opacity0 + color1 * u_opacity1;\n vec3 rgb = color.rgb;\n\n // spin\n rgb = vec3(\n dot(rgb, u_spin_weights.xyz),\n dot(rgb, u_spin_weights.zxy),\n dot(rgb, u_spin_weights.yzx));\n\n // saturation\n float average = (color.r + color.g + color.b) / 3.0;\n rgb += (average - rgb) * u_saturation_factor;\n\n // contrast\n rgb = (rgb - 0.5) * u_contrast_factor + 0.5;\n\n // brightness\n vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low);\n vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high);\n\n gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb), color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform mat4 u_matrix;\nuniform vec2 u_tl_parent;\nuniform float u_scale_parent;\nuniform float u_buffer_scale;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos0;\nvarying vec2 v_pos1;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},icon:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp float u_opacity;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n lowp float alpha = texture2D(u_fadetexture, v_fade_tex).a * u_opacity;\n gl_FragColor = texture2D(u_texture, v_tex) * alpha;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n if (u_rotate_with_map) {\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n } else {\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},sdf:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform sampler2D u_texture;\nuniform sampler2D u_fadetexture;\nuniform lowp vec4 u_color;\nuniform lowp float u_opacity;\nuniform lowp float u_buffer;\nuniform lowp float u_gamma;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n lowp float dist = texture2D(u_texture, v_tex).a;\n lowp float fade_alpha = texture2D(u_fadetexture, v_fade_tex).a;\n lowp float gamma = u_gamma * v_gamma_scale;\n lowp float alpha = smoothstep(u_buffer - gamma, u_buffer + gamma, dist) * fade_alpha;\n\n gl_FragColor = u_color * (alpha * u_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nconst float PI = 3.141592653589793;\n\nattribute vec2 a_pos;\nattribute vec2 a_offset;\nattribute vec2 a_texture_pos;\nattribute vec4 a_data;\n\n\n// matrix is for the vertex position.\nuniform mat4 u_matrix;\n\nuniform mediump float u_zoom;\nuniform bool u_rotate_with_map;\nuniform bool u_pitch_with_map;\nuniform mediump float u_pitch;\nuniform mediump float u_bearing;\nuniform mediump float u_aspect_ratio;\nuniform vec2 u_extrude_scale;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying vec2 v_fade_tex;\nvarying float v_gamma_scale;\n\nvoid main() {\n vec2 a_tex = a_texture_pos.xy;\n mediump float a_labelminzoom = a_data[0];\n mediump vec2 a_zoom = a_data.pq;\n mediump float a_minzoom = a_zoom[0];\n mediump float a_maxzoom = a_zoom[1];\n\n // u_zoom is the current zoom level adjusted for the change in font size\n mediump float z = 2.0 - step(a_minzoom, u_zoom) - (1.0 - step(a_maxzoom, u_zoom));\n\n // pitch-alignment: map\n // rotation-alignment: map | viewport\n if (u_pitch_with_map) {\n lowp float angle = u_rotate_with_map ? (a_data[1] / 256.0 * 2.0 * PI) : u_bearing;\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, asin, -1.0 * asin, acos);\n vec2 offset = RotationMatrix * a_offset;\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos + extrude, 0, 1);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: map\n } else if (u_rotate_with_map) {\n // foreshortening factor to apply on pitched maps\n // as a label goes from horizontal <=> vertical in angle\n // it goes from 0% foreshortening to up to around 70% foreshortening\n lowp float pitchfactor = 1.0 - cos(u_pitch * sin(u_pitch * 0.75));\n\n lowp float lineangle = a_data[1] / 256.0 * 2.0 * PI;\n\n // use the lineangle to position points a,b along the line\n // project the points and calculate the label angle in projected space\n // this calculation allows labels to be rendered unskewed on pitched maps\n vec4 a = u_matrix * vec4(a_pos, 0, 1);\n vec4 b = u_matrix * vec4(a_pos + vec2(cos(lineangle),sin(lineangle)), 0, 1);\n lowp float angle = atan((b[1]/b[3] - a[1]/a[3])/u_aspect_ratio, b[0]/b[3] - a[0]/a[3]);\n lowp float asin = sin(angle);\n lowp float acos = cos(angle);\n mat2 RotationMatrix = mat2(acos, -1.0 * asin, asin, acos);\n\n vec2 offset = RotationMatrix * (vec2((1.0-pitchfactor)+(pitchfactor*cos(angle*2.0)), 1.0) * a_offset);\n vec2 extrude = u_extrude_scale * (offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n gl_Position.z += z * gl_Position.w;\n // pitch-alignment: viewport\n // rotation-alignment: viewport\n } else {\n vec2 extrude = u_extrude_scale * (a_offset / 64.0);\n gl_Position = u_matrix * vec4(a_pos, 0, 1) + vec4(extrude, 0, 0);\n }\n\n v_gamma_scale = (gl_Position.w - 0.5);\n\n v_tex = a_tex / u_texsize;\n v_fade_tex = vec2(a_labelminzoom / 255.0, 0.0);\n}\n"},collisionbox:{fragmentSource:"#ifdef GL_ES\nprecision mediump float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nuniform float u_zoom;\nuniform float u_maxzoom;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n\n float alpha = 0.5;\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, 1.0) * alpha;\n\n if (v_placement_zoom > u_zoom) {\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n }\n\n if (u_zoom >= v_max_zoom) {\n gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0) * alpha * 0.25;\n }\n\n if (v_placement_zoom >= u_maxzoom) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 1.0) * alpha * 0.2;\n }\n}\n",vertexSource:"#ifdef GL_ES\nprecision highp float;\n#else\n#define lowp\n#define mediump\n#define highp\n#endif\n\nattribute vec2 a_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_data;\n\nuniform mat4 u_matrix;\nuniform float u_scale;\n\nvarying float v_max_zoom;\nvarying float v_placement_zoom;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos + a_extrude / u_scale, 0.0, 1.0);\n\n v_max_zoom = a_data.x;\n v_placement_zoom = a_data.y;\n}\n"}},e.exports.util="float evaluate_zoom_function_1(const vec4 values, const float t) {\n if (t < 1.0) {\n return mix(values[0], values[1], t);\n } else if (t < 2.0) {\n return mix(values[1], values[2], t - 1.0);\n } else {\n return mix(values[2], values[3], t - 2.0);\n }\n}\nvec4 evaluate_zoom_function_4(const vec4 value0, const vec4 value1, const vec4 value2, const vec4 value3, const float t) {\n if (t < 1.0) {\n return mix(value0, value1, t);\n } else if (t < 2.0) {\n return mix(value1, value2, t - 1.0);\n } else {\n return mix(value2, value3, t - 2.0);\n }\n}\n"},{path:477}],305:[function(t,e,r){"use strict";var n=t("util").format;e.exports=function(t,e){this.message=(t?t+": ":"")+n.apply(n,Array.prototype.slice.call(arguments,2)),null!==e&&void 0!==e&&e.__line__&&(this.line=e.__line__)}},{util:558}],306:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t}},{}],307:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number?"number":t instanceof String?"string":t instanceof Boolean?"boolean":Array.isArray(t)?"array":null===t?"null":typeof t}},{}],308:[function(t,e,r){"use strict";e.exports=function(t){return t instanceof Number||t instanceof String||t instanceof Boolean?t.valueOf():t}},{}],309:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("../util/extend");e.exports=function(e){var r=t("./validate_function"),o=t("./validate_object"),s={"*":function(){return[]},array:t("./validate_array"),boolean:t("./validate_boolean"),number:t("./validate_number"),color:t("./validate_color"),constants:t("./validate_constants"),enum:t("./validate_enum"),filter:t("./validate_filter"),function:t("./validate_function"),layer:t("./validate_layer"),object:t("./validate_object"),source:t("./validate_source"),string:t("./validate_string")},l=e.value,c=e.valueSpec,u=e.key,h=e.styleSpec,f=e.style;if("string"===i(l)&&"@"===l[0]){if(h.$version>7)return[new n(u,l,"constants have been deprecated as of v8")];if(!(l in f.constants))return[new n(u,l,'constant "%s" not found',l)];e=a({},e,{value:f.constants[l]})}return c.function&&"object"===i(l)?r(e):c.type&&s[c.type]?s[c.type](e):o(a({},e,{valueSpec:c.type?h[c.type]:c}))}},{"../error/validation_error":305,"../util/extend":306,"../util/get_type":307,"./validate_array":310,"./validate_boolean":311,"./validate_color":312,"./validate_constants":313,"./validate_enum":314,"./validate_filter":315,"./validate_function":316,"./validate_layer":318,"./validate_number":320,"./validate_object":321,"./validate_source":323,"./validate_string":324}],310:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("./validate"),a=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.valueSpec,o=t.style,s=t.styleSpec,l=t.key,c=t.arrayElementValidator||i;if("array"!==n(e))return[new a(l,e,"array expected, %s found",n(e))];if(r.length&&e.length!==r.length)return[new a(l,e,"array length %d expected, length %d found",r.length,e.length)];if(r["min-length"]&&e.length<r["min-length"])return[new a(l,e,"array length at least %d expected, length %d found",r["min-length"],e.length)];var u={type:r.value};s.$version<7&&(u.function=r.function),"object"===n(r.value)&&(u=r.value);for(var h=[],f=0;f<e.length;f++)h=h.concat(c({array:e,arrayIndex:f,value:e[f],valueSpec:u,style:o,styleSpec:s,key:l+"["+f+"]"}));return h}},{"../error/validation_error":305,"../util/get_type":307,"./validate":309}],311:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,a=n(e);return"boolean"!==a?[new i(r,e,"boolean expected, %s found",a)]:[]}},{"../error/validation_error":305,"../util/get_type":307}],312:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("csscolorparser").parseCSSColor;e.exports=function(t){var e=t.key,r=t.value,o=i(r);return"string"!==o?[new n(e,r,"color expected, %s found",o)]:null===a(r)?[new n(e,r,'color expected, "%s" found',r)]:[]}},{"../error/validation_error":305,"../util/get_type":307,csscolorparser:109}],313:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type");e.exports=function(t){var e=t.key,r=t.value;if(t.styleSpec.$version>7)return r?[new n(e,r,"constants have been deprecated as of v8")]:[];var a=i(r);if("object"!==a)return[new n(e,r,"object expected, %s found",a)];var o=[];for(var s in r)"@"!==s[0]&&o.push(new n(e+"."+s,r[s],'constants must start with "@"'));return o}},{"../error/validation_error":305,"../util/get_type":307}],314:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,o=[];return-1===a.values.indexOf(i(r))&&o.push(new n(e,r,"expected one of [%s], %s found",a.values.join(", "),r)),o}},{"../error/validation_error":305,"../util/unbundle_jsonlint":308}],315:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_enum"),a=t("../util/get_type"),o=t("../util/unbundle_jsonlint");e.exports=function t(e){var r,s=e.value,l=e.key,c=e.styleSpec,u=[];if("array"!==a(s))return[new n(l,s,"array expected, %s found",a(s))];if(s.length<1)return[new n(l,s,"filter array must have at least 1 element")];switch(u=u.concat(i({key:l+"[0]",value:s[0],valueSpec:c.filter_operator,style:e.style,styleSpec:e.styleSpec})),o(s[0])){case"<":case"<=":case">":case">=":s.length>=2&&"$type"==s[1]&&u.push(new n(l,s,'"$type" cannot be use with operator "%s"',s[0]));case"==":case"!=":3!=s.length&&u.push(new n(l,s,'filter array for operator "%s" must have 3 elements',s[0]));case"in":case"!in":s.length>=2&&("string"!==(r=a(s[1]))?u.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&u.push(new n(l+"[1]",s[1],"filter key cannot be a constant")));for(var h=2;h<s.length;h++)r=a(s[h]),"$type"==s[1]?u=u.concat(i({key:l+"["+h+"]",value:s[h],valueSpec:c.geometry_type,style:e.style,styleSpec:e.styleSpec})):"string"===r&&"@"===s[h][0]?u.push(new n(l+"["+h+"]",s[h],"filter value cannot be a constant")):"string"!==r&&"number"!==r&&"boolean"!==r&&u.push(new n(l+"["+h+"]",s[h],"string, number, or boolean expected, %s found",r));break;case"any":case"all":case"none":for(h=1;h<s.length;h++)u=u.concat(t({key:l+"["+h+"]",value:s[h],style:e.style,styleSpec:e.styleSpec}));break;case"has":case"!has":r=a(s[1]),2!==s.length?u.push(new n(l,s,'filter array for "%s" operator must have 2 elements',s[0])):"string"!==r?u.push(new n(l+"[1]",s[1],"string expected, %s found",r)):"@"===s[1][0]&&u.push(new n(l+"[1]",s[1],"filter key cannot be a constant"))}return u}},{"../error/validation_error":305,"../util/get_type":307,"../util/unbundle_jsonlint":308,"./validate_enum":314}],316:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate"),o=t("./validate_object"),s=t("./validate_array"),l=t("./validate_number");e.exports=function(t){function e(t){var e=[],s=t.value,h=t.key;if("array"!==i(s))return[new n(h,s,"array expected, %s found",i(s))];if(2!==s.length)return[new n(h,s,"array length %d expected, length %d found",2,s.length)];var d=i(s[0]);if(c||(c=d),d!==c)return[new n(h,s,"%s stop key type must match previous stop key type %s",d,c)];if("object"===d){if(void 0===s[0].zoom)return[new n(h,s,"object stop key must have zoom")];if(void 0===s[0].value)return[new n(h,s,"object stop key must have value")];e=e.concat(o({key:h+"[0]",value:s[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:l,value:r}}))}else e=e.concat((f?l:r)({key:h+"[0]",value:s[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec}));return e=e.concat(a({key:h+"[1]",value:s[1],valueSpec:u,style:t.style,styleSpec:t.styleSpec})),"number"===i(s[0])&&("piecewise-constant"===u.function&&s[0]%1!=0&&e.push(new n(h+"[0]",s[0],"zoom level for piecewise-constant functions must be an integer")),0!==t.arrayIndex&&s[0]<t.array[t.arrayIndex-1][0]&&e.push(new n(h+"[0]",s[0],"array stops must appear in ascending order"))),e}function r(t){var e=[],r=i(t.value);return"number"!==r&&"string"!==r&&"array"!==r&&e.push(new n(t.key,t.value,"property value must be a number, string or array")),e}var c,u=t.valueSpec,h=void 0!==t.value.property||"object"===c,f=void 0===t.value.property||"object"===c,d=o({key:t.key,value:t.value,valueSpec:t.styleSpec.function,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{stops:function(t){var r=[],a=t.value;return r=r.concat(s({key:t.key,value:a,valueSpec:t.valueSpec,style:t.style,styleSpec:t.styleSpec,arrayElementValidator:e})),"array"===i(a)&&0===a.length&&r.push(new n(t.key,a,"array must have at least one stop")),r}}});return t.styleSpec.$version>=8&&(h&&!t.valueSpec["property-function"]?d.push(new n(t.key,t.value,"property functions not supported")):f&&!t.valueSpec["zoom-function"]&&d.push(new n(t.key,t.value,"zoom functions not supported"))),d}},{"../error/validation_error":305,"../util/get_type":307,"./validate":309,"./validate_array":310,"./validate_number":320,"./validate_object":321}],317:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("./validate_string");e.exports=function(t){var e=t.value,r=t.key,a=i(t);return a.length?a:(-1===e.indexOf("{fontstack}")&&a.push(new n(r,e,'"glyphs" url must include a "{fontstack}" token')),-1===e.indexOf("{range}")&&a.push(new n(r,e,'"glyphs" url must include a "{range}" token')),a)}},{"../error/validation_error":305,"./validate_string":324}],318:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_filter"),s=t("./validate_paint_property"),l=t("./validate_layout_property"),c=t("../util/extend");e.exports=function(t){var e=[],r=t.value,u=t.key,h=t.style,f=t.styleSpec;r.type||r.ref||e.push(new n(u,r,'either "type" or "ref" is required'));var d=i(r.type),p=i(r.ref);if(r.id)for(var m=0;m<t.arrayIndex;m++){var g=h.layers[m];i(g.id)===i(r.id)&&e.push(new n(u,r.id,'duplicate layer id "%s", previously used at line %d',r.id,g.id.__line__))}if("ref"in r){["type","source","source-layer","filter","layout"].forEach(function(t){t in r&&e.push(new n(u,r[t],'"%s" is prohibited for ref layers',t))});var v;h.layers.forEach(function(t){t.id==p&&(v=t)}),v?v.ref?e.push(new n(u,r.ref,"ref cannot reference another ref layer")):d=i(v.type):e.push(new n(u,r.ref,'ref layer "%s" not found',p))}else if("background"!==d)if(r.source){var y=h.sources&&h.sources[r.source];y?"vector"==y.type&&"raster"==d?e.push(new n(u,r.source,'layer "%s" requires a raster source',r.id)):"raster"==y.type&&"raster"!=d?e.push(new n(u,r.source,'layer "%s" requires a vector source',r.id)):"vector"!=y.type||r["source-layer"]||e.push(new n(u,r,'layer "%s" must specify a "source-layer"',r.id)):e.push(new n(u,r.source,'source "%s" not found',r.source))}else e.push(new n(u,r,'missing required property "source"'));return e=e.concat(a({key:u,value:r,valueSpec:f.layer,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{filter:o,layout:function(t){return a({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return l(c({layerType:d},t))}}})},paint:function(t){return a({layer:r,key:t.key,value:t.value,style:t.style,styleSpec:t.styleSpec,objectElementValidators:{"*":function(t){return s(c({layerType:d},t))}}})}}}))}},{"../error/validation_error":305,"../util/extend":306,"../util/unbundle_jsonlint":308,"./validate_filter":315,"./validate_layout_property":319,"./validate_object":321,"./validate_paint_property":322}],319:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["layout_"+t.layerType];if(t.valueSpec||l[s]){var c=[];return"symbol"===t.layerType&&("icon-image"===s&&r&&!r.sprite?c.push(new i(e,o,'use of "icon-image" requires a style "sprite" property')):"text-field"===s&&r&&!r.glyphs&&c.push(new i(e,o,'use of "text-field" requires a style "glyphs" property'))),c.concat(n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}))}return[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":305,"./validate":309}],320:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.value,a=t.valueSpec,o=n(r);return"number"!==o?[new i(e,r,"number expected, %s found",o)]:"minimum"in a&&r<a.minimum?[new i(e,r,"%s is less than the minimum value %s",r,a.minimum)]:"maximum"in a&&r>a.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":305,"../util/get_type":307}],321:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/get_type"),a=t("./validate");e.exports=function(t){var e=t.key,r=t.value,o=t.valueSpec,s=t.objectElementValidators||{},l=t.style,c=t.styleSpec,u=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, %s found",h)];for(var f in r){var d=f.split(".")[0],p=o&&(o[d]||o["*"]),m=s[d]||s["*"];p||m?u=u.concat((m||a)({key:(e?e+".":e)+f,value:r[f],valueSpec:p,style:l,styleSpec:c,object:r,objectKey:f})):""!==e&&1!==e.split(".").length&&u.push(new n(e,r[f],'unknown property "%s"',f))}for(d in o)o[d].required&&void 0===o[d].default&&void 0===r[d]&&u.push(new n(e,r,'missing required property "%s"',d));return u}},{"../error/validation_error":305,"../util/get_type":307,"./validate":309}],322:[function(t,e,r){"use strict";var n=t("./validate"),i=t("../error/validation_error");e.exports=function(t){var e=t.key,r=t.style,a=t.styleSpec,o=t.value,s=t.objectKey,l=a["paint_"+t.layerType],c=s.match(/^(.*)-transition$/);return c&&l[c[1]]&&l[c[1]].transition?n({key:e,value:o,valueSpec:a.transition,style:r,styleSpec:a}):t.valueSpec||l[s]?n({key:t.key,value:o,valueSpec:t.valueSpec||l[s],style:r,styleSpec:a}):[new i(e,o,'unknown property "%s"',s)]}},{"../error/validation_error":305,"./validate":309}],323:[function(t,e,r){"use strict";var n=t("../error/validation_error"),i=t("../util/unbundle_jsonlint"),a=t("./validate_object"),o=t("./validate_enum");e.exports=function(t){var e=t.value,r=t.key,s=t.styleSpec,l=t.style;if(!e.type)return[new n(r,e,'"type" is required')];switch(i(e.type)){case"vector":case"raster":var c=[];if(c=c.concat(a({key:r,value:e,valueSpec:s.source_tile,style:t.style,styleSpec:s})),"url"in e)for(var u in e)["type","url","tileSize"].indexOf(u)<0&&c.push(new n(r+"."+u,e[u],'a source with a "url" property may not include a "%s" property',u));return c;case"geojson":return a({key:r,value:e,valueSpec:s.source_geojson,style:l,styleSpec:s});case"video":return a({key:r,value:e,valueSpec:s.source_video,style:l,styleSpec:s});case"image":return a({key:r,value:e,valueSpec:s.source_image,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","geojson","video","image"]},style:l,styleSpec:s})}}},{"../error/validation_error":305,"../util/unbundle_jsonlint":308,"./validate_enum":314,"./validate_object":321}],324:[function(t,e,r){"use strict";var n=t("../util/get_type"),i=t("../error/validation_error");e.exports=function(t){var e=t.value,r=t.key,a=n(e);return"string"!==a?[new i(r,e,"string expected, %s found",a)]:[]}},{"../error/validation_error":305,"../util/get_type":307}],325:[function(t,e,r){"use strict";function n(t,e){e=e||l;var r=[];return r=r.concat(s({key:"",value:t,valueSpec:e.$root,styleSpec:e,style:t,objectElementValidators:{glyphs:c}})),e.$version>7&&t.constants&&(r=r.concat(o({key:"constants",value:t.constants,style:t,styleSpec:e}))),i(r)}function i(t){return[].concat(t).sort(function(t,e){return t.line-e.line})}function a(t){return function(){return i(t.apply(this,arguments))}}var o=t("./validate/validate_constants"),s=t("./validate/validate"),l=t("../reference/latest.min"),c=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),n.layer=a(t("./validate/validate_layer")),n.filter=a(t("./validate/validate_filter")),n.paintProperty=a(t("./validate/validate_paint_property")),n.layoutProperty=a(t("./validate/validate_layout_property")),e.exports=n},{"../reference/latest.min":326,"./validate/validate":309,"./validate/validate_constants":313,"./validate/validate_filter":315,"./validate/validate_glyphs_url":317,"./validate/validate_layer":318,"./validate/validate_layout_property":319,"./validate/validate_paint_property":322,"./validate/validate_source":323}],326:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":327}],327:[function(t,e,r){e.exports={$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"},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_tile","source_geojson","source_video","source_image"],source_tile:{type:{required:!0,type:"enum",values:["vector","raster"]},url:{type:"string"},tiles:{type:"array",value:"string"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:["geojson"]},data:{type:"*"},maxzoom:{type:"number",default:14},buffer:{type:"number",default:64},tolerance:{type:"number",default:3},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:400},clusterMaxZoom:{type:"number"}},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","raster","background"]},metadata:{type:"*"},ref:{type:"string"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:22},maxzoom:{type:"number",minimum:0,maximum:22},interactive:{type:"boolean",default:!1},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"},"paint.*":{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_symbol","layout_raster","layout_background"],layout_background:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_fill:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_circle:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_line:{"line-cap":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["butt","round","square"],default:"butt"},"line-join":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["bevel","round","miter"],default:"miter"},"line-miter-limit":{type:"number",default:2,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"miter"}]},"line-round-limit":{type:"number",default:1.05,function:"interpolated","zoom-function":!0,"property-function":!0,requires:[{"line-join":"round"}]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_symbol:{"symbol-placement":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["point","line"],default:"point"},"symbol-spacing":{type:"number",default:250,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:[{"symbol-placement":"line"}]},"symbol-avoid-edges":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1},"icon-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image"]},"icon-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image","text-field"]},"icon-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["icon-image"]},"icon-size":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"icon-text-fit":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!1,values:["none","both","width","height"],default:"none",requires:["icon-image","text-field"]},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image","icon-text-fit","text-field"]},"icon-image":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,tokens:!0},"icon-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,"property-function":!0,units:"degrees",requires:["icon-image"]},"icon-padding":{type:"number",default:2,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,units:"pixels",requires:["icon-image"]},"icon-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":"line"}]},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,requires:["icon-image"]},"text-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],requires:["text-field"]},"text-rotation-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"viewport",requires:["text-field"]},"text-field":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:"",tokens:!0},"text-font":{type:"array",value:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"]},"text-size":{type:"number",default:16,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-max-width":{type:"number",default:10,minimum:0,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-line-height":{type:"number",default:1.2,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-letter-spacing":{type:"number",default:0,units:"em",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-justify":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["left","center","right"],default:"center",requires:["text-field"]},"text-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"],default:"center",requires:["text-field"]},"text-max-angle":{type:"number",default:45,units:"degrees",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field",{"symbol-placement":"line"}]},"text-rotate":{type:"number",default:0,period:360,units:"degrees",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",function:"interpolated","zoom-function":!0,"property-function":!0,requires:["text-field"]},"text-keep-upright":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":"line"}]},"text-transform":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["none","uppercase","lowercase"],default:"none",requires:["text-field"]},"text-offset":{type:"array",value:"number",units:"ems",function:"interpolated","zoom-function":!0,"property-function":!0,length:2,default:[0,0],requires:["text-field"]},"text-allow-overlap":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-ignore-placement":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field"]},"text-optional":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!1,requires:["text-field","icon-image"]},visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},layout_raster:{visibility:{type:"enum",function:"piecewise-constant","zoom-function":!0,values:["visible","none"],default:"visible"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:["==","!=",">",">=","<","<=","in","!in","all","any","none","has","!has"]},geometry_type:{type:"enum",values:["Point","LineString","Polygon"]},color_operation:{type:"enum",values:["lighten","saturate","spin","fade","mix"]},function:{stops:{type:"array",required:!0,value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:["exponential","interval","categorical"],default:"exponential"}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},paint:["paint_fill","paint_line","paint_circle","paint_symbol","paint_raster","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-function":!0,"property-function":!0,default:!0},"fill-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"fill-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"}]},"fill-outline-color":{type:"color",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}]},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_line:{"line-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:1,minimum:0,maximum:1,transition:!0},"line-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"line-pattern"}]},"line-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["line-translate"]},"line-width":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-gap-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-offset":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"line-dasharray":{type:"array",value:"number",function:"piecewise-constant","zoom-function":!0,"property-function":!0,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,"property-function":!0,transition:!0}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-blur":{type:"number",default:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["icon-image"]},"icon-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["icon-image","icon-translate"]},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:["text-field"]},"text-halo-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-halo-blur":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,"property-function":!0,values:["map","viewport"],default:"map",requires:["text-field","text-translate"]}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-hue-rotate":{type:"number",default:0,period:360,function:"interpolated","zoom-function":!0,transition:!0,units:"degrees"},"raster-brightness-min":{type:"number",function:"interpolated","zoom-function":!0,default:0,minimum:0,maximum:1,transition:!0},"raster-brightness-max":{type:"number",function:"interpolated","zoom-function":!0,default:1,minimum:0,maximum:1,transition:!0},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"raster-fade-duration":{type:"number",default:300,minimum:0,function:"interpolated","zoom-function":!0,transition:!0,units:"milliseconds"}},paint_background:{"background-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0,requires:[{"!":"background-pattern"}]},"background-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}}}},{}],328:[function(t,e,r){"use strict";function n(t){return!!("undefined"!=typeof window&&"undefined"!=typeof document&&Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray&&Function.prototype&&Function.prototype.bind&&Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions&&"JSON"in window&&"parse"in JSON&&"stringify"in JSON&&"Worker"in window&&"Uint8ClampedArray"in window&&function(t){void 0===i[t]&&(i[t]=function(t){var e=document.createElement("canvas"),r=Object.create(n.webGLContextAttributes);return r.failIfMajorPerformanceCaveat=t,e.probablySupportsContext?e.probablySupportsContext("webgl",r)||e.probablySupportsContext("experimental-webgl",r):e.supportsContext?e.supportsContext("webgl",r)||e.supportsContext("experimental-webgl",r):e.getContext("webgl",r)||e.getContext("experimental-webgl",r)}(t));return i[t]}(t&&t.failIfMajorPerformanceCaveat))}void 0!==e&&e.exports?e.exports=n:window&&(window.mapboxgl=window.mapboxgl||{},window.mapboxgl.supported=n);var i={};n.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0}},{}],329:[function(t,e,r){"use strict";function n(t){var e=t.layoutVertexArrayType;this.layoutVertexArray=new e;var r=t.elementArrayType;r&&(this.elementArray=new r);var n=t.elementArrayType2;n&&(this.elementArray2=new n),this.paintVertexArrays=i.mapObject(t.paintVertexArrayTypes,function(t){return new t})}var i=t("../util/util");e.exports=n,n.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,n.prototype.hasCapacityFor=function(t){return this.layoutVertexArray.length+t<=n.MAX_VERTEX_ARRAY_LENGTH},n.prototype.isEmpty=function(){return 0===this.layoutVertexArray.length},n.prototype.trim=function(){this.layoutVertexArray.trim(),this.elementArray&&this.elementArray.trim(),this.elementArray2&&this.elementArray2.trim();for(var t in this.paintVertexArrays)this.paintVertexArrays[t].trim()},n.prototype.serialize=function(){return{layoutVertexArray:this.layoutVertexArray.serialize(),elementArray:this.elementArray&&this.elementArray.serialize(),elementArray2:this.elementArray2&&this.elementArray2.serialize(),paintVertexArrays:i.mapObject(this.paintVertexArrays,function(t){return t.serialize()})}},n.prototype.getTransferables=function(t){t.push(this.layoutVertexArray.arrayBuffer),this.elementArray&&t.push(this.elementArray.arrayBuffer),this.elementArray2&&t.push(this.elementArray2.arrayBuffer);for(var e in this.paintVertexArrays)t.push(this.paintVertexArrays[e].arrayBuffer)}},{"../util/util":443}],330:[function(t,e,r){"use strict";function n(t){if(this.zoom=t.zoom,this.overscaling=t.overscaling,this.layer=t.layer,this.childLayers=t.childLayers,this.type=this.layer.type,this.features=[],this.id=this.layer.id,this.index=t.index,this.sourceLayer=this.layer.sourceLayer,this.sourceLayerIndex=t.sourceLayerIndex,this.minZoom=this.layer.minzoom,this.maxZoom=this.layer.maxzoom,this.paintAttributes=function(t){var e={};for(var r in t.programInterfaces){for(var n=e[r]={},a=0;a<t.childLayers.length;a++){var o=t.childLayers[a];n[o.id]={attributes:[],uniforms:[],defines:[],vertexPragmas:{define:{},initialize:{}},fragmentPragmas:{define:{},initialize:{}}}}var s=t.programInterfaces[r];if(s.paintAttributes)for(var c="{precision}",h="{type}",f=0;f<s.paintAttributes.length;f++){var d=s.paintAttributes[f];d.multiplier=d.multiplier||1;for(var p=0;p<t.childLayers.length;p++){var m=t.childLayers[p],g=n[m.id],v=d.name;u("a_"===d.name.slice(0,2));var y,b=d.name.slice(2);if(g.fragmentPragmas.initialize[b]="",m.isPaintValueFeatureConstant(d.paintProperty))g.uniforms.push(d),g.fragmentPragmas.define[b]=g.vertexPragmas.define[b]=["uniform",c,h,v].join(" ")+";",g.fragmentPragmas.initialize[b]=g.vertexPragmas.initialize[b]=[c,h,b,"=",v].join(" ")+";\n";else if(m.isPaintValueZoomConstant(d.paintProperty)){g.attributes.push(l.extend({},d,{name:v})),y=["varying",c,h,b].join(" ")+";\n";var x=[g.fragmentPragmas.define[b],"attribute",c,h,v].join(" ")+";\n";g.fragmentPragmas.define[b]=y,g.vertexPragmas.define[b]=y+x,g.vertexPragmas.initialize[b]=[b,"=",v,"/",d.multiplier.toFixed(1)].join(" ")+";\n"}else{for(var _="u_"+v.slice(2)+"_t",w=m.getPaintValueStopZoomLevels(d.paintProperty),M=0;M<w.length&&w[M]<t.zoom;)M++;for(var k=Math.max(0,Math.min(w.length-4,M-2)),T=[],A=0;A<4;A++)T.push(w[Math.min(k+A,w.length-1)]);y=["varying",c,h,b].join(" ")+";\n",g.vertexPragmas.define[b]=y+["uniform","lowp","float",_].join(" ")+";\n",g.fragmentPragmas.define[b]=y,g.uniforms.push(l.extend({},d,{name:_,getValue:function(t,e){return function(r,n){var i=r.getPaintInterpolationT(t.paintProperty,n.zoom);return[Math.max(0,Math.min(4,i-e))]}}(d,k),components:1}));var S=d.components;if(1===S)g.attributes.push(l.extend({},d,{getValue:i(d,T),isFunction:!0,components:4*S})),g.vertexPragmas.define[b]+=["attribute",c,"vec4",v].join(" ")+";\n",g.vertexPragmas.initialize[b]=[b,"=","evaluate_zoom_function_1("+v+", "+_+")","/",d.multiplier.toFixed(1)].join(" ")+";\n";else{for(var E=[],L=0;L<4;L++)E.push(v+L),g.attributes.push(l.extend({},d,{getValue:i(d,[T[L]]),isFunction:!0,name:v+L})),g.vertexPragmas.define[b]+=["attribute",c,h,v+L].join(" ")+";\n";g.vertexPragmas.initialize[b]=[b," = ","evaluate_zoom_function_4("+E.join(", ")+", "+_+")","/",d.multiplier.toFixed(1)].join(" ")+";\n"}}}}}return e}(this),t.arrays){var e=this.programInterfaces;this.bufferGroups=l.mapObject(t.arrays,function(r,n){var i=e[n],a=t.paintVertexArrayTypes[n];return r.map(function(t){return new s(t,{layoutVertexArrayType:i.layoutVertexArrayType.serialize(),elementArrayType:i.elementArrayType&&i.elementArrayType.serialize(),elementArrayType2:i.elementArrayType2&&i.elementArrayType2.serialize(),paintVertexArrayTypes:a})})})}}function i(t,e){return function(r,n,i){if(1===e.length)return t.getValue(r,l.extend({},n,{zoom:e[0]}),i);for(var a=[],o=0;o<e.length;o++){var s=e[o];a.push(t.getValue(r,l.extend({},n,{zoom:s}),i)[0])}return a}}var a=t("feature-filter"),o=t("./array_group"),s=t("./buffer_group"),l=t("../util/util"),c=t("../util/struct_array"),u=t("assert");e.exports=n,n.create=function(e){return new({fill:t("./bucket/fill_bucket"),line:t("./bucket/line_bucket"),circle:t("./bucket/circle_bucket"),symbol:t("./bucket/symbol_bucket")}[e.layer.type])(e)},n.EXTENT=8192,n.prototype.populateArrays=function(){this.createArrays(),this.recalculateStyleLayers();for(var t=0;t<this.features.length;t++)this.addFeature(this.features[t]);this.trimArrays()},n.prototype.prepareArrayGroup=function(t,e){var r=this.arrayGroups[t],n=r.length&&r[r.length-1];return n&&n.hasCapacityFor(e)||((n=new o({layoutVertexArrayType:this.programInterfaces[t].layoutVertexArrayType,elementArrayType:this.programInterfaces[t].elementArrayType,elementArrayType2:this.programInterfaces[t].elementArrayType2,paintVertexArrayTypes:this.paintVertexArrayTypes[t]})).index=r.length,r.push(n)),n},n.prototype.createArrays=function(){this.arrayGroups={},this.paintVertexArrayTypes={};for(var t in this.programInterfaces){this.arrayGroups[t]=[];var e=this.paintVertexArrayTypes[t]={},r=this.paintAttributes[t];for(var i in r)e[i]=new n.VertexArrayType(r[i].attributes)}},n.prototype.destroy=function(t){for(var e in this.bufferGroups)for(var r=this.bufferGroups[e],n=0;n<r.length;n++)r[n].destroy(t)},n.prototype.trimArrays=function(){for(var t in this.arrayGroups)for(var e=this.arrayGroups[t],r=0;r<e.length;r++)e[r].trim()},n.prototype.isEmpty=function(){for(var t in this.arrayGroups)for(var e=this.arrayGroups[t],r=0;r<e.length;r++)if(!e[r].isEmpty())return!1;return!0},n.prototype.getTransferables=function(t){for(var e in this.arrayGroups)for(var r=this.arrayGroups[e],n=0;n<r.length;n++)r[n].getTransferables(t)},n.prototype.setUniforms=function(t,e,r,n,i){for(var a=this.paintAttributes[e][n.id].uniforms,o=0;o<a.length;o++){var s=a[o],l=r[s.name];t["uniform"+s.components+"fv"](l,s.getValue(n,i))}},n.prototype.serialize=function(){return{layerId:this.layer.id,zoom:this.zoom,arrays:l.mapObject(this.arrayGroups,function(t){return t.map(function(t){return t.serialize()})}),paintVertexArrayTypes:l.mapObject(this.paintVertexArrayTypes,function(t){return l.mapObject(t,function(t){return t.serialize()})}),childLayerIds:this.childLayers.map(function(t){return t.id})}},n.prototype.createFilter=function(){this.filter||(this.filter=a(this.layer.filter))};var h={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};n.prototype.recalculateStyleLayers=function(){for(var t=0;t<this.childLayers.length;t++)this.childLayers[t].recalculate(this.zoom,h)},n.prototype.populatePaintArrays=function(t,e,r,n,i){for(var a=0;a<this.childLayers.length;a++)for(var o=this.childLayers[a],s=this.arrayGroups[t],l=n.index;l<s.length;l++){var c=s[l],u=c.layoutVertexArray.length,h=c.paintVertexArrays[o.id];h.resize(u);for(var f=this.paintAttributes[t][o.id].attributes,d=0;d<f.length;d++)for(var p=f[d],m=p.getValue(o,e,r),g=p.multiplier||1,v=p.components||1,y=l===n.index?i:0;y<u;y++)for(var b=h.get(y),x=0;x<v;x++){b[v>1?p.name+x:p.name]=m[x]*g}}},n.VertexArrayType=function(t){return new c({members:t,alignment:4})},n.ElementArrayType=function(t){return new c({members:[{type:"Uint16",name:"vertices",components:t||3}]})}},{"../util/struct_array":441,"../util/util":443,"./array_group":329,"./bucket/circle_bucket":331,"./bucket/fill_bucket":332,"./bucket/line_bucket":333,"./bucket/symbol_bucket":334,"./buffer_group":336,assert:48,"feature-filter":133}],331:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT;e.exports=n,(n.prototype=a.inherit(i,{})).addCircleVertex=function(t,e,r,n,i){return t.emplaceBack(2*e+(n+1)/2,2*r+(i+1)/2)},n.prototype.programInterfaces={circle:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType,paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("circle-color",e,r)},multiplier:255,paintProperty:"circle-color"},{name:"a_radius",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-radius",e,r)]},multiplier:10,paintProperty:"circle-radius"},{name:"a_blur",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-blur",e,r)]},multiplier:10,paintProperty:"circle-blur"},{name:"a_opacity",components:1,type:"Uint16",isLayerConstant:!1,getValue:function(t,e,r){return[t.getPaintValue("circle-opacity",e,r)]},multiplier:255,paintProperty:"circle-opacity"}]}},n.prototype.addFeature=function(t){for(var e={zoom:this.zoom},r=o(t),n=this.prepareArrayGroup("circle",0),i=n.layoutVertexArray.length,a=0;a<r.length;a++)for(var l=0;l<r[a].length;l++){var c=r[a][l].x,u=r[a][l].y;if(!(c<0||c>=s||u<0||u>=s)){var h=this.prepareArrayGroup("circle",4),f=h.layoutVertexArray,d=this.addCircleVertex(f,c,u,-1,-1);this.addCircleVertex(f,c,u,1,-1),this.addCircleVertex(f,c,u,1,1),this.addCircleVertex(f,c,u,-1,1),h.elementArray.emplaceBack(d,d+1,d+2),h.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":443,"../bucket":330,"../load_geometry":338}],332:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=t("earcut"),l=t("../../util/classify_rings");e.exports=n,(n.prototype=a.inherit(i,{})).programInterfaces={fill:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"}]),elementArrayType:new i.ElementArrayType(1),elementArrayType2:new i.ElementArrayType(2),paintAttributes:[{name:"a_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-color",e,r)},multiplier:255,paintProperty:"fill-color"},{name:"a_outline_color",components:4,type:"Uint8",getValue:function(t,e,r){return t.getPaintValue("fill-outline-color",e,r)},multiplier:255,paintProperty:"fill-outline-color"},{name:"a_opacity",components:1,type:"Uint8",getValue:function(t,e,r){return[t.getPaintValue("fill-opacity",e,r)]},multiplier:255,paintProperty:"fill-opacity"}]}},n.prototype.addFeature=function(t){for(var e=o(t),r=l(e,500),n=this.prepareArrayGroup("fill",0),i=n.layoutVertexArray.length,a=0;a<r.length;a++)this.addPolygon(r[a]);this.populatePaintArrays("fill",{zoom:this.zoom},t.properties,n,i)},n.prototype.addPolygon=function(t){for(var e=0,r=0;r<t.length;r++)e+=t[r].length;for(var n=this.prepareArrayGroup("fill",e),i=[],a=[],o=n.layoutVertexArray.length,l=0;l<t.length;l++){var c=t[l];l>0&&a.push(i.length/2);for(var u=0;u<c.length;u++){var h=c[u],f=n.layoutVertexArray.emplaceBack(h.x,h.y);u>=1&&n.elementArray2.emplaceBack(f-1,f),i.push(h.x),i.push(h.y)}}for(var d=s(i,a),p=0;p<d.length;p++)n.elementArray.emplaceBack(d[p]+o)}},{"../../util/classify_rings":431,"../../util/util":443,"../bucket":330,"../load_geometry":338,earcut:127}],333:[function(t,e,r){"use strict";function n(){i.apply(this,arguments)}var i=t("../bucket"),a=t("../../util/util"),o=t("../load_geometry"),s=i.EXTENT,l=Math.cos(Math.PI/180*37.5),c=Math.pow(2,14)/.5;e.exports=n,(n.prototype=a.inherit(i,{})).addLineVertex=function(t,e,r,n,i,a,o){return t.emplaceBack(e.x<<1|n,e.y<<1|i,Math.round(63*r.x)+128,Math.round(63*r.y)+128,1+(0===a?0:a<0?-1:1)|(.5*o&63)<<2,.5*o>>6)},n.prototype.programInterfaces={line:{layoutVertexArrayType:new i.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}]),elementArrayType:new i.ElementArrayType}},n.prototype.addFeature=function(t){for(var e=o(t,15),r=0;r<e.length;r++)this.addLine(e[r],this.layer.layout["line-join"],this.layer.layout["line-cap"],this.layer.layout["line-miter-limit"],this.layer.layout["line-round-limit"])},n.prototype.addLine=function(t,e,r,n,i){for(var a=t.length;a>2&&t[a-1].equals(t[a-2]);)a--;if(!(t.length<2)){"bevel"===e&&(n=1.05);var o=s/(512*this.overscaling)*15,c=t[0],u=t[a-1],h=c.equals(u);if(this.prepareArrayGroup("line",10*a),2!==a||!h){this.distance=0;var f,d,p,m,g,v,y,b=r,x=h?"butt":r,_=!0;this.e1=this.e2=this.e3=-1,h&&(f=t[a-2],g=c.sub(f)._unit()._perp());for(var w=0;w<a;w++)if(!(p=h&&w===a-1?t[1]:t[w+1])||!t[w].equals(p)){g&&(m=g),f&&(d=f),f=t[w],g=p?p.sub(f)._unit()._perp():m;var M=(m=m||g).add(g)._unit(),k=M.x*g.x+M.y*g.y,T=1/k,A=k<l&&d&&p;if(A&&w>0){var S=f.dist(d);if(S>2*o){var E=f.sub(f.sub(d)._mult(o/S)._round());this.distance+=E.dist(d),this.addCurrentVertex(E,this.distance,m.mult(1),0,0,!1),d=E}}var L=d&&p,C=L?e:p?b:x;if(L&&"round"===C&&(T<i?C="miter":T<=2&&(C="fakeround")),"miter"===C&&T>n&&(C="bevel"),"bevel"===C&&(T>2&&(C="flipbevel"),T<n&&(C="miter")),d&&(this.distance+=f.dist(d)),"miter"===C)M._mult(T),this.addCurrentVertex(f,this.distance,M,0,0,!1);else if("flipbevel"===C){if(T>100)M=g.clone();else{var I=m.x*g.y-m.y*g.x>0?-1:1,P=T*m.add(g).mag()/m.sub(g).mag();M._perp()._mult(P*I)}this.addCurrentVertex(f,this.distance,M,0,0,!1),this.addCurrentVertex(f,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var D=m.x*g.y-m.y*g.x>0,z=-Math.sqrt(T*T-1);if(D?(y=0,v=z):(v=0,y=z),_||this.addCurrentVertex(f,this.distance,m,v,y,!1),"fakeround"===C){for(var O,F=Math.floor(8*(.5-(k-.5))),R=0;R<F;R++)O=g.mult((R+1)/(F+1))._add(m)._unit(),this.addPieSliceVertex(f,this.distance,O,D);this.addPieSliceVertex(f,this.distance,M,D);for(var j=F-1;j>=0;j--)O=m.mult((j+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(f,this.distance,O,D)}p&&this.addCurrentVertex(f,this.distance,g,-v,-y,!1)}else"butt"===C?(_||this.addCurrentVertex(f,this.distance,m,0,0,!1),p&&this.addCurrentVertex(f,this.distance,g,0,0,!1)):"square"===C?(_||(this.addCurrentVertex(f,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(f,this.distance,g,-1,-1,!1)):"round"===C&&(_||(this.addCurrentVertex(f,this.distance,m,0,0,!1),this.addCurrentVertex(f,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(f,this.distance,g,-1,-1,!0),this.addCurrentVertex(f,this.distance,g,0,0,!1)));if(A&&w<a-1){var N=f.dist(p);if(N>2*o){var B=f.add(p.sub(f)._mult(o/N)._round());this.distance+=B.dist(f),this.addCurrentVertex(B,this.distance,g.mult(1),0,0,!1),f=B}}_=!1}}}},n.prototype.addCurrentVertex=function(t,e,r,n,i,a){var o,s=a?1:0,l=this.arrayGroups.line[this.arrayGroups.line.length-1],u=l.layoutVertexArray,h=l.elementArray;o=r.clone(),n&&o._sub(r.perp()._mult(n)),this.e3=this.addLineVertex(u,t,o,s,0,n,e),this.e1>=0&&this.e2>=0&&h.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,o=r.mult(-1),i&&o._sub(r.perp()._mult(i)),this.e3=this.addLineVertex(u,t,o,s,1,-i,e),this.e1>=0&&this.e2>=0&&h.emplaceBack(this.e1,this.e2,this.e3),this.e1=this.e2,this.e2=this.e3,e>c/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,n,i,a))},n.prototype.addPieSliceVertex=function(t,e,r,n){var i=n?1:0;r=r.mult(n?-1:1);var a=this.arrayGroups.line[this.arrayGroups.line.length-1],o=a.layoutVertexArray,s=a.elementArray;this.e3=this.addLineVertex(o,t,r,0,i,0,e),this.e1>=0&&this.e2>=0&&s.emplaceBack(this.e1,this.e2,this.e3),n?this.e2=this.e3:this.e1=this.e3}},{"../../util/util":443,"../bucket":330,"../load_geometry":338}],334:[function(t,e,r){"use strict";function n(t){o.apply(this,arguments),this.showCollisionBoxes=t.showCollisionBoxes,this.overscaling=t.overscaling,this.collisionBoxArray=t.collisionBoxArray,this.symbolQuadsArray=t.symbolQuadsArray,this.symbolInstancesArray=t.symbolInstancesArray,this.sdfIcons=t.sdfIcons,this.iconsNeedLinear=t.iconsNeedLinear,this.adjustedTextSize=t.adjustedTextSize,this.adjustedIconSize=t.adjustedIconSize,this.fontstack=t.fontstack}function i(t,e,r,n,i,a,o,s,l,c,u){return t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a/4,o/4,10*(c||0),u,10*(s||0),10*Math.min(l||25,25))}var a=t("point-geometry"),o=t("../bucket"),s=t("../../symbol/anchor"),l=t("../../symbol/get_anchors"),c=t("../../util/token"),u=t("../../symbol/quads"),h=t("../../symbol/shaping"),f=t("../../symbol/resolve_text"),d=t("../../symbol/mergelines"),p=t("../../symbol/clip_line"),m=t("../../util/util"),g=t("../load_geometry"),v=t("../../symbol/collision_feature"),y=h.shapeText,b=h.shapeIcon,x=u.getGlyphQuads,_=u.getIconQuads,w=o.EXTENT;e.exports=n,n.MAX_QUADS=65535,(n.prototype=m.inherit(o,{})).serialize=function(){var t=o.prototype.serialize.apply(this);return t.sdfIcons=this.sdfIcons,t.iconsNeedLinear=this.iconsNeedLinear,t.adjustedTextSize=this.adjustedTextSize,t.adjustedIconSize=this.adjustedIconSize,t.fontstack=this.fontstack,t};var M=new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_offset",components:2,type:"Int16"},{name:"a_texture_pos",components:2,type:"Uint16"},{name:"a_data",components:4,type:"Uint8"}]),k=new o.ElementArrayType;n.prototype.addCollisionBoxVertex=function(t,e,r,n,i){return t.emplaceBack(e.x,e.y,Math.round(r.x),Math.round(r.y),10*n,10*i)},n.prototype.programInterfaces={glyph:{layoutVertexArrayType:M,elementArrayType:k},icon:{layoutVertexArrayType:M,elementArrayType:k},collisionBox:{layoutVertexArrayType:new o.VertexArrayType([{name:"a_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"},{name:"a_data",components:2,type:"Uint8"}])}},n.prototype.populateArrays=function(t,e,r){var n={lastIntegerZoom:1/0,lastIntegerZoomTime:0,lastZoom:0};this.adjustedTextMaxSize=this.layer.getLayoutValue("text-size",{zoom:18,zoomHistory:n}),this.adjustedTextSize=this.layer.getLayoutValue("text-size",{zoom:this.zoom+1,zoomHistory:n}),this.adjustedIconMaxSize=this.layer.getLayoutValue("icon-size",{zoom:18,zoomHistory:n}),this.adjustedIconSize=this.layer.getLayoutValue("icon-size",{zoom:this.zoom+1,zoomHistory:n});var i=512*this.overscaling;this.tilePixelRatio=w/i,this.compareText={},this.iconsNeedLinear=!1,this.symbolInstancesStartIndex=this.symbolInstancesArray.length;var a=this.layer.layout,o=this.features,s=this.textFeatures,l=.5,u=.5;switch(a["text-anchor"]){case"right":case"top-right":case"bottom-right":l=1;break;case"left":case"top-left":case"bottom-left":l=0}switch(a["text-anchor"]){case"bottom":case"bottom-right":case"bottom-left":u=1;break;case"top":case"top-right":case"top-left":u=0}for(var h="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,f=24*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,v=24*a["text-letter-spacing"],x=[24*a["text-offset"][0],24*a["text-offset"][1]],_=this.fontstack=a["text-font"].join(","),M=[],k=0;k<o.length;k++)M.push(g(o[k]));if("line"===a["symbol-placement"]){var T=d(o,s,M);M=T.geometries,o=T.features,s=T.textFeatures}for(var A,S,E=0;E<o.length;E++)if(M[E]){if(A=s[E]?y(s[E],e[_],p,f,l,u,h,v,x):null,a["icon-image"]){var L=r[c(o[E].properties,a["icon-image"])];S=b(L,a),L&&(void 0===this.sdfIcons?this.sdfIcons=L.sdf:this.sdfIcons!==L.sdf&&m.warnOnce("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),1!==L.pixelRatio?this.iconsNeedLinear=!0:0===a["icon-rotate"]&&this.layer.isLayoutValueFeatureConstant("icon-rotate")||(this.iconsNeedLinear=!0))}else S=null;(A||S)&&this.addFeature(M[E],A,S,o[E])}this.symbolInstancesEndIndex=this.symbolInstancesArray.length,this.placeFeatures(t,this.showCollisionBoxes),this.trimArrays()},n.prototype.addFeature=function(t,e,r,n){var i=this.layer.layout,a=this.adjustedTextSize/24,o=void 0!==this.adjustedTextMaxSize?this.adjustedTextMaxSize:this.adjustedTextSize,c=this.tilePixelRatio*a,u=this.tilePixelRatio*o/24,h=this.tilePixelRatio*this.adjustedIconSize,f=this.tilePixelRatio*i["symbol-spacing"],d=i["symbol-avoid-edges"],m=i["text-padding"]*this.tilePixelRatio,g=i["icon-padding"]*this.tilePixelRatio,v=i["text-max-angle"]/180*Math.PI,y="map"===i["text-rotation-alignment"]&&"line"===i["symbol-placement"],b="map"===i["icon-rotation-alignment"]&&"line"===i["symbol-placement"],x=i["text-allow-overlap"]||i["icon-allow-overlap"]||i["text-ignore-placement"]||i["icon-ignore-placement"],_="line"===i["symbol-placement"],M=f/2;_&&(t=p(t,0,0,w,w));for(var k=0;k<t.length;k++)for(var T,A=t[k],S=0,E=(T=_?l(A,f,v,e,r,24,u,this.overscaling,w):[new s(A[0].x,A[0].y,0)]).length;S<E;S++){var L=T[S];if(!(e&&_&&this.anchorIsTooClose(e.text,M,L))){var C=!(L.x<0||L.x>w||L.y<0||L.y>w);if(!d||C){var I=C||x;this.addSymbolInstance(L,A,e,r,this.layer,I,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,m,y,h,g,b,{zoom:this.zoom},n.properties)}}}},n.prototype.anchorIsTooClose=function(t,e,r){var n=this.compareText;if(t in n){for(var i=n[t],a=i.length-1;a>=0;a--)if(r.dist(i[a])<e)return!0}else n[t]=[];return n[t].push(r),!1},n.prototype.placeFeatures=function(t,e){this.recalculateStyleLayers(),this.createArrays();var r=this.layer.layout,n=t.maxScale,i="map"===r["text-rotation-alignment"]&&"line"===r["symbol-placement"],a="map"===r["icon-rotation-alignment"]&&"line"===r["symbol-placement"];if(r["text-allow-overlap"]||r["icon-allow-overlap"]||r["text-ignore-placement"]||r["icon-ignore-placement"]){var o=this.symbolInstancesArray.toArray(this.symbolInstancesStartIndex,this.symbolInstancesEndIndex),s=t.angle,l=Math.sin(s),c=Math.cos(s);this.sortedSymbolInstances=o.sort(function(t,e){return(l*t.anchorPointX+c*t.anchorPointY|0)-(l*e.anchorPointX+c*e.anchorPointY|0)||e.index-t.index})}for(var u=this.symbolInstancesStartIndex;u<this.symbolInstancesEndIndex;u++){var h=this.sortedSymbolInstances?this.sortedSymbolInstances[u-this.symbolInstancesStartIndex]:this.symbolInstancesArray.get(u),f={boxStartIndex:h.textBoxStartIndex,boxEndIndex:h.textBoxEndIndex},d={boxStartIndex:h.iconBoxStartIndex,boxEndIndex:h.iconBoxEndIndex},p=!(h.textBoxStartIndex===h.textBoxEndIndex),m=!(h.iconBoxStartIndex===h.iconBoxEndIndex),g=r["text-optional"]||!p,v=r["icon-optional"]||!m,y=p?t.placeCollisionFeature(f,r["text-allow-overlap"],r["symbol-avoid-edges"]):t.minScale,b=m?t.placeCollisionFeature(d,r["icon-allow-overlap"],r["symbol-avoid-edges"]):t.minScale;g||v?!v&&y?y=Math.max(b,y):!g&&b&&(b=Math.max(b,y)):b=y=Math.max(b,y),p&&(t.insertCollisionFeature(f,y,r["text-ignore-placement"]),y<=n&&this.addSymbols("glyph",h.glyphQuadStartIndex,h.glyphQuadEndIndex,y,r["text-keep-upright"],i,t.angle)),m&&(t.insertCollisionFeature(d,b,r["icon-ignore-placement"]),b<=n&&this.addSymbols("icon",h.iconQuadStartIndex,h.iconQuadEndIndex,b,r["icon-keep-upright"],a,t.angle))}e&&this.addToDebugBuffers(t)},n.prototype.addSymbols=function(t,e,r,n,a,o,s){for(var l=this.prepareArrayGroup(t,4*(r-e)),c=l.elementArray,u=l.layoutVertexArray,h=this.zoom,f=Math.max(Math.log(n)/Math.LN2+h,0),d=e;d<r;d++){var p=this.symbolQuadsArray.get(d).SymbolQuad,m=(p.anchorAngle+s+Math.PI)%(2*Math.PI);if(!(a&&o&&(m<=Math.PI/2||m>3*Math.PI/2))){var g=p.tl,v=p.tr,y=p.bl,b=p.br,x=p.tex,_=p.anchorPoint,w=Math.max(h+Math.log(p.minScale)/Math.LN2,f),M=Math.min(h+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===f&&(w=0);var k=Math.round(p.glyphAngle/(2*Math.PI)*256),T=i(u,_.x,_.y,g.x,g.y,x.x,x.y,w,M,f,k);i(u,_.x,_.y,v.x,v.y,x.x+x.w,x.y,w,M,f,k),i(u,_.x,_.y,y.x,y.y,x.x,x.y+x.h,w,M,f,k),i(u,_.x,_.y,b.x,b.y,x.x+x.w,x.y+x.h,w,M,f,k),c.emplaceBack(T,T+1,T+2),c.emplaceBack(T+1,T+2,T+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;r<this.features.length;r++){var n=c(this.features[r].properties,e);n&&(t[n]=!0)}},n.prototype.updateFont=function(t){this.recalculateStyleLayers();var e=this.layer.layout["text-font"],r=t[e]=t[e]||{};this.textFeatures=f(this.features,this.layer.layout,r)},n.prototype.addToDebugBuffers=function(t){for(var e=this.prepareArrayGroup("collisionBox",0).layoutVertexArray,r=-t.angle,n=t.yStretch,i=this.symbolInstancesStartIndex;i<this.symbolInstancesEndIndex;i++){var o=this.symbolInstancesArray.get(i);o.textCollisionFeature={boxStartIndex:o.textBoxStartIndex,boxEndIndex:o.textBoxEndIndex},o.iconCollisionFeature={boxStartIndex:o.iconBoxStartIndex,boxEndIndex:o.iconBoxEndIndex};for(var s=0;s<2;s++){var l=o[0===s?"textCollisionFeature":"iconCollisionFeature"];if(l)for(var c=l.boxStartIndex;c<l.boxEndIndex;c++){var u=this.collisionBoxArray.get(c),h=u.anchorPoint,f=new a(u.x1,u.y1*n)._rotate(r),d=new a(u.x2,u.y1*n)._rotate(r),p=new a(u.x1,u.y2*n)._rotate(r),m=new a(u.x2,u.y2*n)._rotate(r),g=Math.max(0,Math.min(25,this.zoom+Math.log(u.maxScale)/Math.LN2)),v=Math.max(0,Math.min(25,this.zoom+Math.log(u.placementScale)/Math.LN2));this.addCollisionBoxVertex(e,h,f,g,v),this.addCollisionBoxVertex(e,h,d,g,v),this.addCollisionBoxVertex(e,h,d,g,v),this.addCollisionBoxVertex(e,h,m,g,v),this.addCollisionBoxVertex(e,h,m,g,v),this.addCollisionBoxVertex(e,h,p,g,v),this.addCollisionBoxVertex(e,h,p,g,v),this.addCollisionBoxVertex(e,h,f,g,v)}}}},n.prototype.addSymbolInstance=function(t,e,r,i,a,o,s,l,c,u,h,f,d,p,g,y,b,w,M){var k,T,A,S,E,L,C,I;if(r&&(C=o?x(t,r,f,e,a,p):[],E=new v(l,e,t,c,u,h,r,f,d,p,!1)),k=this.symbolQuadsArray.length,C&&C.length)for(var P=0;P<C.length;P++)this.addSymbolQuad(C[P]);T=this.symbolQuadsArray.length;var D=E?E.boxStartIndex:this.collisionBoxArray.length,z=E?E.boxEndIndex:this.collisionBoxArray.length;i&&(I=o?_(t,i,g,e,a,b,r,w,M):[],L=new v(l,e,t,c,u,h,i,g,y,b,!0)),A=this.symbolQuadsArray.length,I&&1===I.length&&this.addSymbolQuad(I[0]),S=this.symbolQuadsArray.length;var O=L?L.boxStartIndex:this.collisionBoxArray.length,F=L?L.boxEndIndex:this.collisionBoxArray.length;return S>n.MAX_QUADS&&m.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),T>n.MAX_QUADS&&m.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),this.symbolInstancesArray.emplaceBack(D,z,O,F,k,T,A,S,t.x,t.y,s)},n.prototype.addSymbolQuad=function(t){return this.symbolQuadsArray.emplaceBack(t.anchorPoint.x,t.anchorPoint.y,t.tl.x,t.tl.y,t.tr.x,t.tr.y,t.bl.x,t.bl.y,t.br.x,t.br.y,t.tex.h,t.tex.w,t.tex.x,t.tex.y,t.anchorAngle,t.glyphAngle,t.maxScale,t.minScale)}},{"../../symbol/anchor":392,"../../symbol/clip_line":394,"../../symbol/collision_feature":396,"../../symbol/get_anchors":398,"../../symbol/mergelines":401,"../../symbol/quads":402,"../../symbol/resolve_text":403,"../../symbol/shaping":404,"../../util/token":442,"../../util/util":443,"../bucket":330,"../load_geometry":338,"point-geometry":485}],335:[function(t,e,r){"use strict";function n(t,e,r){this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.attributes=e.members,this.itemSize=e.bytesPerElement,this.type=r,this.arrayType=e}e.exports=n,n.prototype.bind=function(t){var e=t[this.type];this.buffer?t.bindBuffer(e,this.buffer):(this.buffer=t.createBuffer(),t.bindBuffer(e,this.buffer),t.bufferData(e,this.arrayBuffer,t.STATIC_DRAW),this.arrayBuffer=null)};var i={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT"};n.prototype.setVertexAttribPointers=function(t,e){for(var r=0;r<this.attributes.length;r++){var n=this.attributes[r],a=e[n.name];void 0!==a&&t.vertexAttribPointer(a,n.components,t[i[n.type]],!1,this.arrayType.bytesPerElement,n.offset)}},n.prototype.destroy=function(t){this.buffer&&t.deleteBuffer(this.buffer)},n.BufferType={VERTEX:"ARRAY_BUFFER",ELEMENT:"ELEMENT_ARRAY_BUFFER"}},{}],336:[function(t,e,r){"use strict";function n(t,e){this.layoutVertexBuffer=new a(t.layoutVertexArray,e.layoutVertexArrayType,a.BufferType.VERTEX),t.elementArray&&(this.elementBuffer=new a(t.elementArray,e.elementArrayType,a.BufferType.ELEMENT));var r,n=this.vaos={};t.elementArray2&&(this.elementBuffer2=new a(t.elementArray2,e.elementArrayType2,a.BufferType.ELEMENT),r=this.secondVaos={}),this.paintVertexBuffers=i.mapObject(t.paintVertexArrays,function(i,s){return n[s]=new o,t.elementArray2&&(r[s]=new o),new a(i,e.paintVertexArrayTypes[s],a.BufferType.VERTEX)})}var i=t("../util/util"),a=t("./buffer"),o=t("../render/vertex_array_object");e.exports=n,n.prototype.destroy=function(t){this.layoutVertexBuffer.destroy(t),this.elementBuffer&&this.elementBuffer.destroy(t),this.elementBuffer2&&this.elementBuffer2.destroy(t);for(var e in this.paintVertexBuffers)this.paintVertexBuffers[e].destroy(t);for(var r in this.vaos)this.vaos[r].destroy(t);for(var n in this.secondVaos)this.secondVaos[n].destroy(t)}},{"../render/vertex_array_object":358,"../util/util":443,"./buffer":335}],337:[function(t,e,r){"use strict";function n(t,e,r){if(t.grid){var n=t,i=e;t=n.coord,e=n.overscaling,this.grid=new d(n.grid),this.featureIndexArray=new M(n.featureIndexArray),this.rawTileData=i,this.bucketLayerIDs=n.bucketLayerIDs}else this.grid=new d(u,16,0),this.featureIndexArray=new M;this.coord=t,this.overscaling=e,this.x=t.x,this.y=t.y,this.z=t.z-Math.log(e)/Math.LN2,this.setCollisionTile(r)}function i(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])}function a(t,e){return e-t}function o(t){return t["line-gap-width"]>0?t["line-gap-width"]+2*t["line-width"]:t["line-width"]}function s(t,e,r,n,i){if(!e[0]&&!e[1])return t;e=l.convert(e),"viewport"===r&&e._rotate(-n);for(var a=[],o=0;o<t.length;o++){for(var s=t[o],c=[],u=0;u<s.length;u++)c.push(s[u].sub(e._mult(i)));a.push(c)}return a}var l=t("point-geometry"),c=t("./load_geometry"),u=t("./bucket").EXTENT,h=t("feature-filter"),f=t("../util/struct_array"),d=t("grid-index"),p=t("../util/dictionary_coder"),m=t("vector-tile"),g=t("pbf"),v=t("../util/vectortile_to_geojson"),y=t("../util/util").arraysIntersect,b=t("../util/intersection_tests"),x=b.multiPolygonIntersectsBufferedMultiPoint,_=b.multiPolygonIntersectsMultiPolygon,w=b.multiPolygonIntersectsBufferedMultiLine,M=new f({members:[{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]});e.exports=n,n.prototype.insert=function(t,e,r,n){var i=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(e,r,n);for(var a=c(t),o=0;o<a.length;o++){for(var s=a[o],l=[1/0,1/0,-1/0,-1/0],u=0;u<s.length;u++){var h=s[u];l[0]=Math.min(l[0],h.x),l[1]=Math.min(l[1],h.y),l[2]=Math.max(l[2],h.x),l[3]=Math.max(l[3],h.y)}this.grid.insert(i,l[0],l[1],l[2],l[3])}},n.prototype.setCollisionTile=function(t){this.collisionTile=t},n.prototype.serialize=function(){var t={coord:this.coord,overscaling:this.overscaling,grid:this.grid.toArrayBuffer(),featureIndexArray:this.featureIndexArray.serialize(),bucketLayerIDs:this.bucketLayerIDs};return{data:t,transferables:[t.grid,t.featureIndexArray.arrayBuffer]}},n.prototype.query=function(t,e){this.vtLayers||(this.vtLayers=new m.VectorTile(new g(new Uint8Array(this.rawTileData))).layers,this.sourceLayerCoder=new p(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]));var r={},n=t.params||{},s=u/t.tileSize/t.scale,c=h(n.filter),f=0;for(var d in e){var v=e[d],y=v.paint,b=0;"line"===v.type?b=o(y)/2+Math.abs(y["line-offset"])+i(y["line-translate"]):"fill"===v.type?b=i(y["fill-translate"]):"circle"===v.type&&(b=y["circle-radius"]+i(y["circle-translate"])),f=Math.max(f,b*s)}for(var x=t.queryGeometry.map(function(t){return t.map(function(t){return new l(t.x,t.y)})}),_=1/0,w=1/0,M=-1/0,k=-1/0,T=0;T<x.length;T++)for(var A=x[T],S=0;S<A.length;S++){var E=A[S];_=Math.min(_,E.x),w=Math.min(w,E.y),M=Math.max(M,E.x),k=Math.max(k,E.y)}var L=this.grid.query(_-f,w-f,M+f,k+f);L.sort(a),this.filterMatching(r,L,this.featureIndexArray,x,c,n.layers,e,t.bearing,s);var C=this.collisionTile.queryRenderedSymbols(_,w,M,k,t.scale);return C.sort(),this.filterMatching(r,C,this.collisionTile.collisionBoxArray,x,c,n.layers,e,t.bearing,s),r},n.prototype.filterMatching=function(t,e,r,n,i,a,u,h,f){for(var d,p=0;p<e.length;p++){var m=e[p];if(m!==d){d=m;var g=r.get(m),b=this.bucketLayerIDs[g.bucketIndex];if(!a||y(a,b)){var M=this.sourceLayerCoder.decode(g.sourceLayerIndex),k=this.vtLayers[M].feature(g.featureIndex);if(i(k))for(var T=null,A=0;A<b.length;A++){var S=b[A];if(!(a&&a.indexOf(S)<0)){var E=u[S];if(E){var L;if("symbol"!==E.type){T||(T=c(k));var C=E.paint;if("line"===E.type){L=s(n,C["line-translate"],C["line-translate-anchor"],h,f);var I=o(C)/2*f;if(C["line-offset"]&&(T=function(t,e){for(var r=[],n=new l(0,0),i=0;i<t.length;i++){for(var a=t[i],o=[],s=0;s<a.length;s++){var c=a[s-1],u=a[s],h=a[s+1],f=0===s?n:u.sub(c)._unit()._perp(),d=s===a.length-1?n:h.sub(u)._unit()._perp(),p=f._add(d)._unit(),m=p.x*d.x+p.y*d.y;p._mult(1/m),o.push(p._mult(e)._add(u))}r.push(o)}return r}(T,C["line-offset"]*f)),!w(L,T,I))continue}else if("fill"===E.type){if(L=s(n,C["fill-translate"],C["fill-translate-anchor"],h,f),!_(L,T))continue}else if("circle"===E.type){L=s(n,C["circle-translate"],C["circle-translate-anchor"],h,f);var P=C["circle-radius"]*f;if(!x(L,T,P))continue}}var D=new v(k,this.z,this.x,this.y);D.layer=E.serialize({includeRefProperties:!0});var z=t[S];void 0===z&&(z=t[S]=[]),z.push(D)}}}}}}}},{"../util/dictionary_coder":433,"../util/intersection_tests":438,"../util/struct_array":441,"../util/util":443,"../util/vectortile_to_geojson":444,"./bucket":330,"./load_geometry":338,"feature-filter":133,"grid-index":288,pbf:479,"point-geometry":485,"vector-tile":559}],338:[function(t,e,r){"use strict";function n(t){return{min:-1*Math.pow(2,t-1),max:Math.pow(2,t-1)-1}}var i=t("../util/util"),a=t("./bucket").EXTENT,o=t("assert"),s={15:n(15),16:n(16)};e.exports=function(t,e){var r=s[e||16];o(r);for(var n=a/t.extent,l=t.loadGeometry(),c=0;c<l.length;c++)for(var u=l[c],h=0;h<u.length;h++){var f=u[h];f.x=Math.round(f.x*n),f.y=Math.round(f.y*n),(f.x<r.min||f.x>r.max||f.y<r.min||f.y>r.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":443,"./bucket":330,assert:48}],339:[function(t,e,r){"use strict";function n(t,e,r){this.column=t,this.row=e,this.zoom=r}e.exports=n,n.prototype={clone:function(){return new n(this.column,this.row,this.zoom)},zoomTo:function(t){return this.clone()._zoomTo(t)},sub:function(t){return this.clone()._sub(t)},_zoomTo:function(t){var e=Math.pow(2,t-this.zoom);return this.column*=e,this.row*=e,this.zoom=t,this},_sub:function(t){return t=t.zoomTo(this.zoom),this.column-=t.column,this.row-=t.row,this}}},{}],340:[function(t,e,r){"use strict";function n(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")}e.exports=n;var i=t("../util/util").wrap;n.prototype.wrap=function(){return new n(i(this.lng,-180,180),this.lat)},n.prototype.toArray=function(){return[this.lng,this.lat]},n.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{"../util/util":443}],341:[function(t,e,r){"use strict";function n(t,e){t&&(e?this.extend(t).extend(e):4===t.length?this.extend([t[0],t[1]]).extend([t[2],t[3]]):this.extend(t[0]).extend(t[1]))}e.exports=n;var i=t("./lng_lat");n.prototype={extend:function(t){var e,r,a=this._sw,o=this._ne;if(t instanceof i)e=t,r=t;else{if(!(t instanceof n))return t?this.extend(i.convert(t)||n.convert(t)):this;if(e=t._sw,r=t._ne,!e||!r)return this}return a||o?(a.lng=Math.min(e.lng,a.lng),a.lat=Math.min(e.lat,a.lat),o.lng=Math.max(r.lng,o.lng),o.lat=Math.max(r.lat,o.lat)):(this._sw=new i(e.lng,e.lat),this._ne=new i(r.lng,r.lat)),this},getCenter:function(){return new i((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},getSouthWest:function(){return this._sw},getNorthEast:function(){return this._ne},getNorthWest:function(){return new i(this.getWest(),this.getNorth())},getSouthEast:function(){return new i(this.getEast(),this.getSouth())},getWest:function(){return this._sw.lng},getSouth:function(){return this._sw.lat},getEast:function(){return this._ne.lng},getNorth:function(){return this._ne.lat},toArray:function(){return[this._sw.toArray(),this._ne.toArray()]},toString:function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"}},n.convert=function(t){return!t||t instanceof n?t:new n(t)}},{"./lng_lat":340}],342:[function(t,e,r){"use strict";function n(t,e){this.tileSize=512,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new i(0,0),this.zoom=0,this.angle=0,this._altitude=1.5,this._pitch=0,this._unmodified=!0}var i=t("./lng_lat"),a=t("point-geometry"),o=t("./coordinate"),s=t("../util/util").wrap,l=t("../util/interpolate"),c=t("../source/tile_coord"),u=t("../data/bucket").EXTENT,h=t("gl-matrix"),f=h.vec4,d=h.mat4,p=h.mat2;e.exports=n,n.prototype={get minZoom(){return this._minZoom},set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},get maxZoom(){return this._maxZoom},set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},get worldSize(){return this.tileSize*this.scale},get centerPoint(){return this.size._div(2)},get size(){return new a(this.width,this.height)},get bearing(){return-this.angle/Math.PI*180},set bearing(t){var e=-s(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=p.create(),p.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},get pitch(){return this._pitch/Math.PI*180},set pitch(t){var e=Math.min(60,t)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},get altitude(){return this._altitude},set altitude(t){var e=Math.max(.75,t);this._altitude!==e&&(this._unmodified=!1,this._altitude=e,this._calcMatrices())},get zoom(){return this._zoom},set zoom(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._calcMatrices(),this._constrain())},get center(){return this._center},set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._calcMatrices(),this._constrain())},coveringZoomLevel:function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},coveringTiles:function(t){var e=this.coveringZoomLevel(t),r=e;if(e<t.minzoom)return[];e>t.maxzoom&&(e=t.maxzoom);var n=this.locationCoordinate(this.center)._zoomTo(e),i=new a(n.column-.5,n.row-.5);return c.cover(e,[this.pointCoordinate(new a(0,0))._zoomTo(e),this.pointCoordinate(new a(this.width,0))._zoomTo(e),this.pointCoordinate(new a(this.width,this.height))._zoomTo(e),this.pointCoordinate(new a(0,this.height))._zoomTo(e)],t.reparseOverscaled?r:e).sort(function(t,e){return i.dist(t)-i.dist(e)})},resize:function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._calcMatrices(),this._constrain()},get unmodified(){return this._unmodified},zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new a(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new i(this.xLng(t.x,e),this.yLat(t.y,e))},get x(){return this.lngX(this.center.lng)},get y(){return this.latY(this.center.lat)},get point(){return new a(this.x,this.y)},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var r=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(r*Math.PI/180))-90},panBy:function(t){var e=this.centerPoint._add(t);this.center=this.pointLocation(e)},setLocationAtPoint:function(t,e){var r=this.locationCoordinate(t),n=this.pointCoordinate(e),i=this.pointCoordinate(this.centerPoint),a=n._sub(r);this._unmodified=!1,this.center=this.coordinateLocation(i._sub(a))},locationPoint:function(t){return this.coordinatePoint(this.locationCoordinate(t))},pointLocation:function(t){return this.coordinateLocation(this.pointCoordinate(t))},locationCoordinate:function(t){var e=this.zoomScale(this.tileZoom)/this.worldSize,r=i.convert(t);return new o(this.lngX(r.lng)*e,this.latY(r.lat)*e,this.tileZoom)},coordinateLocation:function(t){var e=this.zoomScale(t.zoom);return new i(this.xLng(t.column,e),this.yLat(t.row,e))},pointCoordinate:function(t){var e=[t.x,t.y,0,1],r=[t.x,t.y,1,1];f.transformMat4(e,e,this.pixelMatrixInverse),f.transformMat4(r,r,this.pixelMatrixInverse);var n=e[3],i=r[3],a=e[0]/n,s=r[0]/i,c=e[1]/n,u=r[1]/i,h=e[2]/n,d=r[2]/i,p=h===d?0:(0-h)/(d-h),m=this.worldSize/this.zoomScale(this.tileZoom);return new o(l(a,s,p)/m,l(c,u,p)/m,this.tileZoom)},coordinatePoint:function(t){var e=this.worldSize/this.zoomScale(t.zoom),r=[t.column*e,t.row*e,0,1];return f.transformMat4(r,r,this.pixelMatrix),new a(r[0]/r[3],r[1]/r[3])},calculatePosMatrix:function(t,e){void 0===e&&(e=1/0),t instanceof c&&(t=t.toCoordinate(e));var r=Math.min(t.zoom,e),n=this.worldSize/Math.pow(2,r),i=new Float64Array(16);return d.identity(i),d.translate(i,i,[t.column*n,t.row*n,0]),d.scale(i,i,[n/u,n/u,1]),d.multiply(i,this.projMatrix,i),new Float32Array(i)},_constrain:function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,i,o,s,l,c=this.size,u=this._unmodified;this.latRange&&(t=this.latY(this.latRange[1]),i=(e=this.latY(this.latRange[0]))-t<c.y?c.y/(e-t):0),this.lngRange&&(r=this.lngX(this.lngRange[0]),o=(n=this.lngX(this.lngRange[1]))-r<c.x?c.x/(n-r):0);var h=Math.max(o||0,i||0);if(h)return this.center=this.unproject(new a(o?(n+r)/2:this.x,i?(e+t)/2:this.y)),this.zoom+=this.scaleZoom(h),this._unmodified=u,void(this._constraining=!1);if(this.latRange){var f=this.y,d=c.y/2;f-d<t&&(l=t+d),f+d>e&&(l=e-d)}if(this.lngRange){var p=this.x,m=c.x/2;p-m<r&&(s=r+m),p+m>n&&(s=n-m)}void 0===s&&void 0===l||(this.center=this.unproject(new a(void 0!==s?s:this.x,void 0!==l?l:this.y))),this._unmodified=u,this._constraining=!1}},_calcMatrices:function(){if(this.height){var t=Math.atan(.5/this.altitude),e=Math.sin(t)*this.altitude/Math.sin(Math.PI/2-this._pitch-t),r=Math.cos(Math.PI/2-this._pitch)*e+this.altitude,n=new Float64Array(16);if(d.perspective(n,2*Math.atan(this.height/2/this.altitude),this.width/this.height,.1,r),d.translate(n,n,[0,0,-this.altitude]),d.scale(n,n,[1,-1,1/this.height]),d.rotateX(n,n,this._pitch),d.rotateZ(n,n,this.angle),d.translate(n,n,[-this.x,-this.y,0]),this.projMatrix=n,n=d.create(),d.scale(n,n,[this.width/2,-this.height/2,1]),d.translate(n,n,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),n,this.projMatrix),!(n=d.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=n}}}},{"../data/bucket":330,"../source/tile_coord":370,"../util/interpolate":437,"../util/util":443,"./coordinate":339,"./lng_lat":340,"gl-matrix":194,"point-geometry":485}],343:[function(t,e,r){"use strict";var n={" ":[16,[]],"!":[10,[5,21,5,7,-1,-1,5,2,4,1,5,0,6,1,5,2]],'"':[16,[4,21,4,14,-1,-1,12,21,12,14]],"#":[21,[11,25,4,-7,-1,-1,17,25,10,-7,-1,-1,4,12,18,12,-1,-1,3,6,17,6]],$:[20,[8,25,8,-4,-1,-1,12,25,12,-4,-1,-1,17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],"%":[24,[21,21,3,0,-1,-1,8,21,10,19,10,17,9,15,7,14,5,14,3,16,3,18,4,20,6,21,8,21,10,20,13,19,16,19,19,20,21,21,-1,-1,17,7,15,6,14,4,14,2,16,0,18,0,20,1,21,3,21,5,19,7,17,7]],"&":[26,[23,12,23,13,22,14,21,14,20,13,19,11,17,6,15,3,13,1,11,0,7,0,5,1,4,2,3,4,3,6,4,8,5,9,12,13,13,14,14,16,14,18,13,20,11,21,9,20,8,18,8,16,9,13,11,10,16,3,18,1,20,0,22,0,23,1,23,2]],"'":[10,[5,19,4,20,5,21,6,20,6,18,5,16,4,15]],"(":[14,[11,25,9,23,7,20,5,16,4,11,4,7,5,2,7,-2,9,-5,11,-7]],")":[14,[3,25,5,23,7,20,9,16,10,11,10,7,9,2,7,-2,5,-5,3,-7]],"*":[16,[8,21,8,9,-1,-1,3,18,13,12,-1,-1,13,18,3,12]],"+":[26,[13,18,13,0,-1,-1,4,9,22,9]],",":[10,[6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"-":[26,[4,9,22,9]],".":[10,[5,2,4,1,5,0,6,1,5,2]],"/":[22,[20,25,2,-7]],0:[20,[9,21,6,20,4,17,3,12,3,9,4,4,6,1,9,0,11,0,14,1,16,4,17,9,17,12,16,17,14,20,11,21,9,21]],1:[20,[6,17,8,18,11,21,11,0]],2:[20,[4,16,4,17,5,19,6,20,8,21,12,21,14,20,15,19,16,17,16,15,15,13,13,10,3,0,17,0]],3:[20,[5,21,16,21,10,13,13,13,15,12,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],4:[20,[13,21,3,7,18,7,-1,-1,13,21,13,0]],5:[20,[15,21,5,21,4,12,5,13,8,14,11,14,14,13,16,11,17,8,17,6,16,3,14,1,11,0,8,0,5,1,4,2,3,4]],6:[20,[16,18,15,20,12,21,10,21,7,20,5,17,4,12,4,7,5,3,7,1,10,0,11,0,14,1,16,3,17,6,17,7,16,10,14,12,11,13,10,13,7,12,5,10,4,7]],7:[20,[17,21,7,0,-1,-1,3,21,17,21]],8:[20,[8,21,5,20,4,18,4,16,5,14,7,13,11,12,14,11,16,9,17,7,17,4,16,2,15,1,12,0,8,0,5,1,4,2,3,4,3,7,4,9,6,11,9,12,13,13,15,14,16,16,16,18,15,20,12,21,8,21]],9:[20,[16,14,15,11,13,9,10,8,9,8,6,9,4,11,3,14,3,15,4,18,6,20,9,21,10,21,13,20,15,18,16,14,16,9,15,4,13,1,10,0,8,0,5,1,4,3]],":":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,5,2,4,1,5,0,6,1,5,2]],";":[10,[5,14,4,13,5,12,6,13,5,14,-1,-1,6,1,5,0,4,1,5,2,6,1,6,-1,5,-3,4,-4]],"<":[24,[20,18,4,9,20,0]],"=":[26,[4,12,22,12,-1,-1,4,6,22,6]],">":[24,[4,18,20,9,4,0]],"?":[18,[3,16,3,17,4,19,5,20,7,21,11,21,13,20,14,19,15,17,15,15,14,13,13,12,9,10,9,7,-1,-1,9,2,8,1,9,0,10,1,9,2]],"@":[27,[18,13,17,15,15,16,12,16,10,15,9,14,8,11,8,8,9,6,11,5,14,5,16,6,17,8,-1,-1,12,16,10,14,9,11,9,8,10,6,11,5,-1,-1,18,16,17,8,17,6,19,5,21,5,23,7,24,10,24,12,23,15,22,17,20,19,18,20,15,21,12,21,9,20,7,19,5,17,4,15,3,12,3,9,4,6,5,4,7,2,9,1,12,0,15,0,18,1,20,2,21,3,-1,-1,19,16,18,8,18,6,19,5]],A:[18,[9,21,1,0,-1,-1,9,21,17,0,-1,-1,4,7,14,7]],B:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,-1,-1,4,11,13,11,16,10,17,9,18,7,18,4,17,2,16,1,13,0,4,0]],C:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5]],D:[21,[4,21,4,0,-1,-1,4,21,11,21,14,20,16,18,17,16,18,13,18,8,17,5,16,3,14,1,11,0,4,0]],E:[19,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11,-1,-1,4,0,17,0]],F:[18,[4,21,4,0,-1,-1,4,21,17,21,-1,-1,4,11,12,11]],G:[21,[18,16,17,18,15,20,13,21,9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,18,8,-1,-1,13,8,18,8]],H:[22,[4,21,4,0,-1,-1,18,21,18,0,-1,-1,4,11,18,11]],I:[8,[4,21,4,0]],J:[16,[12,21,12,5,11,2,10,1,8,0,6,0,4,1,3,2,2,5,2,7]],K:[21,[4,21,4,0,-1,-1,18,21,4,7,-1,-1,9,12,18,0]],L:[17,[4,21,4,0,-1,-1,4,0,16,0]],M:[24,[4,21,4,0,-1,-1,4,21,12,0,-1,-1,20,21,12,0,-1,-1,20,21,20,0]],N:[22,[4,21,4,0,-1,-1,4,21,18,0,-1,-1,18,21,18,0]],O:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21]],P:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,14,17,12,16,11,13,10,4,10]],Q:[22,[9,21,7,20,5,18,4,16,3,13,3,8,4,5,5,3,7,1,9,0,13,0,15,1,17,3,18,5,19,8,19,13,18,16,17,18,15,20,13,21,9,21,-1,-1,12,4,18,-2]],R:[21,[4,21,4,0,-1,-1,4,21,13,21,16,20,17,19,18,17,18,15,17,13,16,12,13,11,4,11,-1,-1,11,11,18,0]],S:[20,[17,18,15,20,12,21,8,21,5,20,3,18,3,16,4,14,5,13,7,12,13,10,15,9,16,8,17,6,17,3,15,1,12,0,8,0,5,1,3,3]],T:[16,[8,21,8,0,-1,-1,1,21,15,21]],U:[22,[4,21,4,6,5,3,7,1,10,0,12,0,15,1,17,3,18,6,18,21]],V:[18,[1,21,9,0,-1,-1,17,21,9,0]],W:[24,[2,21,7,0,-1,-1,12,21,7,0,-1,-1,12,21,17,0,-1,-1,22,21,17,0]],X:[20,[3,21,17,0,-1,-1,17,21,3,0]],Y:[18,[1,21,9,11,9,0,-1,-1,17,21,9,11]],Z:[20,[17,21,3,0,-1,-1,3,21,17,21,-1,-1,3,0,17,0]],"[":[14,[4,25,4,-7,-1,-1,5,25,5,-7,-1,-1,4,25,11,25,-1,-1,4,-7,11,-7]],"\\":[14,[0,21,14,-3]],"]":[14,[9,25,9,-7,-1,-1,10,25,10,-7,-1,-1,3,25,10,25,-1,-1,3,-7,10,-7]],"^":[16,[6,15,8,18,10,15,-1,-1,3,12,8,17,13,12,-1,-1,8,17,8,0]],_:[16,[0,-2,16,-2]],"`":[10,[6,21,5,20,4,18,4,16,5,15,6,16,5,17]],a:[19,[15,14,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],b:[19,[4,21,4,0,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],c:[18,[15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],d:[19,[15,21,15,0,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],e:[18,[3,8,15,8,15,10,14,12,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],f:[12,[10,21,8,21,6,20,5,17,5,0,-1,-1,2,14,9,14]],g:[19,[15,14,15,-2,14,-5,13,-6,11,-7,8,-7,6,-6,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],h:[19,[4,21,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],i:[8,[3,21,4,20,5,21,4,22,3,21,-1,-1,4,14,4,0]],j:[10,[5,21,6,20,7,21,6,22,5,21,-1,-1,6,14,6,-3,5,-6,3,-7,1,-7]],k:[17,[4,21,4,0,-1,-1,14,14,4,4,-1,-1,8,8,15,0]],l:[8,[4,21,4,0]],m:[30,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0,-1,-1,15,10,18,13,20,14,23,14,25,13,26,10,26,0]],n:[19,[4,14,4,0,-1,-1,4,10,7,13,9,14,12,14,14,13,15,10,15,0]],o:[19,[8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3,16,6,16,8,15,11,13,13,11,14,8,14]],p:[19,[4,14,4,-7,-1,-1,4,11,6,13,8,14,11,14,13,13,15,11,16,8,16,6,15,3,13,1,11,0,8,0,6,1,4,3]],q:[19,[15,14,15,-7,-1,-1,15,11,13,13,11,14,8,14,6,13,4,11,3,8,3,6,4,3,6,1,8,0,11,0,13,1,15,3]],r:[13,[4,14,4,0,-1,-1,4,8,5,11,7,13,9,14,12,14]],s:[17,[14,11,13,13,10,14,7,14,4,13,3,11,4,9,6,8,11,7,13,6,14,4,14,3,13,1,10,0,7,0,4,1,3,3]],t:[12,[5,21,5,4,6,1,8,0,10,0,-1,-1,2,14,9,14]],u:[19,[4,14,4,4,5,1,7,0,10,0,12,1,15,4,-1,-1,15,14,15,0]],v:[16,[2,14,8,0,-1,-1,14,14,8,0]],w:[22,[3,14,7,0,-1,-1,11,14,7,0,-1,-1,11,14,15,0,-1,-1,19,14,15,0]],x:[17,[3,14,14,0,-1,-1,14,14,3,0]],y:[16,[2,14,8,0,-1,-1,14,14,8,0,6,-4,4,-6,2,-7,1,-7]],z:[17,[14,14,3,0,-1,-1,3,14,14,14,-1,-1,3,0,14,0]],"{":[14,[9,25,7,24,6,23,5,21,5,19,6,17,7,16,8,14,8,12,6,10,-1,-1,7,24,6,22,6,20,7,18,8,17,9,15,9,13,8,11,4,9,8,7,9,5,9,3,8,1,7,0,6,-2,6,-4,7,-6,-1,-1,6,8,8,6,8,4,7,2,6,1,5,-1,5,-3,6,-5,7,-6,9,-7]],"|":[8,[4,25,4,-7]],"}":[14,[5,25,7,24,8,23,9,21,9,19,8,17,7,16,6,14,6,12,8,10,-1,-1,7,24,8,22,8,20,7,18,6,17,5,15,5,13,6,11,10,9,6,7,5,5,5,3,6,1,7,0,8,-2,8,-4,7,-6,-1,-1,8,8,6,6,6,4,7,2,8,1,9,-1,9,-3,8,-5,7,-6,5,-7]],"~":[24,[3,6,3,8,4,11,6,12,8,12,10,11,14,8,16,7,18,7,20,8,21,10,-1,-1,3,8,4,10,6,11,8,11,10,10,14,7,16,6,18,6,20,7,21,10,21,12]]};e.exports=function(t,e,r,i){i=i||1;var a,o,s,l,c,u,h,f,d=[];for(a=0,o=t.length;a<o;a++)if(c=n[t[a]]){for(f=null,s=0,l=c[1].length;s<l;s+=2)-1===c[1][s]&&-1===c[1][s+1]?f=null:(u=e+c[1][s]*i,h=r-c[1][s+1]*i,f&&d.push(f.x,f.y,u,h),f={x:u,y:h});e+=c[0]*i}return d}},{}],344:[function(t,e,r){"use strict";var n=e.exports={};n.version=t("../package.json").version,n.Map=t("./ui/map"),n.Control=t("./ui/control/control"),n.Navigation=t("./ui/control/navigation"),n.Geolocate=t("./ui/control/geolocate"),n.Attribution=t("./ui/control/attribution"),n.Popup=t("./ui/popup"),n.Marker=t("./ui/marker"),n.Style=t("./style/style"),n.LngLat=t("./geo/lng_lat"),n.LngLatBounds=t("./geo/lng_lat_bounds"),n.Point=t("point-geometry"),n.Evented=t("./util/evented"),n.util=t("./util/util"),n.supported=t("./util/browser").supported;var i=t("./util/ajax");n.util.getJSON=i.getJSON,n.util.getArrayBuffer=i.getArrayBuffer;var a=t("./util/config");n.config=a,Object.defineProperty(n,"accessToken",{get:function(){return a.ACCESS_TOKEN},set:function(t){a.ACCESS_TOKEN=t}})},{"../package.json":445,"./geo/lng_lat":340,"./geo/lng_lat_bounds":341,"./style/style":379,"./ui/control/attribution":410,"./ui/control/control":411,"./ui/control/geolocate":412,"./ui/control/navigation":413,"./ui/map":422,"./ui/marker":423,"./ui/popup":424,"./util/ajax":426,"./util/browser":427,"./util/config":432,"./util/evented":435,"./util/util":443,"point-geometry":485}],345:[function(t,e,r){"use strict";var n=t("assert");e.exports=function(t){for(var e={define:{},initialize:{}},r=0;r<t.length;r++){var i=t[r];n("u_"===i.name.slice(0,2));var a="{precision} "+(1===i.components?"float":"vec"+i.components);e.define[i.name.slice(2)]="uniform "+a+" "+i.name+";\n",e.initialize[i.name.slice(2)]=a+" "+i.name.slice(2)+" = "+i.name+";\n"}return e}},{assert:48}],346:[function(t,e,r){"use strict";var n=t("../source/pixels_to_tile_units"),i=t("./create_uniform_pragmas"),a=512;e.exports=function(t,e,r){var o,s=t.gl,l=t.transform,c=r.paint["background-color"],u=r.paint["background-pattern"],h=r.paint["background-opacity"],f=u?t.spriteAtlas.getPosition(u.from,!0):null,d=u?t.spriteAtlas.getPosition(u.to,!0):null;if(t.setDepthSublayer(0),f&&d){if(t.isOpaquePass)return;o=t.useProgram("pattern"),s.uniform1i(o.u_image,0),s.uniform2fv(o.u_pattern_tl_a,f.tl),s.uniform2fv(o.u_pattern_br_a,f.br),s.uniform2fv(o.u_pattern_tl_b,d.tl),s.uniform2fv(o.u_pattern_br_b,d.br),s.uniform1f(o.u_opacity,h),s.uniform1f(o.u_mix,u.t),s.uniform2fv(o.u_pattern_size_a,f.size),s.uniform2fv(o.u_pattern_size_b,d.size),s.uniform1f(o.u_scale_a,u.fromScale),s.uniform1f(o.u_scale_b,u.toScale),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),t.tileExtentPatternVAO.bind(s,o,t.tileExtentBuffer)}else{if(t.isOpaquePass!==(1===c[3]))return;var p=i([{name:"u_color",components:4},{name:"u_opacity",components:1}]);o=t.useProgram("fill",[],p,p),s.uniform4fv(o.u_color,c),s.uniform1f(o.u_opacity,h),t.tileExtentVAO.bind(s,o,t.tileExtentBuffer)}s.disable(s.STENCIL_TEST);for(var m=l.coveringTiles({tileSize:a}),g=0;g<m.length;g++){var v=m[g];if(f&&d){var y={coord:v,tileSize:a};s.uniform1f(o.u_tile_units_to_pixels,1/n(y,1,t.transform.tileZoom));var b=y.tileSize*Math.pow(2,t.transform.tileZoom-y.coord.z),x=b*(y.coord.x+v.w*Math.pow(2,y.coord.z)),_=b*y.coord.y;s.uniform2f(o.u_pixel_coord_upper,x>>16,_>>16),s.uniform2f(o.u_pixel_coord_lower,65535&x,65535&_)}s.uniformMatrix4fv(o.u_matrix,!1,t.transform.calculatePosMatrix(v)),s.drawArrays(s.TRIANGLE_STRIP,0,t.tileExtentBuffer.length)}s.stencilMask(0),s.stencilFunc(s.EQUAL,128,128)}},{"../source/pixels_to_tile_units":364,"./create_uniform_pragmas":345}],347:[function(t,e,r){"use strict";var n=t("../util/browser");e.exports=function(t,e,r,i){if(!t.isOpaquePass){var a=t.gl;t.setDepthSublayer(0),t.depthMask(!1),a.disable(a.STENCIL_TEST);for(var o=0;o<i.length;o++){var s=i[o],l=e.getTile(s),c=l.getBucket(r);if(c){var u=c.bufferGroups.circle;if(u){var h=c.paintAttributes.circle[r.id],f=t.useProgram("circle",h.defines,h.vertexPragmas,h.fragmentPragmas);"map"===r.paint["circle-pitch-scale"]?(a.uniform1i(f.u_scale_with_map,!0),a.uniform2f(f.u_extrude_scale,t.transform.pixelsToGLUnits[0]*t.transform.altitude,t.transform.pixelsToGLUnits[1]*t.transform.altitude)):(a.uniform1i(f.u_scale_with_map,!1),a.uniform2fv(f.u_extrude_scale,t.transform.pixelsToGLUnits)),a.uniform1f(f.u_devicepixelratio,n.devicePixelRatio),a.uniformMatrix4fv(f.u_matrix,!1,t.translatePosMatrix(s.posMatrix,l,r.paint["circle-translate"],r.paint["circle-translate-anchor"])),c.setUniforms(a,"circle",f,r,{zoom:t.transform.zoom});for(var d=0;d<u.length;d++){var p=u[d];p.vaos[r.id].bind(a,f,p.layoutVertexBuffer,p.elementBuffer,p.paintVertexBuffers[r.id]),a.drawElements(a.TRIANGLES,3*p.elementBuffer.length,a.UNSIGNED_SHORT,0)}}}}}}},{"../util/browser":427}],348:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=t.gl;i.enable(i.STENCIL_TEST);for(var a=t.useProgram("collisionbox"),o=0;o<n.length;o++){var s=n[o],l=e.getTile(s),c=l.getBucket(r);if(c){var u=c.bufferGroups.collisionBox;if(u&&u.length){var h=u[0];0!==h.layoutVertexBuffer.length&&(i.uniformMatrix4fv(a.u_matrix,!1,s.posMatrix),t.enableTileClippingMask(s),t.lineWidth(1),i.uniform1f(a.u_scale,Math.pow(2,t.transform.zoom-l.coord.z)),i.uniform1f(a.u_zoom,10*t.transform.zoom),i.uniform1f(a.u_maxzoom,10*(l.coord.z+1)),h.vaos[r.id].bind(i,a,h.layoutVertexBuffer),i.drawArrays(i.LINES,0,h.layoutVertexBuffer.length))}}}}},{}],349:[function(t,e,r){"use strict";var n=t("../lib/debugtext"),i=t("../util/browser"),a=t("gl-matrix").mat4,o=t("../data/bucket").EXTENT,s=t("../data/buffer"),l=t("./vertex_array_object");e.exports=function(t,e,r){if(!t.isOpaquePass&&t.options.debug)for(var c=0;c<r.length;c++)!function(t,e,r){var c=t.gl;c.disable(c.STENCIL_TEST),t.lineWidth(1*i.devicePixelRatio);var u=r.posMatrix,h=t.useProgram("debug");c.uniformMatrix4fv(h.u_matrix,!1,u),c.uniform4f(h.u_color,1,0,0,1),t.debugVAO.bind(c,h,t.debugBuffer),c.drawArrays(c.LINE_STRIP,0,t.debugBuffer.length);for(var f=n(r.toString(),50,200,5),d=new t.PosArray,p=0;p<f.length;p+=2)d.emplaceBack(f[p],f[p+1]);var m=new s(d.serialize(),t.PosArray.serialize(),s.BufferType.VERTEX);(new l).bind(c,h,m),c.uniform4f(h.u_color,1,1,1,1);for(var g=e.getTile(r).tileSize,v=o/(Math.pow(2,t.transform.zoom-r.z)*g),y=[[-1,-1],[-1,1],[1,-1],[1,1]],b=0;b<y.length;b++){var x=y[b];c.uniformMatrix4fv(h.u_matrix,!1,a.translate([],u,[v*x[0],v*x[1],0])),c.drawArrays(c.LINES,0,m.length)}c.uniform4f(h.u_color,0,0,0,1),c.uniformMatrix4fv(h.u_matrix,!1,u),c.drawArrays(c.LINES,0,m.length)}(t,e,r[c])}},{"../data/bucket":330,"../data/buffer":335,"../lib/debugtext":343,"../util/browser":427,"./vertex_array_object":358,"gl-matrix":194}],350:[function(t,e,r){"use strict";function n(t,e,r,n,a,o){var s=a.gl,l=a.spriteAtlas.getPosition(t.from,!0),c=a.spriteAtlas.getPosition(t.to,!0);if(l&&c){s.uniform1i(o.u_image,0),s.uniform2fv(o.u_pattern_tl_a,l.tl),s.uniform2fv(o.u_pattern_br_a,l.br),s.uniform2fv(o.u_pattern_tl_b,c.tl),s.uniform2fv(o.u_pattern_br_b,c.br),s.uniform1f(o.u_opacity,e),s.uniform1f(o.u_mix,t.t),s.uniform1f(o.u_tile_units_to_pixels,1/i(r,1,a.transform.tileZoom)),s.uniform2fv(o.u_pattern_size_a,l.size),s.uniform2fv(o.u_pattern_size_b,c.size),s.uniform1f(o.u_scale_a,t.fromScale),s.uniform1f(o.u_scale_b,t.toScale);var u=r.tileSize*Math.pow(2,a.transform.tileZoom-r.coord.z),h=u*(r.coord.x+n.w*Math.pow(2,r.coord.z)),f=u*r.coord.y;s.uniform2f(o.u_pixel_coord_upper,h>>16,f>>16),s.uniform2f(o.u_pixel_coord_lower,65535&h,65535&f),s.activeTexture(s.TEXTURE0),a.spriteAtlas.bind(s,!0)}}var i=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,i){var a=t.gl;a.enable(a.STENCIL_TEST);var o;if(o=!r.paint["fill-pattern"]&&r.isPaintValueFeatureConstant("fill-color")&&r.isPaintValueFeatureConstant("fill-opacity")&&1===r.paint["fill-color"][3]&&1===r.paint["fill-opacity"],t.isOpaquePass===o){t.setDepthSublayer(1);for(var s=0;s<i.length;s++)!function(t,e,r,i){var a=e.getTile(i),o=a.getBucket(r);if(o){var s=o.bufferGroups.fill;if(s){var l,c=t.gl,u=r.paint["fill-pattern"];if(u)l=t.useProgram("pattern"),n(u,r.paint["fill-opacity"],a,i,t,l),c.activeTexture(c.TEXTURE0),t.spriteAtlas.bind(c,!0);else{var h=o.paintAttributes.fill[r.id];l=t.useProgram("fill",h.defines,h.vertexPragmas,h.fragmentPragmas),o.setUniforms(c,"fill",l,r,{zoom:t.transform.zoom})}c.uniformMatrix4fv(l.u_matrix,!1,t.translatePosMatrix(i.posMatrix,a,r.paint["fill-translate"],r.paint["fill-translate-anchor"])),t.enableTileClippingMask(i);for(var f=0;f<s.length;f++){var d=s[f];d.vaos[r.id].bind(c,l,d.layoutVertexBuffer,d.elementBuffer,d.paintVertexBuffers[r.id]),c.drawElements(c.TRIANGLES,d.elementBuffer.length,c.UNSIGNED_SHORT,0)}}}}(t,e,r,i[s])}if(!t.isOpaquePass&&r.paint["fill-antialias"]){t.lineWidth(2),t.depthMask(!1);var l=r.getPaintProperty("fill-outline-color");!l&&r.paint["fill-pattern"]||!l?t.setDepthSublayer(0):t.setDepthSublayer(2);for(var c=0;c<i.length;c++)!function(t,e,r,i){var a=e.getTile(i),o=a.getBucket(r);if(o){var s,l=t.gl,c=o.bufferGroups.fill,u=r.paint["fill-pattern"],h=r.paint["fill-opacity"],f=r.getPaintProperty("fill-outline-color");if(u&&!f)s=t.useProgram("outlinepattern"),l.uniform2f(s.u_world,l.drawingBufferWidth,l.drawingBufferHeight);else{var d=o.paintAttributes.fill[r.id];s=t.useProgram("outline",d.defines,d.vertexPragmas,d.fragmentPragmas),l.uniform2f(s.u_world,l.drawingBufferWidth,l.drawingBufferHeight),l.uniform1f(s.u_opacity,h),o.setUniforms(l,"fill",s,r,{zoom:t.transform.zoom})}l.uniformMatrix4fv(s.u_matrix,!1,t.translatePosMatrix(i.posMatrix,a,r.paint["fill-translate"],r.paint["fill-translate-anchor"])),u&&n(u,h,a,i,t,s),t.enableTileClippingMask(i);for(var p=0;p<c.length;p++){var m=c[p];m.secondVaos[r.id].bind(l,s,m.layoutVertexBuffer,m.elementBuffer2,m.paintVertexBuffers[r.id]),l.drawElements(l.LINES,2*m.elementBuffer2.length,l.UNSIGNED_SHORT,0)}}}(t,e,r,i[c])}}},{"../source/pixels_to_tile_units":364}],351:[function(t,e,r){"use strict";var n=t("../util/browser"),i=t("gl-matrix").mat2,a=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,o){if(!t.isOpaquePass){t.setDepthSublayer(0),t.depthMask(!1);var s=t.gl;if(s.enable(s.STENCIL_TEST),!(r.paint["line-width"]<=0)){var l=1/n.devicePixelRatio,c=r.paint["line-blur"]+l,u=r.paint["line-color"],h=t.transform,f=i.create();i.scale(f,f,[1,Math.cos(h._pitch)]),i.rotate(f,f,t.transform.angle);var d,p,m,g,v,y=Math.sqrt(h.height*h.height/4*(1+h.altitude*h.altitude)),b=(y+h.height/2*Math.tan(h._pitch))/y-1,x=r.paint["line-dasharray"],_=r.paint["line-pattern"];if(x)d=t.useProgram("linesdfpattern"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,c),s.uniform4fv(d.u_color,u),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),p=t.lineAtlas.getDash(x.from,"round"===r.layout["line-cap"]),m=t.lineAtlas.getDash(x.to,"round"===r.layout["line-cap"]),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.lineAtlas.bind(s),s.uniform1f(d.u_tex_y_a,p.y),s.uniform1f(d.u_tex_y_b,m.y),s.uniform1f(d.u_mix,x.t),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f);else if(_){if(g=t.spriteAtlas.getPosition(_.from,!0),v=t.spriteAtlas.getPosition(_.to,!0),!g||!v)return;d=t.useProgram("linepattern"),s.uniform1i(d.u_image,0),s.activeTexture(s.TEXTURE0),t.spriteAtlas.bind(s,!0),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,c),s.uniform2fv(d.u_pattern_tl_a,g.tl),s.uniform2fv(d.u_pattern_br_a,g.br),s.uniform2fv(d.u_pattern_tl_b,v.tl),s.uniform2fv(d.u_pattern_br_b,v.br),s.uniform1f(d.u_fade,_.t),s.uniform1f(d.u_opacity,r.paint["line-opacity"]),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f)}else d=t.useProgram("line"),s.uniform1f(d.u_linewidth,r.paint["line-width"]/2),s.uniform1f(d.u_gapwidth,r.paint["line-gap-width"]/2),s.uniform1f(d.u_antialiasing,l/2),s.uniform1f(d.u_blur,c),s.uniform1f(d.u_extra,b),s.uniform1f(d.u_offset,-r.paint["line-offset"]),s.uniformMatrix2fv(d.u_antialiasingmatrix,!1,f),s.uniform4fv(d.u_color,u),s.uniform1f(d.u_opacity,r.paint["line-opacity"]);for(var w=0;w<o.length;w++){var M=o[w],k=e.getTile(M),T=k.getBucket(r);if(T){var A=T.bufferGroups.line;if(A){t.enableTileClippingMask(M);var S=t.translatePosMatrix(M.posMatrix,k,r.paint["line-translate"],r.paint["line-translate-anchor"]);s.uniformMatrix4fv(d.u_matrix,!1,S);var E=1/a(k,1,t.transform.zoom);if(x){var L=p.width*x.fromScale,C=m.width*x.toScale,I=[1/a(k,L,t.transform.tileZoom),-p.height/2],P=[1/a(k,C,t.transform.tileZoom),-m.height/2],D=t.lineAtlas.width/(256*Math.min(L,C)*n.devicePixelRatio)/2;s.uniform1f(d.u_ratio,E),s.uniform2fv(d.u_patternscale_a,I),s.uniform2fv(d.u_patternscale_b,P),s.uniform1f(d.u_sdfgamma,D)}else _?(s.uniform1f(d.u_ratio,E),s.uniform2fv(d.u_pattern_size_a,[a(k,g.size[0]*_.fromScale,t.transform.tileZoom),v.size[1]]),s.uniform2fv(d.u_pattern_size_b,[a(k,v.size[0]*_.toScale,t.transform.tileZoom),v.size[1]])):s.uniform1f(d.u_ratio,E);for(var z=0;z<A.length;z++){var O=A[z];O.vaos[r.id].bind(s,d,O.layoutVertexBuffer,O.elementBuffer),s.drawElements(s.TRIANGLES,3*O.elementBuffer.length,s.UNSIGNED_SHORT,0)}}}}}}}},{"../source/pixels_to_tile_units":364,"../util/browser":427,"gl-matrix":194}],352:[function(t,e,r){"use strict";function n(t,e,r,n){if(!t.isOpaquePass){var a=t.gl;a.enable(a.DEPTH_TEST),t.depthMask(!0),a.depthFunc(a.LESS);for(var o=n.length&&n[0].z,s=0;s<n.length;s++){var l=n[s];t.setDepthSublayer(l.z-o),function(t,e,r,n){var a=t.gl;a.disable(a.STENCIL_TEST);var o=e.getTile(n),s=t.transform.calculatePosMatrix(n,e.maxzoom),l=t.useProgram("raster");a.uniformMatrix4fv(l.u_matrix,!1,s),a.uniform1f(l.u_brightness_low,r.paint["raster-brightness-min"]),a.uniform1f(l.u_brightness_high,r.paint["raster-brightness-max"]),a.uniform1f(l.u_saturation_factor,function(t){return t>0?1-1/(1.001-t):-t}(r.paint["raster-saturation"])),a.uniform1f(l.u_contrast_factor,function(t){return t>0?1/(1-t):1+t}(r.paint["raster-contrast"])),a.uniform3fv(l.u_spin_weights,function(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]}(r.paint["raster-hue-rotate"]));var c,u,h=o.source&&o.source.findLoadedParent(n,0,{}),f=function(t,e,r,n){var a=[1,0],o=r.paint["raster-fade-duration"];if(t.source&&o>0){var s=(new Date).getTime(),l=(s-t.timeAdded)/o,c=e?(s-e.timeAdded)/o:-1,u=n.coveringZoomLevel(t.source),h=!!e&&Math.abs(e.coord.z-u)>Math.abs(t.coord.z-u);!e||h?(a[0]=i.clamp(l,0,1),a[1]=1-a[0]):(a[0]=i.clamp(1-c,0,1),a[1]=1-a[0])}var f=r.paint["raster-opacity"];return a[0]*=f,a[1]*=f,a}(o,h,r,t.transform);a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,o.texture),a.activeTexture(a.TEXTURE1),h?(a.bindTexture(a.TEXTURE_2D,h.texture),c=Math.pow(2,h.coord.z-o.coord.z),u=[o.coord.x*c%1,o.coord.y*c%1]):(a.bindTexture(a.TEXTURE_2D,o.texture),f[1]=0);a.uniform2fv(l.u_tl_parent,u||[0,0]),a.uniform1f(l.u_scale_parent,c||1),a.uniform1f(l.u_buffer_scale,1),a.uniform1f(l.u_opacity0,f[0]),a.uniform1f(l.u_opacity1,f[1]),a.uniform1i(l.u_image0,0),a.uniform1i(l.u_image1,1);var d=o.boundsBuffer||t.rasterBoundsBuffer;(o.boundsVAO||t.rasterBoundsVAO).bind(a,l,d),a.drawArrays(a.TRIANGLE_STRIP,0,d.length)}(t,e,r,l)}a.depthFunc(a.LEQUAL)}}var i=t("../util/util"),a=t("../util/struct_array");e.exports=n,n.RasterBoundsArray=new a({members:[{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]})},{"../util/struct_array":441,"../util/util":443}],353:[function(t,e,r){"use strict";function n(t,e,r,n,a,s,l,c,u,h,f,d,p,m,g){for(var v=0;v<n.length;v++){var y=e.getTile(n[v]),b=y.getBucket(r);if(b){var x=b.bufferGroups,_=a?x.glyph:x.icon;_.length&&(t.enableTileClippingMask(n[v]),function(t,e,r,n,a,s,l,c,u,h,f,d,p,m,g,v,y,b,x,_,w){var M,k,T,A=t.gl,S=t.transform,E="map"===m,L="map"===g,C=l?24:1,I=v/C;L?(k=o(n,1,t.transform.zoom)*I,T=1/Math.cos(S._pitch),M=[k,k]):(k=t.transform.altitude*I,T=1,M=[S.pixelsToGLUnits[0]*k,S.pixelsToGLUnits[1]*k]);if(!l&&!t.style.sprite.loaded())return;var P=t.useProgram(c?"sdf":"icon");if(A.uniformMatrix4fv(P.u_matrix,!1,t.translatePosMatrix(r,n,d,p)),A.uniform1i(P.u_rotate_with_map,E),A.uniform1i(P.u_pitch_with_map,L),A.uniform2fv(P.u_extrude_scale,M),A.activeTexture(A.TEXTURE0),A.uniform1i(P.u_texture,0),l){var D=f&&t.glyphSource.getGlyphAtlas(f);if(!D)return;D.updateTexture(A),A.uniform2f(P.u_texsize,D.width/4,D.height/4)}else{var z=t.options.rotating||t.options.zooming,O=1!==I||i.devicePixelRatio!==t.spriteAtlas.pixelRatio||u,F=L||t.transform.pitch;t.spriteAtlas.bind(A,c||z||O||F),A.uniform2f(P.u_texsize,t.spriteAtlas.width/4,t.spriteAtlas.height/4)}var R=Math.log(v/h)/Math.LN2||0;A.uniform1f(P.u_zoom,10*(t.transform.zoom-R)),A.activeTexture(A.TEXTURE1),t.frameHistory.bind(A),A.uniform1i(P.u_fadetexture,1);var j;if(c){var N=.105*C/v/i.devicePixelRatio;if(y){A.uniform1f(P.u_gamma,(1.19*x/I/8+N)*T),A.uniform4fv(P.u_color,b),A.uniform1f(P.u_opacity,_),A.uniform1f(P.u_buffer,(6-y/I)/8);for(var B=0;B<s.length;B++)(j=s[B]).vaos[e.id].bind(A,P,j.layoutVertexBuffer,j.elementBuffer),A.drawElements(A.TRIANGLES,3*j.elementBuffer.length,A.UNSIGNED_SHORT,0)}A.uniform1f(P.u_gamma,N*T),A.uniform4fv(P.u_color,w),A.uniform1f(P.u_opacity,_),A.uniform1f(P.u_buffer,.75),A.uniform1f(P.u_pitch,S.pitch/360*2*Math.PI),A.uniform1f(P.u_bearing,S.bearing/360*2*Math.PI),A.uniform1f(P.u_aspect_ratio,S.width/S.height);for(var U=0;U<s.length;U++)(j=s[U]).vaos[e.id].bind(A,P,j.layoutVertexBuffer,j.elementBuffer),A.drawElements(A.TRIANGLES,3*j.elementBuffer.length,A.UNSIGNED_SHORT,0)}else{A.uniform1f(P.u_opacity,_);for(var V=0;V<s.length;V++)(j=s[V]).vaos[e.id].bind(A,P,j.layoutVertexBuffer,j.elementBuffer),A.drawElements(A.TRIANGLES,3*j.elementBuffer.length,A.UNSIGNED_SHORT,0)}}(t,r,n[v].posMatrix,y,0,_,a,a||b.sdfIcons,!a&&b.iconsNeedLinear,a?b.adjustedTextSize:b.adjustedIconSize,b.fontstack,s,l,c,u,h,f,d,p,m,g))}}}var i=t("../util/browser"),a=t("./draw_collision_debug"),o=t("../source/pixels_to_tile_units");e.exports=function(t,e,r,i){if(!t.isOpaquePass){var o=!(r.layout["text-allow-overlap"]||r.layout["icon-allow-overlap"]||r.layout["text-ignore-placement"]||r.layout["icon-ignore-placement"]),s=t.gl;o?s.disable(s.STENCIL_TEST):s.enable(s.STENCIL_TEST),t.setDepthSublayer(0),t.depthMask(!1),s.disable(s.DEPTH_TEST),n(t,e,r,i,!1,r.paint["icon-translate"],r.paint["icon-translate-anchor"],r.layout["icon-rotation-alignment"],r.layout["icon-rotation-alignment"],r.layout["icon-size"],r.paint["icon-halo-width"],r.paint["icon-halo-color"],r.paint["icon-halo-blur"],r.paint["icon-opacity"],r.paint["icon-color"]),n(t,e,r,i,!0,r.paint["text-translate"],r.paint["text-translate-anchor"],r.layout["text-rotation-alignment"],r.layout["text-pitch-alignment"],r.layout["text-size"],r.paint["text-halo-width"],r.paint["text-halo-color"],r.paint["text-halo-blur"],r.paint["text-opacity"],r.paint["text-color"]),s.enable(s.DEPTH_TEST),e.map.showCollisionBoxes&&a(t,e,r,i)}}},{"../source/pixels_to_tile_units":364,"../util/browser":427,"./draw_collision_debug":348}],354:[function(t,e,r){"use strict";function n(){this.changeTimes=new Float64Array(256),this.changeOpacities=new Uint8Array(256),this.opacities=new Uint8ClampedArray(256),this.array=new Uint8Array(this.opacities.buffer),this.fadeDuration=300,this.previousZoom=0,this.firstFrame=!0}e.exports=n,n.prototype.record=function(t){var e=Date.now();this.firstFrame&&(e=0,this.firstFrame=!1);var r;if((t=Math.floor(10*t))<this.previousZoom)for(r=t+1;r<=this.previousZoom;r++)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];else for(r=t;r>this.previousZoom;r--)this.changeTimes[r]=e,this.changeOpacities[r]=this.opacities[r];for(r=0;r<256;r++){var n=(e-this.changeTimes[r])/this.fadeDuration*255;this.opacities[r]=r<=t?this.changeOpacities[r]+n:this.changeOpacities[r]-n}this.changed=!0,this.previousZoom=t},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.changed&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,256,1,t.ALPHA,t.UNSIGNED_BYTE,this.array),this.changed=!1)):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),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),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,256,1,0,t.ALPHA,t.UNSIGNED_BYTE,this.array))}},{}],355:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.nextRow=0,this.bytes=4,this.data=new Uint8Array(this.width*this.height*this.bytes),this.positions={}}var i=t("../util/util");e.exports=n,n.prototype.setSprite=function(t){this.sprite=t},n.prototype.getDash=function(t,e){var r=t.join(",")+e;return this.positions[r]||(this.positions[r]=this.addDash(t,e)),this.positions[r]},n.prototype.addDash=function(t,e){var r=e?7:0,n=2*r+1;if(this.nextRow+n>this.height)return i.warnOnce("LineAtlas out of space"),null;for(var a=0,o=0;o<t.length;o++)a+=t[o];for(var s=this.width/a,l=s/2,c=t.length%2==1,u=-r;u<=r;u++)for(var h=this.nextRow+r+u,f=this.width*h,d=c?-t[t.length-1]:0,p=t[0],m=1,g=0;g<this.width;g++){for(;p<g/s;)d=p,p+=t[m],c&&m===t.length-1&&(p+=t[0]),m++;var v,y=Math.abs(g-d*s),b=Math.abs(g-p*s),x=Math.min(y,b),_=m%2==1;if(e){var w=r?u/r*(l+1):0;if(_){var M=l-Math.abs(w);v=Math.sqrt(x*x+M*M)}else v=l-Math.sqrt(x*x+w*w)}else v=(_?1:-1)*x;this.data[3+4*(f+g)]=Math.max(0,Math.min(255,v+128))}var k={y:(this.nextRow+r+.5)/this.height,height:2*r/this.height,width:a};return this.nextRow+=n,this.dirty=!0,k},n.prototype.bind=function(t){this.texture?(t.bindTexture(t.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.RGBA,t.UNSIGNED_BYTE,this.data))):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_S,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_WRAP_T,t.REPEAT),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width,this.height,0,t.RGBA,t.UNSIGNED_BYTE,this.data))}},{"../util/util":443}],356:[function(t,e,r){"use strict";function n(t,e){this.gl=t,this.transform=e,this.reusableTextures={},this.preFbos={},this.frameHistory=new o,this.setup(),this.numSublayers=s.maxUnderzooming+s.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE)}var i=t("../util/browser"),a=t("gl-matrix").mat4,o=t("./frame_history"),s=t("../source/source_cache"),l=t("../data/bucket").EXTENT,c=t("../source/pixels_to_tile_units"),u=t("../util/util"),h=t("../util/struct_array"),f=t("../data/buffer"),d=t("./vertex_array_object"),p=t("./draw_raster").RasterBoundsArray,m=t("./create_uniform_pragmas");e.exports=n,u.extend(n.prototype,t("./painter/use_program")),n.prototype.resize=function(t,e){var r=this.gl;this.width=t*i.devicePixelRatio,this.height=e*i.devicePixelRatio,r.viewport(0,0,this.width,this.height)},n.prototype.setup=function(){var t=this.gl;t.verbose=!0,t.enable(t.BLEND),t.blendFunc(t.ONE,t.ONE_MINUS_SRC_ALPHA),t.enable(t.STENCIL_TEST),t.enable(t.DEPTH_TEST),t.depthFunc(t.LEQUAL),this._depthMask=!1,t.depthMask(!1);var e=this.PosArray=new h({members:[{name:"a_pos",type:"Int16",components:2}]}),r=new e;r.emplaceBack(0,0),r.emplaceBack(l,0),r.emplaceBack(0,l),r.emplaceBack(l,l),this.tileExtentBuffer=new f(r.serialize(),e.serialize(),f.BufferType.VERTEX),this.tileExtentVAO=new d,this.tileExtentPatternVAO=new d;var n=new e;n.emplaceBack(0,0),n.emplaceBack(l,0),n.emplaceBack(l,l),n.emplaceBack(0,l),n.emplaceBack(0,0),this.debugBuffer=new f(n.serialize(),e.serialize(),f.BufferType.VERTEX),this.debugVAO=new d;var i=new p;i.emplaceBack(0,0,0,0),i.emplaceBack(l,0,32767,0),i.emplaceBack(0,l,0,32767),i.emplaceBack(l,l,32767,32767),this.rasterBoundsBuffer=new f(i.serialize(),p.serialize(),f.BufferType.VERTEX),this.rasterBoundsVAO=new d},n.prototype.clearColor=function(){var t=this.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT)},n.prototype.clearStencil=function(){var t=this.gl;t.clearStencil(0),t.stencilMask(255),t.clear(t.STENCIL_BUFFER_BIT)},n.prototype.clearDepth=function(){var t=this.gl;t.clearDepth(1),this.depthMask(!0),t.clear(t.DEPTH_BUFFER_BIT)},n.prototype._renderTileClippingMasks=function(t){var e=this.gl;e.colorMask(!1,!1,!1,!1),this.depthMask(!1),e.disable(e.DEPTH_TEST),e.enable(e.STENCIL_TEST),e.stencilMask(248),e.stencilOp(e.KEEP,e.KEEP,e.REPLACE);var r=1;this._tileClippingMaskIDs={};for(var n=0;n<t.length;n++){var i=t[n],a=this._tileClippingMaskIDs[i.id]=r++<<3;e.stencilFunc(e.ALWAYS,a,248);var o=m([{name:"u_color",components:4},{name:"u_opacity",components:1}]),s=this.useProgram("fill",[],o,o);e.uniformMatrix4fv(s.u_matrix,!1,i.posMatrix),this.tileExtentVAO.bind(e,s,this.tileExtentBuffer),e.drawArrays(e.TRIANGLE_STRIP,0,this.tileExtentBuffer.length)}e.stencilMask(0),e.colorMask(!0,!0,!0,!0),this.depthMask(!0),e.enable(e.DEPTH_TEST)},n.prototype.enableTileClippingMask=function(t){var e=this.gl;e.stencilFunc(e.EQUAL,this._tileClippingMaskIDs[t.id],248)},n.prototype.prepareBuffers=function(){},n.prototype.bindDefaultFramebuffer=function(){var t=this.gl;t.bindFramebuffer(t.FRAMEBUFFER,null)};var g={symbol:t("./draw_symbol"),circle:t("./draw_circle"),line:t("./draw_line"),fill:t("./draw_fill"),raster:t("./draw_raster"),background:t("./draw_background"),debug:t("./draw_debug")};n.prototype.render=function(t,e){this.style=t,this.options=e,this.lineAtlas=t.lineAtlas,this.spriteAtlas=t.spriteAtlas,this.spriteAtlas.setSprite(t.sprite),this.glyphSource=t.glyphSource,this.frameHistory.record(this.transform.zoom),this.prepareBuffers(),this.clearColor(),this.clearDepth(),this.showOverdrawInspector(e.showOverdrawInspector),this.depthRange=(t._order.length+2)*this.numSublayers*this.depthEpsilon,this.renderPass({isOpaquePass:!0}),this.renderPass({isOpaquePass:!1})},n.prototype.renderPass=function(t){var e=this.style._groups,r=t.isOpaquePass;this.currentLayer=r?this.style._order.length:-1;for(var n=0;n<e.length;n++){var i,a=e[r?e.length-1-n:n],o=this.style.sources[a.source],s=[];if(o){for(s=o.getVisibleCoordinates(),i=0;i<s.length;i++)s[i].posMatrix=this.transform.calculatePosMatrix(s[i],o.maxzoom);this.clearStencil(),o.prepare&&o.prepare(),o.isTileClipped&&this._renderTileClippingMasks(s)}for(r?(this._showOverdrawInspector||this.gl.disable(this.gl.BLEND),this.isOpaquePass=!0):(this.gl.enable(this.gl.BLEND),this.isOpaquePass=!1,s.reverse()),i=0;i<a.length;i++){var l=a[r?a.length-1-i:i];this.currentLayer+=r?-1:1,this.renderLayer(this,o,l,s)}o&&g.debug(this,o,s)}},n.prototype.depthMask=function(t){t!==this._depthMask&&(this._depthMask=t,this.gl.depthMask(t))},n.prototype.renderLayer=function(t,e,r,n){r.isHidden(this.transform.zoom)||("background"===r.type||n.length)&&(this.id=r.id,g[r.type](t,e,r,n))},n.prototype.setDepthSublayer=function(t){var e=1-((1+this.currentLayer)*this.numSublayers+t)*this.depthEpsilon,r=e-1+this.depthRange;this.gl.depthRange(r,e)},n.prototype.translatePosMatrix=function(t,e,r,n){if(!r[0]&&!r[1])return t;if("viewport"===n){var i=Math.sin(-this.transform.angle),o=Math.cos(-this.transform.angle);r=[r[0]*o-r[1]*i,r[0]*i+r[1]*o]}var s=[c(e,r[0],this.transform.zoom),c(e,r[1],this.transform.zoom),0],l=new Float32Array(16);return a.translate(l,t,s),l},n.prototype.saveTexture=function(t){var e=this.reusableTextures[t.size];e?e.push(t):this.reusableTextures[t.size]=[t]},n.prototype.getTexture=function(t){var e=this.reusableTextures[t];return e&&e.length>0?e.pop():null},n.prototype.lineWidth=function(t){this.gl.lineWidth(u.clamp(t,this.lineWidthRange[0],this.lineWidthRange[1]))},n.prototype.showOverdrawInspector=function(t){if(t||this._showOverdrawInspector){this._showOverdrawInspector=t;var e=this.gl;if(t){e.blendFunc(e.CONSTANT_COLOR,e.ONE);e.blendColor(1/8,1/8,1/8,0),e.clearColor(0,0,0,1),e.clear(e.COLOR_BUFFER_BIT)}else e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA)}}},{"../data/bucket":330,"../data/buffer":335,"../source/pixels_to_tile_units":364,"../source/source_cache":368,"../util/browser":427,"../util/struct_array":441,"../util/util":443,"./create_uniform_pragmas":345,"./draw_background":346,"./draw_circle":347,"./draw_debug":349,"./draw_fill":350,"./draw_line":351,"./draw_raster":352,"./draw_symbol":353,"./frame_history":354,"./painter/use_program":357,"./vertex_array_object":358,"gl-matrix":194}],357:[function(t,e,r){"use strict";function n(t,e){return t.replace(/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,function(t,r,n,i,a){return e[r][a].replace(/{type}/g,i).replace(/{precision}/g,n)})}var i=t("assert"),a=t("../../util/util"),o=t("mapbox-gl-shaders"),s=o.util;e.exports._createProgram=function(t,e,r,l){for(var c=this.gl,u=c.createProgram(),h=o[t],f="#define MAPBOX_GL_JS;\n",d=0;d<e.length;d++)f+="#define "+e[d]+";\n";var p=c.createShader(c.FRAGMENT_SHADER);c.shaderSource(p,n(f+h.fragmentSource,l)),c.compileShader(p),i(c.getShaderParameter(p,c.COMPILE_STATUS),c.getShaderInfoLog(p)),c.attachShader(u,p);var m=c.createShader(c.VERTEX_SHADER);c.shaderSource(m,n(f+s+h.vertexSource,r)),c.compileShader(m),i(c.getShaderParameter(m,c.COMPILE_STATUS),c.getShaderInfoLog(m)),c.attachShader(u,m),c.linkProgram(u),i(c.getProgramParameter(u,c.LINK_STATUS),c.getProgramInfoLog(u));for(var g={},v=c.getProgramParameter(u,c.ACTIVE_ATTRIBUTES),y=0;y<v;y++){var b=c.getActiveAttrib(u,y);g[b.name]=c.getAttribLocation(u,b.name)}for(var x={},_=c.getProgramParameter(u,c.ACTIVE_UNIFORMS),w=0;w<_;w++){var M=c.getActiveUniform(u,w);x[M.name]=c.getUniformLocation(u,M.name)}return a.extend({program:u,definition:h,attributes:g,numAttributes:v},g,x)},e.exports._createProgramCached=function(t,e,r,n){this.cache=this.cache||{};var i=JSON.stringify({name:t,defines:e,vertexPragmas:r,fragmentPragmas:n});return this.cache[i]||(this.cache[i]=this._createProgram(t,e,r,n)),this.cache[i]},e.exports.useProgram=function(t,e,r,n){var i=this.gl;e=e||[],this._showOverdrawInspector&&(e=e.concat("OVERDRAW_INSPECTOR"));var a=this._createProgramCached(t,e,r,n);return this.currentProgram!==a&&(i.useProgram(a.program),this.currentProgram=a),a}},{"../../util/util":443,assert:48,"mapbox-gl-shaders":304}],358:[function(t,e,r){"use strict";function n(){this.boundProgram=null,this.boundVertexBuffer=null,this.boundVertexBuffer2=null,this.boundElementBuffer=null,this.vao=null}var i=t("assert");e.exports=n,n.prototype.bind=function(t,e,r,n,i){void 0===t.extVertexArrayObject&&(t.extVertexArrayObject=t.getExtension("OES_vertex_array_object"));var a=!this.vao||this.boundProgram!==e||this.boundVertexBuffer!==r||this.boundVertexBuffer2!==i||this.boundElementBuffer!==n;!t.extVertexArrayObject||a?this.freshBind(t,e,r,n,i):t.extVertexArrayObject.bindVertexArrayOES(this.vao)},n.prototype.freshBind=function(t,e,r,n,a){var o,s=e.numAttributes;if(t.extVertexArrayObject)this.vao&&this.destroy(t),this.vao=t.extVertexArrayObject.createVertexArrayOES(),t.extVertexArrayObject.bindVertexArrayOES(this.vao),o=0,this.boundProgram=e,this.boundVertexBuffer=r,this.boundVertexBuffer2=a,this.boundElementBuffer=n;else{o=t.currentNumAttributes||0;for(var l=s;l<o;l++)i(0!==l),t.disableVertexAttribArray(l)}for(var c=o;c<s;c++)t.enableVertexAttribArray(c);r.bind(t),r.setVertexAttribPointers(t,e),a&&(a.bind(t),a.setVertexAttribPointers(t,e)),n&&n.bind(t),t.currentNumAttributes=s},n.prototype.unbind=function(t){var e=t.extVertexArrayObject;e&&e.bindVertexArrayOES(null)},n.prototype.destroy=function(t){var e=t.extVertexArrayObject;e&&this.vao&&(e.deleteVertexArrayOES(this.vao),this.vao=null)}},{assert:48}],359:[function(t,e,r){"use strict";function n(t,e,r){e=e||{},this.id=t,this.dispatcher=r,this._data=e.data,void 0!==e.maxzoom&&(this.maxzoom=e.maxzoom),e.type&&(this.type=e.type);var n=s/this.tileSize;this.workerOptions=a.extend({source:this.id,cluster:e.cluster||!1,geojsonVtOptions:{buffer:(void 0!==e.buffer?e.buffer:128)*n,tolerance:(void 0!==e.tolerance?e.tolerance:.375)*n,extent:s,maxZoom:this.maxzoom},superclusterOptions:{maxZoom:Math.min(e.clusterMaxZoom,this.maxzoom-1)||this.maxzoom-1,extent:s,radius:(e.clusterRadius||50)*n,log:!1}},e.workerOptions),this._updateWorkerData(function(t){t?this.fire("error",{error:t}):this.fire("load")}.bind(this))}var i=t("../util/evented"),a=t("../util/util"),o=t("resolve-url"),s=t("../data/bucket").EXTENT;e.exports=n,n.prototype=a.inherit(i,{type:"geojson",minzoom:0,maxzoom:18,tileSize:512,isTileClipped:!0,reparseOverscaled:!0,onAdd:function(t){this.map=t},setData:function(t){return this._data=t,this._updateWorkerData(function(t){if(t)return this.fire("error",{error:t});this.fire("change")}.bind(this)),this},_updateWorkerData:function(t){var e=a.extend({},this.workerOptions),r=this._data;"string"==typeof r?e.url="undefined"!=typeof window?o(window.location.href,r):r:e.data=JSON.stringify(r),this.workerID=this.dispatcher.send(this.type+".loadData",e,function(e){this._loaded=!0,t(e)}.bind(this))},loadTile:function(t,e){var r=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,n={type:this.type,uid:t.uid,coord:t.coord,zoom:t.coord.z,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,overscaling:r,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send("load tile",n,function(r,n){if(t.unloadVectorData(this.map.painter),!t.aborted)return r?e(r):(t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null))}.bind(this),this.workerID)},abortTile:function(t){t.aborted=!0},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},function(){},t.workerID)},serialize:function(){return{type:this.type,data:this._data}}})},{"../data/bucket":330,"../util/evented":435,"../util/util":443,"resolve-url":510}],360:[function(t,e,r){"use strict";function n(t,e,r){r&&(this.loadGeoJSON=r),h.call(this,t,e)}var i=t("../util/util"),a=t("../util/ajax"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),c=t("supercluster"),u=t("geojson-vt"),h=t("./vector_tile_worker_source");e.exports=n,n.prototype=i.inherit(h,{_geoJSONIndexes:{},loadVectorData:function(t,e){var r=t.source,n=t.coord;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(Math.min(n.z,t.maxZoom),n.x,n.y);if(!i)return e(null,null);var a=new s(i.features);a.name="_geojsonTileLayer";var o=l({layers:{_geojsonTileLayer:a}});0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{tile:a,rawTileData:o.buffer})},loadData:function(t,e){var r=function(r,n){return r?e(r):"object"!=typeof n?e(new Error("Input data is not a valid GeoJSON object.")):(o(n,!0),void this._indexData(n,t,function(r,n){if(r)return e(r);this._geoJSONIndexes[t.source]=n,e(null)}.bind(this)))}.bind(this);this.loadGeoJSON(t,r)},loadGeoJSON:function(t,e){if(t.url)a.getJSON(t.url,e);else{if("string"!=typeof t.data)return e(new Error("Input data is not a valid GeoJSON object."));try{return e(null,JSON.parse(t.data))}catch(t){return e(new Error("Input data is not a valid GeoJSON object."))}}},_indexData:function(t,e,r){try{e.cluster?r(null,c(e.superclusterOptions).load(t.features)):r(null,u(t,e.geojsonVtOptions))}catch(t){return r(t)}}})},{"../util/ajax":426,"../util/util":443,"./geojson_wrapper":361,"./vector_tile_worker_source":372,"geojson-rewind":139,"geojson-vt":143,supercluster:538,"vt-pbf":565}],361:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length,this.extent=s}function i(t){if(this.type=t.type,1===t.type){this.rawGeometry=[];for(var e=0;e<t.geometry.length;e++)this.rawGeometry.push([t.geometry[e]])}else this.rawGeometry=t.geometry;this.properties=t.tags,this.extent=s}var a=t("point-geometry"),o=t("vector-tile").VectorTileFeature,s=t("../data/bucket").EXTENT;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new a(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},i.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,a=0;a<t.length;a++)for(var o=t[a],s=0;s<o.length;s++){var l=o[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},i.prototype.toGeoJSON=o.prototype.toGeoJSON},{"../data/bucket":330,"point-geometry":485,"vector-tile":559}],362:[function(t,e,r){"use strict";function n(t,e,r){this.id=t,this.dispatcher=r,this.url=e.url,this.coordinates=e.coordinates,c.getImage(e.url,function(t,r){if(t)return this.fire("error",{error:t});this.image=r,this.image.addEventListener("load",function(){this.map._rerender()}.bind(this)),this._loaded=!0,this.fire("load"),this.map&&this.setCoordinates(e.coordinates)}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),c=t("../util/ajax"),u=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,onAdd:function(t){this.map=t,this.image&&this.setCoordinates(this.coordinates)},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(o.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new a(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*u),Math.round((e.row-n.row)*u))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=new h;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new f(e.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(this._loaded&&this.image&&this.image.complete&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.image)):(this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),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),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.image))}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"image",urls:this.url,coordinates:this.coordinates}}})},{"../data/bucket":330,"../data/buffer":335,"../geo/lng_lat":340,"../render/draw_raster":352,"../render/vertex_array_object":358,"../util/ajax":426,"../util/evented":435,"../util/util":443,"./tile_coord":370,"point-geometry":485}],363:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/ajax"),a=t("../util/browser"),o=t("../util/mapbox").normalizeSourceURL;e.exports=function(t,e){var r=function(t,r){if(t)return e(t);var i=n.pick(r,["tiles","minzoom","maxzoom","attribution"]);r.vector_layers&&(i.vectorLayers=r.vector_layers,i.vectorLayerIds=i.vectorLayers.map(function(t){return t.id})),e(null,i)};t.url?i.getJSON(o(t.url),r):a.frame(r.bind(null,null,t))}},{"../util/ajax":426,"../util/browser":427,"../util/mapbox":440,"../util/util":443}],364:[function(t,e,r){"use strict";var n=t("../data/bucket");e.exports=function(t,e,r){return e*(n.EXTENT/(t.tileSize*Math.pow(2,r-t.coord.z)))}},{"../data/bucket":330}],365:[function(t,e,r){"use strict";function n(t,e){var r=t.coord,n=e.coord;return r.z-n.z||r.y-n.y||r.w-n.w||r.x-n.x}var i=t("./tile_coord");r.rendered=function(t,e,r,i,a,o){var s=t.tilesIn(r);s.sort(n);for(var l=[],c=0;c<s.length;c++){var u=s[c];u.tile.featureIndex&&l.push(u.tile.featureIndex.query({queryGeometry:u.queryGeometry,scale:u.scale,tileSize:u.tile.tileSize,bearing:o,params:i},e))}return function(t){for(var e=t[0]||{},r=1;r<t.length;r++){var n=t[r];for(var i in n){var a=n[i],o=e[i];if(void 0===o)o=e[i]=a;else for(var s=0;s<a.length;s++)o.push(a[s])}}return e}(l)},r.source=function(t,e){for(var r=t.getRenderableIds().map(function(e){return t.getTileByID(e)}),n=[],a={},o=0;o<r.length;o++){var s=r[o],l=new i(Math.min(s.sourceMaxZoom,s.coord.z),s.coord.x,s.coord.y,0).id;a[l]||(a[l]=!0,s.querySourceFeatures(n,e))}return n}},{"./tile_coord":370}],366:[function(t,e,r){"use strict";function n(t,e,r){this.id=t,this.dispatcher=r,i.extend(this,i.pick(e,["url","scheme","tileSize"])),s(e,function(t,e){if(t)return this.fire("error",t);i.extend(this,e),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("../util/ajax"),o=t("../util/evented"),s=t("./load_tilejson"),l=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=i.inherit(o,{minzoom:0,maxzoom:22,roundZoom:!0,scheme:"xyz",tileSize:512,_loaded:!1,onAdd:function(t){this.map=t},serialize:function(){return{type:"raster",url:this.url,tileSize:this.tileSize}},loadTile:function(t,e){var r=l(t.coord.url(this.tiles,null,this.scheme),this.url,this.tileSize);t.request=a.getImage(r,function(r,n){if(delete t.request,!t.aborted){if(r)return e(r);var i=this.map.painter.gl;t.texture=this.map.painter.getTexture(n.width),t.texture?(i.bindTexture(i.TEXTURE_2D,t.texture),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,n)):(t.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,t.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR_MIPMAP_NEAREST),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,n),t.texture.size=n.width),i.generateMipmap(i.TEXTURE_2D),this.map.animationLoop.set(this.map.style.rasterFadeDuration),t.state="loaded",e(null)}}.bind(this))},abortTile:function(t){t.request&&(t.request.abort(),delete t.request)},unloadTile:function(t){t.texture&&this.map.painter.saveTexture(t.texture)}})},{"../util/ajax":426,"../util/evented":435,"../util/mapbox":440,"../util/util":443,"./load_tilejson":363}],367:[function(t,e,r){"use strict";var n=t("../util/util"),i={vector:t("../source/vector_tile_source"),raster:t("../source/raster_tile_source"),geojson:t("../source/geojson_source"),video:t("../source/video_source"),image:t("../source/image_source")};r.create=function(t,e,r){if((e=new i[e.type](t,e,r)).id!==t)throw new Error("Expected Source id to be "+t+" instead of "+e.id);return n.bindAll(["load","abort","unload","serialize","prepare"],e),e},r.getType=function(t){return i[t]},r.setType=function(t,e){i[t]=e}},{"../source/geojson_source":359,"../source/image_source":362,"../source/raster_tile_source":366,"../source/vector_tile_source":371,"../source/video_source":373,"../util/util":443}],368:[function(t,e,r){"use strict";function n(t,e,r){this.id=t,this.dispatcher=r;var n=this._source=o.create(t,e,r).on("load",function(){this.map&&this._source.onAdd&&this._source.onAdd(this.map),this._sourceLoaded=!0,this.tileSize=n.tileSize,this.minzoom=n.minzoom,this.maxzoom=n.maxzoom,this.roundZoom=n.roundZoom,this.reparseOverscaled=n.reparseOverscaled,this.isTileClipped=n.isTileClipped,this.attribution=n.attribution,this.vectorLayerIds=n.vectorLayerIds,this.fire("load")}.bind(this)).on("error",function(t){this._sourceErrored=!0,this.fire("error",t)}.bind(this)).on("change",function(){this.reload(),this.transform&&this.update(this.transform,this.map&&this.map.style.rasterFadeDuration),this.fire("change")}.bind(this));this._tiles={},this._cache=new u(0,this.unloadTile.bind(this)),this._isIdRenderable=this._isIdRenderable.bind(this)}function i(t,e,r){var n=r.zoomTo(Math.min(t.z,e));return{x:(n.column-(t.x+t.w*Math.pow(2,t.z)))*d,y:(n.row-t.y)*d}}function a(t,e){return t%32-e%32}var o=t("./source"),s=t("./tile"),l=t("../util/evented"),c=t("./tile_coord"),u=t("../util/lru_cache"),h=t("../geo/coordinate"),f=t("../util/util"),d=t("../data/bucket").EXTENT;e.exports=n,n.maxOverzooming=10,n.maxUnderzooming=3,n.prototype=f.inherit(l,{onAdd:function(t){this.map=t,this._source&&this._source.onAdd&&this._source.onAdd(t)},loaded:function(){if(this._sourceErrored)return!0;if(!this._sourceLoaded)return!1;for(var t in this._tiles){var e=this._tiles[t];if("loaded"!==e.state&&"errored"!==e.state)return!1}return!0},getSource:function(){return this._source},loadTile:function(t,e){return this._source.loadTile(t,e)},unloadTile:function(t){if(this._source.unloadTile)return this._source.unloadTile(t)},abortTile:function(t){if(this._source.abortTile)return this._source.abortTile(t)},serialize:function(){return this._source.serialize()},prepare:function(){if(this._sourceLoaded&&this._source.prepare)return this._source.prepare()},getIds:function(){return Object.keys(this._tiles).map(Number).sort(a)},getRenderableIds:function(){return this.getIds().filter(this._isIdRenderable)},_isIdRenderable:function(t){return this._tiles[t].isRenderable()&&!this._coveredTiles[t]},reload:function(){this._cache.reset();for(var t in this._tiles){var e=this._tiles[t];"loading"!==e.state&&(e.state="reloading"),this.loadTile(this._tiles[t],this._tileLoaded.bind(this,this._tiles[t]))}},_tileLoaded:function(t,e){if(e)return t.state="errored",this.fire("tile.error",{tile:t,error:e}),void this._source.fire("tile.error",{tile:t,error:e});t.source=this,t.timeAdded=(new Date).getTime(),this.fire("tile.load",{tile:t}),this._source.fire("tile.load",{tile:t})},getTile:function(t){return this.getTileByID(t.id)},getTileByID:function(t){return this._tiles[t]},getZoom:function(t){return t.zoom+t.scaleZoom(t.tileSize/this.tileSize)},findLoadedChildren:function(t,e,r){var n=!1;for(var i in this._tiles){var a=this._tiles[i];if(!(r[i]||!a.isRenderable()||a.coord.z<=t.z||a.coord.z>e)){var o=Math.pow(2,Math.min(a.coord.z,this.maxzoom)-Math.min(t.z,this.maxzoom));if(Math.floor(a.coord.x/o)===t.x&&Math.floor(a.coord.y/o)===t.y)for(r[i]=!0,n=!0;a&&a.coord.z-1>t.z;){var s=a.coord.parent(this.maxzoom).id;(a=this._tiles[s])&&a.isRenderable()&&(delete r[i],r[s]=!0)}}}return n},findLoadedParent:function(t,e,r){for(var n=t.z-1;n>=e;n--){t=t.parent(this.maxzoom);var i=this._tiles[t.id];if(i&&i.isRenderable())return r[t.id]=!0,i;if(this._cache.has(t.id))return this.addTile(t),r[t.id]=!0,this._tiles[t.id]}},updateCacheSize:function(t){var e=(Math.ceil(t.width/t.tileSize)+1)*(Math.ceil(t.height/t.tileSize)+1);this._cache.setMaxSize(Math.floor(5*e))},update:function(t,e){if(this._sourceLoaded){var r,i,a;this.updateCacheSize(t);var o=(this.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-n.maxOverzooming,this.minzoom),l=Math.max(o+n.maxUnderzooming,this.minzoom),u={},h=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(r=0;r<d.length;r++)i=d[r],a=this.addTile(i),u[i.id]=!0,a.isRenderable()||this.findLoadedChildren(i,l,u)||this.findLoadedParent(i,s,u);for(var p={},m=Object.keys(u),g=0;g<m.length;g++){var v=m[g];i=c.fromID(v),(a=this._tiles[v])&&a.timeAdded>h-(e||0)&&(this.findLoadedChildren(i,l,u)&&(u[v]=!0),this.findLoadedParent(i,s,p))}var y;for(y in p)u[y]||(this._coveredTiles[y]=!0);for(y in p)u[y]=!0;var b=f.keysDifference(this._tiles,u);for(r=0;r<b.length;r++)this.removeTile(+b[r]);this.transform=t}},addTile:function(t){var e=this._tiles[t.id];if(e)return e;var r=t.wrapped();if((e=this._tiles[r.id])||(e=this._cache.get(r.id))&&this._redoPlacement&&this._redoPlacement(e),!e){var n=t.z,i=n>this.maxzoom?Math.pow(2,n-this.maxzoom):1;e=new s(r,this.tileSize*i,this.maxzoom),this.loadTile(e,this._tileLoaded.bind(this,e))}return e.uses++,this._tiles[t.id]=e,this.fire("tile.add",{tile:e}),this._source.fire("tile.add",{tile:e}),e},removeTile:function(t){var e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this.fire("tile.remove",{tile:e}),this._source.fire("tile.remove",{tile:e}),e.uses>0||(e.isRenderable()?this._cache.add(e.coord.wrapped().id,e):(e.aborted=!0,this.abortTile(e),this.unloadTile(e))))},clearTiles:function(){for(var t in this._tiles)this.removeTile(t);this._cache.reset()},tilesIn:function(t){for(var e={},r=this.getIds(),n=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0].zoom,u=0;u<t.length;u++){var f=t[u];n=Math.min(n,f.column),a=Math.min(a,f.row),o=Math.max(o,f.column),s=Math.max(s,f.row)}for(var p=0;p<r.length;p++){var m=this._tiles[r[p]],g=c.fromID(r[p]),v=[i(g,m.sourceMaxZoom,new h(n,a,l)),i(g,m.sourceMaxZoom,new h(o,s,l))];if(v[0].x<d&&v[0].y<d&&v[1].x>=0&&v[1].y>=0){for(var y=[],b=0;b<t.length;b++)y.push(i(g,m.sourceMaxZoom,t[b]));var x=e[m.coord.id];void 0===x&&(x=e[m.coord.id]={tile:m,coord:g,queryGeometry:[],scale:Math.pow(2,this.transform.zoom-m.coord.z)}),x.queryGeometry.push(y)}}var _=[];for(var w in e)_.push(e[w]);return _},redoPlacement:function(){for(var t=this.getIds(),e=0;e<t.length;e++){this.getTileByID(t[e]).redoPlacement(this)}},getVisibleCoordinates:function(){return this.getRenderableIds().map(c.fromID)}})},{"../data/bucket":330,"../geo/coordinate":339,"../util/evented":435,"../util/lru_cache":439,"../util/util":443,"./source":367,"./tile":369,"./tile_coord":370}],369:[function(t,e,r){"use strict";function n(t,e,r){this.coord=t,this.uid=a.uniqueId(),this.uses=0,this.tileSize=e,this.sourceMaxZoom=r,this.buckets={},this.state="loading"}function i(t,e){if(e){for(var r={},n=0;n<t.length;n++){var i=e.getLayer(t[n].layerId);if(i){var s=o.create(a.extend({layer:i,childLayers:t[n].childLayerIds.map(e.getLayer.bind(e)).filter(function(t){return t})},t[n]));r[s.id]=s}}return r}}var a=t("../util/util"),o=t("../data/bucket"),s=t("../data/feature_index"),l=t("vector-tile"),c=t("pbf"),u=t("../util/vectortile_to_geojson"),h=t("feature-filter"),f=t("../symbol/collision_tile"),d=t("../symbol/collision_box"),p=t("../symbol/symbol_instances"),m=t("../symbol/symbol_quads");e.exports=n,n.prototype={loadVectorData:function(t,e){this.state="loaded",t&&(this.collisionBoxArray=new d(t.collisionBoxArray),this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.symbolInstancesArray=new p(t.symbolInstancesArray),this.symbolQuadsArray=new m(t.symbolQuadsArray),this.featureIndex=new s(t.featureIndex,t.rawTileData,this.collisionTile),this.rawTileData=t.rawTileData,this.buckets=i(t.buckets,e))},reloadSymbolData:function(t,e,r){if("unloaded"!==this.state){this.collisionTile=new f(t.collisionTile,this.collisionBoxArray),this.featureIndex.setCollisionTile(this.collisionTile);for(var n in this.buckets){var o=this.buckets[n];"symbol"===o.type&&(o.destroy(e.gl),delete this.buckets[n])}a.extend(this.buckets,i(t.buckets,r))}},unloadVectorData:function(t){for(var e in this.buckets){this.buckets[e].destroy(t.gl)}this.collisionBoxArray=null,this.symbolQuadsArray=null,this.symbolInstancesArray=null,this.collisionTile=null,this.featureIndex=null,this.rawTileData=null,this.buckets=null,this.state="unloaded"},redoPlacement:function(t){"loaded"===this.state&&"reloading"!==this.state?(this.state="reloading",t.dispatcher.send("redo placement",{uid:this.uid,source:t.id,angle:t.map.transform.angle,pitch:t.map.transform.pitch,showCollisionBoxes:t.map.showCollisionBoxes},function(e,r){this.reloadSymbolData(r,t.map.painter,t.map.style),t.fire("tile.load",{tile:this}),this.state="loaded",this.redoWhenDone&&(this.redoPlacement(t),this.redoWhenDone=!1)}.bind(this),this.workerID)):this.redoWhenDone=!0},getBucket:function(t){return this.buckets&&this.buckets[t.ref||t.id]},querySourceFeatures:function(t,e){if(this.rawTileData){this.vtLayers||(this.vtLayers=new l.VectorTile(new c(new Uint8Array(this.rawTileData))).layers);var r=this.vtLayers._geojsonTileLayer||this.vtLayers[e.sourceLayer];if(r)for(var n=h(e.filter),i={z:this.coord.z,x:this.coord.x,y:this.coord.y},a=0;a<r.length;a++){var o=r.feature(a);if(n(o)){var s=new u(o,this.coord.z,this.coord.x,this.coord.y);s.tile=i,t.push(s)}}}},isRenderable:function(){return"loaded"===this.state||"reloading"===this.state}}},{"../data/bucket":330,"../data/feature_index":337,"../symbol/collision_box":395,"../symbol/collision_tile":397,"../symbol/symbol_instances":406,"../symbol/symbol_quads":407,"../util/util":443,"../util/vectortile_to_geojson":444,"feature-filter":133,pbf:479,"vector-tile":559}],370:[function(t,e,r){"use strict";function n(t,e,r,n){s(!isNaN(t)&&t>=0&&t%1==0),s(!isNaN(e)&&e>=0&&e%1==0),s(!isNaN(r)&&r>=0&&r%1==0),isNaN(n)&&(n=0),this.z=+t,this.x=+e,this.y=+r,this.w=+n,(n*=2)<0&&(n=-1*n-1);var i=1<<this.z;this.id=32*(i*i*n+i*this.y+this.x)+this.z,this.posMatrix=null}function i(t,e){if(t.row>e.row){var r=t;t=e,e=r}return{x0:t.column,y0:t.row,x1:e.column,y1:e.row,dx:e.column-t.column,dy:e.row-t.row}}function a(t,e,r,n,i){var a=Math.max(r,Math.floor(e.y0)),o=Math.min(n,Math.ceil(e.y1));if(t.x0===e.x0&&t.y0===e.y0?t.x0+e.dy/t.dy*t.dx<e.x1:t.x1-e.dy/t.dy*t.dx<e.x0){var s=t;t=e,e=s}for(var l=t.dx/t.dy,c=e.dx/e.dy,u=t.dx>0,h=e.dx<0,f=a;f<o;f++){var d=l*Math.max(0,Math.min(t.dy,f+u-t.y0))+t.x0,p=c*Math.max(0,Math.min(e.dy,f+h-e.y0))+e.x0;i(Math.floor(p),Math.ceil(d),f)}}function o(t,e,r,n,o,s){var l,c=i(t,e),u=i(e,r),h=i(r,t);c.dy>u.dy&&(l=c,c=u,u=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy&&a(h,c,n,o,s),u.dy&&a(h,u,n,o,s)}var s=t("assert"),l=t("whoots-js"),c=t("../geo/coordinate");e.exports=n,n.prototype.toString=function(){return this.z+"/"+this.x+"/"+this.y},n.prototype.toCoordinate=function(t){var e=Math.min(this.z,t),r=Math.pow(2,e),n=this.y,i=this.x+r*this.w;return new c(i,n,e)},n.fromID=function(t){var e=t%32,r=1<<e,i=(t-e)/32,a=i%r,o=(i-a)/r%r,s=Math.floor(i/(r*r));return s%2!=0&&(s=-1*s-1),s/=2,new n(e,a,o,s)},n.prototype.url=function(t,e,r){var n=l.getTileBBox(this.x,this.y,this.z),i=function(t,e,r){for(var n,i="",a=t;a>0;a--)i+=(e&(n=1<<a-1)?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace("{z}",Math.min(this.z,e||this.z)).replace("{x}",this.x).replace("{y}","tms"===r?Math.pow(2,this.z)-this.y-1:this.y).replace("{quadkey}",i).replace("{bbox-epsg-3857}",n)},n.prototype.parent=function(t){return 0===this.z?null:this.z>t?new n(this.z-1,this.x,this.y,this.w):new n(this.z-1,Math.floor(this.x/2),Math.floor(this.y/2),this.w)},n.prototype.wrapped=function(){return new n(this.z,this.x,this.y,0)},n.prototype.children=function(t){if(this.z>=t)return[new n(this.z+1,this.x,this.y,this.w)];var e=this.z+1,r=2*this.x,i=2*this.y;return[new n(e,r,i,this.w),new n(e,r+1,i,this.w),new n(e,r,i+1,this.w),new n(e,r+1,i+1,this.w)]},n.cover=function(t,e,r){function i(t,e,i){var o,l;if(i>=0&&i<=a)for(o=t;o<e;o++)l=new n(r,(o%a+a)%a,i,Math.floor(o/a)),s[l.id]=l}var a=1<<t,s={};return o(e[0],e[1],e[2],0,a,i),o(e[2],e[3],e[0],0,a,i),Object.keys(s).map(function(t){return s[t]})}},{"../geo/coordinate":339,assert:48,"whoots-js":575}],371:[function(t,e,r){"use strict";function n(t,e,r){if(this.id=t,this.dispatcher=r,a.extend(this,a.pick(e,["url","scheme","tileSize"])),this._options=a.extend({type:"vector"},e),512!==this.tileSize)throw new Error("vector tile sources must have a tileSize of 512");o(e,function(t,e){t?this.fire("error",t):(a.extend(this,e),this.fire("load"))}.bind(this))}var i=t("../util/evented"),a=t("../util/util"),o=t("./load_tilejson"),s=t("../util/mapbox").normalizeTileURL;e.exports=n,n.prototype=a.inherit(i,{minzoom:0,maxzoom:22,scheme:"xyz",tileSize:512,reparseOverscaled:!0,isTileClipped:!0,onAdd:function(t){this.map=t},serialize:function(){return a.extend({},this._options)},loadTile:function(t,e){function r(r,n){if(!t.aborted){if(r)return e(r);t.loadVectorData(n,this.map.style),t.redoWhenDone&&(t.redoWhenDone=!1,t.redoPlacement(this)),e(null),t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)}}var n=t.coord.z>this.maxzoom?Math.pow(2,t.coord.z-this.maxzoom):1,i={url:s(t.coord.url(this.tiles,this.maxzoom,this.scheme),this.url),uid:t.uid,coord:t.coord,zoom:t.coord.z,tileSize:this.tileSize*n,source:this.id,overscaling:n,angle:this.map.transform.angle,pitch:this.map.transform.pitch,showCollisionBoxes:this.map.showCollisionBoxes};t.workerID?"loading"===t.state?t.reloadCallback=e:(i.rawTileData=t.rawTileData,this.dispatcher.send("reload tile",i,r.bind(this),t.workerID)):t.workerID=this.dispatcher.send("load tile",i,r.bind(this))},abortTile:function(t){this.dispatcher.send("abort tile",{uid:t.uid,source:this.id},null,t.workerID)},unloadTile:function(t){t.unloadVectorData(this.map.painter),this.dispatcher.send("remove tile",{uid:t.uid,source:this.id},null,t.workerID)}})},{"../util/evented":435,"../util/mapbox":440,"../util/util":443,"./load_tilejson":363}],372:[function(t,e,r){"use strict";function n(t,e,r){this.actor=t,this.styleLayers=e,r&&(this.loadVectorData=r),this.loading={},this.loaded={}}var i=t("../util/ajax"),a=t("vector-tile"),o=t("pbf"),s=t("./worker_tile");e.exports=n,n.prototype={loadTile:function(t,e){var r=t.source,n=t.uid;this.loading[r]||(this.loading[r]={});var i=this.loading[r][n]=new s(t);i.abort=this.loadVectorData(t,function(t,a){return delete this.loading[r][n],t?e(t):a?(i.data=a.tile,i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,a.rawTileData,e),this.loaded[r]=this.loaded[r]||{},void(this.loaded[r][n]=i)):e(null,null)}.bind(this))},reloadTile:function(t,e){var r=this.loaded[t.source],n=t.uid;if(r&&r[n]){var i=r[n];i.parse(i.data,this.styleLayers.getLayerFamilies(),this.actor,t.rawTileData,e)}},abortTile:function(t){var e=this.loading[t.source],r=t.uid;e&&e[r]&&e[r].abort&&(e[r].abort(),delete e[r])},removeTile:function(t){var e=this.loaded[t.source],r=t.uid;e&&e[r]&&delete e[r]},loadVectorData:function(t,e){var r=i.getArrayBuffer(t.url,function(t,r){if(t)return e(t);var n=new a.VectorTile(new o(new Uint8Array(r)));e(t,{tile:n,rawTileData:r})}.bind(this));return function(){r.abort()}},redoPlacement:function(t,e){var r=this.loaded[t.source],n=this.loading[t.source],i=t.uid;if(r&&r[i]){var a=r[i].redoPlacement(t.angle,t.pitch,t.showCollisionBoxes);a.result&&e(null,a.result,a.transferables)}else n&&n[i]&&(n[i].angle=t.angle)}}},{"../util/ajax":426,"./worker_tile":375,pbf:479,"vector-tile":559}],373:[function(t,e,r){"use strict";function n(t,e){this.id=t,this.urls=e.urls,this.coordinates=e.coordinates,c.getVideo(e.urls,function(t,r){if(t)return this.fire("error",{error:t});this.video=r,this.video.loop=!0;var n;this.video.addEventListener("playing",function(){n=this.map.style.animationLoop.set(1/0),this.map._rerender()}.bind(this)),this.video.addEventListener("pause",function(){this.map.style.animationLoop.cancel(n)}.bind(this)),this.map&&(this.video.play(),this.setCoordinates(e.coordinates)),this.fire("load")}.bind(this))}var i=t("../util/util"),a=t("./tile_coord"),o=t("../geo/lng_lat"),s=t("point-geometry"),l=t("../util/evented"),c=t("../util/ajax"),u=t("../data/bucket").EXTENT,h=t("../render/draw_raster").RasterBoundsArray,f=t("../data/buffer"),d=t("../render/vertex_array_object");e.exports=n,n.prototype=i.inherit(l,{minzoom:0,maxzoom:22,tileSize:512,roundZoom:!0,getVideo:function(){return this.video},onAdd:function(t){this.map||(this.map=t,this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))},setCoordinates:function(t){this.coordinates=t;var e=this.map,r=t.map(function(t){return e.transform.locationCoordinate(o.convert(t)).zoomTo(0)}),n=this.centerCoord=i.getCoordinatesCenter(r);return n.column=Math.round(n.column),n.row=Math.round(n.row),this.minzoom=this.maxzoom=n.zoom,this._coord=new a(n.zoom,n.column,n.row),this._tileCoords=r.map(function(t){var e=t.zoomTo(n.zoom);return new s(Math.round((e.column-n.column)*u),Math.round((e.row-n.row)*u))}),this.fire("change"),this},_setTile:function(t){this._prepared=!1,this.tile=t;var e=new h;e.emplaceBack(this._tileCoords[0].x,this._tileCoords[0].y,0,0),e.emplaceBack(this._tileCoords[1].x,this._tileCoords[1].y,32767,0),e.emplaceBack(this._tileCoords[3].x,this._tileCoords[3].y,0,32767),e.emplaceBack(this._tileCoords[2].x,this._tileCoords[2].y,32767,32767),this.tile.buckets={},this.tile.boundsBuffer=new f(e.serialize(),h.serialize(),f.BufferType.VERTEX),this.tile.boundsVAO=new d,this.tile.state="loaded"},prepare:function(){if(!(this.video.readyState<2)&&this.tile){var t=this.map.painter.gl;this._prepared?(t.bindTexture(t.TEXTURE_2D,this.tile.texture),t.texSubImage2D(t.TEXTURE_2D,0,0,0,t.RGBA,t.UNSIGNED_BYTE,this.video)):(this._prepared=!0,this.tile.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.tile.texture),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),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,this.video)),this._currentTime=this.video.currentTime}},loadTile:function(t,e){this._coord&&this._coord.toString()===t.coord.toString()?(this._setTile(t),e(null)):(t.state="errored",e(null))},serialize:function(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}})},{"../data/bucket":330,"../data/buffer":335,"../geo/lng_lat":340,"../render/draw_raster":352,"../render/vertex_array_object":358,"../util/ajax":426,"../util/evented":435,"../util/util":443,"./tile_coord":370,"point-geometry":485}],374:[function(t,e,r){"use strict";function n(t){this.self=t,this.actor=new a(t,this);var e={getLayers:function(){return this.layers}.bind(this),getLayerFamilies:function(){return this.layerFamilies}.bind(this)};this.workerSources={vector:new l(this.actor,e),geojson:new c(this.actor,e)},this.self.registerWorkerSource=function(t,r){if(this.workerSources[t])throw new Error('Worker source with name "'+t+'" already registered.');this.workerSources[t]=new r(this.actor,e)}.bind(this)}function i(t){var e={};for(var r in t){var n=t[r],i=n.ref||n.id,a=t[i];a.layout&&"none"===a.layout.visibility||(e[i]=e[i]||[],r===i?e[i].unshift(n):e[i].push(n))}return e}var a=t("../util/actor"),o=t("../style/style_layer"),s=t("../util/util"),l=t("./vector_tile_worker_source"),c=t("./geojson_worker_source");e.exports=function(t){return new n(t)},s.extend(n.prototype,{"set layers":function(t){function e(t){var e=o.create(t,t.ref&&r.layers[t.ref]);e.updatePaintTransitions({},{transition:!1}),r.layers[e.id]=e}this.layers={};for(var r=this,n=[],a=0;a<t.length;a++){var s=t[a];"fill"!==s.type&&"line"!==s.type&&"circle"!==s.type&&"symbol"!==s.type||(s.ref?n.push(a):e(s))}for(var l=0;l<n.length;l++)e(t[n[l]]);this.layerFamilies=i(this.layers)},"update layers":function(t){function e(t){var e=a.layers[t.ref];a.layers[t.id]?a.layers[t.id].set(t,e):a.layers[t.id]=o.create(t,e),a.layers[t.id].updatePaintTransitions({},{transition:!1})}var r,n,a=this;for(r in t)(n=t[r]).ref&&e(n);for(r in t)(n=t[r]).ref||e(n);this.layerFamilies=i(this.layers)},"load tile":function(t,e){var r=t.type||"vector";this.workerSources[r].loadTile(t,e)},"reload tile":function(t,e){var r=t.type||"vector";this.workerSources[r].reloadTile(t,e)},"abort tile":function(t){var e=t.type||"vector";this.workerSources[e].abortTile(t)},"remove tile":function(t){var e=t.type||"vector";this.workerSources[e].removeTile(t)},"redo placement":function(t,e){var r=t.type||"vector";this.workerSources[r].redoPlacement(t,e)},"load worker source":function(t,e){try{this.self.importScripts(t.url),e()}catch(t){e(t)}}})},{"../style/style_layer":382,"../util/actor":425,"../util/util":443,"./geojson_worker_source":360,"./vector_tile_worker_source":372}],375:[function(t,e,r){"use strict";function n(t){this.coord=t.coord,this.uid=t.uid,this.zoom=t.zoom,this.tileSize=t.tileSize,this.source=t.source,this.overscaling=t.overscaling,this.angle=t.angle,this.pitch=t.pitch,this.showCollisionBoxes=t.showCollisionBoxes}function i(t){return!t.isEmpty()}function a(t){return t.serialize()}function o(t){var e=[];for(var r in t)t[r].getTransferables(e);return e}function s(t){return t.id}var l=t("../data/feature_index"),c=t("../symbol/collision_tile"),u=t("../data/bucket"),h=t("../symbol/collision_box"),f=t("../util/dictionary_coder"),d=t("../util/util"),p=t("../symbol/symbol_instances"),m=t("../symbol/symbol_quads");e.exports=n,n.prototype.parse=function(t,e,r,n,g){function v(t,e){for(var r=0;r<t.length;r++){var n=t.feature(r);n.index=r;for(var i in e)e[i].filter(n)&&e[i].features.push(n)}}function y(t){if(t)return g(t);if(2==++N){for(var e=z.length-1;e>=0;e--)b(E,z[e]);x()}}function b(t,e){if(e.populateArrays(T,j,R),"symbol"!==e.type)for(var r=0;r<e.features.length;r++){var n=e.features[r];A.insert(n,n.index,e.sourceLayerIndex,e.index)}e.features=null}function x(){E.status="done",E.redoPlacementAfterDone&&(E.redoPlacement(E.angle,E.pitch,null),E.redoPlacementAfterDone=!1);var t=A.serialize(),e=T.serialize(),r=E.collisionBoxArray.serialize(),s=E.symbolInstancesArray.serialize(),l=E.symbolQuadsArray.serialize(),c=[n].concat(t.transferables).concat(e.transferables),u=D.filter(i);g(null,{buckets:u.map(a),featureIndex:t.data,collisionTile:e.data,collisionBoxArray:r,symbolInstancesArray:s,symbolQuadsArray:l,rawTileData:n},o(u).concat(c))}this.status="parsing",this.data=t,this.collisionBoxArray=new h,this.symbolInstancesArray=new p,this.symbolQuadsArray=new m;var _,w,M,k,T=new c(this.angle,this.pitch,this.collisionBoxArray),A=new l(this.coord,this.overscaling,T,t.layers),S=new f(t.layers?Object.keys(t.layers).sort():["_geojsonTileLayer"]),E=this,L={},C={},I=0;for(var P in e)(w=e[P][0]).source===this.source&&(w.ref||w.minzoom&&this.zoom<w.minzoom||w.maxzoom&&this.zoom>=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||((k=u.create({layer:w,index:I++,childLayers:e[P],zoom:this.zoom,overscaling:this.overscaling,showCollisionBoxes:this.showCollisionBoxes,collisionBoxArray:this.collisionBoxArray,symbolQuadsArray:this.symbolQuadsArray,symbolInstancesArray:this.symbolInstancesArray,sourceLayerIndex:S.encode(w.sourceLayer||"_geojsonTileLayer")})).createFilter(),L[w.id]=k,t.layers&&(C[M=w.sourceLayer]=C[M]||{},C[M][w.id]=k)));if(t.layers)for(M in C)1===w.version&&d.warnOnce('Vector tile source "'+this.source+'" layer "'+M+'" does not use vector tile spec v2 and therefore may have some rendering errors.'),(w=t.layers[M])&&v(w,C[M]);else v(t,L);var D=[],z=this.symbolBuckets=[],O=[];A.bucketLayerIDs={};for(var F in L)0!==(k=L[F]).features.length&&(A.bucketLayerIDs[k.index]=k.childLayers.map(s),D.push(k),"symbol"===k.type?z.push(k):O.push(k));var R={},j={},N=0;if(z.length>0){for(_=z.length-1;_>=0;_--)z[_].updateIcons(R),z[_].updateFont(j);for(var B in j)j[B]=Object.keys(j[B]).map(Number);R=Object.keys(R),r.send("get glyphs",{uid:this.uid,stacks:j},function(t,e){j=e,y(t)}),R.length?r.send("get icons",{icons:R},function(t,e){R=e,y(t)}):y()}for(_=O.length-1;_>=0;_--)b(0,O[_]);if(0===z.length)return x()},n.prototype.redoPlacement=function(t,e,r){if("done"!==this.status)return this.redoPlacementAfterDone=!0,this.angle=t,{};for(var n=new c(t,e,this.collisionBoxArray),s=this.symbolBuckets,l=s.length-1;l>=0;l--)s[l].placeFeatures(n,r);var u=n.serialize(),h=s.filter(i);return{result:{buckets:h.map(a),collisionTile:u.data},transferables:o(h).concat(u.transferables)}}},{"../data/bucket":330,"../data/feature_index":337,"../symbol/collision_box":395,"../symbol/collision_tile":397,"../symbol/symbol_instances":406,"../symbol/symbol_quads":407,"../util/dictionary_coder":433,"../util/util":443}],376:[function(t,e,r){"use strict";function n(){this.n=0,this.times=[]}e.exports=n,n.prototype.stopped=function(){return this.times=this.times.filter(function(t){return t.time>=(new Date).getTime()}),!this.times.length},n.prototype.set=function(t){return this.times.push({id:this.n,time:t+(new Date).getTime()}),this.n++},n.prototype.cancel=function(t){this.times=this.times.filter(function(e){return e.id!==t})}},{}],377:[function(t,e,r){"use strict";function n(t){this.base=t,this.retina=s.devicePixelRatio>1;var e=this.retina?"@2x":"";o.getJSON(l(t,e,".json"),function(t,e){t?this.fire("error",{error:t}):(this.data=e,this.img&&this.fire("load"))}.bind(this)),o.getImage(l(t,e,".png"),function(t,e){if(t)this.fire("error",{error:t});else{for(var r=e.getData(),n=e.data=new Uint8Array(r.length),i=0;i<r.length;i+=4){var a=r[i+3]/255;n[i+0]=r[i+0]*a,n[i+1]=r[i+1]*a,n[i+2]=r[i+2]*a,n[i+3]=r[i+3]}this.img=e,this.data&&this.fire("load")}}.bind(this))}function i(){}var a=t("../util/evented"),o=t("../util/ajax"),s=t("../util/browser"),l=t("../util/mapbox").normalizeSpriteURL;e.exports=n,(n.prototype=Object.create(a)).toJSON=function(){return this.base},n.prototype.loaded=function(){return!(!this.data||!this.img)},n.prototype.resize=function(){if(s.devicePixelRatio>1!==this.retina){var t=new n(this.base);t.on("load",function(){this.img=t.img,this.data=t.data,this.retina=t.retina}.bind(this))}},i.prototype={x:0,y:0,width:0,height:0,pixelRatio:1,sdf:!1},n.prototype.getSpritePosition=function(t){if(!this.loaded())return new i;var e=this.data&&this.data[t];return e&&this.img?e:new i}},{"../util/ajax":426,"../util/browser":427,"../util/evented":435,"../util/mapbox":440}],378:[function(t,e,r){"use strict";var n=t("csscolorparser").parseCSSColor,i=t("../util/util"),a=t("./style_function"),o={};e.exports=function t(e){if(a.isFunctionDefinition(e))return i.extend({},e,{stops:e.stops.map(function(e){return[e[0],t(e[1])]})});if("string"==typeof e){if(!o[e]){var r=n(e);if(!r)throw new Error("Invalid color "+e);o[e]=[r[0]/255*r[3],r[1]/255*r[3],r[2]/255*r[3],r[3]]}return o[e]}throw new Error("Invalid color "+e)}},{"../util/util":443,"./style_function":381,csscolorparser:109}],379:[function(t,e,r){"use strict";function n(t,e,r){this.animationLoop=e||new m,this.dispatcher=new p(r||1,this),this.spriteAtlas=new l(1024,1024),this.lineAtlas=new c(256,512),this._layers={},this._order=[],this._groups=[],this.sources={},this.zoomHistory={},u.bindAll(["_forwardSourceEvent","_forwardTileEvent","_forwardLayerEvent","_redoPlacement"],this),this._resetUpdates();var n=function(t,e){if(t)this.fire("error",{error:t});else if(!g.emitErrors(this,g(e))){this._loaded=!0,this.stylesheet=e,this.updateClasses();var r=e.sources;for(var n in r)this.addSource(n,r[n]);e.sprite&&(this.sprite=new o(e.sprite),this.sprite.on("load",this.fire.bind(this,"change"))),this.glyphSource=new s(e.glyphs),this._resolve(),this.fire("load")}}.bind(this);"string"==typeof t?h.getJSON(f(t),n):d.frame(n.bind(this,null,t)),this.on("source.load",function(t){var e=t.source;if(e&&e.vectorLayerIds)for(var r in this._layers){var n=this._layers[r];n.source===e.id&&this._validateLayer(n)}})}var i=t("../util/evented"),a=t("./style_layer"),o=t("./image_sprite"),s=t("../symbol/glyph_source"),l=t("../symbol/sprite_atlas"),c=t("../render/line_atlas"),u=t("../util/util"),h=t("../util/ajax"),f=t("../util/mapbox").normalizeStyleURL,d=t("../util/browser"),p=t("../util/dispatcher"),m=t("./animation_loop"),g=t("./validate_style"),v=t("../source/source"),y=t("../source/query_features"),b=t("../source/source_cache"),x=t("./style_spec"),_=t("./style_function");e.exports=n,n.prototype=u.inherit(i,{_loaded:!1,_validateLayer:function(t){var e=this.sources[t.source];t.sourceLayer&&e&&e.vectorLayerIds&&-1===e.vectorLayerIds.indexOf(t.sourceLayer)&&this.fire("error",{error:new Error('Source layer "'+t.sourceLayer+'" does not exist on source "'+e.id+'" as specified by style layer "'+t.id+'"')})},loaded:function(){if(!this._loaded)return!1;if(Object.keys(this._updates.sources).length)return!1;for(var t in this.sources)if(!this.sources[t].loaded())return!1;return!(this.sprite&&!this.sprite.loaded())},_resolve:function(){var t,e;this._layers={},this._order=this.stylesheet.layers.map(function(t){return t.id});for(var r=0;r<this.stylesheet.layers.length;r++)(e=this.stylesheet.layers[r]).ref||(t=a.create(e),this._layers[t.id]=t,t.on("error",this._forwardLayerEvent));for(var n=0;n<this.stylesheet.layers.length;n++)if((e=this.stylesheet.layers[n]).ref){var i=this.getLayer(e.ref);t=a.create(e,i),this._layers[t.id]=t,t.on("error",this._forwardLayerEvent)}this._groupLayers(),this._updateWorkerLayers()},_groupLayers:function(){var t;this._groups=[];for(var e=0;e<this._order.length;++e){var r=this._layers[this._order[e]];t&&r.source===t.source||((t=[]).source=r.source,this._groups.push(t)),t.push(r)}},_updateWorkerLayers:function(t){this.dispatcher.broadcast(t?"update layers":"set layers",this._serializeLayers(t))},_serializeLayers:function(t){t=t||this._order;for(var e=[],r={includeRefProperties:!0},n=0;n<t.length;n++)e.push(this._layers[t[n]].serialize(r));return e},_applyClasses:function(t,e){if(this._loaded){t=t||[],e=e||{transition:!0};var r=this.stylesheet.transition||{},n=this._updates.allPaintProps?this._layers:this._updates.paintProps;for(var i in n){var a=this._layers[i],o=this._updates.paintProps[i];if(this._updates.allPaintProps||o.all)a.updatePaintTransitions(t,e,r,this.animationLoop);else for(var s in o)this._layers[i].updatePaintTransition(s,t,e,r,this.animationLoop)}}},_recalculate:function(t){for(var e in this.sources)this.sources[e].used=!1;this._updateZoomHistory(t),this.rasterFadeDuration=300;for(var r in this._layers){var n=this._layers[r];n.recalculate(t,this.zoomHistory),!n.isHidden(t)&&n.source&&(this.sources[n.source].used=!0)}Math.floor(this.z)!==Math.floor(t)&&this.animationLoop.set(300),this.z=t,this.fire("zoom")},_updateZoomHistory:function(t){var e=this.zoomHistory;void 0===e.lastIntegerZoom&&(e.lastIntegerZoom=Math.floor(t),e.lastIntegerZoomTime=0,e.lastZoom=t),Math.floor(e.lastZoom)<Math.floor(t)?(e.lastIntegerZoom=Math.floor(t),e.lastIntegerZoomTime=Date.now()):Math.floor(e.lastZoom)>Math.floor(t)&&(e.lastIntegerZoom=Math.floor(t+1),e.lastIntegerZoomTime=Date.now()),e.lastZoom=t},_checkLoaded:function(){if(!this._loaded)throw new Error("Style is not done loading")},update:function(t,e){if(!this._updates.changed)return this;if(this._updates.allLayers)this._groupLayers(),this._updateWorkerLayers();else{var r=Object.keys(this._updates.layers);r.length&&this._updateWorkerLayers(r)}var n,i=Object.keys(this._updates.sources);for(n=0;n<i.length;n++)this._reloadSource(i[n]);for(n=0;n<this._updates.events.length;n++){var a=this._updates.events[n];this.fire(a[0],a[1])}return this._applyClasses(t,e),this._updates.changed&&this.fire("change"),this._resetUpdates(),this},_resetUpdates:function(){this._updates={events:[],layers:{},sources:{},paintProps:{}}},addSource:function(t,e){if(this._checkLoaded(),void 0!==this.sources[t])throw new Error("There is already a source with this ID");if(!e.type)throw new Error("The type property must be defined, but the only the following properties were given: "+Object.keys(e)+".");return["vector","raster","geojson","video","image"].indexOf(e.type)>=0&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new b(t,e,this.dispatcher),this.sources[t]=e,e.style=this,e.on("load",this._forwardSourceEvent).on("error",this._forwardSourceEvent).on("change",this._forwardSourceEvent).on("tile.add",this._forwardTileEvent).on("tile.load",this._forwardTileEvent).on("tile.error",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.add",{source:e}]),this._updates.changed=!0,this)},removeSource:function(t){if(this._checkLoaded(),void 0===this.sources[t])throw new Error("There is no source with this ID");var e=this.sources[t];return delete this.sources[t],delete this._updates.sources[t],e.off("load",this._forwardSourceEvent).off("error",this._forwardSourceEvent).off("change",this._forwardSourceEvent).off("tile.add",this._forwardTileEvent).off("tile.load",this._forwardTileEvent).off("tile.error",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent),this._updates.events.push(["source.remove",{source:e}]),this._updates.changed=!0,this},getSource:function(t){return this.sources[t]&&this.sources[t].getSource()},addLayer:function(t,e){if(this._checkLoaded(),!(t instanceof a)){if(this._handleErrors(g.layer,"layers."+t.id,t,!1,{arrayIndex:-1}))return this;var r=t.ref&&this.getLayer(t.ref);t=a.create(t,r)}return this._validateLayer(t),t.on("error",this._forwardLayerEvent),this._layers[t.id]=t,this._order.splice(e?this._order.indexOf(e):1/0,0,t.id),this._updates.allLayers=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.events.push(["layer.add",{layer:t}]),this.updateClasses(t.id)},removeLayer:function(t){this._checkLoaded();var e=this._layers[t];if(void 0===e)throw new Error("There is no layer with this ID");for(var r in this._layers)this._layers[r].ref===t&&this.removeLayer(r);return e.off("error",this._forwardLayerEvent),delete this._layers[t],delete this._updates.layers[t],delete this._updates.paintProps[t],this._order.splice(this._order.indexOf(t),1),this._updates.allLayers=!0,this._updates.events.push(["layer.remove",{layer:e}]),this._updates.changed=!0,this},getLayer:function(t){return this._layers[t]},getReferentLayer:function(t){var e=this.getLayer(t);return e.ref&&(e=this.getLayer(e.ref)),e},setLayerZoomRange:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return n.minzoom===e&&n.maxzoom===r?this:(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n))},setFilter:function(t,e){this._checkLoaded();var r=this.getReferentLayer(t);return null!==e&&this._handleErrors(g.filter,"layers."+r.id+".filter",e)?this:u.deepEqual(r.filter,e)?this:(r.filter=u.clone(e),this._updateLayer(r))},getFilter:function(t){return this.getReferentLayer(t).filter},setLayoutProperty:function(t,e,r){this._checkLoaded();var n=this.getReferentLayer(t);return u.deepEqual(n.getLayoutProperty(e),r)?this:(n.setLayoutProperty(e,r),this._updateLayer(n))},getLayoutProperty:function(t,e){return this.getReferentLayer(t).getLayoutProperty(e)},setPaintProperty:function(t,e,r,n){this._checkLoaded();var i=this.getLayer(t);if(u.deepEqual(i.getPaintProperty(e,n),r))return this;var a=i.isPaintValueFeatureConstant(e);i.setPaintProperty(e,r,n);return!(r&&_.isFunctionDefinition(r)&&"$zoom"!==r.property&&void 0!==r.property)&&a||(this._updates.layers[t]=!0,i.source&&(this._updates.sources[i.source]=!0)),this.updateClasses(t,e)},getPaintProperty:function(t,e,r){return this.getLayer(t).getPaintProperty(e,r)},updateClasses:function(t,e){if(this._updates.changed=!0,t){var r=this._updates.paintProps;r[t]||(r[t]={}),r[t][e||"all"]=!0}else this._updates.allPaintProps=!0;return this},serialize:function(){return u.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,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:u.mapObject(this.sources,function(t){return t.serialize()}),layers:this._order.map(function(t){return this._layers[t].serialize()},this)},function(t){return void 0!==t})},_updateLayer:function(t){return this._updates.layers[t.id]=!0,t.source&&(this._updates.sources[t.source]=!0),this._updates.changed=!0,this},_flattenRenderedFeatures:function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0;i<t.length;i++){var a=t[i][n];if(a)for(var o=0;o<a.length;o++)e.push(a[o])}return e},queryRenderedFeatures:function(t,e,r,n){e&&e.filter&&this._handleErrors(g.filter,"queryRenderedFeatures.filter",e.filter,!0);var i={};if(e&&e.layers)for(var a=0;a<e.layers.length;a++){var o=e.layers[a];i[this._layers[o].source]=!0}var s=[];for(var l in this.sources)if(!e.layers||i[l]){var c=this.sources[l],u=y.rendered(c,this._layers,t,e,r,n);s.push(u)}return this._flattenRenderedFeatures(s)},querySourceFeatures:function(t,e){e&&e.filter&&this._handleErrors(g.filter,"querySourceFeatures.filter",e.filter,!0);var r=this.sources[t];return r?y.source(r,e):[]},addSourceType:function(t,e,r){return v.getType(t)?r(new Error('A source type called "'+t+'" already exists.')):(v.setType(t,e),e.workerSourceURL?void this.dispatcher.broadcast("load worker source",{name:t,url:e.workerSourceURL},r):r(null,null))},_handleErrors:function(t,e,r,n,i){var a=n?g.throwErrors:g.emitErrors,o=t.call(g,u.extend({key:e,style:this.serialize(),value:r,styleSpec:x},i));return a.call(g,this,o)},_remove:function(){this.dispatcher.remove()},_reloadSource:function(t){this.sources[t].reload()},_updateSources:function(t){for(var e in this.sources)this.sources[e].update(t)},_redoPlacement:function(){for(var t in this.sources)this.sources[t].redoPlacement&&this.sources[t].redoPlacement()},_forwardSourceEvent:function(t){this.fire("source."+t.type,u.extend({source:t.target.getSource()},t))},_forwardTileEvent:function(t){this.fire(t.type,u.extend({source:t.target},t))},_forwardLayerEvent:function(t){this.fire("layer."+t.type,u.extend({layer:{id:t.target.id}},t))},"get sprite json":function(t,e){var r=this.sprite;r.loaded()?e(null,{sprite:r.data,retina:r.retina}):r.on("load",function(){e(null,{sprite:r.data,retina:r.retina})})},"get icons":function(t,e){var r=this.sprite,n=this.spriteAtlas;r.loaded()?(n.setSprite(r),n.addIcons(t.icons,e)):r.on("load",function(){n.setSprite(r),n.addIcons(t.icons,e)})},"get glyphs":function(t,e){function r(t,r,n){t&&console.error(t),a[n]=r,0===--i&&e(null,a)}var n=t.stacks,i=Object.keys(n).length,a={};for(var o in n)this.glyphSource.getSimpleGlyphs(o,n[o],t.uid,r)}})},{"../render/line_atlas":355,"../source/query_features":365,"../source/source":367,"../source/source_cache":368,"../symbol/glyph_source":400,"../symbol/sprite_atlas":405,"../util/ajax":426,"../util/browser":427,"../util/dispatcher":434,"../util/evented":435,"../util/mapbox":440,"../util/util":443,"./animation_loop":376,"./image_sprite":377,"./style_function":381,"./style_layer":382,"./style_spec":389,"./validate_style":391}],380:[function(t,e,r){"use strict";var n=t("./style_function"),i=t("./parse_color"),a=t("../util/util");e.exports=function(t,e){this.value=a.clone(e),this.isFunction=n.isFunctionDefinition(e),this.json=JSON.stringify(this.value);var r="color"===t.type&&this.value?i(this.value):e;if(this.calculate=n[t.function||"piecewise-constant"](r),this.isFeatureConstant=this.calculate.isFeatureConstant,this.isZoomConstant=this.calculate.isZoomConstant,"piecewise-constant"===t.function&&t.transition&&(this.calculate=function(t){return function(e,r){var n,i,a,o=e.zoom,s=e.zoomHistory,l=e.duration,c=o%1,u=Math.min((Date.now()-s.lastIntegerZoomTime)/l,1),h=1;return o>s.lastIntegerZoom?(n=c+(1-c)*u,h*=2,i=t({zoom:o-1},r),a=t({zoom:o},r)):(n=1-(1-u)*c,a=t({zoom:o},r),i=t({zoom:o+1},r),h/=2),void 0===i||void 0===a?void 0:{from:i,fromScale:h,to:a,toScale:1,t:n}}}(this.calculate)),!this.isFeatureConstant&&!this.isZoomConstant){this.stopZoomLevels=[];for(var o=[],s=this.value.stops,l=0;l<this.value.stops.length;l++){var c=s[l][0].zoom;this.stopZoomLevels.indexOf(c)<0&&(this.stopZoomLevels.push(c),o.push([c,o.length]))}this.calculateInterpolationT=n.interpolated({stops:o,base:e.base})}}},{"../util/util":443,"./parse_color":378,"./style_function":381}],381:[function(t,e,r){"use strict";var n=t("mapbox-gl-function");r.interpolated=function(t){var e=n.interpolated(t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r["piecewise-constant"]=function(t){var e=n["piecewise-constant"](t),r=function(t,r){return e(t&&t.zoom,r||{})};return r.isFeatureConstant=e.isFeatureConstant,r.isZoomConstant=e.isZoomConstant,r},r.isFunctionDefinition=n.isFunctionDefinition},{"mapbox-gl-function":303}],382:[function(t,e,r){"use strict";function n(t,e){this.set(t,e)}function i(t){return t.value}var a=t("../util/util"),o=t("./style_transition"),s=t("./style_declaration"),l=t("./style_spec"),c=t("./validate_style"),u=t("./parse_color"),h=t("../util/evented");e.exports=n;n.create=function(e,r){return new({background:t("./style_layer/background_style_layer"),circle:t("./style_layer/circle_style_layer"),fill:t("./style_layer/fill_style_layer"),line:t("./style_layer/line_style_layer"),raster:t("./style_layer/raster_style_layer"),symbol:t("./style_layer/symbol_style_layer")}[(r||e).type])(e,r)},n.prototype=a.inherit(h,{set:function(t,e){this.id=t.id,this.ref=t.ref,this.metadata=t.metadata,this.type=(e||t).type,this.source=(e||t).source,this.sourceLayer=(e||t)["source-layer"],this.minzoom=(e||t).minzoom,this.maxzoom=(e||t).maxzoom,this.filter=(e||t).filter,this.paint={},this.layout={},this._paintSpecifications=l["paint_"+this.type],this._layoutSpecifications=l["layout_"+this.type],this._paintTransitions={},this._paintTransitionOptions={},this._paintDeclarations={},this._layoutDeclarations={},this._layoutFunctions={};var r,n;for(var i in t){var a=i.match(/^paint(?:\.(.*))?$/);if(a){var o=a[1]||"";for(r in t[i])this.setPaintProperty(r,t[i][r],o)}}if(this.ref)this._layoutDeclarations=e._layoutDeclarations;else for(n in t.layout)this.setLayoutProperty(n,t.layout[n]);for(r in this._paintSpecifications)this.paint[r]=this.getPaintValue(r);for(n in this._layoutSpecifications)this._updateLayoutValue(n)},setLayoutProperty:function(t,e){if(null==e)delete this._layoutDeclarations[t];else{var r="layers."+this.id+".layout."+t;if(this._handleErrors(c.layoutProperty,r,t,e))return;this._layoutDeclarations[t]=new s(this._layoutSpecifications[t],e)}this._updateLayoutValue(t)},getLayoutProperty:function(t){return this._layoutDeclarations[t]&&this._layoutDeclarations[t].value},getLayoutValue:function(t,e,r){var n=this._layoutSpecifications[t],i=this._layoutDeclarations[t];return i?i.calculate(e,r):n.default},setPaintProperty:function(t,e,r){var n="layers."+this.id+(r?'["paint.'+r+'"].':".paint.")+t;if(a.endsWith(t,"-transition"))if(this._paintTransitionOptions[r||""]||(this._paintTransitionOptions[r||""]={}),null===e||void 0===e)delete this._paintTransitionOptions[r||""][t];else{if(this._handleErrors(c.paintProperty,n,t,e))return;this._paintTransitionOptions[r||""][t]=e}else if(this._paintDeclarations[r||""]||(this._paintDeclarations[r||""]={}),null===e||void 0===e)delete this._paintDeclarations[r||""][t];else{if(this._handleErrors(c.paintProperty,n,t,e))return;this._paintDeclarations[r||""][t]=new s(this._paintSpecifications[t],e)}},getPaintProperty:function(t,e){return e=e||"",a.endsWith(t,"-transition")?this._paintTransitionOptions[e]&&this._paintTransitionOptions[e][t]:this._paintDeclarations[e]&&this._paintDeclarations[e][t]&&this._paintDeclarations[e][t].value},getPaintValue:function(t,e,r){var n=this._paintSpecifications[t],i=this._paintTransitions[t];return i?i.calculate(e,r):"color"===n.type&&n.default?u(n.default):n.default},getPaintValueStopZoomLevels:function(t){var e=this._paintTransitions[t];return e?e.declaration.stopZoomLevels:[]},getPaintInterpolationT:function(t,e){return this._paintTransitions[t].declaration.calculateInterpolationT({zoom:e})},isPaintValueFeatureConstant:function(t){var e=this._paintTransitions[t];return!e||e.declaration.isFeatureConstant},isLayoutValueFeatureConstant:function(t){var e=this._layoutDeclarations[t];return!e||e.isFeatureConstant},isPaintValueZoomConstant:function(t){var e=this._paintTransitions[t];return!e||e.declaration.isZoomConstant},isHidden:function(t){return!!(this.minzoom&&t<this.minzoom)||(!!(this.maxzoom&&t>=this.maxzoom)||("none"===this.layout.visibility||0===this.paint[this.type+"-opacity"]))},updatePaintTransitions:function(t,e,r,n){for(var i=a.extend({},this._paintDeclarations[""]),o=0;o<t.length;o++)a.extend(i,this._paintDeclarations[t[o]]);var s;for(s in i)this._applyPaintDeclaration(s,i[s],e,r,n);for(s in this._paintTransitions)s in i||this._applyPaintDeclaration(s,null,e,r,n)},updatePaintTransition:function(t,e,r,n,i){for(var a=this._paintDeclarations[""][t],o=0;o<e.length;o++){var s=this._paintDeclarations[e[o]];s&&s[t]&&(a=s[t])}this._applyPaintDeclaration(t,a,r,n,i)},recalculate:function(t,e){for(var r in this._paintTransitions)this.paint[r]=this.getPaintValue(r,{zoom:t,zoomHistory:e});for(var n in this._layoutFunctions)this.layout[n]=this.getLayoutValue(n,{zoom:t,zoomHistory:e})},serialize:function(t){var e={id:this.id,ref:this.ref,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom};for(var r in this._paintDeclarations){e[""===r?"paint":"paint."+r]=a.mapObject(this._paintDeclarations[r],i)}return(!this.ref||t&&t.includeRefProperties)&&a.extend(e,{type:this.type,source:this.source,"source-layer":this.sourceLayer,filter:this.filter,layout:a.mapObject(this._layoutDeclarations,i)}),a.filterObject(e,function(t,e){return void 0!==t&&!("layout"===e&&!Object.keys(t).length)})},_applyPaintDeclaration:function(t,e,r,n,i){var l=r.transition?this._paintTransitions[t]:void 0,c=this._paintSpecifications[t];if(null!==e&&void 0!==e||(e=new s(c,c.default)),!l||l.declaration.json!==e.json){var u=a.extend({duration:300,delay:0},n,this.getPaintProperty(t+"-transition")),h=this._paintTransitions[t]=new o(c,e,l,u);h.instant()||(h.loopID=i.set(h.endTime-Date.now())),l&&i.cancel(l.loopID)}},_updateLayoutValue:function(t){var e=this._layoutDeclarations[t];e&&e.isFunction?this._layoutFunctions[t]=!0:(delete this._layoutFunctions[t],this.layout[t]=this.getLayoutValue(t))},_handleErrors:function(t,e,r,n){return c.emitErrors(this,t.call(c,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:l,style:{glyphs:!0,sprite:!0}}))}})},{"../util/evented":435,"../util/util":443,"./parse_color":378,"./style_declaration":380,"./style_layer/background_style_layer":383,"./style_layer/circle_style_layer":384,"./style_layer/fill_style_layer":385,"./style_layer/line_style_layer":386,"./style_layer/raster_style_layer":387,"./style_layer/symbol_style_layer":388,"./style_spec":389,"./style_transition":390,"./validate_style":391}],383:[function(t,e,r){"use strict";function n(){a.apply(this,arguments)}var i=t("../../util/util"),a=t("../style_layer");e.exports=n,n.prototype=i.inherit(a,{})},{"../../util/util":443,"../style_layer":382}],384:[function(t,e,r){"use strict";function n(){a.apply(this,arguments)}var i=t("../../util/util"),a=t("../style_layer");e.exports=n,n.prototype=i.inherit(a,{})},{"../../util/util":443,"../style_layer":382}],385:[function(t,e,r){"use strict";function n(){a.apply(this,arguments)}var i=t("../../util/util"),a=t("../style_layer");n.prototype=i.inherit(a,{getPaintValue:function(t,e,r){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?a.prototype.getPaintValue.call(this,"fill-color",e,r):a.prototype.getPaintValue.call(this,t,e,r)},getPaintValueStopZoomLevels:function(t){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?a.prototype.getPaintValueStopZoomLevels.call(this,"fill-color"):a.prototype.getPaintValueStopZoomLevels.call(this,arguments)},getPaintInterpolationT:function(t,e){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?a.prototype.getPaintInterpolationT.call(this,"fill-color",e):a.prototype.getPaintInterpolationT.call(this,t,e)},isPaintValueFeatureConstant:function(t){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?a.prototype.isPaintValueFeatureConstant.call(this,"fill-color"):a.prototype.isPaintValueFeatureConstant.call(this,t)},isPaintValueZoomConstant:function(t){return"fill-outline-color"===t&&void 0===this.getPaintProperty("fill-outline-color")?a.prototype.isPaintValueZoomConstant.call(this,"fill-color"):a.prototype.isPaintValueZoomConstant.call(this,t)}}),e.exports=n},{"../../util/util":443,"../style_layer":382}],386:[function(t,e,r){"use strict";function n(){a.apply(this,arguments)}var i=t("../../util/util"),a=t("../style_layer");e.exports=n,n.prototype=i.inherit(a,{getPaintValue:function(t,e,r){var n=a.prototype.getPaintValue.apply(this,arguments);if(n&&"line-dasharray"===t){var i=Math.floor(e.zoom);this._flooredZoom!==i&&(this._flooredZoom=i,this._flooredLineWidth=this.getPaintValue("line-width",e,r)),n.fromScale*=this._flooredLineWidth,n.toScale*=this._flooredLineWidth}return n}})},{"../../util/util":443,"../style_layer":382}],387:[function(t,e,r){"use strict";function n(){a.apply(this,arguments)}var i=t("../../util/util"),a=t("../style_layer");e.exports=n,n.prototype=i.inherit(a,{})},{"../../util/util":443,"../style_layer":382}],388:[function(t,e,r){"use strict";function n(){a.apply(this,arguments)}var i=t("../../util/util"),a=t("../style_layer");e.exports=n,n.prototype=i.inherit(a,{isHidden:function(){if(a.prototype.isHidden.apply(this,arguments))return!0;var t=0===this.paint["text-opacity"]||!this.layout["text-field"],e=0===this.paint["icon-opacity"]||!this.layout["icon-image"];return!(!t||!e)},getLayoutValue:function(t,e,r){return("text-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("text-rotation-alignment"))&&("icon-rotation-alignment"!==t||"line"!==this.getLayoutValue("symbol-placement",e,r)||this.getLayoutProperty("icon-rotation-alignment"))?"text-pitch-alignment"!==t||this.getLayoutProperty("text-pitch-alignment")?a.prototype.getLayoutValue.apply(this,arguments):this.getLayoutValue("text-rotation-alignment"):"map"}})},{"../../util/util":443,"../style_layer":382}],389:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/reference/latest.min")},{"mapbox-gl-style-spec/reference/latest.min":326}],390:[function(t,e,r){"use strict";function n(t,e,r,n){this.declaration=e,this.startTime=this.endTime=(new Date).getTime(),"piecewise-constant"===t.function&&t.transition?this.interp=i:this.interp=o[t.type],this.oldTransition=r,this.duration=n.duration||0,this.delay=n.delay||0,this.instant()||(this.endTime=this.startTime+this.duration+this.delay,this.ease=a.easeCubicInOut),r&&r.endTime<=this.startTime&&delete r.oldTransition}function i(t,e,r){return void 0===(t&&t.to)||void 0===(e&&e.to)?void 0:{from:t.to,fromScale:t.toScale,to:e.to,toScale:e.toScale,t:r}}var a=t("../util/util"),o=t("../util/interpolate");e.exports=n,n.prototype.instant=function(){return!this.oldTransition||!this.interp||0===this.duration&&0===this.delay},n.prototype.calculate=function(t,e){var r=this.declaration.calculate(a.extend({},t,{duration:this.duration}),e);if(this.instant())return r;var n=t.time||Date.now();if(n<this.endTime){var i=this.oldTransition.calculate(a.extend({},t,{time:this.startTime}),e),o=this.ease((n-this.startTime-this.delay)/this.duration);r=this.interp(i,r,o)}return r}},{"../util/interpolate":437,"../util/util":443}],391:[function(t,e,r){"use strict";e.exports=t("mapbox-gl-style-spec/lib/validate_style.min"),e.exports.emitErrors=function(t,e){if(e&&e.length){for(var r=0;r<e.length;r++)t.fire("error",{error:new Error(e[r].message)});return!0}return!1},e.exports.throwErrors=function(t,e){if(e)for(var r=0;r<e.length;r++)throw new Error(e[r].message)}},{"mapbox-gl-style-spec/lib/validate_style.min":325}],392:[function(t,e,r){"use strict";function n(t,e,r,n){this.x=t,this.y=e,this.angle=r,void 0!==n&&(this.segment=n)}var i=t("point-geometry");e.exports=n,(n.prototype=Object.create(i.prototype)).clone=function(){return new n(this.x,this.y,this.angle,this.segment)}},{"point-geometry":485}],393:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){if(void 0===e.segment)return!0;for(var a=e,o=e.segment+1,s=0;s>-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;s<r/2;){var u=t[o-1],h=t[o],f=t[o+1];if(!f)return!1;var d=u.angleTo(h)-h.angleTo(f);for(d=Math.abs((d+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:s,angleDelta:d}),c+=d;s-l[0].distance>n;)c-=l.shift().angleDelta;if(c>i)return!1;o++,s+=h.dist(f)}return!0}},{}],394:[function(t,e,r){"use strict";var n=t("point-geometry");e.exports=function(t,e,r,i,a){for(var o=[],s=0;s<t.length;s++)for(var l,c=t[s],u=0;u<c.length-1;u++){var h=c[u],f=c[u+1];h.x<e&&f.x<e||(h.x<e?h=new n(e,h.y+(f.y-h.y)*((e-h.x)/(f.x-h.x)))._round():f.x<e&&(f=new n(e,h.y+(f.y-h.y)*((e-h.x)/(f.x-h.x)))._round()),h.y<r&&f.y<r||(h.y<r?h=new n(h.x+(f.x-h.x)*((r-h.y)/(f.y-h.y)),r)._round():f.y<r&&(f=new n(h.x+(f.x-h.x)*((r-h.y)/(f.y-h.y)),r)._round()),h.x>=i&&f.x>=i||(h.x>=i?h=new n(i,h.y+(f.y-h.y)*((i-h.x)/(f.x-h.x)))._round():f.x>=i&&(f=new n(i,h.y+(f.y-h.y)*((i-h.x)/(f.x-h.x)))._round()),h.y>=a&&f.y>=a||(h.y>=a?h=new n(h.x+(f.x-h.x)*((a-h.y)/(f.y-h.y)),a)._round():f.y>=a&&(f=new n(h.x+(f.x-h.x)*((a-h.y)/(f.y-h.y)),a)._round()),l&&h.equals(l[l.length-1])||(l=[h],o.push(l)),l.push(f)))))}return o}},{"point-geometry":485}],395:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),a=t("point-geometry"),o=e.exports=new n({members:[{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:"Float32",name:"maxScale"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"bbox0"},{type:"Int16",name:"bbox1"},{type:"Int16",name:"bbox2"},{type:"Int16",name:"bbox3"},{type:"Float32",name:"placementScale"}]});i.extendAll(o.prototype.StructType.prototype,{get anchorPoint(){return new a(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":441,"../util/util":443,"point-geometry":485}],396:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u){var h=o.top*s-l,f=o.bottom*s+l,d=o.left*s-l,p=o.right*s+l;if(this.boxStartIndex=t.length,c){var m=f-h,g=p-d;if(m>0)if(m=Math.max(10*s,m),u){var v=e[r.segment+1].sub(e[r.segment])._unit()._mult(g),y=[r.sub(v),r.add(v)];this._addLineCollisionBoxes(t,y,r,0,g,m,n,i,a)}else this._addLineCollisionBoxes(t,e,r,r.segment,g,m,n,i,a)}else t.emplaceBack(r.x,r.y,d,h,p,f,1/0,n,i,a,0,0,0,0,0);this.boxEndIndex=t.length}e.exports=n,n.prototype._addLineCollisionBoxes=function(t,e,r,n,i,a,o,s,l){var c=a/2,u=Math.floor(i/c),h=-a/2,f=this.boxes,d=r,p=n+1,m=h;do{if(--p<0)return f;m-=e[p].dist(d),d=e[p]}while(m>-i/2);for(var g=e[p].dist(e[p+1]),v=0;v<u;v++){for(var y=-i/2+v*c;m+g<y;){if(m+=g,++p+1>=e.length)return f;g=e[p].dist(e[p+1])}var b=y-m,x=e[p],_=e[p+1].sub(x)._unit()._mult(b)._add(x)._round(),w=i/2/Math.max(Math.abs(y-h)-c/2,0);t.emplaceBack(_.x,_.y,-a/2,-a/2,a/2,a/2,w,o,s,l,0,0,0,0,0)}return f}},{}],397:[function(t,e,r){"use strict";function n(t,e,r){if("object"==typeof t){var n=t;r=e,t=n.angle,e=n.pitch,this.grid=new o(n.grid),this.ignoredGrid=new o(n.ignoredGrid)}else this.grid=new o(a,12,6),this.ignoredGrid=new o(a,12,0);this.angle=t,this.pitch=e;var i=Math.sin(t),s=Math.cos(t);if(this.rotationMatrix=[s,-i,i,s],this.reverseRotationMatrix=[s,i,-i,s],this.yStretch=1/Math.cos(e/180*Math.PI),this.yStretch=Math.pow(this.yStretch,1.3),this.collisionBoxArray=r,0===r.length){r.emplaceBack();r.emplaceBack(0,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(a,0,0,-32767,0,32767,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,0,-32767,0,32767,0,32767,0,0,0,0,0,0,0,0,0),r.emplaceBack(0,a,-32767,0,32767,0,32767,0,0,0,0,0,0,0,0,0)}this.tempCollisionBox=r.get(0),this.edges=[r.get(1),r.get(2),r.get(3),r.get(4)]}var i=t("point-geometry"),a=t("../data/bucket").EXTENT,o=t("grid-index");e.exports=n,n.prototype.serialize=function(){var t={angle:this.angle,pitch:this.pitch,grid:this.grid.toArrayBuffer(),ignoredGrid:this.ignoredGrid.toArrayBuffer()};return{data:t,transferables:[t.grid,t.ignoredGrid]}},n.prototype.minScale=.25,n.prototype.maxScale=2,n.prototype.placeCollisionFeature=function(t,e,r){for(var n=this.collisionBoxArray,a=this.minScale,o=this.rotationMatrix,s=this.yStretch,l=t.boxStartIndex;l<t.boxEndIndex;l++){var c=n.get(l),u=c.anchorPoint._matMult(o),h=u.x,f=u.y,d=h+c.x1,p=f+c.y1*s,m=h+c.x2,g=f+c.y2*s;if(c.bbox0=d,c.bbox1=p,c.bbox2=m,c.bbox3=g,!e)for(var v=this.grid.query(d,p,m,g),y=0;y<v.length;y++){var b=n.get(v[y]),x=b.anchorPoint._matMult(o);if((a=this.getPlacementScale(a,u,c,x,b))>=this.maxScale)return a}if(r){var _;if(this.angle){var w=this.reverseRotationMatrix,M=new i(c.x1,c.y1).matMult(w),k=new i(c.x2,c.y1).matMult(w),T=new i(c.x1,c.y2).matMult(w),A=new i(c.x2,c.y2).matMult(w);(_=this.tempCollisionBox).anchorPointX=c.anchorPoint.x,_.anchorPointY=c.anchorPoint.y,_.x1=Math.min(M.x,k.x,T.x,A.x),_.y1=Math.min(M.y,k.x,T.x,A.x),_.x2=Math.max(M.x,k.x,T.x,A.x),_.y2=Math.max(M.y,k.x,T.x,A.x),_.maxScale=c.maxScale}else _=c;for(var S=0;S<this.edges.length;S++){var E=this.edges[S];if((a=this.getPlacementScale(a,c.anchorPoint,_,E.anchorPoint,E))>=this.maxScale)return a}}}return a},n.prototype.queryRenderedSymbols=function(t,e,r,n,a){var o={},s=[],l=this.collisionBoxArray,c=this.rotationMatrix,u=new i(t,e)._matMult(c),h=this.tempCollisionBox;h.anchorX=u.x,h.anchorY=u.y,h.x1=0,h.y1=0,h.x2=r-t,h.y2=n-e,h.maxScale=a,a=h.maxScale;for(var f=[u.x+h.x1/a,u.y+h.y1/a*this.yStretch,u.x+h.x2/a,u.y+h.y2/a*this.yStretch],d=this.grid.query(f[0],f[1],f[2],f[3]),p=this.ignoredGrid.query(f[0],f[1],f[2],f[3]),m=0;m<p.length;m++)d.push(p[m]);for(var g=0;g<d.length;g++){var v=l.get(d[g]),y=v.sourceLayerIndex,b=v.featureIndex;if(void 0===o[y]&&(o[y]={}),!o[y][b]){var x=v.anchorPoint.matMult(c);this.getPlacementScale(this.minScale,u,h,x,v)>=a&&(o[y][b]=!0,s.push(d[g]))}}return s},n.prototype.getPlacementScale=function(t,e,r,n,i){var a=e.x-n.x,o=e.y-n.y,s=(i.x1-r.x2)/a,l=(i.x2-r.x1)/a,c=(i.y1-r.y2)*this.yStretch/o,u=(i.y2-r.y1)*this.yStretch/o;(isNaN(s)||isNaN(l))&&(s=l=1),(isNaN(c)||isNaN(u))&&(c=u=1);var h=Math.min(Math.max(s,l),Math.max(c,u)),f=i.maxScale,d=r.maxScale;return h>f&&(h=f),h>d&&(h=d),h>t&&h>=i.placementScale&&(t=h),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,a=t.boxStartIndex;a<t.boxEndIndex;a++){var o=i.get(a);o.placementScale=e,e<this.maxScale&&n.insert(a,o.bbox0,o.bbox1,o.bbox2,o.bbox3)}}},{"../data/bucket":330,"grid-index":288,"point-geometry":485}],398:[function(t,e,r){"use strict";function n(t,e,r,s,l,c,u,h,f){for(var d=c/2,p=0,m=0;m<t.length-1;m++)p+=t[m].dist(t[m+1]);for(var g=0,v=e-r,y=[],b=0;b<t.length-1;b++){for(var x=t[b],_=t[b+1],w=x.dist(_),M=_.angleTo(x);v+r<g+w;){var k=((v+=r)-g)/w,T=i(x.x,_.x,k),A=i(x.y,_.y,k);if(T>=0&&T<f&&A>=0&&A<f&&v-d>=0&&v+d<=p){var S=new a(T,A,M,b)._round();s&&!o(t,S,c,s,l)||y.push(S)}}g+=w}return h||y.length||u||(y=n(t,g/2,r,s,l,c,u,!0,f)),y}var i=t("../util/interpolate"),a=t("../symbol/anchor"),o=t("./check_max_angle");e.exports=function(t,e,r,i,a,o,s,l,c){var u=i?.6*o*s:0,h=Math.max(i?i.right-i.left:0,a?a.right-a.left:0),f=0===t[0].x||t[0].x===c||0===t[0].y||t[0].y===c;return e-h*s<e/4&&(e=h*s+e/4),n(t,f?e/2*l%e:(h/2+2*o)*s*l%e,e,u,r,h*s,f,!1,c)}},{"../symbol/anchor":392,"../util/interpolate":437,"./check_max_angle":393}],399:[function(t,e,r){"use strict";function n(){this.width=o,this.height=o,this.bin=new i(this.width,this.height),this.index={},this.ids={},this.data=new Uint8Array(this.width*this.height)}var i=t("shelf-pack"),a=t("../util/util"),o=128;e.exports=n,n.prototype.getGlyphs=function(){var t,e,r,n={};for(var i in this.ids)e=(t=i.split("#"))[0],r=t[1],n[e]||(n[e]=[]),n[e].push(r);return n},n.prototype.getRects=function(){var t,e,r,n={};for(var i in this.ids)e=(t=i.split("#"))[0],r=t[1],n[e]||(n[e]={}),n[e][r]=this.index[i];return n},n.prototype.addGlyph=function(t,e,r,n){if(!r)return null;var i=e+"#"+r.id;if(this.index[i])return this.ids[i].indexOf(t)<0&&this.ids[i].push(t),this.index[i];if(!r.bitmap)return null;var o=r.width+2*n,s=r.height+2*n,l=o+2,c=s+2;l+=4-l%4,c+=4-c%4;var u=this.bin.packOne(l,c);if(u||(this.resize(),u=this.bin.packOne(l,c)),!u)return a.warnOnce("glyph bitmap overflow"),null;this.index[i]=u,this.ids[i]=[t];for(var h=this.data,f=r.bitmap,d=0;d<s;d++)for(var p=this.width*(u.y+d+1)+u.x+1,m=o*d,g=0;g<o;g++)h[p+g]=f[m+g];return this.dirty=!0,u},n.prototype.resize=function(){var t=this.width,e=this.height;if(!(t>=2048||e>=2048)){this.texture&&(this.gl&&this.gl.deleteTexture(this.texture),this.texture=null),this.width*=4,this.height*=4,this.bin.resize(this.width,this.height);for(var r=new ArrayBuffer(this.width*this.height),n=0;n<e;n++){var i=new Uint8Array(this.data.buffer,e*n,t);new Uint8Array(r,e*n*4,t).set(i)}this.data=new Uint8Array(r)}},n.prototype.bind=function(t){this.gl=t,this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.LINEAR),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),t.texImage2D(t.TEXTURE_2D,0,t.ALPHA,this.width,this.height,0,t.ALPHA,t.UNSIGNED_BYTE,null))},n.prototype.updateTexture=function(t){this.bind(t),this.dirty&&(t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width,this.height,t.ALPHA,t.UNSIGNED_BYTE,this.data),this.dirty=!1)}},{"../util/util":443,"shelf-pack":523}],400:[function(t,e,r){"use strict";function n(t){this.url=t&&a(t),this.atlases={},this.stacks={},this.loading={}}function i(t,e,r){this.advance=t.advance,this.left=t.left-r-1,this.top=t.top+r+1,this.rect=e}var a=t("../util/mapbox").normalizeGlyphsURL,o=t("../util/ajax").getArrayBuffer,s=t("../util/glyphs"),l=t("../symbol/glyph_atlas"),c=t("pbf");e.exports=n,n.prototype.getSimpleGlyphs=function(t,e,r,n){void 0===this.stacks[t]&&(this.stacks[t]={}),void 0===this.atlases[t]&&(this.atlases[t]=new l);for(var a,o={},s=this.stacks[t],c=this.atlases[t],u={},h=0,f=0;f<e.length;f++){var d=e[f];if(a=Math.floor(d/256),s[a]){var p=s[a].glyphs[d],m=c.addGlyph(r,t,p,3);p&&(o[d]=new i(p,m,3))}else void 0===u[a]&&(u[a]=[],h++),u[a].push(d)}h||n(void 0,o,t);var g=function(e,a,s){if(!e)for(var l=this.stacks[t][a]=s.stacks[0],f=0;f<u[a].length;f++){var d=u[a][f],p=l.glyphs[d],m=c.addGlyph(r,t,p,3);p&&(o[d]=new i(p,m,3))}--h||n(void 0,o,t)}.bind(this);for(var v in u)this.loadRange(t,v,g)},n.prototype.loadRange=function(t,e,r){if(256*e>65535)return r("glyphs > 65535 not supported");void 0===this.loading[t]&&(this.loading[t]={});var n=this.loading[t];if(n[e])n[e].push(r);else{n[e]=[r];var i=function(t,e,r,n){return n=n||"abc",r.replace("{s}",n[t.length%n.length]).replace("{fontstack}",t).replace("{range}",e)}(t,256*e+"-"+(256*e+255),this.url);o(i,function(t,r){for(var i=!t&&new s(new c(new Uint8Array(r))),a=0;a<n[e].length;a++)n[e][a](t,e,i);delete n[e]})}},n.prototype.getGlyphAtlas=function(t){return this.atlases[t]}},{"../symbol/glyph_atlas":399,"../util/ajax":426,"../util/glyphs":436,"../util/mapbox":440,pbf:479}],401:[function(t,e,r){"use strict";e.exports=function(t,e,r){function n(n){u.push(t[n]),h.push(r[n]),f.push(e[n]),d++}function i(t,e,r){var n=c[t];return delete c[t],c[e]=n,h[n][0].pop(),h[n][0]=h[n][0].concat(r[0]),n}function a(t,e,r){var n=l[e];return delete l[e],l[t]=n,h[n][0].shift(),h[n][0]=r[0].concat(h[n][0]),n}function o(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}var s,l={},c={},u=[],h=[],f=[],d=0;for(s=0;s<t.length;s++){var p=r[s],m=e[s];if(m){var g=o(m,p),v=o(m,p,!0);if(g in c&&v in l&&c[g]!==l[v]){var y=a(g,v,p),b=i(g,v,h[y]);delete l[g],delete c[v],c[o(m,h[b],!0)]=b,h[y]=null}else g in c?i(g,v,p):v in l?a(g,v,p):(n(s),l[g]=d-1,c[v]=d-1)}else n(s)}return{features:u,textFeatures:f,geometries:h}}},{}],402:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c){this.anchorPoint=t,this.tl=e,this.tr=r,this.bl=n,this.br=i,this.tex=a,this.anchorAngle=o,this.glyphAngle=s,this.minScale=l,this.maxScale=c}function i(t,e,r,n,i,s){var l=!s;r<0&&(s=!s),s&&i++;var c=new a(e.x,e.y),u=n[i],h=1/0;r=Math.abs(r);for(var f=o;;){var d=c.dist(u),p=r/d,m=Math.atan2(u.y-c.y,u.x-c.x);if(s||(m+=Math.PI),t.push({anchorPoint:c,offset:l?Math.PI:0,minScale:p,maxScale:h,angle:(m+2*Math.PI)%(2*Math.PI)}),p<=f)break;for(c=u;c.equals(u);)if(i+=s?1:-1,!(u=n[i]))return p;var g=u.sub(c)._unit();c=c.sub(g._mult(d)),h=p}return f}var a=t("point-geometry");e.exports={getIconQuads:function(t,e,r,i,s,l,c,u,h){var f,d,p,m,g=e.image.rect,v=s.layout,y=e.left-1,b=y+g.w/e.image.pixelRatio,x=e.top-1,_=x+g.h/e.image.pixelRatio;if("none"!==v["icon-text-fit"]&&c){var w=b-y,M=_-x,k=v["text-size"]/24,T=c.left*k,A=c.right*k,S=c.top*k,E=A-T,L=c.bottom*k-S,C=v["icon-text-fit-padding"][0],I=v["icon-text-fit-padding"][1],P=v["icon-text-fit-padding"][2],D=v["icon-text-fit-padding"][3],z="width"===v["icon-text-fit"]?.5*(L-M):0,O="height"===v["icon-text-fit"]?.5*(E-w):0,F="width"===v["icon-text-fit"]||"both"===v["icon-text-fit"]?E:w,R="height"===v["icon-text-fit"]||"both"===v["icon-text-fit"]?L:M;f=new a(T+O-D,S+z-C),d=new a(T+O+I+F,S+z-C),p=new a(T+O+I+F,S+z+P+R),m=new a(T+O-D,S+z+P+R)}else f=new a(y,x),d=new a(b,x),p=new a(b,_),m=new a(y,_);var j=s.getLayoutValue("icon-rotate",u,h)*Math.PI/180;if(l){var N=i[t.segment];if(t.y===N.y&&t.x===N.x&&t.segment+1<i.length){var B=i[t.segment+1];j+=Math.atan2(t.y-B.y,t.x-B.x)+Math.PI}else j+=Math.atan2(t.y-N.y,t.x-N.x)}if(j){var U=Math.sin(j),V=Math.cos(j),H=[V,-U,U,V];f=f.matMult(H),d=d.matMult(H),m=m.matMult(H),p=p.matMult(H)}return[new n(new a(t.x,t.y),f,d,m,p,e.image.rect,0,0,o,1/0)]},getGlyphQuads:function(t,e,r,s,l,c){for(var u=l.layout["text-rotate"]*Math.PI/180,h=l.layout["text-keep-upright"],f=e.positionedGlyphs,d=[],p=0;p<f.length;p++){var m=f[p],g=m.glyph,v=g.rect;if(v){var y,b=(m.x+g.advance/2)*r,x=o;c?(x=i(y=[],t,b,s,t.segment,!0),h&&(x=Math.min(x,i(y,t,b,s,t.segment,!1)))):y=[{anchorPoint:new a(t.x,t.y),offset:0,angle:0,maxScale:1/0,minScale:o}];for(var _=m.x+g.left,w=m.y-g.top,M=_+v.w,k=w+v.h,T=new a(_,w),A=new a(M,w),S=new a(_,k),E=new a(M,k),L=0;L<y.length;L++){var C=y[L],I=T,P=A,D=S,z=E;if(u){var O=Math.sin(u),F=Math.cos(u),R=[F,-O,O,F];I=I.matMult(R),P=P.matMult(R),D=D.matMult(R),z=z.matMult(R)}var j=Math.max(C.minScale,x),N=(t.angle+C.offset+2*Math.PI)%(2*Math.PI),B=(C.angle+C.offset+2*Math.PI)%(2*Math.PI);d.push(new n(C.anchorPoint,I,P,D,z,v,N,B,j,C.maxScale))}}}return d},SymbolQuad:n};var o=.5},{"point-geometry":485}],403:[function(t,e,r){"use strict";var n=t("../util/token");e.exports=function(t,e,r){for(var i=[],a=0,o=t.length;a<o;a++){var s=n(t[a].properties,e["text-field"]);if(s){s=s.toString();var l=e["text-transform"];"uppercase"===l?s=s.toLocaleUpperCase():"lowercase"===l&&(s=s.toLocaleLowerCase());for(var c=0;c<s.length;c++)r[s.charCodeAt(c)]=!0;i[a]=s}else i[a]=null}return i}},{"../util/token":442}],404:[function(t,e,r){"use strict";function n(t,e,r,n){this.codePoint=t,this.x=e,this.y=r,this.glyph=n}function i(t,e,r,n,i){for(var a=e[t[n].codePoint].advance,o=(t[n].x+a)*i,s=r;s<=n;s++)t[s].x-=o}e.exports={shapeText:function(t,e,r,s,l,c,u,h,f){for(var d=[],p=new function(t,e,r,n,i,a){this.positionedGlyphs=t,this.text=e,this.top=r,this.bottom=n,this.left=i,this.right=a}(d,t,f[1],f[1],f[0],f[0]),m=0,g=0;g<t.length;g++){var v=t.charCodeAt(g),y=e[v];y&&(d.push(new n(v,m,-17,y)),m+=y.advance+h)}return!!d.length&&(function(t,e,r,n,s,l,c,u){var h=null,f=0,d=0,p=0,m=0,g=t.positionedGlyphs;if(n)for(var v=0;v<g.length;v++){var y=g[v];if(y.x-=f,y.y+=r*p,y.x>n&&null!==h){var b=g[h+1].x;m=Math.max(b,m);for(var x=h+1;x<=v;x++)g[x].y+=r,g[x].x-=b;if(c){var _=h;a[g[h].codePoint]&&_--,i(g,e,d,_,c)}d=h+1,h=null,f+=b,p++}o[y.codePoint]&&(h=v)}var w=g[g.length-1],M=w.x+e[w.codePoint].advance;m=Math.max(m,M);var k=(p+1)*r;i(g,e,d,g.length-1,c),function(t,e,r,n,i,a,o,s){for(var l=(e-r)*i+s[0],c=(-n*(o+1)+.5)*a+s[1],u=0;u<t.length;u++)t[u].x+=l,t[u].y+=c}(g,c,s,l,m,r,p,u),t.top+=-l*k,t.bottom=t.top+k,t.left+=-s*m,t.right=t.left+m}(p,e,s,r,l,c,u,f),p)},shapeIcon:function(t,e){if(!t||!t.rect)return null;var r=e["icon-offset"][0],n=e["icon-offset"][1],i=r-t.width/2,a=i+t.width,o=n-t.height/2;return new function(t,e,r,n,i){this.image=t,this.top=e,this.bottom=r,this.left=n,this.right=i}(t,o,o+t.height,i,a)}};var a={32:!0,8203:!0},o={32:!0,38:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0}},{}],405:[function(t,e,r){"use strict";function n(t,e){this.width=t,this.height=e,this.bin=new i(t,e),this.images={},this.data=!1,this.texture=0,this.filter=0,this.pixelRatio=1,this.dirty=!0}var i=t("shelf-pack"),a=t("../util/browser"),o=t("../util/util");e.exports=n,n.prototype.allocateImage=function(t,e){var r=(t/=this.pixelRatio)+2+(4-(t+2)%4),n=(e/=this.pixelRatio)+2+(4-(e+2)%4),i=this.bin.packOne(r,n);return i||(o.warnOnce("SpriteAtlas out of space."),null)},n.prototype.getImage=function(t,e){if(this.images[t])return this.images[t];if(!this.sprite)return null;var r=this.sprite.getSpritePosition(t);if(!r.width||!r.height)return null;var n=this.allocateImage(r.width,r.height);if(!n)return null;var i=new function(t,e,r,n,i){this.rect=t,this.width=e,this.height=r,this.sdf=n,this.pixelRatio=i}(n,r.width/r.pixelRatio,r.height/r.pixelRatio,r.sdf,r.pixelRatio/this.pixelRatio);return this.images[t]=i,this.copy(n,r,e),i},n.prototype.getPosition=function(t,e){var r=this.getImage(t,e),n=r&&r.rect;if(!n)return null;var i=r.width*r.pixelRatio,a=r.height*r.pixelRatio;return{size:[r.width,r.height],tl:[(n.x+1)/this.width,(n.y+1)/this.height],br:[(n.x+1+i)/this.width,(n.y+1+a)/this.height]}},n.prototype.allocate=function(){if(!this.data){var t=Math.floor(this.width*this.pixelRatio),e=Math.floor(this.height*this.pixelRatio);this.data=new Uint32Array(t*e);for(var r=0;r<this.data.length;r++)this.data[r]=0}},n.prototype.copy=function(t,e,r){if(this.sprite.img.data){var n=new Uint32Array(this.sprite.img.data.buffer);this.allocate();var i=this.data;!function(t,e,r,n,i,a,o,s,l,c,u){var h,f,d=n*e+r,p=s*a+o;if(u)for(p-=a,f=-1;f<=c;f++,d=((f+c)%c+n)*e+r,p+=a)for(h=-1;h<=l;h++)i[p+h]=t[d+(h+l)%l];else for(f=0;f<c;f++,d+=e,p+=a)for(h=0;h<l;h++)i[p+h]=t[d+h]}(n,this.sprite.img.width,e.x,e.y,i,this.width*this.pixelRatio,(t.x+1)*this.pixelRatio,(t.y+1)*this.pixelRatio,e.width,e.height,r),this.dirty=!0}},n.prototype.setSprite=function(t){t&&(this.pixelRatio=a.devicePixelRatio>1?2:1,this.canvas&&(this.canvas.width=this.width*this.pixelRatio,this.canvas.height=this.height*this.pixelRatio)),this.sprite=t},n.prototype.addIcons=function(t,e){for(var r=0;r<t.length;r++)this.getImage(t[r]);e(null,this.images)},n.prototype.bind=function(t,e){var r=!1;this.texture?t.bindTexture(t.TEXTURE_2D,this.texture):(this.texture=t.createTexture(),t.bindTexture(t.TEXTURE_2D,this.texture),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),r=!0);var n=e?t.LINEAR:t.NEAREST;n!==this.filter&&(t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,n),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,n),this.filter=n),this.dirty&&(this.allocate(),r?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,this.width*this.pixelRatio,this.height*this.pixelRatio,0,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)):t.texSubImage2D(t.TEXTURE_2D,0,0,0,this.width*this.pixelRatio,this.height*this.pixelRatio,t.RGBA,t.UNSIGNED_BYTE,new Uint8Array(this.data.buffer)),this.dirty=!1)}},{"../util/browser":427,"../util/util":443,"shelf-pack":523}],406:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),a=t("point-geometry"),o=e.exports=new n({members:[{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"glyphQuadStartIndex"},{type:"Uint16",name:"glyphQuadEndIndex"},{type:"Uint16",name:"iconQuadStartIndex"},{type:"Uint16",name:"iconQuadEndIndex"},{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int8",name:"index"}]});i.extendAll(o.prototype.StructType.prototype,{get anchorPoint(){return new a(this.anchorPointX,this.anchorPointY)}})},{"../util/struct_array":441,"../util/util":443,"point-geometry":485}],407:[function(t,e,r){"use strict";var n=t("../util/struct_array"),i=t("../util/util"),a=t("point-geometry"),o=t("./quads").SymbolQuad,s=e.exports=new n({members:[{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Float32",name:"tlX"},{type:"Float32",name:"tlY"},{type:"Float32",name:"trX"},{type:"Float32",name:"trY"},{type:"Float32",name:"blX"},{type:"Float32",name:"blY"},{type:"Float32",name:"brX"},{type:"Float32",name:"brY"},{type:"Int16",name:"texH"},{type:"Int16",name:"texW"},{type:"Int16",name:"texX"},{type:"Int16",name:"texY"},{type:"Float32",name:"anchorAngle"},{type:"Float32",name:"glyphAngle"},{type:"Float32",name:"maxScale"},{type:"Float32",name:"minScale"}]});i.extendAll(s.prototype.StructType.prototype,{get anchorPoint(){return new a(this.anchorPointX,this.anchorPointY)},get SymbolQuad(){return new o(this.anchorPoint,new a(this.tlX,this.tlY),new a(this.trX,this.trY),new a(this.blX,this.blY),new a(this.brX,this.brY),{x:this.texX,y:this.texY,h:this.texH,w:this.texW,height:this.texH,width:this.texW},this.anchorAngle,this.glyphAngle,this.minScale,this.maxScale)}})},{"../util/struct_array":441,"../util/util":443,"./quads":402,"point-geometry":485}],408:[function(t,e,r){"use strict";var n=t("../util/dom"),i=t("point-geometry"),a={scrollZoom:t("./handler/scroll_zoom"),boxZoom:t("./handler/box_zoom"),dragRotate:t("./handler/drag_rotate"),dragPan:t("./handler/drag_pan"),keyboard:t("./handler/keyboard"),doubleClickZoom:t("./handler/dblclick_zoom"),touchZoomRotate:t("./handler/touch_zoom_rotate")};e.exports=function(t,e){function r(){h=null}function o(e,r){var i=n.mousePos(l,r);return t.fire(e,{lngLat:t.unproject(i),point:i,originalEvent:r})}function s(e,r){var a=n.touchPos(l,r),o=a.reduce(function(t,e,r,n){return t.add(e.div(n.length))},new i(0,0));return t.fire(e,{lngLat:t.unproject(o),point:o,lngLats:a.map(function(e){return t.unproject(e)},this),points:a,originalEvent:r})}var l=t.getCanvasContainer(),c=null,u=null,h=null;for(var f in a)t[f]=new a[f](t,e),e.interactive&&e[f]&&t[f].enable();l.addEventListener("mouseout",function(t){o("mouseout",t)},!1),l.addEventListener("mousedown",function(e){t.stop(),u=n.mousePos(l,e),o("mousedown",e)},!1),l.addEventListener("mouseup",function(e){var r=t.dragRotate&&t.dragRotate.isActive();c&&!r&&o("contextmenu",c),c=null,o("mouseup",e)},!1),l.addEventListener("mousemove",function(e){if(!(t.dragPan&&t.dragPan.isActive()||t.dragRotate&&t.dragRotate.isActive())){for(var r=e.toElement||e.target;r&&r!==l;)r=r.parentNode;r===l&&o("mousemove",e)}},!1),l.addEventListener("touchstart",function(e){t.stop(),s("touchstart",e),!e.touches||e.touches.length>1||(h?(clearTimeout(h),h=null,o("dblclick",e)):h=setTimeout(r,300))},!1),l.addEventListener("touchend",function(t){s("touchend",t)},!1),l.addEventListener("touchmove",function(t){s("touchmove",t)},!1),l.addEventListener("touchcancel",function(t){s("touchcancel",t)},!1),l.addEventListener("click",function(t){n.mousePos(l,t).equals(u)&&o("click",t)},!1),l.addEventListener("dblclick",function(t){o("dblclick",t),t.preventDefault()},!1),l.addEventListener("contextmenu",function(t){c=t,t.preventDefault()},!1)}},{"../util/dom":429,"./handler/box_zoom":414,"./handler/dblclick_zoom":415,"./handler/drag_pan":416,"./handler/drag_rotate":417,"./handler/keyboard":418,"./handler/scroll_zoom":419,"./handler/touch_zoom_rotate":420,"point-geometry":485}],409:[function(t,e,r){"use strict";var n=t("../util/util"),i=t("../util/interpolate"),a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("point-geometry"),c=e.exports=function(){};n.extend(c.prototype,{getCenter:function(){return this.transform.center},setCenter:function(t,e){return this.jumpTo({center:t},e),this},panBy:function(t,e,r){return this.panTo(this.transform.center,n.extend({offset:l.convert(t).mult(-1)},e),r),this},panTo:function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},getZoom:function(){return this.transform.zoom},setZoom:function(t,e){return this.jumpTo({zoom:t},e),this},zoomTo:function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},zoomIn:function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},zoomOut:function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},getBearing:function(){return this.transform.bearing},setBearing:function(t,e){return this.jumpTo({bearing:t},e),this},rotateTo:function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},resetNorth:function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},snapToNorth:function(t,e){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(t,e):this},getPitch:function(){return this.transform.pitch},setPitch:function(t,e){return this.jumpTo({pitch:t},e),this},fitBounds:function(t,e,r){e=n.extend({padding:0,offset:[0,0],maxZoom:1/0},e),t=s.convert(t);var i=l.convert(e.offset),a=this.transform,o=a.project(t.getNorthWest()),c=a.project(t.getSouthEast()),u=c.sub(o),h=(a.width-2*e.padding-2*Math.abs(i.x))/u.x,f=(a.height-2*e.padding-2*Math.abs(i.y))/u.y;return e.center=a.unproject(o.add(c).div(2)),e.zoom=Math.min(a.scaleZoom(a.scale*Math.min(h,f)),e.maxZoom),e.bearing=0,e.linear?this.easeTo(e,r):this.flyTo(e,r)},jumpTo:function(t,e){this.stop();var r=this.transform,n=!1,i=!1,a=!1;return"zoom"in t&&r.zoom!==+t.zoom&&(n=!0,r.zoom=+t.zoom),"center"in t&&(r.center=o.convert(t.center)),"bearing"in t&&r.bearing!==+t.bearing&&(i=!0,r.bearing=+t.bearing),"pitch"in t&&r.pitch!==+t.pitch&&(a=!0,r.pitch=+t.pitch),this.fire("movestart",e).fire("move",e),n&&this.fire("zoomstart",e).fire("zoom",e).fire("zoomend",e),i&&this.fire("rotate",e),a&&this.fire("pitch",e),this.fire("moveend",e)},easeTo:function(t,e){this.stop(),t=n.extend({offset:[0,0],duration:500,easing:n.ease},t);var r,a,s=this.transform,c=l.convert(t.offset),u=this.getZoom(),h=this.getBearing(),f=this.getPitch(),d="zoom"in t?+t.zoom:u,p="bearing"in t?this._normalizeBearing(t.bearing,h):h,m="pitch"in t?+t.pitch:f;"center"in t?(r=o.convert(t.center),a=s.centerPoint.add(c)):"around"in t?(r=o.convert(t.around),a=s.locationPoint(r)):(a=s.centerPoint.add(c),r=s.pointLocation(a));var g=s.locationPoint(r);return!1===t.animate&&(t.duration=0),this.zooming=d!==u,this.rotating=h!==p,this.pitching=m!==f,t.noMoveStart||this.fire("movestart",e),this.zooming&&this.fire("zoomstart",e),clearTimeout(this._onEaseEnd),this._ease(function(t){this.zooming&&(s.zoom=i(u,d,t)),this.rotating&&(s.bearing=i(h,p,t)),this.pitching&&(s.pitch=i(f,m,t)),s.setLocationAtPoint(r,g.add(a.sub(g)._mult(t))),this.fire("move",e),this.zooming&&this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){t.delayEndEvents?this._onEaseEnd=setTimeout(this._easeToEnd.bind(this,e),t.delayEndEvents):this._easeToEnd(e)}.bind(this),t),this},_easeToEnd:function(t){var e=this.zooming;this.zooming=!1,this.rotating=!1,this.pitching=!1,e&&this.fire("zoomend",t),this.fire("moveend",t)},flyTo:function(t,e){function r(t){var e=(k*k-M*M+(t?-1:1)*E*E*T*T)/(2*(t?k:M)*E*T);return Math.log(Math.sqrt(e*e+1)-e)}function a(t){return(Math.exp(t)-Math.exp(-t))/2}function s(t){return(Math.exp(t)+Math.exp(-t))/2}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);var c=this.transform,u=l.convert(t.offset),h=this.getZoom(),f=this.getBearing(),d=this.getPitch(),p="center"in t?o.convert(t.center):this.getCenter(),m="zoom"in t?+t.zoom:h,g="bearing"in t?this._normalizeBearing(t.bearing,f):f,v="pitch"in t?+t.pitch:d;Math.abs(c.center.lng)+Math.abs(p.lng)>180&&(c.center.lng>0&&p.lng<0?p.lng+=360:c.center.lng<0&&p.lng>0&&(p.lng-=360));var y=c.zoomScale(m-h),b=c.point,x="center"in t?c.project(p).sub(u.div(y)):b,_=c.worldSize,w=t.curve,M=Math.max(c.width,c.height),k=M/y,T=x.sub(b).mag();if("minZoom"in t){var A=n.clamp(Math.min(t.minZoom,h,m),c.minZoom,c.maxZoom),S=M/c.zoomScale(A-h);w=Math.sqrt(S/T*2)}var E=w*w,L=r(0),C=function(t){return s(L)/s(L+w*t)},I=function(t){return M*((s(L)*function(t){return a(t)/s(t)}(L+w*t)-a(L))/E)/T},P=(r(1)-L)/w;if(Math.abs(T)<1e-6){if(Math.abs(M-k)<1e-6)return this.easeTo(t);var D=k<M?-1:1;P=Math.abs(Math.log(k/M))/w,I=function(){return 0},C=function(t){return Math.exp(D*w*t)}}if("duration"in t)t.duration=+t.duration;else{var z="screenSpeed"in t?+t.screenSpeed/w:+t.speed;t.duration=1e3*P/z}return this.zooming=!0,f!==g&&(this.rotating=!0),d!==v&&(this.pitching=!0),this.fire("movestart",e),this.fire("zoomstart",e),this._ease(function(t){var r=t*P,n=I(r);c.zoom=h+c.scaleZoom(1/C(r)),c.center=c.unproject(b.add(x.sub(b).mult(n)),_),this.rotating&&(c.bearing=i(f,g,t)),this.pitching&&(c.pitch=i(d,v,t)),this.fire("move",e),this.fire("zoom",e),this.rotating&&this.fire("rotate",e),this.pitching&&this.fire("pitch",e)},function(){this.zooming=!1,this.rotating=!1,this.pitching=!1,this.fire("zoomend",e),this.fire("moveend",e)},t),this},isEasing:function(){return!!this._abortFn},stop:function(){return this._abortFn&&(this._abortFn(),this._finishEase()),this},_ease:function(t,e,r){this._finishFn=e,this._abortFn=a.timed(function(e){t.call(this,r.easing(e)),1===e&&this._finishEase()},!1===r.animate?0:r.duration,this)},_finishEase:function(){delete this._abortFn;var t=this._finishFn;delete this._finishFn,t.call(this)},_normalizeBearing:function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)<r&&(t-=360),Math.abs(t+360-e)<r&&(t+=360),t},_updateEasing:function(t,e,r){var i;if(this.ease){var a=this.ease,o=(Date.now()-a.start)/a.duration,s=a.easing(o+.01)-a.easing(o),l=.27/Math.sqrt(s*s+1e-4)*.01,c=Math.sqrt(.0729-l*l);i=n.bezier(l,c,.25,1)}else i=r?n.bezier.apply(n,r):n.ease;return this.ease={start:(new Date).getTime(),to:Math.pow(2,e),duration:t,easing:i},i}})},{"../geo/lng_lat":340,"../geo/lng_lat_bounds":341,"../util/browser":427,"../util/interpolate":437,"../util/util":443,"point-geometry":485}],410:[function(t,e,r){"use strict";function n(t){o.setOptions(this,t)}var i=t("./control"),a=t("../../util/dom"),o=t("../../util/util");e.exports=n,n.createAttributionString=function(t){var e=[];for(var r in t){var n=t[r];n.attribution&&e.indexOf(n.attribution)<0&&e.push(n.attribution)}return e.sort(function(t,e){return t.length-e.length}),(e=e.filter(function(t,r){for(var n=r+1;n<e.length;n++)if(e[n].indexOf(t)>=0)return!1;return!0})).join(" | ")},n.prototype=o.inherit(i,{options:{position:"bottom-right"},onAdd:function(t){var e=this._container=a.create("div","mapboxgl-ctrl-attrib",t.getContainer());return this._update(),t.on("source.load",this._update.bind(this)),t.on("source.change",this._update.bind(this)),t.on("source.remove",this._update.bind(this)),t.on("moveend",this._updateEditLink.bind(this)),e},_update:function(){this._map.style&&(this._container.innerHTML=n.createAttributionString(this._map.style.sources)),this._editLink=this._container.getElementsByClassName("mapbox-improve-map")[0],this._updateEditLink()},_updateEditLink:function(){if(this._editLink){var t=this._map.getCenter();this._editLink.href="https://www.mapbox.com/map-feedback/#/"+t.lng+"/"+t.lat+"/"+Math.round(this._map.getZoom()+1)}}})},{"../../util/dom":429,"../../util/util":443,"./control":411}],411:[function(t,e,r){"use strict";function n(){}var i=t("../../util/util"),a=t("../../util/evented");e.exports=n,n.prototype={addTo:function(t){this._map=t;var e=this._container=this.onAdd(t);if(this.options&&this.options.position){var r=this.options.position,n=t._controlCorners[r];e.className+=" mapboxgl-ctrl",-1!==r.indexOf("bottom")?n.insertBefore(e,n.firstChild):n.appendChild(e)}return this},remove:function(){return this._container.parentNode.removeChild(this._container),this.onRemove&&this.onRemove(this._map),this._map=null,this}},i.extend(n.prototype,a)},{"../../util/evented":435,"../../util/util":443}],412:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}var i=t("./control"),a=t("../../util/browser"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n;var l={enableHighAccuracy:!1,timeout:6e3};n.prototype=s.inherit(i,{options:{position:"top-right"},onAdd:function(t){var e=this._container=o.create("div","mapboxgl-ctrl-group",t.getContainer());return a.supportsGeolocation?(this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._geolocateButton=o.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),e):e},_onContextMenu:function(t){t.preventDefault()},_onClickGeolocate:function(){navigator.geolocation.getCurrentPosition(this._success.bind(this),this._error.bind(this),l),this._timeoutId=setTimeout(this._finish.bind(this),1e4)},_success:function(t){this._map.jumpTo({center:[t.coords.longitude,t.coords.latitude],zoom:17,bearing:0,pitch:0}),this.fire("geolocate",t),this._finish()},_error:function(t){this.fire("error",t),this._finish()},_finish:function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}})},{"../../util/browser":427,"../../util/dom":429,"../../util/util":443,"./control":411}],413:[function(t,e,r){"use strict";function n(t){s.setOptions(this,t)}function i(t){return new MouseEvent(t.type,{button:2,buttons:2,bubbles:!0,cancelable:!0,detail:t.detail,view:t.view,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,movementX:t.movementX,movementY:t.movementY,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})}var a=t("./control"),o=t("../../util/dom"),s=t("../../util/util");e.exports=n,n.prototype=s.inherit(a,{options:{position:"top-right"},onAdd:function(t){var e="mapboxgl-ctrl",r=this._container=o.create("div",e+"-group",t.getContainer());return this._container.addEventListener("contextmenu",this._onContextMenu.bind(this)),this._zoomInButton=this._createButton(e+"-icon "+e+"-zoom-in",t.zoomIn.bind(t)),this._zoomOutButton=this._createButton(e+"-icon "+e+"-zoom-out",t.zoomOut.bind(t)),this._compass=this._createButton(e+"-icon "+e+"-compass",t.resetNorth.bind(t)),this._compassArrow=o.create("div","arrow",this._compass),this._compass.addEventListener("mousedown",this._onCompassDown.bind(this)),this._onCompassMove=this._onCompassMove.bind(this),this._onCompassUp=this._onCompassUp.bind(this),t.on("rotate",this._rotateCompassArrow.bind(this)),this._rotateCompassArrow(),this._el=t.getCanvasContainer(),r},_onContextMenu:function(t){t.preventDefault()},_onCompassDown:function(t){0===t.button&&(o.disableDrag(),document.addEventListener("mousemove",this._onCompassMove),document.addEventListener("mouseup",this._onCompassUp),this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassMove:function(t){0===t.button&&(this._el.dispatchEvent(i(t)),t.stopPropagation())},_onCompassUp:function(t){0===t.button&&(document.removeEventListener("mousemove",this._onCompassMove),document.removeEventListener("mouseup",this._onCompassUp),o.enableDrag(),this._el.dispatchEvent(i(t)),t.stopPropagation())},_createButton:function(t,e){var r=o.create("button",t,this._container);return r.type="button",r.addEventListener("click",function(){e()}),r},_rotateCompassArrow:function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t}})},{"../../util/dom":429,"../../util/util":443,"./control":411}],414:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../geo/lng_lat_bounds"),o=t("../../util/util");e.exports=n,n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onMouseDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},_onMouseDown:function(t){t.shiftKey&&0===t.button&&(document.addEventListener("mousemove",this._onMouseMove,!1),document.addEventListener("keydown",this._onKeyDown,!1),document.addEventListener("mouseup",this._onMouseUp,!1),i.disableDrag(),this._startPos=i.mousePos(this._el,t),this._active=!0)},_onMouseMove:function(t){var e=this._startPos,r=i.mousePos(this._el,t);this._box||(this._box=i.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var n=Math.min(e.x,r.x),a=Math.max(e.x,r.x),o=Math.min(e.y,r.y),s=Math.max(e.y,r.y);i.setTransform(this._box,"translate("+n+"px,"+o+"px)"),this._box.style.width=a-n+"px",this._box.style.height=s-o+"px"},_onMouseUp:function(t){if(0===t.button){var e=this._startPos,r=i.mousePos(this._el,t),n=new a(this._map.unproject(e),this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(n,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:n})}},_onKeyDown:function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},_finish:function(){this._active=!1,document.removeEventListener("mousemove",this._onMouseMove,!1),document.removeEventListener("keydown",this._onKeyDown,!1),document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.parentNode.removeChild(this._box),this._box=null),i.enableDrag()},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})}}},{"../../geo/lng_lat_bounds":341,"../../util/dom":429,"../../util/util":443}],415:[function(t,e,r){"use strict";function n(t){this._map=t,this._onDblClick=this._onDblClick.bind(this)}e.exports=n,n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},_onDblClick:function(t){this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)}}},{}],416:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=a.bezier(0,0,.3,1);n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},_onDown:function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(document.addEventListener("touchmove",this._onMove),document.addEventListener("touchend",this._onTouchEnd)):(document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onMouseUp)),this._active=!1,this._startPos=this._pos=i.mousePos(this._el,t),this._inertia=[[Date.now(),this._pos]])},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t));var e=i.mousePos(this._el,t),r=this._map;r.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),e]),r.transform.setLocationAtPoint(r.transform.pointLocation(this._pos),e),this._fireEvent("drag",t),this._fireEvent("move",t),this._pos=e,t.preventDefault()}},_onUp:function(t){if(this.isActive()){this._active=!1,this._fireEvent("dragend",t),this._drainInertiaBuffer();var e=function(){this._fireEvent("moveend",t)}.bind(this),r=this._inertia;if(r.length<2)e();else{var n=r[r.length-1],i=r[0],a=n[1].sub(i[1]),s=(n[0]-i[0])/1e3;if(0===s||n[1].equals(i[1]))e();else{var l=a.mult(.3/s),c=l.mag();c>1400&&(c=1400,l._unit()._mult(c));var u=c/750,h=l.mult(-u/2);this._map.panBy(h,{duration:1e3*u,easing:o,noMoveStart:!0},{originalEvent:t})}}}},_onMouseUp:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onMouseUp))},_onTouchEnd:function(t){this._ignoreEvent(t)||(this._onUp(t),document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onTouchEnd))},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragRotate&&e.dragRotate.isActive())return!0;if(t.touches)return t.touches.length>1;if(t.ctrlKey)return!0;return"mousemove"===t.type?!1&t.buttons:0!==t.button},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":429,"../../util/util":443}],417:[function(t,e,r){"use strict";function n(t,e){this._map=t,this._el=t.getCanvasContainer(),this._bearingSnap=e.bearingSnap,o.bindHandlers(this)}var i=t("../../util/dom"),a=t("point-geometry"),o=t("../../util/util");e.exports=n;var s=o.bezier(0,0,.25,1);n.prototype={_enabled:!1,_active:!1,isEnabled:function(){return this._enabled},isActive:function(){return this._active},enable:function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},_onDown:function(t){if(!this._ignoreEvent(t)&&!this.isActive()){document.addEventListener("mousemove",this._onMove),document.addEventListener("mouseup",this._onUp),this._active=!1,this._inertia=[[Date.now(),this._map.getBearing()]],this._startPos=this._pos=i.mousePos(this._el,t),this._center=this._map.transform.centerPoint;var e=this._startPos.sub(this._center);e.mag()<200&&(this._center=this._startPos.add(new a(-200,0)._rotate(e.angle()))),t.preventDefault()}},_onMove:function(t){if(!this._ignoreEvent(t)){this.isActive()||(this._active=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t));var e=this._map;e.stop();var r=this._pos,n=i.mousePos(this._el,t),a=this._center,o=r.sub(a).angleWith(n.sub(a))/Math.PI*180,s=e.getBearing()-o,l=this._inertia,c=l[l.length-1];this._drainInertiaBuffer(),l.push([Date.now(),e._normalizeBearing(s,c[1])]),e.transform.bearing=s,this._fireEvent("rotate",t),this._fireEvent("move",t),this._pos=n}},_onUp:function(t){if(!this._ignoreEvent(t)&&(document.removeEventListener("mousemove",this._onMove),document.removeEventListener("mouseup",this._onUp),this.isActive())){this._active=!1,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var e=this._map,r=e.getBearing(),n=this._inertia,i=function(){Math.abs(r)<this._bearingSnap?e.resetNorth({noMoveStart:!0},{originalEvent:t}):this._fireEvent("moveend",t)}.bind(this);if(n.length<2)i();else{var a=n[0],o=n[n.length-1],l=n[n.length-2],c=e._normalizeBearing(r,l[1]),u=o[1]-a[1],h=u<0?-1:1,f=(o[0]-a[0])/1e3;if(0!==u&&0!==f){var d=Math.abs(u*(.25/f));d>180&&(d=180);var p=d/180;c+=h*d*(p/2),Math.abs(e._normalizeBearing(c,0))<this._bearingSnap&&(c=e._normalizeBearing(0,c)),e.rotateTo(c,{duration:1e3*p,easing:s,noMoveStart:!0},{originalEvent:t})}else i()}}},_fireEvent:function(t,e){return this._map.fire(t,{originalEvent:e})},_ignoreEvent:function(t){var e=this._map;if(e.boxZoom&&e.boxZoom.isActive())return!0;if(e.dragPan&&e.dragPan.isActive())return!0;if(t.touches)return t.touches.length>1;var r=t.ctrlKey?1:2,n=t.ctrlKey?0:2;return"mousemove"===t.type?t.buttons&0===r:t.button!==n},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>0&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":429,"../../util/util":443,"point-geometry":485}],418:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),this._onKeyDown=this._onKeyDown.bind(this)}e.exports=n;n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},_onKeyDown:function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=this._map,r={originalEvent:t};if(!e.isEasing())switch(t.keyCode){case 61:case 107:case 171:case 187:e.zoomTo(Math.round(e.getZoom())+(t.shiftKey?2:1),r);break;case 189:case 109:case 173:e.zoomTo(Math.round(e.getZoom())-(t.shiftKey?2:1),r);break;case 37:t.shiftKey?e.easeTo({bearing:e.getBearing()-2},r):(t.preventDefault(),e.panBy([-80,0],r));break;case 39:t.shiftKey?e.easeTo({bearing:e.getBearing()+2},r):(t.preventDefault(),e.panBy([80,0],r));break;case 38:t.shiftKey?e.easeTo({pitch:e.getPitch()+5},r):(t.preventDefault(),e.panBy([0,-80],r));break;case 40:t.shiftKey?e.easeTo({pitch:Math.max(e.getPitch()-5,0)},r):(t.preventDefault(),e.panBy([0,80],r))}}}}},{}],419:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),o.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/browser"),o=t("../../util/util");e.exports=n;var s="undefined"!=typeof navigator?navigator.userAgent.toLowerCase():"",l=-1!==s.indexOf("firefox"),c=-1!==s.indexOf("safari")&&-1===s.indexOf("chrom");n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},_onWheel:function(t){var e;"wheel"===t.type?(e=t.deltaY,l&&t.deltaMode===window.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===window.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,c&&(e/=3));var r=a.now(),n=r-(this._time||0);this._pos=i.mousePos(this._el,t),this._time=r,0!==e&&e%4.000244140625==0?(this._type="wheel",e=Math.floor(e/4)):0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40)):this._type||(this._type=Math.abs(n*e)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,e+=this._lastValue)),t.shiftKey&&e&&(e/=4),this._type&&this._zoom(-e,t),t.preventDefault()},_onTimeout:function(){this._type="wheel",this._zoom(-this._lastValue)},_zoom:function(t,e){if(0!==t){var r=this._map,n=2/(1+Math.exp(-Math.abs(t/100)));t<0&&0!==n&&(n=1/n);var i=r.ease?r.ease.to:r.transform.scale,a=r.transform.scaleZoom(i*n);r.zoomTo(a,{duration:0,around:r.unproject(this._pos),delayEndEvents:200},{originalEvent:e})}}}},{"../../util/browser":427,"../../util/dom":429,"../../util/util":443}],420:[function(t,e,r){"use strict";function n(t){this._map=t,this._el=t.getCanvasContainer(),a.bindHandlers(this)}var i=t("../../util/dom"),a=t("../../util/util");e.exports=n;var o=a.bezier(0,0,.15,1);n.prototype={_enabled:!1,isEnabled:function(){return this._enabled},enable:function(){this.isEnabled()||(this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0)},disable:function(){this.isEnabled()&&(this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},disableRotation:function(){this._rotationDisabled=!0},enableRotation:function(){this._rotationDisabled=!1},_onStart:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]);this._startVec=e.sub(r),this._startScale=this._map.transform.scale,this._startBearing=this._map.transform.bearing,this._gestureIntent=void 0,this._inertia=[],document.addEventListener("touchmove",this._onMove,!1),document.addEventListener("touchend",this._onEnd,!1)}},_onMove:function(t){if(2===t.touches.length){var e=i.mousePos(this._el,t.touches[0]),r=i.mousePos(this._el,t.touches[1]),n=e.add(r).div(2),a=e.sub(r),o=a.mag()/this._startVec.mag(),s=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,l=this._map;if(this._gestureIntent){var c={duration:0,around:l.unproject(n)};"rotate"===this._gestureIntent&&(c.bearing=this._startBearing+s),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(c.zoom=l.transform.scaleZoom(this._startScale*o)),l.stop(),this._drainInertiaBuffer(),this._inertia.push([Date.now(),o,n]),l.easeTo(c,{originalEvent:t})}else{var u=Math.abs(1-o)>.15;Math.abs(s)>4?this._gestureIntent="rotate":u&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=l.transform.scale,this._startBearing=l.transform.bearing)}t.preventDefault()}},_onEnd:function(t){document.removeEventListener("touchmove",this._onMove),document.removeEventListener("touchend",this._onEnd),this._drainInertiaBuffer();var e=this._inertia,r=this._map;if(e.length<2)r.snapToNorth({},{originalEvent:t});else{var n=e[e.length-1],i=e[0],a=r.transform.scaleZoom(this._startScale*n[1]),s=r.transform.scaleZoom(this._startScale*i[1]),l=a-s,c=(n[0]-i[0])/1e3,u=n[2];if(0!==c&&a!==s){var h=.15*l/c;Math.abs(h)>2.5&&(h=h>0?2.5:-2.5);var f=1e3*Math.abs(h/(12*.15)),d=a+h*f/2e3;d<0&&(d=0),r.easeTo({zoom:d,duration:f,easing:o,around:r.unproject(u)},{originalEvent:t})}else r.snapToNorth({},{originalEvent:t})}},_drainInertiaBuffer:function(){for(var t=this._inertia,e=Date.now();t.length>2&&e-t[0][0]>160;)t.shift()}}},{"../../util/dom":429,"../../util/util":443}],421:[function(t,e,r){"use strict";function n(){i.bindAll(["_onHashChange","_updateHash"],this)}e.exports=n;var i=t("../util/util");n.prototype={addTo:function(t){return this._map=t,window.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},remove:function(){return window.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},_onHashChange:function(){var t=location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0)}),!0)},_updateHash:function(){var t=this._map.getCenter(),e=this._map.getZoom(),r=this._map.getBearing(),n=Math.max(0,Math.ceil(Math.log(e)/Math.LN2)),i="#"+Math.round(100*e)/100+"/"+t.lat.toFixed(n)+"/"+t.lng.toFixed(n)+(r?"/"+Math.round(10*r)/10:"");window.history.replaceState("","",i)}}},{"../util/util":443}],422:[function(t,e,r){"use strict";function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/canvas"),a=t("../util/util"),o=t("../util/browser"),s=t("../util/browser").window,l=t("../util/evented"),c=t("../util/dom"),u=t("../style/style"),h=t("../style/animation_loop"),f=t("../render/painter"),d=t("../geo/transform"),p=t("./hash"),m=t("./bind_handlers"),g=t("./camera"),v=t("../geo/lng_lat"),y=t("../geo/lng_lat_bounds"),b=t("point-geometry"),x=t("./control/attribution"),_={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:20,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,bearingSnap:7,hash:!1,attributionControl:!0,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,workerCount:Math.max(o.hardwareConcurrency-1,1)},w=e.exports=function(t){if((t=a.extend({},_,t)).workerCount<1)throw new Error("workerCount must an integer greater than or equal to 1.");this._interactive=t.interactive,this._failIfMajorPerformanceCaveat=t.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=t.preserveDrawingBuffer,this._trackResize=t.trackResize,this._workerCount=t.workerCount,this._bearingSnap=t.bearingSnap,"string"==typeof t.container?this._container=document.getElementById(t.container):this._container=t.container,this.animationLoop=new h,this.transform=new d(t.minZoom,t.maxZoom),t.maxBounds&&this.setMaxBounds(t.maxBounds),a.bindAll(["_forwardStyleEvent","_forwardSourceEvent","_forwardLayerEvent","_forwardTileEvent","_onStyleLoad","_onStyleChange","_onSourceAdd","_onSourceRemove","_onSourceUpdate","_onWindowOnline","_onWindowResize","_update","_render"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),this.on("moveend",function(){this.animationLoop.set(300),this._rerender()}.bind(this)),void 0!==s&&(s.addEventListener("online",this._onWindowOnline,!1),s.addEventListener("resize",this._onWindowResize,!1)),m(this,t),this._hash=t.hash&&(new p).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:t.center,zoom:t.zoom,bearing:t.bearing,pitch:t.pitch}),this.stacks={},this._classes=[],this.resize(),t.classes&&this.setClasses(t.classes),t.style&&this.setStyle(t.style),t.attributionControl&&this.addControl(new x(t.attributionControl));var e=this.fire.bind(this,"error");this.on("style.error",e),this.on("source.error",e),this.on("tile.error",e),this.on("layer.error",e)};a.extend(w.prototype,l),a.extend(w.prototype,g.prototype),a.extend(w.prototype,{addControl:function(t){return t.addTo(this),this},addClass:function(t,e){return this._classes.indexOf(t)>=0||""===t?this:(this._classes.push(t),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},removeClass:function(t,e){var r=this._classes.indexOf(t);return r<0||""===t?this:(this._classes.splice(r,1),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0))},setClasses:function(t,e){for(var r={},n=0;n<t.length;n++)""!==t[n]&&(r[t[n]]=!0);return this._classes=Object.keys(r),this._classOptions=e,this.style&&this.style.updateClasses(),this._update(!0)},hasClass:function(t){return this._classes.indexOf(t)>=0},getClasses:function(){return this._classes},resize:function(){var t=0,e=0;return this._container&&(t=this._container.offsetWidth||400,e=this._container.offsetHeight||300),this._canvas.resize(t,e),this.transform.resize(t,e),this.painter.resize(t,e),this.fire("movestart").fire("move").fire("resize").fire("moveend")},getBounds:function(){var t=new y(this.transform.pointLocation(new b(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new b(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new b(0,this.transform.size.y)))),t},setMaxBounds:function(t){if(t){var e=y.convert(t);this.transform.lngRange=[e.getWest(),e.getEast()],this.transform.latRange=[e.getSouth(),e.getNorth()],this.transform._constrain(),this._update()}else null!==t&&void 0!==t||(this.transform.lngRange=[],this.transform.latRange=[],this._update());return this},setMinZoom:function(t){if((t=null===t||void 0===t?0:t)>=0&&t<=this.transform.maxZoom)return this.transform.minZoom=t,this._update(),this.getZoom()<t&&this.setZoom(t),this;throw new Error("minZoom must be between 0 and the current maxZoom, inclusive")},setMaxZoom:function(t){if((t=null===t||void 0===t?20:t)>=this.transform.minZoom&&t<=20)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be between the current minZoom and 20, inclusive")},project:function(t){return this.transform.locationPoint(v.convert(t))},unproject:function(t){return this.transform.pointLocation(b.convert(t))},queryRenderedFeatures:function(){var t,e={};return 2===arguments.length?(t=arguments[0],e=arguments[1]):1===arguments.length&&function(t){return t instanceof b||Array.isArray(t)}(arguments[0])?t=arguments[0]:1===arguments.length&&(e=arguments[0]),this.style.queryRenderedFeatures(this._makeQueryGeometry(t),e,this.transform.zoom,this.transform.angle)},_makeQueryGeometry:function(t){void 0===t&&(t=[b.convert([0,0]),b.convert([this.transform.width,this.transform.height])]);var e;if(t instanceof b||"number"==typeof t[0]){e=[b.convert(t)]}else{var r=[b.convert(t[0]),b.convert(t[1])];e=[r[0],new b(r[1].x,r[0].y),r[1],new b(r[0].x,r[1].y),r[0]]}return e=e.map(function(t){return this.transform.pointCoordinate(t)}.bind(this))},querySourceFeatures:function(t,e){return this.style.querySourceFeatures(t,e)},setStyle:function(t){return this.style&&(this.style.off("load",this._onStyleLoad).off("error",this._forwardStyleEvent).off("change",this._onStyleChange).off("source.add",this._onSourceAdd).off("source.remove",this._onSourceRemove).off("source.load",this._onSourceUpdate).off("source.error",this._forwardSourceEvent).off("source.change",this._onSourceUpdate).off("layer.add",this._forwardLayerEvent).off("layer.remove",this._forwardLayerEvent).off("layer.error",this._forwardLayerEvent).off("tile.add",this._forwardTileEvent).off("tile.remove",this._forwardTileEvent).off("tile.load",this._update).off("tile.error",this._forwardTileEvent).off("tile.stats",this._forwardTileEvent)._remove(),this.off("rotate",this.style._redoPlacement),this.off("pitch",this.style._redoPlacement)),t?(this.style=t instanceof u?t:new u(t,this.animationLoop,this._workerCount),this.style.on("load",this._onStyleLoad).on("error",this._forwardStyleEvent).on("change",this._onStyleChange).on("source.add",this._onSourceAdd).on("source.remove",this._onSourceRemove).on("source.load",this._onSourceUpdate).on("source.error",this._forwardSourceEvent).on("source.change",this._onSourceUpdate).on("layer.add",this._forwardLayerEvent).on("layer.remove",this._forwardLayerEvent).on("layer.error",this._forwardLayerEvent).on("tile.add",this._forwardTileEvent).on("tile.remove",this._forwardTileEvent).on("tile.load",this._update).on("tile.error",this._forwardTileEvent).on("tile.stats",this._forwardTileEvent),this.on("rotate",this.style._redoPlacement),this.on("pitch",this.style._redoPlacement),this):(this.style=null,this)},getStyle:function(){if(this.style)return this.style.serialize()},addSource:function(t,e){return this.style.addSource(t,e),this._update(!0),this},addSourceType:function(t,e,r){return this.style.addSourceType(t,e,r)},removeSource:function(t){return this.style.removeSource(t),this._update(!0),this},getSource:function(t){return this.style.getSource(t)},addLayer:function(t,e){return this.style.addLayer(t,e),this._update(!0),this},removeLayer:function(t){return this.style.removeLayer(t),this._update(!0),this},getLayer:function(t){return this.style.getLayer(t)},setFilter:function(t,e){return this.style.setFilter(t,e),this._update(!0),this},setLayerZoomRange:function(t,e,r){return this.style.setLayerZoomRange(t,e,r),this._update(!0),this},getFilter:function(t){return this.style.getFilter(t)},setPaintProperty:function(t,e,r,n){return this.style.setPaintProperty(t,e,r,n),this._update(!0),this},getPaintProperty:function(t,e,r){return this.style.getPaintProperty(t,e,r)},setLayoutProperty:function(t,e,r){return this.style.setLayoutProperty(t,e,r),this._update(!0),this},getLayoutProperty:function(t,e){return this.style.getLayoutProperty(t,e)},getContainer:function(){return this._container},getCanvasContainer:function(){return this._canvasContainer},getCanvas:function(){return this._canvas.getElement()},_setupContainer:function(){var t=this._container;t.classList.add("mapboxgl-map");var e=this._canvasContainer=c.create("div","mapboxgl-canvas-container",t);this._interactive&&e.classList.add("mapboxgl-interactive"),this._canvas=new i(this,e);var r=this._controlContainer=c.create("div","mapboxgl-control-container",t),n=this._controlCorners={};["top-left","top-right","bottom-left","bottom-right"].forEach(function(t){n[t]=c.create("div","mapboxgl-ctrl-"+t,r)})},_setupPainter:function(){var t=this._canvas.getWebGLContext({failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer});t?this.painter=new f(t,this.transform):this.fire("error",{error:new Error("Failed to initialize WebGL")})},_contextLost:function(t){t.preventDefault(),this._frameId&&o.cancelFrame(this._frameId),this.fire("webglcontextlost",{originalEvent:t})},_contextRestored:function(t){this._setupPainter(),this.resize(),this._update(),this.fire("webglcontextrestored",{originalEvent:t})},loaded:function(){return!this._styleDirty&&!this._sourcesDirty&&!(!this.style||!this.style.loaded())},_update:function(t){return this.style?(this._styleDirty=this._styleDirty||t,this._sourcesDirty=!0,this._rerender(),this):this},_render:function(){try{this.style&&this._styleDirty&&(this._styleDirty=!1,this.style.update(this._classes,this._classOptions),this._classOptions=null,this.style._recalculate(this.transform.zoom)),this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.painter.render(this.style,{debug:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,vertices:this.vertices,rotating:this.rotating,zooming:this.zooming}),this.fire("render"),this.loaded()&&!this._loaded&&(this._loaded=!0,this.fire("load")),this._frameId=null,this.animationLoop.stopped()||(this._styleDirty=!0),(this._sourcesDirty||this._repaint||this._styleDirty)&&this._rerender()}catch(t){this.fire("error",{error:t})}return this},remove:function(){this._hash&&this._hash.remove(),o.cancelFrame(this._frameId),this.setStyle(null),void 0!==s&&s.removeEventListener("resize",this._onWindowResize,!1);var t=this.painter.gl.getExtension("WEBGL_lose_context");t&&t.loseContext(),n(this._canvasContainer),n(this._controlContainer),this._container.classList.remove("mapboxgl-map")},_rerender:function(){this.style&&!this._frameId&&(this._frameId=o.frame(this._render))},_forwardStyleEvent:function(t){this.fire("style."+t.type,a.extend({style:t.target},t))},_forwardSourceEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardLayerEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_forwardTileEvent:function(t){this.fire(t.type,a.extend({style:t.target},t))},_onStyleLoad:function(t){this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this.style.update(this._classes,{transition:!1}),this._forwardStyleEvent(t)},_onStyleChange:function(t){this._update(!0),this._forwardStyleEvent(t)},_onSourceAdd:function(t){var e=t.source;e.onAdd&&e.onAdd(this),this._forwardSourceEvent(t)},_onSourceRemove:function(t){var e=t.source;e.onRemove&&e.onRemove(this),this._forwardSourceEvent(t)},_onSourceUpdate:function(t){this._update(),this._forwardSourceEvent(t)},_onWindowOnline:function(){this._update()},_onWindowResize:function(){this._trackResize&&this.stop().resize()._update()}}),a.extendAll(w.prototype,{_showTileBoundaries:!1,get showTileBoundaries(){return this._showTileBoundaries},set showTileBoundaries(t){this._showTileBoundaries!==t&&(this._showTileBoundaries=t,this._update())},_showCollisionBoxes:!1,get showCollisionBoxes(){return this._showCollisionBoxes},set showCollisionBoxes(t){this._showCollisionBoxes!==t&&(this._showCollisionBoxes=t,this.style._redoPlacement())},_showOverdrawInspector:!1,get showOverdrawInspector(){return this._showOverdrawInspector},set showOverdrawInspector(t){this._showOverdrawInspector!==t&&(this._showOverdrawInspector=t,this._update())},_repaint:!1,get repaint(){return this._repaint},set repaint(t){this._repaint=t,this._update()},_vertices:!1,get vertices(){return this._vertices},set vertices(t){this._vertices=t,this._update()}})},{"../geo/lng_lat":340,"../geo/lng_lat_bounds":341,"../geo/transform":342,"../render/painter":356,"../style/animation_loop":376,"../style/style":379,"../util/browser":427,"../util/canvas":428,"../util/dom":429,"../util/evented":435,"../util/util":443,"./bind_handlers":408,"./camera":409,"./control/attribution":410,"./hash":421,"point-geometry":485}],423:[function(t,e,r){"use strict";function n(t,e){t||(t=i.create("div")),t.classList.add("mapboxgl-marker"),this._el=t,this._offset=o.convert(e&&e.offset||[0,0]),this._update=this._update.bind(this)}e.exports=n;var i=t("../util/dom"),a=t("../geo/lng_lat"),o=t("point-geometry");n.prototype={addTo:function(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._el),t.on("move",this._update),this._update(),this},remove:function(){this._map&&(this._map.off("move",this._update),this._map=null);var t=this._el.parentNode;return t&&t.removeChild(this._el),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=a.convert(t),this._update(),this},getElement:function(){return this._el},_update:function(){if(this._map){var t=this._map.project(this._lngLat)._add(this._offset);i.setTransform(this._el,"translate("+t.x+"px,"+t.y+"px)")}}}},{"../geo/lng_lat":340,"../util/dom":429,"point-geometry":485}],424:[function(t,e,r){"use strict";function n(t){i.setOptions(this,t),i.bindAll(["_update","_onClickClose"],this)}e.exports=n;var i=t("../util/util"),a=t("../util/evented"),o=t("../util/dom"),s=t("../geo/lng_lat");n.prototype=i.inherit(a,{options:{closeButton:!0,closeOnClick:!0},addTo:function(t){return this._map=t,this._map.on("move",this._update),this.options.closeOnClick&&this._map.on("click",this._onClickClose),this._update(),this},remove:function(){return this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._container&&(this._container.parentNode.removeChild(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("click",this._onClickClose),delete this._map),this.fire("close"),this},getLngLat:function(){return this._lngLat},setLngLat:function(t){return this._lngLat=s.convert(t),this._update(),this},setText:function(t){return this.setDOMContent(document.createTextNode(t))},setHTML:function(t){var e,r=document.createDocumentFragment(),n=document.createElement("body");for(n.innerHTML=t;e=n.firstChild;)r.appendChild(e);return this.setDOMContent(r)},setDOMContent:function(t){return this._createContent(),this._content.appendChild(t),this._update(),this},_createContent:function(){this._content&&this._content.parentNode&&this._content.parentNode.removeChild(this._content),this._content=o.create("div","mapboxgl-popup-content",this._container),this.options.closeButton&&(this._closeButton=o.create("button","mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClickClose))},_update:function(){if(this._map&&this._lngLat&&this._content){this._container||(this._container=o.create("div","mapboxgl-popup",this._map.getContainer()),this._tip=o.create("div","mapboxgl-popup-tip",this._container),this._container.appendChild(this._content));var t=this._map.project(this._lngLat).round(),e=this.options.anchor;if(!e){var r=this._container.offsetWidth,n=this._container.offsetHeight;e=t.y<n?["top"]:t.y>this._map.transform.height-n?["bottom"]:[],t.x<r/2?e.push("left"):t.x>this._map.transform.width-r/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var i={top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"},a=this._container.classList;for(var s in i)a.remove("mapboxgl-popup-anchor-"+s);a.add("mapboxgl-popup-anchor-"+e),o.setTransform(this._container,i[e]+" translate("+t.x+"px,"+t.y+"px)")}},_onClickClose:function(){this.remove()}})},{"../geo/lng_lat":340,"../util/dom":429,"../util/evented":435,"../util/util":443}],425:[function(t,e,r){"use strict";function n(t,e){this.target=t,this.parent=e,this.callbacks={},this.callbackID=0,this.receive=this.receive.bind(this),this.target.addEventListener("message",this.receive,!1)}e.exports=n,n.prototype.receive=function(t){function e(t,e,r){this.postMessage({type:"<response>",id:String(i),error:t?String(t):null,data:e},r)}var r,n=t.data,i=n.id;if("<response>"===n.type)r=this.callbacks[n.id],delete this.callbacks[n.id],r&&r(n.error||null,n.data);else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.data,e.bind(this));else if(void 0!==n.id&&this.parent.workerSources){var a=n.type.split(".");this.parent.workerSources[a[0]][a[1]](n.data,e.bind(this))}else this.parent[n.type](n.data)},n.prototype.send=function(t,e,r,n){var i=null;r&&(this.callbacks[i=this.callbackID++]=r),this.postMessage({type:t,id:String(i),data:e},n)},n.prototype.postMessage=function(t,e){this.target.postMessage(t,e)}},{}],426:[function(t,e,r){"use strict";function n(t){var e=document.createElement("a");return e.href=t,e.protocol===document.location.protocol&&e.host===document.location.host}r.getJSON=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.setRequestHeader("Accept","application/json"),r.onerror=function(t){e(t)},r.onload=function(){if(r.status>=200&&r.status<300&&r.response){var t;try{t=JSON.parse(r.response)}catch(t){return e(t)}e(null,t)}else e(new Error(r.statusText))},r.send(),r},r.getArrayBuffer=function(t,e){var r=new XMLHttpRequest;return r.open("GET",t,!0),r.responseType="arraybuffer",r.onerror=function(t){e(t)},r.onload=function(){r.status>=200&&r.status<300&&r.response?e(null,r.response):e(new Error(r.statusText))},r.send(),r},r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)return e(t);var n=new Image;n.onload=function(){e(null,n),(window.URL||window.webkitURL).revokeObjectURL(n.src)};var i=new Blob([new Uint8Array(r)],{type:"image/png"});return n.src=(window.URL||window.webkitURL).createObjectURL(i),n.getData=function(){var t=document.createElement("canvas"),e=t.getContext("2d");return t.width=n.width,t.height=n.height,e.drawImage(n,0,0),e.getImageData(0,0,n.width,n.height).data},n})},r.getVideo=function(t,e){var r=document.createElement("video");r.onloadstart=function(){e(null,r)};for(var i=0;i<t.length;i++){var a=document.createElement("source");n(t[i])||(r.crossOrigin="Anonymous"),a.src=t[i],r.appendChild(a)}return r.getData=function(){return r},r}},{}],427:[function(t,e,r){"use strict";r.window=window,e.exports.now=window.performance&&window.performance.now?window.performance.now.bind(window.performance):Date.now.bind(Date);var n=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame;r.frame=function(t){return n(t)};var i=window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.msCancelAnimationFrame;r.cancelFrame=function(t){i(t)},r.timed=function(t,n,i){function a(l){o||((l=e.exports.now())>=s+n?t.call(i,1):(t.call(i,(l-s)/n),r.frame(a)))}if(!n)return t.call(i,1),null;var o=!1,s=e.exports.now();return r.frame(a),function(){o=!0}},r.supported=t("mapbox-gl-supported"),r.hardwareConcurrency=navigator.hardwareConcurrency||4,Object.defineProperty(r,"devicePixelRatio",{get:function(){return window.devicePixelRatio}}),r.supportsWebp=!1;var a=document.createElement("img");a.onload=function(){r.supportsWebp=!0},a.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=",r.supportsGeolocation=!!navigator.geolocation},{"mapbox-gl-supported":328}],428:[function(t,e,r){"use strict";function n(t,e){this.canvas=document.createElement("canvas"),t&&e&&(this.canvas.style.position="absolute",this.canvas.classList.add("mapboxgl-canvas"),this.canvas.addEventListener("webglcontextlost",t._contextLost.bind(t),!1),this.canvas.addEventListener("webglcontextrestored",t._contextRestored.bind(t),!1),this.canvas.setAttribute("tabindex",0),e.appendChild(this.canvas))}var i=t("../util"),a=t("mapbox-gl-supported");e.exports=n,n.prototype.resize=function(t,e){var r=window.devicePixelRatio||1;this.canvas.width=r*t,this.canvas.height=r*e,this.canvas.style.width=t+"px",this.canvas.style.height=e+"px"},n.prototype.getWebGLContext=function(t){return t=i.extend({},t,a.webGLContextAttributes),this.canvas.getContext("webgl",t)||this.canvas.getContext("experimental-webgl",t)},n.prototype.getElement=function(){return this.canvas}},{"../util":443,"mapbox-gl-supported":328}],429:[function(t,e,r){"use strict";function n(t){for(var e=0;e<t.length;e++)if(t[e]in s)return t[e]}function i(t){t.preventDefault(),t.stopPropagation(),window.removeEventListener("click",i,!0)}var a=t("point-geometry");r.create=function(t,e,r){var n=document.createElement(t);return e&&(n.className=e),r&&r.appendChild(n),n};var o,s=document.documentElement.style,l=n(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]);r.disableDrag=function(){l&&(o=s[l],s[l]="none")},r.enableDrag=function(){l&&(s[l]=o)};var c=n(["transform","WebkitTransform"]);r.setTransform=function(t,e){t.style[c]=e},r.suppressClick=function(){window.addEventListener("click",i,!0),window.setTimeout(function(){window.removeEventListener("click",i,!0)},0)},r.mousePos=function(t,e){var r=t.getBoundingClientRect();return e=e.touches?e.touches[0]:e,new a(e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop)},r.touchPos=function(t,e){for(var r=t.getBoundingClientRect(),n=[],i=0;i<e.touches.length;i++)n.push(new a(e.touches[i].clientX-r.left-t.clientLeft,e.touches[i].clientY-r.top-t.clientTop));return n}},{"point-geometry":485}],430:[function(t,e,r){"use strict";var n=t("webworkify");e.exports=function(){return new n(t("../../source/worker"))}},{"../../source/worker":374,webworkify:573}],431:[function(t,e,r){"use strict";function n(t,e){return e.area-t.area}var i=t("quickselect");e.exports=function(t,e){var r=t.length;if(r<=1)return[t];for(var a,o,s=[],l=0;l<r;l++){var c=function(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i<a;o=i++)e=t[i],n+=((r=t[o]).x-e.x)*(e.y+r.y);return n}(t[l]);0!==c&&(t[l].area=Math.abs(c),void 0===o&&(o=c<0),o===c<0?(a&&s.push(a),a=[t[l]]):a.push(t[l]))}if(a&&s.push(a),e>1)for(var u=0;u<s.length;u++)s[u].length<=e||(i(s[u],e,1,s[u].length-1,n),s[u]=s[u].slice(0,e));return s}},{quickselect:502}],432:[function(t,e,r){"use strict";e.exports={API_URL:"https://api.mapbox.com",REQUIRE_ACCESS_TOKEN:!0}},{}],433:[function(t,e,r){"use strict";function n(t){this._stringToNumber={},this._numberToString=[];for(var e=0;e<t.length;e++){var r=t[e];this._stringToNumber[r]=e,this._numberToString[e]=r}}var i=t("assert");e.exports=n,n.prototype.encode=function(t){return i(t in this._stringToNumber),this._stringToNumber[t]},n.prototype.decode=function(t){return i(t<this._numberToString.length),this._numberToString[t]}},{assert:48}],434:[function(t,e,r){"use strict";function n(t,e){this.actors=[],this.currentActor=0;for(var r=0;r<t;r++){var n=new o,i=new a(n,e);i.name="Worker "+r,this.actors.push(i)}}var i=t("./util"),a=t("./actor"),o=t("./web_worker");e.exports=n,n.prototype={broadcast:function(t,e,r){r=r||function(){},i.asyncAll(this.actors,function(r,n){r.send(t,e,n)},r)},send:function(t,e,r,n,i){return("number"!=typeof n||isNaN(n))&&(n=this.currentActor=(this.currentActor+1)%this.actors.length),this.actors[n].send(t,e,r,i),n},remove:function(){for(var t=0;t<this.actors.length;t++)this.actors[t].target.terminate();this.actors=[]}}},{"./actor":425,"./util":443,"./web_worker":430}],435:[function(t,e,r){"use strict";var n=t("./util"),i={on:function(t,e){return this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(e),this},off:function(t,e){if(!t)return delete this._events,this;if(!this.listens(t))return this;if(e){var r=this._events[t].indexOf(e);r>=0&&this._events[t].splice(r,1),this._events[t].length||delete this._events[t]}else delete this._events[t];return this},once:function(t,e){var r=function(n){this.off(t,r),e.call(this,n)}.bind(this);return this.on(t,r),this},fire:function(t,e){if(!this.listens(t))return n.endsWith(t,"error")&&console.error(e&&e.error||e||"Empty error event"),this;e=n.extend({},e),n.extend(e,{type:t,target:this});for(var r=this._events[t].slice(),i=0;i<r.length;i++)r[i].call(this,e);return this},listens:function(t){return!(!this._events||!this._events[t])}};e.exports=i},{"./util":443}],436:[function(t,e,r){"use strict";function n(t,e,r){if(1===t){var n=r.readMessage(i,{glyphs:{}});e.push(n)}}function i(t,e,r){if(1===t)e.name=r.readString();else if(2===t)e.range=r.readString();else if(3===t){var n=r.readMessage(a,{});e.glyphs[n.id]=n}}function a(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())}e.exports=function(t,e){this.stacks=t.readFields(n,[],e)}},{}],437:[function(t,e,r){"use strict";function n(t,e,r){return t*(1-r)+e*r}e.exports=n,n.number=n,n.vec2=function(t,e,r){return[n(t[0],e[0],r),n(t[1],e[1],r)]},n.color=function(t,e,r){return[n(t[0],e[0],r),n(t[1],e[1],r),n(t[2],e[2],r),n(t[3],e[3],r)]},n.array=function(t,e,r){return t.map(function(t,i){return n(t,e[i],r)})}},{}],438:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<t.length-1;r++)for(var n=t[r],a=t[r+1],o=0;o<e.length-1;o++){if(function(t,e,r,n){return i(t,r,n)!==i(e,r,n)&&i(t,e,r)!==i(t,e,n)}(n,a,e[o],e[o+1]))return!0}return!1}function i(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)}function a(t,e,r){var n=r*r;if(1===e.length)return t.distSqr(e[0])<n;for(var i=1;i<e.length;i++){if(function(t,e,r){var n=e.distSqr(r);if(0===n)return t.distSqr(e);var i=((t.x-e.x)*(r.x-e.x)+(t.y-e.y)*(r.y-e.y))/n;return i<0?t.distSqr(e):i>1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}(t,e[i-1],e[i])<n)return!0}return!1}function o(t,e){for(var r,n,i,a=!1,o=0;o<t.length;o++)for(var s=0,l=(r=t[o]).length-1;s<r.length;l=s++)n=r[s],i=r[l],n.y>e.y!=i.y>e.y&&e.x<(i.x-n.x)*(e.y-n.y)/(i.y-n.y)+n.x&&(a=!a);return a}function s(t,e){for(var r=!1,n=0,i=t.length-1;n<t.length;i=n++){var a=t[n],o=t[i];a.y>e.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}e.exports={multiPolygonIntersectsBufferedMultiPoint:function(t,e,r){for(var n=0;n<t.length;n++)for(var i=t[n],o=0;o<e.length;o++)for(var l=e[o],c=0;c<l.length;c++){var u=l[c];if(s(i,u))return!0;if(a(u,i,r))return!0}return!1},multiPolygonIntersectsMultiPolygon:function(t,e){if(1===t.length&&1===t[0].length)return o(e,t[0][0]);for(var r=0;r<e.length;r++)for(var i=e[r],a=0;a<i.length;a++)if(o(t,i[a]))return!0;for(var s=0;s<t.length;s++){for(var l=t[s],c=0;c<l.length;c++)if(o(e,l[c]))return!0;for(var u=0;u<e.length;u++)if(n(l,e[u]))return!0}return!1},multiPolygonIntersectsBufferedMultiLine:function(t,e,r){for(var i=0;i<e.length;i++)for(var o=e[i],l=0;l<t.length;l++){var c=t[l];if(c.length>=3)for(var u=0;u<o.length;u++)if(s(c,o[u]))return!0;if(function(t,e,r){if(t.length>1){if(n(t,e))return!0;for(var i=0;i<e.length;i++)if(a(e[i],t,r))return!0}for(var o=0;o<t.length;o++)if(a(t[o],e,r))return!0;return!1}(c,o,r))return!0}return!1}}},{}],439:[function(t,e,r){"use strict";function n(t,e){this.max=t,this.onRemove=e,this.reset()}e.exports=n,n.prototype.reset=function(){for(var t in this.data)this.onRemove(this.data[t]);return this.data={},this.order=[],this},n.prototype.add=function(t,e){if(this.has(t))this.order.splice(this.order.indexOf(t),1),this.data[t]=e,this.order.push(t);else if(this.data[t]=e,this.order.push(t),this.order.length>this.max){var r=this.get(this.order[0]);r&&this.onRemove(r)}return this},n.prototype.has=function(t){return t in this.data},n.prototype.keys=function(){return this.order},n.prototype.get=function(t){if(!this.has(t))return null;var e=this.data[t];return delete this.data[t],this.order.splice(this.order.indexOf(t),1),e},n.prototype.setMaxSize=function(t){for(this.max=t;this.order.length>this.max;){var e=this.get(this.order[0]);e&&this.onRemove(e)}return this}},{}],440:[function(t,e,r){"use strict";function n(t,e,r){if(!(r=r||a.ACCESS_TOKEN)&&a.REQUIRE_ACCESS_TOKEN)throw new Error("An API access token is required to use Mapbox GL. See https://www.mapbox.com/developers/api/#access-tokens");if(t=t.replace(/^mapbox:\/\//,a.API_URL+e),t+=-1!==t.indexOf("?")?"&access_token=":"?access_token=",a.REQUIRE_ACCESS_TOKEN){if("s"===r[0])throw new Error("Use a public access token (pk.*) with Mapbox GL JS, not a secret access token (sk.*). See https://www.mapbox.com/developers/api/#access-tokens");t+=r}return t}function i(t){return t?"?"+t:""}var a=t("./config"),o=t("./browser"),s=t("url"),l=t("./util");e.exports.normalizeStyleURL=function(t,e){var r=s.parse(t);return"mapbox:"!==r.protocol?t:n("mapbox:/"+r.pathname+i(r.query),"/styles/v1/",e)},e.exports.normalizeSourceURL=function(t,e){return"mapbox:"!==s.parse(t).protocol?t:n(t+".json","/v4/",e)+"&secure"},e.exports.normalizeGlyphsURL=function(t,e){var r=s.parse(t);if("mapbox:"!==r.protocol)return t;return n("mapbox://"+r.pathname.split("/")[1]+"/{fontstack}/{range}.pbf"+i(r.query),"/fonts/v1/",e)},e.exports.normalizeSpriteURL=function(t,e,r,a){var o=s.parse(t);return"mapbox:"!==o.protocol?(o.pathname+=e+r,s.format(o)):n("mapbox:/"+o.pathname+"/sprite"+e+r+i(o.query),"/styles/v1/",a)},e.exports.normalizeTileURL=function(t,e,r){var n=s.parse(t,!0);if(!e)return t;if("mapbox:"!==s.parse(e).protocol)return t;var i=o.supportsWebp?".webp":"$1",c=o.devicePixelRatio>=2||512===r?"@2x":"";return s.format({protocol:n.protocol,hostname:n.hostname,pathname:n.pathname.replace(/(\.(?:png|jpg)\d*)/,c+i),query:function(t){return t.access_token&&"tk."===t.access_token.slice(0,3)?l.extend({},t,{access_token:a.ACCESS_TOKEN}):t}(n.query)})}},{"./browser":427,"./config":432,"./util":443,url:554}],441:[function(t,e,r){"use strict";function n(){return{members:this.prototype.StructType.prototype.members,alignment:this.prototype.StructType.prototype.alignment,bytesPerElement:this.prototype.bytesPerElement}}function i(t,e){return Math.ceil(t/e)*e}function a(t){return h[t].BYTES_PER_ELEMENT}function o(t){return t.toLowerCase()}function s(t,e){var r="this._pos"+a(t.type).toFixed(0)+" + "+(t.offset/a(t.type)+e).toFixed(0);return"this._structArray."+o(t.type)+"["+r+"]"}function l(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}function c(t){void 0!==t?(this.arrayBuffer=t.arrayBuffer,this.length=t.length,this.capacity=this.arrayBuffer.byteLength/this.bytesPerElement,this._refreshViews()):(this.capacity=-1,this.resize(0))}var u=t("assert");e.exports=function(t){function e(){l.apply(this,arguments)}function r(){c.apply(this,arguments),this.members=e.prototype.members}var d=JSON.stringify(t);if(f[d])return f[d];void 0===t.alignment&&(t.alignment=1);var p=0,m=0,g=["Uint8"];return(e.prototype=Object.create(l.prototype)).members=t.members.map(function(r){r={name:r.name,type:r.type,components:r.components||1},u(r.name.length),u(r.type in h),g.indexOf(r.type)<0&&g.push(r.type);var n=a(r.type);m=Math.max(m,n),r.offset=p=i(p,Math.max(t.alignment,n));for(var o=0;o<r.components;o++)Object.defineProperty(e.prototype,r.name+(1===r.components?"":o),{get:function(t,e){return new Function([],"return "+s(t,e)+";")}(r,o),set:function(t,e){return new Function(["x"],s(t,e)+" = x;")}(r,o)});return p+=n*r.components,r}),e.prototype.alignment=t.alignment,e.prototype.size=i(p,Math.max(m,t.alignment)),r.serialize=n,r.prototype=Object.create(c.prototype),r.prototype.StructType=e,r.prototype.bytesPerElement=e.prototype.size,r.prototype.emplaceBack=function(t,e){for(var r=[],n=[],i="var i = this.length;\nthis.resize(this.length + 1);\n",s=0;s<t.length;s++){var l=t[s],c=a(l.type);r.indexOf(c)<0&&(r.push(c),i+="var o"+c.toFixed(0)+" = i * "+(e/c).toFixed(0)+";\n");for(var u=0;u<l.components;u++){var h="v"+n.length,f="o"+c.toFixed(0)+" + "+(l.offset/c+u).toFixed(0);i+="this."+o(l.type)+"["+f+"] = "+h+";\n",n.push(h)}}return i+="return i;",new Function(n,i)}(e.prototype.members,e.prototype.size),r.prototype._usedTypes=g,f[d]=r,r};var h={Int8:Int8Array,Uint8:Uint8Array,Uint8Clamped:Uint8ClampedArray,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array,Float64:Float64Array},f={};c.prototype.DEFAULT_CAPACITY=128,c.prototype.RESIZE_MULTIPLIER=5,c.prototype.serialize=function(){return this.trim(),{length:this.length,arrayBuffer:this.arrayBuffer}},c.prototype.get=function(t){return new this.StructType(this,t)},c.prototype.trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},c.prototype.resize=function(t){if(this.length=t,t>this.capacity){this.capacity=Math.max(t,Math.floor(this.capacity*this.RESIZE_MULTIPLIER),this.DEFAULT_CAPACITY),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},c.prototype._refreshViews=function(){for(var t=0;t<this._usedTypes.length;t++){var e=this._usedTypes[t];this[o(e)]=new h[e](this.arrayBuffer)}},c.prototype.toArray=function(t,e){for(var r=[],n=t;n<e;n++){var i=this.get(n);r.push(i)}return r}},{assert:48}],442:[function(t,e,r){"use strict";e.exports=function(t,e){return e.replace(/{([^{}]+)}/g,function(e,r){return r in t?t[r]:""})}},{}],443:[function(t,e,r){"use strict";var n=t("unitbezier"),i=t("../geo/coordinate");r.easeCubicInOut=function(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)},r.bezier=function(t,e,r,i){var a=new n(t,e,r,i);return function(t){return a.solve(t)}},r.ease=r.bezier(.25,.1,.25,1),r.clamp=function(t,e,r){return Math.min(r,Math.max(e,t))},r.wrap=function(t,e,r){var n=r-e,i=((t-e)%n+n)%n+e;return i===e?r:i},r.coalesce=function(){for(var t=0;t<arguments.length;t++){var e=arguments[t];if(null!==e&&void 0!==e)return e}},r.asyncAll=function(t,e,r){if(!t.length)return r(null,[]);var n=t.length,i=new Array(t.length),a=null;t.forEach(function(t,o){e(t,function(t,e){t&&(a=t),i[o]=e,0==--n&&r(a,i)})})},r.keysDifference=function(t,e){var r=[];for(var n in t)n in e||r.push(n);return r},r.extend=function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)t[n]=r[n]}return t},r.extendAll=function(t,e){for(var r in e)Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r));return t},r.inherit=function(t,e){var n="function"==typeof t?t.prototype:t,i=Object.create(n);return r.extendAll(i,e),i},r.pick=function(t,e){for(var r={},n=0;n<e.length;n++){var i=e[n];i in t&&(r[i]=t[i])}return r};var a=1;r.uniqueId=function(){return a++},r.debounce=function(t,e){var r,n;return function(){n=arguments,clearTimeout(r),r=setTimeout(function(){t.apply(null,n)},e)}},r.bindAll=function(t,e){t.forEach(function(t){e[t]&&(e[t]=e[t].bind(e))})},r.bindHandlers=function(t){for(var e in t)"function"==typeof t[e]&&0===e.indexOf("_on")&&(t[e]=t[e].bind(t))},r.setOptions=function(t,e){t.hasOwnProperty("options")||(t.options=t.options?Object.create(t.options):{});for(var r in e)t.options[r]=e[r];return t.options},r.getCoordinatesCenter=function(t){for(var e=1/0,r=1/0,n=-1/0,a=-1/0,o=0;o<t.length;o++)e=Math.min(e,t[o].column),r=Math.min(r,t[o].row),n=Math.max(n,t[o].column),a=Math.max(a,t[o].row);var s=n-e,l=a-r,c=Math.max(s,l);return new i((e+n)/2,(r+a)/2,0).zoomTo(Math.floor(-Math.log(c)/Math.LN2))},r.endsWith=function(t,e){return-1!==t.indexOf(e,t.length-e.length)},r.startsWith=function(t,e){return 0===t.indexOf(e)},r.mapObject=function(t,e,r){var n={};for(var i in t)n[i]=e.call(r||this,t[i],i,t);return n},r.filterObject=function(t,e,r){var n={};for(var i in t)e.call(r||this,t[i],i,t)&&(n[i]=t[i]);return n},r.deepEqual=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n<e.length;n++)if(!t(e[n],r[n]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==r){if("object"!=typeof r)return!1;if(Object.keys(e).length!==Object.keys(r).length)return!1;for(var i in e)if(!t(e[i],r[i]))return!1;return!0}return e===r},r.clone=function(t){return Array.isArray(t)?t.map(r.clone):"object"==typeof t?r.mapObject(t,r.clone):t},r.arraysIntersect=function(t,e){for(var r=0;r<t.length;r++)if(e.indexOf(t[r])>=0)return!0;return!1};var o={};r.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)}},{"../geo/coordinate":339,unitbezier:553}],444:[function(t,e,r){"use strict";function n(t,e,r,n){this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)}e.exports=n,n.prototype={type:"Feature",get geometry(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},set geometry(t){this._geometry=t},toJSON:function(){var t={};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&"toJSON"!==e&&(t[e]=this[e]);return t}}},{}],445:[function(t,e,r){e.exports={_args:[[{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},"/home/etienne/Documents/plotly/plotly.js"]],_from:"mapbox-gl@>=0.22.0 <0.23.0",_id:"mapbox-gl@0.22.1",_inCache:!0,_location:"/mapbox-gl",_nodeVersion:"4.4.5",_npmOperationalInternal:{host:"packages-12-west.internal.npmjs.com",tmp:"tmp/mapbox-gl-0.22.1.tgz_1471549891670_0.8762630566488951"},_npmUser:{name:"lucaswoj",email:"lucas@lucaswoj.com"},_npmVersion:"2.15.5",_phantomChildren:{},_requested:{raw:"mapbox-gl@^0.22.0",scope:null,escapedName:"mapbox-gl",name:"mapbox-gl",rawSpec:"^0.22.0",spec:">=0.22.0 <0.23.0",type:"range"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz",_shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",_shrinkwrap:null,_spec:"mapbox-gl@^0.22.0",_where:"/home/etienne/Documents/plotly/plotly.js",browser:{"./js/util/ajax.js":"./js/util/browser/ajax.js","./js/util/browser.js":"./js/util/browser/browser.js","./js/util/canvas.js":"./js/util/browser/canvas.js","./js/util/dom.js":"./js/util/browser/dom.js","./js/util/web_worker.js":"./js/util/browser/web_worker.js"},bugs:{url:"https://github.com/mapbox/mapbox-gl-js/issues"},dependencies:{csscolorparser:"^1.0.2",earcut:"^2.0.3","feature-filter":"^2.2.0","geojson-rewind":"^0.1.0","geojson-vt":"^2.4.0","gl-matrix":"^2.3.1","grid-index":"^1.0.0","mapbox-gl-function":"^1.2.1","mapbox-gl-shaders":"github:mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747","mapbox-gl-style-spec":"github:mapbox/mapbox-gl-style-spec#83b1a3e5837d785af582efd5ed1a212f2df6a4ae","mapbox-gl-supported":"^1.2.0",pbf:"^1.3.2",pngjs:"^2.2.0","point-geometry":"^0.0.0",quickselect:"^1.0.0",request:"^2.39.0","resolve-url":"^0.2.1","shelf-pack":"^1.0.0",supercluster:"^2.0.1",unassertify:"^2.0.0",unitbezier:"^0.0.0","vector-tile":"^1.3.0","vt-pbf":"^2.0.2",webworkify:"^1.3.0","whoots-js":"^2.0.0"},description:"A WebGL interactive maps library",devDependencies:{"babel-preset-react":"^6.11.1",babelify:"^7.3.0",benchmark:"~2.1.0",browserify:"^13.0.0",clipboard:"^1.5.12","concat-stream":"1.5.1",coveralls:"^2.11.8",doctrine:"^1.2.1",documentation:"https://github.com/documentationjs/documentation/archive/bb41619c734e59ef3fbc3648610032efcfdaaace.tar.gz","documentation-theme-utils":"3.0.0",envify:"^3.4.0",eslint:"^2.5.3","eslint-config-mourner":"^2.0.0","eslint-plugin-html":"^1.5.1",gl:"^4.0.1",handlebars:"4.0.5","highlight.js":"9.3.0",istanbul:"^0.4.2","json-loader":"^0.5.4",lodash:"^4.13.1","mapbox-gl-test-suite":"github:mapbox/mapbox-gl-test-suite#7babab52fb02788ebbc38384139bf350e8e38552","memory-fs":"^0.3.0",minifyify:"^7.0.1","npm-run-all":"^3.0.0",nyc:"6.4.0",proxyquire:"^1.7.9",remark:"4.2.2","remark-html":"3.0.0",sinon:"^1.15.4",st:"^1.2.0",tap:"^5.7.0","transform-loader":"^0.2.3","unist-util-visit":"1.1.0",vinyl:"1.1.1","vinyl-fs":"2.4.3",watchify:"^3.7.0",webpack:"^1.13.1","webworkify-webpack":"^1.1.3"},directories:{},dist:{shasum:"92a965547d4c2f24c22cbc487eeda48694cb627a",tarball:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz"},engines:{node:">=4.0.0"},gitHead:"13a9015341f0602ccb55c98c53079838ad4b70b5",homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",maintainers:[{name:"aaronlidman",email:"aaronlidman@gmail.com"},{name:"ajashton",email:"aj.ashton@gmail.com"},{name:"ansis",email:"ansis.brammanis@gmail.com"},{name:"bergwerkgis",email:"wb@bergwerk-gis.at"},{name:"bhousel",email:"bryan@mapbox.com"},{name:"bsudekum",email:"bobby@mapbox.com"},{name:"camilleanne",email:"camille@mapbox.com"},{name:"dnomadb",email:"damon@mapbox.com"},{name:"dthompson",email:"dthompson@gmail.com"},{name:"emilymcafee",email:"emily@mapbox.com"},{name:"flippmoke",email:"flippmoke@gmail.com"},{name:"freenerd",email:"spam@freenerd.de"},{name:"gretacb",email:"carol@mapbox.com"},{name:"ian29",email:"ian.villeda@gmail.com"},{name:"ianshward",email:"ian@mapbox.com"},{name:"ingalls",email:"nicholas.ingalls@gmail.com"},{name:"jfirebaugh",email:"john.firebaugh@gmail.com"},{name:"jrpruit1",email:"jake@jakepruitt.com"},{name:"karenzshea",email:"karen@mapbox.com"},{name:"kkaefer",email:"kkaefer@gmail.com"},{name:"lbud",email:"lauren@mapbox.com"},{name:"lucaswoj",email:"lucas@lucaswoj.com"},{name:"lxbarth",email:"alex@mapbox.com"},{name:"lyzidiamond",email:"lyzi@mapbox.com"},{name:"mapbox-admin",email:"accounts@mapbox.com"},{name:"mateov",email:"matt@mapbox.com"},{name:"mcwhittemore",email:"mcwhittemore@gmail.com"},{name:"miccolis",email:"jeff@miccolis.net"},{name:"mikemorris",email:"michael.patrick.morris@gmail.com"},{name:"morganherlocker",email:"morgan.herlocker@gmail.com"},{name:"mourner",email:"agafonkin@gmail.com"},{name:"nickidlugash",email:"nicki@mapbox.com"},{name:"rclark",email:"ryan.clark.j@gmail.com"},{name:"samanbb",email:"saman@mapbox.com"},{name:"sbma44",email:"tlee@mapbox.com"},{name:"scothis",email:"scothis@gmail.com"},{name:"sgillies",email:"sean@mapbox.com"},{name:"springmeyer",email:"dane@mapbox.com"},{name:"themarex",email:"patrick@mapbox.com"},{name:"tmcw",email:"tom@macwright.org"},{name:"tristen",email:"tristen.brown@gmail.com"},{name:"willwhite",email:"will@mapbox.com"},{name:"yhahn",email:"young@mapbox.com"}],name:"mapbox-gl",optionalDependencies:{},readme:"ERROR: No README data found!",repository:{type:"git",url:"git://github.com/mapbox/mapbox-gl-js.git"},scripts:{build:"npm run build-docs # invoked by publisher when publishing docs on the mb-pages branch","build-dev":"browserify js/mapbox-gl.js --debug --standalone mapboxgl > dist/mapbox-gl-dev.js && tap --no-coverage test/build/dev.test.js","build-docs":"documentation build --github --format html -c documentation.yml --theme ./docs/_theme --output docs/api/","build-min":"browserify js/mapbox-gl.js --debug -t unassertify --plugin [minifyify --map mapbox-gl.js.map --output dist/mapbox-gl.js.map] --standalone mapboxgl > dist/mapbox-gl.js && tap --no-coverage test/build/min.test.js","build-token":"browserify debug/access-token-src.js --debug -t envify > debug/access-token.js",lint:"eslint --ignore-path .gitignore js test bench docs/_posts/examples/*.html","open-changed-examples":"git diff --name-only mb-pages HEAD -- docs/_posts/examples/*.html | awk '{print \"http://127.0.0.1:4000/mapbox-gl-js/example/\" substr($0,33,length($0)-37)}' | xargs open",start:"run-p build-token watch-dev watch-bench start-server","start-bench":"run-p build-token watch-bench start-server","start-debug":"run-p build-token watch-dev start-server","start-docs":"npm run build-min && npm run build-docs && jekyll serve -w","start-server":"st --no-cache --localhost --port 9966 --index index.html .",test:"npm run lint && tap --reporter dot test/js/*/*.js test/build/webpack.test.js","test-suite":"node test/render.test.js && node test/query.test.js","watch-bench":"node bench/download-data.js && watchify bench/index.js --plugin [minifyify --no-map] -t [babelify --presets react] -t unassertify -t envify -o bench/bench.js -v","watch-dev":"watchify js/mapbox-gl.js --debug --standalone mapboxgl -o dist/mapbox-gl-dev.js -v"},version:"0.22.1"}},{}],446:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;i<t;++i)n[i]=0,i===e&&(n[i]+=.5),i===r&&(n[i]+=.5);return n}function i(t,e){if(0===e||e===(1<<t+1)-1)return[];for(var r=[],i=[],o=0;o<=t;++o)if(e&1<<o){r.push(n(t,o-1,o-1)),i.push(null);for(var s=0;s<=t;++s)~e&1<<s&&(r.push(n(t,o-1,s-1)),i.push([o,s]))}var l=a(r),c=[];t:for(o=0;o<l.length;++o){var u=l[o],h=[];for(s=0;s<u.length;++s){if(!i[u[s]])continue t;h.push(i[u[s]].slice())}c.push(h)}return c}e.exports=function(t){for(var e=1<<t+1,r=new Array(e),n=0;n<e;++n)r[n]=i(t,n);return r};var a=t("convex-hull")},{"convex-hull":104}],447:[function(t,e,r){function n(t,e,r,n,i){t[0]=e[0]*n+r[0]*i,t[1]=e[1]*n+r[1]*i,t[2]=e[2]*n+r[2]*i}var i=t("./normalize"),a=t("gl-mat4/create"),o=t("gl-mat4/clone"),s=t("gl-mat4/determinant"),l=t("gl-mat4/invert"),c=t("gl-mat4/transpose"),u={length:t("gl-vec3/length"),normalize:t("gl-vec3/normalize"),dot:t("gl-vec3/dot"),cross:t("gl-vec3/cross")},h=a(),f=a(),d=[0,0,0,0],p=[[0,0,0],[0,0,0],[0,0,0]],m=[0,0,0];e.exports=function(t,e,r,a,g,v){if(e||(e=[0,0,0]),r||(r=[0,0,0]),a||(a=[0,0,0]),g||(g=[0,0,0,1]),v||(v=[0,0,0,1]),!i(h,t))return!1;if(o(f,h),f[3]=0,f[7]=0,f[11]=0,f[15]=1,Math.abs(s(f)<1e-8))return!1;var y=h[3],b=h[7],x=h[11],_=h[12],w=h[13],M=h[14],k=h[15];if(0!==y||0!==b||0!==x){d[0]=y,d[1]=b,d[2]=x,d[3]=k;if(!l(f,f))return!1;c(f,f),function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3];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}(g,d,f)}else g[0]=g[1]=g[2]=0,g[3]=1;if(e[0]=_,e[1]=w,e[2]=M,function(t,e){t[0][0]=e[0],t[0][1]=e[1],t[0][2]=e[2],t[1][0]=e[4],t[1][1]=e[5],t[1][2]=e[6],t[2][0]=e[8],t[2][1]=e[9],t[2][2]=e[10]}(p,h),r[0]=u.length(p[0]),u.normalize(p[0],p[0]),a[0]=u.dot(p[0],p[1]),n(p[1],p[1],p[0],1,-a[0]),r[1]=u.length(p[1]),u.normalize(p[1],p[1]),a[0]/=r[1],a[1]=u.dot(p[0],p[2]),n(p[2],p[2],p[0],1,-a[1]),a[2]=u.dot(p[1],p[2]),n(p[2],p[2],p[1],1,-a[2]),r[2]=u.length(p[2]),u.normalize(p[2],p[2]),a[1]/=r[2],a[2]/=r[2],u.cross(m,p[1],p[2]),u.dot(p[0],m)<0)for(var T=0;T<3;T++)r[T]*=-1,p[T][0]*=-1,p[T][1]*=-1,p[T][2]*=-1;return v[0]=.5*Math.sqrt(Math.max(1+p[0][0]-p[1][1]-p[2][2],0)),v[1]=.5*Math.sqrt(Math.max(1-p[0][0]+p[1][1]-p[2][2],0)),v[2]=.5*Math.sqrt(Math.max(1-p[0][0]-p[1][1]+p[2][2],0)),v[3]=.5*Math.sqrt(Math.max(1+p[0][0]+p[1][1]+p[2][2],0)),p[2][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":448,"gl-mat4/clone":176,"gl-mat4/create":177,"gl-mat4/determinant":178,"gl-mat4/invert":182,"gl-mat4/transpose":192,"gl-vec3/cross":273,"gl-vec3/dot":274,"gl-vec3/length":275,"gl-vec3/normalize":277}],448:[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}},{}],449:[function(t,e,r){function n(){return{translate:i(),scale:i(1),skew:i(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function i(t){return[t||0,t||0,t||0]}var a=t("gl-vec3/lerp"),o=t("mat4-recompose"),s=t("mat4-decompose"),l=t("gl-mat4/determinant"),c=t("quat-slerp"),u=n(),h=n(),f=n();e.exports=function(t,e,r,n){if(0===l(e)||0===l(r))return!1;var i=s(e,u.translate,u.scale,u.skew,u.perspective,u.quaternion),d=s(r,h.translate,h.scale,h.skew,h.perspective,h.quaternion);return!(!i||!d||(a(f.translate,u.translate,h.translate,n),a(f.skew,u.skew,h.skew,n),a(f.scale,u.scale,h.scale,n),a(f.perspective,u.perspective,h.perspective,n),c(f.quaternion,u.quaternion,h.quaternion,n),o(t,f.translate,f.scale,f.skew,f.perspective,f.quaternion),0))}},{"gl-mat4/determinant":178,"gl-vec3/lerp":276,"mat4-decompose":447,"mat4-recompose":450,"quat-slerp":498}],450:[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":177,"gl-mat4/fromRotationTranslation":180,"gl-mat4/identity":181,"gl-mat4/multiply":184,"gl-mat4/scale":190,"gl-mat4/translate":191}],451:[function(t,e,r){"use strict";function n(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]}var i=t("binary-search-bounds"),a=t("mat4-interpolate"),o=t("gl-mat4/invert"),s=t("gl-mat4/rotateX"),l=t("gl-mat4/rotateY"),c=t("gl-mat4/rotateZ"),u=t("gl-mat4/lookAt"),h=t("gl-mat4/translate"),f=(t("gl-mat4/scale"),t("gl-vec3/normalize")),d=[0,0,0];e.exports=function(t){return new n((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};var p=n.prototype;p.recalcMatrix=function(t){var e=this._time,r=i.le(e,t),n=this.computedMatrix;if(!(r<0)){var s=this._components;if(r===e.length-1)for(var l=16*r,c=0;c<16;++c)n[c]=s[l++];else{var u=e[r+1]-e[r],h=(l=16*r,this.prevMatrix),d=!0;for(c=0;c<16;++c)h[c]=s[l++];var p=this.nextMatrix;for(c=0;c<16;++c)p[c]=s[l++],d=d&&h[c]===p[c];if(u<1e-6||d)for(c=0;c<16;++c)n[c]=h[c];else a(n,h,p,(t-e[r])/u)}var m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[9],f(m,m);var g=this.computedInverse;o(g,n);var v=this.computedEye,y=g[15];v[0]=g[12]/y,v[1]=g[13]/y,v[2]=g[14]/y;var b=this.computedCenter,x=Math.exp(this.computedRadius[0]);for(c=0;c<3;++c)b[c]=v[c]-n[2+4*c]*x}},p.idle=function(t){if(!(t<this.lastT())){for(var e=this._components,r=e.length-16,n=0;n<16;++n)e.push(e[r++]);this._time.push(t)}},p.flush=function(t){var e=i.gt(this._time,t)-2;e<0||(this._time.splice(0,e),this._components.splice(0,16*e))},p.lastT=function(){return this._time[this._time.length-1]},p.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||d,n=n||this.computedUp,this.setMatrix(t,u(this.computedMatrix,e,r,n));for(var i=0,a=0;a<3;++a)i+=Math.pow(r[a]-e[a],2);i=Math.log(Math.sqrt(i)),this.computedRadius[0]=i},p.rotate=function(t,e,r,n){this.recalcMatrix(t);var i=this.computedInverse;e&&l(i,i,e),r&&s(i,i,r),n&&c(i,i,n),this.setMatrix(t,o(this.computedMatrix,i))};var m=[0,0,0];p.pan=function(t,e,r,n){m[0]=-(e||0),m[1]=-(r||0),m[2]=-(n||0),this.recalcMatrix(t);var i=this.computedInverse;h(i,i,m),this.setMatrix(t,o(i,i))},p.translate=function(t,e,r,n){m[0]=e||0,m[1]=r||0,m[2]=n||0,this.recalcMatrix(t);var i=this.computedMatrix;h(i,i,m),this.setMatrix(t,i)},p.setMatrix=function(t,e){if(!(t<this.lastT())){this._time.push(t);for(var r=0;r<16;++r)this._components.push(e[r])}},p.setDistance=function(t,e){this.computedRadius[0]=e},p.setDistanceLimits=function(t,e){var r=this._limits;r[0]=t,r[1]=e},p.getDistanceLimits=function(t){var e=this._limits;return t?(t[0]=e[0],t[1]=e[1],t):e}},{"binary-search-bounds":67,"gl-mat4/invert":182,"gl-mat4/lookAt":183,"gl-mat4/rotateX":187,"gl-mat4/rotateY":188,"gl-mat4/rotateZ":189,"gl-mat4/scale":190,"gl-mat4/translate":191,"gl-vec3/normalize":277,"mat4-interpolate":449}],452:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e<3){for(var r=new Array(e),i=0;i<e;++i)r[i]=i;return 2===e&&t[0][0]===t[1][0]&&t[0][1]===t[1][1]?[0]:r}var a=new Array(e);for(i=0;i<e;++i)a[i]=i;a.sort(function(e,r){var n=t[e][0]-t[r][0];return n||t[e][1]-t[r][1]});var o=[a[0],a[1]],s=[a[0],a[1]];for(i=2;i<e;++i){for(var l=a[i],c=t[l],u=o.length;u>1&&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=(i=0,o.length);i<f;++i)r[h++]=o[i];for(var d=s.length-2;d>0;--d)r[h++]=s[d];return r};var n=t("robust-orientation")[3]},{"robust-orientation":517}],453:[function(t,e,r){"use strict";e.exports=function(t,e){function r(t){var e=!1;return"altKey"in t&&(e=e||t.altKey!==m.alt,m.alt=!!t.altKey),"shiftKey"in t&&(e=e||t.shiftKey!==m.shift,m.shift=!!t.shiftKey),"ctrlKey"in t&&(e=e||t.ctrlKey!==m.control,m.control=!!t.ctrlKey),"metaKey"in t&&(e=e||t.metaKey!==m.meta,m.meta=!!t.metaKey),e}function i(t,i){var a=n.x(i),o=n.y(i);"buttons"in i&&(t=0|i.buttons),(t!==f||a!==d||o!==p||r(i))&&(f=0|t,d=a||0,p=o||0,e&&e(f,d,p,m))}function a(t){i(0,t)}function o(){(f||d||p||m.shift||m.alt||m.meta||m.control)&&(d=p=0,f=0,m.shift=m.alt=m.control=m.meta=!1,e&&e(0,0,0,m))}function s(t){r(t)&&e&&e(f,d,p,m)}function l(t){0===n.buttons(t)?i(0,t):i(f,t)}function c(t){i(f|n.buttons(t),t)}function u(t){i(f&~n.buttons(t),t)}function h(){g||(g=!0,t.addEventListener("mousemove",l),t.addEventListener("mousedown",c),t.addEventListener("mouseup",u),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",a),t.addEventListener("mouseout",a),t.addEventListener("mouseover",a),t.addEventListener("blur",o),t.addEventListener("keyup",s),t.addEventListener("keydown",s),t.addEventListener("keypress",s),t!==window&&(window.addEventListener("blur",o),window.addEventListener("keyup",s),window.addEventListener("keydown",s),window.addEventListener("keypress",s)))}e||(e=t,t=window);var f=0,d=0,p=0,m={shift:!1,alt:!1,control:!1,meta:!1},g=!1;h();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return g},set:function(e){e?h():g&&(g=!1,t.removeEventListener("mousemove",l),t.removeEventListener("mousedown",c),t.removeEventListener("mouseup",u),t.removeEventListener("mouseleave",a),t.removeEventListener("mouseenter",a),t.removeEventListener("mouseout",a),t.removeEventListener("mouseover",a),t.removeEventListener("blur",o),t.removeEventListener("keyup",s),t.removeEventListener("keydown",s),t.removeEventListener("keypress",s),t!==window&&(window.removeEventListener("blur",o),window.removeEventListener("keyup",s),window.removeEventListener("keydown",s),window.removeEventListener("keypress",s)))},enumerable:!0},buttons:{get:function(){return f},enumerable:!0},x:{get:function(){return d},enumerable:!0},y:{get:function(){return p},enumerable:!0},mods:{get:function(){return m},enumerable:!0}}),v};var n=t("mouse-event")},{"mouse-event":455}],454:[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=function(t){return t===window||t===document||t===document.body?n:t.getBoundingClientRect()}(e);return r[0]=i-o.left,r[1]=a-o.top,r}},{}],455:[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<<e-1}else if("button"in t){var e;if(1===(e=t.button))return 4;if(2===e)return 2;if(e>=0)return 1<<e}}return 0},r.element=n,r.x=function(t){if("object"==typeof t){if("offsetX"in t)return t.offsetX;var e=n(t).getBoundingClientRect();return t.clientX-e.left}return 0},r.y=function(t){if("object"==typeof t){if("offsetY"in t)return t.offsetY;var e=n(t).getBoundingClientRect();return t.clientY-e.top}return 0}},{}],456:[function(t,e,r){"use strict";var n=t("to-px");e.exports=function(t,e,r){"function"==typeof t&&(r=!!e,e=t,t=window);var i=n("ex",t),a=function(t){r&&t.preventDefault();var n=t.deltaX||0,a=t.deltaY||0,o=t.deltaZ||0,s=1;switch(t.deltaMode){case 1:s=i;break;case 2:s=window.innerHeight}if(n*=s,a*=s,o*=s,n||a||o)return e(n,a,o,t)};return t.addEventListener("wheel",a),a}},{"to-px":544}],457:[function(t,e,r){"use strict";function n(t){return"a"+t}function i(t){return"d"+t}function a(t,e){return"c"+t+"_"+e}function o(t){return"s"+t}function s(t,e){return"t"+t+"_"+e}function l(t){return"o"+t}function c(t){return"x"+t}function u(t){return"p"+t}function h(t,e){return"d"+t+"_"+e}function f(t){return"i"+t}function d(t,e){return"u"+t+"_"+e}function p(t){return"b"+t}function m(t){return"y"+t}function g(t){return"e"+t}function v(t){return"v"+t}function y(t,e,r){for(var n=0,i=0;i<t;++i)e&1<<i&&(n|=1<<r[i]);return n}function b(t,e,r,b,S,E){function L(t,e){F.push("for(",f(S[t]),"=",e,";",f(S[t]),"<",o(S[t]),";","++",f(S[t]),"){")}function C(t){for(var e=0;e<D;++e)F.push(u(e),"+=",d(e,S[t]),";");F.push("}")}function I(){for(var t=1;t<1<<z;++t)F.push(A,"=",g(t),";",g(t),"=",m(t),";",m(t),"=",A,";")}function P(t,e){if(t<0)!function(t){for(var e=0;e<D;++e)E[e]?F.push(a(e,0),"=",i(e),".get(",u(e),");"):F.push(a(e,0),"=",i(e),"[",u(e),"];");var r=[];for(e=0;e<D;++e)r.push(a(e,0));for(e=0;e<b;++e)r.push(c(e));F.push(p(0),"=",w,"[",T,"]=phase(",r.join(),");");for(var n=1;n<1<<z;++n)F.push(p(n),"=",w,"[",T,"+",g(n),"];");var o=[];for(n=1;n<1<<z;++n)o.push("("+p(0)+"!=="+p(n)+")");F.push("if(",o.join("||"),"){");var s=[];for(e=0;e<z;++e)s.push(f(e));for(e=0;e<D;++e)for(s.push(a(e,0)),n=1;n<1<<z;++n)E[e]?F.push(a(e,n),"=",i(e),".get(",u(e),"+",h(e,n),");"):F.push(a(e,n),"=",i(e),"[",u(e),"+",h(e,n),"];"),s.push(a(e,n));for(e=0;e<1<<z;++e)s.push(p(e));for(e=0;e<b;++e)s.push(c(e));F.push("vertex(",s.join(),");",v(0),"=",_,"[",T,"]=",M,"++;");var l=(1<<z)-1,d=p(l);for(n=0;n<z;++n)if(0==(t&~(1<<n))){for(var m=l^1<<n,y=p(m),x=[],k=m;k>0;k=k-1&m)x.push(_+"["+T+"+"+g(k)+"]");for(x.push(v(0)),k=0;k<D;++k)1&n?x.push(a(k,l),a(k,m)):x.push(a(k,m),a(k,l));for(1&n?x.push(d,y):x.push(y,d),k=0;k<b;++k)x.push(c(k));F.push("if(",d,"!==",y,"){","face(",x.join(),")}")}F.push("}",T,"+=1;")}(e);else{!function(t){for(var e=t-1;e>=0;--e)L(e,0);var r=[];for(e=0;e<D;++e)E[e]?r.push(i(e)+".get("+u(e)+")"):r.push(i(e)+"["+u(e)+"]");for(e=0;e<b;++e)r.push(c(e));for(F.push(w,"[",T,"++]=phase(",r.join(),");"),e=0;e<t;++e)C(e);for(var n=0;n<D;++n)F.push(u(n),"+=",d(n,S[t]),";")}(t),F.push("if(",o(S[t]),">0){",f(S[t]),"=1;"),P(t-1,e|1<<S[t]);for(var r=0;r<D;++r)F.push(u(r),"+=",d(r,S[t]),";");t===z-1&&(F.push(T,"=0;"),I()),L(t,2),P(t-1,e),t===z-1&&(F.push("if(",f(S[z-1]),"&1){",T,"=0;}"),I()),C(t),F.push("}")}}var D=E.length,z=S.length;if(z<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var O="extractContour"+S.join("_"),F=[],R=[],j=[],N=0;N<D;++N)j.push(n(N));for(N=0;N<b;++N)j.push(c(N));for(N=0;N<z;++N)R.push(o(N)+"="+n(0)+".shape["+N+"]|0");for(N=0;N<D;++N){R.push(i(N)+"="+n(N)+".data",l(N)+"="+n(N)+".offset|0");for(var B=0;B<z;++B)R.push(s(N,B)+"="+n(N)+".stride["+B+"]|0")}for(N=0;N<D;++N){R.push(u(N)+"="+l(N)),R.push(a(N,0));for(B=1;B<1<<z;++B){for(var U=[],V=0;V<z;++V)B&1<<V&&U.push("-"+s(N,V));R.push(h(N,B)+"=("+U.join("")+")|0"),R.push(a(N,B)+"=0")}}for(N=0;N<D;++N)for(B=0;B<z;++B){var H=[s(N,S[B])];B>0&&H.push(s(N,S[B-1])+"*"+o(S[B-1])),R.push(d(N,S[B])+"=("+H.join("-")+")|0")}for(N=0;N<z;++N)R.push(f(N)+"=0");R.push(M+"=0");var q=["2"];for(N=z-2;N>=0;--N)q.push(o(S[N]));R.push(k+"=("+q.join("*")+")|0",w+"=mallocUint32("+k+")",_+"=mallocUint32("+k+")",T+"=0"),R.push(p(0)+"=0");for(B=1;B<1<<z;++B){var G=[],Y=[];for(V=0;V<z;++V)B&1<<V&&(0===Y.length?G.push("1"):G.unshift(Y.join("*"))),Y.push(o(S[V]));var W="";G[0].indexOf(o(S[z-2]))<0&&(W="-");var X=y(z,B,S);R.push(g(X)+"=(-"+G.join("-")+")|0",m(X)+"=("+W+G.join("-")+")|0",p(X)+"=0")}R.push(v(0)+"=0",A+"=0"),P(z-1,0),F.push("freeUint32(",_,");freeUint32(",w,");");var Z=["'use strict';","function ",O,"(",j.join(),"){","var ",R.join(),";",F.join(""),"}","return ",O].join("");return new Function("vertex","face","phase","mallocUint32","freeUint32",Z)(t,e,r,x.mallocUint32,x.freeUint32)}var x=t("typedarray-pool");e.exports=function(t){function e(t){throw new Error("ndarray-extract-contour: "+t)}"object"!=typeof t&&e("Must specify arguments");var r=t.order;Array.isArray(r)||e("Must specify order");var n=t.arrayArguments||1;n<1&&e("Must have at least one array argument");var i=t.scalarArguments||0;i<0&&e("Scalar arg count must be > 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 a=t.getters||[],o=new Array(n),s=0;s<n;++s)a.indexOf(s)>=0?o[s]=!0:o[s]=!1;return b(t.vertex,t.cell,t.phase,i,r,o)};var _="V",w="P",M="N",k="Q",T="X",A="T"},{"typedarray-pool":550}],458:[function(t,e,r){"use strict";var n=t("cwise/lib/wrapper")({args:["index","array","scalar"],pre:{body:"{}",args:[],thisVars:[],localVars:[]},body:{body:"{_inline_1_arg1_=_inline_1_arg2_.apply(void 0,_inline_1_arg0_)}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_1_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_1_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:[],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"cwise",blockSize:64});e.exports=function(t,e){return n(t,e),t}},{"cwise/lib/wrapper":114}],459:[function(t,e,r){"use strict";function n(t){if(t in o)return o[t];for(var e=[],r=0;r<t;++r)e.push("out",r,"s=0.5*(inp",r,"l-inp",r,"r);");var n=["array"],s=["junk"];for(r=0;r<t;++r){n.push("array"),s.push("out"+r+"s");var c=i(t);c[r]=-1,n.push({array:0,offset:c.slice()}),c[r]=1,n.push({array:0,offset:c.slice()}),s.push("inp"+r+"l","inp"+r+"r")}return o[t]=a({args:n,pre:l,post:l,body:{body:e.join(""),args:s.map(function(t){return{name:t,lvalue:0===t.indexOf("out"),rvalue:0===t.indexOf("inp"),count:"junk"!==t|0}}),thisVars:[],localVars:[]},funcName:"fdTemplate"+t})}e.exports=function(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r=i(e.dimension,"string"==typeof r?r:"clamp");if(t.dimension!==e.dimension+1)throw new Error("ndarray-gradient: output dimension must be +1 input dimension");if(t.shape[e.dimension]!==e.dimension)throw new Error("ndarray-gradient: output shape must match input shape");for(var a=0;a<e.dimension;++a)if(t.shape[a]!==e.shape[a])throw new Error("ndarray-gradient: shape mismatch");return 0===e.size?t:e.dimension<=0?(t.set(0),t):function(t){function e(e){for(var r=i-e.length,n=[],o=[],s=[],l=0;l<i;++l)e.indexOf(l+1)>=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),n.push("1"),o.push("s["+l+"]-2"));var c=".lo("+n.join()+").hi("+o.join()+")";if(0===n.length&&(c=""),r>0){for(a.push("if(1"),l=0;l<i;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");for(a.push("){grad",r,"(src.pick(",s.join(),")",c),l=0;l<i;++l)e.indexOf(l+1)>=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",c);a.push(");")}for(l=0;l<e.length;++l){var u=Math.abs(e[l])-1,h="dst.pick("+s.join()+","+u+")"+c;switch(t[u]){case"clamp":var f=s.slice(),d=s.slice();e[l]<0?f[u]="s["+u+"]-2":d[u]="1",0===r?a.push("if(s[",u,"]>1){dst.set(",s.join(),",",u,",0.5*(src.get(",f.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):a.push("if(s[",u,"]>1){diff(",h,",src.pick(",f.join(),")",c,",src.pick(",d.join(),")",c,");}else{zero(",h,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",u,",0);"):a.push("zero(",h,");");break;case"wrap":var p=s.slice(),m=s.slice();e[l]<0?(p[u]="s["+u+"]-2",m[u]="0"):(p[u]="s["+u+"]-1",m[u]="1"),0===r?a.push("if(s[",u,"]>2){dst.set(",s.join(),",",u,",0.5*(src.get(",p.join(),")-src.get(",m.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):a.push("if(s[",u,"]>2){diff(",h,",src.pick(",p.join(),")",c,",src.pick(",m.join(),")",c,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}r>0&&a.push("};")}var r=t.join();if(v=s[r])return v;for(var i=t.length,a=["function gradient(dst,src){var s=src.shape.slice();"],l=0;l<1<<i;++l){for(var h=[],f=0;f<i;++f)l&1<<f&&h.push(f+1);for(var d=0;d<1<<h.length;++d){var p=h.slice();for(f=0;f<h.length;++f)d&1<<f&&(p[f]=-p[f]);e(p)}}a.push("return dst;};return gradient");var m=["diff","zero"],g=[c,u];for(l=1;l<=i;++l)m.push("grad"+l),g.push(n(l));m.push(a.join(""));var v=Function.apply(void 0,m).apply(void 0,g);return o[r]=v,v}(r)(t,e)};var i=t("dup"),a=t("cwise-compiler"),o={},s={},l={body:"",args:[],thisVars:[],localVars:[]},c=a({args:["array","array","array"],pre:l,post:l,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1},{name:"left",lvalue:!1,rvalue:!0,count:1},{name:"right",lvalue:!1,rvalue:!0,count:1}],body:"out=0.5*(left-right)",thisVars:[],localVars:[]},funcName:"cdiff"}),u=a({args:["array"],pre:l,post:l,body:{args:[{name:"out",lvalue:!0,rvalue:!1,count:1}],body:"out=0",thisVars:[],localVars:[]},funcName:"zero"})},{"cwise-compiler":111,dup:126}],460:[function(t,e,r){"use strict";var n=t("ndarray-warp"),i=t("gl-matrix-invert");e.exports=function(t,e,r){var a=e.dimension,o=i([],r);return n(t,e,function(t,e){for(var r=0;r<a;++r){t[r]=o[(a+1)*a+r];for(var n=0;n<a;++n)t[r]+=o[(a+1)*n+r]*e[n]}var i=o[(a+1)*(a+1)-1];for(n=0;n<a;++n)i+=o[(a+1)*n+a]*e[n];var s=1/i;for(r=0;r<a;++r)t[r]*=s;return t}),t}},{"gl-matrix-invert":193,"ndarray-warp":467}],461:[function(t,e,r){"use strict";function n(t,e){var r=Math.floor(e),n=e-r,i=0<=r&&r<t.shape[0],a=0<=r+1&&r+1<t.shape[0];return(1-n)*(i?+t.get(r):0)+n*(a?+t.get(r+1):0)}function i(t,e,r){var n=Math.floor(e),i=e-n,a=0<=n&&n<t.shape[0],o=0<=n+1&&n+1<t.shape[0],s=Math.floor(r),l=r-s,c=0<=s&&s<t.shape[1],u=0<=s+1&&s+1<t.shape[1],h=a&&c?t.get(n,s):0,f=a&&u?t.get(n,s+1):0;return(1-l)*((1-i)*h+i*(o&&c?t.get(n+1,s):0))+l*((1-i)*f+i*(o&&u?t.get(n+1,s+1):0))}function a(t,e,r,n){var i=Math.floor(e),a=e-i,o=0<=i&&i<t.shape[0],s=0<=i+1&&i+1<t.shape[0],l=Math.floor(r),c=r-l,u=0<=l&&l<t.shape[1],h=0<=l+1&&l+1<t.shape[1],f=Math.floor(n),d=n-f,p=0<=f&&f<t.shape[2],m=0<=f+1&&f+1<t.shape[2],g=o&&u&&p?t.get(i,l,f):0,v=o&&h&&p?t.get(i,l+1,f):0,y=s&&u&&p?t.get(i+1,l,f):0,b=s&&h&&p?t.get(i+1,l+1,f):0,x=o&&u&&m?t.get(i,l,f+1):0,_=o&&h&&m?t.get(i,l+1,f+1):0;return(1-d)*((1-c)*((1-a)*g+a*y)+c*((1-a)*v+a*b))+d*((1-c)*((1-a)*x+a*(s&&u&&m?t.get(i+1,l,f+1):0))+c*((1-a)*_+a*(s&&h&&m?t.get(i+1,l+1,f+1):0)))}e.exports=function(t,e,r,o){switch(t.shape.length){case 0:return 0;case 1:return n(t,e);case 2:return i(t,e,r);case 3:return a(t,e,r,o);default:return function(t){var e,r,n=0|t.shape.length,i=new Array(n),a=new Array(n),o=new Array(n),s=new Array(n);for(e=0;e<n;++e)r=+arguments[e+1],i[e]=Math.floor(r),a[e]=r-i[e],o[e]=0<=i[e]&&i[e]<t.shape[e],s[e]=0<=i[e]+1&&i[e]+1<t.shape[e];var l,c,u,h=0;t:for(e=0;e<1<<n;++e){for(c=1,u=t.offset,l=0;l<n;++l)if(e&1<<l){if(!s[l])continue t;c*=a[l],u+=t.stride[l]*(i[l]+1)}else{if(!o[l])continue t;c*=1-a[l],u+=t.stride[l]*i[l]}h+=c*t.data[u]}return h}.apply(void 0,arguments)}},e.exports.d1=n,e.exports.d2=i,e.exports.d3=a},{}],462:[function(t,e,r){"use strict";function n(t){if(!t)return o;for(var e=0;e<t.args.length;++e){var r=t.args[e];t.args[e]=0===e?{name:r,lvalue:!0,rvalue:!!t.rvalue,count:t.count||1}:{name:r,lvalue:!1,rvalue:!0,count:1}}return t.thisVars||(t.thisVars=[]),t.localVars||(t.localVars=[]),t}function i(t){for(var e=[],r=0;r<t.args.length;++r)e.push("a"+r);return new Function("P",["return function ",t.funcName,"_ndarrayops(",e.join(","),") {P(",e.join(","),");return a0}"].join(""))(function(t){return a({args:t.args,pre:n(t.pre),body:n(t.body),post:n(t.proc),funcName:t.funcName})}(t))}var a=t("cwise-compiler"),o={body:"",args:[],thisVars:[],localVars:[]},s={add:"+",sub:"-",mul:"*",div:"/",mod:"%",band:"&",bor:"|",bxor:"^",lshift:"<<",rshift:">>",rrshift:">>>"};!function(){for(var t in s){var e=s[t];r[t]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"seq"]=i({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]=i({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),r[t+"eq"]=i({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]=i({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),r[t+"s"]=i({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),r[t+"eq"]=i({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),r[t+"seq"]=i({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;t<u.length;++t){var e=u[t];r[e]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b)",thisVars:["this_f"]},funcName:e}),r[e+"eq"]=i({args:["array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a"],body:"a=this_f(a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"})}}();var h=["max","min","atan2","pow"];!function(){for(var t=0;t<h.length;++t){var e=h[t];r[e]=i({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e}),r[e+"s"]=i({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(b,c)",thisVars:["this_f"]},funcName:e+"s"}),r[e+"eq"]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"eq"}),r[e+"seq"]=i({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(a,b)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"seq"})}}();var f=["atan2","pow"];!function(){for(var t=0;t<f.length;++t){var e=f[t];r[e+"op"]=i({args:["array","array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"op"}),r[e+"ops"]=i({args:["array","array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b","c"],body:"a=this_f(c,b)",thisVars:["this_f"]},funcName:e+"ops"}),r[e+"opeq"]=i({args:["array","array"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opeq"}),r[e+"opseq"]=i({args:["array","scalar"],pre:{args:[],body:"this_f=Math."+e,thisVars:["this_f"]},body:{args:["a","b"],body:"a=this_f(b,a)",thisVars:["this_f"]},rvalue:!0,count:2,funcName:e+"opseq"})}}(),r.any=a({args:["array"],pre:o,body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"if(a){return true}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return false"},funcName:"any"}),r.all=a({args:["array"],pre:o,body:{args:[{name:"x",lvalue:!1,rvalue:!0,count:1}],body:"if(!x){return false}",localVars:[],thisVars:[]},post:{args:[],localVars:[],thisVars:[],body:"return true"},funcName:"all"}),r.sum=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s+=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"sum"}),r.prod=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=1"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:1}],body:"this_s*=a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"prod"}),r.norm2squared=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norm2squared"}),r.norm2=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:2}],body:"this_s+=a*a",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return Math.sqrt(this_s)"},funcName:"norm2"}),r.norminf=a({args:["array"],pre:{args:[],localVars:[],thisVars:["this_s"],body:"this_s=0"},body:{args:[{name:"a",lvalue:!1,rvalue:!0,count:4}],body:"if(-a>this_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=a({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=a({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=a({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.argmin=a({args:["index","array","shape"],pre:{body:"{this_v=Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_<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.argmax=a({args:["index","array","shape"],pre:{body:"{this_v=-Infinity;this_i=_inline_0_arg2_.slice(0)}",args:[{name:"_inline_0_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_0_arg2_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_i","this_v"],localVars:[]},body:{body:"{if(_inline_1_arg1_>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=i({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=i({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),r.assigns=i({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),r.equals=a({args:["array","array"],pre:o,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":111}],463:[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":464,ndarray:468}],464:[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":111}],465:[function(t,e,r){"use strict";function n(t){switch(t){case"uint8":return[a.mallocUint8,a.freeUint8];case"uint16":return[a.mallocUint16,a.freeUint16];case"uint32":return[a.mallocUint32,a.freeUint32];case"int8":return[a.mallocInt8,a.freeInt8];case"int16":return[a.mallocInt16,a.freeInt16];case"int32":return[a.mallocInt32,a.freeInt32];case"float32":return[a.mallocFloat,a.freeFloat];case"float64":return[a.mallocDouble,a.freeDouble];default:return null}}function i(t){for(var e=[],r=0;r<t;++r)e.push("s"+r);for(r=0;r<t;++r)e.push("n"+r);for(r=1;r<t;++r)e.push("d"+r);for(r=1;r<t;++r)e.push("e"+r);for(r=1;r<t;++r)e.push("f"+r);return e}var a=t("typedarray-pool"),o=32;e.exports=function(t,e){var r=["'use strict'"],a=["ndarraySortWrapper",t.join("d"),e].join("");r.push(["function ",a,"(",["array"].join(","),"){"].join(""));for(var s=["data=array.data,offset=array.offset|0,shape=array.shape,stride=array.stride"],l=0;l<t.length;++l)s.push(["s",l,"=stride[",l,"]|0,n",l,"=shape[",l,"]|0"].join(""));var c=new Array(t.length),u=[];for(l=0;l<t.length;++l)0!==(p=t[l])&&(0===u.length?c[p]="1":c[p]=u.join("*"),u.push("n"+p));var h=-1,f=-1;for(l=0;l<t.length;++l){var d=t[l];0!==d&&(h>0?s.push(["d",d,"=s",d,"-d",h,"*n",h].join("")):s.push(["d",d,"=s",d].join("")),h=d);var p;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 m=["0","n0-1","data","offset"].concat(i(t.length));r.push(["if(n0<=",o,"){","insertionSort(",m.join(","),")}else{","quickSort(",m.join(","),")}"].join("")),r.push("}return "+a);var g=new Function("insertionSort","quickSort",r.join("\n")),v=function(t,e){function r(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function a(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}var o=["'use strict'"],s=["ndarrayInsertionSort",t.join("d"),e].join(""),l=["left","right","data","offset"].concat(i(t.length)),c=n(e),u=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var h=[],f=1;f<t.length;++f)u.push("i"+f),h.push("n"+f);c?u.push("scratch=malloc("+h.join("*")+")"):u.push("scratch=new Array("+h.join("*")+")"),u.push("dptr","sptr","a","b")}else u.push("scratch");if(o.push(["function ",s,"(",l.join(","),"){var ",u.join(",")].join(""),"for(i=left+1;i<=right;++i){","j=i;ptr+=s0","cptr=ptr"),t.length>1){for(o.push("dptr=0;sptr=ptr"),f=t.length-1;f>=0;--f)0!==(d=t[f])&&o.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""));for(o.push("scratch[dptr++]=",r("sptr")),f=0;f<t.length;++f)0!==(d=t[f])&&o.push("sptr+=d"+d,"}");for(o.push("__g:while(j--\x3eleft){","dptr=0","sptr=cptr-s0"),f=1;f<t.length;++f)1===f&&o.push("__l:"),o.push(["for(i",f,"=0;i",f,"<n",f,";++i",f,"){"].join(""));for(o.push(["a=",r("sptr"),"\nb=scratch[dptr]\nif(a<b){break __g}\nif(a>b){break __l}"].join("")),f=t.length-1;f>=1;--f)o.push("sptr+=e"+f,"dptr+=f"+f,"}");for(o.push("dptr=cptr;sptr=cptr-s0"),f=t.length-1;f>=0;--f)0!==(d=t[f])&&o.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""));for(o.push(a("dptr",r("sptr"))),f=0;f<t.length;++f)0!==(d=t[f])&&o.push(["dptr+=d",d,";sptr+=d",d].join(""),"}");for(o.push("cptr-=s0\n}"),o.push("dptr=cptr;sptr=0"),f=t.length-1;f>=0;--f)0!==(d=t[f])&&o.push(["for(i",d,"=0;i",d,"<n",d,";++i",d,"){"].join(""));for(o.push(a("dptr","scratch[sptr++]")),f=0;f<t.length;++f){var d;0!==(d=t[f])&&o.push("dptr+=d"+d,"}")}}else o.push("scratch="+r("ptr"),"while((j--\x3eleft)&&("+r("cptr-s0")+">scratch)){",a("cptr",r("cptr-s0")),"cptr-=s0","}",a("cptr","scratch"));return o.push("}"),t.length>1&&c&&o.push("free(scratch)"),o.push("} return "+s),c?new Function("malloc","free",o.join("\n"))(c[0],c[1]):new Function(o.join("\n"))()}(t,e);return g(v,function(t,e,r){function a(t){return["(offset+",t,"*s0)"].join("")}function s(t){return"generic"===e?["data.get(",t,")"].join(""):["data[",t,"]"].join("")}function l(t,r){return"generic"===e?["data.set(",t,",",r,")"].join(""):["data[",t,"]=",r].join("")}function c(e,r,n){if(1===e.length)_.push("ptr0="+a(e[0]));else for(var i=0;i<e.length;++i)_.push(["b_ptr",i,"=s0*",e[i]].join(""));for(r&&_.push("pivot_ptr=0"),_.push("ptr_shift=offset"),i=t.length-1;i>=0;--i)0!==(o=t[i])&&_.push(["for(i",o,"=0;i",o,"<n",o,";++i",o,"){"].join(""));if(e.length>1)for(i=0;i<e.length;++i)_.push(["ptr",i,"=b_ptr",i,"+ptr_shift"].join(""));for(_.push(n),r&&_.push("++pivot_ptr"),i=0;i<t.length;++i){var o;0!==(o=t[i])&&(e.length>1?_.push("ptr_shift+=d"+o):_.push("ptr0+=d"+o),_.push("}"))}}function u(e,r,n,i){if(1===r.length)_.push("ptr0="+a(r[0]));else{for(var o=0;o<r.length;++o)_.push(["b_ptr",o,"=s0*",r[o]].join(""));_.push("ptr_shift=offset")}for(n&&_.push("pivot_ptr=0"),e&&_.push(e+":"),o=1;o<t.length;++o)_.push(["for(i",o,"=0;i",o,"<n",o,";++i",o,"){"].join(""));if(r.length>1)for(o=0;o<r.length;++o)_.push(["ptr",o,"=b_ptr",o,"+ptr_shift"].join(""));for(_.push(i),o=t.length-1;o>=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function h(){t.length>1&&k&&_.push("free(pivot1)","free(pivot2)")}function f(e,r){var n="el"+e,i="el"+r;if(t.length>1){var o="__l"+ ++T;u(o,[n,i],!1,["comp=",s("ptr0"),"-",s("ptr1"),"\n","if(comp>0){tmp0=",n,";",n,"=",i,";",i,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else _.push(["if(",s(a(n)),">",s(a(i)),"){tmp0=",n,";",n,"=",i,";",i,"=tmp0}"].join(""))}function d(e,r){t.length>1?c([e,r],!1,l("ptr0",s("ptr1"))):_.push(l(a(e),s(a(r))))}function p(e,r,n){if(t.length>1){var i="__l"+ ++T;u(i,[r],!0,[e,"=",s("ptr0"),"-pivot",n,"[pivot_ptr]\n","if(",e,"!==0){break ",i,"}"].join(""))}else _.push([e,"=",s(a(r)),"-pivot",n].join(""))}function m(e,r){t.length>1?c([e,r],!1,["tmp=",s("ptr0"),"\n",l("ptr0",s("ptr1")),"\n",l("ptr1","tmp")].join("")):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","tmp=",s("ptr0"),"\n",l("ptr0",s("ptr1")),"\n",l("ptr1","tmp")].join(""))}function g(e,r,n){t.length>1?(c([e,r,n],!1,["tmp=",s("ptr0"),"\n",l("ptr0",s("ptr1")),"\n",l("ptr1",s("ptr2")),"\n",l("ptr2","tmp")].join("")),_.push("++"+r,"--"+n)):_.push(["ptr0=",a(e),"\n","ptr1=",a(r),"\n","ptr2=",a(n),"\n","++",r,"\n","--",n,"\n","tmp=",s("ptr0"),"\n",l("ptr0",s("ptr1")),"\n",l("ptr1",s("ptr2")),"\n",l("ptr2","tmp")].join(""))}function v(t,e){m(t,e),_.push("--"+e)}function y(e,r,n){t.length>1?c([e,r],!0,[l("ptr0",s("ptr1")),"\n",l("ptr1",["pivot",n,"[pivot_ptr]"].join(""))].join("")):_.push(l(a(e),s(a(r))),l(a(r),"pivot"+n))}function b(e,r){_.push(["if((",r,"-",e,")<=",o,"){\n","insertionSort(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}else{\n",w,"(",e,",",r,",data,offset,",i(t.length).join(","),")\n","}"].join(""))}function x(e,r,n){t.length>1?(_.push(["__l",++T,":while(true){"].join("")),c([e],!0,["if(",s("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",T,"}"].join("")),_.push(n,"}")):_.push(["while(",s(a(e)),"===pivot",r,"){",n,"}"].join(""))}var _=["'use strict'"],w=["ndarrayQuickSort",t.join("d"),e].join(""),M=["left","right","data","offset"].concat(i(t.length)),k=n(e),T=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var A=["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 S=[],E=1;E<t.length;++E)S.push("n"+E),A.push("i"+E);for(E=0;E<8;++E)A.push("b_ptr"+E);A.push("ptr3","ptr4","ptr5","ptr6","ptr7","pivot_ptr","ptr_shift","elementSize="+S.join("*")),k?A.push("pivot1=malloc(elementSize)","pivot2=malloc(elementSize)"):A.push("pivot1=new Array(elementSize),pivot2=new Array(elementSize)")}else A.push("pivot1","pivot2");return _.push("var "+A.join(",")),f(1,2),f(4,5),f(1,3),f(2,3),f(1,4),f(3,4),f(2,5),f(2,3),f(4,5),t.length>1?c(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",s("ptr1"),"\n","pivot2[pivot_ptr]=",s("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",s("ptr0"),"\n","y=",s("ptr2"),"\n","z=",s("ptr4"),"\n",l("ptr5","x"),"\n",l("ptr6","y"),"\n",l("ptr7","z")].join("")):_.push(["pivot1=",s(a("el2")),"\n","pivot2=",s(a("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",s(a("el1")),"\n","y=",s(a("el3")),"\n","z=",s(a("el5")),"\n",l(a("index1"),"x"),"\n",l(a("index3"),"y"),"\n",l(a("index5"),"z")].join("")),d("index2","left"),d("index4","right"),_.push("if(pivots_are_equal){"),_.push("for(k=less;k<=great;++k){"),p("comp","k",1),_.push("if(comp===0){continue}"),_.push("if(comp<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),_.push("while(true){"),p("comp","great",1),_.push("if(comp>0){"),_.push("great--"),_.push("}else if(comp<0){"),g("k","less","great"),_.push("break"),_.push("}else{"),v("k","great"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}else{"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1<0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2>0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp>0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),g("k","less","great"),_.push("}else{"),v("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),y("left","(less-1)",1),y("right","(great+1)",2),b("left","(less-2)"),b("(great+2)","right"),_.push("if(pivots_are_equal){"),h(),_.push("return"),_.push("}"),_.push("if(less<index1&&great>index5){"),x("less",1,"++less"),x("great",2,"--great"),_.push("for(k=less;k<=great;++k){"),p("comp_pivot1","k",1),_.push("if(comp_pivot1===0){"),_.push("if(k!==less){"),m("k","less"),_.push("}"),_.push("++less"),_.push("}else{"),p("comp_pivot2","k",2),_.push("if(comp_pivot2===0){"),_.push("while(true){"),p("comp","great",2),_.push("if(comp===0){"),_.push("if(--great<k){break}"),_.push("continue"),_.push("}else{"),p("comp","great",1),_.push("if(comp<0){"),g("k","less","great"),_.push("}else{"),v("k","great"),_.push("}"),_.push("break"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),_.push("}"),h(),b("less","great"),_.push("}return "+w),t.length>1&&k?new Function("insertionSort","malloc","free",_.join("\n"))(r,k[0],k[1]):new Function("insertionSort",_.join("\n"))(r)}(t,e,v))}},{"typedarray-pool":550}],466:[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":465}],467:[function(t,e,r){"use strict";var n=t("ndarray-linear-interpolate"),i=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=new Array(_inline_9_arg4_)}",args:[{name:"_inline_9_arg0_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg1_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg2_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg3_",lvalue:!1,rvalue:!1,count:0},{name:"_inline_9_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_10_arg2_(this_warped,_inline_10_arg0_),_inline_10_arg1_=_inline_10_arg3_.apply(void 0,this_warped)}",args:[{name:"_inline_10_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_10_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_10_arg4_",lvalue:!1,rvalue:!1,count:0}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warpND",blockSize:64}),a=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_13_arg2_(this_warped,_inline_13_arg0_),_inline_13_arg1_=_inline_13_arg3_(_inline_13_arg4_,this_warped[0])}",args:[{name:"_inline_13_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_13_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_13_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp1D",blockSize:64}),o=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_16_arg2_(this_warped,_inline_16_arg0_),_inline_16_arg1_=_inline_16_arg3_(_inline_16_arg4_,this_warped[0],this_warped[1])}",args:[{name:"_inline_16_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_16_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_16_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp2D",blockSize:64}),s=t("cwise/lib/wrapper")({args:["index","array","scalar","scalar","scalar"],pre:{body:"{this_warped=[0,0,0]}",args:[],thisVars:["this_warped"],localVars:[]},body:{body:"{_inline_19_arg2_(this_warped,_inline_19_arg0_),_inline_19_arg1_=_inline_19_arg3_(_inline_19_arg4_,this_warped[0],this_warped[1],this_warped[2])}",args:[{name:"_inline_19_arg0_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg1_",lvalue:!0,rvalue:!1,count:1},{name:"_inline_19_arg2_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg3_",lvalue:!1,rvalue:!0,count:1},{name:"_inline_19_arg4_",lvalue:!1,rvalue:!0,count:1}],thisVars:["this_warped"],localVars:[]},post:{body:"{}",args:[],thisVars:[],localVars:[]},debug:!1,funcName:"warp3D",blockSize:64});e.exports=function(t,e,r){switch(e.shape.length){case 1:a(t,r,n.d1,e);break;case 2:o(t,r,n.d2,e);break;case 3:s(t,r,n.d3,e);break;default:i(t,r,n.bind(void 0,e),e.shape.length)}return t}},{"cwise/lib/wrapper":114,"ndarray-linear-interpolate":461}],468:[function(t,e,r){function n(t,e){return t[0]-e[0]}function i(){var t,e=this.stride,r=new Array(e.length);for(t=0;t<r.length;++t)r[t]=[Math.abs(e[t]),t];r.sort(n);var i=new Array(r.length);for(t=0;t<i.length;++t)i[t]=r[t][1];return i}function a(t,e){var r=["View",e,"d",t].join("");e<0&&(r="View_Nil"+t);var n="generic"===t;if(-1===e){var a="function "+r+"(a){this.data=a;};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return -1};proto.size=0;proto.dimension=-1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function(){return new "+r+"(this.data);};proto.get=proto.set=function(){};proto.pick=function(){return null};return function construct_"+r+"(a){return new "+r+"(a);}";return new Function(a)()}if(0===e){a="function "+r+"(a,d) {this.data = a;this.offset = d};var proto="+r+".prototype;proto.dtype='"+t+"';proto.index=function(){return this.offset};proto.dimension=0;proto.size=1;proto.shape=proto.stride=proto.order=[];proto.lo=proto.hi=proto.transpose=proto.step=function "+r+"_copy() {return new "+r+"(this.data,this.offset)};proto.pick=function "+r+"_pick(){return TrivialArray(this.data);};proto.valueOf=proto.get=function "+r+"_get(){return "+(n?"this.data.get(this.offset)":"this.data[this.offset]")+"};proto.set=function "+r+"_set(v){return "+(n?"this.data.set(this.offset,v)":"this.data[this.offset]=v")+"};return function construct_"+r+"(a,b,c,d){return new "+r+"(a,d)}";return new Function("TrivialArray",a)(c[t][0])}a=["'use strict'"];var s=o(e),l=s.map(function(t){return"i"+t}),u="this.offset+"+s.map(function(t){return"this.stride["+t+"]*i"+t}).join("+"),h=s.map(function(t){return"b"+t}).join(","),f=s.map(function(t){return"c"+t}).join(",");a.push("function "+r+"(a,"+h+","+f+",d){this.data=a","this.shape=["+h+"]","this.stride=["+f+"]","this.offset=d|0}","var proto="+r+".prototype","proto.dtype='"+t+"'","proto.dimension="+e),a.push("Object.defineProperty(proto,'size',{get:function "+r+"_size(){return "+s.map(function(t){return"this.shape["+t+"]"}).join("*"),"}})"),1===e?a.push("proto.order=[0]"):(a.push("Object.defineProperty(proto,'order',{get:"),e<4?(a.push("function "+r+"_order(){"),2===e?a.push("return (Math.abs(this.stride[0])>Math.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){"),n?a.push("return this.data.set("+u+",v)}"):a.push("return this.data["+u+"]=v}"),a.push("proto.get=function "+r+"_get("+l.join(",")+"){"),n?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,"+s.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+s.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var d=s.map(function(t){return"a"+t+"=this.shape["+t+"]"}),p=s.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 m=0;m<e;++m)a.push("if(typeof i"+m+"==='number'&&i"+m+">=0){d=i"+m+"|0;b+=c"+m+"*d;a"+m+"-=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"c"+t}).join(",")+",b)}"),a.push("proto.step=function "+r+"_step("+l.join(",")+"){var "+s.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+s.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(m=0;m<e;++m)a.push("if(typeof i"+m+"==='number'){d=i"+m+"|0;if(d<0){c+=b"+m+"*(a"+m+"-1);a"+m+"=ceil(-a"+m+"/d)}else{a"+m+"=ceil(a"+m+"/d)}b"+m+"*=d}");a.push("return new "+r+"(this.data,"+s.map(function(t){return"a"+t}).join(",")+","+s.map(function(t){return"b"+t}).join(",")+",c)}");var g=new Array(e),v=new Array(e);for(m=0;m<e;++m)g[m]="a[i"+m+"]",v[m]="b[i"+m+"]";a.push("proto.transpose=function "+r+"_transpose("+l+"){"+l.map(function(t,e){return t+"=("+t+"===undefined?"+e+":"+t+"|0)"}).join(";"),"var a=this.shape,b=this.stride;return new "+r+"(this.data,"+g.join(",")+","+v.join(",")+",this.offset)}"),a.push("proto.pick=function "+r+"_pick("+l+"){var a=[],b=[],c=this.offset");for(m=0;m<e;++m)a.push("if(typeof i"+m+"==='number'&&i"+m+">=0){c=(c+this.stride["+m+"]*i"+m+")|0}else{a.push(this.shape["+m+"]);b.push(this.stride["+m+"])}");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,"+s.map(function(t){return"shape["+t+"]"}).join(",")+","+s.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}");return new Function("CTOR_LIST","ORDER",a.join("\n"))(c[t],i)}var o=t("iota-array"),s=t("is-buffer"),l="undefined"!=typeof Float64Array,c={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};e.exports=function(t,e,r,n){if(void 0===t)return(0,c.array[0])([]);"number"==typeof t&&(t=[t]),void 0===e&&(e=[t.length]);var i=e.length;if(void 0===r){r=new Array(i);for(var o=i-1,u=1;o>=0;--o)r[o]=u,u*=e[o]}if(void 0===n)for(n=0,o=0;o<i;++o)r[o]<0&&(n-=(e[o]-1)*r[o]);for(var h=function(t){if(s(t))return"buffer";if(l)switch(Object.prototype.toString.call(t)){case"[object Float64Array]":return"float64";case"[object Float32Array]":return"float32";case"[object Int8Array]":return"int8";case"[object Int16Array]":return"int16";case"[object Int32Array]":return"int32";case"[object Uint8Array]":return"uint8";case"[object Uint16Array]":return"uint16";case"[object Uint32Array]":return"uint32";case"[object Uint8ClampedArray]":return"uint8_clamped"}return Array.isArray(t)?"array":"generic"}(t),f=c[h];f.length<=i+1;)f.push(a(h,f.length-1));return(0,f[i+1])(t,e,r,n)}},{"iota-array":294,"is-buffer":296}],469:[function(t,e,r){"use strict";var n=t("double-bits"),i=Math.pow(2,-1074),a=-1>>>0;e.exports=function(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return e<0?-i:i;var r=n.hi(t),o=n.lo(t);return e>t==t>0?o===a?(r+=1,o=0):o+=1:0===o?(o=a,r-=1):o-=1,n.pack(o,r)}},{"double-bits":125}],470:[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;o<n;++o)i[o]=[0,0,0];for(o=0;o<t.length;++o)for(var s=t[o],l=0,c=s[s.length-1],u=s[0],h=0;h<s.length;++h){l=c,c=u,u=s[(h+1)%s.length];for(var f=e[l],d=e[c],p=e[u],m=new Array(3),g=0,v=new Array(3),y=0,b=0;b<3;++b)m[b]=f[b]-d[b],g+=m[b]*m[b],v[b]=p[b]-d[b],y+=v[b]*v[b];if(g*y>a){var x=i[c],_=1/Math.sqrt(g*y);for(b=0;b<3;++b){var w=(b+1)%3,M=(b+2)%3;x[b]+=_*(v[w]*m[M]-v[M]*m[w])}}}for(o=0;o<n;++o){x=i[o];var k=0;for(b=0;b<3;++b)k+=x[b]*x[b];if(k>a)for(_=1/Math.sqrt(k),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;o<n;++o){for(var s=t[o],l=new Array(3),c=0;c<3;++c)l[c]=e[s[c]];var u=new Array(3),h=new Array(3);for(c=0;c<3;++c)u[c]=l[1][c]-l[0][c],h[c]=l[2][c]-l[0][c];var f=new Array(3),d=0;for(c=0;c<3;++c){var p=(c+1)%3,m=(c+2)%3;f[c]=u[p]*h[m]-u[m]*h[p],d+=f[c]*f[c]}d=d>a?1/Math.sqrt(d):0;for(c=0;c<3;++c)f[c]*=d;i[o]=f}return i}},{}],471:[function(t,e,r){"use strict";var n=Object.getOwnPropertySymbols,i=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;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,o,s=function(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}(t),l=1;l<arguments.length;l++){r=Object(arguments[l]);for(var c in r)i.call(r,c)&&(s[c]=r[c]);if(n){o=n(r);for(var u=0;u<o.length;u++)a.call(r,o[u])&&(s[o[u]]=r[o[u]])}}return s}},{}],472:[function(t,e,r){"use strict";function n(t,e){var r,n,s;return"string"==typeof t?(n=(r=function(t,e){e||(e={});var r=e.family||"sans-serif",n=a.width,i=a.height,s=e.width||e.height||e.size;s&&s!=n&&(n=i=a.width=a.height=s);var l=e.fontSize||n/2;return o.fillStyle="#000",o.fillRect(0,0,n,i),o.font=l+"px "+r,o.textBaseline="middle",o.textAlign="center",o.fillStyle="white",o.fillText(t,n/2,i/2),o.getImageData(0,0,n,i)}(t,e)).width,s=r.height):t instanceof HTMLCanvasElement?(n=t.width,s=t.height,r=(t=t.getContext("2d")).getImageData(0,0,n,s)):t instanceof ImageData&&(n=t.width,s=t.height,r=t),function(t){var e,r,n,a,o,s,l,c,u,h,f,d,p=t.data,m=t.width,g=t.height,v=Array(g),y=Array(g),b=0,x=0,_=m,w=0,M=0,k=Array(g);for(r=0;r<g;r++)if(o=0,s=0,a=4*r*m,(h=function(t,e){var r=0,n=t.length,i=0;e||(e=4);for(;!t[i]&&i<n;)i+=e;r=i,i=t.length;for(;!t[i]&&i>r;)i-=e;return n=i,[r/e,n/e]}(p.subarray(a,a+4*m),4))[0]!==h[1]){for(b||(b=r),x=r,e=h[0];e<h[1];e++)n=p[a+4*e],o+=n,s+=e*n;v[r]=0===o?0:o/m,y[r]=0===o?0:s/o,h[0]<_&&(_=h[0]),h[1]>w&&(w=h[1]),k[r]=h}for(o=0,l=0,s=0,r=0;r<g;r++)(f=v[r])&&(l+=f*r,o+=f,s+=y[r]*f);for(u=l/o,c=s/o,M=0,d=0,r=0;r<g;r++)(h=k[r])&&(d=Math.max(i(c-h[0],u-r),i(c-h[1],u-r)))>M&&(M=d);return{center:[c,u],bounds:[_,b,w,x+1],radius:Math.sqrt(M)}}(r)}function i(t,e){return t*t+e*e}e.exports=n;var a=document.createElement("canvas"),o=a.getContext("2d");a.width=200,a.height=200,n.canvas=a},{}],473:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a,o,s,l,c){var u=e+a+c;if(h>0){var h=Math.sqrt(u+1);t[0]=.5*(o-l)/h,t[1]=.5*(s-n)/h,t[2]=.5*(r-a)/h,t[3]=.5*h}else{var f=Math.max(e,a,c);h=Math.sqrt(2*f-u+1),e>=f?(t[0]=.5*h,t[1]=.5*(i+r)/h,t[2]=.5*(s+n)/h,t[3]=.5*(o-l)/h):a>=f?(t[0]=.5*(r+i)/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-i)/h)}return t}},{}],474:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function a(t,e){var r=e[0],n=e[1],a=e[2],o=e[3],s=i(r,n,a,o);s>1e-6?(t[0]=r/s,t[1]=n/s,t[2]=a/s,t[3]=o/s):(t[0]=t[1]=t[2]=0,t[3]=1)}function o(t,e,r){this.radius=s([r]),this.center=s(e),this.rotation=s(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)}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),a(r=[].slice.call(r,0,4),r);var i=new o(r,e,Math.log(n));return i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up),i};var s=t("filtered-vector"),l=t("gl-mat4/lookAt"),c=t("gl-mat4/fromQuat"),u=t("gl-mat4/invert"),h=t("./lib/quatFromFrame"),f=o.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;a(e,e);var r=this.computedMatrix;c(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,h=0;h<3;++h)u+=r[l+4*h]*i[h];r[12+l]=-u}},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,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=a[1],s=a[5],l=a[9],c=n(o,s,l);o/=c,s/=c,l/=c;var u=a[0],h=a[4],f=a[8],d=u*o+h*s+f*l,p=n(u-=o*d,h-=s*d,f-=l*d);u/=p,h/=p,f/=p;var m=a[2],g=a[6],v=a[10],y=m*o+g*s+v*l,b=m*u+g*h+v*f,x=n(m-=y*o+b*u,g-=y*s+b*h,v-=y*l+b*f);m/=x,g/=x,v/=x;var _=u*e+o*r,w=h*e+s*r,M=f*e+l*r;this.center.move(t,_,w,M);var k=Math.exp(this.computedRadius[0]);k=Math.max(1e-4,k+i),this.radius.set(t,Math.log(k))},f.rotate=function(t,e,r,a){this.recalcMatrix(t),e=e||0,r=r||0;var o=this.computedMatrix,s=o[0],l=o[4],c=o[8],u=o[1],h=o[5],f=o[9],d=o[2],p=o[6],m=o[10],g=e*s+r*u,v=e*l+r*h,y=e*c+r*f,b=-(p*y-m*v),x=-(m*g-d*y),_=-(d*v-p*g),w=Math.sqrt(Math.max(0,1-Math.pow(b,2)-Math.pow(x,2)-Math.pow(_,2))),M=i(b,x,_,w);M>1e-6?(b/=M,x/=M,_/=M,w/=M):(b=x=_=0,w=1);var k=this.computedRotation,T=k[0],A=k[1],S=k[2],E=k[3],L=T*w+E*b+A*_-S*x,C=A*w+E*x+S*b-T*_,I=S*w+E*_+T*x-A*b,P=E*w-T*b-A*x-S*_;if(a){b=d,x=p,_=m;var D=Math.sin(a)/n(b,x,_);b*=D,x*=D,_*=D,P=P*(w=Math.cos(e))-(L=L*w+P*b+C*_-I*x)*b-(C=C*w+P*x+I*b-L*_)*x-(I=I*w+P*_+L*x-C*b)*_}var z=i(L,C,I,P);z>1e-6?(L/=z,C/=z,I/=z,P/=z):(L=C=I=0,P=1),this.rotation.set(t,L,C,I,P)},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;l(i,e,r,n);var o=this.computedRotation;h(o,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),a(o,o),this.rotation.set(t,o[0],o[1],o[2],o[3]);for(var s=0,c=0;c<3;++c)s+=Math.pow(r[c]-e[c],2);this.radius.set(t,.5*Math.log(Math.max(s,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;h(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),a(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;u(n,e);var i=n[15];if(Math.abs(i)>1e-6){var o=n[12]/i,s=n[13]/i,l=n[14]/i;this.recalcMatrix(t);var c=Math.exp(this.computedRadius[0]);this.center.set(t,o-n[2]*c,s-n[6]*c,l-n[10]*c),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 i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":473,"filtered-vector":134,"gl-mat4/fromQuat":179,"gl-mat4/invert":182,"gl-mat4/lookAt":183}],475:[function(t,e,r){"use strict";var n=t("repeat-string");e.exports=function(t,e,r){return r=void 0!==r?r+"":" ",n(r,e)+t}},{"repeat-string":509}],476:[function(t,e,r){e.exports=function(t,e){e||(e=[0,""]),t=String(t);var r=parseFloat(t,10);return e[0]=r,e[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",e}},{}],477:[function(t,e,r){(function(t){function e(t,e){for(var r=0,n=t.length-1;n>=0;n--){var i=t[n];"."===i?t.splice(n,1):".."===i?(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<t.length;n++)e(t[n],n,t)&&r.push(t[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(t){return i.exec(t).slice(1)};r.resolve=function(){for(var r="",i=!1,a=arguments.length-1;a>=-1&&!i;a--){var o=a>=0?arguments[a]:t.cwd();if("string"!=typeof o)throw new TypeError("Arguments to path.resolve must be strings");o&&(r=o+"/"+r,i="/"===o.charAt(0))}return r=e(n(r.split("/"),function(t){return!!t}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(t){var i=r.isAbsolute(t),a="/"===o(t,-1);return(t=e(n(t.split("/"),function(t){return!!t}),!i).join("/"))||i||(t="."),t&&a&&(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<t.length&&""===t[e];e++);for(var r=t.length-1;r>=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 i=n(t.split("/")),a=n(e.split("/")),o=Math.min(i.length,a.length),s=o,l=0;l<o;l++)if(i[l]!==a[l]){s=l;break}var c=[];for(l=s;l<i.length;l++)c.push("..");return(c=c.concat(a.slice(s))).join("/")},r.sep="/",r.delimiter=":",r.dirname=function(t){var e=a(t),r=e[0],n=e[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(t,e){var r=a(t)[2];return e&&r.substr(-1*e.length)===e&&(r=r.substr(0,r.length-e.length)),r},r.extname=function(t){return a(t)[3]};var o="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:496}],478:[function(t,e,r){"use strict";function n(t){var e;t&&t.length&&(t=(e=t).length);var r=new Uint8Array(t||0);return e&&r.set(e),r.readUInt32LE=a.readUInt32LE,r.writeUInt32LE=a.writeUInt32LE,r.readInt32LE=a.readInt32LE,r.writeInt32LE=a.writeInt32LE,r.readFloatLE=a.readFloatLE,r.writeFloatLE=a.writeFloatLE,r.readDoubleLE=a.readDoubleLE,r.writeDoubleLE=a.writeDoubleLE,r.toString=a.toString,r.write=a.write,r.slice=a.slice,r.copy=a.copy,r._isBuffer=!0,r}function i(t){for(var e,r,n=t.length,i=[],a=0;a<n;a++){if((e=t.charCodeAt(a))>55295&&e<57344){if(!r){e>56319||a+1===n?i.push(239,191,189):r=e;continue}if(e<56320){i.push(239,191,189),r=e;continue}e=r-55296<<10|e-56320|65536,r=null}else r&&(i.push(239,191,189),r=null);e<128?i.push(e):e<2048?i.push(e>>6|192,63&e|128):e<65536?i.push(e>>12|224,e>>6&63|128,63&e|128):i.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}return i}e.exports=n;var a,o,s,l=t("ieee754");(a={readUInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},writeUInt32LE:function(t,e){this[e]=t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24},readInt32LE:function(t){return(this[t]|this[t+1]<<8|this[t+2]<<16)+(this[t+3]<<24)},readFloatLE:function(t){return l.read(this,t,!0,23,4)},readDoubleLE:function(t){return l.read(this,t,!0,52,8)},writeFloatLE:function(t,e){return l.write(this,t,e,!0,23,4)},writeDoubleLE:function(t,e){return l.write(this,t,e,!0,52,8)},toString:function(t,e,r){var n="",i="";e=e||0,r=Math.min(this.length,r||this.length);for(var a=e;a<r;a++){var o=this[a];o<=127?(n+=decodeURIComponent(i)+String.fromCharCode(o),i=""):i+="%"+o.toString(16)}return n+=decodeURIComponent(i)},write:function(t,e){for(var r=t===o?s:i(t),n=0;n<r.length;n++)this[e+n]=r[n]},slice:function(t,e){return this.subarray(t,e)},copy:function(t,e){e=e||0;for(var r=0;r<this.length;r++)t[e+r]=this[r]}}).writeInt32LE=a.writeUInt32LE,n.byteLength=function(t){return o=t,(s=i(t)).length},n.isBuffer=function(t){return!(!t||!t._isBuffer)}},{ieee754:290}],479:[function(t,e,r){(function(r){"use strict";function n(t){this.buf=d.isBuffer(t)?t:new d(t||0),this.pos=0,this.length=this.buf.length}function i(t,e){for(var r=0;r<t.length;r++)e.writeVarint(t[r])}function a(t,e){for(var r=0;r<t.length;r++)e.writeSVarint(t[r])}function o(t,e){for(var r=0;r<t.length;r++)e.writeFloat(t[r])}function s(t,e){for(var r=0;r<t.length;r++)e.writeDouble(t[r])}function l(t,e){for(var r=0;r<t.length;r++)e.writeBoolean(t[r])}function c(t,e){for(var r=0;r<t.length;r++)e.writeFixed32(t[r])}function u(t,e){for(var r=0;r<t.length;r++)e.writeSFixed32(t[r])}function h(t,e){for(var r=0;r<t.length;r++)e.writeFixed64(t[r])}function f(t,e){for(var r=0;r<t.length;r++)e.writeSFixed64(t[r])}e.exports=n;var d=r.Buffer||t("./buffer");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;var p=Math.pow(2,63);n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,a=this.pos;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=this.buf.readUInt32LE(this.pos);return this.pos+=4,t},readSFixed32:function(){var t=this.buf.readInt32LE(this.pos);return this.pos+=4,t},readFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+4294967296*this.buf.readUInt32LE(this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=this.buf.readUInt32LE(this.pos)+4294967296*this.buf.readInt32LE(this.pos+4);return this.pos+=8,t},readFloat:function(){var t=this.buf.readFloatLE(this.pos);return this.pos+=4,t},readDouble:function(){var t=this.buf.readDoubleLE(this.pos);return this.pos+=8,t},readVarint:function(){var t,e,r=this.buf;return e=r[this.pos++],t=127&e,e<128?t:(e=r[this.pos++],t|=(127&e)<<7,e<128?t:(e=r[this.pos++],t|=(127&e)<<14,e<128?t:(e=r[this.pos++],t|=(127&e)<<21,e<128?t:function(t,e){var r,n=e.buf;if(r=n[e.pos++],t+=268435456*(127&r),r<128)return t;if(r=n[e.pos++],t+=34359738368*(127&r),r<128)return t;if(r=n[e.pos++],t+=4398046511104*(127&r),r<128)return t;if(r=n[e.pos++],t+=562949953421312*(127&r),r<128)return t;if(r=n[e.pos++],t+=72057594037927940*(127&r),r<128)return t;if(r=n[e.pos++],t+=0x8000000000000000*(127&r),r<128)return t;throw new Error("Expected varint not more than 10 bytes")}(t,this))))},readVarint64:function(){var t=this.pos,e=this.readVarint();if(e<p)return e;for(var r=this.pos-2;255===this.buf[r];)r--;r<t&&(r=t),e=0;for(var n=0;n<r-t+1;n++){var i=127&~this.buf[t+n];e+=n<4?i<<7*n:i*Math.pow(2,7*n)}return-e-1},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.buf.toString("utf8",this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.slice(this.pos,t);return this.pos=t,e},readPackedVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readVarint());return e},readPackedSVarint:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(){for(var t=this.readVarint()+this.pos,e=[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(t){var e=7&t;if(e===n.Varint)for(;this.buf[this.pos++]>127;);else if(e===n.Bytes)this.pos=this.readVarint()+this.pos;else if(e===n.Fixed32)this.pos+=4;else{if(e!==n.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;e<this.pos+t;)e*=2;if(e!==this.length){var r=new d(e);this.buf.copy(r),this.buf=r,this.length=e}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.slice(0,this.length)},writeFixed32:function(t){this.realloc(4),this.buf.writeUInt32LE(t,this.pos),this.pos+=4},writeSFixed32:function(t){this.realloc(4),this.buf.writeInt32LE(t,this.pos),this.pos+=4},writeFixed64:function(t){this.realloc(8),this.buf.writeInt32LE(-1&t,this.pos),this.buf.writeUInt32LE(Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeSFixed64:function(t){this.realloc(8),this.buf.writeInt32LE(-1&t,this.pos),this.buf.writeInt32LE(Math.floor(t*(1/4294967296)),this.pos+4),this.pos+=8},writeVarint:function(t){(t=+t)>268435455?function(t,e){e.realloc(10);for(var r=e.pos+10;t>=1;){if(e.pos>=r)throw new Error("Given varint doesn't fit into 10 bytes");var n=255&t;e.buf[e.pos++]=n|(t>=128?128:0),t/=128}}(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);var e=d.byteLength(t);this.writeVarint(e),this.realloc(e),this.buf.write(t,this.pos),this.pos+=e},writeFloat:function(t){this.realloc(4),this.buf.writeFloatLE(t,this.pos),this.pos+=4},writeDouble:function(t){this.realloc(8),this.buf.writeDoubleLE(t,this.pos),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r<e;r++)this.buf[this.pos++]=t[r]},writeRawMessage:function(t,e){this.pos++;var r=this.pos;t(e,this);var n=this.pos-r;n>=128&&function(t,e,r){var n=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.ceil(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]}(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(t,e,r){this.writeTag(t,n.Bytes),this.writeRawMessage(e,r)},writePackedVarint:function(t,e){this.writeMessage(t,i,e)},writePackedSVarint:function(t,e){this.writeMessage(t,a,e)},writePackedBoolean:function(t,e){this.writeMessage(t,l,e)},writePackedFloat:function(t,e){this.writeMessage(t,o,e)},writePackedDouble:function(t,e){this.writeMessage(t,s,e)},writePackedFixed32:function(t,e){this.writeMessage(t,c,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,u,e)},writePackedFixed64:function(t,e){this.writeMessage(t,h,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,f,e)},writeBytesField:function(t,e){this.writeTag(t,n.Bytes),this.writeBytes(e)},writeFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(t,e){this.writeTag(t,n.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(t,e){this.writeTag(t,n.Fixed64),this.writeSFixed64(e)},writeVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeVarint(e)},writeSVarintField:function(t,e){this.writeTag(t,n.Varint),this.writeSVarint(e)},writeStringField:function(t,e){this.writeTag(t,n.Bytes),this.writeString(e)},writeFloatField:function(t,e){this.writeTag(t,n.Fixed32),this.writeFloat(e)},writeDoubleField:function(t,e){this.writeTag(t,n.Fixed64),this.writeDouble(e)},writeBooleanField:function(t,e){this.writeVarintField(t,Boolean(e))}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./buffer":478}],480:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e<n){for(var r=1,a=0;a<e;++a)for(var o=0;o<a;++o)if(t[a]<t[o])r=-r;else if(t[a]===t[o])return 0;return r}var s=i.mallocUint8(e);for(a=0;a<e;++a)s[a]=0;for(r=1,a=0;a<e;++a)if(!s[a]){var l=1;for(s[a]=1,o=t[a];o!==a;o=t[o]){if(s[o])return i.freeUint8(s),0;l+=1,s[o]=1}1&l||(r=-r)}return i.freeUint8(s),r};var n=32,i=t("typedarray-pool")},{"typedarray-pool":550}],481:[function(t,e,r){"use strict";var n=t("typedarray-pool"),i=t("invert-permutation");r.rank=function(t){var e=t.length;switch(e){case 0:case 1:return 0;case 2:return t[1]}var r,a,o,s=n.mallocUint32(e),l=n.mallocUint32(e),c=0;for(i(t,l),o=0;o<e;++o)s[o]=t[o];for(o=e-1;o>0;--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;a<t;++a)r[a]=a,o=o*a|0;for(a=t-1;a>0;--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":293,"typedarray-pool":550}],482:[function(t,e,r){"use strict";e.exports=function(t,e){function r(t,e){var r=c[e][t[e]];r.splice(r.indexOf(t),1)}function i(t,i,a){for(var o,s,l,u=0;u<2;++u)if(c[u][i].length>0){o=c[u][i][0],l=u;break}s=o[1^l];for(var h=0;h<2;++h)for(var f=c[h][i],d=0;d<f.length;++d){var p=f[d],m=p[1^h];n(e[t],e[i],e[s],e[m])>0&&(o=p,s=m,l=h)}return a?s:(o&&r(o,l),s)}function a(t,a){var o=c[a][t][0],s=[t];r(o,a);for(var l=o[1^a];;){for(;l!==t;)s.push(l),l=i(s[s.length-2],l,!1);if(c[0][t].length+c[1][t].length===0)break;var u=s[s.length-1],h=t,f=s[1],d=i(u,h,!0);if(n(e[u],e[h],e[f],e[d])<0)break;s.push(t),l=i(u,h)}return s}function o(t,e){return e[1]===e[e.length-1]}for(var s=0|e.length,l=t.length,c=[new Array(s),new Array(s)],u=0;u<s;++u)c[0][u]=[],c[1][u]=[];for(u=0;u<l;++u){var h=t[u];c[0][h[0]].push(h),c[1][h[1]].push(h)}var f=[];for(u=0;u<s;++u)c[0][u].length+c[1][u].length===0&&f.push([u]);for(u=0;u<s;++u)for(var d=0;d<2;++d){for(var p=[];c[d][u].length>0;){c[0][u].length;var m=a(u,d);o(0,m)?p.push.apply(p,m):(p.length>0&&f.push(p),p=m)}p.length>0&&f.push(p)}return f};var n=t("compare-angle")},{"compare-angle":101}],483:[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;s<e.length;++s){var l=r[s].length;a[s]=l,i[s]=!0,l<=1&&o.push(s)}for(;o.length>0;){i[d=o.pop()]=!1;var c=r[d];for(s=0;s<c.length;++s){var u=c[s];0==--a[u]&&o.push(u)}}var h=new Array(e.length),f=[];for(s=0;s<e.length;++s)if(i[s]){var d=f.length;h[s]=d,f.push(e[s])}else h[s]=-1;var p=[];for(s=0;s<t.length;++s){var m=t[s];i[m[0]]&&i[m[1]]&&p.push([h[m[0]],h[m[1]]])}return[p,f]};var n=t("edges-to-adjacency-list")},{"edges-to-adjacency-list":128}],484:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t),n=0;n<t;++n)r[n]=e;return r}e.exports=function(t,e){function r(t){for(var e=t.length,r=0;r<e;++r)if(!C[t[r]])return!1;return!0}t=(R=u(t,e))[0];for(var h=(e=R[1]).length,f=(t.length,i(t,e.length)),d=0;d<h;++d)if(f[d].length%2==1)throw new Error("planar-graph-to-polyline: graph must be manifold");var p=a(t,e),m=(p=p.filter(function(t){for(var r=t.length,n=[0],i=0;i<r;++i){var a=e[t[i]],o=e[t[(i+1)%r]],c=s(-a[0],a[1]),u=s(-a[0],o[1]),h=s(o[0],a[1]),f=s(o[0],o[1]);n=l(n,l(l(c,u),l(h,f)))}return n[n.length-1]>0})).length,g=new Array(m),v=new Array(m);for(d=0;d<m;++d){g[d]=d;var y=new Array(m),b=p[d].map(function(t){return e[t]}),x=o([b]),_=0;t:for(var w=0;w<m;++w)if(y[w]=0,d!==w){for(var M=(q=p[w]).length,k=0;k<M;++k){var T=x(e[q[k]]);if(0!==T){T<0&&(y[w]=1,_+=1);continue t}}y[w]=1,_+=1}v[d]=[_,d,y]}for(v.sort(function(t,e){return e[0]-t[0]}),d=0;d<m;++d){var A=(y=v[d])[1],S=y[2];for(w=0;w<m;++w)S[w]&&(g[w]=A)}var E=function(t){for(var e=new Array(t),r=0;r<t;++r)e[r]=[];return e}(m);for(d=0;d<m;++d)E[d].push(g[d]),E[g[d]].push(d);var L={},C=n(h,!1);for(d=0;d<m;++d)for(M=(q=p[d]).length,w=0;w<M;++w){var I=q[w],P=q[(w+1)%M],D=Math.min(I,P)+":"+Math.max(I,P);if(D in L){var z=L[D];E[z].push(d),E[d].push(z),C[I]=C[P]=!0}else L[D]=d}var O=[],F=n(m,-1);for(d=0;d<m;++d)g[d]!==d||r(p[d])?F[d]=-1:(O.push(d),F[d]=0);for(var R=[];O.length>0;){var j=O.pop(),N=E[j];c(N,function(t,e){return t-e});var B,U=N.length,V=F[j];for(0===V&&(B=[q=p[j]]),d=0;d<U;++d){var H=N[d];if(!(F[H]>=0)&&(F[H]=1^V,O.push(H),0===V)){var q;r(q=p[H])||(q.reverse(),B.push(q))}}0===V&&R.push(B)}return R};var i=t("edges-to-adjacency-list"),a=t("planar-dual"),o=t("point-in-big-polygon"),s=t("two-product"),l=t("robust-sum"),c=t("uniq"),u=t("./lib/trim-leaves")},{"./lib/trim-leaves":483,"edges-to-adjacency-list":128,"planar-dual":482,"point-in-big-polygon":486,"robust-sum":522,"two-product":548,uniq:552}],485:[function(t,e,r){"use strict";function n(t,e){this.x=t,this.y=e}e.exports=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(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)},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[0]*this.x+t[1]*this.y,r=t[2]*this.x+t[3]*this.y;return this.x=e,this.y=r,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},_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=e*this.x-r*this.y,i=r*this.x+e*this.y;return this.x=n,this.y=i,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t}},{}],486:[function(t,e,r){function n(){return!0}function i(t){for(var e={},r=0;r<t.length;++r){var i=t[r],a=i[0][0],o=i[0][1],s=i[1][1],c=[Math.min(o,s),Math.max(o,s)];a in e?e[a].push(c):e[a]=[c]}var u={},h=Object.keys(e);for(r=0;r<h.length;++r){var f=e[h[r]];u[h[r]]=l(f)}return function(t){return function(e,r){var i=t[e];return!!i&&!!i.queryPoint(r,n)}}(u)}function a(t){return 1}e.exports=function(t){for(var e=t.length,r=[],n=[],l=0;l<e;++l)for(var u=t[l],h=u.length,f=h-1,d=0;d<h;f=d++){var p=u[f],m=u[d];p[0]===m[0]?n.push([p,m]):r.push([p,m])}if(0===r.length)return 0===n.length?a:function(t){return function(e){return t(e[0],e[1])?0:1}}(i(n));var g=s(r),v=function(t,e){return function(r){var n=c.le(e,r[0]);if(n<0)return 1;var i=t[n];if(!i){if(!(n>0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var s=i.key,l=o(r,s[0],s[1]);if(s[0][0]<s[1][0])if(l<0)i=i.left;else{if(!(l>0))return 0;a=-1,i=i.right}else if(l>0)i=i.left;else{if(!(l<0))return 0;a=1,i=i.right}}return a}}(g.slabs,g.coordinates);return 0===n.length?v:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(i(n),v)};var o=t("robust-orientation")[3],s=t("slab-decomposition"),l=t("interval-tree-1d"),c=t("binary-search-bounds")},{"binary-search-bounds":67,"interval-tree-1d":292,"robust-orientation":517,"slab-decomposition":534}],487:[function(t,e,r){function n(t,e,r){var n=i.segments(t),a=i.segments(e),o=r(i.combine(n,a));return i.polygon(o)}var i,a=t("./lib/build-log"),o=t("./lib/epsilon"),s=t("./lib/intersecter"),l=t("./lib/segment-chainer"),c=t("./lib/segment-selector"),u=t("./lib/geojson"),h=!1,f=o();i={buildLog:function(t){return!0===t?h=a():!1===t&&(h=!1),!1!==h&&h.list},epsilon:function(t){return f.epsilon(t)},segments:function(t){var e=s(!0,f,h);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:s(!1,f,h).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:c.union(t.combined,h),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:c.intersect(t.combined,h),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:c.difference(t.combined,h),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:c.differenceRev(t.combined,h),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:c.xor(t.combined,h),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:l(t.segments,f,h),inverted:t.inverted}},polygonFromGeoJSON:function(t){return u.toPolygon(i,t)},polygonToGeoJSON:function(t){return u.fromPolygon(i,f,t)},union:function(t,e){return n(t,e,i.selectUnion)},intersect:function(t,e){return n(t,e,i.selectIntersect)},difference:function(t,e){return n(t,e,i.selectDifference)},differenceRev:function(t,e){return n(t,e,i.selectDifferenceRev)},xor:function(t,e){return n(t,e,i.selectXor)}},"object"==typeof window&&(window.PolyBool=i),e.exports=i},{"./lib/build-log":488,"./lib/epsilon":489,"./lib/geojson":490,"./lib/intersecter":491,"./lib/segment-chainer":493,"./lib/segment-selector":494}],488:[function(t,e,r){e.exports=function(){function t(t,r){return e.list.push({type:t,data:r?JSON.parse(JSON.stringify(r)):void 0}),e}var e,r=0,n=!1;return e={list:[],segmentId:function(){return r++},checkIntersection:function(e,r){return t("check",{seg1:e,seg2:r})},segmentChop:function(e,r){return t("div_seg",{seg:e,pt:r}),t("chop",{seg:e,pt:r})},statusRemove:function(e){return t("pop_seg",{seg:e})},segmentUpdate:function(e){return t("seg_update",{seg:e})},segmentNew:function(e,r){return t("new_seg",{seg:e,primary:r})},segmentRemove:function(e){return t("rem_seg",{seg:e})},tempStatus:function(e,r,n){return t("temp_status",{seg:e,above:r,below:n})},rewind:function(e){return t("rewind",{seg:e})},status:function(e,r,n){return t("status",{seg:e,above:r,below:n})},vert:function(r){return r===n?e:(n=r,t("vert",{x:r}))},log:function(e){return"string"!=typeof e&&(e=JSON.stringify(e,!1," ")),t("log",{txt:e})},reset:function(){return t("reset")},selected:function(e){return t("selected",{segs:e})},chainStart:function(e){return t("chain_start",{seg:e})},chainRemoveHead:function(e,r){return t("chain_rem_head",{index:e,pt:r})},chainRemoveTail:function(e,r){return t("chain_rem_tail",{index:e,pt:r})},chainNew:function(e,r){return t("chain_new",{pt1:e,pt2:r})},chainMatch:function(e){return t("chain_match",{index:e})},chainClose:function(e){return t("chain_close",{index:e})},chainAddHead:function(e,r){return t("chain_add_head",{index:e,pt:r})},chainAddTail:function(e,r){return t("chain_add_tail",{index:e,pt:r})},chainConnect:function(e,r){return t("chain_con",{index1:e,index2:r})},chainReverse:function(e){return t("chain_rev",{index:e})},chainJoin:function(e,r){return t("chain_join",{index1:e,index2:r})},done:function(){return t("done")}}}},{}],489:[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)&&!(l-(a*a+s*s)>-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])<t},pointsSameY:function(e,r){return Math.abs(e[1]-r[1])<t},pointsSame:function(t,r){return e.pointsSameX(t,r)&&e.pointsSameY(t,r)},pointsCompare:function(t,r){return e.pointsSameX(t,r)?e.pointsSameY(t,r)?0:t[1]<r[1]?-1:1:t[0]<r[0]?-1:1},pointsCollinear:function(e,r,n){var i=e[0]-r[0],a=e[1]-r[1],o=r[0]-n[0],s=r[1]-n[1];return Math.abs(i*s-o*a)<t},linesIntersect:function(e,r,n,i){var a=r[0]-e[0],o=r[1]-e[1],s=i[0]-n[0],l=i[1]-n[1],c=a*l-o*s;if(Math.abs(c)<t)return!1;var u=e[0]-n[0],h=e[1]-n[1],f=(s*h-l*u)/c,d=(a*h-o*u)/c,p={alongA:0,alongB:0,pt:[e[0]+f*a,e[1]+f*o]};return p.alongA=f<=-t?-2:f<t?-1:f-1<=-t?0:f-1<t?1:2,p.alongB=d<=-t?-2:d<t?-1:d-1<=-t?0:d-1<t?1:2,p},pointInsideRegion:function(e,r){for(var n=e[0],i=e[1],a=r[r.length-1][0],o=r[r.length-1][1],s=!1,l=0;l<r.length;l++){var c=r[l][0],u=r[l][1];u-i>t!=o-i>t&&(a-c)*(i-u)/(o-u)+c-n>t&&(s=!s),a=c,o=u}return s}};return e}},{}],490:[function(t,e,r){var n={toPolygon:function(t,e){function r(e){function r(e){var r=e.slice(0,e.length-1);return t.segments({inverted:!1,regions:[r]})}if(e.length<=0)return t.segments({inverted:!1,regions:[]});for(var n=r(e[0]),i=1;i<e.length;i++)n=t.selectDifference(t.combine(n,r(e[i])));return n}if("Polygon"===e.type)return t.polygon(r(e.coordinates));if("MultiPolygon"===e.type){for(var n=t.segments({inverted:!1,regions:[]}),i=0;i<e.coordinates.length;i++)n=t.selectUnion(t.combine(n,r(e.coordinates[i])));return t.polygon(n)}throw new Error("PolyBool: Cannot convert GeoJSON object to PolyBool polygon")},fromPolygon:function(t,e,r){function n(t,r){return e.pointInsideRegion([.5*(t[0][0]+t[1][0]),.5*(t[0][1]+t[1][1])],r)}function i(t){return{region:t,children:[]}}function a(t,e){for(var r=0;r<t.children.length;r++){if(n(e,(s=t.children[r]).region))return void a(s,e)}var o=i(e);for(r=0;r<t.children.length;r++){var s;n((s=t.children[r]).region,e)&&(o.children.push(s),t.children.splice(r,1),r--)}t.children.push(o)}function o(t,e){for(var r=0,n=t[t.length-1][0],i=t[t.length-1][1],a=[],o=0;o<t.length;o++){var s=t[o][0],l=t[o][1];a.push([s,l]),r+=l*n-s*i,n=s,i=l}return r<0!==e&&a.reverse(),a.push([a[0][0],a[0][1]]),a}function s(t){var e=[o(t.region,!1)];h.push(e);for(var r=0;r<t.children.length;r++)e.push(function(t){for(var e=0;e<t.children.length;e++)s(t.children[e]);return o(t.region,!0)}(t.children[r]))}r=t.polygon(t.segments(r));for(var l=i(null),c=0;c<r.regions.length;c++){var u=r.regions[c];u.length<3||a(l,u)}var h=[];for(c=0;c<l.children.length;c++)s(l.children[c]);return h.length<=0?{type:"Polygon",coordinates:[]}:1==h.length?{type:"Polygon",coordinates:h[0]}:{type:"MultiPolygon",coordinates:h}}};e.exports=n},{}],491:[function(t,e,r){var n=t("./linked-list");e.exports=function(t,e,r){function i(t,e){return{id:r?r.segmentId():-1,start:t,end:e,myFill:{above:null,below:null},otherFill:null}}function a(t,e,n){return{id:r?r.segmentId():-1,start:t,end:e,myFill:{above:n.myFill.above,below:n.myFill.below},otherFill:null}}function o(t,r){u.insertBefore(t,function(n){return function(t,r,n,i,a,o){var s=e.pointsCompare(r,a);return 0!==s?s:e.pointsSame(n,o)?0:t!==i?t?1:-1:e.pointAboveOrOnLine(n,i?a:o,i?o:a)?1:-1}(t.isStart,t.pt,r,n.isStart,n.pt,n.other.pt)<0})}function s(t,e){var r=function(t,e){var r=n.node({isStart:!0,pt:t.start,seg:t,primary:e,other:null,status:null});return o(r,t.end),r}(t,e);return function(t,e,r){var i=n.node({isStart:!1,pt:e.end,seg:e,primary:r,other:t,status:null});t.other=i,o(i,t.pt)}(r,t,e),r}function l(t,e){var n=a(e,t.seg.end,t.seg);return function(t,e){r&&r.segmentChop(t.seg,e),t.other.remove(),t.seg.end=e,t.other.pt=e,o(t.other,t.pt)}(t,e),s(n,t.primary)}function c(i,a){function o(t){return c.findTransition(function(r){return function(t,r){var n=t.seg.start,i=t.seg.end,a=r.seg.start,o=r.seg.end;return e.pointsCollinear(n,a,o)?e.pointsCollinear(i,a,o)?1:e.pointAboveOrOnLine(i,a,o)?1:-1:e.pointAboveOrOnLine(n,a,o)?1:-1}(t,r.ev)>0})}function s(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 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),d=e.pointsSame(s,u);if(f&&d)return n;var p=!f&&e.pointBetween(o,c,u),m=!d&&e.pointBetween(s,c,u);if(f)return m?l(n,s):l(t,u),n;p&&(d||(m?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 c=n.create(),h=[];!u.isEmpty();){var f=u.getHead();if(r&&r.vert(f.pt[0]),f.isStart){r&&r.segmentNew(f.seg,f.primary);var d=o(f),p=d.before?d.before.ev:null,m=d.after?d.after.ev:null;r&&r.tempStatus(f.seg,!!p&&p.seg,!!m&&m.seg);var g=function(){if(p){var t=s(f,p);if(t)return t}return!!m&&s(f,m)}();if(g&&(t?(v=null===f.seg.myFill.below||f.seg.myFill.above!==f.seg.myFill.below)&&(g.seg.myFill.above=!g.seg.myFill.above):g.seg.otherFill=f.seg.myFill,r&&r.segmentUpdate(g.seg),f.other.remove(),f.remove()),u.getHead()!==f){r&&r.rewind(f.seg);continue}if(t){var v;v=null===f.seg.myFill.below||f.seg.myFill.above!==f.seg.myFill.below,f.seg.myFill.below=m?m.seg.myFill.above:i,f.seg.myFill.above=v?!f.seg.myFill.below:f.seg.myFill.below}else if(null===f.seg.otherFill){var y;y=m?f.primary===m.primary?m.seg.otherFill.above:m.seg.myFill.above:f.primary?a:i,f.seg.otherFill={above:y,below:y}}r&&r.status(f.seg,!!p&&p.seg,!!m&&m.seg),f.other.status=d.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(c.exists(b.prev)&&c.exists(b.next)&&s(b.prev.ev,b.next.ev),r&&r.statusRemove(b.ev.seg),b.remove(),!f.primary){var x=f.seg.myFill;f.seg.myFill=f.seg.otherFill,f.seg.otherFill=x}h.push(f.seg)}u.getHead().remove()}return r&&r.done(),h}var u=n.create();return t?{addRegion:function(t){for(var r,n=t[t.length-1],a=0;a<t.length;a++){r=n,n=t[a];var o=e.pointsCompare(r,n);0!==o&&s(i(o<0?r:n,o<0?n:r),!0)}},calculate:function(t){return c(t,!1)}}:{calculate:function(t,e,r,n){return t.forEach(function(t){s(a(t.start,t.end,t),!0)}),r.forEach(function(t){s(a(t.start,t.end,t),!1)}),c(e,n)}}}},{"./linked-list":492}],492:[function(t,e,r){e.exports={create:function(){var t={root:{root:!0,next:null},exists:function(e){return null!==e&&e!==t.root},isEmpty:function(){return null===t.root.next},getHead:function(){return t.root.next},insertBefore:function(e,r){for(var n=t.root,i=t.root.next;null!==i;){if(r(i))return e.prev=i.prev,e.next=i,i.prev.next=e,void(i.prev=e);n=i,i=i.next}n.next=e,e.prev=n,e.next=null},findTransition:function(e){for(var r=t.root,n=t.root.next;null!==n&&!e(n);)r=n,n=n.next;return{before:r===t.root?null:r,after:n,insert:function(t){return t.prev=r,t.next=n,r.next=t,null!==n&&(n.prev=t),t}}}};return t},node:function(t){return t.prev=null,t.next=null,t.remove=function(){t.prev.next=t.next,t.next&&(t.next.prev=t.prev),t.prev=null,t.next=null},t}}},{}],493:[function(t,e,r){e.exports=function(t,e,r){var n=[],i=[];return t.forEach(function(t){function a(t,e,r){return f.index=t,f.matches_head=e,f.matches_pt1=r,f===u?(f=h,!1):(f=null,!0)}function o(t){r&&r.chainReverse(t),n[t].reverse()}function s(t,i){var a=n[t],o=n[i],s=a[a.length-1],l=a[a.length-2],c=o[0],u=o[1];e.pointsCollinear(l,s,c)&&(r&&r.chainRemoveTail(t,s),a.pop(),s=l),e.pointsCollinear(s,c,u)&&(r&&r.chainRemoveHead(i,c),o.shift()),r&&r.chainJoin(t,i),n[t]=a.concat(o),n.splice(i,1)}var l=t.start,c=t.end;if(e.pointsSame(l,c))console.warn("PolyBool: Warning: Zero-length segment detected; your epsilon is probably too small or too large");else{r&&r.chainStart(t);for(var u={index:0,matches_head:!1,matches_pt1:!1},h={index:0,matches_head:!1,matches_pt1:!1},f=u,d=0;d<n.length;d++){var p=(b=n[d])[0],m=(b[1],b[b.length-1]);if(b[b.length-2],e.pointsSame(p,l)){if(a(d,!0,!0))break}else if(e.pointsSame(p,c)){if(a(d,!0,!1))break}else if(e.pointsSame(m,l)){if(a(d,!1,!0))break}else if(e.pointsSame(m,c)&&a(d,!1,!1))break}if(f===u)return n.push([l,c]),void(r&&r.chainNew(l,c));if(f===h){r&&r.chainMatch(u.index);var g=u.index,v=u.matches_pt1?c:l,y=u.matches_head,b=n[g],x=y?b[0]:b[b.length-1],_=y?b[1]:b[b.length-2],w=y?b[b.length-1]:b[0],M=y?b[b.length-2]:b[1];return e.pointsCollinear(_,x,v)&&(y?(r&&r.chainRemoveHead(u.index,v),b.shift()):(r&&r.chainRemoveTail(u.index,v),b.pop()),x=_),e.pointsSame(w,v)?(n.splice(g,1),e.pointsCollinear(M,w,x)&&(y?(r&&r.chainRemoveTail(u.index,x),b.pop()):(r&&r.chainRemoveHead(u.index,x),b.shift())),r&&r.chainClose(u.index),void i.push(b)):void(y?(r&&r.chainAddHead(u.index,v),b.unshift(v)):(r&&r.chainAddTail(u.index,v),b.push(v)))}var k=u.index,T=h.index;r&&r.chainConnect(k,T);var A=n[k].length<n[T].length;u.matches_head?h.matches_head?A?(o(k),s(k,T)):(o(T),s(T,k)):s(T,k):h.matches_head?s(k,T):A?(o(k),s(T,k)):(o(T),s(k,T))}}),i}},{}],494:[function(t,e,r){function n(t,e,r){var n=[];return t.forEach(function(t){var i=(t.myFill.above?8:0)+(t.myFill.below?4:0)+(t.otherFill&&t.otherFill.above?2:0)+(t.otherFill&&t.otherFill.below?1:0);0!==e[i]&&n.push({id:r?r.segmentId():-1,start:t.start,end:t.end,myFill:{above:1===e[i],below:2===e[i]},otherFill:null})}),r&&r.selected(n),n}var i={union:function(t,e){return n(t,[0,2,1,0,2,2,0,0,1,0,1,0,0,0,0,0],e)},intersect:function(t,e){return n(t,[0,0,0,0,0,2,0,2,0,0,1,1,0,2,1,0],e)},difference:function(t,e){return n(t,[0,0,0,0,2,0,2,0,1,1,0,0,0,1,2,0],e)},differenceRev:function(t,e){return n(t,[0,2,1,0,0,0,1,1,0,2,0,2,0,0,0,0],e)},xor:function(t,e){return n(t,[0,2,1,0,2,0,0,1,1,0,0,2,0,1,2,0],e)}};e.exports=i},{}],495:[function(t,e,r){"use strict";var n=new Float64Array(4),i=new Float64Array(4),a=new Float64Array(4);e.exports=function(t,e,r,o,s){n.length<o.length&&(n=new Float64Array(o.length),i=new Float64Array(o.length),a=new Float64Array(o.length));for(var l=0;l<o.length;++l)n[l]=t[l]-o[l],i[l]=e[l]-t[l],a[l]=r[l]-t[l];var c=0,u=0,h=0,f=0,d=0,p=0;for(l=0;l<o.length;++l){var m=i[l],g=a[l],v=n[l];c+=m*m,u+=m*g,h+=g*g,f+=v*m,d+=v*g,p+=v*v}var y,b=Math.abs(c*h-u*u),x=u*d-h*f,_=u*f-c*d;if(x+_<=b)if(x<0)_<0&&f<0?(_=0,-f>=c?(x=1,y=c+2*f+p):y=f*(x=-f/c)+p):(x=0,d>=0?(_=0,y=p):-d>=h?(_=1,y=h+2*d+p):y=d*(_=-d/h)+p);else if(_<0)_=0,f>=0?(x=0,y=p):-f>=c?(x=1,y=c+2*f+p):y=f*(x=-f/c)+p;else{var w=1/b;y=(x*=w)*(c*x+u*(_*=w)+2*f)+_*(u*x+h*_+2*d)+p}else{var M,k,T,A;x<0?(k=h+d)>(M=u+f)?(T=k-M)>=(A=c-2*u+h)?(x=1,_=0,y=c+2*f+p):y=(x=T/A)*(c*x+u*(_=1-x)+2*f)+_*(u*x+h*_+2*d)+p:(x=0,k<=0?(_=1,y=h+2*d+p):d>=0?(_=0,y=p):y=d*(_=-d/h)+p):_<0?(k=c+f)>(M=u+d)?(T=k-M)>=(A=c-2*u+h)?(_=1,x=0,y=h+2*d+p):y=(x=1-(_=T/A))*(c*x+u*_+2*f)+_*(u*x+h*_+2*d)+p:(_=0,k<=0?(x=1,y=c+2*f+p):f>=0?(x=0,y=p):y=f*(x=-f/c)+p):(T=h+d-u-f)<=0?(x=0,_=1,y=h+2*d+p):T>=(A=c-2*u+h)?(x=1,_=0,y=c+2*f+p):y=(x=T/A)*(c*x+u*(_=1-x)+2*f)+_*(u*x+h*_+2*d)+p}var S=1-x-_;for(l=0;l<o.length;++l)s[l]=S*t[l]+x*e[l]+_*r[l];return y<0?0:y}},{}],496:[function(t,e,r){function n(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function a(t){if(u===setTimeout)return setTimeout(t,0);if((u===n||!u)&&setTimeout)return u=setTimeout,setTimeout(t,0);try{return u(t,0)}catch(e){try{return u.call(null,t,0)}catch(e){return u.call(this,t,0)}}}function o(){m&&d&&(m=!1,d.length?p=d.concat(p):g=-1,p.length&&s())}function s(){if(!m){var t=a(o);m=!0;for(var e=p.length;e;){for(d=p,p=[];++g<e;)d&&d[g].run();g=-1,e=p.length}d=null,m=!1,function(t){if(h===clearTimeout)return clearTimeout(t);if((h===i||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}(t)}}function l(t,e){this.fun=t,this.array=e}function c(){}var u,h,f=e.exports={};!function(){try{u="function"==typeof setTimeout?setTimeout:n}catch(t){u=n}try{h="function"==typeof clearTimeout?clearTimeout:i}catch(t){h=i}}();var d,p=[],m=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];p.push(new l(t,e)),1!==p.length||m||a(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,f.prependListener=c,f.prependOnceListener=c,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},{}],497:[function(t,e,r){(function(t){!function(n){function i(t){throw new RangeError(I[t])}function a(t,e){for(var r=t.length,n=[];r--;)n[r]=e(t[r]);return n}function o(t,e){var r=t.split("@"),n="";r.length>1&&(n=r[0]+"@",t=r[1]);return n+a((t=t.replace(C,".")).split("."),e).join(".")}function s(t){for(var e,r,n=[],i=0,a=t.length;i<a;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<a?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function l(t){return a(t,function(t){var e="";return t>65535&&(e+=z((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=z(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:x}function u(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function h(t,e,r){var n=0;for(t=r?D(t/k):t>>1,t+=D(t/e);t>P*w>>1;n+=x)t=D(t/P);return D(n+(P+1)*t/(t+M))}function f(t){var e,r,n,a,o,s,u,f,d,p,m=[],g=t.length,v=0,y=A,M=T;for((r=t.lastIndexOf(S))<0&&(r=0),n=0;n<r;++n)t.charCodeAt(n)>=128&&i("not-basic"),m.push(t.charCodeAt(n));for(a=r>0?r+1:0;a<g;){for(o=v,s=1,u=x;a>=g&&i("invalid-input"),((f=c(t.charCodeAt(a++)))>=x||f>D((b-v)/s))&&i("overflow"),v+=f*s,d=u<=M?_:u>=M+w?w:u-M,!(f<d);u+=x)s>D(b/(p=x-d))&&i("overflow"),s*=p;M=h(v-o,e=m.length+1,0==o),D(v/e)>b-y&&i("overflow"),y+=D(v/e),v%=e,m.splice(v++,0,y)}return l(m)}function d(t){var e,r,n,a,o,l,c,f,d,p,m,g,v,y,M,k=[];for(g=(t=s(t)).length,e=A,r=0,o=T,l=0;l<g;++l)(m=t[l])<128&&k.push(z(m));for(n=a=k.length,a&&k.push(S);n<g;){for(c=b,l=0;l<g;++l)(m=t[l])>=e&&m<c&&(c=m);for(c-e>D((b-r)/(v=n+1))&&i("overflow"),r+=(c-e)*v,e=c,l=0;l<g;++l)if((m=t[l])<e&&++r>b&&i("overflow"),m==e){for(f=r,d=x;p=d<=o?_:d>=o+w?w:d-o,!(f<p);d+=x)M=f-p,y=x-p,k.push(z(u(p+M%y,0))),f=D(M/y);k.push(z(u(f,0))),o=h(r,v,n==a),r=0,++n}++r,++e}return k.join("")}var p="object"==typeof r&&r&&!r.nodeType&&r,m="object"==typeof e&&e&&!e.nodeType&&e,g="object"==typeof t&&t;g.global!==g&&g.window!==g&&g.self!==g||(n=g);var v,y,b=2147483647,x=36,_=1,w=26,M=38,k=700,T=72,A=128,S="-",E=/^xn--/,L=/[^\x20-\x7E]/,C=/[\x2E\u3002\uFF0E\uFF61]/g,I={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},P=x-_,D=Math.floor,z=String.fromCharCode;if(v={version:"1.4.1",ucs2:{decode:s,encode:l},decode:f,encode:d,toASCII:function(t){return o(t,function(t){return L.test(t)?"xn--"+d(t):t})},toUnicode:function(t){return o(t,function(t){return E.test(t)?f(t.slice(4).toLowerCase()):t})}},p&&m)if(e.exports==p)m.exports=v;else for(y in v)v.hasOwnProperty(y)&&(p[y]=v[y]);else n.punycode=v}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],498:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":232}],499:[function(t,e,r){"use strict";function n(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,r,a){e=e||"&",r=r||"=";var o={};if("string"!=typeof t||0===t.length)return o;var s=/\+/g;t=t.split(e);var l=1e3;a&&"number"==typeof a.maxKeys&&(l=a.maxKeys);var c=t.length;l>0&&c>l&&(c=l);for(var u=0;u<c;++u){var h,f,d,p,m=t[u].replace(s,"%20"),g=m.indexOf(r);g>=0?(h=m.substr(0,g),f=m.substr(g+1)):(h=m,f=""),d=decodeURIComponent(h),p=decodeURIComponent(f),n(o,d)?i(o[d])?o[d].push(p):o[d]=[o[d],p]:o[d]=p}return o};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],500:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;n<t.length;n++)r.push(e(t[n],n));return r}var i=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,r,s){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?n(o(t),function(o){var s=encodeURIComponent(i(o))+r;return a(t[o])?n(t[o],function(t){return s+encodeURIComponent(i(t))}).join(e):s+encodeURIComponent(i(t[o]))}).join(e):s?encodeURIComponent(i(s))+r+encodeURIComponent(i(t)):""};var a=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o=Object.keys||function(t){var e=[];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.push(r);return e}},{}],501:[function(t,e,r){"use strict";r.decode=r.parse=t("./decode"),r.encode=r.stringify=t("./encode")},{"./decode":499,"./encode":500}],502:[function(t,e,r){"use strict";function n(t,e,r,a,o){for(r=r||0,a=a||t.length-1,o=o||function(t,e){return t<e?-1:t>e?1:0};a>r;){if(a-r>600){var s=a-r+1,l=e-r+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);n(t,e,Math.max(r,Math.floor(e-l*u/s+h)),Math.min(a,Math.floor(e+(s-l)*u/s+h)),o)}var f=t[e],d=r,p=a;for(i(t,r,e),o(t[a],f)>0&&i(t,r,a);d<p;){for(i(t,d,p),d++,p--;o(t[d],f)<0;)d++;for(;o(t[p],f)>0;)p--}0===o(t[r],f)?i(t,r,p):i(t,++p,a),p<=e&&(r=p+1),e<=p&&(a=p-1)}}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n},{}],503:[function(t,e,r){"use strict";var n=t("big-rat/add");e.exports=function(t,e){for(var r=t.length,i=new Array(r),a=0;a<r;++a)i[a]=n(t[a],e[a]);return i}},{"big-rat/add":51}],504:[function(t,e,r){"use strict";e.exports=function(t){for(var e=new Array(t.length),r=0;r<t.length;++r)e[r]=n(t[r]);return e};var n=t("big-rat")},{"big-rat":54}],505:[function(t,e,r){"use strict";var n=t("big-rat"),i=t("big-rat/mul");e.exports=function(t,e){for(var r=n(e),a=t.length,o=new Array(a),s=0;s<a;++s)o[s]=i(t[s],r);return o}},{"big-rat":54,"big-rat/mul":63}],506:[function(t,e,r){"use strict";var n=t("big-rat/sub");e.exports=function(t,e){for(var r=t.length,i=new Array(r),a=0;a<r;++a)i[a]=n(t[a],e[a]);return i}},{"big-rat/sub":65}],507:[function(t,e,r){"use strict";var n=t("compare-cell"),i=t("compare-oriented-cell"),a=t("cell-orientation");e.exports=function(t){t.sort(i);for(var e=t.length,r=0,o=0;o<e;++o){var s=t[o],l=a(s);if(0!==l){if(r>0){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":86,"compare-cell":102,"compare-oriented-cell":103}],508:[function(t,e,r){!function(t,n){"object"==typeof r&&void 0!==e?e.exports=n():t.createREGL=n()}(this,function(){"use strict";function t(t){return"undefined"!=typeof btoa?btoa(t):"base64:"+t}function e(t){var e=new Error("(regl) "+t);throw console.error(e),e}function r(t,r){t||e(r)}function n(t){return t?": "+t:""}function i(t,r,i){r.indexOf(t)<0&&e("invalid value"+n(i)+". must be one of: "+r)}function a(t,e){for(t+="";t.length<e;)t=" "+t;return t}function o(){this.name="unknown",this.lines=[],this.index={},this.hasErrors=!1}function s(t,e){this.number=t,this.line=e,this.errors=[]}function l(t,e,r){this.file=t,this.line=e,this.message=r}function c(){var t=new Error,e=(t.stack||t).toString(),r=/compileProcedure.*\n\s*at.*\((.*)\)/.exec(e);if(r)return r[1];var n=/compileProcedure.*\n\s*at\s+(.*)(\n|$)/.exec(e);return n?n[1]:"unknown"}function u(){var t=new Error,e=(t.stack||t).toString(),r=/at REGLCommand.*\n\s+at.*\((.*)\)/.exec(e);if(r)return r[1];var n=/at REGLCommand.*\n\s+at\s+(.*)\n/.exec(e);return n?n[1]:"unknown"}function h(e,r){var n=e.split("\n"),i=1,a=0,l={unknown:new o,0:new o};l.unknown.name=l[0].name=r||c(),l.unknown.lines.push(new s(0,""));for(var u=0;u<n.length;++u){var h=n[u],f=/^\s*\#\s*(\w+)\s+(.+)\s*$/.exec(h);if(f)switch(f[1]){case"line":var d=/(\d+)(\s+\d+)?/.exec(f[2]);d&&(i=0|d[1],d[2]&&((a=0|d[2])in l||(l[a]=new o)));break;case"define":var p=/SHADER_NAME(_B64)?\s+(.*)$/.exec(f[2]);p&&(l[a].name=p[1]?t(p[2]):p[2])}l[a].lines.push(new s(i++,h))}return Object.keys(l).forEach(function(t){var e=l[t];e.lines.forEach(function(t){e.index[t.number]=t})}),l}function f(t){t._commandRef=c()}function d(t,r){var n=u();e(t+" in command "+(r||c())+("unknown"===n?"":" called from "+n))}function p(t,e,r,i){typeof t!==e&&d("invalid parameter type"+n(r)+". expected "+e+", got "+typeof t,i||c())}function m(t,e){return t===bt||t===yt||t===xt?2:t===_t?4:wt[t]*e}function g(t){return!(t&t-1||!t)}function v(t,e){this.id=kt++,this.type=t,this.data=e}function y(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function b(t){if(0===t.length)return[];var e=t.charAt(0),r=t.charAt(t.length-1);if(t.length>1&&e===r&&('"'===e||"'"===e))return['"'+y(t.substr(1,t.length-2))+'"'];var n=/\[(false|true|null|\d+|'[^']*'|"[^"]*")\]/.exec(t);if(n)return b(t.substr(0,n.index)).concat(b(n[1])).concat(b(t.substr(n.index+n[0].length)));var i=t.split(".");if(1===i.length)return['"'+y(t)+'"'];for(var a=[],o=0;o<i.length;++o)a=a.concat(b(i[o]));return a}function x(t){return"["+b(t).join("][")+"]"}function _(t){return"string"==typeof t?t.split():(Mt(Array.isArray(t),"invalid extension array"),t)}function w(t){return"string"==typeof t?(Mt("undefined"!=typeof document,"not supported outside of DOM"),document.querySelector(t)):t}function M(t){var e,r,n,i,a=t||{},o={},s=[],l=[],c="undefined"==typeof window?1:window.devicePixelRatio,u=!1,h=function(t){t&&Mt.raise(t)},f=function(){};if("string"==typeof a?(Mt("undefined"!=typeof document,"selector queries only supported in DOM enviroments"),e=document.querySelector(a),Mt(e,"invalid query string for element")):"object"==typeof a?!function(t){return"string"==typeof t.nodeName&&"function"==typeof t.appendChild&&"function"==typeof t.getBoundingClientRect}(a)?!function(t){return"function"==typeof t.drawArrays||"function"==typeof t.drawElements}(a)?(Mt.constructor(a),"gl"in a?i=a.gl:"canvas"in a?n=w(a.canvas):"container"in a&&(r=w(a.container)),"attributes"in a&&(o=a.attributes,Mt.type(o,"object","invalid context attributes")),"extensions"in a&&(s=_(a.extensions)),"optionalExtensions"in a&&(l=_(a.optionalExtensions)),"onDone"in a&&(Mt.type(a.onDone,"function","invalid or missing onDone callback"),h=a.onDone),"profile"in a&&(u=!!a.profile),"pixelRatio"in a&&Mt((c=+a.pixelRatio)>0,"invalid pixel ratio")):n=(i=a).canvas:e=a:Mt.raise("invalid arguments to regl"),e&&("canvas"===e.nodeName.toLowerCase()?n=e:r=e),!i){if(!n){Mt("undefined"!=typeof document,"must manually specify webgl context outside of DOM environments");var d=function(t,e,r){function n(){var e=window.innerWidth,n=window.innerHeight;if(t!==document.body){var a=t.getBoundingClientRect();e=a.right-a.left,n=a.bottom-a.top}i.width=r*e,i.height=r*n,ct(i.style,{width:e+"px",height:n+"px"})}var i=document.createElement("canvas");return ct(i.style,{border:0,margin:0,padding:0,top:0,left:0}),t.appendChild(i),t===document.body&&(i.style.position="absolute",ct(t.style,{margin:0,padding:0})),window.addEventListener("resize",n,!1),n(),{canvas:i,onDestroy:function(){window.removeEventListener("resize",n),t.removeChild(i)}}}(r||document.body,0,c);if(!d)return null;n=d.canvas,f=d.onDestroy}i=function(t,e){function r(r){try{return t.getContext(r,e)}catch(t){return null}}return r("webgl")||r("experimental-webgl")||r("webgl-experimental")}(n,o)}return i?{gl:i,canvas:n,container:r,extensions:s,optionalExtensions:l,pixelRatio:c,profile:u,onDone:h,onDestroy:f}:(f(),h("webgl not supported, try upgrading your browser or graphics drivers http://get.webgl.org"),null)}function k(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)||lt(t.data))}function T(t,e){for(var r=Array(t),n=0;n<t;++n)r[n]=e(n);return r}function A(t){var e,r;return e=(t>65535)<<4,t>>>=e,r=(t>255)<<3,t>>>=r,e|=r,r=(t>15)<<2,t>>>=r,e|=r,r=(t>3)<<1,t>>>=r,(e|=r)|t>>1}function S(t){var e=function(t){for(var e=16;e<=1<<28;e*=16)if(t<=e)return e;return 0}(t),r=jt[A(e)>>2];return r.length>0?r.pop():new ArrayBuffer(e)}function E(t){jt[A(t.byteLength)>>2].push(t)}function L(t,e,r,n,i,a){for(var o=a,s=0;s<e;++s)for(var l=t[s],c=0;c<r;++c)for(var u=l[c],h=0;h<n;++h)i[o++]=u[h]}function C(t,e,r,n,i){for(var a=1,o=r+1;o<e.length;++o)a*=e[o];var s=e[r];if(e.length-r==4){var l=e[r+1],c=e[r+2],u=e[r+3];for(o=0;o<s;++o)L(t[o],l,c,u,n,i),i+=a}else for(o=0;o<s;++o)C(t[o],e,r+1,n,i),i+=a}function I(t){return 0|st[Object.prototype.toString.call(t)]}function P(t,e){for(var r=0;r<e.length;++r)t[r]=e[r]}function D(t,e,r,n,i,a,o){for(var s=0,l=0;l<r;++l)for(var c=0;c<n;++c)t[s++]=e[i*l+a*c+o]}function z(t){for(var e=Nt.allocType(he,t.length),r=0;r<t.length;++r)if(isNaN(t[r]))e[r]=65535;else if(t[r]===1/0)e[r]=31744;else if(t[r]===-1/0)e[r]=64512;else{ce[0]=t[r];var n=ue[0],i=n>>>31<<15,a=(n<<1>>>24)-127,o=n>>13&1023;if(a<-24)e[r]=i;else if(a<-14){var s=-14-a;e[r]=i+(o+1024>>s)}else e[r]=a>15?i+31744:i+(a+15<<10)+o}return e}function O(t){return Array.isArray(t)||lt(t)}function F(t){return"[object "+t+"]"}function R(t){return Array.isArray(t)&&(0===t.length||"number"==typeof t[0])}function j(t){if(!Array.isArray(t))return!1;return!(0===t.length||!O(t[0]))}function N(t){return Object.prototype.toString.call(t)}function B(t){return N(t)===wr}function U(t){if(!t)return!1;var e=N(t);return Ar.indexOf(e)>=0||(R(t)||j(t)||k(t))}function V(t){return 0|st[Object.prototype.toString.call(t)]}function H(t,e){return Nt.allocType(t.type===Pe?Xe:t.type,e)}function q(t,e){t.type===Pe?(t.data=z(e),Nt.freeType(e)):t.data=e}function G(t,e,r,n,i,a){var o;if(o=void 0!==Er[t]?Er[t]:_r[t]*Sr[e],a&&(o*=6),i){for(var s=0,l=r;l>=1;)s+=o*l*l,l/=2;return s}return o*r*n}function Y(t,e,r,n,i,a,o){function s(){this.internalformat=ge,this.format=ge,this.type=Ge,this.compressed=!1,this.premultiplyAlpha=!1,this.flipY=!1,this.unpackAlignment=1,this.colorSpace=0,this.width=0,this.height=0,this.channels=0}function l(t,e){t.internalformat=e.internalformat,t.format=e.format,t.type=e.type,t.compressed=e.compressed,t.premultiplyAlpha=e.premultiplyAlpha,t.flipY=e.flipY,t.unpackAlignment=e.unpackAlignment,t.colorSpace=e.colorSpace,t.width=e.width,t.height=e.height,t.channels=e.channels}function c(t,n){if("object"==typeof n&&n){if("premultiplyAlpha"in n&&(Mt.type(n.premultiplyAlpha,"boolean","invalid premultiplyAlpha"),t.premultiplyAlpha=n.premultiplyAlpha),"flipY"in n&&(Mt.type(n.flipY,"boolean","invalid texture flip"),t.flipY=n.flipY),"alignment"in n&&(Mt.oneOf(n.alignment,[1,2,4,8],"invalid texture unpack alignment"),t.unpackAlignment=n.alignment),"colorSpace"in n&&(Mt.parameter(n.colorSpace,F,"invalid colorSpace"),t.colorSpace=F[n.colorSpace]),"type"in n){var i=n.type;Mt(e.oes_texture_float||!("float"===i||"float32"===i),"you must enable the OES_texture_float extension in order to use floating point textures."),Mt(e.oes_texture_half_float||!("half float"===i||"float16"===i),"you must enable the OES_texture_half_float extension in order to use 16-bit floating point textures."),Mt(e.webgl_depth_texture||!("uint16"===i||"uint32"===i||"depth stencil"===i),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Mt.parameter(i,Y,"invalid texture type"),t.type=Y[i]}var a=t.width,o=t.height,s=t.channels,l=!1;"shape"in n?(Mt(Array.isArray(n.shape)&&n.shape.length>=2,"shape must be an array"),a=n.shape[0],o=n.shape[1],3===n.shape.length&&(s=n.shape[2],Mt(s>0&&s<=4,"invalid number of channels"),l=!0),Mt(a>=0&&a<=r.maxTextureSize,"invalid width"),Mt(o>=0&&o<=r.maxTextureSize,"invalid height")):("radius"in n&&(a=o=n.radius,Mt(a>=0&&a<=r.maxTextureSize,"invalid radius")),"width"in n&&(a=n.width,Mt(a>=0&&a<=r.maxTextureSize,"invalid width")),"height"in n&&(o=n.height,Mt(o>=0&&o<=r.maxTextureSize,"invalid height")),"channels"in n&&(s=n.channels,Mt(s>0&&s<=4,"invalid number of channels"),l=!0)),t.width=0|a,t.height=0|o,t.channels=0|s;var c=!1;if("format"in n){var u=n.format;Mt(e.webgl_depth_texture||!("depth"===u||"depth stencil"===u),"you must enable the WEBGL_depth_texture extension in order to use depth/stencil textures."),Mt.parameter(u,W,"invalid texture format");var h=t.internalformat=W[u];t.format=rt[h],u in Y&&("type"in n||(t.type=Y[u])),u in X&&(t.compressed=!0),c=!0}!l&&c?t.channels=_r[t.format]:l&&!c?t.channels!==xr[t.format]&&(t.format=t.internalformat=xr[t.channels]):c&&l&&Mt(t.channels===_r[t.format],"number of channels inconsistent with specified format")}}function u(e){t.pixelStorei(pr,e.flipY),t.pixelStorei(mr,e.premultiplyAlpha),t.pixelStorei(gr,e.colorSpace),t.pixelStorei(dr,e.unpackAlignment)}function h(){s.call(this),this.xOffset=0,this.yOffset=0,this.data=null,this.needsFree=!1,this.element=null,this.needsCopy=!1}function f(t,e){var n=null;if(U(e)?n=e:e&&(Mt.type(e,"object","invalid pixel data type"),c(t,e),"x"in e&&(t.xOffset=0|e.x),"y"in e&&(t.yOffset=0|e.y),U(e.data)&&(n=e.data)),Mt(!t.compressed||n instanceof Uint8Array,"compressed texture data must be stored in a uint8array"),e.copy){Mt(!n,"can not specify copy and data field for the same texture");var a=i.viewportWidth,o=i.viewportHeight;t.width=t.width||a-t.xOffset,t.height=t.height||o-t.yOffset,t.needsCopy=!0,Mt(t.xOffset>=0&&t.xOffset<a&&t.yOffset>=0&&t.yOffset<o&&t.width>0&&t.width<=a&&t.height>0&&t.height<=o,"copy texture read out of bounds")}else if(n){if(lt(n))t.channels=t.channels||4,t.data=n,"type"in e||t.type!==Ge||(t.type=V(n));else if(R(n))t.channels=t.channels||4,function(t,e){var r=e.length;switch(t.type){case Ge:case Ye:case We:case Xe:var n=Nt.allocType(t.type,r);n.set(e),t.data=n;break;case Pe:t.data=z(e);break;default:Mt.raise("unsupported texture type, must specify a typed array")}}(t,n),t.alignment=1,t.needsFree=!0;else if(k(n)){var s=n.data;Array.isArray(s)||t.type!==Ge||(t.type=V(s));var l,u,h,f,d,p,m=n.shape,g=n.stride;3===m.length?(h=m[2],p=g[2]):(Mt(2===m.length,"invalid ndarray pixel data, must be 2 or 3D"),h=1,p=1),l=m[0],u=m[1],f=g[0],d=g[1],t.alignment=1,t.width=l,t.height=u,t.channels=h,t.format=t.internalformat=xr[h],t.needsFree=!0,function(t,e,r,n,i,a){for(var o=t.width,s=t.height,l=t.channels,c=H(t,o*s*l),u=0,h=0;h<s;++h)for(var f=0;f<o;++f)for(var d=0;d<l;++d)c[u++]=e[r*f+n*h+i*d+a];q(t,c)}(t,s,f,d,p,n.offset)}else if(B(n)||function(t){return N(t)===Mr}(n))B(n)?t.element=n:t.element=n.canvas,t.width=t.element.width,t.height=t.element.height,t.channels=4;else if(function(t){return N(t)===kr}(n))t.element=n,t.width=n.naturalWidth,t.height=n.naturalHeight,t.channels=4;else if(function(t){return N(t)===Tr}(n))t.element=n,t.width=n.videoWidth,t.height=n.videoHeight,t.channels=4;else if(j(n)){var v=t.width||n[0].length,y=t.height||n.length,b=t.channels;b=O(n[0][0])?b||n[0][0].length:b||1;for(var x=Bt.shape(n),_=1,w=0;w<x.length;++w)_*=x[w];var M=H(t,_);Bt.flatten(n,x,"",M),q(t,M),t.alignment=1,t.width=v,t.height=y,t.channels=b,t.format=t.internalformat=xr[b],t.needsFree=!0}}else t.width=t.width||1,t.height=t.height||1,t.channels=t.channels||4;t.type===Xe?Mt(r.extensions.indexOf("oes_texture_float")>=0,"oes_texture_float extension not enabled"):t.type===Pe&&Mt(r.extensions.indexOf("oes_texture_half_float")>=0,"oes_texture_half_float extension not enabled")}function d(e,r,i){var a=e.element,o=e.data,s=e.internalformat,l=e.format,c=e.type,h=e.width,f=e.height;u(e),a?t.texImage2D(r,i,l,l,c,a):e.compressed?t.compressedTexImage2D(r,i,s,h,f,0,o):e.needsCopy?(n(),t.copyTexImage2D(r,i,l,e.xOffset,e.yOffset,h,f,0)):t.texImage2D(r,i,l,h,f,0,l,c,o)}function p(e,r,i,a,o){var s=e.element,l=e.data,c=e.internalformat,h=e.format,f=e.type,d=e.width,p=e.height;u(e),s?t.texSubImage2D(r,o,i,a,h,f,s):e.compressed?t.compressedTexSubImage2D(r,o,i,a,c,d,p,l):e.needsCopy?(n(),t.copyTexSubImage2D(r,o,i,a,e.xOffset,e.yOffset,d,p)):t.texSubImage2D(r,o,i,a,d,p,h,f,l)}function m(){return nt.pop()||new h}function g(t){t.needsFree&&Nt.freeType(t.data),h.call(t),nt.push(t)}function v(t,e,r){var n=t.images[0]=m();t.mipmask=1,n.width=t.width=e,n.height=t.height=r,n.channels=t.channels=4}function y(t,e){var r=null;if(U(e))l(r=t.images[0]=m(),t),f(r,e),t.mipmask=1;else if(c(t,e),Array.isArray(e.mipmap))for(var n=e.mipmap,i=0;i<n.length;++i)l(r=t.images[i]=m(),t),r.width>>=i,r.height>>=i,f(r,n[i]),t.mipmask|=1<<i;else l(r=t.images[0]=m(),t),f(r,e),t.mipmask=1;l(t,t.images[0]),(t.compressed&&t.internalformat===De||t.internalformat===ze||t.internalformat===Oe||t.internalformat===Fe)&&Mt(t.width%4==0&&t.height%4==0,"for compressed texture formats, mipmap level 0 must have width and height that are a multiple of 4")}function b(t,e){for(var r=t.images,n=0;n<r.length;++n){if(!r[n])return;d(r[n],e,n)}}function x(){var t=it.pop()||new function(){s.call(this),this.genMipmaps=!1,this.mipmapHint=cr,this.mipmask=0,this.images=Array(16)};s.call(t),t.mipmask=0;for(var e=0;e<16;++e)t.images[e]=null;return t}function _(t){for(var e=t.images,r=0;r<e.length;++r)e[r]&&g(e[r]),e[r]=null;it.push(t)}function w(){this.minFilter=rr,this.magFilter=rr,this.wrapS=Qe,this.wrapT=Qe,this.anisotropic=1,this.genMipmaps=!1,this.mipmapHint=cr}function M(t,e){if("min"in e){var n=e.min;Mt.parameter(n,D),t.minFilter=D[n],br.indexOf(t.minFilter)>=0&&(t.genMipmaps=!0)}if("mag"in e){var i=e.mag;Mt.parameter(i,P),t.magFilter=P[i]}var a=t.wrapS,o=t.wrapT;if("wrap"in e){var s=e.wrap;"string"==typeof s?(Mt.parameter(s,I),a=o=I[s]):Array.isArray(s)&&(Mt.parameter(s[0],I),Mt.parameter(s[1],I),a=I[s[0]],o=I[s[1]])}else{if("wrapS"in e){var l=e.wrapS;Mt.parameter(l,I),a=I[l]}if("wrapT"in e){var c=e.wrapT;Mt.parameter(c,I),o=I[c]}}if(t.wrapS=a,t.wrapT=o,"anisotropic"in e){var u=e.anisotropic;Mt("number"==typeof u&&u>=1&&u<=r.maxAnisotropic,"aniso samples must be between 1 and "),t.anisotropic=e.anisotropic}if("mipmap"in e){var h=!1;switch(typeof e.mipmap){case"string":Mt.parameter(e.mipmap,C,"invalid mipmap hint"),t.mipmapHint=C[e.mipmap],t.genMipmaps=!0,h=!0;break;case"boolean":h=t.genMipmaps=e.mipmap;break;case"object":Mt(Array.isArray(e.mipmap),"invalid mipmap type"),t.genMipmaps=!1,h=!0;break;default:Mt.raise("invalid mipmap type")}!h||"min"in e||(t.minFilter=ir)}}function T(r,n){t.texParameteri(n,er,r.minFilter),t.texParameteri(n,tr,r.magFilter),t.texParameteri(n,Ze,r.wrapS),t.texParameteri(n,Je,r.wrapT),e.ext_texture_filter_anisotropic&&t.texParameteri(n,fr,r.anisotropic),r.genMipmaps&&(t.hint(lr,r.mipmapHint),t.generateMipmap(n))}function A(e){s.call(this),this.mipmask=0,this.internalformat=ge,this.id=at++,this.refCount=1,this.target=e,this.texture=t.createTexture(),this.unit=-1,this.bindCount=0,this.texInfo=new w,o.profile&&(this.stats={size:0})}function S(e){t.activeTexture(yr),t.bindTexture(e.target,e.texture)}function E(){var e=ut[0];e?t.bindTexture(e.target,e.texture):t.bindTexture(de,null)}function L(e){var r=e.texture;Mt(r,"must not double destroy texture");var n=e.unit,i=e.target;n>=0&&(t.activeTexture(yr+n),t.bindTexture(i,null),ut[n]=null),t.deleteTexture(r),e.texture=null,e.params=null,e.pixels=null,e.refCount=0,delete ot[e.id],a.textureCount--}var C={"don't care":cr,"dont care":cr,nice:hr,fast:ur},I={repeat:Ke,clamp:Qe,mirror:$e},P={nearest:rr,linear:nr},D=ct({mipmap:sr,"nearest mipmap nearest":ir,"linear mipmap nearest":ar,"nearest mipmap linear":or,"linear mipmap linear":sr},P),F={none:0,browser:vr},Y={uint8:Ge,rgba4:ke,rgb565:Ae,"rgb5 a1":Te},W={alpha:ve,luminance:be,"luminance alpha":xe,rgb:ye,rgba:ge,rgba4:_e,"rgb5 a1":we,rgb565:Me},X={};e.ext_srgb&&(W.srgb=Ce,W.srgba=Ie),e.oes_texture_float&&(Y.float32=Y.float=Xe),e.oes_texture_half_float&&(Y.float16=Y["half float"]=Pe),e.webgl_depth_texture&&(ct(W,{depth:Ee,"depth stencil":Le}),ct(Y,{uint16:Ye,uint32:We,"depth stencil":Se})),e.webgl_compressed_texture_s3tc&&ct(X,{"rgb s3tc dxt1":De,"rgba s3tc dxt1":ze,"rgba s3tc dxt3":Oe,"rgba s3tc dxt5":Fe}),e.webgl_compressed_texture_atc&&ct(X,{"rgb atc":Re,"rgba atc explicit alpha":je,"rgba atc interpolated alpha":Ne}),e.webgl_compressed_texture_pvrtc&&ct(X,{"rgb pvrtc 4bppv1":Be,"rgb pvrtc 2bppv1":Ue,"rgba pvrtc 4bppv1":Ve,"rgba pvrtc 2bppv1":He}),e.webgl_compressed_texture_etc1&&(X["rgb etc1"]=qe);var Z=Array.prototype.slice.call(t.getParameter(fe));Object.keys(X).forEach(function(t){var e=X[t];Z.indexOf(e)>=0&&(W[t]=e)});var J=Object.keys(W);r.textureFormats=J;var K=[];Object.keys(W).forEach(function(t){var e=W[t];K[e]=t});var Q=[];Object.keys(Y).forEach(function(t){var e=Y[t];Q[e]=t});var $=[];Object.keys(P).forEach(function(t){var e=P[t];$[e]=t});var tt=[];Object.keys(D).forEach(function(t){var e=D[t];tt[e]=t});var et=[];Object.keys(I).forEach(function(t){var e=I[t];et[e]=t});var rt=J.reduce(function(t,e){var r=W[e];return r===be||r===ve||r===be||r===xe||r===Ee||r===Le?t[r]=r:r===we||e.indexOf("rgba")>=0?t[r]=ge:t[r]=ye,t},{}),nt=[],it=[],at=0,ot={},st=r.maxTextureUnits,ut=Array(st).map(function(){return null});return ct(A.prototype,{bind:function(){this.bindCount+=1;var e=this.unit;if(e<0){for(var r=0;r<st;++r){var n=ut[r];if(n){if(n.bindCount>0)continue;n.unit=-1}ut[r]=this,e=r;break}e>=st&&Mt.raise("insufficient number of texture units"),o.profile&&a.maxTextureUnits<e+1&&(a.maxTextureUnits=e+1),this.unit=e,t.activeTexture(yr+e),t.bindTexture(this.target,this.texture)}return e},unbind:function(){this.bindCount-=1},decRef:function(){--this.refCount<=0&&L(this)}}),o.profile&&(a.getTotalTextureSize=function(){var t=0;return Object.keys(ot).forEach(function(e){t+=ot[e].stats.size}),t}),{create2D:function(e,n){function i(t,e){var n=s.texInfo;w.call(n);var a=x();return"number"==typeof t?v(a,0|t,"number"==typeof e?0|e:0|t):t?(Mt.type(t,"object","invalid arguments to regl.texture"),M(n,t),y(a,t)):v(a,1,1),n.genMipmaps&&(a.mipmask=(a.width<<1)-1),s.mipmask=a.mipmask,l(s,a),Mt.texture2D(n,a,r),s.internalformat=a.internalformat,i.width=a.width,i.height=a.height,S(s),b(a,de),T(n,de),E(),_(a),o.profile&&(s.stats.size=G(s.internalformat,s.type,a.width,a.height,n.genMipmaps,!1)),i.format=K[s.internalformat],i.type=Q[s.type],i.mag=$[n.magFilter],i.min=tt[n.minFilter],i.wrapS=et[n.wrapS],i.wrapT=et[n.wrapT],i}var s=new A(de);return ot[s.id]=s,a.textureCount++,i(e,n),i.subimage=function(t,e,r,n){Mt(!!t,"must specify image data");var a=0|e,o=0|r,c=0|n,u=m();return l(u,s),u.width=0,u.height=0,f(u,t),u.width=u.width||(s.width>>c)-a,u.height=u.height||(s.height>>c)-o,Mt(s.type===u.type&&s.format===u.format&&s.internalformat===u.internalformat,"incompatible format for texture.subimage"),Mt(a>=0&&o>=0&&a+u.width<=s.width&&o+u.height<=s.height,"texture.subimage write out of bounds"),Mt(s.mipmask&1<<c,"missing mipmap data"),Mt(u.data||u.element||u.needsCopy,"missing image data"),S(s),p(u,de,a,o,c),E(),g(u),i},i.resize=function(e,r){var n=0|e,a=0|r||n;if(n===s.width&&a===s.height)return i;i.width=s.width=n,i.height=s.height=a,S(s);for(var l=0;s.mipmask>>l;++l)t.texImage2D(de,l,s.format,n>>l,a>>l,0,s.format,s.type,null);return E(),o.profile&&(s.stats.size=G(s.internalformat,s.type,n,a,!1,!1)),i},i._reglType="texture2d",i._texture=s,o.profile&&(i.stats=s.stats),i.destroy=function(){s.decRef()},i},createCube:function(e,n,i,s,u,h){function d(t,e,n,i,a,s){var u,h=k.texInfo;for(w.call(h),u=0;u<6;++u)L[u]=x();if("number"!=typeof t&&t)if("object"==typeof t)if(e)y(L[0],t),y(L[1],e),y(L[2],n),y(L[3],i),y(L[4],a),y(L[5],s);else if(M(h,t),c(k,t),"faces"in t){var f=t.faces;for(Mt(Array.isArray(f)&&6===f.length,"cube faces must be a length 6 array"),u=0;u<6;++u)Mt("object"==typeof f[u]&&!!f[u],"invalid input for cube map face"),l(L[u],k),y(L[u],f[u])}else for(u=0;u<6;++u)y(L[u],t);else Mt.raise("invalid arguments to cube map");else{var p=0|t||1;for(u=0;u<6;++u)v(L[u],p,p)}for(l(k,L[0]),h.genMipmaps?k.mipmask=(L[0].width<<1)-1:k.mipmask=L[0].mipmask,Mt.textureCube(k,h,L,r),k.internalformat=L[0].internalformat,d.width=L[0].width,d.height=L[0].height,S(k),u=0;u<6;++u)b(L[u],me+u);for(T(h,pe),E(),o.profile&&(k.stats.size=G(k.internalformat,k.type,d.width,d.height,h.genMipmaps,!0)),d.format=K[k.internalformat],d.type=Q[k.type],d.mag=$[h.magFilter],d.min=tt[h.minFilter],d.wrapS=et[h.wrapS],d.wrapT=et[h.wrapT],u=0;u<6;++u)_(L[u]);return d}var k=new A(pe);ot[k.id]=k,a.cubeCount++;var L=new Array(6);return d(e,n,i,s,u,h),d.subimage=function(t,e,r,n,i){Mt(!!e,"must specify image data"),Mt("number"==typeof t&&t===(0|t)&&t>=0&&t<6,"invalid face");var a=0|r,o=0|n,s=0|i,c=m();return l(c,k),c.width=0,c.height=0,f(c,e),c.width=c.width||(k.width>>s)-a,c.height=c.height||(k.height>>s)-o,Mt(k.type===c.type&&k.format===c.format&&k.internalformat===c.internalformat,"incompatible format for texture.subimage"),Mt(a>=0&&o>=0&&a+c.width<=k.width&&o+c.height<=k.height,"texture.subimage write out of bounds"),Mt(k.mipmask&1<<s,"missing mipmap data"),Mt(c.data||c.element||c.needsCopy,"missing image data"),S(k),p(c,me+t,a,o,s),E(),g(c),d},d.resize=function(e){var r=0|e;if(r!==k.width){d.width=k.width=r,d.height=k.height=r,S(k);for(var n=0;n<6;++n)for(var i=0;k.mipmask>>i;++i)t.texImage2D(me+n,i,k.format,r>>i,r>>i,0,k.format,k.type,null);return E(),o.profile&&(k.stats.size=G(k.internalformat,k.type,d.width,d.height,!1,!0)),d}},d._reglType="textureCube",d._texture=k,o.profile&&(d.stats=k.stats),d.destroy=function(){k.decRef()},d},clear:function(){for(var e=0;e<st;++e)t.activeTexture(yr+e),t.bindTexture(de,null),ut[e]=null;Ct(ot).forEach(L),a.cubeCount=0,a.textureCount=0},getTexture:function(t){return null},restore:function(){Ct(ot).forEach(function(e){e.texture=t.createTexture(),t.bindTexture(e.target,e.texture);for(var r=0;r<32;++r)if(0!=(e.mipmask&1<<r))if(e.target===de)t.texImage2D(de,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;n<6;++n)t.texImage2D(me+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);T(e.texInfo,e.target)})}}}function W(t,e,r){return Ir[t]*e*r}function X(){this.state=0,this.x=0,this.y=0,this.z=0,this.w=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=Kr,this.offset=0,this.stride=0,this.divisor=0}function Z(t,e,r,n){function i(t,e,r,n){this.name=t,this.id=e,this.location=r,this.info=n}function a(t,e){for(var r=0;r<t.length;++r)if(t[r].id===e.id)return void(t[r].location=e.location);t.push(e)}function o(r,n,i){var a=r===Qr?l:c,o=a[n];if(!o){var s=e.str(n);o=t.createShader(r),t.shaderSource(o,s),t.compileShader(o),Mt.shaderError(t,o,s,r,i),a[n]=o}return o}function s(r,s){var l,c,u=o(Qr,r.fragId),h=o($r,r.vertId),f=r.program=t.createProgram();t.attachShader(f,u),t.attachShader(f,h),t.linkProgram(f),Mt.linkError(t,f,e.str(r.fragId),e.str(r.vertId),s);var d=t.getProgramParameter(f,tn);n.profile&&(r.stats.uniformsCount=d);var p=r.uniforms;for(l=0;l<d;++l)if(c=t.getActiveUniform(f,l))if(c.size>1)for(var m=0;m<c.size;++m){var g=c.name.replace("[0]","["+m+"]");a(p,new i(g,e.id(g),t.getUniformLocation(f,g),c))}else a(p,new i(c.name,e.id(c.name),t.getUniformLocation(f,c.name),c));var v=t.getProgramParameter(f,en);n.profile&&(r.stats.attributesCount=v);var y=r.attributes;for(l=0;l<v;++l)(c=t.getActiveAttrib(f,l))&&a(y,new i(c.name,e.id(c.name),t.getAttribLocation(f,c.name),c))}var l={},c={},u={},h=[],f=0;return n.profile&&(r.getMaxUniformsCount=function(){var t=0;return h.forEach(function(e){e.stats.uniformsCount>t&&(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);Ct(l).forEach(e),l={},Ct(c).forEach(e),c={},h.forEach(function(e){t.deleteProgram(e.program)}),h.length=0,u={},r.shaderCount=0},program:function(t,e,i){Mt.command(t>=0,"missing vertex shader",i),Mt.command(e>=0,"missing fragment shader",i);var a=u[e];a||(a=u[e]={});var o=a[t];return o||(o=new function(t,e){this.id=f++,this.fragId=t,this.vertId=e,this.program=null,this.uniforms=[],this.attributes=[],n.profile&&(this.stats={uniformsCount:0,attributesCount:0})}(e,t),r.shaderCount++,s(o,i),a[t]=o,h.push(o)),o},restore:function(){l={},c={};for(var t=0;t<h.length;++t)s(h[t])},shader:o,frag:-1,vert:-1}}function J(t,e,r,n,i,a){function o(o){var s;null===e.next?(Mt(i.preserveDrawingBuffer,'you must create a webgl context with "preserveDrawingBuffer":true in order to read pixels from the drawing buffer'),s=nn):(Mt(null!==e.next.colorAttachments[0].texture,"You cannot read from a renderbuffer"),s=e.next.colorAttachments[0].texture._texture.type,a.oes_texture_float?Mt(s===nn||s===on,"Reading from a framebuffer is only allowed for the types 'uint8' and 'float'"):Mt(s===nn,"Reading from a framebuffer is only allowed for the type 'uint8'"));var l=0,c=0,u=n.framebufferWidth,h=n.framebufferHeight,f=null;lt(o)?f=o:o&&(Mt.type(o,"object","invalid arguments to regl.read()"),l=0|o.x,c=0|o.y,Mt(l>=0&&l<n.framebufferWidth,"invalid x offset for regl.read"),Mt(c>=0&&c<n.framebufferHeight,"invalid y offset for regl.read"),u=0|(o.width||n.framebufferWidth-l),h=0|(o.height||n.framebufferHeight-c),f=o.data||null),f&&(s===nn?Mt(f instanceof Uint8Array,"buffer must be 'Uint8Array' when reading from a framebuffer of type 'uint8'"):s===on&&Mt(f instanceof Float32Array,"buffer must be 'Float32Array' when reading from a framebuffer of type 'float'")),Mt(u>0&&u+l<=n.framebufferWidth,"invalid width for read pixels"),Mt(h>0&&h+c<=n.framebufferHeight,"invalid height for read pixels"),r();var d=u*h*4;return f||(s===nn?f=new Uint8Array(d):s===on&&(f=f||new Float32Array(d))),Mt.isTypedArray(f,"data buffer for regl.read() must be a typedarray"),Mt(f.byteLength>=d,"data buffer for regl.read() too small"),t.pixelStorei(an,4),t.readPixels(l,c,u,h,rn,s,f),f}return function(t){return t&&"framebuffer"in t?function(t){var r;return e.setFBO({framebuffer:t.framebuffer},function(){r=o(t)}),r}(t):o(t)}}function K(t){return Array.prototype.slice.call(t)}function Q(t){return K(t).join("")}function $(t){return Array.isArray(t)||lt(t)||k(t)}function tt(t){return t.sort(function(t,e){return t===Vn?-1:e===Vn?1:t<e?-1:1})}function et(t,e,r,n){this.thisDep=t,this.contextDep=e,this.propDep=r,this.append=n}function rt(t){return t&&!(t.thisDep||t.contextDep||t.propDep)}function nt(t){return new et(!1,!1,!1,t)}function it(t,e){var r=t.type;if(r===hn){var n=t.data.length;return new et(!0,n>=1,n>=2,e)}if(r===mn){var i=t.data;return new et(i.thisDep,i.contextDep,i.propDep,e)}return new et(r===pn,r===dn,r===fn,e)}function at(t,e,r,n,i,a,o,s,l,c,u,h,f,d,p){function m(t){return t.replace(".","_")}function g(t,e,r){var n=m(t);V.push(t),U[n]=B[n]=!!r,H[n]=e}function v(t,e,r){var n=m(t);V.push(t),Array.isArray(r)?(B[n]=r.slice(),U[n]=r.slice()):B[n]=U[n]=r,q[n]=e}function y(){var t=function(){function t(){var t=[],e=[];return ct(function(){t.push.apply(t,K(arguments))},{def:function(){var n="v"+r++;return e.push(n),arguments.length>0&&(t.push(n,"="),t.push.apply(t,K(arguments)),t.push(";")),n},toString:function(){return Q([e.length>0?"var "+e+";":"",Q(t)])}})}function e(){function e(t,e){n(t,e,"=",r.def(t,e),";")}var r=t(),n=t(),i=r.toString,a=n.toString;return ct(function(){r.apply(r,K(arguments))},{def:r.def,entry:r,exit:n,save:e,set:function(t,n,i){e(t,n),r(t,n,"=",i,";")},toString:function(){return i()+a()}})}var r=0,n=[],i=[],a=t(),o={};return{global:a,link:function(t){for(var e=0;e<i.length;++e)if(i[e]===t)return n[e];var a="g"+r++;return n.push(a),i.push(t),a},block:t,proc:function(t,r){function n(){var t="a"+i.length;return i.push(t),t}var i=[];r=r||0;for(var a=0;a<r;++a)n();var s=e(),l=s.toString;return o[t]=ct(s,{arg:n,toString:function(){return Q(["function(",i.join(),"){",l(),"}"])}})},scope:e,cond:function(){var t=Q(arguments),r=e(),n=e(),i=r.toString,a=n.toString;return ct(r,{then:function(){return r.apply(r,K(arguments)),this},else:function(){return n.apply(n,K(arguments)),this},toString:function(){var e=a();return e&&(e="else{"+e+"}"),Q(["if(",t,"){",i(),"}",e])}})},compile:function(){var t=['"use strict";',a,"return {"];Object.keys(o).forEach(function(e){t.push('"',e,'":',o[e].toString(),",")}),t.push("}");var e=Q(t).replace(/;/g,";\n").replace(/}/g,"}\n").replace(/{/g,"{\n");return Function.apply(null,n.concat(e)).apply(null,i)}}}(),r=t.link,n=t.global;t.id=W++,t.batchId="0";var i=r(G),a=t.shared={props:"a0"};Object.keys(G).forEach(function(t){a[t]=n.def(i,".",t)}),Mt.optional(function(){t.CHECK=r(Mt),t.commandStr=Mt.guessCommand(),t.command=r(t.commandStr),t.assert=function(t,e,n){t("if(!(",e,"))",this.CHECK,".commandRaise(",r(n),",",this.command,");")},Y.invalidBlendCombinations=Ki});var o=t.next={},s=t.current={};Object.keys(q).forEach(function(t){Array.isArray(B[t])&&(o[t]=n.def(a.next,".",t),s[t]=n.def(a.current,".",t))});var l=t.constants={};Object.keys(Y).forEach(function(t){l[t]=n.def(JSON.stringify(Y[t]))}),t.invoke=function(e,n){switch(n.type){case hn:var i=["this",a.context,a.props,t.batchId];return e.def(r(n.data),".call(",i.slice(0,Math.max(n.data.length+1,4)),")");case fn:return e.def(a.props,n.data);case dn:return e.def(a.context,n.data);case pn:return e.def("this",n.data);case mn:return n.data.append(t,e),n.data.ref}},t.attribCache={};var u={};return t.scopeAttrib=function(t){var n=e.id(t);if(n in u)return u[n];var i=c.scope[n];i||(i=c.scope[n]=new F);return u[n]=r(i)},t}function b(t,r,o,l,c){function h(t){var e=g[t];e&&(y[t]=e)}var f=t.static,d=t.dynamic;Mt.optional(function(){function t(t){Object.keys(t).forEach(function(t){Mt.command(e.indexOf(t)>=0,'unknown parameter "'+t+'"',c.commandStr)})}var e=[qn,Gn,Yn,Wn,Xn,Jn,Zn,Kn,Hn].concat(V);t(f),t(d)});var p=function(t,e){var r=t.static,n=t.dynamic;if(qn in r){var i=r[qn];return i?(i=s.getFramebuffer(i),Mt.command(i,"invalid framebuffer object"),nt(function(t,e){var r=t.link(i),n=t.shared;e.set(n.framebuffer,".next",r);var a=n.context;return e.set(a,"."+Qn,r+".width"),e.set(a,"."+$n,r+".height"),r})):nt(function(t,e){var r=t.shared;e.set(r.framebuffer,".next","null");var n=r.context;return e.set(n,"."+Qn,n+"."+ri),e.set(n,"."+$n,n+"."+ni),"null"})}if(qn in n){var a=n[qn];return it(a,function(t,e){var r=t.invoke(e,a),n=t.shared,i=n.framebuffer,o=e.def(i,".getFramebuffer(",r,")");Mt.optional(function(){t.assert(e,"!"+r+"||"+o,"invalid framebuffer object")}),e.set(i,".next",o);var s=n.context;return e.set(s,"."+Qn,o+"?"+o+".width:"+s+"."+ri),e.set(s,"."+$n,o+"?"+o+".height:"+s+"."+ni),o})}return null}(t),g=function(t,e,r){function n(t){if(t in i){var n=i[t];Mt.commandType(n,"object","invalid "+t,r.commandStr);var o,s,l=!0,c=0|n.x,u=0|n.y;return"width"in n?(o=0|n.width,Mt.command(o>=0,"invalid "+t,r.commandStr)):l=!1,"height"in n?(s=0|n.height,Mt.command(s>=0,"invalid "+t,r.commandStr)):l=!1,new et(!l&&e&&e.thisDep,!l&&e&&e.contextDep,!l&&e&&e.propDep,function(t,e){var r=t.shared.context,i=o;"width"in n||(i=e.def(r,".",Qn,"-",c));var a=s;return"height"in n||(a=e.def(r,".",$n,"-",u)),[c,u,i,a]})}if(t in a){var h=a[t],f=it(h,function(e,r){var n=e.invoke(r,h);Mt.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)});var i=e.shared.context,a=r.def(n,".x|0"),o=r.def(n,".y|0"),s=r.def('"width" in ',n,"?",n,".width|0:","(",i,".",Qn,"-",a,")"),l=r.def('"height" in ',n,"?",n,".height|0:","(",i,".",$n,"-",o,")");return Mt.optional(function(){e.assert(r,s+">=0&&"+l+">=0","invalid "+t)}),[a,o,s,l]});return e&&(f.thisDep=f.thisDep||e.thisDep,f.contextDep=f.contextDep||e.contextDep,f.propDep=f.propDep||e.propDep),f}return e?new et(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".",Qn),e.def(r,".",$n)]}):null}var i=t.static,a=t.dynamic,o=n(Vn);if(o){var s=o;o=new et(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=s.append(t,e),n=t.shared.context;return e.set(n,"."+ti,r[2]),e.set(n,"."+ei,r[3]),r})}return{viewport:o,scissor_box:n(Un)}}(t,p,c),v=function(t,e){function r(t,r){if(t in n){var a=0|n[t];return Mt.command(!r||a>=0,"invalid "+t,e.commandStr),nt(function(t,e){return r&&(t.OFFSET=a),a})}if(t in i){var s=i[t];return it(s,function(e,n){var i=e.invoke(n,s);return r&&(e.OFFSET=i,Mt.optional(function(){e.assert(n,i+">=0","invalid "+t)})),i})}return r&&o?nt(function(t,e){return t.OFFSET="0",0}):null}var n=t.static,i=t.dynamic,o=function(){if(Wn in n){var t=n[Wn];$(t)?t=a.getElements(a.create(t,!0)):t&&(t=a.getElements(t),Mt.command(t,"invalid elements",e.commandStr));var r=nt(function(e,r){if(t){var n=e.link(t);return e.ELEMENTS=n,n}return e.ELEMENTS=null,null});return r.value=t,r}if(Wn in i){var o=i[Wn];return it(o,function(t,e){var r=t.shared,n=r.isBufferArgs,i=r.elements,a=t.invoke(e,o),s=e.def("null"),l=e.def(n,"(",a,")"),c=t.cond(l).then(s,"=",i,".createStream(",a,");").else(s,"=",i,".getElements(",a,");");return Mt.optional(function(){t.assert(c.else,"!"+a+"||"+s,"invalid elements")}),e.entry(c),e.exit(t.cond(l).then(i,".destroyStream(",s,");")),t.ELEMENTS=s,s})}return null}(),s=r(Jn,!0);return{elements:o,primitive:function(){if(Xn in n){var t=n[Xn];return Mt.commandParameter(t,Jt,"invalid primitve",e.commandStr),nt(function(e,r){return Jt[t]})}if(Xn in i){var r=i[Xn];return it(r,function(t,e){var n=t.constants.primTypes,i=t.invoke(e,r);return Mt.optional(function(){t.assert(e,i+" in "+n,"invalid primitive, must be one of "+Object.keys(Jt))}),e.def(n,"[",i,"]")})}return o?rt(o)?o.value?nt(function(t,e){return e.def(t.ELEMENTS,".primType")}):nt(function(){return Oi}):new et(o.thisDep,o.contextDep,o.propDep,function(t,e){var r=t.ELEMENTS;return e.def(r,"?",r,".primType:",Oi)}):null}(),count:function(){if(Zn in n){var t=0|n[Zn];return Mt.command("number"==typeof t&&t>=0,"invalid vertex count",e.commandStr),nt(function(){return t})}if(Zn in i){var r=i[Zn];return it(r,function(t,e){var n=t.invoke(e,r);return Mt.optional(function(){t.assert(e,"typeof "+n+'==="number"&&'+n+">=0&&"+n+"===("+n+"|0)","invalid vertex count")}),n})}if(o){if(rt(o)){if(o)return s?new et(s.thisDep,s.contextDep,s.propDep,function(t,e){var r=e.def(t.ELEMENTS,".vertCount-",t.OFFSET);return Mt.optional(function(){t.assert(e,r+">=0","invalid vertex offset/element buffer too small")}),r}):nt(function(t,e){return e.def(t.ELEMENTS,".vertCount")});var a=nt(function(){return-1});return Mt.optional(function(){a.MISSING=!0}),a}var l=new et(o.thisDep||s.thisDep,o.contextDep||s.contextDep,o.propDep||s.propDep,function(t,e){var r=t.ELEMENTS;return t.OFFSET?e.def(r,"?",r,".vertCount-",t.OFFSET,":-1"):e.def(r,"?",r,".vertCount:-1")});return Mt.optional(function(){l.DYNAMIC=!0}),l}return null}(),instances:r(Kn,!1),offset:s}}(t,c),y=function(t,e){var r=t.static,i=t.dynamic,a={};return V.forEach(function(t){function o(e,n){if(t in r){var o=e(r[t]);a[s]=nt(function(){return o})}else if(t in i){var l=i[t];a[s]=it(l,function(t,e){return n(t,e,t.invoke(e,l))})}}var s=m(t);switch(t){case An:case vn:case gn:case On:case _n:case Bn:case Cn:case Pn:case Dn:case kn:return o(function(r){return Mt.commandType(r,"boolean",t,e.commandStr),r},function(e,r,n){return Mt.optional(function(){e.assert(r,"typeof "+n+'==="boolean"',"invalid flag "+t,e.commandStr)}),n});case wn:return o(function(r){return Mt.commandParameter(r,Qi,"invalid "+t,e.commandStr),Qi[r]},function(e,r,n){var i=e.constants.compareFuncs;return Mt.optional(function(){e.assert(r,n+" in "+i,"invalid "+t+", must be one of "+Object.keys(Qi))}),r.def(i,"[",n,"]")});case Mn:return o(function(t){return Mt.command(O(t)&&2===t.length&&"number"==typeof t[0]&&"number"==typeof t[1]&&t[0]<=t[1],"depth range is 2d array",e.commandStr),t},function(t,e,r){return Mt.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===2&&typeof "+r+'[0]==="number"&&typeof '+r+'[1]==="number"&&'+r+"[0]<="+r+"[1]","depth range must be a 2d array")}),[e.def("+",r,"[0]"),e.def("+",r,"[1]")]});case xn:return o(function(t){Mt.commandType(t,"object","blend.func",e.commandStr);var r="srcRGB"in t?t.srcRGB:t.src,n="srcAlpha"in t?t.srcAlpha:t.src,i="dstRGB"in t?t.dstRGB:t.dst,a="dstAlpha"in t?t.dstAlpha:t.dst;return Mt.commandParameter(r,Ji,s+".srcRGB",e.commandStr),Mt.commandParameter(n,Ji,s+".srcAlpha",e.commandStr),Mt.commandParameter(i,Ji,s+".dstRGB",e.commandStr),Mt.commandParameter(a,Ji,s+".dstAlpha",e.commandStr),Mt.command(-1===Ki.indexOf(r+", "+i),"unallowed blending combination (srcRGB, dstRGB) = ("+r+", "+i+")",e.commandStr),[Ji[r],Ji[i],Ji[n],Ji[a]]},function(e,r,n){function i(i,o){var s=r.def('"',i,o,'" in ',n,"?",n,".",i,o,":",n,".",i);return Mt.optional(function(){e.assert(r,s+" in "+a,"invalid "+t+"."+i+o+", must be one of "+Object.keys(Ji))}),s}var a=e.constants.blendFuncs;Mt.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid blend func, must be an object")});var o=i("src","RGB"),s=i("dst","RGB");Mt.optional(function(){var t=e.constants.invalidBlendCombinations;e.assert(r,t+".indexOf("+o+'+", "+'+s+") === -1 ","unallowed blending combination for (srcRGB, dstRGB)")});var l=r.def(a,"[",o,"]"),c=r.def(a,"[",i("src","Alpha"),"]");return[l,r.def(a,"[",s,"]"),c,r.def(a,"[",i("dst","Alpha"),"]")]});case bn:return o(function(r){return"string"==typeof r?(Mt.commandParameter(r,R,"invalid "+t,e.commandStr),[R[r],R[r]]):"object"==typeof r?(Mt.commandParameter(r.rgb,R,t+".rgb",e.commandStr),Mt.commandParameter(r.alpha,R,t+".alpha",e.commandStr),[R[r.rgb],R[r.alpha]]):void Mt.commandRaise("invalid blend.equation",e.commandStr)},function(e,r,n){var i=e.constants.blendEquations,a=r.def(),o=r.def(),s=e.cond("typeof ",n,'==="string"');return Mt.optional(function(){function r(t,r,n){e.assert(t,n+" in "+i,"invalid "+r+", must be one of "+Object.keys(R))}r(s.then,t,n),e.assert(s.else,n+"&&typeof "+n+'==="object"',"invalid "+t),r(s.else,t+".rgb",n+".rgb"),r(s.else,t+".alpha",n+".alpha")}),s.then(a,"=",o,"=",i,"[",n,"];"),s.else(a,"=",i,"[",n,".rgb];",o,"=",i,"[",n,".alpha];"),r(s),[a,o]});case yn:return o(function(t){return Mt.command(O(t)&&4===t.length,"blend.color must be a 4d array",e.commandStr),T(4,function(e){return+t[e]})},function(t,e,r){return Mt.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","blend.color must be a 4d array")}),T(4,function(t){return e.def("+",r,"[",t,"]")})});case Fn:return o(function(t){return Mt.commandType(t,"number",s,e.commandStr),0|t},function(t,e,r){return Mt.optional(function(){t.assert(e,"typeof "+r+'==="number"',"invalid stencil.mask")}),e.def(r,"|0")});case Rn:return o(function(r){Mt.commandType(r,"object",s,e.commandStr);var n=r.cmp||"keep",i=r.ref||0,a="mask"in r?r.mask:-1;return Mt.commandParameter(n,Qi,t+".cmp",e.commandStr),Mt.commandType(i,"number",t+".ref",e.commandStr),Mt.commandType(a,"number",t+".mask",e.commandStr),[Qi[n],i,a]},function(t,e,r){var n=t.constants.compareFuncs;return Mt.optional(function(){function i(){t.assert(e,Array.prototype.join.call(arguments,""),"invalid stencil.func")}i(r+"&&typeof ",r,'==="object"'),i('!("cmp" in ',r,")||(",r,".cmp in ",n,")")}),[e.def('"cmp" in ',r,"?",n,"[",r,".cmp]",":",Hi),e.def(r,".ref|0"),e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case jn:case Nn:return o(function(r){Mt.commandType(r,"object",s,e.commandStr);var n=r.fail||"keep",i=r.zfail||"keep",a=r.zpass||"keep";return Mt.commandParameter(n,$i,t+".fail",e.commandStr),Mt.commandParameter(i,$i,t+".zfail",e.commandStr),Mt.commandParameter(a,$i,t+".zpass",e.commandStr),[t===Nn?Ri:Fi,$i[n],$i[i],$i[a]]},function(e,r,n){function i(i){return Mt.optional(function(){e.assert(r,'!("'+i+'" in '+n+")||("+n+"."+i+" in "+a+")","invalid "+t+"."+i+", must be one of "+Object.keys($i))}),r.def('"',i,'" in ',n,"?",a,"[",n,".",i,"]:",Hi)}var a=e.constants.stencilOps;return Mt.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[t===Nn?Ri:Fi,i("fail"),i("zfail"),i("zpass")]});case In:return o(function(t){Mt.commandType(t,"object",s,e.commandStr);var r=0|t.factor,n=0|t.units;return Mt.commandType(r,"number",s+".factor",e.commandStr),Mt.commandType(n,"number",s+".units",e.commandStr),[r,n]},function(e,r,n){return Mt.optional(function(){e.assert(r,n+"&&typeof "+n+'==="object"',"invalid "+t)}),[r.def(n,".factor|0"),r.def(n,".units|0")]});case Sn:return o(function(t){var r=0;return"front"===t?r=Fi:"back"===t&&(r=Ri),Mt.command(!!r,s,e.commandStr),r},function(t,e,r){return Mt.optional(function(){t.assert(e,r+'==="front"||'+r+'==="back"',"invalid cull.face")}),e.def(r,'==="front"?',Fi,":",Ri)});case Ln:return o(function(t){return Mt.command("number"==typeof t&&t>=n.lineWidthDims[0]&&t<=n.lineWidthDims[1],"invalid line width, must positive number between "+n.lineWidthDims[0]+" and "+n.lineWidthDims[1],e.commandStr),t},function(t,e,r){return Mt.optional(function(){t.assert(e,"typeof "+r+'==="number"&&'+r+">="+n.lineWidthDims[0]+"&&"+r+"<="+n.lineWidthDims[1],"invalid line width")}),r});case En:return o(function(t){return Mt.commandParameter(t,ea,s,e.commandStr),ea[t]},function(t,e,r){return Mt.optional(function(){t.assert(e,r+'==="cw"||'+r+'==="ccw"',"invalid frontFace, must be one of cw,ccw")}),e.def(r+'==="cw"?'+ji+":"+Ni)});case Tn:return o(function(t){return Mt.command(O(t)&&4===t.length,"color.mask must be length 4 array",e.commandStr),t.map(function(t){return!!t})},function(t,e,r){return Mt.optional(function(){t.assert(e,t.shared.isArrayLike+"("+r+")&&"+r+".length===4","invalid color.mask")}),T(4,function(t){return"!!"+r+"["+t+"]"})});case zn:return o(function(t){Mt.command("object"==typeof t&&t,s,e.commandStr);var r="value"in t?t.value:1,n=!!t.invert;return Mt.command("number"==typeof r&&r>=0&&r<=1,"sample.coverage.value must be a number between 0 and 1",e.commandStr),[r,n]},function(t,e,r){return Mt.optional(function(){t.assert(e,r+"&&typeof "+r+'==="object"',"invalid sample.coverage")}),[e.def('"value" in ',r,"?+",r,".value:1"),e.def("!!",r,".invert")]})}}),a}(t,c),b=function(t){function r(t){if(t in i){var r=e.id(i[t]);Mt.optional(function(){u.shader(ta[t],r,Mt.guessCommand())});var n=nt(function(){return r});return n.id=r,n}if(t in a){var o=a[t];return it(o,function(e,r){var n=e.invoke(r,o),i=r.def(e.shared.strings,".id(",n,")");return Mt.optional(function(){r(e.shared.shader,".shader(",ta[t],",",i,",",e.command,");")}),i})}return null}var n,i=t.static,a=t.dynamic,o=r(Yn),s=r(Gn),l=null;return rt(o)&&rt(s)?(l=u.program(s.id,o.id),n=nt(function(t,e){return t.link(l)})):n=new et(o&&o.thisDep||s&&s.thisDep,o&&o.contextDep||s&&s.contextDep,o&&o.propDep||s&&s.propDep,function(t,e){var r,n=t.shared.shader;r=o?o.append(t,e):e.def(n,".",Yn);var i=n+".program("+(s?s.append(t,e):e.def(n,".",Gn))+","+r;return Mt.optional(function(){i+=","+t.command}),e.def(i+")")}),{frag:o,vert:s,progVar:n,program:l}}(t);h(Vn),h(m(Un));var x=Object.keys(y).length>0,_={framebuffer:p,draw:v,shader:b,state:y,dirty:x};return _.profile=function(t){var e,r=t.static,n=t.dynamic;if(Hn in r){var i=!!r[Hn];(e=nt(function(t,e){return i})).enable=i}else if(Hn in n){var a=n[Hn];e=it(a,function(t,e){return t.invoke(e,a)})}return e}(t),_.uniforms=function(t,e){var r=t.static,n=t.dynamic,i={};return Object.keys(r).forEach(function(t){var n,a=r[t];if("number"==typeof a||"boolean"==typeof a)n=nt(function(){return a});else if("function"==typeof a){var o=a._reglType;"texture2d"===o||"textureCube"===o?n=nt(function(t){return t.link(a)}):"framebuffer"===o||"framebufferCube"===o?(Mt.command(a.color.length>0,'missing color attachment for framebuffer sent to uniform "'+t+'"',e.commandStr),n=nt(function(t){return t.link(a.color[0])})):Mt.commandRaise('invalid data for uniform "'+t+'"',e.commandStr)}else O(a)?n=nt(function(e){return e.global.def("[",T(a.length,function(r){return Mt.command("number"==typeof a[r]||"boolean"==typeof a[r],"invalid uniform "+t,e.commandStr),a[r]}),"]")}):Mt.commandRaise('invalid or missing data for uniform "'+t+'"',e.commandStr);n.value=a,i[t]=n}),Object.keys(n).forEach(function(t){var e=n[t];i[t]=it(e,function(t,r){return t.invoke(r,e)})}),i}(o,c),_.attributes=function(t,r){var n=t.static,a=t.dynamic,o={};return Object.keys(n).forEach(function(t){var a=n[t],s=e.id(t),l=new F;if($(a))l.state=cn,l.buffer=i.getBuffer(i.create(a,ai,!1,!0)),l.type=0;else{var c=i.getBuffer(a);if(c)l.state=cn,l.buffer=c,l.type=0;else if(Mt.command("object"==typeof a&&a,"invalid data for attribute "+t,r.commandStr),a.constant){var u=a.constant;l.buffer="null",l.state=un,"number"==typeof u?l.x=u:(Mt.command(O(u)&&u.length>0&&u.length<=4,"invalid constant for attribute "+t,r.commandStr),sn.forEach(function(t,e){e<u.length&&(l[t]=u[e])}))}else{c=$(a.buffer)?i.getBuffer(i.create(a.buffer,ai,!1,!0)):i.getBuffer(a.buffer),Mt.command(!!c,'missing buffer for attribute "'+t+'"',r.commandStr);var h=0|a.offset;Mt.command(h>=0,'invalid offset for attribute "'+t+'"',r.commandStr);var f=0|a.stride;Mt.command(f>=0&&f<256,'invalid stride for attribute "'+t+'", must be integer betweeen [0, 255]',r.commandStr);var d=0|a.size;Mt.command(!("size"in a)||d>0&&d<=4,'invalid size for attribute "'+t+'", must be 1,2,3,4',r.commandStr);var p=!!a.normalized,m=0;"type"in a&&(Mt.commandParameter(a.type,Ut,"invalid type for attribute "+t,r.commandStr),m=Ut[a.type]);var g=0|a.divisor;"divisor"in a&&(Mt.command(0===g||j,'cannot specify divisor for attribute "'+t+'", instancing not supported',r.commandStr),Mt.command(g>=0,'invalid divisor for attribute "'+t+'"',r.commandStr)),Mt.optional(function(){var e=r.commandStr,n=["buffer","offset","divisor","normalized","type","size","stride"];Object.keys(a).forEach(function(r){Mt.command(n.indexOf(r)>=0,'unknown parameter "'+r+'" for attribute pointer "'+t+'" (valid parameters are '+n+")",e)})}),l.buffer=c,l.state=cn,l.size=d,l.normalized=p,l.type=m||c.dtype,l.offset=h,l.stride=f,l.divisor=g}}o[t]=nt(function(t,e){var r=t.attribCache;if(s in r)return r[s];var n={isStream:!1};return Object.keys(l).forEach(function(t){n[t]=l[t]}),l.buffer&&(n.buffer=t.link(l.buffer),n.type=n.type||n.buffer+".dtype"),r[s]=n,n})}),Object.keys(a).forEach(function(t){var e=a[t];o[t]=it(e,function(r,n){function i(t){n(c[t],"=",a,".",t,"|0;")}var a=r.invoke(n,e),o=r.shared,s=o.isBufferArgs,l=o.buffer;Mt.optional(function(){r.assert(n,a+"&&(typeof "+a+'==="object"||typeof '+a+'==="function")&&('+s+"("+a+")||"+l+".getBuffer("+a+")||"+l+".getBuffer("+a+".buffer)||"+s+"("+a+'.buffer)||("constant" in '+a+"&&(typeof "+a+'.constant==="number"||'+o.isArrayLike+"("+a+".constant))))",'invalid dynamic attribute "'+t+'"')});var c={isStream:n.def(!1)},u=new F;u.state=cn,Object.keys(u).forEach(function(t){c[t]=n.def(""+u[t])});var h=c.buffer,f=c.type;return n("if(",s,"(",a,")){",c.isStream,"=true;",h,"=",l,".createStream(",ai,",",a,");",f,"=",h,".dtype;","}else{",h,"=",l,".getBuffer(",a,");","if(",h,"){",f,"=",h,".dtype;",'}else if("constant" in ',a,"){",c.state,"=",un,";","if(typeof "+a+'.constant === "number"){',c[sn[0]],"=",a,".constant;",sn.slice(1).map(function(t){return c[t]}).join("="),"=0;","}else{",sn.map(function(t,e){return c[t]+"="+a+".constant.length>="+e+"?"+a+".constant["+e+"]:0;"}).join(""),"}}else{","if(",s,"(",a,".buffer)){",h,"=",l,".createStream(",ai,",",a,".buffer);","}else{",h,"=",l,".getBuffer(",a,".buffer);","}",f,'="type" in ',a,"?",o.glTypes,"[",a,".type]:",h,".dtype;",c.normalized,"=!!",a,".normalized;"),i("size"),i("offset"),i("stride"),i("divisor"),n("}}"),n.exit("if(",c.isStream,"){",l,".destroyStream(",h,");","}"),c})}),o}(r,c),_.context=function(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=nt(function(t,e){return"number"==typeof r||"boolean"==typeof r?""+r:t.link(r)})}),Object.keys(r).forEach(function(t){var e=r[t];n[t]=it(e,function(t,r){return t.invoke(r,e)})}),n}(l),_}function x(t,e,r){var n=t.shared.context,i=t.scope();Object.keys(r).forEach(function(a){e.save(n,"."+a);var o=r[a];i(n,".",a,"=",o.append(t,e),";")}),e(i)}function _(t,e,r,n){var i,a=t.shared,o=a.gl,s=a.framebuffer;N&&(i=e.def(a.extensions,".webgl_draw_buffers"));var l,c=t.constants,u=c.drawBuffer,h=c.backBuffer;l=r?r.append(t,e):e.def(s,".next"),n||e("if(",l,"!==",s,".cur){"),e("if(",l,"){",o,".bindFramebuffer(",Xi,",",l,".framebuffer);"),N&&e(i,".drawBuffersWEBGL(",u,"[",l,".colorAttachments.length]);"),e("}else{",o,".bindFramebuffer(",Xi,",null);"),N&&e(i,".drawBuffersWEBGL(",h,");"),e("}",s,".cur=",l,";"),n||e("}")}function w(t,e,r){var n=t.shared,i=n.gl,a=t.current,o=t.next,s=n.current,l=n.next,c=t.cond(s,".dirty");V.forEach(function(e){var n=m(e);if(!(n in r.state)){var u,h;if(n in o){u=o[n],h=a[n];var f=T(B[n].length,function(t){return c.def(u,"[",t,"]")});c(t.cond(f.map(function(t,e){return t+"!=="+h+"["+e+"]"}).join("||")).then(i,".",q[n],"(",f,");",f.map(function(t,e){return h+"["+e+"]="+t}).join(";"),";"))}else{u=c.def(l,".",n);var d=t.cond(u,"!==",s,".",n);c(d),n in H?d(t.cond(u).then(i,".enable(",H[n],");").else(i,".disable(",H[n],");"),s,".",n,"=",u,";"):d(i,".",q[n],"(",u,");",s,".",n,"=",u,";")}}}),0===Object.keys(r.state).length&&c(s,".dirty=false;"),e(c)}function M(t,e,r,n){var i=t.shared,a=t.current,o=i.current,s=i.gl;tt(Object.keys(r)).forEach(function(i){var l=r[i];if(!n||n(l)){var c=l.append(t,e);if(H[i]){var u=H[i];rt(l)?e(s,c?".enable(":".disable(",u,");"):e(t.cond(c).then(s,".enable(",u,");").else(s,".disable(",u,");")),e(o,".",i,"=",c,";")}else if(O(c)){var h=a[i];e(s,".",q[i],"(",c,");",c.map(function(t,e){return h+"["+e+"]="+t}).join(";"),";")}else e(s,".",q[i],"(",c,");",o,".",i,"=",c,";")}})}function k(t,e){j&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function A(t,e,r,n,i){function a(){return"undefined"==typeof performance?"Date.now()":"performance.now()"}function o(t){t(c=e.def(),"=",a(),";"),"string"==typeof i?t(p,".count+=",i,";"):t(p,".count++;"),d&&(n?t(u=e.def(),"=",g,".getNumPendingQueries();"):t(g,".beginQuery(",p,");"))}function s(t){t(p,".cpuTime+=",a(),"-",c,";"),d&&(n?t(g,".pushScopeStats(",u,",",g,".getNumPendingQueries(),",p,");"):t(g,".endQuery();"))}function l(t){var r=e.def(m,".profile");e(m,".profile=",t,";"),e.exit(m,".profile=",r,";")}var c,u,h,f=t.shared,p=t.stats,m=f.current,g=f.timer,v=r.profile;if(v){if(rt(v))return void(v.enable?(o(e),s(e.exit),l("true")):l("false"));l(h=v.append(t,e))}else h=e.def(m,".profile");var y=t.block();o(y),e("if(",h,"){",y,"}");var b=t.block();s(b),e.exit("if(",h,"){",b,"}")}function S(t,e,r,n,i){var a=t.shared;n.forEach(function(n){var o,s=n.name,l=r.attributes[s];if(l){if(!i(l))return;o=l.append(t,e)}else{if(!i(ra))return;var c=t.scopeAttrib(s);Mt.optional(function(){t.assert(e,c+".state","missing attribute "+s)}),o={},Object.keys(new F).forEach(function(t){o[t]=e.def(c,".",t)})}!function(r,n,i){function o(){e("if(!",u,".buffer){",l,".enableVertexAttribArray(",c,");}");var r,a=i.type;if(r=i.size?e.def(i.size,"||",n):n,e("if(",u,".type!==",a,"||",u,".size!==",r,"||",p.map(function(t){return u+"."+t+"!=="+i[t]}).join("||"),"){",l,".bindBuffer(",ai,",",f,".buffer);",l,".vertexAttribPointer(",[c,r,a,i.normalized,i.stride,i.offset],");",u,".type=",a,";",u,".size=",r,";",p.map(function(t){return u+"."+t+"="+i[t]+";"}).join(""),"}"),j){var o=i.divisor;e("if(",u,".divisor!==",o,"){",t.instancing,".vertexAttribDivisorANGLE(",[c,o],");",u,".divisor=",o,";}")}}function s(){e("if(",u,".buffer){",l,".disableVertexAttribArray(",c,");","}if(",sn.map(function(t,e){return u+"."+t+"!=="+d[e]}).join("||"),"){",l,".vertexAttrib4f(",c,",",d,");",sn.map(function(t,e){return u+"."+t+"="+d[e]+";"}).join(""),"}")}var l=a.gl,c=e.def(r,".location"),u=e.def(a.attributes,"[",c,"]"),h=i.state,f=i.buffer,d=[i.x,i.y,i.z,i.w],p=["buffer","normalized","offset","stride"];h===cn?o():h===un?s():(e("if(",h,"===",cn,"){"),o(),e("}else{"),s(),e("}"))}(t.link(n),function(t){switch(t){case bi:case Mi:case Si:return 2;case xi:case ki:case Ei:return 3;case _i:case Ti:case Li:return 4;default:return 1}}(n.info.type),o)})}function E(t,r,n,i,a){for(var o,s=t.shared,l=s.gl,c=0;c<i.length;++c){var u,h=i[c],f=h.name,d=h.info.type,p=n.uniforms[f],m=t.link(h)+".location";if(p){if(!a(p))continue;if(rt(p)){var g=p.value;if(Mt.command(null!==g&&void 0!==g,'missing uniform "'+f+'"',t.commandStr),d===Di||d===zi){Mt.command("function"==typeof g&&(d===Di&&("texture2d"===g._reglType||"framebuffer"===g._reglType)||d===zi&&("textureCube"===g._reglType||"framebufferCube"===g._reglType)),"invalid texture for uniform "+f,t.commandStr);var v=t.link(g._texture||g.color[0]._texture);r(l,".uniform1i(",m,",",v+".bind());"),r.exit(v,".unbind();")}else if(d===Ci||d===Ii||d===Pi){Mt.optional(function(){Mt.command(O(g),"invalid matrix for uniform "+f,t.commandStr),Mt.command(d===Ci&&4===g.length||d===Ii&&9===g.length||d===Pi&&16===g.length,"invalid length for matrix uniform "+f,t.commandStr)});var y=t.global.def("new Float32Array(["+Array.prototype.slice.call(g)+"])"),b=2;d===Ii?b=3:d===Pi&&(b=4),r(l,".uniformMatrix",b,"fv(",m,",false,",y,");")}else{switch(d){case yi:Mt.commandType(g,"number","uniform "+f,t.commandStr),o="1f";break;case bi:Mt.command(O(g)&&2===g.length,"uniform "+f,t.commandStr),o="2f";break;case xi:Mt.command(O(g)&&3===g.length,"uniform "+f,t.commandStr),o="3f";break;case _i:Mt.command(O(g)&&4===g.length,"uniform "+f,t.commandStr),o="4f";break;case Ai:Mt.commandType(g,"boolean","uniform "+f,t.commandStr),o="1i";break;case wi:Mt.commandType(g,"number","uniform "+f,t.commandStr),o="1i";break;case Si:case Mi:Mt.command(O(g)&&2===g.length,"uniform "+f,t.commandStr),o="2i";break;case Ei:case ki:Mt.command(O(g)&&3===g.length,"uniform "+f,t.commandStr),o="3i";break;case Li:case Ti:Mt.command(O(g)&&4===g.length,"uniform "+f,t.commandStr),o="4i"}r(l,".uniform",o,"(",m,",",O(g)?Array.prototype.slice.call(g):g,");")}continue}u=p.append(t,r)}else{if(!a(ra))continue;u=r.def(s.uniforms,"[",e.id(f),"]")}d===Di?r("if(",u,"&&",u,'._reglType==="framebuffer"){',u,"=",u,".color[0];","}"):d===zi&&r("if(",u,"&&",u,'._reglType==="framebufferCube"){',u,"=",u,".color[0];","}"),Mt.optional(function(){function e(e,n){t.assert(r,e,'bad data or missing for uniform "'+f+'". '+n)}function n(t){e("typeof "+u+'==="'+t+'"',"invalid type, expected "+t)}function i(r,n){e(s.isArrayLike+"("+u+")&&"+u+".length==="+r,"invalid vector, should have length "+r,t.commandStr)}function a(r){e("typeof "+u+'==="function"&&'+u+'._reglType==="texture'+(r===si?"2d":"Cube")+'"',"invalid texture type",t.commandStr)}switch(d){case wi:n("number");break;case Mi:i(2);break;case ki:i(3);break;case Ti:i(4);break;case yi:n("number");break;case bi:i(2);break;case xi:i(3);break;case _i:i(4);break;case Ai:n("boolean");break;case Si:i(2);break;case Ei:i(3);break;case Li:case Ci:i(4);break;case Ii:i(9);break;case Pi:i(16);break;case Di:a(si);break;case zi:a(li)}});var x=1;switch(d){case Di:case zi:var _=r.def(u,"._texture");r(l,".uniform1i(",m,",",_,".bind());"),r.exit(_,".unbind();");continue;case wi:case Ai:o="1i";break;case Mi:case Si:o="2i",x=2;break;case ki:case Ei:o="3i",x=3;break;case Ti:case Li:o="4i",x=4;break;case yi:o="1f";break;case bi:o="2f",x=2;break;case xi:o="3f",x=3;break;case _i:o="4f",x=4;break;case Ci:o="Matrix2fv";break;case Ii:o="Matrix3fv";break;case Pi:o="Matrix4fv"}if(r(l,".uniform",o,"(",m,","),"M"===o.charAt(0)){var w=Math.pow(d-Ci+2,2),M=t.global.def("new Float32Array(",w,")");r("false,(Array.isArray(",u,")||",u," instanceof Float32Array)?",u,":(",T(w,function(t){return M+"["+t+"]="+u+"["+t+"]"}),",",M,")")}else r(x>1?T(x,function(t){return u+"["+t+"]"}):u);r(");")}}function L(t,e,r,n){function i(i){var a=u[i];return a?a.contextDep&&n.contextDynamic||a.propDep?a.append(t,r):a.append(t,e):e.def(c,".",i)}function a(){function t(){r(g,".drawElementsInstancedANGLE(",[f,p,v,d+"<<(("+v+"-"+ln+")>>1)",m],");")}function e(){r(g,".drawArraysInstancedANGLE(",[f,d,p,m],");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[f,p,v,d+"<<(("+v+"-"+ln+")>>1)"]+");")}function e(){r(l+".drawArrays("+[f,d,p]+");")}h?y?t():(r("if(",h,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,c=s.draw,u=n.draw,h=function(){var i,a=u.elements,o=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(o=r),i=a.append(t,o)):i=o.def(c,".",Wn),i&&o("if("+i+")"+l+".bindBuffer("+oi+","+i+".buffer.buffer);"),i}(),f=i(Xn),d=i(Jn),p=function(){var i,a=u.count,o=e;return a?((a.contextDep&&n.contextDynamic||a.propDep)&&(o=r),i=a.append(t,o),Mt.optional(function(){a.MISSING&&t.assert(e,"false","missing vertex count"),a.DYNAMIC&&t.assert(o,i+">=0","missing vertex count")})):(i=o.def(c,".",Zn),Mt.optional(function(){t.assert(o,i+">=0","missing vertex count")})),i}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var m,g;j&&(m=i(Kn),g=t.instancing);var v=h+".type",y=u.elements&&rt(u.elements);j&&("number"!=typeof m||m>=0)?"string"==typeof m?(r("if(",m,">0){"),a(),r("}else if(",m,"<0){"),o(),r("}")):a():o()}function C(t,e,r,n,i){var a=y(),o=a.proc("body",i);return Mt.optional(function(){a.commandStr=e.commandStr,a.command=a.link(e.commandStr)}),j&&(a.instancing=o.def(a.shared.extensions,".angle_instanced_arrays")),t(a,o,r,n),a.compile().body}function I(t,e,r,n){k(t,e),S(t,e,r,n.attributes,function(){return!0}),E(t,e,r,n.uniforms,function(){return!0}),L(t,e,e,r)}function P(t,e,r,n){function i(){return!0}t.batchId="a1",k(t,e),S(t,e,r,n.attributes,i),E(t,e,r,n.uniforms,i),L(t,e,e,r)}function D(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}k(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();if(e(c.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",u,"}",c.exit),r.needsContext&&x(t,u,r.context),r.needsFramebuffer&&_(t,u,r.framebuffer),M(t,u,r.state,i),r.profile&&i(r.profile)&&A(t,u,r,!1,!0),n)S(t,c,r,n.attributes,a),S(t,u,r,n.attributes,i),E(t,c,r,n.uniforms,a),E(t,u,r,n.uniforms,i),L(t,c,u,r);else{var h=t.global.def("{}"),f=r.shader.progVar.append(t,u),d=u.def(f,".id"),p=u.def(h,"[",d,"]");u(t.shared.gl,".useProgram(",f,".program);","if(!",p,"){",p,"=",h,"[",d,"]=",t.link(function(e){return C(P,t,r,e,2)}),"(",f,");}",p,".call(this,a0[",s,"],",s,");")}}function z(t,e,r){var n=e.static[r];if(n&&function(t){if("object"==typeof t&&!O(t)){for(var e=Object.keys(t),r=0;r<e.length;++r)if(At.isDynamic(t[e[r]]))return!0;return!1}}(n)){var i=t.global,a=Object.keys(n),o=!1,s=!1,l=!1,c=t.global.def("{}");a.forEach(function(e){var r=n[e];if(At.isDynamic(r)){"function"==typeof r&&(r=n[e]=At.unbox(r));var a=it(r,null);o=o||a.thisDep,l=l||a.propDep,s=s||a.contextDep}else{switch(i(c,".",e,"="),typeof r){case"number":i(r);break;case"string":i('"',r,'"');break;case"object":Array.isArray(r)&&i("[",r.join(),"]");break;default:i(t.link(r))}i(";")}}),e.dynamic[r]=new At.DynamicVariable(mn,{thisDep:o,contextDep:s,propDep:l,ref:c,append:function(t,e){a.forEach(function(r){var i=n[r];if(At.isDynamic(i)){var a=t.invoke(e,i);e(c,".",r,"=",a,";")}})}}),delete e.static[r]}}var F=c.Record,R={add:32774,subtract:32778,"reverse subtract":32779};r.ext_blend_minmax&&(R.min=Bi,R.max=Ui);var j=r.angle_instanced_arrays,N=r.webgl_draw_buffers,B={dirty:!0,profile:p.profile},U={},V=[],H={},q={};g(gn,hi),g(vn,ui),v(yn,"blendColor",[0,0,0,0]),v(bn,"blendEquationSeparate",[Yi,Yi]),v(xn,"blendFuncSeparate",[Gi,qi,Gi,qi]),g(_n,di,!0),v(wn,"depthFunc",Wi),v(Mn,"depthRange",[0,1]),v(kn,"depthMask",!0),v(Tn,Tn,[!0,!0,!0,!0]),g(An,ci),v(Sn,"cullFace",Ri),v(En,En,Ni),v(Ln,Ln,1),g(Cn,mi),v(In,"polygonOffset",[0,0]),g(Pn,gi),g(Dn,vi),v(zn,"sampleCoverage",[1,!1]),g(On,fi),v(Fn,"stencilMask",-1),v(Rn,"stencilFunc",[Vi,0,-1]),v(jn,"stencilOpSeparate",[Fi,Hi,Hi,Hi]),v(Nn,"stencilOpSeparate",[Ri,Hi,Hi,Hi]),g(Bn,pi),v(Un,"scissor",[0,0,t.drawingBufferWidth,t.drawingBufferHeight]),v(Vn,Vn,[0,0,t.drawingBufferWidth,t.drawingBufferHeight]);var G={gl:t,context:f,strings:e,next:U,current:B,draw:h,elements:a,buffer:i,shader:u,attributes:c.state,uniforms:l,framebuffer:s,extensions:r,timer:d,isBufferArgs:$},Y={primTypes:Jt,compareFuncs:Qi,blendFuncs:Ji,blendEquations:R,stencilOps:$i,glTypes:Ut,orientationType:ea};Mt.optional(function(){G.isArrayLike=O}),N&&(Y.backBuffer=[Ri],Y.drawBuffer=T(n.maxDrawbuffers,function(t){return 0===t?[0]:T(t,function(t){return Zi+t})}));var W=0;return{next:U,current:B,procs:function(){var e=y(),r=e.proc("poll"),i=e.proc("refresh"),a=e.block();r(a),i(a);var o=e.shared,s=o.gl,l=o.next,c=o.current;a(c,".dirty=false;"),_(e,r),_(e,i,null,!0);var u,h=t.getExtension("angle_instanced_arrays");h&&(u=e.link(h));for(var f=0;f<n.maxAttributes;++f){var d=i.def(o.attributes,"[",f,"]"),p=e.cond(d,".buffer");p.then(s,".enableVertexAttribArray(",f,");",s,".bindBuffer(",ai,",",d,".buffer.buffer);",s,".vertexAttribPointer(",f,",",d,".size,",d,".type,",d,".normalized,",d,".stride,",d,".offset);").else(s,".disableVertexAttribArray(",f,");",s,".vertexAttrib4f(",f,",",d,".x,",d,".y,",d,".z,",d,".w);",d,".buffer=null;"),i(p),h&&i(u,".vertexAttribDivisorANGLE(",f,",",d,".divisor);")}return Object.keys(H).forEach(function(t){var n=H[t],o=a.def(l,".",t),u=e.block();u("if(",o,"){",s,".enable(",n,")}else{",s,".disable(",n,")}",c,".",t,"=",o,";"),i(u),r("if(",o,"!==",c,".",t,"){",u,"}")}),Object.keys(q).forEach(function(t){var n,o,u=q[t],h=B[t],f=e.block();if(f(s,".",u,"("),O(h)){var d=h.length;n=e.global.def(l,".",t),o=e.global.def(c,".",t),f(T(d,function(t){return n+"["+t+"]"}),");",T(d,function(t){return o+"["+t+"]="+n+"["+t+"];"}).join("")),r("if(",T(d,function(t){return n+"["+t+"]!=="+o+"["+t+"]"}).join("||"),"){",f,"}")}else n=a.def(l,".",t),o=a.def(c,".",t),f(n,");",c,".",t,"=",n,";"),r("if(",n,"!==",o,"){",f,"}");i(f)}),e.compile()}(),compile:function(t,r,n,i,a){var o=y();o.stats=o.link(a),Object.keys(r.static).forEach(function(t){z(o,r,t)}),ii.forEach(function(e){z(o,t,e)});var s=b(t,r,n,i,o);return function(t,e){var r=t.proc("draw",1);k(t,r),x(t,r,e.context),_(t,r,e.framebuffer),w(t,r,e),M(t,r,e.state),A(t,r,e,!1,!0);var n=e.shader.progVar.append(t,r);if(r(t.shared.gl,".useProgram(",n,".program);"),e.shader.program)I(t,r,e,e.shader.program);else{var i=t.global.def("{}"),a=r.def(n,".id"),o=r.def(i,"[",a,"]");r(t.cond(o).then(o,".call(this,a0);").else(o,"=",i,"[",a,"]=",t.link(function(r){return C(I,t,e,r,1)}),"(",n,");",o,".call(this,a0);"))}Object.keys(e.state).length>0&&r(t.shared.current,".dirty=true;")}(o,s),function(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;x(t,i,r.context),r.framebuffer&&r.framebuffer.append(t,i),tt(Object.keys(r.state)).forEach(function(e){var n=r.state[e].append(t,i);O(n)?n.forEach(function(r,n){i.set(t.next[e],"["+n+"]",r)}):i.set(a.next,"."+e,n)}),A(t,i,r,!0,!0),[Wn,Jn,Zn,Kn,Xn].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 F).forEach(function(t){i.set(a,"."+t,n[t])})}),n(Gn),n(Yn),Object.keys(r.state).length>0&&(i(o,".dirty=true;"),i.exit(o,".dirty=true;")),i("a1(",t.shared.context,",a0,",t.batchId,");")}(o,s),function(t,e){function r(t){return t.contextDep&&i||t.propDep}var n=t.proc("batch",2);t.batchId="0",k(t,n);var i=!1,a=!0;Object.keys(e.context).forEach(function(t){i=i||e.context[t].propDep}),i||(x(t,n,e.context),a=!1);var o=e.framebuffer,s=!1;o?(o.propDep?i=s=!0:o.contextDep&&i&&(s=!0),s||_(t,n,o)):_(t,n,null),e.state.viewport&&e.state.viewport.propDep&&(i=!0),w(t,n,e),M(t,n,e.state,function(t){return!r(t)}),e.profile&&r(e.profile)||A(t,n,e,!1,"a1"),e.contextDep=i,e.needsContext=a,e.needsFramebuffer=s;var l=e.shader.progVar;if(l.contextDep&&i||l.propDep)D(t,n,e,null);else{var c=l.append(t,n);if(n(t.shared.gl,".useProgram(",c,".program);"),e.shader.program)D(t,n,e,e.shader.program);else{var u=t.global.def("{}"),h=n.def(c,".id"),f=n.def(u,"[",h,"]");n(t.cond(f).then(f,".call(this,a0,a1);").else(f,"=",u,"[",h,"]=",t.link(function(r){return C(D,t,e,r,2)}),"(",c,");",f,".call(this,a0,a1);"))}}Object.keys(e.state).length>0&&n(t.shared.current,".dirty=true;")}(o,s),o.compile()}}}function ot(t,e){for(var r=0;r<t.length;++r)if(t[r]===e)return r;return-1}var st={"[object Int8Array]":5120,"[object Int16Array]":5122,"[object Int32Array]":5124,"[object Uint8Array]":5121,"[object Uint8ClampedArray]":5121,"[object Uint16Array]":5123,"[object Uint32Array]":5125,"[object Float32Array]":5126,"[object Float64Array]":5121,"[object ArrayBuffer]":5121},lt=function(t){return Object.prototype.toString.call(t)in st},ct=function(t,e){for(var r=Object.keys(e),n=0;n<r.length;++n)t[r[n]]=e[r[n]];return t},ut=["gl","canvas","container","attributes","pixelRatio","extensions","optionalExtensions","profile","onDone"],ht=33071,ft=9728,dt=9984,pt=9985,mt=9986,gt=9987,vt=5126,yt=32819,bt=32820,xt=33635,_t=34042,wt={};wt[5120]=wt[5121]=1,wt[5122]=wt[5123]=wt[36193]=wt[xt]=wt[yt]=wt[bt]=2,wt[5124]=wt[5125]=wt[vt]=wt[_t]=4;var Mt=ct(r,{optional:function(t){t()},raise:e,commandRaise:d,command:function(t,e,r){t||d(e,r||c())},parameter:function(t,r,i){t in r||e("unknown parameter ("+t+")"+n(i)+". possible values: "+Object.keys(r).join())},commandParameter:function(t,e,r,i){t in e||d("unknown parameter ("+t+")"+n(r)+". possible values: "+Object.keys(e).join(),i||c())},constructor:function(t){Object.keys(t).forEach(function(t){ut.indexOf(t)<0&&e('invalid regl constructor argument "'+t+'". must be one of '+ut)})},type:function(t,r,i){typeof t!==r&&e("invalid parameter type"+n(i)+". expected "+r+", got "+typeof t)},commandType:p,isTypedArray:function(t,r){lt(t)||e("invalid parameter type"+n(r)+". must be a typed array")},nni:function(t,r){t>=0&&(0|t)===t||e("invalid parameter type, ("+t+")"+n(r)+". must be a nonnegative integer")},oneOf:i,shaderError:function(t,e,n,i,o){if(!t.getShaderParameter(e,t.COMPILE_STATUS)){var s=t.getShaderInfoLog(e),c=i===t.FRAGMENT_SHADER?"fragment":"vertex";p(n,"string",c+" shader source must be a string",o);var u=h(n,o),f=function(t){var e=[];return t.split("\n").forEach(function(t){if(!(t.length<5)){var r=/^ERROR\:\s+(\d+)\:(\d+)\:\s*(.*)$/.exec(t);r?e.push(new l(0|r[1],0|r[2],r[3].trim())):t.length>0&&e.push(new l("unknown",0,t))}}),e}(s);!function(t,e){e.forEach(function(e){var r=t[e.file];if(r){var n=r.index[e.line];if(n)return n.errors.push(e),void(r.hasErrors=!0)}t.unknown.hasErrors=!0,t.unknown.lines[0].errors.push(e)})}(u,f),Object.keys(u).forEach(function(t){function e(t,e){n.push(t),i.push(e||"")}var r=u[t];if(r.hasErrors){var n=[""],i=[""];e("file number "+t+": "+r.name+"\n","color:red;text-decoration:underline;font-weight:bold"),r.lines.forEach(function(t){if(t.errors.length>0){e(a(t.number,4)+"| ","background-color:yellow; font-weight:bold"),e(t.line+"\n","color:red; background-color:yellow; font-weight:bold");var r=0;t.errors.forEach(function(n){var i=n.message,o=/^\s*\'(.*)\'\s*\:\s*(.*)$/.exec(i);if(o){var s=o[1];switch(i=o[2],s){case"assign":s="="}r=Math.max(t.line.indexOf(s,r),0)}else r=0;e(a("| ",6)),e(a("^^^",r+3)+"\n","font-weight:bold"),e(a("| ",6)),e(i+"\n","font-weight:bold")}),e(a("| ",6)+"\n")}else e(a(t.number,4)+"| "),e(t.line+"\n","color:red")}),"undefined"!=typeof document?(i[0]=n.join("%c"),console.log.apply(console,i)):console.log(n.join(""))}}),r.raise("Error compiling "+c+" shader, "+u[0].name)}},linkError:function(t,e,n,i,a){if(!t.getProgramParameter(e,t.LINK_STATUS)){var o=t.getProgramInfoLog(e),s=h(n,a),l='Error linking program with vertex shader, "'+h(i,a)[0].name+'", and fragment shader "'+s[0].name+'"';"undefined"!=typeof document?console.log("%c"+l+"\n%c"+o,"color:red;text-decoration:underline;font-weight:bold","color:red"):console.log(l+"\n"+o),r.raise(l)}},callSite:u,saveCommandRef:f,saveDrawInfo:function(t,e,r,n){function i(t){return t?n.id(t):0}function a(t,e){Object.keys(e).forEach(function(e){t[n.id(e)]=!0})}f(t),t._fragId=i(t.static.frag),t._vertId=i(t.static.vert);var o=t._uniformSet={};a(o,e.static),a(o,e.dynamic);var s=t._attributeSet={};a(s,r.static),a(s,r.dynamic),t._hasCount="count"in t.static||"count"in t.dynamic||"elements"in t.static||"elements"in t.dynamic},framebufferFormat:function(t,e,r){t.texture?i(t.texture._texture.internalformat,e,"unsupported texture format for attachment"):i(t.renderbuffer._renderbuffer.format,r,"unsupported renderbuffer format for attachment")},guessCommand:c,texture2D:function(t,e,n){var i,a=e.width,o=e.height,s=e.channels;r(a>0&&a<=n.maxTextureSize&&o>0&&o<=n.maxTextureSize,"invalid texture shape"),t.wrapS===ht&&t.wrapT===ht||r(g(a)&&g(o),"incompatible wrap mode for texture, both width and height must be power of 2"),1===e.mipmask?1!==a&&1!==o&&r(t.minFilter!==dt&&t.minFilter!==mt&&t.minFilter!==pt&&t.minFilter!==gt,"min filter requires mipmap"):(r(g(a)&&g(o),"texture must be a square power of 2 to support mipmapping"),r(e.mipmask===(a<<1)-1,"missing or incomplete mipmap data")),e.type===vt&&(n.extensions.indexOf("oes_texture_float_linear")<0&&r(t.minFilter===ft&&t.magFilter===ft,"filter not supported, must enable oes_texture_float_linear"),r(!t.genMipmaps,"mipmap generation not supported with float textures"));var l=e.images;for(i=0;i<16;++i)if(l[i]){var c=a>>i,u=o>>i;r(e.mipmask&1<<i,"missing mipmap data");var h=l[i];if(r(h.width===c&&h.height===u,"invalid shape for mip images"),r(h.format===e.format&&h.internalformat===e.internalformat&&h.type===e.type,"incompatible type for mip image"),h.compressed);else if(h.data){var f=Math.ceil(m(h.type,s)*c/h.unpackAlignment)*h.unpackAlignment;r(h.data.byteLength===f*u,"invalid data for image, buffer size is inconsistent with image format")}else h.element||h.copy}else t.genMipmaps||r(0==(e.mipmask&1<<i),"extra mipmap data");e.compressed&&r(!t.genMipmaps,"mipmap generation for compressed images not supported")},textureCube:function(t,e,n,i){var a=t.width,o=t.height,s=t.channels;r(a>0&&a<=i.maxTextureSize&&o>0&&o<=i.maxTextureSize,"invalid texture shape"),r(a===o,"cube map must be square"),r(e.wrapS===ht&&e.wrapT===ht,"wrap mode not supported by cube map");for(var l=0;l<n.length;++l){var c=n[l];r(c.width===a&&c.height===o,"inconsistent cube map face shape"),e.genMipmaps&&(r(!c.compressed,"can not generate mipmap for compressed textures"),r(1===c.mipmask,"can not specify mipmaps and generate mipmaps"));for(var u=c.images,h=0;h<16;++h){var f=u[h];if(f){var d=a>>h,p=o>>h;r(c.mipmask&1<<h,"missing mipmap data"),r(f.width===d&&f.height===p,"invalid shape for mip images"),r(f.format===t.format&&f.internalformat===t.internalformat&&f.type===t.type,"incompatible type for mip image"),f.compressed||(f.data?r(f.data.byteLength===d*p*Math.max(m(f.type,s),f.unpackAlignment),"invalid data for image, buffer size is inconsistent with image format"):f.element||f.copy)}}}}}),kt=0,Tt=0,At={DynamicVariable:v,define:function(t,e){return new v(t,x(e+""))},isDynamic:function(t){return"function"==typeof t&&!t._reglType||t instanceof v},unbox:function(t,e){return"function"==typeof t?new v(Tt,t):t},accessor:x},St={next:"function"==typeof requestAnimationFrame?function(t){return requestAnimationFrame(t)}:function(t){return setTimeout(t,16)},cancel:"function"==typeof cancelAnimationFrame?function(t){return cancelAnimationFrame(t)}:clearTimeout},Et="undefined"!=typeof performance&&performance.now?function(){return performance.now()}:function(){return+new Date},Lt=function(t,e){var r=1;e.ext_texture_filter_anisotropic&&(r=t.getParameter(34047));var n=1,i=1;return e.webgl_draw_buffers&&(n=t.getParameter(34852),i=t.getParameter(36063)),{colorBits:[t.getParameter(3410),t.getParameter(3411),t.getParameter(3412),t.getParameter(3413)],depthBits:t.getParameter(3414),stencilBits:t.getParameter(3415),subpixelBits:t.getParameter(3408),extensions:Object.keys(e).filter(function(t){return!!e[t]}),maxAnisotropic:r,maxDrawbuffers:n,maxColorAttachments:i,pointSizeDims:t.getParameter(33901),lineWidthDims:t.getParameter(33902),maxViewportDims:t.getParameter(3386),maxCombinedTextureUnits:t.getParameter(35661),maxCubeMapSize:t.getParameter(34076),maxRenderbufferSize:t.getParameter(34024),maxTextureUnits:t.getParameter(34930),maxTextureSize:t.getParameter(3379),maxAttributes:t.getParameter(34921),maxVertexUniforms:t.getParameter(36347),maxVertexTextureUnits:t.getParameter(35660),maxVaryingVectors:t.getParameter(36348),maxFragmentUniforms:t.getParameter(36349),glsl:t.getParameter(35724),renderer:t.getParameter(7937),vendor:t.getParameter(7936),version:t.getParameter(7938)}},Ct=function(t){return Object.keys(t).map(function(e){return t[e]})},It=5120,Pt=5121,Dt=5122,zt=5123,Ot=5124,Ft=5125,Rt=5126,jt=T(8,function(){return[]}),Nt={alloc:S,free:E,allocType:function(t,e){var r=null;switch(t){case It:r=new Int8Array(S(e),0,e);break;case Pt:r=new Uint8Array(S(e),0,e);break;case Dt:r=new Int16Array(S(2*e),0,e);break;case zt:r=new Uint16Array(S(2*e),0,e);break;case Ot:r=new Int32Array(S(4*e),0,e);break;case Ft:r=new Uint32Array(S(4*e),0,e);break;case Rt:r=new Float32Array(S(4*e),0,e);break;default:return null}return r.length!==e?r.subarray(0,e):r},freeType:function(t){E(t.buffer)}},Bt={shape:function(t){for(var e=[],r=t;r.length;r=r[0])e.push(r.length);return e},flatten:function(t,e,r,n){var i=1;if(e.length)for(var a=0;a<e.length;++a)i*=e[a];else i=0;var o=n||Nt.allocType(r,i);switch(e.length){case 0:break;case 1:!function(t,e,r){for(var n=0;n<e;++n)r[n]=t[n]}(t,e[0],o);break;case 2:!function(t,e,r,n){for(var i=0,a=0;a<e;++a)for(var o=t[a],s=0;s<r;++s)n[i++]=o[s]}(t,e[0],e[1],o);break;case 3:L(t,e[0],e[1],e[2],o,0);break;default:C(t,e,0,o,0)}return o}},Ut={int8:5120,int16:5122,int32:5124,uint8:5121,uint16:5123,uint32:5125,float:5126,float32:5126},Vt={dynamic:35048,stream:35040,static:35044},Ht=Bt.flatten,qt=Bt.shape,Gt=35044,Yt=35040,Wt=5121,Xt=5126,Zt=[];Zt[5120]=1,Zt[5122]=2,Zt[5124]=4,Zt[5121]=1,Zt[5123]=2,Zt[5125]=4,Zt[5126]=4;var Jt={points:0,point:0,lines:1,line:1,triangles:4,triangle:4,"line loop":2,"line strip":3,"triangle strip":5,"triangle fan":6},Kt=0,Qt=1,$t=4,te=5120,ee=5121,re=5122,ne=5123,ie=5124,ae=5125,oe=34963,se=35040,le=35044,ce=new Float32Array(1),ue=new Uint32Array(ce.buffer),he=5123,fe=34467,de=3553,pe=34067,me=34069,ge=6408,ve=6406,ye=6407,be=6409,xe=6410,_e=32854,we=32855,Me=36194,ke=32819,Te=32820,Ae=33635,Se=34042,Ee=6402,Le=34041,Ce=35904,Ie=35906,Pe=36193,De=33776,ze=33777,Oe=33778,Fe=33779,Re=35986,je=35987,Ne=34798,Be=35840,Ue=35841,Ve=35842,He=35843,qe=36196,Ge=5121,Ye=5123,We=5125,Xe=5126,Ze=10242,Je=10243,Ke=10497,Qe=33071,$e=33648,tr=10240,er=10241,rr=9728,nr=9729,ir=9984,ar=9985,or=9986,sr=9987,lr=33170,cr=4352,ur=4353,hr=4354,fr=34046,dr=3317,pr=37440,mr=37441,gr=37443,vr=37444,yr=33984,br=[ir,or,ar,sr],xr=[0,be,xe,ye,ge],_r={};_r[be]=_r[ve]=_r[Ee]=1,_r[Le]=_r[xe]=2,_r[ye]=_r[Ce]=3,_r[ge]=_r[Ie]=4;var wr=F("HTMLCanvasElement"),Mr=F("CanvasRenderingContext2D"),kr=F("HTMLImageElement"),Tr=F("HTMLVideoElement"),Ar=Object.keys(st).concat([wr,Mr,kr,Tr]),Sr=[];Sr[Ge]=1,Sr[Xe]=4,Sr[Pe]=2,Sr[Ye]=2,Sr[We]=4;var Er=[];Er[_e]=2,Er[we]=2,Er[Me]=2,Er[Le]=4,Er[De]=.5,Er[ze]=.5,Er[Oe]=1,Er[Fe]=1,Er[Re]=.5,Er[je]=1,Er[Ne]=1,Er[Be]=.5,Er[Ue]=.25,Er[Ve]=.5,Er[He]=.25,Er[qe]=.5;var Lr=36161,Cr=32854,Ir=[];Ir[Cr]=2,Ir[32855]=2,Ir[36194]=2,Ir[33189]=2,Ir[36168]=1,Ir[34041]=4,Ir[35907]=4,Ir[34836]=16,Ir[34842]=8,Ir[34843]=6;var Pr=function(t,e,r,n,i){function a(t){this.id=c++,this.refCount=1,this.renderbuffer=t,this.format=Cr,this.width=0,this.height=0,i.profile&&(this.stats={size:0})}function o(e){var r=e.renderbuffer;Mt(r,"must not double destroy renderbuffer"),t.bindRenderbuffer(Lr,null),t.deleteRenderbuffer(r),e.renderbuffer=null,e.refCount=0,delete u[e.id],n.renderbufferCount--}var s={rgba4:Cr,rgb565:36194,"rgb5 a1":32855,depth:33189,stencil:36168,"depth stencil":34041};e.ext_srgb&&(s.srgba=35907),e.ext_color_buffer_half_float&&(s.rgba16f=34842,s.rgb16f=34843),e.webgl_color_buffer_float&&(s.rgba32f=34836);var l=[];Object.keys(s).forEach(function(t){var e=s[t];l[e]=t});var c=0,u={};return a.prototype.decRef=function(){--this.refCount<=0&&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,o){function c(e,n){var a=0,o=0,u=Cr;if("object"==typeof e&&e){var f=e;if("shape"in f){var d=f.shape;Mt(Array.isArray(d)&&d.length>=2,"invalid renderbuffer shape"),a=0|d[0],o=0|d[1]}else"radius"in f&&(a=o=0|f.radius),"width"in f&&(a=0|f.width),"height"in f&&(o=0|f.height);"format"in f&&(Mt.parameter(f.format,s,"invalid renderbuffer format"),u=s[f.format])}else"number"==typeof e?(a=0|e,o="number"==typeof n?0|n:a):e?Mt.raise("invalid arguments to renderbuffer constructor"):a=o=1;if(Mt(a>0&&o>0&&a<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),a!==h.width||o!==h.height||u!==h.format)return c.width=h.width=a,c.height=h.height=o,h.format=u,t.bindRenderbuffer(Lr,h.renderbuffer),t.renderbufferStorage(Lr,u,a,o),i.profile&&(h.stats.size=W(h.format,h.width,h.height)),c.format=l[h.format],c}var h=new a(t.createRenderbuffer());return u[h.id]=h,n.renderbufferCount++,c(e,o),c.resize=function(e,n){var a=0|e,o=0|n||a;return a===h.width&&o===h.height?c:(Mt(a>0&&o>0&&a<=r.maxRenderbufferSize&&o<=r.maxRenderbufferSize,"invalid renderbuffer size"),c.width=h.width=a,c.height=h.height=o,t.bindRenderbuffer(Lr,h.renderbuffer),t.renderbufferStorage(Lr,h.format,a,o),i.profile&&(h.stats.size=W(h.format,h.width,h.height)),c)},c._reglType="renderbuffer",c._renderbuffer=h,i.profile&&(c.stats=h.stats),c.destroy=function(){h.decRef()},c},clear:function(){Ct(u).forEach(o)},restore:function(){Ct(u).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(Lr,e.renderbuffer),t.renderbufferStorage(Lr,e.format,e.width,e.height)}),t.bindRenderbuffer(Lr,null)}}},Dr=36160,zr=36161,Or=3553,Fr=34069,Rr=36064,jr=36096,Nr=36128,Br=33306,Ur=36053,Vr=6402,Hr=[6408],qr=[];qr[6408]=4;var Gr=[];Gr[5121]=1,Gr[5126]=4,Gr[36193]=2;var Yr=33189,Wr=36168,Xr=34041,Zr=[32854,32855,36194,35907,34842,34843,34836],Jr={};Jr[Ur]="complete",Jr[36054]="incomplete attachment",Jr[36057]="incomplete dimensions",Jr[36055]="incomplete, missing attachment",Jr[36061]="unsupported";var Kr=5126,Qr=35632,$r=35633,tn=35718,en=35721,rn=6408,nn=5121,an=3333,on=5126,sn="xyzw".split(""),ln=5121,cn=1,un=2,hn=0,fn=1,dn=2,pn=3,mn=4,gn="dither",vn="blend.enable",yn="blend.color",bn="blend.equation",xn="blend.func",_n="depth.enable",wn="depth.func",Mn="depth.range",kn="depth.mask",Tn="colorMask",An="cull.enable",Sn="cull.face",En="frontFace",Ln="lineWidth",Cn="polygonOffset.enable",In="polygonOffset.offset",Pn="sample.alpha",Dn="sample.enable",zn="sample.coverage",On="stencil.enable",Fn="stencil.mask",Rn="stencil.func",jn="stencil.opFront",Nn="stencil.opBack",Bn="scissor.enable",Un="scissor.box",Vn="viewport",Hn="profile",qn="framebuffer",Gn="vert",Yn="frag",Wn="elements",Xn="primitive",Zn="count",Jn="offset",Kn="instances",Qn=qn+"Width",$n=qn+"Height",ti=Vn+"Width",ei=Vn+"Height",ri="drawingBufferWidth",ni="drawingBufferHeight",ii=[xn,bn,Rn,jn,Nn,zn,Vn,Un,In],ai=34962,oi=34963,si=3553,li=34067,ci=2884,ui=3042,hi=3024,fi=2960,di=2929,pi=3089,mi=32823,gi=32926,vi=32928,yi=5126,bi=35664,xi=35665,_i=35666,wi=5124,Mi=35667,ki=35668,Ti=35669,Ai=35670,Si=35671,Ei=35672,Li=35673,Ci=35674,Ii=35675,Pi=35676,Di=35678,zi=35680,Oi=4,Fi=1028,Ri=1029,ji=2304,Ni=2305,Bi=32775,Ui=32776,Vi=519,Hi=7680,qi=0,Gi=1,Yi=32774,Wi=513,Xi=36160,Zi=36064,Ji={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},Ki=["constant color, constant alpha","one minus constant color, constant alpha","constant color, one minus constant alpha","one minus constant color, one minus constant alpha","constant alpha, constant color","constant alpha, one minus constant color","one minus constant alpha, constant color","one minus constant alpha, one minus constant color"],Qi={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},$i={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},ta={frag:35632,vert:35633},ea={cw:ji,ccw:Ni},ra=new et(!1,!1,!1,function(){}),na=34918,ia=34919,aa=35007,oa=function(t,e){function r(t){o.push(t)}function n(t){l.push(t)}function i(t,e,r){var n=l.pop()||new function(){this.startQueryIndex=-1,this.endQueryIndex=-1,this.sum=0,this.stats=null};n.startQueryIndex=t,n.endQueryIndex=e,n.sum=0,n.stats=r,c.push(n)}var a=e.ext_disjoint_timer_query;if(!a)return null;var o=[],s=[],l=[],c=[],u=[],h=[];return{beginQuery:function(t){var e=o.pop()||a.createQueryEXT();a.beginQueryEXT(aa,e),s.push(e),i(s.length-1,s.length,t)},endQuery:function(){a.endQueryEXT(aa)},pushScopeStats:i,update:function(){var t,e,i=s.length;if(0!==i){h.length=Math.max(h.length,i+1),u.length=Math.max(u.length,i+1),u[0]=0,h[0]=0;var o=0;for(t=0,e=0;e<s.length;++e){var l=s[e];a.getQueryObjectEXT(l,ia)?(o+=a.getQueryObjectEXT(l,na),r(l)):s[t++]=l,u[e+1]=o,h[e+1]=t}for(s.length=t,t=0,e=0;e<c.length;++e){var f=c[e],d=f.startQueryIndex,p=f.endQueryIndex;f.sum+=u[p]-u[d];var m=h[d],g=h[p];g===m?(f.stats.gpuTime+=f.sum/1e6,n(f)):(f.startQueryIndex=m,f.endQueryIndex=g,c[t++]=f)}c.length=t}},getNumPendingQueries:function(){return s.length},clear:function(){o.push.apply(o,s);for(var t=0;t<o.length;t++)a.deleteQueryEXT(o[t]);s.length=0,o.length=0},restore:function(){s.length=0,o.length=0}}},sa=16384,la=256,ca=1024,ua=34962,ha="webglcontextlost",fa="webglcontextrestored",da=1,pa=2,ma=3;return function(t){function e(){if(0===H.length)return _&&_.update(),void(K=null);K=St.next(e),u();for(var t=H.length-1;t>=0;--t){var r=H[t];r&&r(S,null,0)}p.flush(),_&&_.update()}function r(){!K&&H.length>0&&(K=St.next(e))}function n(){K&&(St.cancel(e),K=null)}function i(t){t.preventDefault(),g=!0,n(),q.forEach(function(t){t()})}function a(t){p.getError(),g=!1,v.restore(),O.restore(),L.restore(),F.restore(),R.restore(),j.restore(),_&&_.restore(),N.procs.refresh(),r(),G.forEach(function(t){t()})}function o(t){function e(t){var e={},r={};return Object.keys(t).forEach(function(n){var i=t[n];At.isDynamic(i)?r[n]=At.unbox(i,n):e[n]=i}),{dynamic:r,static:e}}Mt(!!t,"invalid args to regl({...})"),Mt.type(t,"object","invalid args to regl({...})");var r=e(t.context||{}),n=e(t.uniforms||{}),i=e(t.attributes||{}),a=e(function(t){function e(t){if(t in r){var e=r[t];delete r[t],Object.keys(e).forEach(function(n){r[t+"."+n]=e[n]})}}var r=ct({},t);return delete r.uniforms,delete r.attributes,delete r.context,"stencil"in r&&r.stencil.op&&(r.stencil.opBack=r.stencil.opFront=r.stencil.op,delete r.stencil.op),e("blend"),e("depth"),e("cull"),e("stencil"),e("polygonOffset"),e("scissor"),e("sample"),r}(t)),o={gpuTime:0,cpuTime:0,count:0},s=N.compile(a,i,n,r,o),l=s.draw,c=s.batch,u=s.scope,h=[];return ct(function(t,e){var r;if(g&&Mt.raise("context lost"),"function"==typeof t)return u.call(this,null,t,0);if("function"==typeof e){if("number"==typeof t){for(r=0;r<t;++r)u.call(this,null,e,r);return}if(Array.isArray(t)){for(r=0;r<t.length;++r)u.call(this,t[r],e,r);return}return u.call(this,t,e,0)}if("number"==typeof t){if(t>0)return c.call(this,function(t){for(;h.length<t;)h.push(null);return h}(0|t),0|t)}else{if(!Array.isArray(t))return l.call(this,t);if(t.length)return c.call(this,t,t.length)}},{stats:o})}function s(t,e){var r=0;N.procs.poll();var n=e.color;n&&(p.clearColor(+n[0]||0,+n[1]||0,+n[2]||0,+n[3]||0),r|=sa),"depth"in e&&(p.clearDepth(+e.depth),r|=la),"stencil"in e&&(p.clearStencil(0|e.stencil),r|=ca),Mt(!!r,"called regl.clear with no buffer specified"),p.clear(r)}function l(t){return Mt.type(t,"function","regl.frame() callback must be a function"),H.push(t),r(),{cancel:function(){function e(){var t=ot(H,e);H[t]=H[H.length-1],H.length-=1,H.length<=0&&n()}var r=ot(H,t);Mt(r>=0,"cannot cancel a frame twice"),H[r]=e}}}function c(){var t=U.viewport,e=U.scissor_box;t[0]=t[1]=e[0]=e[1]=0,S.viewportWidth=S.framebufferWidth=S.drawingBufferWidth=t[2]=e[2]=p.drawingBufferWidth,S.viewportHeight=S.framebufferHeight=S.drawingBufferHeight=t[3]=e[3]=p.drawingBufferHeight}function u(){S.tick+=1,S.time=f(),c(),N.procs.poll()}function h(){c(),N.procs.refresh(),_&&_.update()}function f(){return(Et()-w)/1e3}var d=M(t);if(!d)return null;var p=d.gl,m=p.getContextAttributes(),g=p.isContextLost(),v=function(t,e){function r(e){Mt.type(e,"string","extension name must be string");var r,i=e.toLowerCase();try{r=n[i]=t.getExtension(i)}catch(t){}return!!r}for(var n={},i=0;i<e.extensions.length;++i){var a=e.extensions[i];if(!r(a))return e.onDestroy(),e.onDone('"'+a+'" extension is not supported by the current WebGL context, try upgrading your system or a different browser'),null}return e.optionalExtensions.forEach(r),{extensions:n,restore:function(){Object.keys(n).forEach(function(t){if(!r(t))throw new Error("(regl): error restoring extension "+t)})}}}(p,d);if(!v)return null;var y=function(){var t={"":0},e=[""];return{id:function(r){var n=t[r];return n||(n=t[r]=e.length,e.push(r),n)},str:function(t){return e[t]}}}(),b={bufferCount:0,elementsCount:0,framebufferCount:0,shaderCount:0,textureCount:0,cubeCount:0,renderbufferCount:0,maxTextureUnits:0},x=v.extensions,_=oa(p,x),w=Et(),T=p.drawingBufferWidth,A=p.drawingBufferHeight,S={tick:0,time:0,viewportWidth:T,viewportHeight:A,framebufferWidth:T,framebufferHeight:A,drawingBufferWidth:T,drawingBufferHeight:A,pixelRatio:d.pixelRatio},E=Lt(p,x),L=function(t,e,r){function n(e){this.id=s++,this.buffer=t.createBuffer(),this.type=e,this.usage=Gt,this.byteLength=0,this.dimension=1,this.dtype=Wt,this.persistentData=null,r.profile&&(this.stats={size:0})}function i(e,r,n){e.byteLength=r.byteLength,t.bufferData(e.type,r,n)}function a(t,e,r,n,a,o){var s;if(t.usage=r,Array.isArray(e)){if(t.dtype=n||Xt,e.length>0){var l;if(Array.isArray(e[0])){s=qt(e);for(var c=1,u=1;u<s.length;++u)c*=s[u];t.dimension=c,i(t,l=Ht(e,s,t.dtype),r),o?t.persistentData=l:Nt.freeType(l)}else if("number"==typeof e[0]){t.dimension=a;var h=Nt.allocType(t.dtype,e.length);P(h,e),i(t,h,r),o?t.persistentData=h:Nt.freeType(h)}else lt(e[0])?(t.dimension=e[0].length,t.dtype=n||I(e[0])||Xt,i(t,l=Ht(e,[e.length,e[0].length],t.dtype),r),o?t.persistentData=l:Nt.freeType(l)):Mt.raise("invalid buffer data")}}else if(lt(e))t.dtype=n||I(e),t.dimension=a,i(t,e,r),o&&(t.persistentData=new Uint8Array(new Uint8Array(e.buffer)));else if(k(e)){s=e.shape;var f=e.stride,d=e.offset,p=0,m=0,g=0,v=0;1===s.length?(p=s[0],m=1,g=f[0],v=0):2===s.length?(p=s[0],m=s[1],g=f[0],v=f[1]):Mt.raise("invalid shape"),t.dtype=n||I(e.data)||Xt,t.dimension=m;var y=Nt.allocType(t.dtype,p*m);D(y,e.data,p,m,g,v,d),i(t,y,r),o?t.persistentData=y:Nt.freeType(y)}else Mt.raise("invalid buffer data")}function o(r){e.bufferCount--;var n=r.buffer;Mt(n,"buffer must not be deleted already"),t.deleteBuffer(n),r.buffer=null,delete l[r.id]}var s=0,l={};n.prototype.bind=function(){t.bindBuffer(this.type,this.buffer)},n.prototype.destroy=function(){o(this)};var c=[];return r.profile&&(e.getTotalBufferSize=function(){var t=0;return Object.keys(l).forEach(function(e){t+=l[e].stats.size}),t}),{create:function(i,s,c,u){function h(e){var n=Gt,i=null,o=0,s=0,l=1;return Array.isArray(e)||lt(e)||k(e)?i=e:"number"==typeof e?o=0|e:e&&(Mt.type(e,"object","buffer arguments must be an object, a number or an array"),"data"in e&&(Mt(null===i||Array.isArray(i)||lt(i)||k(i),"invalid data for buffer"),i=e.data),"usage"in e&&(Mt.parameter(e.usage,Vt,"invalid buffer usage"),n=Vt[e.usage]),"type"in e&&(Mt.parameter(e.type,Ut,"invalid buffer type"),s=Ut[e.type]),"dimension"in e&&(Mt.type(e.dimension,"number","invalid dimension"),l=0|e.dimension),"length"in e&&(Mt.nni(o,"buffer length must be a nonnegative integer"),o=0|e.length)),d.bind(),i?a(d,i,n,s,l,u):(t.bufferData(d.type,o,n),d.dtype=s||Wt,d.usage=n,d.dimension=l,d.byteLength=o),r.profile&&(d.stats.size=d.byteLength*Zt[d.dtype]),h}function f(e,r){Mt(r+e.byteLength<=d.byteLength,"invalid buffer subdata call, buffer is too small. Can't write data of size "+e.byteLength+" starting from offset "+r+" to a buffer of size "+d.byteLength),t.bufferSubData(d.type,r,e)}e.bufferCount++;var d=new n(s);return l[d.id]=d,c||h(i),h._reglType="buffer",h._buffer=d,h.subdata=function(t,e){var r,n=0|(e||0);if(d.bind(),Array.isArray(t)){if(t.length>0)if("number"==typeof t[0]){var i=Nt.allocType(d.dtype,t.length);P(i,t),f(i,n),Nt.freeType(i)}else if(Array.isArray(t[0])||lt(t[0])){r=qt(t);var a=Ht(t,r,d.dtype);f(a,n),Nt.freeType(a)}else Mt.raise("invalid buffer data")}else if(lt(t))f(t,n);else if(k(t)){r=t.shape;var o=t.stride,s=0,l=0,c=0,u=0;1===r.length?(s=r[0],l=1,c=o[0],u=0):2===r.length?(s=r[0],l=r[1],c=o[0],u=o[1]):Mt.raise("invalid shape");var p=Array.isArray(t.data)?d.dtype:I(t.data),m=Nt.allocType(p,s*l);D(m,t.data,s,l,c,u,t.offset),f(m,n),Nt.freeType(m)}else Mt.raise("invalid data for buffer subdata");return h},r.profile&&(h.stats=d.stats),h.destroy=function(){o(d)},h},createStream:function(t,e){var r=c.pop();return r||(r=new n(t)),r.bind(),a(r,e,Yt,0,1,!1),r},destroyStream:function(t){c.push(t)},clear:function(){Ct(l).forEach(o),c.forEach(o)},getBuffer:function(t){return t&&t._buffer instanceof n?t._buffer:null},restore:function(){Ct(l).forEach(function(e){e.buffer=t.createBuffer(),t.bindBuffer(e.type,e.buffer),t.bufferData(e.type,e.persistentData||e.byteLength,e.usage)})},_initBuffer:a}}(p,b,d),C=function(t,e,r,n){function i(t){this.id=l++,s[this.id]=this,this.buffer=t,this.primType=$t,this.vertCount=0,this.type=0}function a(n,i,a,o,s,l,c){if(n.buffer.bind(),i){var u=c;c||lt(i)&&(!k(i)||lt(i.data))||(u=e.oes_element_index_uint?ae:ne),r._initBuffer(n.buffer,i,a,u,3)}else t.bufferData(oe,l,a),n.buffer.dtype=h||ee,n.buffer.usage=a,n.buffer.dimension=3,n.buffer.byteLength=l;var h=c;if(!c){switch(n.buffer.dtype){case ee:case te:h=ee;break;case ne:case re:h=ne;break;case ae:case ie:h=ae;break;default:Mt.raise("unsupported type for element array")}n.buffer.dtype=h}n.type=h,Mt(h!==ae||!!e.oes_element_index_uint,"32 bit element buffers not supported, enable oes_element_index_uint first");var f=s;f<0&&(f=n.buffer.byteLength,h===ne?f>>=1:h===ae&&(f>>=2)),n.vertCount=f;var d=o;if(o<0){d=$t;var p=n.buffer.dimension;1===p&&(d=Kt),2===p&&(d=Qt),3===p&&(d=$t)}n.primType=d}function o(t){n.elementsCount--,Mt(null!==t.buffer,"must not double destroy elements"),delete s[t.id],t.buffer.destroy(),t.buffer=null}var s={},l=0,c={uint8:ee,uint16:ne};e.oes_element_index_uint&&(c.uint32=ae),i.prototype.bind=function(){this.buffer.bind()};var u=[];return{create:function(t,e){function s(t){if(t)if("number"==typeof t)l(t),u.primType=$t,u.vertCount=0|t,u.type=ee;else{var e=null,r=le,n=-1,i=-1,o=0,h=0;Array.isArray(t)||lt(t)||k(t)?e=t:(Mt.type(t,"object","invalid arguments for elements"),"data"in t&&(e=t.data,Mt(Array.isArray(e)||lt(e)||k(e),"invalid data for element buffer")),"usage"in t&&(Mt.parameter(t.usage,Vt,"invalid element buffer usage"),r=Vt[t.usage]),"primitive"in t&&(Mt.parameter(t.primitive,Jt,"invalid element buffer primitive"),n=Jt[t.primitive]),"count"in t&&(Mt("number"==typeof t.count&&t.count>=0,"invalid vertex count for elements"),i=0|t.count),"type"in t&&(Mt.parameter(t.type,c,"invalid buffer type"),h=c[t.type]),"length"in t?o=0|t.length:(o=i,h===ne||h===re?o*=2:h!==ae&&h!==ie||(o*=4))),a(u,e,r,n,i,o,h)}else l(),u.primType=$t,u.vertCount=0,u.type=ee;return s}var l=r.create(null,oe,!0),u=new i(l._buffer);return n.elementsCount++,s(t),s._reglType="elements",s._elements=u,s.subdata=function(t,e){return l.subdata(t,e),s},s.destroy=function(){o(u)},s},createStream:function(t){var e=u.pop();return e||(e=new i(r.create(null,oe,!0,!1)._buffer)),a(e,t,se,-1,-1,0,0),e},destroyStream:function(t){u.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){Ct(s).forEach(o)}}}(p,x,L,b),z=function(t,e,r,n,i){for(var a=r.maxAttributes,o=new Array(a),s=0;s<a;++s)o[s]=new X;return{Record:X,scope:{},state:o}}(0,0,E),O=Z(p,y,b,d),F=Y(p,x,E,function(){N.procs.poll()},S,b,d),R=Pr(p,x,E,b,d),j=function(t,e,r,n,i,a){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=0,i=0;e?(n=e.width,i=e.height):r&&(n=r.width,i=r.height),this.width=n,this.height=i}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){if(t)if(t.texture){var n=t.texture._texture,i=Math.max(1,n.width),a=Math.max(1,n.height);Mt(i===e&&a===r,"inconsistent width/height for supplied texture"),n.refCount+=1}else{var o=t.renderbuffer._renderbuffer;Mt(o.width===e&&o.height===r,"inconsistent width/height for renderbuffer"),o.refCount+=1}}function c(e,r){r&&(r.texture?t.framebufferTexture2D(Dr,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(Dr,e,zr,r.renderbuffer._renderbuffer.renderbuffer))}function u(t){var e=Or,r=null,n=null,i=t;"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),Mt.type(i,"function","invalid attachment data");var a=i._reglType;return"texture2d"===a?(r=i,Mt(e===Or)):"textureCube"===a?(r=i,Mt(e>=Fr&&e<Fr+6,"invalid cube map target")):"renderbuffer"===a?(n=i,e=zr):Mt.raise("invalid regl object for attachment"),new o(e,r,n)}function h(t,e,r,a,s){if(r){var l=n.create2D({width:t,height:e,format:a,type:s});return l._texture.refCount=0,new o(Or,l,null)}var c=i.create({width:t,height:e,format:a});return c._renderbuffer.refCount=0,new o(zr,null,c)}function f(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))}function p(){this.id=M++,k[this.id]=this,this.framebuffer=t.createFramebuffer(),this.width=0,this.height=0,this.colorAttachments=[],this.depthAttachment=null,this.stencilAttachment=null,this.depthStencilAttachment=null}function m(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function g(e){var r=e.framebuffer;Mt(r,"must not double destroy framebuffer"),t.deleteFramebuffer(r),e.framebuffer=null,a.framebufferCount--,delete k[e.id]}function v(e){var n;t.bindFramebuffer(Dr,e.framebuffer);var i=e.colorAttachments;for(n=0;n<i.length;++n)c(Rr+n,i[n]);for(n=i.length;n<r.maxColorAttachments;++n)t.framebufferTexture2D(Dr,Rr+n,Or,null,0);t.framebufferTexture2D(Dr,Br,Or,null,0),t.framebufferTexture2D(Dr,jr,Or,null,0),t.framebufferTexture2D(Dr,Nr,Or,null,0),c(jr,e.depthAttachment),c(Nr,e.stencilAttachment),c(Br,e.depthStencilAttachment);var a=t.checkFramebufferStatus(Dr);a!==Ur&&Mt.raise("framebuffer configuration not supported, status = "+Jr[a]),t.bindFramebuffer(Dr,b.next),b.cur=b.next,t.getError()}function y(t,n){function i(t,n){var a;Mt(b.next!==o,"can not update framebuffer which is currently in use");var s=e.webgl_draw_buffers,c=0,d=0,p=!0,g=!0,y=null,M=!0,k="rgba",T="uint8",A=1,S=null,E=null,L=null,C=!1;if("number"==typeof t)c=0|t,d=0|n||c;else if(t){Mt.type(t,"object","invalid arguments for framebuffer");var I=t;if("shape"in I){var P=I.shape;Mt(Array.isArray(P)&&P.length>=2,"invalid shape for framebuffer"),c=P[0],d=P[1]}else"radius"in I&&(c=d=I.radius),"width"in I&&(c=I.width),"height"in I&&(d=I.height);("color"in I||"colors"in I)&&(y=I.color||I.colors,Array.isArray(y)&&Mt(1===y.length||s,"multiple render targets not supported")),y||("colorCount"in I&&(A=0|I.colorCount,Mt(A>0,"invalid color buffer count")),"colorTexture"in I&&(M=!!I.colorTexture,k="rgba4"),"colorType"in I&&(T=I.colorType,M?(Mt(e.oes_texture_float||!("float"===T||"float32"===T),"you must enable OES_texture_float in order to use floating point framebuffer objects"),Mt(e.oes_texture_half_float||!("half float"===T||"float16"===T),"you must enable OES_texture_half_float in order to use 16-bit floating point framebuffer objects")):"half float"===T||"float16"===T?(Mt(e.ext_color_buffer_half_float,"you must enable EXT_color_buffer_half_float to use 16-bit render buffers"),k="rgba16f"):"float"!==T&&"float32"!==T||(Mt(e.webgl_color_buffer_float,"you must enable WEBGL_color_buffer_float in order to use 32-bit floating point renderbuffers"),k="rgba32f"),Mt.oneOf(T,w,"invalid color type")),"colorFormat"in I&&(k=I.colorFormat,x.indexOf(k)>=0?M=!0:_.indexOf(k)>=0?M=!1:M?Mt.oneOf(I.colorFormat,x,"invalid color format for texture"):Mt.oneOf(I.colorFormat,_,"invalid color format for renderbuffer"))),("depthTexture"in I||"depthStencilTexture"in I)&&(C=!(!I.depthTexture&&!I.depthStencilTexture),Mt(!C||e.webgl_depth_texture,"webgl_depth_texture extension not supported")),"depth"in I&&("boolean"==typeof I.depth?p=I.depth:(S=I.depth,g=!1)),"stencil"in I&&("boolean"==typeof I.stencil?g=I.stencil:(E=I.stencil,p=!1)),"depthStencil"in I&&("boolean"==typeof I.depthStencil?p=g=I.depthStencil:(L=I.depthStencil,p=!1,g=!1))}else c=d=1;var D=null,z=null,O=null,F=null;if(Array.isArray(y))D=y.map(u);else if(y)D=[u(y)];else for(D=new Array(A),a=0;a<A;++a)D[a]=h(c,d,M,k,T);Mt(e.webgl_draw_buffers||D.length<=1,"you must enable the WEBGL_draw_buffers extension in order to use multiple color buffers."),Mt(D.length<=r.maxColorAttachments,"too many color attachments, not supported"),c=c||D[0].width,d=d||D[0].height,S?z=u(S):p&&!g&&(z=h(c,d,C,"depth","uint32")),E?O=u(E):g&&!p&&(O=h(c,d,!1,"stencil","uint8")),L?F=u(L):!S&&!E&&g&&p&&(F=h(c,d,C,"depth stencil","depth stencil")),Mt(!!S+!!E+!!L<=1,"invalid framebuffer configuration, can specify exactly one depth/stencil attachment");var R=null;for(a=0;a<D.length;++a)if(l(D[a],c,d),Mt(!D[a]||D[a].texture&&Hr.indexOf(D[a].texture._texture.format)>=0||D[a].renderbuffer&&Zr.indexOf(D[a].renderbuffer._renderbuffer.format)>=0,"framebuffer color attachment "+a+" is invalid"),D[a]&&D[a].texture){var j=qr[D[a].texture._texture.format]*Gr[D[a].texture._texture.type];null===R?R=j:Mt(R===j,"all color attachments much have the same number of bits per pixel.")}return l(z,c,d),Mt(!z||z.texture&&z.texture._texture.format===Vr||z.renderbuffer&&z.renderbuffer._renderbuffer.format===Yr,"invalid depth attachment for framebuffer object"),l(O,c,d),Mt(!O||O.renderbuffer&&O.renderbuffer._renderbuffer.format===Wr,"invalid stencil attachment for framebuffer object"),l(F,c,d),Mt(!F||F.texture&&F.texture._texture.format===Xr||F.renderbuffer&&F.renderbuffer._renderbuffer.format===Xr,"invalid depth-stencil attachment for framebuffer object"),m(o),o.width=c,o.height=d,o.colorAttachments=D,o.depthAttachment=z,o.stencilAttachment=O,o.depthStencilAttachment=F,i.color=D.map(f),i.depth=f(z),i.stencil=f(O),i.depthStencil=f(F),i.width=o.width,i.height=o.height,v(o),i}var o=new p;return a.framebufferCount++,i(t,n),ct(i,{resize:function(t,e){Mt(b.next!==o,"can not resize a framebuffer which is currently in use");var r=0|t,n=0|e||r;if(r===o.width&&n===o.height)return i;for(var a=o.colorAttachments,s=0;s<a.length;++s)d(a[s],r,n);return d(o.depthAttachment,r,n),d(o.stencilAttachment,r,n),d(o.depthStencilAttachment,r,n),o.width=i.width=r,o.height=i.height=n,v(o),i},_reglType:"framebuffer",_framebuffer:o,destroy:function(){g(o),m(o)},use:function(t){b.setFBO({framebuffer:i},t)}})}var b={cur:null,next:null,dirty:!1,setFBO:null},x=["rgba"],_=["rgba4","rgb565","rgb5 a1"];e.ext_srgb&&_.push("srgba"),e.ext_color_buffer_half_float&&_.push("rgba16f","rgb16f"),e.webgl_color_buffer_float&&_.push("rgba32f");var w=["uint8"];e.oes_texture_half_float&&w.push("half float","float16"),e.oes_texture_float&&w.push("float","float32");var M=0,k={};return ct(b,{getFramebuffer:function(t){if("function"==typeof t&&"framebuffer"===t._reglType){var e=t._framebuffer;if(e instanceof p)return e}return null},create:y,createCube:function(t){function i(t){var r;Mt(a.indexOf(b.next)<0,"can not update framebuffer which is currently in use");var o=e.webgl_draw_buffers,s={color:null},l=0,c=null,u="rgba",h="uint8",f=1;if("number"==typeof t)l=0|t;else if(t){Mt.type(t,"object","invalid arguments for framebuffer");var d=t;if("shape"in d){var p=d.shape;Mt(Array.isArray(p)&&p.length>=2,"invalid shape for framebuffer"),Mt(p[0]===p[1],"cube framebuffer must be square"),l=p[0]}else"radius"in d&&(l=0|d.radius),"width"in d?(l=0|d.width,"height"in d&&Mt(d.height===l,"must be square")):"height"in d&&(l=0|d.height);("color"in d||"colors"in d)&&(c=d.color||d.colors,Array.isArray(c)&&Mt(1===c.length||o,"multiple render targets not supported")),c||("colorCount"in d&&(f=0|d.colorCount,Mt(f>0,"invalid color buffer count")),"colorType"in d&&(Mt.oneOf(d.colorType,w,"invalid color type"),h=d.colorType),"colorFormat"in d&&(u=d.colorFormat,Mt.oneOf(d.colorFormat,x,"invalid color format for texture"))),"depth"in d&&(s.depth=d.depth),"stencil"in d&&(s.stencil=d.stencil),"depthStencil"in d&&(s.depthStencil=d.depthStencil)}else l=1;var m;if(c)if(Array.isArray(c))for(m=[],r=0;r<c.length;++r)m[r]=c[r];else m=[c];else{m=Array(f);var g={radius:l,format:u,type:h};for(r=0;r<f;++r)m[r]=n.createCube(g)}for(s.color=Array(m.length),r=0;r<m.length;++r){var v=m[r];Mt("function"==typeof v&&"textureCube"===v._reglType,"invalid cube map"),l=l||v.width,Mt(v.width===l&&v.height===l,"invalid cube map shape"),s.color[r]={target:Fr,data:m[r]}}for(r=0;r<6;++r){for(var _=0;_<m.length;++_)s.color[_].target=Fr+r;r>0&&(s.depth=a[0].depth,s.stencil=a[0].stencil,s.depthStencil=a[0].depthStencil),a[r]?a[r](s):a[r]=y(s)}return ct(i,{width:l,height:l,color:m})}var a=Array(6);return i(t),ct(i,{faces:a,resize:function(t){var e,n=0|t;if(Mt(n>0&&n<=r.maxCubeMapSize,"invalid radius for cube fbo"),n===i.width)return i;var o=i.color;for(e=0;e<o.length;++e)o[e].resize(n);for(e=0;e<6;++e)a[e].resize(n);return i.width=i.height=n,i},_reglType:"framebufferCube",destroy:function(){a.forEach(function(t){t.destroy()})}})},clear:function(){Ct(k).forEach(g)},restore:function(){Ct(k).forEach(function(e){e.framebuffer=t.createFramebuffer(),v(e)})}})}(p,x,E,F,R,b),N=at(p,y,x,E,L,C,0,j,{},z,O,{elements:null,primitive:4,count:-1,offset:0,instances:-1},S,_,d),B=J(p,j,N.procs.poll,S,m,x),U=N.next,V=p.canvas,H=[],q=[],G=[],W=[d.onDestroy],K=null;V&&(V.addEventListener(ha,i,!1),V.addEventListener(fa,a,!1));var Q=j.setFBO=o({framebuffer:At.define.call(null,da,"framebuffer")});h();var $=ct(o,{clear:function(t){if(Mt("object"==typeof t&&t,"regl.clear() takes an object as input"),"framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;e<6;++e)Q(ct({framebuffer:t.framebuffer.faces[e]},t),s);else Q(t,s);else s(0,t)},prop:At.define.bind(null,da),context:At.define.bind(null,pa),this:At.define.bind(null,ma),draw:o({}),buffer:function(t){return L.create(t,ua,!1,!1)},elements:function(t){return C.create(t,!1)},texture:F.create2D,cube:F.createCube,renderbuffer:R.create,framebuffer:j.create,framebufferCube:j.createCube,attributes:m,frame:l,on:function(t,e){Mt.type(e,"function","listener callback must be a function");var r;switch(t){case"frame":return l(e);case"lost":r=q;break;case"restore":r=G;break;case"destroy":r=W;break;default:Mt.raise("invalid event, must be one of frame,lost,restore,destroy")}return r.push(e),{cancel:function(){for(var t=0;t<r.length;++t)if(r[t]===e)return r[t]=r[r.length-1],void r.pop()}}},limits:E,hasExtension:function(t){return E.extensions.indexOf(t.toLowerCase())>=0},read:B,destroy:function(){H.length=0,n(),V&&(V.removeEventListener(ha,i),V.removeEventListener(fa,a)),O.clear(),j.clear(),R.clear(),F.clear(),C.clear(),L.clear(),_&&_.clear(),W.forEach(function(t){t()})},_gl:p,_refresh:h,poll:function(){u(),_&&_.update()},now:f,stats:b});return d.onDone(null,$),$}})},{}],509:[function(t,e,r){"use strict";var n,i="";e.exports=function(t,e){if("string"!=typeof t)throw new TypeError("expected a string");if(1===e)return t;if(2===e)return t+t;var r=t.length*e;if(n!==t||void 0===n)n=t,i="";else if(i.length>=r)return i.substr(0,r);for(;r>i.length&&e>1;)1&e&&(i+=t),e>>=1,t+=t;return i+=t,i=i.substr(0,r)}},{}],510:[function(t,e,r){!function(t,n){"object"==typeof r?e.exports=n():t.resolveUrl=n()}(this,function(){return function(){var t=arguments.length;if(0===t)throw new Error("resolveUrl requires at least one argument; got none.");var e=document.createElement("base");if(e.href=arguments[0],1===t)return e.href;var r=document.getElementsByTagName("head")[0];r.insertBefore(e,r.firstChild);for(var n,i=document.createElement("a"),a=1;a<t;a++)i.href=arguments[a],n=i.href,e.href=n;return r.removeChild(e),n}})},{}],511:[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:{})},{}],512:[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;(l=(s=t[i])-((r=a+s)-a))&&(t[--n]=r,r=l)}var o=0;for(i=n;i<e;++i){var s,l;(l=(s=r)-((r=(a=t[i])+s)-a))&&(t[o++]=l)}return t[o++]=r,t.length=o,t}},{}],513:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function i(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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;r<t.length;++r)e.push(["scale(",o(n(t,r)),",",i(r),t[0][r],")"].join(""));return a(e)}function s(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",o(function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=["m[",r,"][",n,"]"].join("")}return e}(t)),")};return robustDeterminant",t].join(""))(c,u,l,h)}var l=t("two-product"),c=t("robust-sum"),u=t("robust-scale"),h=t("robust-compress"),f=6,d=[function(){return[0]},function(t){return[t[0][0]]}];!function(){for(;d.length<f;)d.push(s(d.length));for(var t=[],r=["function robustDeterminant(m){switch(m.length){"],n=0;n<f;++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,d.concat([d,s])),n=0;n<d.length;++n)e.exports[n]=d[n]}()},{"robust-compress":512,"robust-scale":519,"robust-sum":522,"two-product":548}],514:[function(t,e,r){"use strict";var n=t("two-product"),i=t("robust-sum");e.exports=function(t,e){for(var r=n(t[0],e[0]),a=1;a<t.length;++a)r=i(r,n(t[a],e[a]));return r}},{"robust-sum":522,"two-product":548}],515:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function i(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",i(t.slice(0,e)),",",i(t.slice(e)),")"].join("")}function a(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 a(e,t)}function o(t){return!0&t?"-":""}function s(t){if(2===t.length)return[["diff(",a(t[0][0],t[1][1]),",",a(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r<t.length;++r)e.push(["scale(",i(s(n(t,r))),",",o(r),t[0][r],")"].join(""));return e}function l(t,e){for(var r=[],n=0;n<e-2;++n)r.push(["prod(m",t,"[",n,"],m",t,"[",n,"])"].join(""));return i(r)}function c(t){for(var e=[],r=[],a=function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=["m",n,"[",t-r-2,"]"].join("")}return e}(t),o=0;o<t;++o)a[0][o]="1",a[t-1][o]="w"+o;for(o=0;o<t;++o)0==(1&o)?e.push.apply(e,s(n(a,o))):r.push.apply(r,s(n(a,o)));var c=i(e),p=i(r),m="exactInSphere"+t,g=[];for(o=0;o<t;++o)g.push("m"+o);var v=["function ",m,"(",g.join(),"){"];for(o=0;o<t;++o){v.push("var w",o,"=",l(o,t),";");for(var y=0;y<t;++y)y!==o&&v.push("var w",o,"m",y,"=scale(w",o,",m",y,"[0]);")}v.push("var p=",c,",n=",p,",d=diff(p,n);return d[d.length-1];}return ",m);return new Function("sum","diff","prod","scale",v.join(""))(h,f,u,d)}var u=t("two-product"),h=t("robust-sum"),f=t("robust-subtract"),d=t("robust-scale"),p=6,m=[function(){return 0},function(){return 0},function(){return 0}];!function(){for(;m.length<=p;)m.push(c(m.length));for(var t=[],r=["slow"],n=0;n<=p;++n)t.push("a"+n),r.push("o"+n);var i=["function testInSphere(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(n=2;n<=p;++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;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return testInSphere"),r.push(i.join(""));var a=Function.apply(void 0,r);for(e.exports=a.apply(void 0,[function(t){var e=m[t.length];return e||(e=m[t.length]=c(t.length)),e.apply(void 0,t)}].concat(m)),n=0;n<=p;++n)e.exports[n]=m[n]}()},{"robust-scale":519,"robust-subtract":521,"robust-sum":522,"two-product":548}],516:[function(t,e,r){"use strict";function n(t){for(var e="robustLinearSolve"+t+"d",r=["function ",e,"(A,b){return ["],n=0;n<t;++n){r.push("det([");for(var a=0;a<t;++a){a>0&&r.push(","),r.push("[");for(var o=0;o<t;++o)o>0&&r.push(","),o===n?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?i[t]:i)}var i=t("robust-determinant"),a=6,o=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];!function(){for(;o.length<a;)o.push(n(o.length));for(var t=[],r=["function dispatchLinearSolve(A,b){switch(A.length){"],i=0;i<a;++i)t.push("s"+i),r.push("case ",i,":return s",i,"(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 s=Function.apply(void 0,t);for(e.exports=s.apply(void 0,o.concat([o,n])),i=0;i<a;++i)e.exports[i]=o[i]}()},{"robust-determinant":513}],517:[function(t,e,r){"use strict";function n(t,e){for(var r=new Array(t.length-1),n=1;n<t.length;++n)for(var i=r[n-1]=new Array(t.length-1),a=0,o=0;a<t.length;++a)a!==e&&(i[o++]=t[n][a]);return r}function i(t){return 1&t?"-":""}function a(t){if(1===t.length)return t[0];if(2===t.length)return["sum(",t[0],",",t[1],")"].join("");var e=t.length>>1;return["sum(",a(t.slice(0,e)),",",a(t.slice(e)),")"].join("")}function o(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;r<t.length;++r)e.push(["scale(",a(o(n(t,r))),",",i(r),t[0][r],")"].join(""));return e}function s(t){for(var e=[],r=[],i=function(t){for(var e=new Array(t),r=0;r<t;++r){e[r]=new Array(t);for(var n=0;n<t;++n)e[r][n]=["m",n,"[",t-r-1,"]"].join("")}return e}(t),s=[],f=0;f<t;++f)0==(1&f)?e.push.apply(e,o(n(i,f))):r.push.apply(r,o(n(i,f))),s.push("m"+f);var d=a(e),p=a(r),m="orientation"+t+"Exact",g=["function ",m,"(",s.join(),"){var p=",d,",n=",p,",d=sub(p,n);return d[d.length-1];};return ",m].join("");return new Function("sum","prod","scale","sub",g)(c,l,u,h)}var l=t("two-product"),c=t("robust-sum"),u=t("robust-scale"),h=t("robust-subtract"),f=5,d=s(3),p=s(4),m=[function(){return 0},function(){return 0},function(t,e){return e[0]-t[0]},function(t,e,r){var n,i=(t[1]-r[1])*(e[0]-r[0]),a=(t[0]-r[0])*(e[1]-r[1]),o=i-a;if(i>0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:d(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],h=e[2]-n[2],f=r[2]-n[2],d=a*c,m=o*l,g=o*s,v=i*c,y=i*l,b=a*s,x=u*(d-m)+h*(g-v)+f*(y-b),_=7.771561172376103e-16*((Math.abs(d)+Math.abs(m))*Math.abs(u)+(Math.abs(g)+Math.abs(v))*Math.abs(h)+(Math.abs(y)+Math.abs(b))*Math.abs(f));return x>_||-x>_?x:p(t,e,r,n)}];!function(){for(;m.length<=f;)m.push(s(m.length));for(var t=[],r=["slow"],n=0;n<=f;++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<=f;++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;i<arguments.length;++i){s[i]=arguments[i]};return slow(s);}return getOrientation"),r.push(i.join(""));var a=Function.apply(void 0,r);for(e.exports=a.apply(void 0,[function(t){var e=m[t.length];return e||(e=m[t.length]=s(t.length)),e.apply(void 0,t)}].concat(m)),n=0;n<=f;++n)e.exports[n]=m[n]}()},{"robust-scale":519,"robust-subtract":521,"robust-sum":522,"two-product":548}],518:[function(t,e,r){"use strict";var n=t("robust-sum"),i=t("robust-scale");e.exports=function(t,e){if(1===t.length)return i(e,t[0]);if(1===e.length)return i(t,e[0]);if(0===t.length||0===e.length)return[0];var r=[0];if(t.length<e.length)for(var a=0;a<t.length;++a)r=n(r,i(e,t[a]));else for(a=0;a<e.length;++a)r=n(r,i(t,e[a]));return r}},{"robust-scale":519,"robust-sum":522}],519:[function(t,e,r){"use strict";var n=t("two-product"),i=t("two-sum");e.exports=function(t,e){var r=t.length;if(1===r){var a=n(t[0],e);return a[0]?a:[a[1]]}var o=new Array(2*r),s=[.1,.1],l=[.1,.1],c=0;n(t[0],e,s),s[0]&&(o[c++]=s[0]);for(var u=1;u<r;++u){n(t[u],e,l);var h=s[1];i(h,l[0],s),s[0]&&(o[c++]=s[0]);var f=l[1],d=s[1],p=f+d,m=d-(p-f);s[1]=p,m&&(o[c++]=m)}return s[1]&&(o[c++]=s[1]),0===c&&(o[c++]=0),o.length=c,o}},{"two-product":548,"two-sum":549}],520:[function(t,e,r){"use strict";e.exports=function(t,e,r,i){var a=n(t,r,i),o=n(e,r,i);if(a>0&&o>0||a<0&&o<0)return!1;var s=n(r,t,e),l=n(i,t,e);return!(s>0&&l>0||s<0&&l<0)&&(0!==a||0!==o||0!==s||0!==l||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],h=Math.min(c,u);if(Math.max(c,u)<s||l<h)return!1}return!0}(t,e,r,i))};var n=t("robust-orientation")[3]},{"robust-orientation":517}],521:[function(t,e,r){"use strict";e.exports=function(t,e){var r=0|t.length,n=0|e.length;if(1===r&&1===n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);return i?[i,r]:[r]}(t[0],-e[0]);var i,a,o=r+n,s=new Array(o),l=0,c=0,u=0,h=Math.abs,f=t[c],d=h(f),p=-e[u],m=h(p);d<m?(a=f,(c+=1)<r&&(d=h(f=t[c]))):(a=p,(u+=1)<n&&(m=h(p=-e[u]))),c<r&&d<m||u>=n?(i=f,(c+=1)<r&&(d=h(f=t[c]))):(i=p,(u+=1)<n&&(m=h(p=-e[u])));for(var g,v,y=i+a,b=y-i,x=a-b,_=x,w=y;c<r&&u<n;)d<m?(i=f,(c+=1)<r&&(d=h(f=t[c]))):(i=p,(u+=1)<n&&(m=h(p=-e[u]))),(x=(a=_)-(b=(y=i+a)-i))&&(s[l++]=x),_=w-((g=w+y)-(v=g-w))+(y-v),w=g;for(;c<r;)(x=(a=_)-(b=(y=(i=f)+a)-i))&&(s[l++]=x),_=w-((g=w+y)-(v=g-w))+(y-v),w=g,(c+=1)<r&&(f=t[c]);for(;u<n;)(x=(a=_)-(b=(y=(i=p)+a)-i))&&(s[l++]=x),_=w-((g=w+y)-(v=g-w))+(y-v),w=g,(u+=1)<n&&(p=-e[u]);return _&&(s[l++]=_),w&&(s[l++]=w),l||(s[l++]=0),s.length=l,s}},{}],522:[function(t,e,r){"use strict";e.exports=function(t,e){var r=0|t.length,n=0|e.length;if(1===r&&1===n)return function(t,e){var r=t+e,n=r-t,i=t-(r-n)+(e-n);return i?[i,r]:[r]}(t[0],e[0]);var i,a,o=r+n,s=new Array(o),l=0,c=0,u=0,h=Math.abs,f=t[c],d=h(f),p=e[u],m=h(p);d<m?(a=f,(c+=1)<r&&(d=h(f=t[c]))):(a=p,(u+=1)<n&&(m=h(p=e[u]))),c<r&&d<m||u>=n?(i=f,(c+=1)<r&&(d=h(f=t[c]))):(i=p,(u+=1)<n&&(m=h(p=e[u])));for(var g,v,y=i+a,b=y-i,x=a-b,_=x,w=y;c<r&&u<n;)d<m?(i=f,(c+=1)<r&&(d=h(f=t[c]))):(i=p,(u+=1)<n&&(m=h(p=e[u]))),(x=(a=_)-(b=(y=i+a)-i))&&(s[l++]=x),_=w-((g=w+y)-(v=g-w))+(y-v),w=g;for(;c<r;)(x=(a=_)-(b=(y=(i=f)+a)-i))&&(s[l++]=x),_=w-((g=w+y)-(v=g-w))+(y-v),w=g,(c+=1)<r&&(f=t[c]);for(;u<n;)(x=(a=_)-(b=(y=(i=p)+a)-i))&&(s[l++]=x),_=w-((g=w+y)-(v=g-w))+(y-v),w=g,(u+=1)<n&&(p=e[u]);return _&&(s[l++]=_),w&&(s[l++]=w),l||(s[l++]=0),s.length=l,s}},{}],523:[function(t,e,r){!function(t,n){"object"==typeof r&&void 0!==e?e.exports=n():t.ShelfPack=n()}(this,function(){function t(t,e,r){r=r||{},this.w=t||64,this.h=e||64,this.autoResize=!!r.autoResize,this.shelves=[],this.stats={},this.count=function(t){this.stats[t]=1+(0|this.stats[t])}}function e(t,e,r){this.x=0,this.y=t,this.w=this.free=e,this.h=r}return t.prototype.pack=function(t,e){t=[].concat(t),e=e||{};for(var r,n,i,a=[],o=0;o<t.length;o++)if(r=t[o].w||t[o].width,n=t[o].h||t[o].height,r&&n){if(!(i=this.packOne(r,n)))continue;e.inPlace&&(t[o].x=i.x,t[o].y=i.y),a.push(i)}if(this.shelves.length>0){for(var s=0,l=0,c=0;c<this.shelves.length;c++){var u=this.shelves[c];l+=u.h,s=Math.max(u.w-u.free,s)}this.resize(s,l)}return a},t.prototype.packOne=function(t,r){for(var n,i,a=0,o={shelf:-1,waste:1/0},s=0;s<this.shelves.length;s++){if(n=this.shelves[s],a+=n.h,r===n.h&&t<=n.free)return this.count(r),n.alloc(t,r);r>n.h||t>n.free||r<n.h&&t<=n.free&&(i=n.h-r)<o.waste&&(o.waste=i,o.shelf=s)}if(-1!==o.shelf)return n=this.shelves[o.shelf],this.count(r),n.alloc(t,r);if(r<=this.h-a&&t<=this.w)return n=new e(a,this.w,r),this.shelves.push(n),this.count(r),n.alloc(t,r);if(this.autoResize){var l,c,u,h;return l=c=this.h,((u=h=this.w)<=l||t>u)&&(h=2*Math.max(t,u)),(l<u||r>l)&&(c=2*Math.max(r,l)),this.resize(h,c),this.packOne(t,r)}return null},t.prototype.clear=function(){this.shelves=[],this.stats={}},t.prototype.resize=function(t,e){this.w=t,this.h=e;for(var r=0;r<this.shelves.length;r++)this.shelves[r].resize(t);return!0},e.prototype.alloc=function(t,e){if(t>this.free||e>this.h)return null;var r=this.x;return this.x+=t,this.free-=t,{x:r,y:this.y,w:t,h:e,width:t,height:e}},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t})},{}],524:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],525:[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":70,"reduce-simplicial-complex":507}],526:[function(t,e,r){"use strict";e.exports=function(t,e,r,s){if(r=r||0,void 0===s&&(s=function(t){for(var e=t.length,r=0,n=0;n<e;++n)r=0|Math.max(r,t[n].length);return r-1}(t)),0===t.length||s<1)return{cells:[],vertexIds:[],vertexWeights:[]};var l=function(t,e){for(var r=t.length,n=i.mallocUint8(r),a=0;a<r;++a)n[a]=t[a]<e|0;return n}(e,+r),c=function(t,e){for(var r=t.length,o=e*(e+1)/2*r|0,s=i.mallocUint32(2*o),l=0,c=0;c<r;++c)for(var u=t[c],h=(e=u.length,0);h<e;++h)for(var f=0;f<h;++f){var d=u[f],p=u[h];s[l++]=0|Math.min(d,p),s[l++]=0|Math.max(d,p)}a(n(s,[l/2|0,2]));var m=2;for(c=2;c<l;c+=2)s[c-2]===s[c]&&s[c-1]===s[c+1]||(s[m++]=s[c],s[m++]=s[c+1]);return n(s,[m/2|0,2])}(t,s),u=function(t,e,r,a){for(var o=t.data,s=t.shape[0],l=i.mallocDouble(s),c=0,u=0;u<s;++u){var h=o[2*u],f=o[2*u+1];if(r[h]!==r[f]){var d=e[h],p=e[f];o[2*c]=h,o[2*c+1]=f,l[c++]=(p-a)/(p-d)}}return t.shape[0]=c,n(l,[c])}(c,e,l,+r),h=function(t,e){var r=i.mallocInt32(2*e),n=t.shape[0],a=t.data;r[0]=0;for(var o=0,s=0;s<n;++s){var l=a[2*s];if(l!==o){for(r[2*o+1]=s;++o<l;)r[2*o]=s,r[2*o+1]=s;r[2*o]=s}}for(r[2*o+1]=n;++o<e;)r[2*o]=r[2*o+1]=n;return r}(c,0|e.length),f=o(s)(t,c.data,h,l),d=function(t){for(var e=0|t.shape[0],r=t.data,n=new Array(e),i=0;i<e;++i)n[i]=[r[2*i],r[2*i+1]];return n}(c),p=[].slice.call(u.data,0,u.shape[0]);return i.free(l),i.free(c.data),i.free(u.data),i.free(h),{cells:f,vertexIds:d,vertexWeights:p}};var n=t("ndarray"),i=t("typedarray-pool"),a=t("ndarray-sort"),o=t("./lib/codegen")},{"./lib/codegen":527,ndarray:468,"ndarray-sort":466,"typedarray-pool":550}],527:[function(t,e,r){"use strict";e.exports=function(t){var e=a[t];return e||(e=a[t]=function(t){function e(t){if(!(t.length<=0)){c.push("R.push(");for(var e=0;e<t.length;++e){var r=t[e];e>0&&c.push(","),c.push("[");for(var n=0;n<r.length;++n){var i=r[n];n>0&&c.push(","),c.push("B(C,E,c[",i[0],"],c[",i[1],"])")}c.push("]")}c.push(");")}}var r=0,a=new Array(t+1);a[0]=[[]];for(var o=1;o<=t;++o)for(var s=a[o]=i(o),l=0;l<s.length;++l)r=Math.max(r,s[o].length);var c=["function B(C,E,i,j){","var a=Math.min(i,j)|0,b=Math.max(i,j)|0,l=C[2*a],h=C[2*a+1];","while(l<h){","var m=(l+h)>>1,v=E[2*m+1];","if(v===b){return m}","if(b<v){h=m}else{l=m+1}","}","return l;","};","function getContour",t,"d(F,E,C,S){","var n=F.length,R=[];","for(var i=0;i<n;++i){var c=F[i],l=c.length;"];for(o=t+1;o>1;--o){o<t+1&&c.push("else "),c.push("if(l===",o,"){");var u=[];for(l=0;l<o;++l)u.push("(S[c["+l+"]]<<"+l+")");for(c.push("var M=",u.join("+"),";if(M===0||M===",(1<<o)-1,"){continue}switch(M){"),s=a[o-1],l=0;l<s.length;++l)c.push("case ",l,":"),e(s[l]),c.push("break;");c.push("}}")}return c.push("}return R;};return getContour",t,"d"),new Function("pool",c.join(""))(n)}(t)),e};var n=t("typedarray-pool"),i=t("marching-simplex-table"),a={}},{"marching-simplex-table":446,"typedarray-pool":550}],528:[function(t,e,r){"use strict";"use restrict";function n(t,e){var r=t.length,n=t.length-e.length,i=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])||i(t[0],t[1])-i(e[0],e[1]);case 3:var a=t[0]+t[1],o=e[0]+e[1];if(s=a+t[2]-(o+e[2]))return s;var s,l=i(t[0],t[1]),c=i(e[0],e[1]);return(s=i(l,t[2])-i(c,e[2]))||i(l+t[2],a)-i(c+e[2],o);default:var u=t.slice(0);u.sort();var h=e.slice(0);h.sort();for(var f=0;f<r;++f)if(n=u[f]-h[f])return n;return 0}}function i(t,e){return n(t[0],e[0])}function a(t,e){if(e){for(var r=t.length,a=new Array(r),o=0;o<r;++o)a[o]=[t[o],e[o]];a.sort(i);for(o=0;o<r;++o)t[o]=a[o][0],e[o]=a[o][1];return t}return t.sort(n),t}function o(t){if(0===t.length)return[];for(var e=1,r=t.length,i=1;i<r;++i){var a=t[i];if(n(a,t[i-1])){if(i===e){e++;continue}t[e++]=a}}return t.length=e,t}function s(t,e){for(var r=0,i=t.length-1,a=-1;r<=i;){var o=r+i>>1,s=n(t[o],e);s<=0?(0===s&&(a=o),r=o+1):s>0&&(i=o-1)}return a}function l(t,e){for(var r=new Array(t.length),i=0,a=r.length;i<a;++i)r[i]=[];for(var o=[],l=(i=0,e.length);i<l;++i)for(var c=e[i],h=c.length,f=1,d=1<<h;f<d;++f){o.length=u.popCount(f);for(var p=0,m=0;m<h;++m)f&1<<m&&(o[p++]=c[m]);var g=s(t,o);if(!(g<0))for(;r[g++].push(i),!(g>=t.length||0!==n(t[g],o)););}return r}function c(t,e){if(e<0)return[];for(var r=[],n=(1<<e+1)-1,i=0;i<t.length;++i)for(var o=t[i],s=n;s<1<<o.length;s=u.nextCombination(s)){for(var l=new Array(e+1),c=0,h=0;h<o.length;++h)s&1<<h&&(l[c++]=o[h]);r.push(l)}return a(r)}var u=t("bit-twiddle"),h=t("union-find");r.dimension=function(t){for(var e=0,r=Math.max,n=0,i=t.length;n<i;++n)e=r(e,t[n].length);return e-1},r.countVertices=function(t){for(var e=-1,r=Math.max,n=0,i=t.length;n<i;++n)for(var a=t[n],o=0,s=a.length;o<s;++o)e=r(e,a[o]);return e+1},r.cloneCells=function(t){for(var e=new Array(t.length),r=0,n=t.length;r<n;++r)e[r]=t[r].slice(0);return e},r.compareCells=n,r.normalize=a,r.unique=o,r.findCell=s,r.incidence=l,r.dual=function(t,e){if(!e)return l(o(c(t,0)),t);for(var r=new Array(e),n=0;n<e;++n)r[n]=[];n=0;for(var i=t.length;n<i;++n)for(var a=t[n],s=0,u=a.length;s<u;++s)r[a[s]].push(n);return r},r.explode=function(t){for(var e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],o=0|i.length,s=1,l=1<<o;s<l;++s){for(var c=[],u=0;u<o;++u)s>>>u&1&&c.push(i[u]);e.push(c)}return a(e)},r.skeleton=c,r.boundary=function(t){for(var e=[],r=0,n=t.length;r<n;++r)for(var i=t[r],o=0,s=i.length;o<s;++o){for(var l=new Array(i.length-1),c=0,u=0;c<s;++c)c!==o&&(l[u++]=i[c]);e.push(l)}return a(e)},r.connectedComponents=function(t,e){return e?function(t,e){for(var r=new h(e),n=0;n<t.length;++n)for(var i=t[n],a=0;a<i.length;++a)for(var o=a+1;o<i.length;++o)r.link(i[a],i[o]);var s=[],l=r.ranks;for(n=0;n<l.length;++n)l[n]=-1;for(n=0;n<t.length;++n){var c=r.find(t[n][0]);l[c]<0?(l[c]=s.length,s.push([t[n].slice(0)])):s[l[c]].push(t[n].slice(0))}return s}(t,e):function(t){for(var e=o(a(c(t,0))),r=new h(e.length),n=0;n<t.length;++n)for(var i=t[n],l=0;l<i.length;++l)for(var u=s(e,[i[l]]),f=l+1;f<i.length;++f)r.link(u,s(e,[i[f]]));var d=[],p=r.ranks;for(n=0;n<p.length;++n)p[n]=-1;for(n=0;n<t.length;++n){var m=r.find(s(e,[t[n][0]]));p[m]<0?(p[m]=d.length,d.push([t[n].slice(0)])):d[p[m]].push(t[n].slice(0))}return d}(t)}},{"bit-twiddle":68,"union-find":551}],529:[function(t,e,r){arguments[4][68][0].apply(r,arguments)},{dup:68}],530:[function(t,e,r){arguments[4][528][0].apply(r,arguments)},{"bit-twiddle":529,dup:528,"union-find":531}],531:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e<t;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n,n.prototype.length=function(){return this.roots.length},n.prototype.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},n.prototype.find=function(t){for(var e=this.roots;e[t]!==t;){var r=e[t];e[t]=e[r],t=r}return t},n.prototype.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,a=this.roots,o=i[r],s=i[n];o<s?a[r]=n:s<o?a[n]=r:(a[n]=r,++i[r])}}},{}],532:[function(t,e,r){"use strict";e.exports=function(t,e,r){function a(t){if(x[t])return 1/0;var r=v[t],i=y[t];return r<0||i<0?1/0:function(t,e,r){return Math.abs(n(t,e,r))/Math.sqrt(Math.pow(e[0]-r[0],2)+Math.pow(e[1]-r[1],2))}(e[t],e[r],e[i])}function o(t,e){var r=T[t],n=T[e];T[t]=n,T[e]=r,A[r]=e,A[n]=t}function s(t){return b[T[t]]}function l(t){return 1&t?t-1>>1:(t>>1)-1}function c(t){for(var e=s(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(n<S){var l=s(n);l<r&&(a=n,r=l)}if(i<S&&s(i)<r&&(a=i),a===t)return t;o(t,a),t=a}}function u(t){for(var e=s(t);t>0;){var r=l(t);if(!(r>=0&&e<s(r)))return t;o(t,r),t=r}}function h(){if(S>0){var t=T[0];return o(0,S-1),S-=1,c(0),t}return-1}function f(t,e){var r=T[t];return b[r]===e?t:(b[r]=-1/0,u(t),h(),b[r]=e,S+=1,u(S-1))}function d(t){if(!x[t]){x[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),A[e]>=0&&f(A[e],a(e)),A[r]>=0&&f(A[r],a(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!x[n]||i<0||i===n)break;if(n=i,i=t[n],!x[n]||i<0||i===n)break;n=i,r=t[r]}while(r!==n);for(var a=e;a!==n;a=t[a])t[a]=n;return n}for(var m=e.length,g=t.length,v=new Array(m),y=new Array(m),b=new Array(m),x=new Array(m),_=0;_<m;++_)v[_]=y[_]=-1,b[_]=1/0,x[_]=!1;for(_=0;_<g;++_){var w=t[_];if(2!==w.length)throw new Error("Input must be a graph");var M=w[1],k=w[0];-1!==y[k]?y[k]=-2:y[k]=M,-1!==v[M]?v[M]=-2:v[M]=k}var T=[],A=new Array(m);for(_=0;_<m;++_)(b[_]=a(_))<1/0?(A[_]=T.length,T.push(_)):A[_]=-1;var S=T.length;for(_=S>>1;_>=0;--_)c(_);for(;;){var E=h();if(E<0||b[E]>r)break;d(E)}var L=[];for(_=0;_<m;++_)x[_]||(A[_]=L.length,L.push(e[_].slice()));L.length;var C=[];return t.forEach(function(t){var e=p(v,t[0]),r=p(y,t[1]);if(e>=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":517,"simplicial-complex":530}],533:[function(t,e,r){"use strict";function n(t,e){var r,n;if(e[0][0]<e[1][0])r=e[0],n=e[1];else{if(!(e[0][0]>e[1][0])){var a=Math.min(t[0][1],t[1][1]),o=Math.max(t[0][1],t[1][1]),s=Math.min(e[0][1],e[1][1]),l=Math.max(e[0][1],e[1][1]);return o<s?o-s:a>l?a-l:o-l}r=e[1],n=e[0]}var c,u;t[0][1]<t[1][1]?(c=t[0],u=t[1]):(c=t[1],u=t[0]);var h=i(n,r,c);return h||((h=i(n,r,u))||u-n)}e.exports=function(t,e){var r,a;if(e[0][0]<e[1][0])r=e[0],a=e[1];else{if(!(e[0][0]>e[1][0]))return n(e,t);r=e[1],a=e[0]}var o,s;if(t[0][0]<t[1][0])o=t[0],s=t[1];else{if(!(t[0][0]>t[1][0]))return-n(t,e);o=t[1],s=t[0]}var l=i(r,a,s),c=i(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=i(s,o,a),c=i(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 i=t("robust-orientation")},{"robust-orientation":517}],534:[function(t,e,r){"use strict";function n(t,e,r){this.slabs=t,this.coordinates=e,this.horizontal=r}function i(t,e){return t.y-e}function a(t,e){for(var r=null;t;){var n,i,o=t.key;o[0][0]<o[1][0]?(n=o[0],i=o[1]):(n=o[1],i=o[0]);var s=u(n,i,e);if(s<0)t=t.left;else if(s>0)if(e[0]!==o[1][0])r=t,t=t.right;else{if(l=a(t.right,e))return l;t=t.left}else{if(e[0]!==o[1][0])return t;var l;if(l=a(t.right,e))return l;t=t.left}}return r}function o(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function s(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}e.exports=function(t){for(var e=t.length,r=2*e,i=new Array(r),a=0;a<e;++a){var l=t[a],u=l[0][0]<l[1][0];i[2*a]=new s(l[0][0],l,u,a),i[2*a+1]=new s(l[1][0],l,!u,a)}i.sort(function(t,e){var r=t.x-e.x;return r||(r=t.create-e.create)||Math.min(t.segment[0][1],t.segment[1][1])-Math.min(e.segment[0][1],e.segment[1][1])});var f=c(h),d=[],p=[],m=[];for(a=0;a<r;){for(var g=i[a].x,v=[];a<r;){var y=i[a];if(y.x!==g)break;a+=1,y.segment[0][0]===y.x&&y.segment[1][0]===y.x?y.create&&(y.segment[0][1]<y.segment[1][1]?(v.push(new o(y.segment[0][1],y.index,!0,!0)),v.push(new o(y.segment[1][1],y.index,!1,!1))):(v.push(new o(y.segment[1][1],y.index,!0,!1)),v.push(new o(y.segment[0][1],y.index,!1,!0)))):f=y.create?f.insert(y.segment,y.index):f.remove(y.segment)}d.push(f.root),p.push(g),m.push(v)}return new n(d,p,m)};var l=t("binary-search-bounds"),c=t("functional-red-black-tree"),u=t("robust-orientation"),h=t("./lib/order-segments");n.prototype.castUp=function(t){var e=l.le(this.coordinates,t[0]);if(e<0)return-1;this.slabs[e];var r=a(this.slabs[e],t),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var o=null;if(r&&(o=r.key),e>0){var s=a(this.slabs[e-1],t);s&&(o?h(s.key,o)>0&&(o=s.key,n=s.value):(n=s.value,o=s.key))}var c=this.horizontal[e];if(c.length>0){var f=l.ge(c,t[1],i);if(f<c.length){var d=c[f];if(t[1]===d.y){if(d.closed)return d.index;for(;f<c.length-1&&c[f+1].y===t[1];)if(f+=1,(d=c[f]).closed)return d.index;if(d.y===t[1]&&!d.start){if((f+=1)>=c.length)return n;d=c[f]}}if(d.start)if(o){var p=u(o[0],o[1],[t[0],d.y]);o[0][0]>o[1][0]&&(p=-p),p>0&&(n=d.index)}else n=d.index;else d.y!==t[1]&&(n=d.index)}}}return n}},{"./lib/order-segments":533,"binary-search-bounds":67,"functional-red-black-tree":136,"robust-orientation":517}],535:[function(t,e,r){"use strict";function n(t,e){var r=o(a(t,e),[e[e.length-1]]);return r[r.length-1]}function i(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;l<o;++l)s[l]=i*t[l]+a*r[l];return s}var a=t("robust-dot-product"),o=t("robust-sum");e.exports=function(t,e){for(var r=[],a=[],o=n(t[t.length-1],e),s=t[t.length-1],l=t[0],c=0;c<t.length;++c,s=l){var u=n(l=t[c],e);if(o<0&&u>0||o>0&&u<0){var h=i(s,u,l,o);r.push(h),a.push(h.slice())}u<0?a.push(l.slice()):u>0?r.push(l.slice()):(r.push(l.slice()),a.push(l.slice())),o=u}return{positive:r,negative:a}},e.exports.positive=function(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l<t.length;++l,o=s){var c=n(s=t[l],e);(a<0&&c>0||a>0&&c<0)&&r.push(i(o,c,s,a)),c>=0&&r.push(s.slice()),a=c}return r},e.exports.negative=function(t,e){for(var r=[],a=n(t[t.length-1],e),o=t[t.length-1],s=t[0],l=0;l<t.length;++l,o=s){var c=n(s=t[l],e);(a<0&&c>0||a>0&&c<0)&&r.push(i(o,c,s,a)),c<=0&&r.push(s.slice()),a=c}return r}},{"robust-dot-product":514,"robust-sum":522}],536:[function(t,e,r){!function(){"use strict";function t(e){return function(e,r){var i,a,o,s,l,c,u,h,f,d=1,p=e.length,m="";for(a=0;a<p;a++)if("string"==typeof e[a])m+=e[a];else if(Array.isArray(e[a])){if((s=e[a])[2])for(i=r[d],o=0;o<s[2].length;o++){if(!i.hasOwnProperty(s[2][o]))throw new Error(t('[sprintf] property "%s" does not exist',s[2][o]));i=i[s[2][o]]}else i=s[1]?r[s[1]]:r[d++];if(n.not_type.test(s[8])&&n.not_primitive.test(s[8])&&i instanceof Function&&(i=i()),n.numeric_arg.test(s[8])&&"number"!=typeof i&&isNaN(i))throw new TypeError(t("[sprintf] expecting number but found %T",i));switch(n.number.test(s[8])&&(h=i>=0),s[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,s[6]?parseInt(s[6]):0);break;case"e":i=s[7]?parseFloat(i).toExponential(s[7]):parseFloat(i).toExponential();break;case"f":i=s[7]?parseFloat(i).toFixed(s[7]):parseFloat(i);break;case"g":i=s[7]?String(Number(i.toPrecision(s[7]))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=s[7]?i.substring(0,s[7]):i;break;case"t":i=String(!!i),i=s[7]?i.substring(0,s[7]):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=s[7]?i.substring(0,s[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=s[7]?i.substring(0,s[7]):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}n.json.test(s[8])?m+=i:(!n.number.test(s[8])||h&&!s[3]?f="":(f=h?"+":"-",i=i.toString().replace(n.sign,"")),c=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",u=s[6]-(f+i).length,l=s[6]&&u>0?c.repeat(u):"",m+=s[5]?f+i+l:"0"===c?f+l+i:l+f+i)}return m}(function(t){if(i[t])return i[t];var e,r=t,a=[],o=0;for(;r;){if(null!==(e=n.text.exec(r)))a.push(e[0]);else if(null!==(e=n.modulo.exec(r)))a.push("%");else{if(null===(e=n.placeholder.exec(r)))throw new SyntaxError("[sprintf] unexpected placeholder");if(e[2]){o|=1;var s=[],l=e[2],c=[];if(null===(c=n.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=n.key_access.exec(l)))s.push(c[1]);else{if(null===(c=n.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(c[1])}e[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");a.push(e)}r=r.substring(e[0].length)}return i[t]=a}(e),arguments)}function e(e,r){return t.apply(null,[e].concat(r||[]))}var n={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:/^[\+\-]/},i=Object.create(null);void 0!==r&&(r.sprintf=t,r.vsprintf=e),"undefined"!=typeof window&&(window.sprintf=t,window.vsprintf=e)}()},{}],537:[function(t,e,r){"use strict";e.exports=function(t){function e(e){var r=[e],c=[e];for(n[e]=i[e]=u,a[e]=!0,u+=1;c.length>0;){e=c[c.length-1];var d=t[e];if(o[e]<d.length){for(var p=o[e];p<d.length;++p){var m=d[p];if(n[m]<0){n[m]=i[m]=u,a[m]=!0,u+=1,r.push(m),c.push(m);break}a[m]&&(i[e]=0|Math.min(i[e],i[m])),s[m]>=0&&l[e].push(s[m])}o[e]=p}else{if(i[e]===n[e]){var g=[],v=[],y=0;for(p=r.length-1;p>=0;--p){var b=r[p];if(a[b]=!1,g.push(b),v.push(l[b]),y+=l[b].length,s[b]=h.length,b===e){r.length=p;break}}h.push(g);var x=new Array(y);for(p=0;p<v.length;p++)for(var _=0;_<v[p].length;_++)x[--y]=v[p][_];f.push(x)}c.pop()}}}for(var r=t.length,n=new Array(r),i=new Array(r),a=new Array(r),o=new Array(r),s=new Array(r),l=new Array(r),c=0;c<r;++c)n[c]=-1,i[c]=0,a[c]=!1,o[c]=0,s[c]=-1,l[c]=[];var u=0,h=[],f=[];for(c=0;c<r;++c)n[c]<0&&e(c);var d;for(c=0;c<f.length;c++){var p=f[c];if(0!==p.length){p.sort(function(t,e){return t-e}),d=[p[0]];for(var m=1;m<p.length;m++)p[m]!==p[m-1]&&d.push(p[m]);f[c]=d}}return{components:h,adjacencyList:f}}},{}],538:[function(t,e,r){"use strict";function n(t){this.options=c(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function i(t,e){var r=t.geometry.coordinates;return{x:s(r[0]),y:l(r[1]),zoom:1/0,id:e,parentId:-1}}function a(t){return{type:"Feature",properties:o(t),geometry:{type:"Point",coordinates:[function(t){return 360*(t-.5)}(t.x),function(t){var e=(180-360*t)*Math.PI/180;return 360*Math.atan(Math.exp(e))/Math.PI-90}(t.y)]}}}function o(t){var e=t.numPoints,r=e>=1e4?Math.round(e/1e3)+"k":e>=1e3?Math.round(e/100)/10+"k":e;return c(c({},t.properties),{cluster:!0,cluster_id:t.id,point_count:e,point_count_abbreviated:r})}function s(t){return t/360+.5}function l(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 c(t,e){for(var r in e)t[r]=e[r];return t}function u(t){return t.x}function h(t){return t.y}var f=t("kdbush");e.exports=function(t){return new n(t)},n.prototype={options:{minZoom:0,maxZoom:16,radius:40,extent:512,nodeSize:64,log:!1,reduce:null,initial:function(){return{}},map:function(t){return t}},load:function(t){var e=this.options.log;e&&console.time("total time");var r="prepare "+t.length+" points";e&&console.time(r),this.points=t;var n=t.map(i);e&&console.timeEnd(r);for(var a=this.options.maxZoom;a>=this.options.minZoom;a--){var o=+Date.now();this.trees[a+1]=f(n,u,h,this.options.nodeSize,Float32Array),n=this._cluster(n,a),e&&console.log("z%d: %d clusters in %dms",a,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=f(n,u,h,this.options.nodeSize,Float32Array),e&&console.timeEnd("total time"),this},getClusters:function(t,e){for(var r=this.trees[this._limitZoom(e)],n=r.range(s(t[0]),l(t[3]),s(t[2]),l(t[1])),i=[],o=0;o<n.length;o++){var c=r.points[n[o]];i.push(c.numPoints?a(c):this.points[c.id])}return i},getChildren:function(t,e){for(var r=this.trees[e+1].points[t],n=this.options.radius/(this.options.extent*Math.pow(2,e)),i=this.trees[e+1].within(r.x,r.y,n),o=[],s=0;s<i.length;s++){var l=this.trees[e+1].points[i[s]];l.parentId===t&&o.push(l.numPoints?a(l):this.points[l.id])}return o},getLeaves:function(t,e,r,n){r=r||10,n=n||0;var i=[];return this._appendLeaves(i,t,e,r,n,0),i},getTile:function(t,e,r){var n=this.trees[this._limitZoom(t)],i=Math.pow(2,t),a=this.options.extent,o=this.options.radius/a,s=(r-o)/i,l=(r+1+o)/i,c={features:[]};return this._addTileFeatures(n.range((e-o)/i,s,(e+1+o)/i,l),n.points,e,r,i,c),0===e&&this._addTileFeatures(n.range(1-o/i,s,1,l),n.points,i,r,i,c),e===i-1&&this._addTileFeatures(n.range(0,s,o/i,l),n.points,-1,r,i,c),c.features.length?c:null},getClusterExpansionZoom:function(t,e){for(;e<this.options.maxZoom;){var r=this.getChildren(t,e);if(e++,1!==r.length)break;t=r[0].properties.cluster_id}return e},_appendLeaves:function(t,e,r,n,i,a){for(var o=this.getChildren(e,r),s=0;s<o.length;s++){var l=o[s].properties;if(l.cluster?a+l.point_count<=i?a+=l.point_count:a=this._appendLeaves(t,l.cluster_id,r+1,n,i,a):a<i?a++:t.push(o[s]),t.length===n)break}return a},_addTileFeatures:function(t,e,r,n,i,a){for(var s=0;s<t.length;s++){var l=e[t[s]];a.features.push({type:1,geometry:[[Math.round(this.options.extent*(l.x*i-r)),Math.round(this.options.extent*(l.y*i-n))]],tags:l.numPoints?o(l):this.points[l.id].properties})}},_limitZoom:function(t){return Math.max(this.options.minZoom,Math.min(t,this.options.maxZoom+1))},_cluster:function(t,e){for(var r=[],n=this.options.radius/(this.options.extent*Math.pow(2,e)),i=0;i<t.length;i++){var a=t[i];if(!(a.zoom<=e)){a.zoom=e;var o=this.trees[e+1],s=o.within(a.x,a.y,n),l=a.numPoints||1,c=a.x*l,u=a.y*l,h=null;this.options.reduce&&(h=this.options.initial(),this._accumulate(h,a));for(var f=0;f<s.length;f++){var d=o.points[s[f]];if(e<d.zoom){var p=d.numPoints||1;d.zoom=e,c+=d.x*p,u+=d.y*p,l+=p,d.parentId=i,this.options.reduce&&this._accumulate(h,d)}}1===l?r.push(a):(a.parentId=i,r.push(function(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:n,properties:i,parentId:-1,numPoints:r}}(c/l,u/l,l,i,h)))}}return r},_accumulate:function(t,e){var r=e.numPoints?e.properties:this.options.map(this.points[e.id].properties);this.options.reduce(t,r)}}},{kdbush:299}],539:[function(t,e,r){"use strict";e.exports=function(t){return t.split("").map(function(t){return t in n?n[t]:""}).join("")};var n={" ":" ",0:"\u2070",1:"\xb9",2:"\xb2",3:"\xb3",4:"\u2074",5:"\u2075",6:"\u2076",7:"\u2077",8:"\u2078",9:"\u2079","+":"\u207a","-":"\u207b",a:"\u1d43",b:"\u1d47",c:"\u1d9c",d:"\u1d48",e:"\u1d49",f:"\u1da0",g:"\u1d4d",h:"\u02b0",i:"\u2071",j:"\u02b2",k:"\u1d4f",l:"\u02e1",m:"\u1d50",n:"\u207f",o:"\u1d52",p:"\u1d56",r:"\u02b3",s:"\u02e2",t:"\u1d57",u:"\u1d58",v:"\u1d5b",w:"\u02b7",x:"\u02e3",y:"\u02b8",z:"\u1dbb"}},{}],540:[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<n;++s)i[s]=[r[s]],o[s]=[s];return{positions:i,cells:o}}(t,e);var r=t.order.join()+"-"+t.dtype,s=o[r];return e=+e||0,s||(s=o[r]=function(t,e){var r=t.length,a=["'use strict';"],o="surfaceNets"+t.join("_")+"d"+e;a.push("var contour=genContour({","order:[",t.join(),"],","scalarArguments: 3,","phase:function phaseFunc(p,a,b,c) { return (p > c)|0 },"),"generic"===e&&a.push("getters:[0],");for(var s=[],l=[],c=0;c<r;++c)s.push("d"+c),l.push("d"+c);for(c=0;c<1<<r;++c)s.push("v"+c),l.push("v"+c);for(c=0;c<1<<r;++c)s.push("p"+c),l.push("p"+c);s.push("a","b","c"),l.push("a","c"),a.push("vertex:function vertexFunc(",s.join(),"){");var u=[];for(c=0;c<1<<r;++c)u.push("(p"+c+"<<"+c+")");a.push("var m=(",u.join("+"),")|0;if(m===0||m===",(1<<(1<<r))-1,"){return}");var h=[],f=[];for(1<<(1<<r)<=128?(a.push("switch(m){"),f=a):a.push("switch(m>>>7){"),c=0;c<1<<(1<<r);++c){if(1<<(1<<r)>128&&c%128==0){h.length>0&&f.push("}}");var d="vExtra"+h.length;a.push("case ",c>>>7,":",d,"(m&0x7f,",l.join(),");break;"),f=["function ",d,"(m,",l.join(),"){switch(m){"],h.push(f)}f.push("case ",127&c,":");for(var p=new Array(r),m=new Array(r),g=new Array(r),v=new Array(r),y=0,b=0;b<r;++b)p[b]=[],m[b]=[],g[b]=0,v[b]=0;for(b=0;b<1<<r;++b)for(var x=0;x<r;++x){var _=b^1<<x;if(!(_>b)&&!(c&1<<_)!=!(c&1<<b)){var w=1;c&1<<_?m[x].push("v"+_+"-v"+b):(m[x].push("v"+b+"-v"+_),w=-w),w<0?(p[x].push("-v"+b+"-v"+_),g[x]+=2):(p[x].push("v"+b+"+v"+_),g[x]-=2),y+=1;for(var M=0;M<r;++M)M!==x&&(_&1<<M?v[M]+=1:v[M]-=1)}}var k=[];for(x=0;x<r;++x)if(0===p[x].length)k.push("d"+x+"-0.5");else{var T="";g[x]<0?T=g[x]+"*c":g[x]>0&&(T="+"+g[x]+"*c");var A=p[x].length/y*.5,S=.5+v[x]/y*.5;k.push("d"+x+"-"+S+"-"+A+"*("+p[x].join("+")+T+")/("+m[x].join("+")+")")}f.push("a.push([",k.join(),"]);","break;")}a.push("}},"),h.length>0&&f.push("}}");var E=[];for(c=0;c<1<<r-1;++c)E.push("v"+c);E.push("c0","c1","p0","p1","a","b","c"),a.push("cell:function cellFunc(",E.join(),"){");var L=i(r-1);for(a.push("if(p0){b.push(",L.map(function(t){return"["+t.map(function(t){return"v"+t})+"]"}).join(),")}else{b.push(",L.map(function(t){var e=t.slice();return e.reverse(),"["+e.map(function(t){return"v"+t})+"]"}).join(),")}}});function ",o,"(array,level){var verts=[],cells=[];contour(array,verts,cells,level);return {positions:verts,cells:cells};} return ",o,";"),c=0;c<h.length;++c)a.push(h[c].join(""));return new Function("genContour",a.join(""))(n)}(t.order,t.dtype)),s(t,e)};var n=t("ndarray-extract-contour"),i=t("triangulate-hypercube"),a=t("zero-crossings"),o={}},{"ndarray-extract-contour":457,"triangulate-hypercube":546,"zero-crossings":593}],541:[function(t,e,r){(function(r){"use strict";function n(t,e,r){r=r||{};var a=o[t];a||(a=o[t]={" ":{data:new Float32Array(0),shape:.2}});var s=a[e];if(!s)if(e.length<=1||!/\d/.test(e))s=a[e]=function(t){for(var e=t.cells,r=t.positions,n=new Float32Array(6*e.length),i=0,a=0,o=0;o<e.length;++o)for(var s=e[o],l=0;l<3;++l){var c=r[s[l]];n[i++]=c[0],n[i++]=c[1]+1.4,a=Math.max(c[0],a)}return{data:n,shape:a}}(i(e,{triangles:!0,font:t,textAlign:r.textAlign||"left",textBaseline:"alphabetic"}));else{for(var l=e.split(/(\d|\s)/),c=new Array(l.length),u=0,h=0,f=0;f<l.length;++f)c[f]=n(t,l[f]),u+=c[f].data.length,h+=c[f].shape,f>0&&(h+=.02);var d=new Float32Array(u),p=0,m=-.5*h;for(f=0;f<c.length;++f){for(var g=c[f].data,v=0;v<g.length;v+=2)d[p++]=g[v]+m,d[p++]=g[v+1];m+=c[f].shape+.02}s=a[e]={data:d,shape:h}}return s}e.exports=n;var i=t("vectorize-text"),a=window||r.global||{},o=a.__TEXT_CACHE||{};a.__TEXT_CACHE={}}).call(this,t("_process"))},{_process:496,"vectorize-text":563}],542:[function(t,e,r){"use strict";function n(t,e,r,n,i){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.radius=r||8;var a=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=a,this.ctx=this.canvas.getContext("2d"),this.ctx.font=t+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(a*a),this.gridInner=new Float64Array(a*a),this.f=new Float64Array(a),this.d=new Float64Array(a),this.z=new Float64Array(a+1),this.v=new Int16Array(a),this.middle=Math.round(a/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function i(t,e,r,n,i,o,s){for(var l=0;l<e;l++){for(var c=0;c<r;c++)n[c]=t[c*e+l];for(a(n,i,o,s,r),c=0;c<r;c++)t[c*e+l]=i[c]}for(c=0;c<r;c++){for(l=0;l<e;l++)n[l]=t[c*e+l];for(a(n,i,o,s,e),l=0;l<e;l++)t[c*e+l]=Math.sqrt(i[l])}}function a(t,e,r,n,i){r[0]=0,n[0]=-o,n[1]=+o;for(var a=1,s=0;a<i;a++){for(var l=(t[a]+a*a-(t[r[s]]+r[s]*r[s]))/(2*a-2*r[s]);l<=n[s];)s--,l=(t[a]+a*a-(t[r[s]]+r[s]*r[s]))/(2*a-2*r[s]);r[++s]=a,n[s]=l,n[s+1]=+o}for(a=0,s=0;a<i;a++){for(;n[s+1]<a;)s++;e[a]=(a-r[s])*(a-r[s])+t[r[s]]}}e.exports=n;var o=1e20;n.prototype.draw=function(t){this.ctx.clearRect(0,0,this.size,this.size),this.ctx.fillText(t,this.buffer,this.middle);for(var e=this.ctx.getImageData(0,0,this.size,this.size),r=e.data,n=0;n<this.size*this.size;n++){var a=r[4*n+3]/255;this.gridOuter[n]=1===a?0:0===a?o:Math.pow(Math.max(0,.5-a),2),this.gridInner[n]=1===a?o:0===a?0:Math.pow(Math.max(0,a-.5),2)}for(i(this.gridOuter,this.size,this.size,this.f,this.d,this.v,this.z),i(this.gridInner,this.size,this.size,this.f,this.d,this.v,this.z),n=0;n<this.size*this.size;n++){var s=this.gridOuter[n]-this.gridInner[n],l=Math.max(0,Math.min(255,Math.round(255-255*(s/this.radius+this.cutoff))));r[4*n+0]=l,r[4*n+1]=l,r[4*n+2]=l,r[4*n+3]=255}return e}},{}],543:[function(t,e,r){!function(t){function r(e,n){if(e=e||"",n=n||{},e instanceof r)return e;if(!(this instanceof r))return new r(e,n);var i=function(e){var r={r:0,g:0,b:0},n=1,i=null,a=null,o=null,s=!1,l=!1;"string"==typeof e&&(e=function(t){t=t.replace(L,"").replace(C,"").toLowerCase();var e=!1;if(F[t])t=F[t],e=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};var r;if(r=j.rgb.exec(t))return{r:r[1],g:r[2],b:r[3]};if(r=j.rgba.exec(t))return{r:r[1],g:r[2],b:r[3],a:r[4]};if(r=j.hsl.exec(t))return{h:r[1],s:r[2],l:r[3]};if(r=j.hsla.exec(t))return{h:r[1],s:r[2],l:r[3],a:r[4]};if(r=j.hsv.exec(t))return{h:r[1],s:r[2],v:r[3]};if(r=j.hsva.exec(t))return{h:r[1],s:r[2],v:r[3],a:r[4]};if(r=j.hex8.exec(t))return{r:M(r[1]),g:M(r[2]),b:M(r[3]),a:S(r[4]),format:e?"name":"hex8"};if(r=j.hex6.exec(t))return{r:M(r[1]),g:M(r[2]),b:M(r[3]),format:e?"name":"hex"};if(r=j.hex4.exec(t))return{r:M(r[1]+""+r[1]),g:M(r[2]+""+r[2]),b:M(r[3]+""+r[3]),a:S(r[4]+""+r[4]),format:e?"name":"hex8"};if(r=j.hex3.exec(t))return{r:M(r[1]+""+r[1]),g:M(r[2]+""+r[2]),b:M(r[3]+""+r[3]),format:e?"name":"hex"};return!1}(e));"object"==typeof e&&(E(e.r)&&E(e.g)&&E(e.b)?(r=function(t,e,r){return{r:255*_(t,255),g:255*_(e,255),b:255*_(r,255)}}(e.r,e.g,e.b),s=!0,l="%"===String(e.r).substr(-1)?"prgb":"rgb"):E(e.h)&&E(e.s)&&E(e.v)?(i=T(e.s),a=T(e.v),r=function(e,r,n){e=6*_(e,360),r=_(r,100),n=_(n,100);var i=t.floor(e),a=e-i,o=n*(1-r),s=n*(1-a*r),l=n*(1-(1-a)*r),c=i%6;return{r:255*[n,s,o,o,l,n][c],g:255*[l,n,n,s,o,o][c],b:255*[o,o,l,n,n,s][c]}}(e.h,i,a),s=!0,l="hsv"):E(e.h)&&E(e.s)&&E(e.l)&&(i=T(e.s),o=T(e.l),r=function(t,e,r){function n(t,e,r){return r<0&&(r+=1),r>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}var i,a,o;t=_(t,360),e=_(e,100),r=_(r,100);if(0===e)i=a=o=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;i=n(l,s,t+1/3),a=n(l,s,t),o=n(l,s,t-1/3)}return{r:255*i,g:255*a,b:255*o}}(e.h,i,o),s=!0,l="hsl"),e.hasOwnProperty("a")&&(n=e.a));return n=x(n),{ok:s,format:e.format||l,r:D(255,z(r.r,0)),g:D(255,z(r.g,0)),b:D(255,z(r.b,0)),a:n}}(e);this._originalInput=e,this._r=i.r,this._g=i.g,this._b=i.b,this._a=i.a,this._roundA=P(100*this._a)/100,this._format=n.format||i.format,this._gradientType=n.gradientType,this._r<1&&(this._r=P(this._r)),this._g<1&&(this._g=P(this._g)),this._b<1&&(this._b=P(this._b)),this._ok=i.ok,this._tc_id=I++}function n(t,e,r){t=_(t,255),e=_(e,255),r=_(r,255);var n,i,a=z(t,e,r),o=D(t,e,r),s=(a+o)/2;if(a==o)n=i=0;else{var l=a-o;switch(i=s>.5?l/(2-a-o):l/(a+o),a){case t:n=(e-r)/l+(e<r?6:0);break;case e:n=(r-t)/l+2;break;case r:n=(t-e)/l+4}n/=6}return{h:n,s:i,l:s}}function i(t,e,r){t=_(t,255),e=_(e,255),r=_(r,255);var n,i,a=z(t,e,r),o=D(t,e,r),s=a-o;if(i=0===a?0:s/a,a==o)n=0;else{switch(a){case t:n=(e-r)/s+(e<r?6:0);break;case e:n=(r-t)/s+2;break;case r:n=(t-e)/s+4}n/=6}return{h:n,s:i,v:a}}function a(t,e,r,n){var i=[k(P(t).toString(16)),k(P(e).toString(16)),k(P(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function o(t,e,r,n){return[k(A(n)),k(P(t).toString(16)),k(P(e).toString(16)),k(P(r).toString(16))].join("")}function s(t,e){e=0===e?0:e||10;var n=r(t).toHsl();return n.s-=e/100,n.s=w(n.s),r(n)}function l(t,e){e=0===e?0:e||10;var n=r(t).toHsl();return n.s+=e/100,n.s=w(n.s),r(n)}function c(t){return r(t).desaturate(100)}function u(t,e){e=0===e?0:e||10;var n=r(t).toHsl();return n.l+=e/100,n.l=w(n.l),r(n)}function h(t,e){e=0===e?0:e||10;var n=r(t).toRgb();return n.r=z(0,D(255,n.r-P(-e/100*255))),n.g=z(0,D(255,n.g-P(-e/100*255))),n.b=z(0,D(255,n.b-P(-e/100*255))),r(n)}function f(t,e){e=0===e?0:e||10;var n=r(t).toHsl();return n.l-=e/100,n.l=w(n.l),r(n)}function d(t,e){var n=r(t).toHsl(),i=(n.h+e)%360;return n.h=i<0?360+i:i,r(n)}function p(t){var e=r(t).toHsl();return e.h=(e.h+180)%360,r(e)}function m(t){var e=r(t).toHsl(),n=e.h;return[r(t),r({h:(n+120)%360,s:e.s,l:e.l}),r({h:(n+240)%360,s:e.s,l:e.l})]}function g(t){var e=r(t).toHsl(),n=e.h;return[r(t),r({h:(n+90)%360,s:e.s,l:e.l}),r({h:(n+180)%360,s:e.s,l:e.l}),r({h:(n+270)%360,s:e.s,l:e.l})]}function v(t){var e=r(t).toHsl(),n=e.h;return[r(t),r({h:(n+72)%360,s:e.s,l:e.l}),r({h:(n+216)%360,s:e.s,l:e.l})]}function y(t,e,n){e=e||6,n=n||30;var i=r(t).toHsl(),a=360/n,o=[r(t)];for(i.h=(i.h-(a*e>>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(r(i));return o}function b(t,e){e=e||6;for(var n=r(t).toHsv(),i=n.h,a=n.s,o=n.v,s=[],l=1/e;e--;)s.push(r({h:i,s:a,v:o})),o=(o+l)%1;return s}function x(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function _(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=D(r,z(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function w(t){return D(1,z(0,t))}function M(t){return parseInt(t,16)}function k(t){return 1==t.length?"0"+t:""+t}function T(t){return t<=1&&(t=100*t+"%"),t}function A(e){return t.round(255*parseFloat(e)).toString(16)}function S(t){return M(t)/255}function E(t){return!!j.CSS_UNIT.exec(t)}var L=/^\s+/,C=/\s+$/,I=0,P=t.round,D=t.min,z=t.max,O=t.random;r.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,a,o,s=this.toRgb();return e=s.r/255,r=s.g/255,n=s.b/255,i=e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4),a=r<=.03928?r/12.92:t.pow((r+.055)/1.055,2.4),o=n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4),.2126*i+.7152*a+.0722*o},setAlpha:function(t){return this._a=x(t),this._roundA=P(100*this._a)/100,this},toHsv:function(){var t=i(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=i(this._r,this._g,this._b),e=P(360*t.h),r=P(100*t.s),n=P(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=n(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=n(this._r,this._g,this._b),e=P(360*t.h),r=P(100*t.s),i=P(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+i+"%)":"hsla("+e+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(t){return a(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 a=[k(P(t).toString(16)),k(P(e).toString(16)),k(P(r).toString(16)),k(A(n))];return i&&a[0].charAt(0)==a[0].charAt(1)&&a[1].charAt(0)==a[1].charAt(1)&&a[2].charAt(0)==a[2].charAt(1)&&a[3].charAt(0)==a[3].charAt(1)?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:P(this._r),g:P(this._g),b:P(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+P(this._r)+", "+P(this._g)+", "+P(this._b)+")":"rgba("+P(this._r)+", "+P(this._g)+", "+P(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:P(100*_(this._r,255))+"%",g:P(100*_(this._g,255))+"%",b:P(100*_(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+P(100*_(this._r,255))+"%, "+P(100*_(this._g,255))+"%, "+P(100*_(this._b,255))+"%)":"rgba("+P(100*_(this._r,255))+"%, "+P(100*_(this._g,255))+"%, "+P(100*_(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(R[a(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+o(this._r,this._g,this._b,this._a),n=e,i=this._gradientType?"GradientType = 1, ":"";if(t){var a=r(t);n="#"+o(a._r,a._g,a._b,a._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+e+",endColorstr="+n+")"},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 r(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(u,arguments)},brighten:function(){return this._applyModification(h,arguments)},darken:function(){return this._applyModification(f,arguments)},desaturate:function(){return this._applyModification(s,arguments)},saturate:function(){return this._applyModification(l,arguments)},greyscale:function(){return this._applyModification(c,arguments)},spin:function(){return this._applyModification(d,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(y,arguments)},complement:function(){return this._applyCombination(p,arguments)},monochromatic:function(){return this._applyCombination(b,arguments)},splitcomplement:function(){return this._applyCombination(v,arguments)},triad:function(){return this._applyCombination(m,arguments)},tetrad:function(){return this._applyCombination(g,arguments)}},r.fromRatio=function(t,e){if("object"==typeof t){var n={};for(var i in t)t.hasOwnProperty(i)&&(n[i]="a"===i?t[i]:T(t[i]));t=n}return r(t,e)},r.equals=function(t,e){return!(!t||!e)&&r(t).toRgbString()==r(e).toRgbString()},r.random=function(){return r.fromRatio({r:O(),g:O(),b:O()})},r.mix=function(t,e,n){n=0===n?0:n||50;var i=r(t).toRgb(),a=r(e).toRgb(),o=n/100;return r({r:(a.r-i.r)*o+i.r,g:(a.g-i.g)*o+i.g,b:(a.b-i.b)*o+i.b,a:(a.a-i.a)*o+i.a})},r.readability=function(e,n){var i=r(e),a=r(n);return(t.max(i.getLuminance(),a.getLuminance())+.05)/(t.min(i.getLuminance(),a.getLuminance())+.05)},r.isReadable=function(t,e,n){var i,a,o=r.readability(t,e);switch(a=!1,(i=function(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA"),"small"!==r&&"large"!==r&&(r="small"),{level:e,size:r}}(n)).level+i.size){case"AAsmall":case"AAAlarge":a=o>=4.5;break;case"AAlarge":a=o>=3;break;case"AAAsmall":a=o>=7}return a},r.mostReadable=function(t,e,n){var i,a,o,s,l=null,c=0;a=(n=n||{}).includeFallbackColors,o=n.level,s=n.size;for(var u=0;u<e.length;u++)(i=r.readability(t,e[u]))>c&&(c=i,l=r(e[u]));return r.isReadable(t,l,{level:o,size:s})||!a?l:(n.includeFallbackColors=!1,r.mostReadable(t,["#fff","#000"],n))};var F=r.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"},R=r.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(F),j=function(){var t="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)",e="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?",r="[\\s|\\(]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")[,|\\s]+("+t+")\\s*\\)?";return{CSS_UNIT:new RegExp(t),rgb:new RegExp("rgb"+e),rgba:new RegExp("rgba"+r),hsl:new RegExp("hsl"+e),hsla:new RegExp("hsla"+r),hsv:new RegExp("hsv"+e),hsva:new RegExp("hsva"+r),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})$/}}();void 0!==e&&e.exports?e.exports=r:window.tinycolor=r}(Math)},{}],544:[function(t,e,r){"use strict";function n(t,e){var r=a(getComputedStyle(t).getPropertyValue(e));return r[0]*i(r[1],t)}function i(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 i=n(r,"font-size")/128;return e.removeChild(r),i}(t,e);case"em":return n(e,"font-size");case"rem":return n(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 o;case"cm":return o/2.54;case"mm":return o/25.4;case"pt":return o/72;case"pc":return o/6}return 1}var a=t("parse-unit");e.exports=i;var o=96},{"parse-unit":476}],545:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.topojson=t.topojson||{})}(this,function(t){"use strict";function e(t,e){var n=e.id,i=e.bbox,a=null==e.properties?{}:e.properties,o=r(t,e);return null==n&&null==i?{type:"Feature",properties:a,geometry:o}:null==i?{type:"Feature",id:n,properties:a,geometry:o}:{type:"Feature",id:n,bbox:i,properties:a,geometry:o}}function r(t,e){function r(t,e){e.length&&e.pop();for(var r=h[t<0?~t:t],n=0,i=r.length;n<i;++n)e.push(u(r[n].slice(),n));t<0&&l(e,i)}function n(t){return u(t.slice())}function i(t){for(var e=[],n=0,i=t.length;n<i;++n)r(t[n],e);return e.length<2&&e.push(e[0].slice()),e}function a(t){for(var e=i(t);e.length<4;)e.push(e[0].slice());return e}function s(t){return t.map(a)}function c(t){var e,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(c)};case"Point":e=n(t.coordinates);break;case"MultiPoint":e=t.coordinates.map(n);break;case"LineString":e=i(t.arcs);break;case"MultiLineString":e=t.arcs.map(i);break;case"Polygon":e=s(t.arcs);break;case"MultiPolygon":e=t.arcs.map(s);break;default:return null}return{type:r,coordinates:e}}var u=o(t),h=t.arcs;return c(e)}function n(t,e,r){var n,i,a;if(arguments.length>1)n=function(t,e,r){function n(t){var e=t<0?~t:t;(c[e]||(c[e]=[])).push({i:t,g:s})}function i(t){t.forEach(n)}function a(t){t.forEach(i)}function o(t){switch(s=t,t.type){case"GeometryCollection":t.geometries.forEach(o);break;case"LineString":i(t.arcs);break;case"MultiLineString":case"Polygon":a(t.arcs);break;case"MultiPolygon":!function(t){t.forEach(a)}(t.arcs)}}var s,l=[],c=[];return o(e),c.forEach(null==r?function(t){l.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&l.push(t[0].i)}),l}(0,e,r);else for(i=0,n=new Array(a=t.arcs.length);i<a;++i)n[i]=i;return{type:"MultiLineString",arcs:c(t,n)}}function i(t,e){function n(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(n);break;case"Polygon":i(t.arcs);break;case"MultiPolygon":t.arcs.forEach(i)}}function i(t){t.forEach(function(e){e.forEach(function(e){(o[e=e<0?~e:e]||(o[e]=[])).push(t)})}),s.push(t)}function a(e){return function(t){for(var e,r=-1,n=t.length,i=t[n-1],a=0;++r<n;)e=i,i=t[r],a+=e[0]*i[1]-e[1]*i[0];return Math.abs(a)}(r(t,{type:"Polygon",arcs:[e]}).coordinates[0])}var o={},s=[],l=[];return e.forEach(n),s.forEach(function(t){if(!t._){var e=[],r=[t];for(t._=1,l.push(e);t=r.pop();)e.push(t),t.forEach(function(t){t.forEach(function(t){o[t<0?~t:t].forEach(function(t){t._||(t._=1,r.push(t))})})})}}),s.forEach(function(t){delete t._}),{type:"MultiPolygon",arcs:l.map(function(e){var r,n=[];if(e.forEach(function(t){t.forEach(function(t){t.forEach(function(t){o[t<0?~t:t].length<2&&n.push(t)})})}),n=c(t,n),(r=n.length)>1)for(var i,s,l=1,u=a(n[0]);l<r;++l)(i=a(n[l]))>u&&(s=n[0],n[0]=n[l],n[l]=s,u=i);return n})}}var a=function(t){return t},o=function(t){if(null==(e=t.transform))return a;var e,r,n,i=e.scale[0],o=e.scale[1],s=e.translate[0],l=e.translate[1];return function(t,e){return e||(r=n=0),t[0]=(r+=t[0])*i+s,t[1]=(n+=t[1])*o+l,t}},s=function(t){function e(t){l[0]=t[0],l[1]=t[1],s(l),l[0]<c&&(c=l[0]),l[0]>h&&(h=l[0]),l[1]<u&&(u=l[1]),l[1]>f&&(f=l[1])}function r(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(r);break;case"Point":e(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(e)}}var n=t.bbox;if(!n){var i,a,s=o(t),l=new Array(2),c=1/0,u=c,h=-c,f=-c;t.arcs.forEach(function(t){for(var e=-1,r=t.length;++e<r;)i=t[e],l[0]=i[0],l[1]=i[1],s(l,e),l[0]<c&&(c=l[0]),l[0]>h&&(h=l[0]),l[1]<u&&(u=l[1]),l[1]>f&&(f=l[1])});for(a in t.objects)r(t.objects[a]);n=t.bbox=[c,u,h,f]}return n},l=function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r},c=function(t,e){function r(t,e){for(var r in t){var i=t[r];delete e[i.start],delete i.start,delete i.end,i.forEach(function(t){n[t<0?~t:t]=1}),o.push(i)}}var n={},i={},a={},o=[],s=-1;return e.forEach(function(r,n){var i,a=t.arcs[r<0?~r:r];a.length<3&&!a[1][0]&&!a[1][1]&&(i=e[++s],e[s]=r,e[n]=i)}),e.forEach(function(e){var r,n,o=function(e){var r,n=t.arcs[e<0?~e:e],i=n[0];return t.transform?(r=[0,0],n.forEach(function(t){r[0]+=t[0],r[1]+=t[1]})):r=n[n.length-1],e<0?[r,i]:[i,r]}(e),s=o[0],l=o[1];if(r=a[s])if(delete a[r.end],r.push(e),r.end=l,n=i[l]){delete i[n.start];var c=n===r?r:r.concat(n);i[c.start=r.start]=a[c.end=n.end]=c}else i[r.start]=a[r.end]=r;else if(r=i[l])if(delete i[r.start],r.unshift(e),r.start=s,n=a[s]){delete a[n.end];var u=n===r?r:n.concat(r);i[u.start=n.start]=a[u.end=r.end]=u}else i[r.start]=a[r.end]=r;else i[(r=[e]).start=s]=a[r.end=l]=r}),r(a,i),r(i,a),e.forEach(function(t){n[t<0?~t:t]||o.push([t])}),o},u=function(t,e){for(var r=0,n=t.length;r<n;){var i=r+n>>>1;t[i]<e?r=i+1:n=i}return r};t.bbox=s,t.feature=function(t,r){return"GeometryCollection"===r.type?{type:"FeatureCollection",features:r.geometries.map(function(r){return e(t,r)})}:e(t,r)},t.mesh=function(t){return r(t,n.apply(this,arguments))},t.meshArcs=n,t.merge=function(t){return r(t,i.apply(this,arguments))},t.mergeArcs=i,t.neighbors=function(t){function e(t,e){t.forEach(function(t){t<0&&(t=~t);var r=i[t];r?r.push(e):i[t]=[e]})}function r(t,r){t.forEach(function(t){e(t,r)})}function n(t,e){"GeometryCollection"===t.type?t.geometries.forEach(function(t){n(t,e)}):t.type in o&&o[t.type](t.arcs,e)}var i={},a=t.map(function(){return[]}),o={LineString:e,MultiLineString:r,Polygon:r,MultiPolygon:function(t,e){t.forEach(function(t){r(t,e)})}};t.forEach(n);for(var s in i)for(var l=i[s],c=l.length,h=0;h<c;++h)for(var f=h+1;f<c;++f){var d,p=l[h],m=l[f];(d=a[p])[s=u(d,m)]!==m&&d.splice(s,0,m),(d=a[m])[s=u(d,p)]!==p&&d.splice(s,0,p)}return a},t.quantize=function(t,e){function r(t){t[0]=Math.round((t[0]-o)/l),t[1]=Math.round((t[1]-c)/u)}function n(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(n);break;case"Point":r(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(r)}}if(!((e=Math.floor(e))>=2))throw new Error("n must be \u22652");if(t.transform)throw new Error("already quantized");var i,a=s(t),o=a[0],l=(a[2]-o)/(e-1)||1,c=a[1],u=(a[3]-c)/(e-1)||1;t.arcs.forEach(function(t){for(var e,r,n,i=1,a=1,s=t.length,h=t[0],f=h[0]=Math.round((h[0]-o)/l),d=h[1]=Math.round((h[1]-c)/u);i<s;++i)h=t[i],r=Math.round((h[0]-o)/l),n=Math.round((h[1]-c)/u),r===f&&n===d||((e=t[a++])[0]=r-f,f=r,e[1]=n-d,d=n);a<2&&((e=t[a++])[0]=0,e[1]=0),t.length=a});for(i in t.objects)n(t.objects[i]);return t.transform={scale:[l,u],translate:[o,c]},t},t.transform=o,t.untransform=function(t){if(null==(e=t.transform))return a;var e,r,n,i=e.scale[0],o=e.scale[1],s=e.translate[0],l=e.translate[1];return function(t,e){e||(r=n=0);var a=Math.round((t[0]-s)/i),c=Math.round((t[1]-l)/o);return t[0]=a-r,r=a,t[1]=c-n,n=c,t}},Object.defineProperty(t,"__esModule",{value:!0})})},{}],546:[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;o<e;++o){for(var s=n.unrank(t,o),l=[0],c=0,u=0;u<s.length;++u)c+=1<<s[u],l.push(c);i(s)<1&&(l[0]=c,l[t]=0),r.push(l)}return r};var n=t("permutation-rank"),i=t("permutation-parity"),a=t("gamma")},{gamma:137,"permutation-parity":480,"permutation-rank":481}],547:[function(t,e,r){"use strict";function n(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function i(t){return Math.min(1,Math.max(-1,t))}function a(t){var e=Math.abs(t[0]),r=Math.abs(t[1]),n=Math.abs(t[2]),i=[0,0,0];e>Math.max(r,n)?i[2]=1:r>Math.max(e,n)?i[0]=1:i[1]=1;for(var a=0,o=0,s=0;s<3;++s)a+=t[s]*t[s],o+=i[s]*t[s];for(s=0;s<3;++s)i[s]-=o/a*t[s];return h(i,i),i}function o(t,e,r,n,i,a,o,l){this.center=s(r),this.up=s(n),this.right=s(i),this.radius=s([a]),this.angle=s([o,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)}e.exports=function(t){var e=(t=t||{}).center||[0,0,0],r=t.up||[0,1,0],i=t.right||a(r),s=t.radius||1,l=t.theta||0,c=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),h(r,r),i=[].slice.call(i,0,3),h(i,i),"eye"in t){var d=t.eye,p=[d[0]-e[0],d[1]-e[1],d[2]-e[2]];u(i,p,r),n(i[0],i[1],i[2])<1e-6?i=a(r):h(i,i),s=n(p[0],p[1],p[2]);var m=f(r,p)/s,g=f(i,p)/s;c=Math.acos(m),l=Math.acos(g)}return s=Math.log(s),new o(t.zoomMin,t.zoomMax,e,r,i,s,l,c)};var s=t("filtered-vector"),l=t("gl-mat4/invert"),c=t("gl-mat4/rotate"),u=t("gl-vec3/cross"),h=t("gl-vec3/normalize"),f=t("gl-vec3/dot"),d=o.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,i=0,a=0,o=0;o<3;++o)a+=e[o]*r[o],i+=e[o]*e[o];var s=Math.sqrt(i),l=0;for(o=0;o<3;++o)r[o]-=e[o]*a/i,l+=r[o]*r[o],e[o]/=s;var c=Math.sqrt(l);for(o=0;o<3;++o)r[o]/=c;var f=this.computedToward;u(f,e,r),h(f,f);var d=Math.exp(this.computedRadius[0]),p=this.computedAngle[0],m=this.computedAngle[1],g=Math.cos(p),v=Math.sin(p),y=Math.cos(m),b=Math.sin(m),x=this.computedCenter,_=g*y,w=v*y,M=b,k=-g*b,T=-v*b,A=y,S=this.computedEye,E=this.computedMatrix;for(o=0;o<3;++o){var L=_*r[o]+w*f[o]+M*e[o];E[4*o+1]=k*r[o]+T*f[o]+A*e[o],E[4*o+2]=L,E[4*o+3]=0}var C=E[1],I=E[5],P=E[9],D=E[2],z=E[6],O=E[10],F=I*O-P*z,R=P*D-C*O,j=C*z-I*D,N=n(F,R,j);F/=N,R/=N,j/=N,E[0]=F,E[4]=R,E[8]=j;for(o=0;o<3;++o)S[o]=x[o]+E[2+4*o]*d;for(o=0;o<3;++o){l=0;for(var B=0;B<3;++B)l+=E[o+4*B]*S[B];E[12+o]=-l}E[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 a=this.computedUp,o=this.computedRight,s=this.computedToward,l=0;l<3;++l)i[4*l]=a[l],i[4*l+1]=o[l],i[4*l+2]=s[l];c(i,i,n,p);for(l=0;l<3;++l)a[l]=i[4*l],o[l]=i[4*l+1];this.up.set(t,a[0],a[1],a[2]),this.right.set(t,o[0],o[1],o[2])}},d.pan=function(t,e,r,i){e=e||0,r=r||0,i=i||0,this.recalcMatrix(t);var a=this.computedMatrix,o=(Math.exp(this.computedRadius[0]),a[1]),s=a[5],l=a[9],c=n(o,s,l);o/=c,s/=c,l/=c;var u=a[0],h=a[4],f=a[8],d=u*o+h*s+f*l,p=n(u-=o*d,h-=s*d,f-=l*d),m=(u/=p)*e+o*r,g=(h/=p)*e+s*r,v=(f/=p)*e+l*r;this.center.move(t,m,g,v);var y=Math.exp(this.computedRadius[0]);y=Math.max(1e-4,y+i),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,a){var o=1;"number"==typeof r&&(o=0|r),(o<0||o>3)&&(o=1);var s=(o+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var c=e[o],u=e[o+4],h=e[o+8];if(a){var f=Math.abs(c),d=Math.abs(u),p=Math.abs(h),m=Math.max(f,d,p);f===m?(c=c<0?-1:1,u=h=0):p===m?(h=h<0?-1:1,c=u=0):(u=u<0?-1:1,c=h=0)}else{var g=n(c,u,h);c/=g,u/=g,h/=g}var v=e[s],y=e[s+4],b=e[s+8],x=v*c+y*u+b*h,_=n(v-=c*x,y-=u*x,b-=h*x),w=u*(b/=_)-h*(y/=_),M=h*(v/=_)-c*b,k=c*y-u*v,T=n(w,M,k);w/=T,M/=T,k/=T,this.center.jump(t,q,G,Y),this.radius.idle(t),this.up.jump(t,c,u,h),this.right.jump(t,v,y,b);var A,S;if(2===o){var E=e[1],L=e[5],C=e[9],I=E*v+L*y+C*b,P=E*w+L*M+C*k;A=F<0?-Math.PI/2:Math.PI/2,S=Math.atan2(P,I)}else{var D=e[2],z=e[6],O=e[10],F=D*c+z*u+O*h,R=D*v+z*y+O*b,j=D*w+z*M+O*k;A=Math.asin(i(F)),S=Math.atan2(j,R)}this.angle.jump(t,S,A),this.recalcMatrix(t);var N=e[2],B=e[6],U=e[10],V=this.computedMatrix;l(V,e);var H=V[15],q=V[12]/H,G=V[13]/H,Y=V[14]/H,W=Math.exp(this.computedRadius[0]);this.center.jump(t,q-N*W,G-B*W,Y-U*W)},d.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},d.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},d.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},d.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},d.lookAt=function(t,e,r,a){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter;var o=(a=a||this.computedUp)[0],s=a[1],l=a[2],c=n(o,s,l);if(!(c<1e-6)){o/=c,s/=c,l/=c;var u=e[0]-r[0],h=e[1]-r[1],f=e[2]-r[2],d=n(u,h,f);if(!(d<1e-6)){u/=d,h/=d,f/=d;var p=this.computedRight,m=p[0],g=p[1],v=p[2],y=o*m+s*g+l*v,b=n(m-=y*o,g-=y*s,v-=y*l);if(!(b<.01&&(m=s*f-l*h,g=l*u-o*f,v=o*h-s*u,(b=n(m,g,v))<1e-6))){m/=b,g/=b,v/=b,this.up.set(t,o,s,l),this.right.set(t,m,g,v),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(d));var x=s*v-l*g,_=l*m-o*v,w=o*g-s*m,M=n(x,_,w),k=o*u+s*h+l*f,T=m*u+g*h+v*f,A=(x/=M)*u+(_/=M)*h+(w/=M)*f,S=Math.asin(i(k)),E=Math.atan2(A,T),L=this.angle._state,C=L[L.length-1],I=L[L.length-2];C%=2*Math.PI;var P=Math.abs(C+2*Math.PI-E),D=Math.abs(C-E),z=Math.abs(C-2*Math.PI-E);P<D&&(C+=2*Math.PI),z<D&&(C-=2*Math.PI),this.angle.jump(this.angle.lastT(),C,I),this.angle.set(t,E,S)}}}}},{"filtered-vector":134,"gl-mat4/invert":182,"gl-mat4/rotate":186,"gl-vec3/cross":273,"gl-vec3/dot":274,"gl-vec3/normalize":277}],548:[function(t,e,r){"use strict";e.exports=function(t,e,r){var i=t*e,a=n*t,o=a-(a-t),s=t-o,l=n*e,c=l-(l-e),u=e-c,h=s*u-(i-o*c-s*c-o*u);return r?(r[0]=h,r[1]=i,r):[h,i]};var n=+(Math.pow(2,27)+1)},{}],549:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n=t+e,i=n-t,a=e-i,o=t-(n-i);return r?(r[0]=o+a,r[1]=n,r):[o+a,n]}},{}],550:[function(t,e,r){(function(e,n){"use strict";function i(t){if(t){var e=t.length||t.byteLength,r=v.log2(e);_[r].push(t)}}function a(t){t=v.nextPow2(t);var e=v.log2(t),r=_[e];return r.length>0?r.pop():new ArrayBuffer(t)}function o(t){return new Uint8Array(a(t),0,t)}function s(t){return new Uint16Array(a(2*t),0,t)}function l(t){return new Uint32Array(a(4*t),0,t)}function c(t){return new Int8Array(a(t),0,t)}function u(t){return new Int16Array(a(2*t),0,t)}function h(t){return new Int32Array(a(4*t),0,t)}function f(t){return new Float32Array(a(4*t),0,t)}function d(t){return new Float64Array(a(8*t),0,t)}function p(t){return b?new Uint8ClampedArray(a(t),0,t):o(t)}function m(t){return new DataView(a(t),0,t)}function g(t){t=v.nextPow2(t);var e=v.log2(t),r=w[e];return r.length>0?r.pop():new n(t)}var v=t("bit-twiddle"),y=t("dup");e.__TYPEDARRAY_POOL||(e.__TYPEDARRAY_POOL={UINT8:y([32,0]),UINT16:y([32,0]),UINT32:y([32,0]),INT8:y([32,0]),INT16:y([32,0]),INT32:y([32,0]),FLOAT:y([32,0]),DOUBLE:y([32,0]),DATA:y([32,0]),UINT8C:y([32,0]),BUFFER:y([32,0])});var b="undefined"!=typeof Uint8ClampedArray,x=e.__TYPEDARRAY_POOL;x.UINT8C||(x.UINT8C=y([32,0])),x.BUFFER||(x.BUFFER=y([32,0]));var _=x.DATA,w=x.BUFFER;r.free=function(t){if(n.isBuffer(t))w[v.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|v.log2(e);_[r].push(t)}},r.freeUint8=r.freeUint16=r.freeUint32=r.freeInt8=r.freeInt16=r.freeInt32=r.freeFloat32=r.freeFloat=r.freeFloat64=r.freeDouble=r.freeUint8Clamped=r.freeDataView=function(t){i(t.buffer)},r.freeArrayBuffer=i,r.freeBuffer=function(t){w[v.log2(t.length)].push(t)},r.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return a(t);switch(e){case"uint8":return o(t);case"uint16":return s(t);case"uint32":return l(t);case"int8":return c(t);case"int16":return u(t);case"int32":return h(t);case"float":case"float32":return f(t);case"double":case"float64":return d(t);case"uint8_clamped":return p(t);case"buffer":return g(t);case"data":case"dataview":return m(t);default:return null}return null},r.mallocArrayBuffer=a,r.mallocUint8=o,r.mallocUint16=s,r.mallocUint32=l,r.mallocInt8=c,r.mallocInt16=u,r.mallocInt32=h,r.mallocFloat32=r.mallocFloat=f,r.mallocFloat64=r.mallocDouble=d,r.mallocUint8Clamped=p,r.mallocDataView=m,r.mallocBuffer=g,r.clearCache=function(){for(var t=0;t<32;++t)x.UINT8[t].length=0,x.UINT16[t].length=0,x.UINT32[t].length=0,x.INT8[t].length=0,x.INT16[t].length=0,x.INT32[t].length=0,x.FLOAT[t].length=0,x.DOUBLE[t].length=0,x.UINT8C[t].length=0,_[t].length=0,w[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"bit-twiddle":68,buffer:78,dup:126}],551:[function(t,e,r){"use strict";"use restrict";function n(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e<t;++e)this.roots[e]=e,this.ranks[e]=0}e.exports=n;var i=n.prototype;Object.defineProperty(i,"length",{get:function(){return this.roots.length}}),i.makeSet=function(){var t=this.roots.length;return this.roots.push(t),this.ranks.push(0),t},i.find=function(t){for(var e=t,r=this.roots;r[t]!==t;)t=r[t];for(;r[e]!==t;){var n=r[e];r[e]=t,e=n}return t},i.link=function(t,e){var r=this.find(t),n=this.find(e);if(r!==n){var i=this.ranks,a=this.roots,o=i[r],s=i[n];o<s?a[r]=n:s<o?a[n]=r:(a[n]=r,++i[r])}}},{}],552:[function(t,e,r){"use strict";e.exports=function(t,e,r){return 0===t.length?t:e?(r||t.sort(e),function(t,e){for(var r=1,n=t.length,i=t[0],a=t[0],o=1;o<n;++o)if(a=i,i=t[o],e(i,a)){if(o===r){r++;continue}t[r++]=i}return t.length=r,t}(t,e)):(r||t.sort(),function(t){for(var e=1,r=t.length,n=t[0],i=t[0],a=1;a<r;++a,i=n)if(i=n,(n=t[a])!==i){if(a===e){e++;continue}t[e++]=n}return t.length=e,t}(t))}},{}],553:[function(t,e,r){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}e.exports=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){void 0===e&&(e=1e-6);var r,n,i,a,o;for(i=t,o=0;o<8;o++){if(a=this.sampleCurveX(i)-t,Math.abs(a)<e)return i;var s=this.sampleCurveDerivativeX(i);if(Math.abs(s)<1e-6)break;i-=a/s}if(r=0,n=1,(i=t)<r)return r;if(i>n)return n;for(;r<n;){if(a=this.sampleCurveX(i),Math.abs(a-t)<e)return i;t>a?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],554:[function(t,e,r){"use strict";function n(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function i(t,e,r){if(t&&o.isObject(t)&&t instanceof n)return t;var i=new n;return i.parse(t,e,r),i}var a=t("punycode"),o=t("./util");r.parse=i,r.resolve=function(t,e){return i(t,!1,!0).resolve(e)},r.resolveObject=function(t,e){return t?i(t,!1,!0).resolveObject(e):e},r.format=function(t){return o.isString(t)&&(t=i(t)),t instanceof n?t.format():n.prototype.format.call(t)},r.Url=n;var s=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,c=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,u=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),h=["'"].concat(u),f=["%","/","?",";","#"].concat(h),d=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,m=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},y={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},b=t("querystring");n.prototype.parse=function(t,e,r){if(!o.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var n=t.indexOf("?"),i=-1!==n&&n<t.indexOf("#")?"?":"#",l=t.split(i);l[0]=l[0].replace(/\\/g,"/");var u=t=l.join(i);if(u=u.trim(),!r&&1===t.split("#").length){var x=c.exec(u);if(x)return this.path=u,this.href=u,this.pathname=x[1],x[2]?(this.search=x[2],this.query=e?b.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var _=s.exec(u);if(_){var w=(_=_[0]).toLowerCase();this.protocol=w,u=u.substr(_.length)}if(r||_||u.match(/^\/\/[^@\/]+@[^@\/]+/)){var M="//"===u.substr(0,2);!M||_&&v[_]||(u=u.substr(2),this.slashes=!0)}if(!v[_]&&(M||_&&!y[_])){for(var k=-1,T=0;T<d.length;T++){-1!==(E=u.indexOf(d[T]))&&(-1===k||E<k)&&(k=E)}var A,S;-1!==(S=-1===k?u.lastIndexOf("@"):u.lastIndexOf("@",k))&&(A=u.slice(0,S),u=u.slice(S+1),this.auth=decodeURIComponent(A)),k=-1;for(T=0;T<f.length;T++){var E;-1!==(E=u.indexOf(f[T]))&&(-1===k||E<k)&&(k=E)}-1===k&&(k=u.length),this.host=u.slice(0,k),u=u.slice(k),this.parseHost(),this.hostname=this.hostname||"";var L="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!L)for(var C=this.hostname.split(/\./),I=(T=0,C.length);T<I;T++){var P=C[T];if(P&&!P.match(p)){for(var D="",z=0,O=P.length;z<O;z++)P.charCodeAt(z)>127?D+="x":D+=P[z];if(!D.match(p)){var F=C.slice(0,T),R=C.slice(T+1),j=P.match(m);j&&(F.push(j[1]),R.unshift(j[2])),R.length&&(u="/"+R.join(".")+u),this.hostname=F.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),L||(this.hostname=a.toASCII(this.hostname));var N=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+N,this.href+=this.host,L&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!g[w])for(T=0,I=h.length;T<I;T++){var U=h[T];if(-1!==u.indexOf(U)){var V=encodeURIComponent(U);V===U&&(V=escape(U)),u=u.split(U).join(V)}}var H=u.indexOf("#");-1!==H&&(this.hash=u.substr(H),u=u.slice(0,H));var q=u.indexOf("?");if(-1!==q?(this.search=u.substr(q),this.query=u.substr(q+1),e&&(this.query=b.parse(this.query)),u=u.slice(0,q)):e&&(this.search="",this.query={}),u&&(this.pathname=u),y[w]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){N=this.pathname||"";var G=this.search||"";this.path=N+G}return this.href=this.format(),this},n.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",r=this.pathname||"",n=this.hash||"",i=!1,a="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&o.isObject(this.query)&&Object.keys(this.query).length&&(a=b.stringify(this.query));var s=this.search||a&&"?"+a||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||y[e])&&!1!==i?(i="//"+(i||""),r&&"/"!==r.charAt(0)&&(r="/"+r)):i||(i=""),n&&"#"!==n.charAt(0)&&(n="#"+n),s&&"?"!==s.charAt(0)&&(s="?"+s),r=r.replace(/[?#]/g,function(t){return encodeURIComponent(t)}),s=s.replace("#","%23"),e+i+r+s+n},n.prototype.resolve=function(t){return this.resolveObject(i(t,!1,!0)).format()},n.prototype.resolveObject=function(t){if(o.isString(t)){var e=new n;e.parse(t,!1,!0),t=e}for(var r=new n,i=Object.keys(this),a=0;a<i.length;a++){var s=i[a];r[s]=this[s]}if(r.hash=t.hash,""===t.href)return r.href=r.format(),r;if(t.slashes&&!t.protocol){for(var l=Object.keys(t),c=0;c<l.length;c++){var u=l[c];"protocol"!==u&&(r[u]=t[u])}return y[r.protocol]&&r.hostname&&!r.pathname&&(r.path=r.pathname="/"),r.href=r.format(),r}if(t.protocol&&t.protocol!==r.protocol){if(!y[t.protocol]){for(var h=Object.keys(t),f=0;f<h.length;f++){var d=h[f];r[d]=t[d]}return r.href=r.format(),r}if(r.protocol=t.protocol,t.host||v[t.protocol])r.pathname=t.pathname;else{for(var p=(t.pathname||"").split("/");p.length&&!(t.host=p.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==p[0]&&p.unshift(""),p.length<2&&p.unshift(""),r.pathname=p.join("/")}if(r.search=t.search,r.query=t.query,r.host=t.host||"",r.auth=t.auth,r.hostname=t.hostname||t.host,r.port=t.port,r.pathname||r.search){var m=r.pathname||"",g=r.search||"";r.path=m+g}return r.slashes=r.slashes||t.slashes,r.href=r.format(),r}var b=r.pathname&&"/"===r.pathname.charAt(0),x=t.host||t.pathname&&"/"===t.pathname.charAt(0),_=x||b||r.host&&t.pathname,w=_,M=r.pathname&&r.pathname.split("/")||[],k=(p=t.pathname&&t.pathname.split("/")||[],r.protocol&&!y[r.protocol]);if(k&&(r.hostname="",r.port=null,r.host&&(""===M[0]?M[0]=r.host:M.unshift(r.host)),r.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===p[0]?p[0]=t.host:p.unshift(t.host)),t.host=null),_=_&&(""===p[0]||""===M[0])),x)r.host=t.host||""===t.host?t.host:r.host,r.hostname=t.hostname||""===t.hostname?t.hostname:r.hostname,r.search=t.search,r.query=t.query,M=p;else if(p.length)M||(M=[]),M.pop(),M=M.concat(p),r.search=t.search,r.query=t.query;else if(!o.isNullOrUndefined(t.search)){if(k){r.hostname=r.host=M.shift();(C=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=C.shift(),r.host=r.hostname=C.shift())}return r.search=t.search,r.query=t.query,o.isNull(r.pathname)&&o.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!M.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var T=M.slice(-1)[0],A=(r.host||t.host||M.length>1)&&("."===T||".."===T)||""===T,S=0,E=M.length;E>=0;E--)"."===(T=M[E])?M.splice(E,1):".."===T?(M.splice(E,1),S++):S&&(M.splice(E,1),S--);if(!_&&!w)for(;S--;S)M.unshift("..");!_||""===M[0]||M[0]&&"/"===M[0].charAt(0)||M.unshift(""),A&&"/"!==M.join("/").substr(-1)&&M.push("");var L=""===M[0]||M[0]&&"/"===M[0].charAt(0);if(k){r.hostname=r.host=L?"":M.length?M.shift():"";var C;(C=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=C.shift(),r.host=r.hostname=C.shift())}return(_=_||r.host&&M.length)&&!L&&M.unshift(""),M.length?r.pathname=M.join("/"):(r.pathname=null,r.path=null),o.isNull(r.pathname)&&o.isNull(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var t=this.host,e=l.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":555,punycode:497,querystring:501}],555:[function(t,e,r){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],556:[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}},{}],557:[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}},{}],558:[function(t,e,r){(function(e,n){function i(t,e){var n={seen:[],stylize:o};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),h(e)?n.showHidden=e:e&&r._extend(n,e),m(n.showHidden)&&(n.showHidden=!1),m(n.depth)&&(n.depth=2),m(n.colors)&&(n.colors=!1),m(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),s(n,t,n.depth)}function a(t,e){var r=i.styles[e];return r?"\x1b["+i.colors[r][0]+"m"+t+"\x1b["+i.colors[r][1]+"m":t}function o(t,e){return t}function s(t,e,n){if(t.customInspect&&e&&x(e.inspect)&&e.inspect!==r.inspect&&(!e.constructor||e.constructor.prototype!==e)){var i=e.inspect(n,t);return p(i)||(i=s(t,i,n)),i}var a=function(t,e){if(m(e))return t.stylize("undefined","undefined");if(p(e)){var r="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(r,"string")}if(d(e))return t.stylize(""+e,"number");if(h(e))return t.stylize(""+e,"boolean");if(f(e))return t.stylize("null","null")}(t,e);if(a)return a;var o=Object.keys(e),v=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(e)),b(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(e);if(0===o.length){if(x(e)){var _=e.name?": "+e.name:"";return t.stylize("[Function"+_+"]","special")}if(g(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(y(e))return t.stylize(Date.prototype.toString.call(e),"date");if(b(e))return l(e)}var w="",k=!1,T=["{","}"];if(u(e)&&(k=!0,T=["[","]"]),x(e)){w=" [Function"+(e.name?": "+e.name:"")+"]"}if(g(e)&&(w=" "+RegExp.prototype.toString.call(e)),y(e)&&(w=" "+Date.prototype.toUTCString.call(e)),b(e)&&(w=" "+l(e)),0===o.length&&(!k||0==e.length))return T[0]+w+T[1];if(n<0)return g(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var A;return A=k?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o<s;++o)M(e,String(o))?a.push(c(t,e,r,n,String(o),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(c(t,e,r,n,i,!0))}),a}(t,e,n,v,o):o.map(function(r){return c(t,e,n,v,r,k)}),t.seen.pop(),function(t,e,r){if(t.reduce(function(t,e){return 0,e.indexOf("\n")>=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]}(A,w,T)}function l(t){return"["+Error.prototype.toString.call(t)+"]"}function c(t,e,r,n,i,a){var o,l,c;if((c=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?l=c.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):c.set&&(l=t.stylize("[Setter]","special")),M(n,i)||(o="["+i+"]"),l||(t.seen.indexOf(c.value)<0?(l=f(r)?s(t,c.value,null):s(t,c.value,r-1)).indexOf("\n")>-1&&(l=a?l.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+l.split("\n").map(function(t){return" "+t}).join("\n")):l=t.stylize("[Circular]","special")),m(o)){if(a&&i.match(/^\d+$/))return l;(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+": "+l}function u(t){return Array.isArray(t)}function h(t){return"boolean"==typeof t}function f(t){return null===t}function d(t){return"number"==typeof t}function p(t){return"string"==typeof t}function m(t){return void 0===t}function g(t){return v(t)&&"[object RegExp]"===_(t)}function v(t){return"object"==typeof t&&null!==t}function y(t){return v(t)&&"[object Date]"===_(t)}function b(t){return v(t)&&("[object Error]"===_(t)||t instanceof Error)}function x(t){return"function"==typeof t}function _(t){return Object.prototype.toString.call(t)}function w(t){return t<10?"0"+t.toString(10):t.toString(10)}function M(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var k=/%[sdj%]/g;r.format=function(t){if(!p(t)){for(var e=[],r=0;r<arguments.length;r++)e.push(i(arguments[r]));return e.join(" ")}r=1;for(var n=arguments,a=n.length,o=String(t).replace(k,function(t){if("%%"===t)return"%";if(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}}),s=n[r];r<a;s=n[++r])f(s)||!v(s)?o+=" "+s:o+=" "+i(s);return o},r.deprecate=function(t,i){if(m(n.process))return function(){return r.deprecate(t,i).apply(this,arguments)};if(!0===e.noDeprecation)return t;var a=!1;return function(){if(!a){if(e.throwDeprecation)throw new Error(i);e.traceDeprecation?console.trace(i):console.error(i),a=!0}return t.apply(this,arguments)}};var T,A={};r.debuglog=function(t){if(m(T)&&(T=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!A[t])if(new RegExp("\\b"+t+"\\b","i").test(T)){var n=e.pid;A[t]=function(){var e=r.format.apply(r,arguments);console.error("%s %d: %s",t,n,e)}}else A[t]=function(){};return A[t]},r.inspect=i,i.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]},i.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=u,r.isBoolean=h,r.isNull=f,r.isNullOrUndefined=function(t){return null==t},r.isNumber=d,r.isString=p,r.isSymbol=function(t){return"symbol"==typeof t},r.isUndefined=m,r.isRegExp=g,r.isObject=v,r.isDate=y,r.isError=b,r.isFunction=x,r.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},r.isBuffer=t("./support/isBuffer");var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",function(){var t=new Date,e=[w(t.getHours()),w(t.getMinutes()),w(t.getSeconds())].join(":");return[t.getDate(),S[t.getMonth()],e].join(" ")}(),r.format.apply(r,arguments))},r.inherits=t("inherits"),r._extend=function(t,e){if(!e||!v(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":557,_process:496,inherits:556}],559:[function(t,e,r){e.exports.VectorTile=t("./lib/vectortile.js"),e.exports.VectorTileFeature=t("./lib/vectortilefeature.js"),e.exports.VectorTileLayer=t("./lib/vectortilelayer.js")},{"./lib/vectortile.js":560,"./lib/vectortilefeature.js":561,"./lib/vectortilelayer.js":562}],560:[function(t,e,r){"use strict";function n(t,e,r){if(3===t){var n=new i(r,r.readVarint()+r.pos);n.length&&(e[n.name]=n)}}var i=t("./vectortilelayer");e.exports=function(t,e){this.layers=t.readFields(n,{},e)}},{"./vectortilelayer":562}],561:[function(t,e,r){"use strict";function n(t,e,r,n,a){this.properties={},this.extent=r,this.type=0,this._pbf=t,this._geometry=-1,this._keys=n,this._values=a,t.readFields(i,this,e)}function i(t,e,r){1==t?e.id=r.readVarint():2==t?function(t,e){var r=t.readVarint()+t.pos;for(;t.pos<r;){var n=e._keys[t.readVarint()],i=e._values[t.readVarint()];e.properties[n]=i}}(r,e):3==t?e.type=r.readVarint():4==t&&(e._geometry=r.pos)}var a=t("point-geometry");e.exports=n,n.types=["Unknown","Point","LineString","Polygon"],n.prototype.loadGeometry=function(){var t=this._pbf;t.pos=this._geometry;for(var e,r=t.readVarint()+t.pos,n=1,i=0,o=0,s=0,l=[];t.pos<r;){if(!i){var c=t.readVarint();n=7&c,i=c>>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},n.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<e;){if(!n){var u=t.readVarint();r=7&u,n=u>>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),i<o&&(o=i),i>s&&(s=i),a<l&&(l=a),a>c&&(c=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,c]},n.prototype.toGeoJSON=function(t,e,r){function i(t){for(var e=0;e<t.length;e++){var r=t[e],n=180-360*(r.y+c)/s;t[e]=[360*(r.x+l)/s-180,360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90]}}var a,o,s=this.extent*Math.pow(2,r),l=this.extent*t,c=this.extent*e,u=this.loadGeometry(),h=n.types[this.type];switch(this.type){case 1:var f=[];for(a=0;a<u.length;a++)f[a]=u[a][0];i(u=f);break;case 2:for(a=0;a<u.length;a++)i(u[a]);break;case 3:for(u=function(t){var e=t.length;if(e<=1)return[t];for(var r,n,i=[],a=0;a<e;a++){var o=function(t){for(var e,r,n=0,i=0,a=t.length,o=a-1;i<a;o=i++)e=t[i],r=t[o],n+=(r.x-e.x)*(e.y+r.y);return n}(t[a]);0!==o&&(void 0===n&&(n=o<0),n===o<0?(r&&i.push(r),r=[t[a]]):r.push(t[a]))}return r&&i.push(r),i}(u),a=0;a<u.length;a++)for(o=0;o<u[a].length;o++)i(u[a][o])}1===u.length?u=u[0]:h="Multi"+h;var d={type:"Feature",geometry:{type:h,coordinates:u},properties:this.properties};return"id"in this&&(d.id=this.id),d}},{"point-geometry":485}],562:[function(t,e,r){"use strict";function n(t,e){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=t,this._keys=[],this._values=[],this._features=[],t.readFields(i,this,e),this.length=this._features.length}function i(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():5===t?e.extent=r.readVarint():2===t?e._features.push(r.pos):3===t?e._keys.push(r.readString()):4===t&&e._values.push(function(t){var e=null,r=t.readVarint()+t.pos;for(;t.pos<r;){var n=t.readVarint()>>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))}var a=t("./vectortilefeature.js");e.exports=n,n.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 a(this._pbf,e,this.extent,this._keys,this._values)}},{"./vectortilefeature.js":561}],563:[function(t,e,r){"use strict";e.exports=function(t,e){return"object"==typeof e&&null!==e||(e={}),n(t,e.canvas||i,e.context||a,e)};var n=t("./lib/vtext"),i=null,a=null;"undefined"!=typeof document&&((i=document.createElement("canvas")).width=8192,i.height=1024,a=i.getContext("2d"))},{"./lib/vtext":564}],564:[function(t,e,r){"use strict";function n(t,e,r,n){var i=function(t,e){var r=a(t,128);return e?s(r.cells,r.positions,.25):{edges:r.cells,positions:r.positions}}(t,n),o=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<s;++l)for(var c=t[l],u=0;u<2;++u)a[u]=0|Math.min(a[u],c[u]),o[u]=0|Math.max(o[u],c[u]);var h=0;switch(n){case"center":h=-.5*(a[0]+o[0]);break;case"right":case"end":h=-o[0];break;case"left":case"start":h=-a[0];break;default:throw new Error("vectorize-text: Unrecognized textAlign: '"+n+"'")}var f=0;switch(i){case"hanging":case"top":f=-a[1];break;case"middle":f=-.5*(a[1]+o[1]);break;case"alphabetic":case"ideographic":f=-3*r;break;case"bottom":f=-o[1];break;default:throw new Error("vectorize-text: Unrecoginized textBaseline: '"+i+"'")}var d=1/r;return"lineHeight"in e?d*=+e.lineHeight:"width"in e?d=e.width/(o[0]-a[0]):"height"in e&&(d=e.height/(o[1]-a[1])),t.map(function(t){return[d*(t[0]+h),d*(t[1]+f)]})}(i.positions,e,r),h=i.edges,f="ccw"===e.orientation;if(l(o,h),e.polygons||e.polygon||e.polyline){for(var d=u(h,o),p=new Array(d.length),m=0;m<d.length;++m){for(var g=d[m],v=new Array(g.length),y=0;y<g.length;++y){for(var b=g[y],x=new Array(b.length),_=0;_<b.length;++_)x[_]=o[b[_]].slice();f&&x.reverse(),v[y]=x}p[m]=v}return p}return e.triangles||e.triangulate||e.triangle?{cells:c(o,h,{delaunay:!1,exterior:!1,interior:!0}),positions:o}:{edges:h,positions:o}}function i(t,e,r){try{return n(t,e,r,!0)}catch(t){}try{return n(t,e,r,!1)}catch(t){}return e.polygons||e.polyline||e.polygon?[]:e.triangles||e.triangulate||e.triangle?{cells:[],positions:[]}:{edges:[],positions:[]}}e.exports=function(t,e,r,n){var a=n.size||64,s=n.font||"normal";return r.font=a+"px "+s,r.textAlign="start",r.textBaseline="alphabetic",r.direction="ltr",i(function(t,e,r,n){var i=0|Math.ceil(e.measureText(r).width+2*n);if(i>8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height<a&&(t.height=a),e.fillStyle="#000",e.fillRect(0,0,t.width,t.height),e.fillStyle="#fff",e.fillText(r,n,2*n);var s=e.getImageData(0,0,i,a);return o(s.data,[a,i,4]).pick(-1,-1,0).transpose(1,0)}(e,r,t,a),n,a)},e.exports.processPixels=i;var a=t("surface-nets"),o=t("ndarray"),s=t("simplify-planar-graph"),l=t("clean-pslg"),c=t("cdt2d"),u=t("planar-graph-to-polyline")},{cdt2d:80,"clean-pslg":90,ndarray:468,"planar-graph-to-polyline":484,"simplify-planar-graph":532,"surface-nets":540}],565:[function(t,e,r){function n(t){var e=[];for(var r in t.layers)e.push(function(t){for(var e={name:t.name||"",version:t.version||1,extent:t.extent||4096,keys:[],values:[],features:[]},r={},n={},o=0;o<t.length;o++){var s=t.feature(o);s.geometry=function(t){for(var e=[],r=0,n=0,o=t.length,s=0;s<o;s++){var l=t[s];e.push(i(1,1));for(var c=0;c<l.length;c++){1===c&&e.push(i(2,l.length-1));var u=l[c].x-r,h=l[c].y-n;e.push(a(u),a(h)),r+=u,n+=h}}return e}(s.loadGeometry());var l=[];for(var c in s.properties){var u=r[c];void 0===u&&(e.keys.push(c),u=e.keys.length-1,r[c]=u);var h=function(t){var e,r=typeof t;"string"===r?e={string_value:t}:"boolean"===r?e={bool_value:t}:"number"===r?e=t%1!=0?{double_value:t}:t<0?{sint_value:t}:{uint_value:t}:(t=JSON.stringify(t),e={string_value:t});return e.key=r+":"+t,e}(s.properties[c]),f=n[h.key];void 0===f&&(e.values.push(h),f=e.values.length-1,n[h.key]=f),l.push(u),l.push(f)}s.tags=l,e.features.push(s)}return e}(t.layers[r]));var n=new o;return s.tile.write({layers:e},n),n.finish()}function i(t,e){return(e<<3)+(7&t)}function a(t){return t<<1^t>>31}var o=t("pbf"),s=t("./vector-tile-pb"),l=t("./lib/geojson_wrapper");e.exports=n,e.exports.fromVectorTileJs=n,e.exports.fromGeojsonVt=function(t){var e={};for(var r in t)e[r]=new l(t[r].features),e[r].name=r;return n({layers:e})},e.exports.GeoJSONWrapper=l},{"./lib/geojson_wrapper":566,"./vector-tile-pb":567,pbf:479}],566:[function(t,e,r){"use strict";function n(t){this.features=t,this.length=t.length}function i(t){this.id="number"==typeof t.id?t.id:void 0,this.type=t.type,this.rawGeometry=1===t.type?[t.geometry]:t.geometry,this.properties=t.tags,this.extent=4096}var a=t("point-geometry"),o=t("vector-tile").VectorTileFeature;e.exports=n,n.prototype.feature=function(t){return new i(this.features[t])},i.prototype.loadGeometry=function(){var t=this.rawGeometry;this.geometry=[];for(var e=0;e<t.length;e++){for(var r=t[e],n=[],i=0;i<r.length;i++)n.push(new a(r[i][0],r[i][1]));this.geometry.push(n)}return this.geometry},i.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var t=this.geometry,e=1/0,r=-1/0,n=1/0,i=-1/0,a=0;a<t.length;a++)for(var o=t[a],s=0;s<o.length;s++){var l=o[s];e=Math.min(e,l.x),r=Math.max(r,l.x),n=Math.min(n,l.y),i=Math.max(i,l.y)}return[e,n,r,i]},i.prototype.toGeoJSON=o.prototype.toGeoJSON},{"point-geometry":485,"vector-tile":559}],567:[function(t,e,r){"use strict";function n(t,e,r){3===t&&e.layers.push(u(r,r.readVarint()+r.pos))}function i(t,e){return t.readFields(a,{},e)}function a(t,e,r){1===t?e.string_value=r.readString():2===t?e.float_value=r.readFloat():3===t?e.double_value=r.readDouble():4===t?e.int_value=r.readVarint():5===t?e.uint_value=r.readVarint():6===t?e.sint_value=r.readSVarint():7===t&&(e.bool_value=r.readBoolean())}function o(t,e){void 0!==t.string_value&&e.writeStringField(1,t.string_value),void 0!==t.float_value&&e.writeFloatField(2,t.float_value),void 0!==t.double_value&&e.writeDoubleField(3,t.double_value),void 0!==t.int_value&&e.writeVarintField(4,t.int_value),void 0!==t.uint_value&&e.writeVarintField(5,t.uint_value),void 0!==t.sint_value&&e.writeSVarintField(6,t.sint_value),void 0!==t.bool_value&&e.writeBooleanField(7,t.bool_value)}function s(t,e){var r=t.readFields(l,{},e);return void 0===r.type&&(r.type="Unknown"),r}function l(t,e,r){1===t?e.id=r.readVarint():2===t?e.tags=r.readPackedVarint():3===t?e.type=r.readVarint():4===t&&(e.geometry=r.readPackedVarint())}function c(t,e){void 0!==t.id&&e.writeVarintField(1,t.id),void 0!==t.tags&&e.writePackedVarint(2,t.tags),void 0!==t.type&&e.writeVarintField(3,t.type),void 0!==t.geometry&&e.writePackedVarint(4,t.geometry)}function u(t,e){return t.readFields(h,{features:[],keys:[],values:[]},e)}function h(t,e,r){15===t?e.version=r.readVarint():1===t?e.name=r.readString():2===t?e.features.push(s(r,r.readVarint()+r.pos)):3===t?e.keys.push(r.readString()):4===t?e.values.push(i(r,r.readVarint()+r.pos)):5===t&&(e.extent=r.readVarint())}function f(t,e){void 0!==t.version&&e.writeVarintField(15,t.version),void 0!==t.name&&e.writeStringField(1,t.name);var r;if(void 0!==t.features)for(r=0;r<t.features.length;r++)e.writeMessage(2,c,t.features[r]);if(void 0!==t.keys)for(r=0;r<t.keys.length;r++)e.writeStringField(3,t.keys[r]);if(void 0!==t.values)for(r=0;r<t.values.length;r++)e.writeMessage(4,o,t.values[r]);void 0!==t.extent&&e.writeVarintField(5,t.extent)}var d=r.tile={read:function(t,e){return t.readFields(n,{layers:[]},e)},write:function(t,e){var r;if(void 0!==t.layers)for(r=0;r<t.layers.length;r++)e.writeMessage(3,f,t.layers[r])}};d.GeomType={Unknown:0,Point:1,LineString:2,Polygon:3},d.value={read:i,write:o},d.feature={read:s,write:c},d.layer={read:u,write:f}},{}],568:[function(t,e,r){!function(){"use strict";function t(e){e.permitHostObjects___&&e.permitHostObjects___(t)}function r(t){return!(t.substr(0,d.length)==d&&"___"===t.substr(t.length-3))}function n(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[p];if(e&&e.key===t)return e;if(f(t)){e={key:t};try{return h(t,p,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function i(t){return t.prototype=null,Object.freeze(t)}function a(){y||"undefined"==typeof console||(y=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}if("undefined"==typeof ses||!ses.ok||ses.ok()){"undefined"!=typeof ses&&(ses.weakMapPermitHostObjects=t);var o=!1;if("function"==typeof WeakMap){var s=WeakMap;if("undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent));else{var l=new s,c=Object.freeze({});if(l.set(c,1),1===l.get(c))return void(e.exports=WeakMap);o=!0}}Object.prototype.hasOwnProperty;var u=Object.getOwnPropertyNames,h=Object.defineProperty,f=Object.isExtensible,d="weakmap:",p=d+"ident:"+Math.random()+"___";if("undefined"!=typeof crypto&&"function"==typeof crypto.getRandomValues&&"function"==typeof ArrayBuffer&&"function"==typeof Uint8Array){var m=new ArrayBuffer(25),g=new Uint8Array(m);crypto.getRandomValues(g),p=d+"rand:"+Array.prototype.map.call(g,function(t){return(t%36).toString(36)}).join("")+"___"}if(h(Object,"getOwnPropertyNames",{value:function(t){return u(t).filter(r)}}),"getPropertyNames"in Object){var v=Object.getPropertyNames;h(Object,"getPropertyNames",{value:function(t){return v(t).filter(r)}})}!function(){var t=Object.freeze;h(Object,"freeze",{value:function(e){return n(e),t(e)}});var e=Object.seal;h(Object,"seal",{value:function(t){return n(t),e(t)}});var r=Object.preventExtensions;h(Object,"preventExtensions",{value:function(t){return n(t),r(t)}})}();var y=!1,b=0,x=function(){this instanceof x||a();var t=[],e=[],r=b++;return Object.create(x.prototype,{get___:{value:i(function(i,a){var o,s=n(i);return s?r in s?s[r]:a:(o=t.indexOf(i))>=0?e[o]:a})},has___:{value:i(function(e){var i=n(e);return i?r in i:t.indexOf(e)>=0})},set___:{value:i(function(i,a){var o,s=n(i);return s?s[r]=a:(o=t.indexOf(i))>=0?e[o]=a:(o=t.length,e[o]=a,t[o]=i),this})},delete___:{value:i(function(i){var a,o,s=n(i);return s?r in s&&delete s[r]:!((a=t.indexOf(i))<0||(o=t.length-1,t[a]=void 0,e[a]=e[o],t[a]=t[o],t.length=o,e.length=o,0))})}})};x.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 s?function(){function r(){this instanceof x||a();var e,r=new s,n=void 0,l=!1;return e=o?function(t,e){return r.set(t,e),r.has(t)||(n||(n=new x),n.set(t,e)),this}:function(t,e){if(l)try{r.set(t,e)}catch(r){n||(n=new x),n.set___(t,e)}else r.set(t,e);return this},Object.create(x.prototype,{get___:{value:i(function(t,e){return n?r.has(t)?r.get(t):n.get___(t,e):r.get(t,e)})},has___:{value:i(function(t){return r.has(t)||!!n&&n.has___(t)})},set___:{value:i(e)},delete___:{value:i(function(t){var e=!!r.delete(t);return n?n.delete___(t)||e:e})},permitHostObjects___:{value:i(function(e){if(e!==t)throw new Error("bogus call to permitHostObjects___");l=!0})}})}o&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=x.prototype,e.exports=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),e.exports=x)}}()},{}],569:[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":570}],570:[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}},{}],571:[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":569}],572:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":148}],573:[function(t,e,r){var n=arguments[3],i=arguments[4],a=arguments[5],o=JSON.stringify;e.exports=function(t,e){function r(t){g[t]=!0;for(var e in i[t][1]){var n=i[t][1][e];g[n]||r(n)}}for(var s,l=Object.keys(a),c=0,u=l.length;c<u;c++){var h=l[c],f=a[h].exports;if(f===t||f&&f.default===t){s=h;break}}if(!s){s=Math.floor(Math.pow(16,8)*Math.random()).toString(16);var d={};for(c=0,u=l.length;c<u;c++){d[h=l[c]]=h}i[s]=[Function(["require","module","exports"],"("+t+")(self)"),d]}var p=Math.floor(Math.pow(16,8)*Math.random()).toString(16),m={};m[s]=s,i[p]=[Function(["require"],"var f = require("+o(s)+");(f.default ? f.default : f)(self);"),m];var g={};r(p);var v="("+n+")({"+Object.keys(g).map(function(t){return o(t)+":["+i[t][0]+","+o(i[t][1])+"]"}).join(",")+"},{},["+o(p)+"])",y=window.URL||window.webkitURL||window.mozURL||window.msURL,b=new Blob([v],{type:"text/javascript"});if(e&&e.bare)return b;var x=y.createObjectURL(b),_=new Worker(x);return _.objectURL=x,_}},{}],574:[function(t,e,r){e.exports.RADIUS=6378137,e.exports.FLATTENING=1/298.257223563,e.exports.POLAR_RADIUS=6356752.3142},{}],575:[function(t,e,r){!function(t,n){n("object"==typeof r&&void 0!==e?r:t.WhooTS=t.WhooTS||{})}(this,function(t){function e(t,e,n){var i=r(256*t,256*(e=Math.pow(2,n)-e-1),n),a=r(256*(t+1),256*(e+1),n);return i[0]+","+i[1]+","+a[0]+","+a[1]}function r(t,e,r){var n=2*Math.PI*6378137/256/Math.pow(2,r);return[t*n-2*Math.PI*6378137/2,e*n-2*Math.PI*6378137/2]}t.getURL=function(t,r,n,i,a,o){return o=o||{},t+"?"+["bbox="+e(n,i,a),"format="+(o.format||"image/png"),"service="+(o.service||"WMS"),"version="+(o.version||"1.1.1"),"request="+(o.request||"GetMap"),"srs="+(o.srs||"EPSG:3857"),"width="+(o.width||256),"height="+(o.height||256),"layers="+r].join("&")},t.getTileBBox=e,t.getMercCoords=r,Object.defineProperty(t,"__esModule",{value:!0})})},{}],576:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();a(n.prototype=new i.baseCalendar,{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 n=this.intercalaryMonth(t);if(r&&e!==n||e<1||e>12)throw i.local.invalidMonth.replace(/\{0\}/,this.local.name);return n?!r&&e<=n?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 i.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e<r?e+1:e:e+1},intercalaryMonth:function(t){t=this._validateYear(t);return h[t-h[0]]>>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 n,a=this._validateYear(t,i.local.invalidyear),s=f[a-f[0]],l=s>>9&4095,c=s>>5&15,u=31&s;(n=o.newDate(l,c,u)).add(4-(n.dayOfWeek()||7),"d");var h=this.toJD(t,e,r)-n.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 i.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 n=this._validate(t,s,r,i.local.invalidDate);t=this._validateYear(n.year()),e=n.month(),r=n.day();var a=this.isIntercalaryMonth(t,e),s=this.toChineseMonth(t,e),l=function(t,e,r,n,i){var a,o;if("object"==typeof t)o=t,a=e||{};else{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");var s;"object"==typeof n?(s=!1,a=n):(s=!!n,a=i||{}),o={year:t,month:e,day:r,isIntercalary:s}}var l;l=o.day-1;var c,u=h[o.year-h[0]],d=u>>13;c=d?o.month>d?o.month:o.isIntercalary?o.month:o.month-1:o.month-1;for(var p=0;p<c;p++)l+=u&1<<12-p?30:29;var m=f[o.year-f[0]],g=m>>9&4095,v=m>>5&15,y=31&m,b=new Date(g,v-1,y+l);return a.year=b.getFullYear(),a.month=1+b.getMonth(),a.day=b.getDate(),a}(t,s,r,a);return o.toJD(l.year,l.month,l.day)},fromJD:function(t){var e=o.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=f[i.year-f[0]],s=i.year<<9|i.month<<5|i.day;a.year=s>=o?i.year:i.year-1;var l,c=(o=f[a.year-f[0]])>>9&4095,u=o>>5&15,d=31&o,p=new Date(c,u-1,d),m=new Date(i.year,i.month-1,i.day);l=Math.round((m-p)/864e5);var g,v=h[a.year-h[0]];for(g=0;g<13;g++){var y=v&1<<12-g?30:29;if(l<y)break;l-=y}var b=v>>13;return!b||g<b?(a.isIntercalary=!1,a.month=1+g):g===b?(a.isIntercalary=!0,a.month=g):(a.isIntercalary=!1,a.month=g),a.day=1+l,a}(e.year(),e.month(),e.day()),n=this.toMonthIndex(r.year,r.month,r.isIntercalary);return this.newDate(r.year,n,r.day)},fromString:function(t){var e=t.match(s),r=this._validateYear(+e[1]),n=+e[2],i=!!e[3],a=this.toMonthIndex(r,n,i),o=+e[4];return this.newDate(r,a,o)},add:function(t,e,r){var i=t.year(),a=t.month(),o=this.isIntercalaryMonth(i,a),s=this.toChineseMonth(i,a),l=Object.getPrototypeOf(n.prototype).add.call(this,t,e,r);if("y"===r){var c=l.year(),u=l.month(),h=this.isIntercalaryMonth(c,s),f=o&&h?this.toMonthIndex(c,s,!0):this.toMonthIndex(c,s,!1);f!==u&&l.month(f)}return l}});var s=/^\s*(-?\d\d\d\d|\d\d)[-/](\d?\d)([iI]?)[-/](\d?\d)/m,l=/^\d?\d[iI]?/m,c=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?\u6708/m,u=/^\u95f0?\u5341?[\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d]?/m;i.calendars.chinese=n;var h=[1887,5780,5802,19157,2742,50359,1198,2646,46378,7466,3412,30122,5482,67949,2396,5294,43597,6732,6954,36181,2772,4954,18781,2396,54427,5274,6730,47781,5800,6868,21210,4790,59703,2350,5270,46667,3402,3496,38325,1388,4782,18735,2350,52374,6804,7498,44457,2906,1388,29294,4700,63789,6442,6804,56138,5802,2772,38235,1210,4698,22827,5418,63125,3476,5802,43701,2484,5302,27223,2646,70954,7466,3412,54698,5482,2412,38062,5294,2636,32038,6954,60245,2772,4826,43357,2394,5274,39501,6730,72357,5800,5844,53978,4790,2358,38039,5270,87627,3402,3496,54708,5484,4782,43311,2350,3222,27978,7498,68965,2904,5484,45677,4700,6444,39573,6804,6986,19285,2772,62811,1210,4698,47403,5418,5780,38570,5546,76469,2420,5302,51799,2646,5414,36501,3412,5546,18869,2412,54446,5276,6732,48422,6822,2900,28010,4826,92509,2394,5274,55883,6730,6820,47956,5812,2778,18779,2358,62615,5270,5450,46757,3492,5556,27318,4718,67887,2350,3222,52554,7498,3428,38252,5468,4700,31022,6444,64149,6804,6986,43861,2772,5338,35421,2650,70955,5418,5780,54954,5546,2740,38074,5302,2646,29991,3366,61011,3412,5546,43445,2412,5294,35406,6732,72998,6820,6996,52586,2778,2396,38045,5274,6698,23333,6820,64338,5812,2746,43355,2358,5270,39499,5450,79525,3492,5548],f=[1887,966732,967231,967733,968265,968766,969297,969798,970298,970829,971330,971830,972362,972863,973395,973896,974397,974928,975428,975929,976461,976962,977462,977994,978494,979026,979526,980026,980558,981059,981559,982091,982593,983124,983624,984124,984656,985157,985656,986189,986690,987191,987722,988222,988753,989254,989754,990286,990788,991288,991819,992319,992851,993352,993851,994383,994885,995385,995917,996418,996918,997450,997949,998481,998982,999483,1000014,1000515,1001016,1001548,1002047,1002578,1003080,1003580,1004111,1004613,1005113,1005645,1006146,1006645,1007177,1007678,1008209,1008710,1009211,1009743,1010243,1010743,1011275,1011775,1012306,1012807,1013308,1013840,1014341,1014841,1015373,1015874,1016404,1016905,1017405,1017937,1018438,1018939,1019471,1019972,1020471,1021002,1021503,1022035,1022535,1023036,1023568,1024069,1024568,1025100,1025601,1026102,1026633,1027133,1027666,1028167,1028666,1029198,1029699,1030199,1030730,1031231,1031763,1032264,1032764,1033296,1033797,1034297,1034828,1035329,1035830,1036362,1036861,1037393,1037894,1038394,1038925,1039427,1039927,1040459,1040959,1041491,1041992,1042492,1043023,1043524,1044024,1044556,1045057,1045558,1046090,1046590,1047121,1047622,1048122,1048654,1049154,1049655,1050187,1050689,1051219,1051720,1052220,1052751,1053252,1053752,1054284,1054786,1055285,1055817,1056317,1056849,1057349,1057850,1058382,1058883,1059383,1059915,1060415,1060947,1061447,1061947,1062479,1062981,1063480,1064012,1064514,1065014,1065545,1066045,1066577,1067078,1067578,1068110,1068611,1069112,1069642,1070142,1070674,1071175,1071675,1072207,1072709,1073209,1073740,1074241,1074741,1075273,1075773,1076305,1076807,1077308,1077839,1078340,1078840,1079372,1079871,1080403,1080904]},{"../main":590,"object-assign":471}],577:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{name:"Coptic",jdEpoch:1825029.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:"Coptic",epochs:["BAM","AM"],monthNames:["Thout","Paopi","Hathor","Koiak","Tobi","Meshir","Paremhat","Paremoude","Pashons","Paoni","Epip","Mesori","Pi Kogi Enavot"],monthNamesShort:["Tho","Pao","Hath","Koi","Tob","Mesh","Pat","Pad","Pash","Pao","Epi","Meso","PiK"],dayNames:["Tkyriaka","Pesnau","Pshoment","Peftoou","Ptiou","Psoou","Psabbaton"],dayNamesShort:["Tky","Pes","Psh","Pef","Pti","Pso","Psa"],dayNamesMin:["Tk","Pes","Psh","Pef","Pt","Pso","Psa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,i.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,i.local.invalidYear||i.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,i.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 n=this._validate(t,e,r,i.local.invalidDate);return(t=n.year())<0&&t++,n.day()+30*(n.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)}}),i.calendars.coptic=n},{"../main":590,"object-assign":471}],578:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{name:"Discworld",jdEpoch:1721425.5,daysPerMonth:[16,32,32,32,32,32,32,32,32,32,32,32,32],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Discworld",epochs:["BUC","UC"],monthNames:["Ick","Offle","February","March","April","May","June","Grune","August","Spune","Sektober","Ember","December"],monthNamesShort:["Ick","Off","Feb","Mar","Apr","May","Jun","Gru","Aug","Spu","Sek","Emb","Dec"],dayNames:["Sunday","Octeday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Oct","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Oc","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:2,isRTL:!1}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),!1},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),13},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,i.local.invalidYear),400},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/8)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.local.invalidMonth);return this.daysPerMonth[r.month()-1]},daysInWeek:function(){return 8},dayOfWeek:function(t,e,r){return(this._validate(t,e,r,i.local.invalidDate).day()+1)%8},weekDay:function(t,e,r){var n=this.dayOfWeek(t,e,r);return n>=2&&n<=6},extraInfo:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return{century:a[Math.floor((n.year()-1)/100)+1]||""}},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate);return t=n.year()+(n.year()<0?1:0),e=n.month(),(r=n.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 a={20:"Fruitbat",21:"Anchovy"};i.calendars.discworld=n},{"../main":590,"object-assign":471}],579:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{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,i.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,i.local.invalidYear||i.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,i.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 n=this._validate(t,e,r,i.local.invalidDate);return(t=n.year())<0&&t++,n.day()+30*(n.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)}}),i.calendars.ethiopian=n},{"../main":590,"object-assign":471}],580:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}var a=t("../main");t("object-assign")(n.prototype=new a.baseCalendar,{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,a.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return t=t<0?t+1:t,i(7*t+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,a.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,a.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,a.local.invalidMonth),12===e&&this.leapYear(t)?30:8===e&&5===i(this.daysInYear(t),10)?30:9===e&&3===i(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 n=this._validate(t,e,r,a.local.invalidDate);return{yearType:(this.leapYear(n)?"embolismic":"common")+" "+["deficient","regular","complete"][this.daysInYear(n)%10-3]}},toJD:function(t,e,r){var n=this._validate(t,e,r,a.local.invalidDate);t=n.year(),e=n.month(),r=n.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<e;s++)o+=this.daysInMonth(t,s)}else for(s=7;s<e;s++)o+=this.daysInMonth(t,s);return o},_delay1:function(t){var e=Math.floor((235*t-234)/19),r=12084+13753*e,n=29*e+Math.floor(r/25920);return i(3*(n+1),7)<3&&n++,n},_delay2:function(t){var e=this._delay1(t-1),r=this._delay1(t);return this._delay1(t+1)-r==356?2:r-e==382?1:0},fromJD:function(t){t=Math.floor(t)+.5;for(var e=Math.floor(98496*(t-this.jdEpoch)/35975351)-1;t>=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=t<this.toJD(e,1,1)?7:1;t>this.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),a.calendars.hebrew=n},{"../main":590,"object-assign":471}],581:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{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,i.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,i.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 n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),e=n.month(),r=n.day(),t=t<=0?t+1:t,r+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)}}),i.calendars.islamic=n},{"../main":590,"object-assign":471}],582:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{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,i.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,i.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 n=this._validate(t,e,r,i.local.invalidDate);return t=n.year(),e=n.month(),r=n.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)}}),i.calendars.julian=n},{"../main":590,"object-assign":471}],583:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}function a(t,e){return i(t-1,e)+1}var o=t("../main");t("object-assign")(n.prototype=new o.baseCalendar,{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,o.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,o.local.invalidYear).year();var e=Math.floor(t/400);t%=400,t+=t<0?400:0;return 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;r<t.length;r++){var n=parseInt(t[r],10);if(Math.abs(n)>19||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,o.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,o.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,o.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,o.local.invalidDate),!0},extraInfo:function(t,e,r){var n=this._validate(t,e,r,o.local.invalidDate).toJD(),i=this._toHaab(n),a=this._toTzolkin(n);return{haabMonthName:this.local.haabMonths[i[0]-1],haabMonth:i[0],haabDay:i[1],tzolkinDayName:this.local.tzolkinMonths[a[0]-1],tzolkinDay:a[0],tzolkinTrecena:a[1]}},_toHaab:function(t){var e=i((t-=this.jdEpoch)+8+340,365);return[Math.floor(e/20)+1,i(e,20)]},_toTzolkin:function(t){return t-=this.jdEpoch,[a(t+20,20),a(t+4,13)]},toJD:function(t,e,r){var n=this._validate(t,e,r,o.local.invalidDate);return n.day()+20*n.month()+360*n.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)}}),o.calendars.mayan=n},{"../main":590,"object-assign":471}],584:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign");n.prototype=new i.baseCalendar;var o=i.instance("gregorian");a(n.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,i.local.invalidYear||i.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,i.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 n=this._validate(t,e,r,i.local.invalidMonth);(t=n.year())<0&&t++;for(var a=n.day(),s=1;s<n.month();s++)a+=this.daysPerMonth[s-1];return a+o.toJD(t+1468,3,13)},fromJD:function(t){t=Math.floor(t+.5);for(var e=Math.floor((t-(this.jdEpoch-1))/366);t>=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)}}),i.calendars.nanakshahi=n},{"../main":590,"object-assign":471}],585:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{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,i.local.invalidYear).year(),void 0===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,i.local.invalidMonth),void 0===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 n=this._validate(t,e,r,i.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var a=i.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=i.instance().fromJD(t),r=e.year(),n=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;n>l;)++o>12&&(o=1,a++),l+=this.NEPALI_CALENDAR_DATA[a][o];var c=this.NEPALI_CALENDAR_DATA[a][o]-(l-n);return this.newDate(a,o,c)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r<t+2;r++)void 0===this.NEPALI_CALENDAR_DATA[r]&&(this.NEPALI_CALENDAR_DATA[r]=e)},NEPALI_CALENDAR_DATA:{1970:[18,31,31,32,31,31,31,30,29,30,29,30,30],1971:[18,31,31,32,31,32,30,30,29,30,29,30,30],1972:[17,31,32,31,32,31,30,30,30,29,29,30,30],1973:[19,30,32,31,32,31,30,30,30,29,30,29,31],1974:[19,31,31,32,30,31,31,30,29,30,29,30,30],1975:[18,31,31,32,32,30,31,30,29,30,29,30,30],1976:[17,31,32,31,32,31,30,30,30,29,29,30,31],1977:[18,31,32,31,32,31,31,29,30,29,30,29,31],1978:[18,31,31,32,31,31,31,30,29,30,29,30,30],1979:[18,31,31,32,32,31,30,30,29,30,29,30,30],1980:[17,31,32,31,32,31,30,30,30,29,29,30,31],1981:[18,31,31,31,32,31,31,29,30,30,29,30,30],1982:[18,31,31,32,31,31,31,30,29,30,29,30,30],1983:[18,31,31,32,32,31,30,30,29,30,29,30,30],1984:[17,31,32,31,32,31,30,30,30,29,29,30,31],1985:[18,31,31,31,32,31,31,29,30,30,29,30,30],1986:[18,31,31,32,31,31,31,30,29,30,29,30,30],1987:[18,31,32,31,32,31,30,30,29,30,29,30,30],1988:[17,31,32,31,32,31,30,30,30,29,29,30,31],1989:[18,31,31,31,32,31,31,30,29,30,29,30,30],1990:[18,31,31,32,31,31,31,30,29,30,29,30,30],1991:[18,31,32,31,32,31,30,30,29,30,29,30,30],1992:[17,31,32,31,32,31,30,30,30,29,30,29,31],1993:[18,31,31,31,32,31,31,30,29,30,29,30,30],1994:[18,31,31,32,31,31,31,30,29,30,29,30,30],1995:[17,31,32,31,32,31,30,30,30,29,29,30,30],1996:[17,31,32,31,32,31,30,30,30,29,30,29,31],1997:[18,31,31,32,31,31,31,30,29,30,29,30,30],1998:[18,31,31,32,31,31,31,30,29,30,29,30,30],1999:[17,31,32,31,32,31,30,30,30,29,29,30,31],2e3:[17,30,32,31,32,31,30,30,30,29,30,29,31],2001:[18,31,31,32,31,31,31,30,29,30,29,30,30],2002:[18,31,31,32,32,31,30,30,29,30,29,30,30],2003:[17,31,32,31,32,31,30,30,30,29,29,30,31],2004:[17,30,32,31,32,31,30,30,30,29,30,29,31],2005:[18,31,31,32,31,31,31,30,29,30,29,30,30],2006:[18,31,31,32,32,31,30,30,29,30,29,30,30],2007:[17,31,32,31,32,31,30,30,30,29,29,30,31],2008:[17,31,31,31,32,31,31,29,30,30,29,29,31],2009:[18,31,31,32,31,31,31,30,29,30,29,30,30],2010:[18,31,31,32,32,31,30,30,29,30,29,30,30],2011:[17,31,32,31,32,31,30,30,30,29,29,30,31],2012:[17,31,31,31,32,31,31,29,30,30,29,30,30],2013:[18,31,31,32,31,31,31,30,29,30,29,30,30],2014:[18,31,31,32,32,31,30,30,29,30,29,30,30],2015:[17,31,32,31,32,31,30,30,30,29,29,30,31],2016:[17,31,31,31,32,31,31,29,30,30,29,30,30],2017:[18,31,31,32,31,31,31,30,29,30,29,30,30],2018:[18,31,32,31,32,31,30,30,29,30,29,30,30],2019:[17,31,32,31,32,31,30,30,30,29,30,29,31],2020:[17,31,31,31,32,31,31,30,29,30,29,30,30],2021:[18,31,31,32,31,31,31,30,29,30,29,30,30],2022:[17,31,32,31,32,31,30,30,30,29,29,30,30],2023:[17,31,32,31,32,31,30,30,30,29,30,29,31],2024:[17,31,31,31,32,31,31,30,29,30,29,30,30],2025:[18,31,31,32,31,31,31,30,29,30,29,30,30],2026:[17,31,32,31,32,31,30,30,30,29,29,30,31],2027:[17,30,32,31,32,31,30,30,30,29,30,29,31],2028:[17,31,31,32,31,31,31,30,29,30,29,30,30],2029:[18,31,31,32,31,32,30,30,29,30,29,30,30],2030:[17,31,32,31,32,31,30,30,30,30,30,30,31],2031:[17,31,32,31,32,31,31,31,31,31,31,31,31],2032:[17,32,32,32,32,32,32,32,32,32,32,32,32],2033:[18,31,31,32,32,31,30,30,29,30,29,30,30],2034:[17,31,32,31,32,31,30,30,30,29,29,30,31],2035:[17,30,32,31,32,31,31,29,30,30,29,29,31],2036:[17,31,31,32,31,31,31,30,29,30,29,30,30],2037:[18,31,31,32,32,31,30,30,29,30,29,30,30],2038:[17,31,32,31,32,31,30,30,30,29,29,30,31],2039:[17,31,31,31,32,31,31,29,30,30,29,30,30],2040:[17,31,31,32,31,31,31,30,29,30,29,30,30],2041:[18,31,31,32,32,31,30,30,29,30,29,30,30],2042:[17,31,32,31,32,31,30,30,30,29,29,30,31],2043:[17,31,31,31,32,31,31,29,30,30,29,30,30],2044:[17,31,31,32,31,31,31,30,29,30,29,30,30],2045:[18,31,32,31,32,31,30,30,29,30,29,30,30],2046:[17,31,32,31,32,31,30,30,30,29,29,30,31],2047:[17,31,31,31,32,31,31,30,29,30,29,30,30],2048:[17,31,31,32,31,31,31,30,29,30,29,30,30],2049:[17,31,32,31,32,31,30,30,30,29,29,30,30],2050:[17,31,32,31,32,31,30,30,30,29,30,29,31],2051:[17,31,31,31,32,31,31,30,29,30,29,30,30],2052:[17,31,31,32,31,31,31,30,29,30,29,30,30],2053:[17,31,32,31,32,31,30,30,30,29,29,30,30],2054:[17,31,32,31,32,31,30,30,30,29,30,29,31],2055:[17,31,31,32,31,31,31,30,29,30,30,29,30],2056:[17,31,31,32,31,32,30,30,29,30,29,30,30],2057:[17,31,32,31,32,31,30,30,30,29,29,30,31],2058:[17,30,32,31,32,31,30,30,30,29,30,29,31],2059:[17,31,31,32,31,31,31,30,29,30,29,30,30],2060:[17,31,31,32,32,31,30,30,29,30,29,30,30],2061:[17,31,32,31,32,31,30,30,30,29,29,30,31],2062:[17,30,32,31,32,31,31,29,30,29,30,29,31],2063:[17,31,31,32,31,31,31,30,29,30,29,30,30],2064:[17,31,31,32,32,31,30,30,29,30,29,30,30],2065:[17,31,32,31,32,31,30,30,30,29,29,30,31],2066:[17,31,31,31,32,31,31,29,30,30,29,29,31],2067:[17,31,31,32,31,31,31,30,29,30,29,30,30],2068:[17,31,31,32,32,31,30,30,29,30,29,30,30],2069:[17,31,32,31,32,31,30,30,30,29,29,30,31],2070:[17,31,31,31,32,31,31,29,30,30,29,30,30],2071:[17,31,31,32,31,31,31,30,29,30,29,30,30],2072:[17,31,32,31,32,31,30,30,29,30,29,30,30],2073:[17,31,32,31,32,31,30,30,30,29,29,30,31],2074:[17,31,31,31,32,31,31,30,29,30,29,30,30],2075:[17,31,31,32,31,31,31,30,29,30,29,30,30],2076:[16,31,32,31,32,31,30,30,30,29,29,30,30],2077:[17,31,32,31,32,31,30,30,30,29,30,29,31],2078:[17,31,31,31,32,31,31,30,29,30,29,30,30],2079:[17,31,31,32,31,31,31,30,29,30,29,30,30],2080:[16,31,32,31,32,31,30,30,30,29,29,30,30],2081:[17,31,31,32,32,31,30,30,30,29,30,30,30],2082:[17,31,32,31,32,31,30,30,30,29,30,30,30],2083:[17,31,31,32,31,31,30,30,30,29,30,30,30],2084:[17,31,31,32,31,31,30,30,30,29,30,30,30],2085:[17,31,32,31,32,31,31,30,30,29,30,30,30],2086:[17,31,32,31,32,31,30,30,30,29,30,30,30],2087:[16,31,31,32,31,31,31,30,30,29,30,30,30],2088:[16,30,31,32,32,30,31,30,30,29,30,30,30],2089:[17,31,32,31,32,31,30,30,30,29,30,30,30],2090:[17,31,32,31,32,31,30,30,30,29,30,30,30],2091:[16,31,31,32,31,31,31,30,30,29,30,30,30],2092:[16,31,31,32,32,31,30,30,30,29,30,30,30],2093:[17,31,32,31,32,31,30,30,30,29,30,30,30],2094:[17,31,31,32,31,31,30,30,30,29,30,30,30],2095:[17,31,31,32,31,31,31,30,29,30,30,30,30],2096:[17,30,31,32,32,31,30,30,29,30,29,30,30],2097:[17,31,32,31,32,31,30,30,30,29,30,30,30],2098:[17,31,31,32,31,31,31,29,30,29,30,30,31],2099:[17,31,31,32,31,31,31,30,29,29,30,30,30],2100:[17,31,32,31,32,30,31,30,29,30,29,30,30]}}),i.calendars.nepali=n},{"../main":590,"object-assign":471}],586:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function i(t,e){return t-e*Math.floor(t/e)}var a=t("../main");t("object-assign")(n.prototype=new a.baseCalendar,{name:"Persian",jdEpoch:1948320.5,daysPerMonth:[31,31,31,31,31,31,30,30,30,30,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Persian",epochs:["BP","AP"],monthNames:["Farvardin","Ordibehesht","Khordad","Tir","Mordad","Shahrivar","Mehr","Aban","Azar","Day","Bahman","Esfand"],monthNamesShort:["Far","Ord","Kho","Tir","Mor","Sha","Meh","Aba","Aza","Day","Bah","Esf"],dayNames:["Yekshambe","Doshambe","Seshambe","Ch\xe6harshambe","Panjshambe","Jom'e","Shambe"],dayNamesShort:["Yek","Do","Se","Ch\xe6","Panj","Jom","Sha"],dayNamesMin:["Ye","Do","Se","Ch","Pa","Jo","Sh"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,a.local.invalidYear);return 682*((e.year()-(e.year()>0?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,a.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 n=this._validate(t,e,r,a.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var o=t-(t>=0?474:473),s=474+i(o,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*s-110)/2816)+365*(s-1)+1029983*Math.floor(o/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=i(e,1029983),a=2820;if(1029982!==n){var o=Math.floor(n/366),s=i(n,366);a=Math.floor((2134*o+2816*s+2815)/1028522)+o+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)}}),a.calendars.persian=n,a.calendars.jalali=n},{"../main":590,"object-assign":471}],587:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();a(n.prototype=new i.baseCalendar,{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,i.local.invalidYear);t=this._t2gYear(e.year());return o.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear);t=this._t2gYear(n.year());return o.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.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 n=this._validate(t,e,r,i.local.invalidDate);t=this._t2gYear(n.year());return o.toJD(t,n.month(),n.day())},fromJD:function(t){var e=o.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)}}),i.calendars.taiwan=n},{"../main":590,"object-assign":471}],588:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main"),a=t("object-assign"),o=i.instance();a(n.prototype=new i.baseCalendar,{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,i.local.invalidYear);t=this._t2gYear(e.year());return o.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,i.local.invalidYear);t=this._t2gYear(n.year());return o.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,i.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 n=this._validate(t,e,r,i.local.invalidDate);t=this._t2gYear(n.year());return o.toJD(t,n.month(),n.day())},fromJD:function(t){var e=o.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)}}),i.calendars.thai=n},{"../main":590,"object-assign":471}],589:[function(t,e,r){function n(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}var i=t("../main");t("object-assign")(n.prototype=new i.baseCalendar,{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,i.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,i.local.invalidMonth).toJD()-24e5+.5,n=0,o=0;o<a.length;o++){if(a[o]>r)return a[n]-a[n-1];n++}return 30},weekDay:function(t,e,r){return 5!==this.dayOfWeek(t,e,r)},toJD:function(t,e,r){var n=this._validate(t,e,r,i.local.invalidDate),o=12*(n.year()-1)+n.month()-15292;return n.day()+a[o-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;n<a.length&&!(a[n]>e);n++)r++;var i=r+15292,o=Math.floor((i-1)/12),s=o+1,l=i-12*o,c=e-a[r-1]+1;return this.newDate(s,l,c)},isValid:function(t,e,r){var n=i.baseCalendar.prototype.isValid.apply(this,arguments);return n&&(n=(t=null!=t.year?t.year:t)>=1276&&t<=1500),n},_validate:function(t,e,r,n){var a=i.baseCalendar.prototype._validate.apply(this,arguments);if(a.year<1276||a.year>1500)throw n.replace(/\{0\}/,this.local.name);return a}}),i.calendars.ummalqura=n;var a=[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":590,"object-assign":471}],590:[function(t,e,r){function n(){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 a(t,e){return t=""+t,"000000".substring(0,e-t.length)+t}function o(){this.shortYearCutoff="+10"}function s(t){this.local=this.regionalOptions[t]||this.regionalOptions[""]}var l=t("object-assign");l(n.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]}}}),l(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?"-":"")+a(Math.abs(this.year()),4)+"-"+a(this.month(),2)+"-"+a(this.day(),2)}}),l(o.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?"-":"")+a(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(;o<t.minMonth;)a--,o+=t.monthsInYear(a);for(var e=t.monthsInYear(a);o>e-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.monthsInYear(i)&&r>=this.minDay&&r-this.minDay<this.daysInMonth(i)}return this._validateLevel--,n},toJSDate:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);return c.instance().fromJD(this.toJD(n)).toJSDate()},fromJSDate:function(t){return this.fromJD(c.instance().fromJSDate(t).toJD())},_validate:function(t,e,r,n){if(t.year){if(0===this._validateLevel&&this.name!==t.calendar().name)throw(c.local.differentCalendars||c.regionalOptions[""].differentCalendars).replace(/\{0\}/,this.local.name).replace(/\{1\}/,t.calendar().local.name);return t}try{if(this._validateLevel++,1===this._validateLevel&&!this.isValid(t,e,r))throw n.replace(/\{0\}/,this.local.name);var i=this.newDate(t,e,r);return this._validateLevel--,i}catch(t){throw this._validateLevel--,t}}}),l(s.prototype=new o,{name:"Gregorian",jdEpoch:1721425.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Gregorian",epochs:["BCE","CE"],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,c.local.invalidYear||c.regionalOptions[""].invalidYear);return(t=e.year()+(e.year()<0?1:0))%4==0&&(t%100!=0||t%400==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,c.local.invalidMonth||c.regionalOptions[""].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 n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate);t=n.year(),e=n.month(),r=n.day(),t<0&&t++,e<3&&(e+=12,t--);var i=Math.floor(t/100),a=2-i+Math.floor(i/4);return Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r+a-1524.5},fromJD:function(t){var e=Math.floor(t+.5),r=Math.floor((e-1867216.25)/36524.25),n=(r=e+1+r-Math.floor(r/4))+1524,i=Math.floor((n-122.1)/365.25),a=Math.floor(365.25*i),o=Math.floor((n-a)/30.6001),s=n-a-Math.floor(30.6001*o),l=o-(o>13.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 n;c.cdate=i,c.baseCalendar=o,c.calendars.gregorian=s},{"object-assign":471}],591:[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=(r=r||{}).dayNamesShort||this.local.dayNamesShort,a=r.dayNames||this.local.dayNames,o=r.monthNumbers||this.local.monthNumbers,s=r.monthNamesShort||this.local.monthNamesShort,l=r.monthNames||this.local.monthNames,c=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;b+n<t.length&&t.charAt(b+n)===e;)n++;return b+=n-1,Math.floor(n/(r||1))>1}),u=function(t,e,r,n){var i=""+e;if(c(t,n))for(;i.length<r;)i="0"+i;return i},h=function(t,e,r,n){return c(t)?n[e]:r[e]},f=this,d=function(t){return"function"==typeof o?o.call(f,t,c("m")):g(u("m",t.month(),2))},p=function(t,e){return e?"function"==typeof l?l.call(f,t):l[t.month()-f.minMonth]:"function"==typeof s?s.call(f,t):s[t.month()-f.minMonth]},m=this.local.digits,g=function(t){return r.localNumbers&&m?m(t):t},v="",y=!1,b=0;b<t.length;b++)if(y)"'"!==t.charAt(b)||c("'")?v+=t.charAt(b):y=!1;else switch(t.charAt(b)){case"d":v+=g(u("d",e.day(),2));break;case"D":v+=h("D",e.dayOfWeek(),n,a);break;case"o":v+=u("o",e.dayOfYear(),3);break;case"w":v+=u("w",e.weekOfYear(),2);break;case"m":v+=d(e);break;case"M":v+=p(e,c("M"));break;case"y":v+=c("y",2)?e.year():(e.year()%100<10?"0":"")+e.year()%100;break;case"Y":c("Y",2),v+=e.formatYear();break;case"J":v+=e.toJD();break;case"@":v+=(e.toJD()-this.UNIX_EPOCH)*this.SECS_PER_DAY;break;case"!":v+=(e.toJD()-this.TICKS_EPOCH)*this.TICKS_PER_DAY;break;case"'":c("'")?v+="'":y=!0;break;default:v+=t.charAt(b)}return v},parseDate:function(t,e,r){if(null==e)throw i.local.invalidArguments||i.regionalOptions[""].invalidArguments;if(""===(e="object"==typeof e?e.toString():e+""))return null;t=t||this.local.dateFormat;var n=(r=r||{}).shortYearCutoff||this.shortYearCutoff;n="string"!=typeof n?n:this.today().year()%100+parseInt(n,10);for(var a=r.dayNamesShort||this.local.dayNamesShort,o=r.dayNames||this.local.dayNames,s=r.parseMonth||this.local.parseMonth,l=r.monthNumbers||this.local.monthNumbers,c=r.monthNamesShort||this.local.monthNamesShort,u=r.monthNames||this.local.monthNames,h=-1,f=-1,d=-1,p=-1,m=-1,g=!1,v=!1,y=function(e,r){for(var n=1;A+n<t.length&&t.charAt(A+n)===e;)n++;return A+=n-1,Math.floor(n/(r||1))>1},b=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(T).match(o);if(!s)throw(i.local.missingNumberAt||i.regionalOptions[""].missingNumberAt).replace(/\{0\}/,T);return T+=s[0].length,parseInt(s[0],10)},x=this,_=function(){if("function"==typeof l){y("m");var t=l.call(x,e.substring(T));return T+=t.length,t}return b("m")},w=function(t,r,n,a){for(var o=y(t,a)?n:r,s=0;s<o.length;s++)if(e.substr(T,o[s].length).toLowerCase()===o[s].toLowerCase())return T+=o[s].length,s+x.minMonth;throw(i.local.unknownNameAt||i.regionalOptions[""].unknownNameAt).replace(/\{0\}/,T)},M=function(){if("function"==typeof u){var t=y("M")?u.call(x,e.substring(T)):c.call(x,e.substring(T));return T+=t.length,t}return w("M",c,u)},k=function(){if(e.charAt(T)!==t.charAt(A))throw(i.local.unexpectedLiteralAt||i.regionalOptions[""].unexpectedLiteralAt).replace(/\{0\}/,T);T++},T=0,A=0;A<t.length;A++)if(v)"'"!==t.charAt(A)||y("'")?k():v=!1;else switch(t.charAt(A)){case"d":p=b("d");break;case"D":w("D",a,o);break;case"o":m=b("o");break;case"w":b("w");break;case"m":d=_();break;case"M":d=M();break;case"y":var S=A;g=!y("y",2),A=S,f=b("y",2);break;case"Y":f=b("Y",2);break;case"J":h=b("J")+.5,"."===e.charAt(T)&&(T++,b("J"));break;case"@":h=b("@")/this.SECS_PER_DAY+this.UNIX_EPOCH;break;case"!":h=b("!")/this.TICKS_PER_DAY+this.TICKS_EPOCH;break;case"*":T=e.length;break;case"'":y("'")?k():v=!0;break;default:k()}if(T<e.length)throw i.local.unexpectedText||i.regionalOptions[""].unexpectedText;if(-1===f?f=this.today().year():f<100&&g&&(f+=-1===n?1900:this.today().year()-this.today().year()%100-(f<=n?0:100)),"string"==typeof d&&(d=s.call(this,f,d)),m>-1){d=1,p=m;for(var E=this.daysInMonth(f,d);p>E;E=this.daysInMonth(f,d))d++,p-=E}return h>-1?this.fromJD(h):this.newDate(f,d,p)},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":590,"object-assign":471}],592:[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":111}],593:[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":592}],594:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./common_defaults"),o=t("./attributes");e.exports=function(t,e,r,s,l){function c(r,i){return n.coerce(t,e,o,r,i)}s=s||{};var u=c("visible",!(l=l||{}).itemIsNotPlainObject),h=c("clicktoshow");if(!u&&!h)return e;a(t,e,r,c);for(var f=e.showarrow,d=["x","y"],p=[-10,-30],m={_fullLayout:r},g=0;g<2;g++){var v=d[g],y=i.coerceRef(t,e,m,v,"","paper");if(i.coercePosition(e,m,c,y,v,.5),f){var b="a"+v,x=i.coerceRef(t,e,m,b,"pixel");"pixel"!==x&&x!==y&&(x=e[b]="pixel");var _="pixel"===x?p[g]:.4;i.coercePosition(e,m,c,x,b,_)}c(v+"anchor"),c(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),f&&n.noneOrAll(t,e,["ax","ay"]),h){var w=c("xclick"),M=c("yclick");e._xclick=void 0===w?e.x:i.cleanPosition(w,m,e.xref),e._yclick=void 0===M?e.y:i.cleanPosition(M,m,e.yref)}return e}},{"../../lib":738,"../../plots/cartesian/axes":785,"./attributes":596,"./common_defaults":599}],595:[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}]},{}],596:[function(t,e,r){"use strict";var n=t("./arrow_paths"),i=t("../../plots/font_attributes"),a=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"annotation",visible:{valType:"boolean",dflt:!0,editType:"calcIfAutorange"},text:{valType:"string",editType:"calcIfAutorange"},textangle:{valType:"angle",dflt:0,editType:"calcIfAutorange"},font:i({editType:"calcIfAutorange",colorEditType:"arraydraw"}),width:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange"},height:{valType:"number",min:1,dflt:null,editType:"calcIfAutorange"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},align:{valType:"enumerated",values:["left","center","right"],dflt:"center",editType:"arraydraw"},valign:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle",editType:"arraydraw"},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},bordercolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},borderpad:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange"},borderwidth:{valType:"number",min:0,dflt:1,editType:"calcIfAutorange"},showarrow:{valType:"boolean",dflt:!0,editType:"calcIfAutorange"},arrowcolor:{valType:"color",editType:"arraydraw"},arrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},startarrowhead:{valType:"integer",min:0,max:n.length,dflt:1,editType:"arraydraw"},arrowside:{valType:"flaglist",flags:["end","start"],extras:["none"],dflt:"end",editType:"arraydraw"},arrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange"},startarrowsize:{valType:"number",min:.3,dflt:1,editType:"calcIfAutorange"},arrowwidth:{valType:"number",min:.1,editType:"calcIfAutorange"},standoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange"},startstandoff:{valType:"number",min:0,dflt:0,editType:"calcIfAutorange"},ax:{valType:"any",editType:"calcIfAutorange"},ay:{valType:"any",editType:"calcIfAutorange"},axref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.x.toString()],editType:"calc"},ayref:{valType:"enumerated",dflt:"pixel",values:["pixel",a.idRegex.y.toString()],editType:"calc"},xref:{valType:"enumerated",values:["paper",a.idRegex.x.toString()],editType:"calc"},x:{valType:"any",editType:"calcIfAutorange"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"auto",editType:"calcIfAutorange"},xshift:{valType:"number",dflt:0,editType:"calcIfAutorange"},yref:{valType:"enumerated",values:["paper",a.idRegex.y.toString()],editType:"calc"},y:{valType:"any",editType:"calcIfAutorange"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"calcIfAutorange"},yshift:{valType:"number",dflt:0,editType:"calcIfAutorange"},clicktoshow:{valType:"enumerated",values:[!1,"onoff","onout"],dflt:!1,editType:"arraydraw"},xclick:{valType:"any",editType:"arraydraw"},yclick:{valType:"any",editType:"arraydraw"},hovertext:{valType:"string",editType:"arraydraw"},hoverlabel:{bgcolor:{valType:"color",editType:"arraydraw"},bordercolor:{valType:"color",editType:"arraydraw"},font:i({editType:"arraydraw"}),editType:"arraydraw"},captureevents:{valType:"boolean",editType:"arraydraw"},editType:"calc",_deprecated:{ref:{valType:"string",editType:"calc"}}}},{"../../plots/cartesian/constants":790,"../../plots/font_attributes":810,"./arrow_paths":595}],597:[function(t,e,r){"use strict";function n(t){var e=t._fullLayout;i.filterVisible(e.annotations).forEach(function(e){var r,n,i,o,s=a.getFromId(t,e.xref),l=a.getFromId(t,e.yref),c=3*e.arrowsize*e.arrowwidth||0,u=3*e.startarrowsize*e.arrowwidth||0;s&&s.autorange&&(r=c+e.xshift,n=c-e.xshift,i=u+e.xshift,o=u-e.xshift,e.axref===e.xref?(a.expand(s,[s.r2c(e.x)],{ppadplus:r,ppadminus:n}),a.expand(s,[s.r2c(e.ax)],{ppadplus:Math.max(e._xpadplus,i),ppadminus:Math.max(e._xpadminus,o)})):(i=e.ax?i+e.ax:i,o=e.ax?o-e.ax:o,a.expand(s,[s.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r,i),ppadminus:Math.max(e._xpadminus,n,o)}))),l&&l.autorange&&(r=c-e.yshift,n=c+e.yshift,i=u-e.yshift,o=u+e.yshift,e.ayref===e.yref?(a.expand(l,[l.r2c(e.y)],{ppadplus:r,ppadminus:n}),a.expand(l,[l.r2c(e.ay)],{ppadplus:Math.max(e._ypadplus,i),ppadminus:Math.max(e._ypadminus,o)})):(i=e.ay?i+e.ay:i,o=e.ay?o-e.ay:o,a.expand(l,[l.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r,i),ppadminus:Math.max(e._ypadminus,n,o)})))})}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./draw").draw;e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.annotations);if(r.length&&t._fullData.length){var s={};r.forEach(function(t){s[t.xref]=1,s[t.yref]=1});for(var l in s){var c=a.getFromId(t,l);if(c&&c.autorange)return i.syncOrAsync([o,n],t)}}}},{"../../lib":738,"../../plots/cartesian/axes":785,"./draw":602}],598:[function(t,e,r){"use strict";function n(t,e){var r,n,a,o,s,l,c,u=t._fullLayout.annotations,h=[],f=[],d=[],p=(e||[]).length;for(r=0;r<u.length;r++)if(a=u[r],o=a.clicktoshow){for(n=0;n<p;n++)if(s=e[n],l=s.xaxis,c=s.yaxis,l._id===a.xref&&c._id===a.yref&&l.d2r(s.x)===i(a._xclick,l)&&c.d2r(s.y)===i(a._yclick,c)){(a.visible?"onout"===o?f:d:h).push(r);break}n===p&&a.visible&&"onout"===o&&f.push(r)}return{on:h,off:f,explicitOff:d}}function i(t,e){return"log"===e.type?e.l2r(t):e.d2r(t)}var a=t("../../plotly");e.exports={hasClickToShow:function(t,e){var r=n(t,e);return r.on.length>0||r.explicitOff.length>0},onClick:function(t,e){var r,i=n(t,e),o=i.on,s=i.off.concat(i.explicitOff),l={};if(o.length||s.length){for(r=0;r<o.length;r++)l["annotations["+o[r]+"].visible"]=!0;for(r=0;r<s.length;r++)l["annotations["+s[r]+"].visible"]=!1;return a.update(t,{},l)}}}},{"../../plotly":780}],599:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color");e.exports=function(t,e,r,a){a("opacity");var o=a("bgcolor"),s=a("bordercolor"),l=i.opacity(s);a("borderpad");var c=a("borderwidth"),u=a("showarrow");a("text",u?" ":"new text"),a("textangle"),n.coerceFont(a,"font",r.font),a("width"),a("align");if(a("height")&&a("valign"),u){var h,f,d=a("arrowside");-1!==d.indexOf("end")&&(h=a("arrowhead"),f=a("arrowsize")),-1!==d.indexOf("start")&&(a("startarrowhead",h),a("startarrowsize",f)),a("arrowcolor",l?e.bordercolor:i.defaultLine),a("arrowwidth",2*(l&&c||1)),a("standoff"),a("startstandoff")}var p=a("hovertext"),m=r.hoverlabel||{};if(p){var g=a("hoverlabel.bgcolor",m.bgcolor||(i.opacity(o)?i.rgb(o):i.defaultLine)),v=a("hoverlabel.bordercolor",m.bordercolor||i.contrast(g));n.coerceFont(a,"hoverlabel.font",{family:m.font.family,size:m.font.size,color:m.font.color||v})}a("captureevents",!!p)}},{"../../lib":738,"../color":613}],600:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib/to_log_range");e.exports=function(t,e,r,a){function o(t){var r=c[t],o=null;o=s?i(r,e.range):Math.pow(10,r),n(o)||(o=null),a(u+t,o)}e=e||{};var s="log"===r&&"linear"===e.type,l="linear"===r&&"log"===e.type;if(s||l)for(var c,u,h=t._fullLayout.annotations,f=e._id.charAt(0),d=0;d<h.length;d++)c=h[d],u="annotations["+d+"].",c[f+"ref"]===e._id&&o(f),c["a"+f+"ref"]===e._id&&o("a"+f)}},{"../../lib/to_log_range":763,"fast-isnumeric":132}],601:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./annotation_defaults");e.exports=function(t,e){n(t,e,{name:"annotations",handleItemDefaults:i})}},{"../../plots/array_container_defaults":782,"./annotation_defaults":594}],602:[function(t,e,r){"use strict";function n(t,e){var r=t._fullLayout.annotations[e]||{};i(t,r,e,!1,c.getFromId(t,r.xref),c.getFromId(t,r.yref))}function i(t,e,r,n,i,s){function c(r){return r.call(h.font,R).attr({"text-anchor":{left:"start",right:"end"}[e.align]||"middle"}),d.convertToTspans(r,t,v),r}function v(){function r(t,e){return"auto"===e&&(e=t<1/3?"left":t>2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var a=j.selectAll("a");if(1===a.size()&&a.text()===j.text()){C.insert("a",":first-child").attr({"xlink:xlink:href":a.attr("xlink:href"),"xlink:xlink:show":a.attr("xlink:show")}).style({cursor:"pointer"}).node().appendChild(z.node())}var c=C.select(".annotation-text-math-group"),f=!c.empty(),v=h.bBox((f?c:j).node()),y=v.width,L=v.height,P=e.width||y,R=e.height||L,N=Math.round(P+2*D),B=Math.round(R+2*D);e._w=P,e._h=R;for(var U=!1,V=["x","y"],H=0;H<V.length;H++){var q,G,Y,W,X,Z=V[H],J=e[Z+"ref"]||Z,K=e["a"+Z+"ref"],Q={x:i,y:s}[Z],$=(T+("x"===Z?0:-90))*Math.PI/180,tt=N*Math.cos($),et=B*Math.sin($),rt=Math.abs(tt)+Math.abs(et),nt=e[Z+"anchor"],it=e[Z+"shift"]*("x"===Z?1:-1),at=k[Z];if(Q){var ot=Q.r2fraction(e[Z]);if((t._dragging||!Q.autorange)&&(ot<0||ot>1)&&(K===J?((ot=Q.r2fraction(e["a"+Z]))<0||ot>1)&&(U=!0):U=!0,U))continue;q=Q._offset+Q.r2p(e[Z]),W=.5}else"x"===Z?(Y=e[Z],q=_.l+_.w*Y):(Y=1-e[Z],q=_.t+_.h*Y),W=e.showarrow?.5:Y;if(e.showarrow){at.head=q;var st=e["a"+Z];X=tt*r(.5,e.xanchor)-et*r(.5,e.yanchor),K===J?(at.tail=Q._offset+Q.r2p(st),G=X):(at.tail=q+st,G=X+st),at.text=at.tail+X;var lt=x["x"===Z?"width":"height"];if("paper"===J&&(at.head=l.constrain(at.head,1,lt-1)),"pixel"===K){var ct=-Math.max(at.tail-3,at.text),ut=Math.min(at.tail+3,at.text)-lt;ct>0?(at.tail+=ct,at.text+=ct):ut>0&&(at.tail-=ut,at.text-=ut)}at.tail+=it,at.head+=it}else G=X=rt*r(W,nt),at.text=q+X;at.text+=it,X+=it,G+=it,e["_"+Z+"padplus"]=rt/2+G,e["_"+Z+"padminus"]=rt/2-G,e["_"+Z+"size"]=rt,e["_"+Z+"shift"]=X}if(U)C.remove();else{var ht=0,ft=0;if("left"!==e.align&&(ht=(P-y)*("center"===e.align?.5:1)),"top"!==e.valign&&(ft=(R-L)*("middle"===e.valign?.5:1)),f)c.select("svg").attr({x:D+ht-1,y:D+ft}).call(h.setClipUrl,O?M:null);else{var dt=D+ft-v.top,pt=D+ht-v.left;j.call(d.positionText,pt,dt).call(h.setClipUrl,O?M:null)}F.select("rect").call(h.setRect,D,D,P,R),z.call(h.setRect,I/2,I/2,N-I,B-I),C.call(h.setTranslate,Math.round(k.x.text-N/2),Math.round(k.y.text-B/2)),S.attr({transform:"rotate("+T+","+k.x.text+","+k.y.text+")"});var mt=function(r,a){A.selectAll(".annotation-arrow-g").remove();var c=k.x.head,f=k.y.head,d=k.x.tail+r,p=k.y.tail+a,v=k.x.text+r,y=k.y.text+a,x=l.rotationXYMatrix(T,v,y),M=l.apply2DTransform(x),E=l.apply2DTransform2(x),L=+z.attr("width"),I=+z.attr("height"),P=v-.5*L,D=P+L,O=y-.5*I,F=O+I,R=[[P,O,P,F],[P,F,D,F],[D,F,D,O],[D,O,P,O]].map(E);if(!R.reduce(function(t,e){return t^!!l.segmentsIntersect(c,f,c+1e6,f+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=l.segmentsIntersect(d,p,c,f,t[0],t[1],t[2],t[3]);e&&(d=e.x,p=e.y)});var j=e.arrowwidth,N=e.arrowcolor,B=e.arrowside,U=A.append("g").style({opacity:u.opacity(N)}).classed("annotation-arrow-g",!0),V=U.append("path").attr("d","M"+d+","+p+"L"+c+","+f).style("stroke-width",j+"px").call(u.stroke,u.rgb(N));if(g(V,B,e),w.annotationPosition&&V.node().parentNode&&!n){var H=c,q=f;if(e.standoff){var G=Math.sqrt(Math.pow(c-d,2)+Math.pow(f-p,2));H+=e.standoff*(d-c)/G,q+=e.standoff*(p-f)/G}var Y,W,X,Z=U.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-H)+","+(p-q),transform:"translate("+H+","+q+")"}).style("stroke-width",j+6+"px").call(u.stroke,"rgba(0,0,0,0)").call(u.fill,"rgba(0,0,0,0)");m.init({element:Z.node(),gd:t,prepFn:function(){var t=h.getTranslate(C);W=t.x,X=t.y,Y={},i&&i.autorange&&(Y[i._name+".autorange"]=!0),s&&s.autorange&&(Y[s._name+".autorange"]=!0)},moveFn:function(t,r){var n=M(W,X),a=n[0]+t,o=n[1]+r;C.call(h.setTranslate,a,o),Y[b+".x"]=i?i.p2r(i.r2p(e.x)+t):e.x+t/_.w,Y[b+".y"]=s?s.p2r(s.r2p(e.y)+r):e.y-r/_.h,e.axref===e.xref&&(Y[b+".ax"]=i.p2r(i.r2p(e.ax)+t)),e.ayref===e.yref&&(Y[b+".ay"]=s.p2r(s.r2p(e.ay)+r)),U.attr("transform","translate("+t+","+r+")"),S.attr({transform:"rotate("+T+","+a+","+o+")"})},doneFn:function(){o.relayout(t,Y);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(e.showarrow&&mt(0,0),E){var gt,vt;m.init({element:C.node(),gd:t,prepFn:function(){vt=S.attr("transform"),gt={}},moveFn:function(t,r){var a="pointer";if(e.showarrow)e.axref===e.xref?gt[b+".ax"]=i.p2r(i.r2p(e.ax)+t):gt[b+".ax"]=e.ax+t,e.ayref===e.yref?gt[b+".ay"]=s.p2r(s.r2p(e.ay)+r):gt[b+".ay"]=e.ay+r,mt(t,r);else{if(n)return;if(i)gt[b+".x"]=e.x+t/i._m;else{var o=e._xsize/_.w,l=e.x+(e._xshift-e.xshift)/_.w-o/2;gt[b+".x"]=m.align(l+t/_.w,o,0,1,e.xanchor)}if(s)gt[b+".y"]=e.y+r/s._m;else{var c=e._ysize/_.h,u=e.y-(e._yshift+e.yshift)/_.h-c/2;gt[b+".y"]=m.align(u-r/_.h,c,0,1,e.yanchor)}i&&s||(a=m.getCursor(i?.5:gt[b+".x"],s?.5:gt[b+".y"],e.xanchor,e.yanchor))}S.attr({transform:"translate("+t+","+r+")"+vt}),p(C,a)},doneFn:function(){p(C),o.relayout(t,gt);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}}var y,b,x=t._fullLayout,_=t._fullLayout._size,w=t._context.edits;n?(y="annotation-"+n,b=n+".annotations["+r+"]"):(y="annotation",b="annotations["+r+"]"),x._infolayer.selectAll("."+y+'[data-index="'+r+'"]').remove();var M="clip"+x._uid+"_ann"+r;if(e._input&&!1!==e.visible){var k={x:{},y:{}},T=+e.textangle||0,A=x._infolayer.append("g").classed(y,!0).attr("data-index",String(r)).style("opacity",e.opacity),S=A.append("g").classed("annotation-text-g",!0),E=w[e.showarrow?"annotationTail":"annotationPosition"],L=e.captureevents||w.annotationText||E,C=S.append("g").style("pointer-events",L?"all":null).call(p,"default").on("click",function(){t._dragging=!1;var i={index:r,annotation:e._input,fullAnnotation:e,event:a.event};n&&(i.subplotId=n),t.emit("plotly_clickannotation",i)});e.hovertext&&C.on("mouseover",function(){var r=e.hoverlabel,n=r.font,i=this.getBoundingClientRect(),a=t.getBoundingClientRect();f.loneHover({x0:i.left-a.left,x1:i.right-a.left,y:(i.top+i.bottom)/2-a.top,text:e.hovertext,color:r.bgcolor,borderColor:r.bordercolor,fontFamily:n.family,fontSize:n.size,fontColor:n.color},{container:x._hoverlayer.node(),outerContainer:x._paper.node(),gd:t})}).on("mouseout",function(){f.loneUnhover(x._hoverlayer.node())});var I=e.borderwidth,P=e.borderpad,D=I+P,z=C.append("rect").attr("class","bg").style("stroke-width",I+"px").call(u.stroke,e.bordercolor).call(u.fill,e.bgcolor),O=e.width||e.height,F=x._topclips.selectAll("#"+M).data(O?[0]:[]);F.enter().append("clipPath").classed("annclip",!0).attr("id",M).append("rect"),F.exit().remove();var R=e.font,j=C.append("text").classed("annotation-text",!0).text(e.text);w.annotationText?j.call(d.makeEditable,{delegate:C,gd:t}).call(c).on("edit",function(r){e.text=r,this.call(c);var n={};n[b+".text"]=e.text,i&&i.autorange&&(n[i._name+".autorange"]=!0),s&&s.autorange&&(n[s._name+".autorange"]=!0),o.relayout(t,n)}):j.call(c)}else a.selectAll("#"+M).remove()}var a=t("d3"),o=t("../../plotly"),s=t("../../plots/plots"),l=t("../../lib"),c=t("../../plots/cartesian/axes"),u=t("../color"),h=t("../drawing"),f=t("../fx"),d=t("../../lib/svg_text_utils"),p=t("../../lib/setcursor"),m=t("../dragelement"),g=t("./draw_arrow_head");e.exports={draw:function(t){var e=t._fullLayout;e._infolayer.selectAll(".annotation").remove();for(var r=0;r<e.annotations.length;r++)e.annotations[r].visible&&n(t,r);return s.previousPromises(t)},drawOne:n,drawRaw:i}},{"../../lib":738,"../../lib/setcursor":757,"../../lib/svg_text_utils":761,"../../plotly":780,"../../plots/cartesian/axes":785,"../../plots/plots":846,"../color":613,"../dragelement":635,"../drawing":638,"../fx":655,"./draw_arrow_head":603,d3:123}],603:[function(t,e,r){"use strict";var n=t("d3"),i=t("../color"),a=t("./arrow_paths");e.exports=function(t,e,r){function o(){t.style("stroke-dasharray","0px,100px")}function s(e,a,o,s){e.path&&(e.noRotate&&(o=0),n.select(f.parentNode).append("path").attr({class:t.attr("class"),d:e.path,transform:"translate("+a.x+","+a.y+")"+(o?"rotate("+180*o/Math.PI+")":"")+"scale("+s+")"}).style({fill:i.rgb(r.arrowcolor),"stroke-width":0}))}var l,c,u,h,f=t.node(),d=a[r.arrowhead||0],p=a[r.startarrowhead||0],m=(r.arrowwidth||1)*(r.arrowsize||1),g=(r.arrowwidth||1)*(r.startarrowsize||1),v=e.indexOf("start")>=0,y=e.indexOf("end")>=0,b=d.backoff*m+r.standoff,x=p.backoff*g+r.startstandoff;if("line"===f.nodeName){l={x:+t.attr("x1"),y:+t.attr("y1")},c={x:+t.attr("x2"),y:+t.attr("y2")};var _=l.x-c.x,w=l.y-c.y;if(u=Math.atan2(w,_),h=u+Math.PI,b&&x&&b+x>Math.sqrt(_*_+w*w))return void o();if(b){if(b*b>_*_+w*w)return void o();var M=b*Math.cos(u),k=b*Math.sin(u);c.x+=M,c.y+=k,t.attr({x2:c.x,y2:c.y})}if(x){if(x*x>_*_+w*w)return void o();var T=x*Math.cos(u),A=x*Math.sin(u);l.x-=T,l.y-=A,t.attr({x1:l.x,y1:l.y})}}else if("path"===f.nodeName){var S=f.getTotalLength(),E="";if(S<b+x)return void o();var L=f.getPointAtLength(0),C=f.getPointAtLength(.1);u=Math.atan2(L.y-C.y,L.x-C.x),l=f.getPointAtLength(Math.min(x,S)),E="0px,"+x+"px,";var I=f.getPointAtLength(S),P=f.getPointAtLength(S-.1);h=Math.atan2(I.y-P.y,I.x-P.x),c=f.getPointAtLength(Math.max(0,S-b));E+=S-(E?x+b:b)+"px,"+S+"px",t.style("stroke-dasharray",E)}v&&s(p,l,u,g),y&&s(d,c,h,m)}},{"../color":613,"./arrow_paths":595,d3:123}],604:[function(t,e,r){"use strict";var n=t("./draw"),i=t("./click");e.exports={moduleType:"component",name:"annotations",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),includeBasePlot:t("../../plots/cartesian/include_components")("annotations"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne,drawRaw:n.drawRaw,hasClickToShow:i.hasClickToShow,onClick:i.onClick,convertCoords:t("./convert_coords")}},{"../../plots/cartesian/include_components":795,"./attributes":596,"./calc_autorange":597,"./click":598,"./convert_coords":600,"./defaults":601,"./draw":602}],605:[function(t,e,r){"use strict";var n=t("../annotations/attributes"),i=t("../../plot_api/edit_types").overrideAll;e.exports=i({_isLinkedToArray:"annotation",visible:n.visible,x:{valType:"any"},y:{valType:"any"},z:{valType:"any"},ax:{valType:"number"},ay:{valType:"number"},xanchor:n.xanchor,xshift:n.xshift,yanchor:n.yanchor,yshift:n.yshift,text:n.text,textangle:n.textangle,font:n.font,width:n.width,height:n.height,opacity:n.opacity,align:n.align,valign:n.valign,bgcolor:n.bgcolor,bordercolor:n.bordercolor,borderpad:n.borderpad,borderwidth:n.borderwidth,showarrow:n.showarrow,arrowcolor:n.arrowcolor,arrowhead:n.arrowhead,startarrowhead:n.startarrowhead,arrowside:n.arrowside,arrowsize:n.arrowsize,startarrowsize:n.startarrowsize,arrowwidth:n.arrowwidth,standoff:n.standoff,startstandoff:n.startstandoff,hovertext:n.hovertext,hoverlabel:n.hoverlabel,captureevents:n.captureevents},"calc","from-root")},{"../../plot_api/edit_types":769,"../annotations/attributes":596}],606:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes");e.exports=function(t){for(var e=t.fullSceneLayout.annotations,r=0;r<e.length;r++)!function(t,e){var r=e.fullSceneLayout.domain,a=e.fullLayout._size,o={pdata:null,type:"linear",autorange:!1,range:[-1/0,1/0]};t._xa={},n.extendFlat(t._xa,o),i.setConvert(t._xa),t._xa._offset=a.l+r.x[0]*a.w,t._xa.l2p=function(){return.5*(1+t.pdata[0]/t.pdata[3])*a.w*(r.x[1]-r.x[0])},t._ya={},n.extendFlat(t._ya,o),i.setConvert(t._ya),t._ya._offset=a.t+(1-r.y[1])*a.h,t._ya.l2p=function(){return.5*(1-t.pdata[1]/t.pdata[3])*a.h*(r.y[1]-r.y[0])}}(e[r],t);t.fullLayout._infolayer.selectAll(".annotation-"+t.id).remove()}},{"../../lib":738,"../../plots/cartesian/axes":785}],607:[function(t,e,r){"use strict";function n(t,e,r,n,o){function c(r,n){return i.coerce(t,e,l,r,n)}function u(t){var n=t+"axis",i={_fullLayout:{}};return i._fullLayout[n]=r[n],a.coercePosition(e,i,c,t,t,.5)}return c("visible",!o.itemIsNotPlainObject)?(s(t,e,n.fullLayout,c),u("x"),u("y"),u("z"),i.noneOrAll(t,e,["x","y","z"]),e.xref="x",e.yref="y",e.zref="z",c("xanchor"),c("yanchor"),c("xshift"),c("yshift"),e.showarrow&&(e.axref="pixel",e.ayref="pixel",c("ax",-10),c("ay",-30),i.noneOrAll(t,e,["ax","ay"])),e):e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("../annotations/common_defaults"),l=t("./attributes");e.exports=function(t,e,r){o(t,e,{name:"annotations",handleItemDefaults:n,fullLayout:r.fullLayout})}},{"../../lib":738,"../../plots/array_container_defaults":782,"../../plots/cartesian/axes":785,"../annotations/common_defaults":599,"./attributes":605}],608:[function(t,e,r){"use strict";var n=t("../annotations/draw").drawRaw,i=t("../../plots/gl3d/project"),a=["x","y","z"];e.exports=function(t){for(var e=t.fullSceneLayout,r=t.dataScale,o=e.annotations,s=0;s<o.length;s++){for(var l=o[s],c=!1,u=0;u<3;u++){var h=a[u],f=l[h],d=e[h+"axis"].r2fraction(f);if(d<0||d>1){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":835,"../annotations/draw":602}],609:[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)for(var a=r.attrRegex,o=Object.keys(t),s=0;s<o.length;s++){var l=o[s];a.test(l)&&(t[l].annotations||[]).length&&(i.pushUnique(e._basePlotModules,r),i.pushUnique(e._subplots.gl3d,l))}},convert:t("./convert"),draw:t("./draw")}},{"../../lib":738,"../../registry":861,"./attributes":605,"./convert":606,"./defaults":607,"./draw":608}],610:[function(t,e,r){"use strict";e.exports=t("world-calendars/dist/main"),t("world-calendars/dist/plus"),t("world-calendars/dist/calendars/chinese"),t("world-calendars/dist/calendars/coptic"),t("world-calendars/dist/calendars/discworld"),t("world-calendars/dist/calendars/ethiopian"),t("world-calendars/dist/calendars/hebrew"),t("world-calendars/dist/calendars/islamic"),t("world-calendars/dist/calendars/julian"),t("world-calendars/dist/calendars/mayan"),t("world-calendars/dist/calendars/nanakshahi"),t("world-calendars/dist/calendars/nepali"),t("world-calendars/dist/calendars/persian"),t("world-calendars/dist/calendars/taiwan"),t("world-calendars/dist/calendars/thai"),t("world-calendars/dist/calendars/ummalqura")},{"world-calendars/dist/calendars/chinese":576,"world-calendars/dist/calendars/coptic":577,"world-calendars/dist/calendars/discworld":578,"world-calendars/dist/calendars/ethiopian":579,"world-calendars/dist/calendars/hebrew":580,"world-calendars/dist/calendars/islamic":581,"world-calendars/dist/calendars/julian":582,"world-calendars/dist/calendars/mayan":583,"world-calendars/dist/calendars/nanakshahi":584,"world-calendars/dist/calendars/nepali":585,"world-calendars/dist/calendars/persian":586,"world-calendars/dist/calendars/taiwan":587,"world-calendars/dist/calendars/thai":588,"world-calendars/dist/calendars/ummalqura":589,"world-calendars/dist/main":590,"world-calendars/dist/plus":591}],611:[function(t,e,r){"use strict";function n(t){var e=m[t];return e||(e=m[t]=o.instance(t))}function i(t){return s.extendFlat({},h,{description:t})}function a(t){return"Sets the calendar system to use with `"+t+"` date data."}var o=t("./calendars"),s=t("../../lib"),l=t("../../constants/numerical"),c=l.EPOCHJD,u=l.ONEDAY,h={valType:"enumerated",values:Object.keys(o.calendars),editType:"calc",dflt:"gregorian"},f=function(t,e,r,n){var i={};return i[r]=h,s.coerce(t,e,i,r,n)},d="##",p={d:{0:"dd","-":"d"},e:{0:"d","-":"d"},a:{0:"D","-":"D"},A:{0:"DD","-":"DD"},j:{0:"oo","-":"o"},W:{0:"ww","-":"w"},m:{0:"mm","-":"m"},b:{0:"M","-":"M"},B:{0:"MM","-":"MM"},y:{0:"yy","-":"yy"},Y:{0:"yyyy","-":"yyyy"},U:d,w:d,c:{0:"D M d %X yyyy","-":"D M d %X yyyy"},x:{0:"mm/dd/yyyy","-":"mm/dd/yyyy"}},m={},g={xcalendar:i(a("x"))},v=s.extendFlat({},g,{ycalendar:i(a("y"))}),y=s.extendFlat({},v,{zcalendar:i(a("z"))}),b=i(["Sets the calendar system to use for `range` and `tick0`","if this is a date axis. This does not set the calendar for","interpreting data on this axis, that's specified in the trace","or via the global `layout.calendar`"].join(" "));e.exports={moduleType:"component",name:"calendars",schema:{traces:{scatter:v,bar:v,box:v,heatmap:v,contour:v,histogram:v,histogram2d:v,histogram2dcontour:v,scatter3d:y,surface:y,mesh3d:y,scattergl:v,ohlc:g,candlestick:g},layout:{calendar:i(["Sets the default calendar system to use for interpreting and","displaying dates throughout the plot."].join(" "))},subplots:{xaxis:{calendar:b},yaxis:{calendar:b},scene:{xaxis:{calendar:b},yaxis:{calendar:b},zaxis:{calendar:b}}},transforms:{filter:{valuecalendar:i(["Sets the calendar system to use for `value`, if it is a date."].join(" ")),targetcalendar:i(["Sets the calendar system to use for `target`, if it is an","array of dates. If `target` is a string (eg *x*) we use the","corresponding trace attribute (eg `xcalendar`) if it exists,","even if `targetcalendar` is provided."].join(" "))}}},layoutAttributes:h,handleDefaults:f,handleTraceDefaults:function(t,e,r,n){for(var i=0;i<r.length;i++)f(t,e,r[i]+"calendar",n.calendar)},CANONICAL_SUNDAY:{chinese:"2000-01-02",coptic:"2000-01-03",discworld:"2000-01-03",ethiopian:"2000-01-05",hebrew:"5000-01-01",islamic:"1000-01-02",julian:"2000-01-03",mayan:"5000-01-01",nanakshahi:"1000-01-05",nepali:"2000-01-05",persian:"1000-01-01",jalali:"1000-01-01",taiwan:"1000-01-04",thai:"2000-01-04",ummalqura:"1400-01-06"},CANONICAL_TICK:{chinese:"2000-01-01",coptic:"2000-01-01",discworld:"2000-01-01",ethiopian:"2000-01-01",hebrew:"5000-01-01",islamic:"1000-01-01",julian:"2000-01-01",mayan:"5000-01-01",nanakshahi:"1000-01-01",nepali:"2000-01-01",persian:"1000-01-01",jalali:"1000-01-01",taiwan:"1000-01-01",thai:"2000-01-01",ummalqura:"1400-01-01"},DFLTRANGE:{chinese:["2000-01-01","2001-01-01"],coptic:["1700-01-01","1701-01-01"],discworld:["1800-01-01","1801-01-01"],ethiopian:["2000-01-01","2001-01-01"],hebrew:["5700-01-01","5701-01-01"],islamic:["1400-01-01","1401-01-01"],julian:["2000-01-01","2001-01-01"],mayan:["5200-01-01","5201-01-01"],nanakshahi:["0500-01-01","0501-01-01"],nepali:["2000-01-01","2001-01-01"],persian:["1400-01-01","1401-01-01"],jalali:["1400-01-01","1401-01-01"],taiwan:["0100-01-01","0101-01-01"],thai:["2500-01-01","2501-01-01"],ummalqura:["1400-01-01","1401-01-01"]},getCal:n,worldCalFmt:function(t,e,r){for(var i,a,o,s,l,h=Math.floor((e+.05)/u)+c,f=n(r).fromJD(h),m=0;-1!==(m=t.indexOf("%",m));)"0"===(i=t.charAt(m+1))||"-"===i||"_"===i?(o=3,a=t.charAt(m+2),"_"===i&&(i="-")):(a=i,i="0",o=2),(s=p[a])?(l=s===d?d:f.formatDate(s[i]),t=t.substr(0,m)+l+t.substr(m+o),m+=l.length):m+=o;return t}}},{"../../constants/numerical":717,"../../lib":738,"./calendars":610}],612:[function(t,e,r){"use strict";r.defaults=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#7f7f7f","#bcbd22","#17becf"],r.defaultLine="#444",r.lightLine="#eee",r.background="#fff",r.borderLine="#BEC8D9",r.lightFraction=1e3/11},{}],613:[function(t,e,r){"use strict";function n(t){if(a(t)||"string"!=typeof t)return t;var e=t.trim();if("rgb"!==e.substr(0,3))return t;var r=e.match(/^rgba?\s*\(([^()]*)\)$/);if(!r)return t;var n=r[1].trim().split(/\s*[\s,]\s*/),i="a"===e.charAt(3)&&4===n.length;if(!i&&3!==n.length)return t;for(var o=0;o<n.length;o++){if(!n[o].length)return t;if(n[o]=Number(n[o]),!(n[o]>=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+")"}var i=t("tinycolor2"),a=t("fast-isnumeric"),o=e.exports={},s=t("./attributes");o.defaults=s.defaults;var l=o.defaultLine=s.defaultLine;o.lightLine=s.lightLine;var c=o.background=s.background;o.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},o.rgb=function(t){return o.tinyRGB(i(t))},o.opacity=function(t){return t?i(t).getAlpha():0},o.addOpacity=function(t,e){var r=i(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},o.combine=function(t,e){var r=i(t).toRgb();if(1===r.a)return i(t).toRgbString();var n=i(e||c).toRgb(),a=1===n.a?n:{r:255*(1-n.a)+n.r*n.a,g:255*(1-n.a)+n.g*n.a,b:255*(1-n.a)+n.b*n.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 i(o).toRgbString()},o.contrast=function(t,e,r){var n=i(t);1!==n.getAlpha()&&(n=i(o.combine(t,c)));return(n.isDark()?e?n.lighten(e):c:r?n.darken(r):l).toString()},o.stroke=function(t,e){var r=i(e);t.style({stroke:o.tinyRGB(r),"stroke-opacity":r.getAlpha()})},o.fill=function(t,e){var r=i(e);t.style({fill:o.tinyRGB(r),"fill-opacity":r.getAlpha()})},o.clean=function(t){if(t&&"object"==typeof t){var e,r,i,a,s=Object.keys(t);for(e=0;e<s.length;e++)if(i=s[e],a=t[i],"color"===i.substr(i.length-5))if(Array.isArray(a))for(r=0;r<a.length;r++)a[r]=n(a[r]);else t[i]=n(a);else if("colorscale"===i.substr(i.length-10)&&Array.isArray(a))for(r=0;r<a.length;r++)Array.isArray(a[r])&&(a[r][1]=n(a[r][1]));else if(Array.isArray(a)){var l=a[0];if(!Array.isArray(l)&&l&&"object"==typeof l)for(r=0;r<a.length;r++)o.clean(a[r])}else a&&"object"==typeof a&&o.clean(a)}}},{"./attributes":612,"fast-isnumeric":132,tinycolor2:543}],614:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/layout_attributes"),i=t("../../plots/font_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll;e.exports=o({thicknessmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"pixels"},thickness:{valType:"number",min:0,dflt:30},lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",dflt:1.02,min:-2,max:3},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},xpad:{valType:"number",min:0,dflt:10},y:{valType:"number",dflt:.5,min:-2,max:3},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"middle"},ypad:{valType:"number",min:0,dflt:10},outlinecolor:n.linecolor,outlinewidth:n.linewidth,bordercolor:n.linecolor,borderwidth:{valType:"number",min:0,dflt:0},bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)"},tickmode:n.tickmode,nticks:n.nticks,tick0:n.tick0,dtick:n.dtick,tickvals:n.tickvals,ticktext:n.ticktext,ticks:a({},n.ticks,{dflt:""}),ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,tickfont:i({}),tickangle:n.tickangle,tickformat:n.tickformat,tickformatstops:n.tickformatstops,tickprefix:n.tickprefix,showtickprefix:n.showtickprefix,ticksuffix:n.ticksuffix,showticksuffix:n.showticksuffix,separatethousands:n.separatethousands,exponentformat:n.exponentformat,showexponent:n.showexponent,title:{valType:"string"},titlefont:i({}),titleside:{valType:"enumerated",values:["right","top","bottom"],dflt:"top"}},"colorbars","from-root")},{"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/cartesian/layout_attributes":797,"../../plots/font_attributes":810}],615:[function(t,e,r){"use strict";e.exports={cn:{colorbar:"colorbar",cbbg:"cbbg",cbfill:"cbfill",cbfills:"cbfills",cbline:"cbline",cblines:"cblines",cbaxis:"cbaxis",cbtitleunshift:"cbtitleunshift",cbtitle:"cbtitle",cboutline:"cboutline",crisp:"crisp",jsPlaceholder:"js-placeholder"}}},{}],616:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/tick_value_defaults"),a=t("../../plots/cartesian/tick_mark_defaults"),o=t("../../plots/cartesian/tick_label_defaults"),s=t("./attributes");e.exports=function(t,e,r){function l(t,e){return n.coerce(u,c,s,t,e)}var c=e.colorbar={},u=t.colorbar||{};l("thickness","fraction"===l("thicknessmode")?30/(r.width-r.margin.l-r.margin.r):30);l("len","fraction"===l("lenmode")?1:r.height-r.margin.t-r.margin.b),l("x"),l("xanchor"),l("xpad"),l("y"),l("yanchor"),l("ypad"),n.noneOrAll(u,c,["x","y"]),l("outlinecolor"),l("outlinewidth"),l("bordercolor"),l("borderwidth"),l("bgcolor"),i(u,c,l,"linear"),o(u,c,l,"linear",{outerTicks:!1,font:r.font,noHover:!0}),a(u,c,l,"linear",{outerTicks:!1,font:r.font,noHover:!0}),l("title",r._dfltTitle.colorbar),n.coerceFont(l,"titlefont",r.font),l("titleside")}},{"../../lib":738,"../../plots/cartesian/tick_label_defaults":804,"../../plots/cartesian/tick_mark_defaults":805,"../../plots/cartesian/tick_value_defaults":806,"./attributes":614}],617:[function(t,e,r){"use strict";var n=t("d3"),i=t("tinycolor2"),a=t("../../plotly"),o=t("../../plots/plots"),s=t("../../registry"),l=t("../../plots/cartesian/axes"),c=t("../dragelement"),u=t("../../lib"),h=t("../../lib/extend").extendFlat,f=t("../../lib/setcursor"),d=t("../drawing"),p=t("../color"),m=t("../titles"),g=t("../../lib/svg_text_utils"),v=t("../../constants/alignment").LINE_SPACING,y=t("../../plots/cartesian/axis_defaults"),b=t("../../plots/cartesian/position_defaults"),x=t("../../plots/cartesian/layout_attributes"),_=t("./attributes"),w=t("./constants").cn;e.exports=function(t,e){function r(){function _(t,e){return u.coerce(tt,et,x,t,e)}function T(e,r){var n,i=M();n=s.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var a={propContainer:et,propName:n,traceIndex:i.index,placeholder:A._dfltTitle.colorbar,containerGroup:st.select(".cbtitle")},o="h"===e.charAt(0)?e.substr(1):"h"+e;st.selectAll("."+o+",."+o+"-math-group").remove(),m.draw(t,e,h(a,r||{}))}var A=t._fullLayout,S=A._size;if("function"==typeof k.fillcolor||"function"==typeof k.line.color){var E,L,C=n.extent(("function"==typeof k.fillcolor?k.fillcolor:k.line.color).domain()),I=[],P=[],D="function"==typeof k.line.color?k.line.color:function(){return k.line.color},z="function"==typeof k.fillcolor?k.fillcolor:function(){return k.fillcolor},O=k.levels.end+k.levels.size/100,F=k.levels.size,R=1.001*C[0]-.001*C[1],j=1.001*C[1]-.001*C[0];for(L=0;L<1e5&&(E=k.levels.start+L*F,!(F>0?E>=O:E<=O));L++)E>R&&E<j&&I.push(E);if("function"==typeof k.fillcolor)if(k.filllevels)for(O=k.filllevels.end+k.filllevels.size/100,F=k.filllevels.size,L=0;L<1e5&&(E=k.filllevels.start+L*F,!(F>0?E>=O:E<=O));L++)E>C[0]&&E<C[1]&&P.push(E);else(P=I.map(function(t){return t-k.levels.size/2})).push(P[P.length-1]+k.levels.size);else k.fillcolor&&"string"==typeof k.fillcolor&&(P=[0]);k.levels.size<0&&(I.reverse(),P.reverse());var N,B=A.height-A.margin.t-A.margin.b,U=A.width-A.margin.l-A.margin.r,V=Math.round(k.thickness*("fraction"===k.thicknessmode?U:1)),H=V/S.w,q=Math.round(k.len*("fraction"===k.lenmode?B:1)),G=q/S.h,Y=k.xpad/S.w,W=(k.borderwidth+k.outlinewidth)/2,X=k.ypad/S.h,Z=Math.round(k.x*S.w+k.xpad),J=k.x-H*({middle:.5,right:1}[k.xanchor]||0),K=k.y+G*(({top:-.5,bottom:.5}[k.yanchor]||0)-.5),Q=Math.round(S.h*(1-K)),$=Q-q,tt={type:"linear",range:C,tickmode:k.tickmode,nticks:k.nticks,tick0:k.tick0,dtick:k.dtick,tickvals:k.tickvals,ticktext:k.ticktext,ticks:k.ticks,ticklen:k.ticklen,tickwidth:k.tickwidth,tickcolor:k.tickcolor,showticklabels:k.showticklabels,tickfont:k.tickfont,tickangle:k.tickangle,tickformat:k.tickformat,exponentformat:k.exponentformat,separatethousands:k.separatethousands,showexponent:k.showexponent,showtickprefix:k.showtickprefix,tickprefix:k.tickprefix,showticksuffix:k.showticksuffix,ticksuffix:k.ticksuffix,title:k.title,titlefont:k.titlefont,showline:!0,anchor:"free",position:1},et={type:"linear",_id:"y"+e},rt={letter:"y",font:A.font,noHover:!0,calendar:A.calendar};if(y(tt,et,_,rt,A),b(tt,et,_,rt),et.position=k.x+Y+H,r.axis=et,-1!==["top","bottom"].indexOf(k.titleside)&&(et.titleside=k.titleside,et.titlex=k.x+Y,et.titley=K+("top"===k.titleside?G-X:X)),k.line.color&&"auto"===k.tickmode){et.tickmode="linear",et.tick0=k.levels.start;var nt=k.levels.size,it=u.constrain((Q-$)/50,4,15)+1,at=(C[1]-C[0])/((k.nticks||it)*nt);if(at>1){var ot=Math.pow(10,Math.floor(Math.log(at)/Math.LN10));nt*=ot*u.roundUp(at/ot,[2,5,10]),(Math.abs(k.levels.start)/k.levels.size+1e-6)%1<2e-6&&(et.tick0=0)}et.dtick=nt}et.domain=[K+X,K+G-X],et.setScale();var st=A._infolayer.selectAll("g."+e).data([0]);st.enter().append("g").classed(e,!0).classed(w.colorbar,!0).each(function(){var t=n.select(this);t.append("rect").classed(w.cbbg,!0),t.append("g").classed(w.cbfills,!0),t.append("g").classed(w.cblines,!0),t.append("g").classed(w.cbaxis,!0).classed(w.crisp,!0),t.append("g").classed(w.cbtitleunshift,!0).append("g").classed(w.cbtitle,!0),t.append("rect").classed(w.cboutline,!0),t.select(".cbtitle").datum(0)}),st.attr("transform","translate("+Math.round(S.l)+","+Math.round(S.t)+")");var lt=st.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(S.l)+",-"+Math.round(S.t)+")");et._axislayer=st.select(".cbaxis");var ct=0;if(-1!==["top","bottom"].indexOf(k.titleside)){var ut,ht=S.l+(k.x+Y)*S.w,ft=et.titlefont.size;ut="top"===k.titleside?(1-(K+G-X))*S.h+S.t+3+.75*ft:(1-(K+X))*S.h+S.t-3-.25*ft,T(et._id+"title",{attributes:{x:ht,y:ut,"text-anchor":"start"}})}var dt=u.syncOrAsync([o.previousPromises,function(){if(-1!==["top","bottom"].indexOf(k.titleside)){var e=st.select(".cbtitle"),r=e.select("text"),a=[-k.outlinewidth/2,k.outlinewidth/2],o=e.select(".h"+et._id+"title-math-group").node(),s=15.6;if(r.node()&&(s=parseInt(r.node().style.fontSize,10)*v),o?(ct=d.bBox(o).height)>s&&(a[1]-=(ct-s)/2):r.node()&&!r.classed(w.jsPlaceholder)&&(ct=d.bBox(r.node()).height),ct){if(ct+=5,"top"===k.titleside)et.domain[1]-=ct/S.h,a[1]*=-1;else{et.domain[0]+=ct/S.h;var c=g.lineCount(r);a[1]+=(1-c)*s}e.attr("transform","translate("+a+")"),et.setScale()}}st.selectAll(".cbfills,.cblines").attr("transform","translate(0,"+Math.round(S.h*(1-et.domain[1]))+")"),et._axislayer.attr("transform","translate(0,"+Math.round(-S.t)+")");var h=st.select(".cbfills").selectAll("rect.cbfill").data(P);h.enter().append("rect").classed(w.cbfill,!0).style("stroke","none"),h.exit().remove(),h.each(function(t,e){var r=[0===e?C[0]:(P[e]+P[e-1])/2,e===P.length-1?C[1]:(P[e]+P[e+1])/2].map(et.c2p).map(Math.round);e!==P.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=z(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Z,width:Math.max(V,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var f=st.select(".cblines").selectAll("path.cbline").data(k.line.color&&k.line.width?I:[]);return f.enter().append("path").classed(w.cbline,!0),f.exit().remove(),f.each(function(t){n.select(this).attr("d","M"+Z+","+(Math.round(et.c2p(t))+k.line.width/2%1)+"h"+V).call(d.lineGroupStyle,k.line.width,D(t),k.line.dash)}),et._axislayer.selectAll("g."+et._id+"tick,path").remove(),et._pos=Z+V+(k.outlinewidth||0)/2-("outside"===k.ticks?1:0),et.side="right",u.syncOrAsync([function(){return l.doTicks(t,et,!0)},function(){if(-1===["top","bottom"].indexOf(k.titleside)){var e=et.titlefont.size,r=et._offset+et._length/2,i=S.l+(et.position||0)*S.w+("right"===et.side?10+e*(et.showticklabels?1:.5):-10-e*(et.showticklabels?.5:0));T("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:k.titleside,offsetLeft:S.l,offsetTop:0,maxShift:A.width},attributes:{x:i,y:r,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])},o.previousPromises,function(){var r=V+k.outlinewidth/2+d.bBox(et._axislayer.node()).width;if((N=lt.select("text")).node()&&!N.classed(w.jsPlaceholder)){var n,i=lt.select(".h"+et._id+"title-math-group").node();n=i&&-1!==["top","bottom"].indexOf(k.titleside)?d.bBox(i).width:d.bBox(lt.node()).right-Z-S.l,r=Math.max(r,n)}var a=2*k.xpad+r+k.borderwidth+k.outlinewidth/2,s=Q-$;st.select(".cbbg").attr({x:Z-k.xpad-(k.borderwidth+k.outlinewidth)/2,y:$-W,width:Math.max(a,2),height:Math.max(s+2*W,2)}).call(p.fill,k.bgcolor).call(p.stroke,k.bordercolor).style({"stroke-width":k.borderwidth}),st.selectAll(".cboutline").attr({x:Z,y:$+k.ypad+("top"===k.titleside?ct:0),width:Math.max(V,2),height:Math.max(s-2*k.ypad-ct,2)}).call(p.stroke,k.outlinecolor).style({fill:"None","stroke-width":k.outlinewidth});var l=({center:.5,right:1}[k.xanchor]||0)*a;st.attr("transform","translate("+(S.l-l)+","+S.t+")"),o.autoMargin(t,e,{x:k.x,y:k.y,l:a*({right:1,center:.5}[k.xanchor]||0),r:a*({left:1,center:.5}[k.xanchor]||0),t:s*({bottom:1,middle:.5}[k.yanchor]||0),b:s*({top:1,middle:.5}[k.yanchor]||0)})}],t);if(dt&&dt.then&&(t._promises||[]).push(dt),t._context.edits.colorbarPosition){var pt,mt,gt;c.init({element:st.node(),gd:t,prepFn:function(){pt=st.attr("transform"),f(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),mt=c.align(J+t/S.w,H,0,1,k.xanchor),gt=c.align(K-e/S.h,G,0,1,k.yanchor);var r=c.getCursor(mt,gt,k.xanchor,k.yanchor);f(st,r)},doneFn:function(){f(st),void 0!==mt&&void 0!==gt&&a.restyle(t,{"colorbar.x":mt,"colorbar.y":gt},M().index)}})}return dt}A._infolayer.selectAll("g."+e).remove()}function M(){var r,n,i=e.substr(2);for(r=0;r<t._fullData.length;r++)if((n=t._fullData[r]).uid===i)return n}var k={};return Object.keys(_).forEach(function(t){k[t]=null}),k.fillcolor=null,k.line={color:null,width:null,dash:null},k.levels={start:null,end:null,size:null},k.filllevels=null,Object.keys(k).forEach(function(t){r[t]=function(e){return arguments.length?(k[t]=u.isPlainObject(k[t])?u.extendFlat(k[t],e):e,r):k[t]}}),r.options=function(t){return Object.keys(t).forEach(function(e){"function"==typeof r[e]&&r[e](t[e])}),r},r._opts=k,r}},{"../../constants/alignment":711,"../../lib":738,"../../lib/extend":727,"../../lib/setcursor":757,"../../lib/svg_text_utils":761,"../../plotly":780,"../../plots/cartesian/axes":785,"../../plots/cartesian/axis_defaults":787,"../../plots/cartesian/layout_attributes":797,"../../plots/cartesian/position_defaults":800,"../../plots/plots":846,"../../registry":861,"../color":613,"../dragelement":635,"../drawing":638,"../titles":704,"./attributes":614,"./constants":615,d3:123,tinycolor2:543}],618:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t){return n.isPlainObject(t.colorbar)}},{"../../lib":738}],619:[function(t,e,r){"use strict";e.exports={zauto:{valType:"boolean",dflt:!0,editType:"calc",impliedEdits:{zmin:void 0,zmax:void 0}},zmin:{valType:"number",dflt:null,editType:"plot",impliedEdits:{zauto:!1}},zmax:{valType:"number",dflt:null,editType:"plot",impliedEdits:{zauto:!1}},colorscale:{valType:"colorscale",editType:"calc",impliedEdits:{autocolorscale:!1}},autocolorscale:{valType:"boolean",dflt:!0,editType:"calc",impliedEdits:{colorscale:void 0}},reversescale:{valType:"boolean",dflt:!1,editType:"calc"},showscale:{valType:"boolean",dflt:!0,editType:"calc"}}},{}],620:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./scales"),a=t("./flip_scale");e.exports=function(t,e,r,o){var s,l;r?(s=n.nestedProperty(t,r).get(),l=n.nestedProperty(t._input,r).get()):(s=t,l=t._input);var c=o+"auto",u=o+"min",h=o+"max",f=s[c],d=s[u],p=s[h],m=s.colorscale;!1===f&&void 0!==d||(d=n.aggNums(Math.min,null,e)),!1===f&&void 0!==p||(p=n.aggNums(Math.max,null,e)),d===p&&(d-=.5,p+=.5),s[u]=d,s[h]=p,l[u]=d,l[h]=p,l[c]=!1!==f||void 0===d&&void 0===p,s.autocolorscale&&(m=d*p<0?i.RdBu:d>=0?i.Reds:i.Blues,l.colorscale=m,s.reversescale&&(m=a(m)),s.colorscale=m)}},{"../../lib":738,"./flip_scale":625,"./scales":632}],621:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../lib/extend").extendFlat;t("./scales.js");e.exports=function(t,e,r){return{color:{valType:"color",arrayOk:!0,editType:e||"style"},colorscale:i({},n.colorscale,{}),cauto:i({},n.zauto,{impliedEdits:{cmin:void 0,cmax:void 0}}),cmax:i({},n.zmax,{editType:e||n.zmax.editType,impliedEdits:{cauto:!1}}),cmin:i({},n.zmin,{editType:e||n.zmin.editType,impliedEdits:{cauto:!1}}),autocolorscale:i({},n.autocolorscale,{dflt:!1===r?r:n.autocolorscale.dflt}),reversescale:i({},n.reversescale,{})}}},{"../../lib/extend":727,"./attributes":619,"./scales.js":632}],622:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":632}],623:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../colorbar/has_colorbar"),o=t("../colorbar/defaults"),s=t("./is_valid_scale"),l=t("./flip_scale");e.exports=function(t,e,r,c,u){var h=u.prefix,f=u.cLetter,d=h.slice(0,h.length-1),p=h?i.nestedProperty(t,d).get()||{}:t,m=h?i.nestedProperty(e,d).get()||{}:e,g=p[f+"min"],v=p[f+"max"],y=p.colorscale;c(h+f+"auto",!(n(g)&&n(v)&&g<v)),c(h+f+"min"),c(h+f+"max");var b;void 0!==y&&(b=!s(y)),c(h+"autocolorscale",b);var x=c(h+"colorscale");if(c(h+"reversescale")&&(m.colorscale=l(x)),"marker.line."!==h){var _;h&&(_=a(p));c(h+"showscale",_)&&o(p,m,r)}}},{"../../lib":738,"../colorbar/defaults":616,"../colorbar/has_colorbar":618,"./flip_scale":625,"./is_valid_scale":629,"fast-isnumeric":132}],624:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n=t.length,i=new Array(n),a=new Array(n),o=0;o<n;o++){var s=t[o];i[o]=e+s[0]*(r-e),a[o]=s[1]}return{domain:i,range:a}}},{}],625:[function(t,e,r){"use strict";e.exports=function(t){for(var e,r=t.length,n=new Array(r),i=r-1,a=0;i>=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],626:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./default_scale"),a=t("./is_valid_scale_array");e.exports=function(t,e){function r(){try{t=n[t]||JSON.parse(t)}catch(r){t=e}}return e||(e=i),t?("string"==typeof t&&(r(),"string"==typeof t&&r()),a(t)?t:e):e}},{"./default_scale":622,"./is_valid_scale_array":630,"./scales":632}],627:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("./is_valid_scale");e.exports=function(t,e){var r=e?i.nestedProperty(t,e).get()||{}:t,o=r.color,s=!1;if(Array.isArray(o))for(var l=0;l<o.length;l++)if(n(o[l])){s=!0;break}return i.isPlainObject(r)&&(s||!0===r.showscale||n(r.cmin)&&n(r.cmax)||a(r.colorscale)||i.isPlainObject(r.colorbar))}},{"../../lib":738,"./is_valid_scale":629,"fast-isnumeric":132}],628:[function(t,e,r){"use strict";r.scales=t("./scales"),r.defaultScale=t("./default_scale"),r.attributes=t("./attributes"),r.handleDefaults=t("./defaults"),r.calc=t("./calc"),r.hasColorscale=t("./has_colorscale"),r.isValidScale=t("./is_valid_scale"),r.getScale=t("./get_scale"),r.flipScale=t("./flip_scale"),r.extractScale=t("./extract_scale"),r.makeColorScaleFunc=t("./make_color_scale_func")},{"./attributes":619,"./calc":620,"./default_scale":622,"./defaults":623,"./extract_scale":624,"./flip_scale":625,"./get_scale":626,"./has_colorscale":627,"./is_valid_scale":629,"./make_color_scale_func":631,"./scales":632}],629:[function(t,e,r){"use strict";var n=t("./scales"),i=t("./is_valid_scale_array");e.exports=function(t){return void 0!==n[t]||i(t)}},{"./is_valid_scale_array":630,"./scales":632}],630:[function(t,e,r){"use strict";var n=t("tinycolor2");e.exports=function(t){var e=0;if(!Array.isArray(t)||t.length<2)return!1;if(!t[0]||!t[t.length-1])return!1;if(0!=+t[0][0]||1!=+t[t.length-1][0])return!1;for(var r=0;r<t.length;r++){var i=t[r];if(2!==i.length||+i[0]<e||!n(i[1]).isValid())return!1;e=+i[0]}return!0}},{tinycolor2:543}],631:[function(t,e,r){"use strict";function n(t){var e={r:t[0],g:t[1],b:t[2],a:t[3]};return a(e).toRgbString()}var i=t("d3"),a=t("tinycolor2"),o=t("fast-isnumeric"),s=t("../color");e.exports=function(t,e){e=e||{};for(var r=t.domain,l=t.range,c=l.length,u=new Array(c),h=0;h<c;h++){var f=a(l[h]).toRgb();u[h]=[f.r,f.g,f.b,f.a]}var d,p=i.scale.linear().domain(r).range(u).clamp(!0),m=e.noNumericCheck,g=e.returnArray;return d=m&&g?p:m?function(t){return n(p(t))}:g?function(t){return o(t)?p(t):a(t).isValid()?t:s.defaultLine}:function(t){return o(t)?n(p(t)):a(t).isValid()?t:s.defaultLine},d.domain=p.domain,d.range=function(){return l},d}},{"../color":613,d3:123,"fast-isnumeric":132,tinycolor2:543}],632:[function(t,e,r){"use strict";e.exports={Greys:[[0,"rgb(0,0,0)"],[1,"rgb(255,255,255)"]],YlGnBu:[[0,"rgb(8,29,88)"],[.125,"rgb(37,52,148)"],[.25,"rgb(34,94,168)"],[.375,"rgb(29,145,192)"],[.5,"rgb(65,182,196)"],[.625,"rgb(127,205,187)"],[.75,"rgb(199,233,180)"],[.875,"rgb(237,248,217)"],[1,"rgb(255,255,217)"]],Greens:[[0,"rgb(0,68,27)"],[.125,"rgb(0,109,44)"],[.25,"rgb(35,139,69)"],[.375,"rgb(65,171,93)"],[.5,"rgb(116,196,118)"],[.625,"rgb(161,217,155)"],[.75,"rgb(199,233,192)"],[.875,"rgb(229,245,224)"],[1,"rgb(247,252,245)"]],YlOrRd:[[0,"rgb(128,0,38)"],[.125,"rgb(189,0,38)"],[.25,"rgb(227,26,28)"],[.375,"rgb(252,78,42)"],[.5,"rgb(253,141,60)"],[.625,"rgb(254,178,76)"],[.75,"rgb(254,217,118)"],[.875,"rgb(255,237,160)"],[1,"rgb(255,255,204)"]],Bluered:[[0,"rgb(0,0,255)"],[1,"rgb(255,0,0)"]],RdBu:[[0,"rgb(5,10,172)"],[.35,"rgb(106,137,247)"],[.5,"rgb(190,190,190)"],[.6,"rgb(220,170,132)"],[.7,"rgb(230,145,90)"],[1,"rgb(178,10,28)"]],Reds:[[0,"rgb(220,220,220)"],[.2,"rgb(245,195,157)"],[.4,"rgb(245,160,105)"],[1,"rgb(178,10,28)"]],Blues:[[0,"rgb(5,10,172)"],[.35,"rgb(40,60,190)"],[.5,"rgb(70,100,245)"],[.6,"rgb(90,120,245)"],[.7,"rgb(106,137,247)"],[1,"rgb(220,220,220)"]],Picnic:[[0,"rgb(0,0,255)"],[.1,"rgb(51,153,255)"],[.2,"rgb(102,204,255)"],[.3,"rgb(153,204,255)"],[.4,"rgb(204,204,255)"],[.5,"rgb(255,255,255)"],[.6,"rgb(255,204,255)"],[.7,"rgb(255,153,255)"],[.8,"rgb(255,102,204)"],[.9,"rgb(255,102,102)"],[1,"rgb(255,0,0)"]],Rainbow:[[0,"rgb(150,0,90)"],[.125,"rgb(0,0,200)"],[.25,"rgb(0,25,255)"],[.375,"rgb(0,152,255)"],[.5,"rgb(44,255,150)"],[.625,"rgb(151,255,0)"],[.75,"rgb(255,234,0)"],[.875,"rgb(255,111,0)"],[1,"rgb(255,0,0)"]],Portland:[[0,"rgb(12,51,131)"],[.25,"rgb(10,136,186)"],[.5,"rgb(242,211,56)"],[.75,"rgb(242,143,56)"],[1,"rgb(217,30,30)"]],Jet:[[0,"rgb(0,0,131)"],[.125,"rgb(0,60,170)"],[.375,"rgb(5,255,255)"],[.625,"rgb(255,255,0)"],[.875,"rgb(250,0,0)"],[1,"rgb(128,0,0)"]],Hot:[[0,"rgb(0,0,0)"],[.3,"rgb(230,0,0)"],[.6,"rgb(255,210,0)"],[1,"rgb(255,255,255)"]],Blackbody:[[0,"rgb(0,0,0)"],[.2,"rgb(230,0,0)"],[.4,"rgb(230,210,0)"],[.7,"rgb(255,255,255)"],[1,"rgb(160,200,255)"]],Earth:[[0,"rgb(0,0,130)"],[.1,"rgb(0,180,180)"],[.2,"rgb(40,210,40)"],[.4,"rgb(230,230,50)"],[.6,"rgb(120,70,20)"],[1,"rgb(255,255,255)"]],Electric:[[0,"rgb(0,0,0)"],[.15,"rgb(30,0,100)"],[.4,"rgb(120,0,100)"],[.6,"rgb(160,90,0)"],[.8,"rgb(230,200,0)"],[1,"rgb(255,250,220)"]],Viridis:[[0,"#440154"],[.06274509803921569,"#48186a"],[.12549019607843137,"#472d7b"],[.18823529411764706,"#424086"],[.25098039215686274,"#3b528b"],[.3137254901960784,"#33638d"],[.3764705882352941,"#2c728e"],[.4392156862745098,"#26828e"],[.5019607843137255,"#21918c"],[.5647058823529412,"#1fa088"],[.6274509803921569,"#28ae80"],[.6901960784313725,"#3fbc73"],[.7529411764705882,"#5ec962"],[.8156862745098039,"#84d44b"],[.8784313725490196,"#addc30"],[.9411764705882353,"#d8e219"],[1,"#fde725"]],Cividis:[[0,"rgb(0,32,76)"],[.058824,"rgb(0,42,102)"],[.117647,"rgb(0,52,110)"],[.176471,"rgb(39,63,108)"],[.235294,"rgb(60,74,107)"],[.294118,"rgb(76,85,107)"],[.352941,"rgb(91,95,109)"],[.411765,"rgb(104,106,112)"],[.470588,"rgb(117,117,117)"],[.529412,"rgb(131,129,120)"],[.588235,"rgb(146,140,120)"],[.647059,"rgb(161,152,118)"],[.705882,"rgb(176,165,114)"],[.764706,"rgb(192,177,109)"],[.823529,"rgb(209,191,102)"],[.882353,"rgb(225,204,92)"],[.941176,"rgb(243,219,79)"],[1,"rgb(255,233,69)"]]}},{}],633:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var a=(t-r)/(n-r),o=a+e/(n-r),s=(a+o)/2;return"left"===i||"bottom"===i?a:"center"===i||"middle"===i?s:"right"===i||"top"===i?o:a<2/3-s?a:o>4/3-s?o:s}},{}],634:[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":738}],635:[function(t,e,r){"use strict";function n(){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 i(t){return a(t.changedTouches?t.changedTouches[0]:t,document.body)}var a=t("mouse-event-offset"),o=t("has-hover"),s=t("../../plotly"),l=t("../../lib"),c=t("../../plots/cartesian/constants"),u=t("../../constants/interactions"),h=e.exports={};h.align=t("./align"),h.getCursor=t("./cursor");var f=t("./unhover");h.unhover=f.wrapped,h.unhoverRaw=f.raw,h.init=function(t){function e(e){x._dragged=!1,x._dragging=!0;var s=i(e);return f=s[0],d=s[1],y=e.target,v=e,b=e.buttons&&2===e.buttons||e.ctrlKey,(p=(new Date).getTime())-x._mouseDownTime<w?_+=1:(_=1,x._mouseDownTime=p),t.prepFn&&t.prepFn(e,f,d),o&&!b?(g=n()).style.cursor=window.getComputedStyle(M).cursor:o||(g=document,m=window.getComputedStyle(document.documentElement).cursor,document.documentElement.style.cursor=window.getComputedStyle(M).cursor),document.addEventListener("mousemove",r),document.addEventListener("mouseup",a),document.addEventListener("touchmove",r),document.addEventListener("touchend",a),l.pauseEvent(e)}function r(e){var r=i(e),n=r[0]-f,a=r[1]-d,o=t.minDrag||c.MINDRAG;return Math.abs(n)<o&&(n=0),Math.abs(a)<o&&(a=0),(n||a)&&(x._dragged=!0,h.unhover(x)),x._dragged&&t.moveFn&&!b&&t.moveFn(n,a),l.pauseEvent(e)}function a(e){if(document.removeEventListener("mousemove",r),document.removeEventListener("mouseup",a),document.removeEventListener("touchmove",r),document.removeEventListener("touchend",a),o?l.removeElement(g):m&&(g.documentElement.style.cursor=m,m=null),x._dragging){if(x._dragging=!1,(new Date).getTime()-x._mouseDownTime>w&&(_=Math.max(_-1,1)),x._dragged)t.doneFn&&t.doneFn(e);else if(t.clickFn&&t.clickFn(_,v),!b){var n;try{n=new MouseEvent("click",e)}catch(t){var c=i(e);(n=document.createEvent("MouseEvents")).initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,c[0],c[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}y.dispatchEvent(n)}return function(t){t._dragging=!1,t._replotPending&&s.plot(t)}(x),x._dragged=!1,l.pauseEvent(e)}x._dragged=!1}var f,d,p,m,g,v,y,b,x=t.gd,_=1,w=u.DBLCLICKDELAY,M=t.element;x._mouseDownTime||(x._mouseDownTime=0),M.style.pointerEvents="all",M.onmousedown=e,M.ontouchstart=e},h.coverSlip=n},{"../../constants/interactions":716,"../../lib":738,"../../plotly":780,"../../plots/cartesian/constants":790,"./align":633,"./cursor":634,"./unhover":636,"has-hover":289,"mouse-event-offset":454}],636:[function(t,e,r){"use strict";var n=t("../../lib/events"),i=t("../../lib/throttle"),a=t("../../lib/get_graph_div"),o=t("../fx/constants"),s=e.exports={};s.wrapped=function(t,e,r){t=a(t),i.clear(t._fullLayout._uid+o.HOVERID),s.raw(t,e,r)},s.raw=function(t,e){var r=t._fullLayout,i=t._hoverdata;e||(e={}),e.target&&!1===n.triggerHandler(t,"plotly_beforehover",e)||(r._hoverlayer.selectAll("g").remove(),r._hoverlayer.selectAll("line").remove(),r._hoverlayer.selectAll("circle").remove(),t._hoverdata=void 0,e.target&&i&&t.emit("plotly_unhover",{event:e,points:i}))}},{"../../lib/events":726,"../../lib/get_graph_div":733,"../../lib/throttle":762,"../fx/constants":650}],637:[function(t,e,r){"use strict";r.dash={valType:"string",values:["solid","dot","dash","longdash","dashdot","longdashdot"],dflt:"solid",editType:"style"}},{}],638:[function(t,e,r){"use strict";function n(t,e){var r=t%100;return _.symbolFuncs[r](e)+(t>=200?k:"")}function i(t,e,r,n){var i=l.select(t.node().parentNode),a=-1!==e.indexOf("top")?"top":-1!==e.indexOf("bottom")?"bottom":"middle",o=-1!==e.indexOf("left")?"end":-1!==e.indexOf("right")?"start":"middle",s=n?n/.8+1:0,c=(m.lineCount(t)-1)*v+1,u=S[o]*s,h=.75*r+S[a]*s+(S[a]-1)*c*r/2;t.attr("text-anchor",o),i.attr("transform","translate("+u+","+h+")")}function a(t,e){var r=t.ts||e.textfont.size;return c(r)&&r>0?r:0}function o(t,e,r,n){var i=t[0]-e[0],a=t[1]-e[1],o=r[0]-e[0],s=r[1]-e[1],c=Math.pow(i*i+a*a,E/2),u=Math.pow(o*o+s*s,E/2),h=(u*u*i-c*c*o)*n,f=(u*u*a-c*c*s)*n,d=3*u*(c+u),p=3*c*(c+u);return[[l.round(e[0]+(d&&h/d),2),l.round(e[1]+(d&&f/d),2)],[l.round(e[0]-(p&&h/p),2),l.round(e[1]-(p&&f/p),2)]]}function s(t){var e=t.getAttribute("data-unformatted");if(null!==e)return e+t.getAttribute("data-math")+t.getAttribute("text-anchor")+t.getAttribute("style")}var l=t("d3"),c=t("fast-isnumeric"),u=t("tinycolor2"),h=t("../../registry"),f=t("../color"),d=t("../colorscale"),p=t("../../lib"),m=t("../../lib/svg_text_utils"),g=t("../../constants/xmlns_namespaces"),v=t("../../constants/alignment").LINE_SPACING,y=t("../../constants/interactions").DESELECTDIM,b=t("../../traces/scatter/subtypes"),x=t("../../traces/scatter/make_bubble_size_func"),_=e.exports={};_.font=function(t,e,r,n){p.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(f.fill,n)},_.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},_.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},_.setRect=function(t,e,r,n,i){t.call(_.setPosition,e,r).call(_.setSize,n,i)},_.translatePoint=function(t,e,r,n){var i=r.c2p(t.x),a=n.c2p(t.y);return!!(c(i)&&c(a)&&e.node())&&("text"===e.node().nodeName?e.attr("x",i).attr("y",a):e.attr("transform","translate("+i+","+a+")"),!0)},_.translatePoints=function(t,e,r){t.each(function(t){var n=l.select(this);_.translatePoint(t,n,e,r)})},_.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},_.hideOutsideRangePoints=function(t,e){if(e._hasClipOnAxisFalse){var r=e.xaxis,n=e.yaxis;t.each(function(e){var i=e[0].trace,a=i.xcalendar,o=i.ycalendar;t.selectAll(".point,.textpoint").each(function(t){_.hideOutsideRangePoint(t,l.select(this),r,n,a,o)})})}},_.crispRound=function(t,e,r){return e&&c(e)?t._context.staticPlot?e:e<1?1:Math.round(e):r||0},_.singleLineStyle=function(t,e,r,n,i){e.style("fill","none");var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";f.stroke(e,n||a.color),_.dashLine(e,s,o)},_.lineGroupStyle=function(t,e,r,n){t.style("fill","none").each(function(t){var i=(((t||[])[0]||{}).trace||{}).line||{},a=e||i.width||0,o=n||i.dash||"";l.select(this).call(f.stroke,r||i.color).call(_.dashLine,o,a)})},_.dashLine=function(t,e,r){r=+r||0,e=_.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},_.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},_.singleFillStyle=function(t){var e=(((l.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;e&&t.call(f.fill,e)},_.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=l.select(this);try{r.call(f.fill,e[0].trace.fillcolor)}catch(e){p.error(e,t),r.remove()}})};var w=t("./symbol_defs");_.symbolNames=[],_.symbolFuncs=[],_.symbolNeedLines={},_.symbolNoDot={},_.symbolList=[],Object.keys(w).forEach(function(t){var e=w[t];_.symbolList=_.symbolList.concat([e.n,t,e.n+100,t+"-open"]),_.symbolNames[e.n]=t,_.symbolFuncs[e.n]=e.f,e.needLine&&(_.symbolNeedLines[e.n]=!0),e.noDot?_.symbolNoDot[e.n]=!0:_.symbolList=_.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"])});var M=_.symbolNames.length,k="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";_.symbolNumber=function(t){if("string"==typeof t){var e=0;t.indexOf("-open")>0&&(e=100,t=t.replace("-open","")),t.indexOf("-dot")>0&&(e+=200,t=t.replace("-dot","")),(t=_.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=M||t>=400?0:Math.floor(Math.max(t,0))};var T={x1:1,x2:0,y1:0,y2:0},A={x1:0,x2:0,y1:1,y2:0};_.gradient=function(t,e,r,n,i,a){var o=e._fullLayout._defs.select(".gradients").selectAll("#"+r).data([n+i+a],p.identity);o.exit().remove(),o.enter().append("radial"===n?"radialGradient":"linearGradient").each(function(){var t=l.select(this);"horizontal"===n?t.attr(T):"vertical"===n&&t.attr(A),t.attr("id",r);var e=u(i),o=u(a);t.append("stop").attr({offset:"0%","stop-color":f.tinyRGB(o),"stop-opacity":o.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":f.tinyRGB(e),"stop-opacity":e.getAlpha()})}),t.style({fill:"url(#"+r+")","fill-opacity":null})},_.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},_.singlePointStyle=function(t,e,r,i,a,o){var s=r.marker;!function(t,e,r,i,a,o,s,l){if(h.traceIs(r,"symbols")){var c=x(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:b.isBubble(r)?c(t.ms):(o.size||6)/2,t.mrc=e;var i=_.symbolNumber(t.mx||o.symbol)||0;return t.om=i%200>=100,n(i,e)})}e.style("opacity",function(t){return(t.mo+1||o.opacity+1)-1});var u,d,p,m=!1;if(t.so?(p=s.outlierwidth,d=s.outliercolor,u=o.outliercolor):(p=(t.mlw+1||s.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,d="mlc"in t?t.mlcc=a(t.mlc):Array.isArray(s.color)?f.defaultLine:s.color,Array.isArray(o.color)&&(u=f.defaultLine,m=!0),u="mc"in t?t.mcc=i(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(f.stroke,u).style({"stroke-width":(p||1)+"px",fill:"none"});else{e.style("stroke-width",p+"px");var g=o.gradient,v=t.mgt;if(v?m=!0:v=g&&g.type,v&&"none"!==v){var y=t.mgc;y?m=!0:y=g.color;var w="g"+l._fullLayout._uid+"-"+r.uid;m&&(w+="-"+t.i),e.call(_.gradient,l,w,v,u,y)}else e.call(f.fill,u);p&&e.call(f.stroke,d)}}(t,e,r,i,a,s,s.line,o)},_.pointStyle=function(t,e,r){if(t.size()){var n=e.marker,i=_.tryColorscale(n,""),a=_.tryColorscale(n,"line");t.each(function(t){_.singlePointStyle(t,l.select(this),e,i,a,r)})}},_.selectedPointStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=e.selected||{},i=e.unselected||{},a=e.marker||{},o=r.marker||{},s=i.marker||{},c=a.opacity,u=o.opacity,d=s.opacity,p=void 0!==u,m=void 0!==d;t.each(function(t){var e,r=l.select(this),n=t.mo,i=void 0!==n;(i||p||m)&&(t.selected?p&&(e=u):e=m?d:y*(i?n:c)),void 0!==e&&r.style("opacity",e)});var g=o.color,v=s.color;(g||v)&&t.each(function(t){var e,r=l.select(this);t.selected?g&&(e=g):v&&(e=v),e&&f.fill(r,e)});var b=o.size,x=s.size,w=void 0!==b,M=void 0!==x;h.traceIs(e,"symbols")&&(w||M)&&t.each(function(t){var e,r=l.select(this),i=t.mrc,o=t.mx||a.symbol||0;e=t.selected?w?b/2:i:M?x/2:i,r.attr("d",n(_.symbolNumber(o),e)),t.mrc2=e})}},_.tryColorscale=function(t,e){var r=e?p.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&Array.isArray(i)?d.makeColorScaleFunc(d.extractScale(n,r.cmin,r.cmax)):p.identity};var S={start:1,end:-1,middle:0,bottom:1,top:-1};_.textPointStyle=function(t,e,r){t.each(function(t){var n=l.select(this),o=p.extractOption(t,e,"tx","text");if(o){var s=t.tp||e.textposition,c=a(t,e);n.call(_.font,t.tf||e.textfont.family,c,t.tc||e.textfont.color).text(o).call(m.convertToTspans,r).call(i,s,c,t.mrc)}else n.remove()})},_.selectedTextStyle=function(t,e){if(t.size()&&e.selectedpoints){var r=e.selected||{},n=e.unselected||{};t.each(function(t){var o,s=l.select(this),c=t.tc||e.textfont.color,u=t.tp||e.textposition,h=a(t,e),d=(r.textfont||{}).color,p=(n.textfont||{}).color;t.selected?d&&(o=d):p?o=p:d||(o=f.addOpacity(c,y)),o&&f.fill(s,o),i(s,u,h,t.mrc2||t.mrc)})}};var E=.5;_.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r<t.length-1;r++)i.push(o(t[r-1],t[r],t[r+1],e));for(n+="Q"+i[0][0]+" "+t[1],r=2;r<t.length-1;r++)n+="C"+i[r-2][1]+" "+i[r-1][0]+" "+t[r];return n+="Q"+i[t.length-3][1]+" "+t[t.length-1]},_.smoothclosed=function(t,e){if(t.length<3)return"M"+t.join("L")+"Z";var r,n="M"+t[0],i=t.length-1,a=[o(t[i],t[0],t[1],e)];for(r=1;r<i;r++)a.push(o(t[r-1],t[r],t[r+1],e));for(a.push(o(t[i-1],t[i],t[0],e)),r=1;r<=i;r++)n+="C"+a[r-1][1]+" "+a[r][0]+" "+t[r];return n+="C"+a[i][1]+" "+a[0][0]+" "+t[0]+"Z"};var L={hv:function(t,e){return"H"+l.round(e[0],2)+"V"+l.round(e[1],2)},vh:function(t,e){return"V"+l.round(e[1],2)+"H"+l.round(e[0],2)},hvh:function(t,e){return"H"+l.round((t[0]+e[0])/2,2)+"V"+l.round(e[1],2)+"H"+l.round(e[0],2)},vhv:function(t,e){return"V"+l.round((t[1]+e[1])/2,2)+"H"+l.round(e[0],2)+"V"+l.round(e[1],2)}};_.steps=function(t){var e=L[t]||function(t,e){return"L"+l.round(e[0],2)+","+l.round(e[1],2)};return function(t){for(var r="M"+l.round(t[0][0],2)+","+l.round(t[0][1],2),n=1;n<t.length;n++)r+=e(t[n-1],t[n]);return r}},_.makeTester=function(){var t=l.select("body").selectAll("#js-plotly-tester").data([0]);t.enter().append("svg").attr("id","js-plotly-tester").attr(g.svgAttrs).style({position:"absolute",left:"-10000px",top:"-10000px",width:"9000px",height:"9000px","z-index":"1"});var e=t.selectAll(".js-reference-point").data([0]);e.enter().append("path").classed("js-reference-point",!0).attr("d","M0,0H1V1H0Z").style({"stroke-width":0,fill:"black"}),_.tester=t,_.testref=e},_.savedBBoxes={};var C=0;_.bBox=function(t,e,r){r||(r=s(t));var n;if(r){if(n=_.savedBBoxes[r])return p.extendFlat({},n)}else if(1===t.childNodes.length){var i=t.childNodes[0];if(r=s(i)){var a=+i.getAttribute("x")||0,o=+i.getAttribute("y")||0,c=i.getAttribute("transform");if(!c){var u=_.bBox(i,!1,r);return a&&(u.left+=a,u.right+=a),o&&(u.top+=o,u.bottom+=o),u}if(r+="~"+a+"~"+o+"~"+c,n=_.savedBBoxes[r])return p.extendFlat({},n)}}var h,f;e?h=t:(f=_.tester.node(),h=t.cloneNode(!0),f.appendChild(h)),l.select(h).attr("transform",null).call(m.positionText,0,0);var d=h.getBoundingClientRect(),g=_.testref.node().getBoundingClientRect();e||f.removeChild(h);var v={height:d.height,width:d.width,left:d.left-g.left,top:d.top-g.top,right:d.right-g.left,bottom:d.bottom-g.top};return C>=1e4&&(_.savedBBoxes={},C=0),r&&(_.savedBBoxes[r]=v),C++,p.extendFlat({},v)},_.setClipUrl=function(t,e){if(e){var r="#"+e,n=l.select("base");n.size()&&n.attr("href")&&(r=window.location.href.split("#")[0]+r),t.attr("clip-path","url("+r+")")}else t.attr("clip-path",null)},_.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}},_.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+=" translate("+e+", "+r+")",a=a.trim(),t[i]("transform",a),a},_.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}},_.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+=" scale("+e+", "+r+")",a=a.trim(),t[i]("transform",a),a},_.setPointGroupScale=function(t,e,r){var n,i,a;return e=e||1,r=r||1,i=1===e&&1===r?"":" scale("+e+","+r+")",a=/\s*sc.*/,t.each(function(){n=(this.getAttribute("transform")||"").replace(a,""),n=(n+=i).trim(),this.setAttribute("transform",n)}),i};var I=/translate\([^)]*\)\s*$/;_.setTextPointsScale=function(t,e,r){t.each(function(){var t,n=l.select(this),i=n.select("text");if(i.node()){var a=parseFloat(i.attr("x")||0),o=parseFloat(i.attr("y")||0),s=(n.attr("transform")||"").match(I);t=1===e&&1===r?[]:["translate("+a+","+o+")","scale("+e+","+r+")","translate("+-a+","+-o+")"],s&&t.push(s),n.attr("transform",t.join(" "))}})}},{"../../constants/alignment":711,"../../constants/interactions":716,"../../constants/xmlns_namespaces":719,"../../lib":738,"../../lib/svg_text_utils":761,"../../registry":861,"../../traces/scatter/make_bubble_size_func":1071,"../../traces/scatter/subtypes":1076,"../color":613,"../colorscale":628,"./symbol_defs":639,d3:123,"fast-isnumeric":132,tinycolor2:543}],639:[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},"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},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},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},"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},"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},"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},"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},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!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},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!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}}},{d3:123}],640:[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"}}}},{}],641:[function(t,e,r){"use strict";function n(t,e,r,n){var a=e["error_"+n]||{},l=[];if(a.visible&&-1!==["linear","log"].indexOf(r.type)){for(var c=s(a),u=0;u<t.length;u++){var h=t[u],f=h[n];if(i(r.c2l(f))){var d=c(f,u);if(i(d[0])&&i(d[1])){var p=h[n+"s"]=f-d[0],m=h[n+"h"]=f+d[1];l.push(p,m)}}}o.expand(r,l,{padded:!0})}}var i=t("fast-isnumeric"),a=t("../../registry"),o=t("../../plots/cartesian/axes"),s=t("./compute_error");e.exports=function(t){for(var e=t.calcdata,r=0;r<e.length;r++){var i=e[r],s=i[0].trace;if(a.traceIs(s,"errorBarsOK")){var l=o.getFromId(t,s.xaxis),c=o.getFromId(t,s.yaxis);n(i,s,l,"x"),n(i,s,c,"y")}}}},{"../../plots/cartesian/axes":785,"../../registry":861,"./compute_error":642,"fast-isnumeric":132}],642:[function(t,e,r){"use strict";function n(t,e){return"percent"===t?function(t){return Math.abs(t*e/100)}:"constant"===t?function(){return Math.abs(e)}:"sqrt"===t?function(t){return Math.sqrt(Math.abs(t))}:void 0}e.exports=function(t){var e=t.type,r=t.symmetric;if("data"===e){var i=t.array,a=t.arrayminus;return r||void 0===a?function(t,e){var r=+i[e];return[r,r]}:function(t,e){return[+a[e],+i[e]]}}var o=n(e,t.value),s=n(e,t.valueminus);return r||void 0===t.valueminus?function(t){var e=o(t);return[e,e]}:function(t){return[s(t),o(t)]}}},{}],643:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../registry"),a=t("../../lib"),o=t("./attributes");e.exports=function(t,e,r,s){function l(t,e){return a.coerce(h,u,o,t,e)}var c="error_"+s.axis,u=e[c]={},h=t[c]||{};if(!1!==l("visible",void 0!==h.array||void 0!==h.value||"sqrt"===h.type)){var f=l("type","array"in h?"data":"percent"),d=!0;if("sqrt"!==f&&(d=l("symmetric",!(("data"===f?"arrayminus":"valueminus")in h))),"data"===f){if(l("array")||(u.array=[]),l("traceref"),!d){l("arrayminus")||(u.arrayminus=[]),l("tracerefminus")}}else"percent"!==f&&"constant"!==f||(l("value"),d||l("valueminus"));var p="copy_"+s.inherit+"style";if(s.inherit){(e["error_"+s.inherit]||{}).visible&&l(p,!(h.color||n(h.thickness)||n(h.width)))}s.inherit&&u[p]||(l("color",r),l("thickness"),l("width",i.traceIs(e,"gl3d")?0:4))}}},{"../../lib":738,"../../registry":861,"./attributes":640,"fast-isnumeric":132}],644:[function(t,e,r){"use strict";var n=e.exports={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.calcFromTrace=function(t,e){for(var r=t.x||[],i=t.y||[],a=r.length||i.length,o=new Array(a),s=0;s<a;s++)o[s]={x:r[s],y:i[s]};return o[0].trace=t,n.calc({calcdata:[o],_fullLayout:e}),o},n.plot=t("./plot"),n.style=t("./style"),n.hoverInfo=function(t,e,r){(e.error_y||{}).visible&&(r.yerr=t.yh-t.y,e.error_y.symmetric||(r.yerrneg=t.y-t.ys)),(e.error_x||{}).visible&&(r.xerr=t.xh-t.x,e.error_x.symmetric||(r.xerrneg=t.x-t.xs))}},{"./attributes":640,"./calc":641,"./defaults":643,"./plot":645,"./style":646}],645:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../drawing"),o=t("../../traces/scatter/subtypes");e.exports=function(t,e,r){var s=e.xaxis,l=e.yaxis,c=r&&r.duration>0;t.each(function(t){var u,h=t[0].trace,f=h.error_x||{},d=h.error_y||{};h.ids&&(u=function(t){return t.id});var p=o.hasMarkers(h)&&h.marker.maxdisplayed>0;d.visible||f.visible||(t=[]);var m=n.select(this).selectAll("g.errorbar").data(t,u);if(m.exit().remove(),t.length){f.visible||m.selectAll("path.xerror").remove(),d.visible||m.selectAll("path.yerror").remove(),m.style("opacity",1);var g=m.enter().append("g").classed("errorbar",!0);c&&g.style("opacity",0).transition().duration(r.duration).style("opacity",1),a.setClipUrl(m,e.layerClipId),m.each(function(t){var e=n.select(this),a=function(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};return 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))),n}(t,s,l);if(!p||t.vis){var o;if(d.visible&&i(a.x)&&i(a.yh)&&i(a.ys)){var u=d.width;o="M"+(a.x-u)+","+a.yh+"h"+2*u+"m-"+u+",0V"+a.ys,a.noYS||(o+="m-"+u+",0h"+2*u);var h=e.select("path.yerror");!h.size()?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):c&&(h=h.transition().duration(r.duration).ease(r.easing)),h.attr("d",o)}if(f.visible&&i(a.y)&&i(a.xh)&&i(a.xs)){var m=(f.copy_ystyle?d:f).width;o="M"+a.xh+","+(a.y-m)+"v"+2*m+"m0,-"+m+"H"+a.xs,a.noXS||(o+="m0,-"+m+"v"+2*m);var g=e.select("path.xerror");!g.size()?g=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):c&&(g=g.transition().duration(r.duration).ease(r.easing)),g.attr("d",o)}}})}})}},{"../../traces/scatter/subtypes":1076,"../drawing":638,d3:123,"fast-isnumeric":132}],646:[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":613,d3:123}],647:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes");e.exports={hoverlabel:{bgcolor:{valType:"color",arrayOk:!0,editType:"none"},bordercolor:{valType:"color",arrayOk:!0,editType:"none"},font:n({arrayOk:!0,editType:"none"}),namelength:{valType:"integer",min:-1,arrayOk:!0,editType:"none"},editType:"calc"}}},{"../../plots/font_attributes":810}],648:[function(t,e,r){"use strict";function n(t,e,r,n){n=n||i.identity,Array.isArray(t)&&(e[0][r]=n(t))}var i=t("../../lib"),a=t("../../registry");e.exports=function(t){function e(t){return function(e){return i.coerceHoverinfo({hoverinfo:e},{_module:t._module},o)}}for(var r=t.calcdata,o=t._fullLayout,s=0;s<r.length;s++){var l=r[s],c=l[0].trace;if(!a.traceIs(c,"pie")){var u=a.traceIs(c,"2dMap")?n:i.fillArray;u(c.hoverinfo,l,"hi",e(c)),c.hoverlabel&&(u(c.hoverlabel.bgcolor,l,"hbg"),u(c.hoverlabel.bordercolor,l,"hbc"),u(c.hoverlabel.font.size,l,"hts"),u(c.hoverlabel.font.color,l,"htc"),u(c.hoverlabel.font.family,l,"htf"),u(c.hoverlabel.namelength,l,"hnl"))}}}},{"../../lib":738,"../../registry":861}],649:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./hover").hover;e.exports=function(t,e,r){function a(){t.emit("plotly_click",{points:t._hoverdata,event:e})}var o=n.getComponentMethod("annotations","onClick")(t,t._hoverdata);void 0!==r&&i(t,e,r,!0),t._hoverdata&&e&&e.target&&(o&&o.then?o.then(a):a(),e.stopImmediatePropagation&&e.stopImmediatePropagation())}},{"../../registry":861,"./hover":653}],650:[function(t,e,r){"use strict";e.exports={MAXDIST:20,YANGLE:60,HOVERARROWSIZE:6,HOVERTEXTPAD:3,HOVERFONTSIZE:13,HOVERFONT:"Arial, sans-serif",HOVERMINTIME:50,HOVERID:"-hover"}},{}],651:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./hoverlabel_defaults");e.exports=function(t,e,r,o){a(t,e,function(r,a){return n.coerce(t,e,i,r,a)},o.hoverlabel)}},{"../../lib":738,"./attributes":647,"./hoverlabel_defaults":654}],652:[function(t,e,r){"use strict";function n(t){return s[t]||t}function i(t,e){return Array.isArray(e)?Array.isArray(t)&&Array.isArray(t[e[0]])?t[e[0]][e[1]]:void 0:t[e]}var a=t("../../lib"),o=t("./constants");r.getSubplot=function(t){return t.subplot||t.xaxis+t.yaxis||t.geo},r.flat=function(t,e){for(var r=new Array(t.length),n=0;n<t.length;n++)r[n]=e;return r},r.p2c=function(t,e){for(var r=new Array(t.length),n=0;n<t.length;n++)r[n]=t[n].p2c(e);return r},r.getDistanceFunction=function(t,e,n,i){return"closest"===t?i||r.quadrature(e,n):"x"===t?e:n},r.getClosest=function(t,e,r){if(!1!==r.index)r.index>=0&&r.index<t.length?r.distance=0:r.index=!1;else for(var n=0;n<t.length;n++){var i=e(t[n]);i<=r.distance&&(r.index=n,r.distance=i)}return r},r.inbox=function(t,e){return t*e<0||0===t?o.MAXDIST*(.6-.3/Math.max(3,Math.abs(t-e))):1/0},r.quadrature=function(t,e){return function(r){var n=t(r),i=e(r);return Math.sqrt(n*n+i*i)}},r.makeEventData=function(t,e,n){var i="index"in t?t.index:t.pointNumber,a={data:e._input,fullData:e,curveNumber:e.index,pointNumber:i};if(e._indexToPoints){var o=e._indexToPoints[i];1===o.length?a.pointIndex=o[0]:a.pointIndices=o}else a.pointIndex=i;return e._module.eventData?a=e._module.eventData(a,t,e,n,i):("xVal"in t?a.x=t.xVal:"x"in t&&(a.x=t.x),"yVal"in t?a.y=t.yVal:"y"in t&&(a.y=t.y),t.xa&&(a.xaxis=t.xa),t.ya&&(a.yaxis=t.ya),void 0!==t.zLabelVal&&(a.z=t.zLabelVal)),r.appendArrayPointValue(a,e,i),a},r.appendArrayPointValue=function(t,e,r){var o=e._arrayAttrs;if(o)for(var s=0;s<o.length;s++){var l=o[s],c=n(l);if(void 0===t[c]){var u=i(a.nestedProperty(e,l).get(),r);void 0!==u&&(t[c]=u)}}},r.appendArrayMultiPointValues=function(t,e,r){var o=e._arrayAttrs;if(o)for(var s=0;s<o.length;s++){var l=o[s],c=n(l);if(void 0===t[c]){for(var u=a.nestedProperty(e,l).get(),h=new Array(r.length),f=0;f<r.length;f++)h[f]=i(u,r[f]);t[c]=h}}};var s={ids:"id",locations:"location",labels:"label",values:"value","marker.colors":"color"}},{"../../lib":738,"./constants":650}],653:[function(t,e,r){"use strict";function n(t,e,r,n){r||(r="xy");var f=Array.isArray(r)?r:[r],_=t._fullLayout,w=_._plots||[],k=w[r];if(k){var T=k.overlays.map(function(t){return t.id});f=f.concat(T)}for(var A=f.length,S=new Array(A),E=new Array(A),L=0;L<A;L++){var C=f[L],I=w[C];if(I)S[L]=v.getFromId(t,I.xaxis._id),E[L]=v.getFromId(t,I.yaxis._id);else{var P=_[C]._subplot;S[L]=P.xaxis,E[L]=P.yaxis}}var D=e.hovermode||_.hovermode;if(-1===["x","y","closest"].indexOf(D)||!t.calcdata||t.querySelector(".zoombox")||t._dragging)return g.unhoverRaw(t,e);var z,O,F,R,j,N,B,U,V,H,q,G,Y,W=[],X=[];if(Array.isArray(e))for(D="array",F=0;F<e.length;F++)"skip"!==(j=t.calcdata[e[F].curveNumber||0])[0].trace.hoverinfo&&X.push(j);else{for(R=0;R<t.calcdata.length;R++)"skip"!==(N=(j=t.calcdata[R])[0].trace).hoverinfo&&-1!==f.indexOf(b.getSubplot(N))&&X.push(j);var Z,J;if(!e.target)Z="xpx"in e?e.xpx:S[0]._length/2,J="ypx"in e?e.ypx:E[0]._length/2;else{if(!1===h.triggerHandler(t,"plotly_beforehover",e))return;var K=e.target.getBoundingClientRect();if(Z=e.clientX-K.left,J=e.clientY-K.top,Z<0||Z>K.width||J<0||J>K.height)return g.unhoverRaw(t,e)}if(z="xval"in e?b.flat(f,e.xval):b.p2c(S,Z),O="yval"in e?b.flat(f,e.yval):b.p2c(E,J),!l(z[0])||!l(O[0]))return u.warn("Fx.hover failed",e,t),g.unhoverRaw(t,e)}var Q=1/0;for(R=0;R<X.length;R++)if((j=X[R])&&j[0]&&j[0].trace&&!0===j[0].trace.visible&&(N=j[0].trace,-1===["carpet","contourcarpet"].indexOf(N._module.name))){if(B=b.getSubplot(N),U=f.indexOf(B),V=D,G={cd:j,trace:N,xa:S[U],ya:E[U],index:!1,distance:Math.min(Q,x.MAXDIST),color:m.defaultLine,name:N.name,x0:void 0,x1:void 0,y0:void 0,y1:void 0,xLabelVal:void 0,yLabelVal:void 0,zLabelVal:void 0,text:void 0},_[B]&&(G.subplot=_[B]._subplot),Y=W.length,"array"===V){var $=e[R];"pointNumber"in $?(G.index=$.pointNumber,V="closest"):(V="","xval"in $&&(H=$.xval,V="x"),"yval"in $&&(q=$.yval,V=V?"closest":"y"))}else H=z[U],q=O[U];if(N._module&&N._module.hoverPoints){var tt=N._module.hoverPoints(G,H,q,V,_._hoverlayer);if(tt)for(var et,rt=0;rt<tt.length;rt++)et=tt[rt],l(et.x0)&&l(et.y0)&&W.push(function(t,e){function r(e,r,n){var i=s(r,n);i&&(t[e]=i)}var n=t.index,i=t.trace||{},a=t.cd[0],o=t.cd[n]||{},s=Array.isArray(n)?function(t,e){return u.castOption(a,n,t)||u.extractOption({},i,"",e)}:function(t,e){return u.extractOption(o,i,t,e)};r("hoverinfo","hi","hoverinfo"),r("color","hbg","hoverlabel.bgcolor"),r("borderColor","hbc","hoverlabel.bordercolor"),r("fontFamily","htf","hoverlabel.font.family"),r("fontSize","hts","hoverlabel.font.size"),r("fontColor","htc","hoverlabel.font.color"),r("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?(t.x0+t.x1)/2:(t.y0+t.y1)/2,t.x0=u.constrain(t.x0,0,t.xa._length),t.x1=u.constrain(t.x1,0,t.xa._length),t.y0=u.constrain(t.y0,0,t.ya._length),t.y1=u.constrain(t.y1,0,t.ya._length),void 0!==t.xLabelVal&&(t.xLabel="xLabel"in t?t.xLabel:v.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal));void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:v.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));if(!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var l=v.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+l+" / -"+v.tickText(t.xa,t.xa.c2l(t.xerrneg),"hover").text:t.xLabel+=" \xb1 "+l,"x"===e&&(t.distance+=1)}if(!(isNaN(t.yerr)||"log"===t.ya.type&&t.yerr<=0)){var c=v.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+c+" / -"+v.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+c,"y"===e&&(t.distance+=1)}var h=t.hoverinfo||t.trace.hoverinfo;"all"!==h&&(-1===(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));return t}(et,D))}else u.log("Unrecognized trace type in hover:",N);"closest"===D&&W.length>Y&&(W.splice(0,Y),Q=W[0].distance)}if(0===W.length)return g.unhoverRaw(t,e);W.sort(function(t,e){return t.distance-e.distance});var nt=t._hoverdata,it=[];for(F=0;F<W.length;F++){var at=W[F];it.push(b.makeEventData(at,at.trace,at.cd))}if(t._hoverdata=it,o(t,e,nt)&&_._hasCartesian){!function(t,e){var r=e.hovermode,n=e.container,i=t[0],a=i.xa,o=i.ya,s=a.showspikes,l=o.showspikes;if(n.selectAll(".spikeline").remove(),"closest"!==r||!s&&!l)return;var u=e.fullLayout,h=a._offset+(i.x0+i.x1)/2,f=o._offset+(i.y0+i.y1)/2,d=m.combine(u.plot_bgcolor,u.paper_bgcolor),g=c.readability(i.color,d)<1.5?m.contrast(d):i.color;if(l){var v=o.spikemode,y=o.spikethickness,b=o.spikecolor||g,x=o._boundingBox,_=(x.left+x.right)/2<h?x.right:x.left;if(-1!==v.indexOf("toaxis")||-1!==v.indexOf("across")){var w=_,M=h;-1!==v.indexOf("across")&&(w=o._counterSpan[0],M=o._counterSpan[1]),n.append("line").attr({x1:w,x2:M,y1:f,y2:f,"stroke-width":y+2,stroke:d}).classed("spikeline",!0).classed("crisp",!0),n.append("line").attr({x1:w,x2:M,y1:f,y2:f,"stroke-width":y,stroke:b,"stroke-dasharray":p.dashStyle(o.spikedash,y)}).classed("spikeline",!0).classed("crisp",!0)}-1!==v.indexOf("marker")&&n.append("circle").attr({cx:_+("right"!==o.side?y:-y),cy:f,r:y,fill:b}).classed("spikeline",!0)}if(s){var k=a.spikemode,T=a.spikethickness,A=a.spikecolor||g,S=a._boundingBox,E=(S.top+S.bottom)/2<f?S.bottom:S.top;if(-1!==k.indexOf("toaxis")||-1!==k.indexOf("across")){var L=E,C=f;-1!==k.indexOf("across")&&(L=a._counterSpan[0],C=a._counterSpan[1]),n.append("line").attr({x1:h,x2:h,y1:L,y2:C,"stroke-width":T+2,stroke:d}).classed("spikeline",!0).classed("crisp",!0),n.append("line").attr({x1:h,x2:h,y1:L,y2:C,"stroke-width":T,stroke:A,"stroke-dasharray":p.dashStyle(a.spikedash,T)}).classed("spikeline",!0).classed("crisp",!0)}-1!==k.indexOf("marker")&&n.append("circle").attr({cx:h,cy:E-("top"!==a.side?T:-T),r:T,fill:A}).classed("spikeline",!0)}}(W,{hovermode:D,fullLayout:_,container:_._hoverlayer,outerContainer:_._paperdiv})}var ot="y"===D&&X.length>1,st=i(W,{hovermode:D,rotateLabels:ot,bgColor:m.combine(_.plot_bgcolor||m.background,_.paper_bgcolor),container:_._hoverlayer,outerContainer:_._paperdiv,commonLabelOpts:_.hoverlabel},t);if(function(t,e,r){function n(t){var e=t[0],r=t[t.length-1];if(a=e.pmin-e.pos-e.dp+e.size,o=r.pos+r.dp+r.size-e.pmax,a>.01){for(l=t.length-1;l>=0;l--)t[l].dp+=a;i=!1}if(!(o<.01)){if(a<-.01){for(l=t.length-1;l>=0;l--)t[l].dp-=o;i=!1}if(i){var n=0;for(s=0;s<t.length;s++)(c=t[s]).pos+c.dp+c.size>e.pmax&&n++;for(s=t.length-1;s>=0&&!(n<=0);s--)(c=t[s]).pos>e.pmax-1&&(c.del=!0,n--);for(s=0;s<t.length&&!(n<=0);s++)if((c=t[s]).pos<e.pmin+1)for(c.del=!0,n--,o=2*c.size,l=t.length-1;l>=0;l--)t[l].dp-=o;for(s=t.length-1;s>=0&&!(n<=0);s--)(c=t[s]).pos+c.dp+c.size>e.pmax&&(c.del=!0,n--)}}}var i,a,o,s,l,c,u,h=0,f=t.map(function(t,n){var i=t[e];return[{i:n,dp:0,pos:t.pos,posref:t.posref,size:t.by*("x"===i._id.charAt(0)?M:1)/2,pmin:0,pmax:"x"===i._id.charAt(0)?r.width:r.height}]}).sort(function(t,e){return t[0].posref-e[0].posref});for(;!i&&h<=t.length;){for(h++,i=!0,s=0;s<f.length-1;){var d=f[s],p=f[s+1],m=d[d.length-1],g=p[0];if((a=m.pos+m.dp+m.size-g.pos-g.dp+g.size)>.01&&m.pmin===g.pmin&&m.pmax===g.pmax){for(l=p.length-1;l>=0;l--)p[l].dp+=a;for(d.push.apply(d,p),f.splice(s+1,1),u=0,l=d.length-1;l>=0;l--)u+=d[l].dp;for(o=u/d.length,l=d.length-1;l>=0;l--)d[l].dp-=o;i=!1}else s++}f.forEach(n)}for(s=f.length-1;s>=0;s--){var v=f[s];for(l=v.length-1;l>=0;l--){var y=v[l],b=t[y.i];b.offset=y.dp,b.del=y.del}}}(W,ot?"xa":"ya",_),a(st,ot),e.target&&e.target.tagName){var lt=y.getComponentMethod("annotations","hasClickToShow")(t,it);d(s.select(e.target),lt?"pointer":"")}e.target&&!n&&o(t,e,nt)&&(nt&&t.emit("plotly_unhover",{event:e,points:nt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:S,yaxes:E,xvals:z,yvals:O}))}function i(t,e,r){var n,i=e.hovermode,a=e.rotateLabels,o=e.bgColor,l=e.container,c=e.outerContainer,u=e.commonLabelOpts||{},h=e.fontFamily||x.HOVERFONT,d=e.fontSize||x.HOVERFONTSIZE,g=t[0],v=g.xa,y=g.ya,b="y"===i?"yLabel":"xLabel",w=g[b],M=(String(w)||"").split(" ")[0],k=c.node().getBoundingClientRect(),T=k.top,E=k.width,L=k.height,C=g.distance<=x.MAXDIST&&("x"===i||"y"===i);for(n=0;n<t.length;n++){var I=(t[n].hoverinfo||t[n].trace.hoverinfo).split("+");if(-1===I.indexOf("all")&&-1===I.indexOf(i)){C=!1;break}}var P=l.selectAll("g.axistext").data(C?[0]:[]);P.enter().append("g").classed("axistext",!0),P.exit().remove(),P.each(function(){var e=s.select(this),n=e.selectAll("path").data([0]),a=e.selectAll("text").data([0]);n.enter().append("path").style({"stroke-width":"1px"}),n.style({fill:u.bgcolor||m.defaultLine,stroke:u.bordercolor||m.background}),a.enter().append("text").attr("data-notex",1),a.text(w).call(p.font,u.font.family||h,u.font.size||d,u.font.color||m.background).call(f.positionText,0,0).call(f.convertToTspans,r),e.attr("transform","");var o=a.node().getBoundingClientRect();if("x"===i){a.attr("text-anchor","middle").call(f.positionText,0,"top"===v.side?T-o.bottom-A-S:T-o.top+A+S);var l="top"===v.side?"-":"";n.attr("d","M0,0L"+A+","+l+A+"H"+(S+o.width/2)+"v"+l+(2*S+o.height)+"H-"+(S+o.width/2)+"V"+l+A+"H-"+A+"Z"),e.attr("transform","translate("+(v._offset+(g.x0+g.x1)/2)+","+(y._offset+("top"===v.side?0:y._length))+")")}else{a.attr("text-anchor","right"===y.side?"start":"end").call(f.positionText,("right"===y.side?1:-1)*(S+A),T-o.top-o.height/2);var c="right"===y.side?"":"-";n.attr("d","M0,0L"+c+A+","+A+"V"+(S+o.height/2)+"h"+c+(2*S+o.width)+"V-"+(S+o.height/2)+"H"+c+A+"V-"+A+"Z"),e.attr("transform","translate("+(v._offset+("right"===y.side?v._length:0))+","+(y._offset+(g.y0+g.y1)/2)+")")}t=t.filter(function(t){return void 0!==t.zLabelVal||(t[b]||"").split(" ")[0]===M})});var D=l.selectAll("g.hovertext").data(t,function(t){return[t.trace.index,t.index,t.x0,t.y0,t.name,t.attr,t.xa,t.ya||""].join(",")});return D.enter().append("g").classed("hovertext",!0).each(function(){var t=s.select(this);t.append("rect").call(m.fill,m.addOpacity(o,.8)),t.append("text").classed("name",!0),t.append("path").style("stroke-width","1px"),t.append("text").classed("nums",!0).call(p.font,h,d)}),D.exit().remove(),D.each(function(t){var e=s.select(this).attr("transform",""),n="",l="",c=m.opacity(t.color)?t.color:m.defaultLine,u=m.combine(c,o),g=t.borderColor||m.contrast(u);if(void 0!==t.nameOverride&&(t.name=t.nameOverride),t.name){n=f.plainText(t.name||"");var v=Math.round(t.nameLength);v>-1&&n.length>v&&(n=v>3?n.substr(0,v-3)+"...":n.substr(0,v))}void 0!==t.extraText&&(l+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"<br>"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"<br>"),l+=(l?"z: ":"")+t.zLabel):C&&t[i+"Label"]===w?l=t[("x"===i?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(l=t.yLabel):l=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(l+=(l?"<br>":"")+t.text),""===l&&(""===n&&e.remove(),l=n);var y=e.select("text.nums").call(p.font,t.fontFamily||h,t.fontSize||d,t.fontColor||g).text(l).attr("data-notex",1).call(f.positionText,0,0).call(f.convertToTspans,r),b=e.select("text.name"),x=0;n&&n!==l?(b.call(p.font,t.fontFamily||h,t.fontSize||d,u).text(n).attr("data-notex",1).call(f.positionText,0,0).call(f.convertToTspans,r),x=b.node().getBoundingClientRect().width+2*S):(b.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:g});var M,k,I=y.node().getBoundingClientRect(),P=t.xa._offset+(t.x0+t.x1)/2,D=t.ya._offset+(t.y0+t.y1)/2,z=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),F=I.width+A+S+x;t.ty0=T-I.top,t.bx=I.width+2*S,t.by=I.height+2*S,t.anchor="start",t.txwidth=I.width,t.tx2width=x,t.offset=0,a?(t.pos=P,M=D+O/2+F<=L,k=D-O/2-F>=0,"top"!==t.idealAlign&&M||!k?M?(D+=O/2,t.anchor="start"):t.anchor="middle":(D-=O/2,t.anchor="end")):(t.pos=D,M=P+z/2+F<=E,k=P-z/2-F>=0,"left"!==t.idealAlign&&M||!k?M?(P+=z/2,t.anchor="start"):t.anchor="middle":(P-=z/2,t.anchor="end")),y.attr("text-anchor",t.anchor),x&&b.attr("text-anchor",t.anchor),e.attr("transform","translate("+P+","+D+")"+(a?"rotate("+_+")":""))}),D}function a(t,e){t.each(function(t){var r=s.select(this);if(t.del)r.remove();else{var n="end"===t.anchor?-1:1,i=r.select("text.nums"),a={start:1,end:-1,middle:0}[t.anchor],o=a*(A+S),l=o+a*(t.txwidth+S),c=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,l-=t.tx2width/2),e&&(u*=-T,c=t.offset*k),r.select("path").attr("d","middle"===t.anchor?"M-"+t.bx/2+",-"+t.by/2+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(n*A+c)+","+(A+u)+"v"+(t.by/2-A)+"h"+n*t.bx+"v-"+t.by+"H"+(n*A+c)+"V"+(u-A)+"Z"),i.call(f.positionText,o+c,u+t.ty0-t.by/2+S),t.tx2width&&(r.select("text.name").call(f.positionText,l+a*S+c,u+t.ty0-t.by/2+S),r.select("rect").call(p.setRect,l+(a-1)*t.tx2width/2+c,u-t.by/2-1,t.tx2width,t.by+2))}})}function o(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}var s=t("d3"),l=t("fast-isnumeric"),c=t("tinycolor2"),u=t("../../lib"),h=t("../../lib/events"),f=t("../../lib/svg_text_utils"),d=t("../../lib/override_cursor"),p=t("../drawing"),m=t("../color"),g=t("../dragelement"),v=t("../../plots/cartesian/axes"),y=t("../../registry"),b=t("./helpers"),x=t("./constants"),_=x.YANGLE,w=Math.PI*_/180,M=1/Math.sin(w),k=Math.cos(w),T=Math.sin(w),A=x.HOVERARROWSIZE,S=x.HOVERTEXTPAD;r.hover=function(t,e,r,i){t=u.getGraphDiv(t),u.throttle(t._fullLayout._uid+x.HOVERID,x.HOVERMINTIME,function(){n(t,e,r,i)})},r.loneHover=function(t,e){var r={color:t.color||m.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},n=s.select(e.container),o=e.outerContainer?s.select(e.outerContainer):n,l={hovermode:"closest",rotateLabels:!1,bgColor:e.bgColor||m.background,container:n,outerContainer:o},c=i([r],l,e.gd);return a(c,l.rotateLabels),c.node()}},{"../../lib":738,"../../lib/events":726,"../../lib/override_cursor":749,"../../lib/svg_text_utils":761,"../../plots/cartesian/axes":785,"../../registry":861,"../color":613,"../dragelement":635,"../drawing":638,"./constants":650,"./helpers":652,d3:123,"fast-isnumeric":132,tinycolor2:543}],654:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i){r("hoverlabel.bgcolor",(i=i||{}).bgcolor),r("hoverlabel.bordercolor",i.bordercolor),r("hoverlabel.namelength",i.namelength),n.coerceFont(r,"hoverlabel.font",i.font)}},{"../../lib":738}],655:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../dragelement"),o=t("./helpers"),s=t("./layout_attributes");e.exports={moduleType:"component",name:"fx",constants:t("./constants"),schema:{layout:s},attributes:t("./attributes"),layoutAttributes:s,supplyLayoutGlobalDefaults:t("./layout_global_defaults"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),getDistanceFunction:o.getDistanceFunction,getClosest:o.getClosest,inbox:o.inbox,quadrature:o.quadrature,appendArrayPointValue:o.appendArrayPointValue,castHoverOption:function(t,e,r){return i.castOption(t,e,"hoverlabel."+r)},castHoverinfo:function(t,e,r){return i.castOption(t,r,"hoverinfo",function(r){return i.coerceHoverinfo({hoverinfo:r},{_module:t._module},e)})},hover:t("./hover").hover,unhover:a.unhover,loneHover:t("./hover").loneHover,loneUnhover:function(t){var e=i.isD3Selection(t)?t:n.select(t);e.selectAll("g.hovertext").remove(),e.selectAll(".spikeline").remove()},click:t("./click")}},{"../../lib":738,"../dragelement":635,"./attributes":647,"./calc":648,"./click":649,"./constants":650,"./defaults":651,"./helpers":652,"./hover":653,"./layout_attributes":656,"./layout_defaults":657,"./layout_global_defaults":658,d3:123}],656:[function(t,e,r){"use strict";var n=t("./constants"),i=t("../../plots/font_attributes")({editType:"none"});i.family.dflt=n.HOVERFONT,i.size.dflt=n.HOVERFONTSIZE,e.exports={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",!1],editType:"modebar"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:i,namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},editType:"none"}}},{"../../plots/font_attributes":810,"./constants":650}],657:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r){function a(r,a){return n.coerce(t,e,i,r,a)}a("dragmode");var o;e._has("cartesian")?(e._isHoriz=function(t){for(var e=!0,r=0;r<t.length;r++)if("h"!==t[r].orientation){e=!1;break}return e}(r),o=e._isHoriz?"y":"x"):o="closest",a("hovermode",o);var s=e._has("mapbox"),l=e._has("geo"),c=e._basePlotModules.length;"zoom"===e.dragmode&&((s||l)&&1===c||s&&l&&2===c)&&(e.dragmode="pan")}},{"../../lib":738,"./layout_attributes":656}],658:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./hoverlabel_defaults"),a=t("./layout_attributes");e.exports=function(t,e){i(t,e,function(r,i){return n.coerce(t,e,a,r,i)})}},{"../../lib":738,"./hoverlabel_defaults":654,"./layout_attributes":656}],659:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/constants");e.exports={_isLinkedToArray:"image",visible:{valType:"boolean",dflt:!0,editType:"arraydraw"},source:{valType:"string",editType:"arraydraw"},layer:{valType:"enumerated",values:["below","above"],dflt:"above",editType:"arraydraw"},sizex:{valType:"number",dflt:0,editType:"arraydraw"},sizey:{valType:"number",dflt:0,editType:"arraydraw"},sizing:{valType:"enumerated",values:["fill","contain","stretch"],dflt:"contain",editType:"arraydraw"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},x:{valType:"any",dflt:0,editType:"arraydraw"},y:{valType:"any",dflt:0,editType:"arraydraw"},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left",editType:"arraydraw"},yanchor:{valType:"enumerated",values:["top","middle","bottom"],dflt:"top",editType:"arraydraw"},xref:{valType:"enumerated",values:["paper",n.idRegex.x.toString()],dflt:"paper",editType:"arraydraw"},yref:{valType:"enumerated",values:["paper",n.idRegex.y.toString()],dflt:"paper",editType:"arraydraw"},editType:"arraydraw"}},{"../../plots/cartesian/constants":790}],660:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib/to_log_range");e.exports=function(t,e,r,a){e=e||{};var o="log"===r&&"linear"===e.type,s="linear"===r&&"log"===e.type;if(o||s)for(var l,c,u=t._fullLayout.images,h=e._id.charAt(0),f=0;f<u.length;f++)if(l=u[f],c="images["+f+"].",l[h+"ref"]===e._id){var d=l[h],p=l["size"+h],m=null,g=null;if(o){m=i(d,e.range);var v=p/Math.pow(10,m)/2;g=2*Math.log(v+Math.sqrt(1+v*v))/Math.LN10}else g=(m=Math.pow(10,d))*(Math.pow(10,p/2)-Math.pow(10,-p/2));n(m)?n(g)||(g=null):(m=null,g=null),a(c+h,m),a(c+"size"+h,g)}}},{"../../lib/to_log_range":763,"fast-isnumeric":132}],661:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,s,r,n)}if(!n("visible",!!n("source")))return e;n("layer"),n("xanchor"),n("yanchor"),n("sizex"),n("sizey"),n("sizing"),n("opacity");for(var o={_fullLayout:r},l=["x","y"],c=0;c<2;c++){var u=l[c],h=a.coerceRef(t,e,o,u,"paper");a.coercePosition(e,o,n,h,u,0)}return e}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../../plots/array_container_defaults"),s=t("./attributes");e.exports=function(t,e){o(t,e,{name:"images",handleItemDefaults:n})}},{"../../lib":738,"../../plots/array_container_defaults":782,"../../plots/cartesian/axes":785,"./attributes":659}],662:[function(t,e,r){"use strict";var n=t("d3"),i=t("../drawing"),a=t("../../plots/cartesian/axes"),o=t("../../constants/xmlns_namespaces");e.exports=function(t){function e(e){var r=n.select(this);if(!this.img||this.img.src!==e.source){r.attr("xmlns",o.svg);var i=new Promise(function(t){function n(){r.remove(),t()}var i=new Image;this.img=i,i.setAttribute("crossOrigin","anonymous"),i.onerror=n,i.onload=function(){var e=document.createElement("canvas");e.width=this.width,e.height=this.height;e.getContext("2d").drawImage(this,0,0);var n=e.toDataURL("image/png");r.attr("xlink:href",n),t()},r.on("error",n),i.src=e.source}.bind(this));t._promises.push(i)}}function r(e){var r=n.select(this),o=a.getFromId(t,e.xref),s=a.getFromId(t,e.yref),l=c._size,u=o?Math.abs(o.l2p(e.sizex)-o.l2p(0)):e.sizex*l.w,h=s?Math.abs(s.l2p(e.sizey)-s.l2p(0)):e.sizey*l.h,f=u*m.x[e.xanchor].offset,d=h*m.y[e.yanchor].offset,p=m.x[e.xanchor].sizing+m.y[e.yanchor].sizing,g=(o?o.r2p(e.x)+o._offset:e.x*l.w+l.l)+f,v=(s?s.r2p(e.y)+s._offset:l.h-e.y*l.h+l.t)+d;switch(e.sizing){case"fill":p+=" slice";break;case"stretch":p="none"}r.attr({x:g,y:v,width:u,height:h,preserveAspectRatio:p,opacity:e.opacity});var y=(o?o._id:"")+(s?s._id:"");r.call(i.setClipUrl,y?"clip"+c._uid+y:null)}var s,l,c=t._fullLayout,u=[],h={},f=[];for(l=0;l<c.images.length;l++){var d=c.images[l];if(d.visible)if("below"===d.layer&&"paper"!==d.xref&&"paper"!==d.yref){s=d.xref+d.yref;var p=c._plots[s];if(!p){f.push(d);continue}p.mainplot&&(s=p.mainplot.id),h[s]||(h[s]=[]),h[s].push(d)}else"above"===d.layer?u.push(d):f.push(d)}var m={x:{left:{sizing:"xMin",offset:0},center:{sizing:"xMid",offset:-.5},right:{sizing:"xMax",offset:-1}},y:{top:{sizing:"YMin",offset:0},middle:{sizing:"YMid",offset:-.5},bottom:{sizing:"YMax",offset:-1}}},g=c._imageLowerLayer.selectAll("image").data(f),v=c._imageUpperLayer.selectAll("image").data(u);g.enter().append("image"),v.enter().append("image"),g.exit().remove(),v.exit().remove(),g.each(function(t){e.bind(this)(t),r.bind(this)(t)}),v.each(function(t){e.bind(this)(t),r.bind(this)(t)});var y=Object.keys(c._plots);for(l=0;l<y.length;l++){s=y[l];var b=c._plots[s];if(b.imagelayer){var x=b.imagelayer.selectAll("image").data(h[s]||[]);x.enter().append("image"),x.exit().remove(),x.each(function(t){e.bind(this)(t),r.bind(this)(t)})}}}},{"../../constants/xmlns_namespaces":719,"../../plots/cartesian/axes":785,"../drawing":638,d3:123}],663:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"images",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),includeBasePlot:t("../../plots/cartesian/include_components")("images"),draw:t("./draw"),convertCoords:t("./convert_coords")}},{"../../plots/cartesian/include_components":795,"./attributes":659,"./convert_coords":660,"./defaults":661,"./draw":662}],664:[function(t,e,r){"use strict";r.isRightAnchor=function(t){return"right"===t.xanchor||"auto"===t.xanchor&&t.x>=2/3},r.isCenterAnchor=function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},r.isBottomAnchor=function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},r.isMiddleAnchor=function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},{}],665:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes");e.exports={bgcolor:{valType:"color",editType:"legend"},bordercolor:{valType:"color",dflt:i.defaultLine,editType:"legend"},borderwidth:{valType:"number",min:0,dflt:0,editType:"legend"},font:n({editType:"legend"}),orientation:{valType:"enumerated",values:["v","h"],dflt:"v",editType:"legend"},traceorder:{valType:"flaglist",flags:["reversed","grouped"],extras:["normal"],editType:"legend"},tracegroupgap:{valType:"number",min:0,dflt:10,editType:"legend"},x:{valType:"number",min:-2,max:3,dflt:1.02,editType:"legend"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"legend"},y:{valType:"number",min:-2,max:3,dflt:1,editType:"legend"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"auto",editType:"legend"},editType:"legend"}},{"../../plots/font_attributes":810,"../color/attributes":612}],666:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],667:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("./attributes"),o=t("../../plots/layout_attributes"),s=t("./helpers");e.exports=function(t,e,r){function l(t,e){return i.coerce(d,p,a,t,e)}for(var c,u,h,f,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v<r.length;v++){var y=r[v];s.legendGetsTrace(y)&&(m++,n.traceIs(y,"pie")&&m++),(n.traceIs(y,"bar")&&"stack"===e.barmode||-1!==["tonextx","tonexty"].indexOf(y.fill))&&(g=s.isGrouped({traceorder:g})?"grouped+reversed":"reversed"),void 0!==y.legendgroup&&""!==y.legendgroup&&(g=s.isReversed({traceorder:g})?"reversed+grouped":"grouped")}if(!1!==i.coerce(t,e,o,"showlegend",m>1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var b=t.xaxis;b&&b.rangeslider&&b.rangeslider.visible?(c=0,h="left",u=1.1,f="bottom"):(c=0,h="left",u=-.1,f="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",c),l("xanchor",h),l("y",u),l("yanchor",f),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":738,"../../plots/layout_attributes":837,"../../registry":861,"./attributes":665,"./helpers":671}],668:[function(t,e,r){"use strict";function n(t,e){function r(r){m.convertToTspans(r,e,function(){!function(t,e){var r=t.data()[0][0];if(!r.trace.showlegend)return void t.remove();var n,i,a=t.select("g[class*=math-group]"),o=a.node(),s=e._fullLayout.legend.font.size*b;if(o){var l=d.bBox(o);n=l.height,i=l.width,d.setTranslate(a,0,n/4)}else{var c=t.select(".legendtext"),u=m.lineCount(c),h=c.node();n=s*u,i=h?d.bBox(h).width:0;var f=s*(.3+(1-u)/2);m.positionText(c,40,f)}n=Math.max(n,16)+3,r.height=n,r.width=i}(t,e)})}var n=t.data()[0][0],i=e._fullLayout,a=n.trace,o=h.traceIs(a,"pie"),s=a.index,u=o?n.label:a.name,f=t.selectAll("text.legendtext").data([0]);f.enter().append("text").classed("legendtext",!0),f.attr("text-anchor","start").classed("user-select-none",!0).call(d.font,i.legend.font).text(u),e._context.edits.legendText&&!o?f.call(m.makeEditable,{gd:e}).call(r).on("edit",function(t){this.text(t).call(r);var i=t;this.text()||(t=" ");var a,o=n.trace._fullInput||{},u={};if(-1!==["ohlc","candlestick"].indexOf(o.type))u[(a=n.trace.transforms)[a.length-1].direction+".name"]=t;else if(h.hasTransform(o,"groupby")){var f=h.getTransformIndices(o,"groupby"),d=f[f.length-1],p=c.keyedContainer(o,"transforms["+d+"].styles","target","value.name");""===i?p.remove(n.trace._group):p.set(n.trace._group,t),u=p.constructUpdate()}else u.name=t;return l.restyle(e,u,s)}):f.call(r)}function i(t,e){var r,n=1,i=t.selectAll("rect").data([0]);i.enter().append("rect").classed("legendtoggle",!0).style("cursor","pointer").attr("pointer-events","all").call(p.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){(r=(new Date).getTime())-e._legendMouseDownTime<k?n+=1:(n=1,e._legendMouseDownTime=r)}),i.on("mouseup",function(){if(!e._dragged&&!e._editing){var r=e._fullLayout.legend;(new Date).getTime()-e._legendMouseDownTime>k&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){g(t,e,n)},k):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,g(t,e,n))}})}function a(t,e,r){var n=t._fullLayout,i=n.legend,a=i.borderwidth,o=w.isGrouped(i),l=0;if(i.width=0,i.height=0,w.isVertical(i))o&&e.each(function(t,e){d.setTranslate(this,0,e*i.tracegroupgap)}),r.each(function(t){var e=t[0],r=e.height,n=e.width;d.setTranslate(this,a,5+a+i.height+r/2),i.height+=r,i.width=Math.max(i.width,n)}),i.width+=45+2*a,i.height+=10+2*a,o&&(i.height+=(i._lgroupsLength-1)*i.tracegroupgap),l=40;else if(o){for(var c=[i.width],u=e.data(),h=0,f=u.length;h<f;h++){var p=u[h].map(function(t){return t[0].width}),m=40+Math.max.apply(null,p);i.width+=i.tracegroupgap+m,c.push(i.width)}e.each(function(t,e){d.setTranslate(this,c[e],0)}),e.each(function(){var t=0;s.select(this).selectAll("g.traces").each(function(e){var r=e[0].height;d.setTranslate(this,0,5+a+t+r/2),t+=r}),i.height=Math.max(i.height,t)}),i.height+=10+2*a,i.width+=2*a}else{var g,v=0,y=0,b=0,x=0,_=0,M=i.tracegroupgap||5;r.each(function(t){b=Math.max(40+t[0].width,b),_+=40+t[0].width+M}),g=n.width-(n.margin.r+n.margin.l)>a+_-M,r.each(function(t){var e=t[0],r=g?40+t[0].width:b;a+x+M+r>n.width-(n.margin.r+n.margin.l)&&(x=0,v+=y,i.height=i.height+y,y=0),d.setTranslate(this,a+x,5+a+e.height/2+v),i.width+=M+r,i.height=Math.max(i.height,e.height),x+=M+r,y=Math.max(e.height,y)}),i.width+=2*a,i.height+=10+2*a}i.width=Math.ceil(i.width),i.height=Math.ceil(i.height),r.each(function(e){var r=e[0];s.select(this).select(".legendtoggle").call(d.setRect,0,-r.height/2,(t._context.edits.legendText?0:i.width)+l,r.height)})}function o(t){var e=t._fullLayout.legend,r="left";M.isRightAnchor(e)?r="right":M.isCenterAnchor(e)&&(r="center");var n="top";M.isBottomAnchor(e)?n="bottom":M.isMiddleAnchor(e)&&(n="middle"),u.autoMargin(t,"legend",{x:e.x,y:e.y,l:e.width*({right:1,center:.5}[r]||0),r:e.width*({left:1,center:.5}[r]||0),b:e.height*({top:1,middle:.5}[n]||0),t:e.height*({bottom:1,middle:.5}[n]||0)})}var s=t("d3"),l=t("../../plotly"),c=t("../../lib"),u=t("../../plots/plots"),h=t("../../registry"),f=t("../dragelement"),d=t("../drawing"),p=t("../color"),m=t("../../lib/svg_text_utils"),g=t("./handle_click"),v=t("./constants"),y=t("../../constants/interactions"),b=t("../../constants/alignment").LINE_SPACING,x=t("./get_legend_data"),_=t("./style"),w=t("./helpers"),M=t("./anchor_utils"),k=y.DBLCLICKDELAY;e.exports=function(t){function e(t,e){E.attr("data-scroll",e).call(d.setTranslate,0,e),L.call(d.setRect,j,t,v.scrollBarWidth,v.scrollBarHeight),A.select("rect").attr({y:y.borderwidth-e})}var r=t._fullLayout,m="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var y=r.legend,b=r.showlegend&&x(t.calcdata,y),w=r.hiddenlabels||[];if(!r.showlegend||!b.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+m).remove(),void u.autoMargin(t,"legend");var T=r._infolayer.selectAll("g.legend").data([0]);T.enter().append("g").attr({class:"legend","pointer-events":"all"});var A=r._topdefs.selectAll("#"+m).data([0]);A.enter().append("clipPath").attr("id",m).append("rect");var S=T.selectAll("rect.bg").data([0]);S.enter().append("rect").attr({class:"bg","shape-rendering":"crispEdges"}),S.call(p.stroke,y.bordercolor),S.call(p.fill,y.bgcolor),S.style("stroke-width",y.borderwidth+"px");var E=T.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=T.selectAll("rect.scrollbar").data([0]);L.enter().append("rect").attr({class:"scrollbar",rx:20,ry:2,width:0,height:0}).call(p.fill,"#808BA4");var C=E.selectAll("g.groups").data(b);C.enter().append("g").attr("class","groups"),C.exit().remove();var I=C.selectAll("g.traces").data(c.identity);I.enter().append("g").attr("class","traces"),I.exit().remove(),I.call(_,t).style("opacity",function(t){var e=t[0].trace;return h.traceIs(e,"pie")?-1!==w.indexOf(t[0].label)?.5:1:"legendonly"===e.visible?.5:1}).each(function(){s.select(this).call(n,t).call(i,t)});var P=0!==T.enter().size();P&&(a(t,C,I),o(t));var D=r.width,z=r.height;a(t,C,I),y.height>z?function(t){var e=t._fullLayout.legend,r="left";M.isRightAnchor(e)?r="right":M.isCenterAnchor(e)&&(r="center"),u.autoMargin(t,"legend",{x:e.x,y:.5,l:e.width*({right:1,center:.5}[r]||0),r:e.width*({left:1,center:.5}[r]||0),b:0,t:0})}(t):o(t);var O=r._size,F=O.l+O.w*y.x,R=O.t+O.h*(1-y.y);M.isRightAnchor(y)?F-=y.width:M.isCenterAnchor(y)&&(F-=y.width/2),M.isBottomAnchor(y)?R-=y.height:M.isMiddleAnchor(y)&&(R-=y.height/2);var j=y.width,N=O.w;j>N?(F=O.l,j=N):(F+j>D&&(F=D-j),F<0&&(F=0),j=Math.min(D-F,y.width));var B=y.height,U=O.h;B>U?(R=O.t,B=U):(R+B>z&&(R=z-B),R<0&&(R=0),B=Math.min(z-R,y.height)),d.setTranslate(T,F,R);var V,H,q=B-v.scrollBarHeight-2*v.scrollBarMargin,G=y.height-B;if(y.height<=B||t._context.staticPlot)S.attr({width:j-y.borderwidth,height:B-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),d.setTranslate(E,0,0),A.select("rect").attr({width:j-2*y.borderwidth,height:B-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),E.call(d.setClipUrl,m);else{V=v.scrollBarMargin,H=E.attr("data-scroll")||0,S.attr({width:j-2*y.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),A.select("rect").attr({width:j-2*y.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-H}),E.call(d.setClipUrl,m),P&&e(V,H),T.on("wheel",null),T.on("wheel",function(){H=c.constrain(E.attr("data-scroll")-s.event.deltaY/q*G,-G,0),e(V=v.scrollBarMargin-H/G*q,H),0!==H&&H!==-G&&s.event.preventDefault()}),L.on(".drag",null),E.on(".drag",null);var Y=s.behavior.drag().on("drag",function(){V=c.constrain(s.event.y-v.scrollBarHeight/2,v.scrollBarMargin,v.scrollBarMargin+q),H=-(V-v.scrollBarMargin)/q*G,e(V,H)});L.call(Y),E.call(Y)}if(t._context.edits.legendPosition){var W,X,Z,J;T.classed("cursor-move",!0),f.init({element:T.node(),gd:t,prepFn:function(){var t=d.getTranslate(T);Z=t.x,J=t.y},moveFn:function(t,e){var r=Z+t,n=J+e;d.setTranslate(T,r,n),W=f.align(r,0,O.l,O.l+O.w,y.xanchor),X=f.align(n,0,O.t+O.h,O.t,y.yanchor)},doneFn:function(){void 0!==W&&void 0!==X&&l.relayout(t,{"legend.x":W,"legend.y":X})},clickFn:function(e,n){var i=r._infolayer.selectAll("g.traces").filter(function(){var t=this.getBoundingClientRect();return n.clientX>=t.left&&n.clientX<=t.right&&n.clientY>=t.top&&n.clientY<=t.bottom});i.size()>0&&(1===e?T._clickTimeout=setTimeout(function(){g(i,t,e)},k):2===e&&(T._clickTimeout&&clearTimeout(T._clickTimeout),g(i,t,e)))}})}}}},{"../../constants/alignment":711,"../../constants/interactions":716,"../../lib":738,"../../lib/svg_text_utils":761,"../../plotly":780,"../../plots/plots":846,"../../registry":861,"../color":613,"../dragelement":635,"../drawing":638,"./anchor_utils":664,"./constants":666,"./get_legend_data":669,"./handle_click":670,"./helpers":671,"./style":673,d3:123}],669:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./helpers");e.exports=function(t,e){function r(t,r){if(""!==t&&i.isGrouped(e))-1===l.indexOf(t)?(l.push(t),c=!0,s[t]=[[r]]):s[t].push([r]);else{var n="~~i"+h;l.push(n),s[n]=[[r]],h++}}var a,o,s={},l=[],c=!1,u={},h=0;for(a=0;a<t.length;a++){var f=t[a],d=f[0],p=d.trace,m=p.legendgroup;if(i.legendGetsTrace(p)&&p.showlegend)if(n.traceIs(p,"pie"))for(u[m]||(u[m]={}),o=0;o<f.length;o++){var g=f[o].label;u[m][g]||(r(m,{label:g,color:f[o].color,i:f[o].i,trace:p}),u[m][g]=!0)}else r(m,d)}if(!l.length)return[];var v,y,b=l.length;if(c&&i.isGrouped(e))for(y=new Array(b),a=0;a<b;a++)v=s[l[a]],y[a]=i.isReversed(e)?v.reverse():v;else{for(y=[new Array(b)],a=0;a<b;a++)v=s[l[a]][0],y[0][i.isReversed(e)?b-a-1:a]=v;b=1}return e._lgroupsLength=b,y}},{"../../registry":861,"./helpers":671}],670:[function(t,e,r){"use strict";var n=t("../../plotly"),i=t("../../lib"),a=t("../../registry"),o=!0;e.exports=function(t,e,r){function s(t,e,r){var n=x.indexOf(t),i=b[e];return i||(i=b[e]=[]),-1===x.indexOf(t)&&(x.push(t),n=x.length-1),i[n]=r,n}function l(t,e){var r=t._fullInput;if(a.hasTransform(r,"groupby")){var n=_[r.index];if(!n){var o=a.getTransformIndices(r,"groupby"),l=o[o.length-1];n=i.keyedContainer(r,"transforms["+l+"].styles","target","value.visible"),_[r.index]=n}var c=n.get(t._group);void 0===c&&(c=!0),!1!==c&&n.set(t._group,e),w[r.index]=s(r.index,"visible",!1!==r.visible)}else{var u=!1!==r.visible&&e;s(r.index,"visible",u)}}if(!e._dragged&&!e._editing){var c,u,h,f,d,p=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],m=t.data()[0][0],g=e._fullData,v=m.trace,y=v.legendgroup,b={},x=[],_=[],w=[];if(1===r&&o&&e.data&&e._context.showTips?(i.notifier(i._(e,"Double-click on legend to isolate one trace"),"long"),o=!1):o=!1,a.traceIs(v,"pie")){var M=m.label,k=p.indexOf(M);1===r?-1===k?p.push(M):p.splice(k,1):2===r&&(p=[],e.calcdata[0].forEach(function(t){M!==t.label&&p.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===p.length&&-1===k&&(p=[])),n.relayout(e,"hiddenlabels",p)}else{var T,A=y&&y.length,S=[];if(A)for(c=0;c<g.length;c++)(T=g[c]).visible&&T.legendgroup===y&&S.push(c);if(1===r){var E;switch(v.visible){case!0:E="legendonly";break;case!1:E=!1;break;case"legendonly":E=!0}if(A)for(c=0;c<g.length;c++)!1!==g[c].visible&&g[c].legendgroup===y&&l(g[c],E);else l(v,E)}else if(2===r){var L,C,I=!0;for(c=0;c<g.length;c++)if(!(g[c]===v)&&!(L=A&&g[c].legendgroup===y)&&!0===g[c].visible&&!a.traceIs(g[c],"notLegendIsolatable")){I=!1;break}for(c=0;c<g.length;c++)if(!1!==g[c].visible&&!a.traceIs(g[c],"notLegendIsolatable"))switch(v.visible){case"legendonly":l(g[c],!0);break;case!0:C=!!I||"legendonly",L=g[c]===v||A&&g[c].legendgroup===y,l(g[c],!!L||C)}}for(c=0;c<_.length;c++)if(h=_[c]){var P=h.constructUpdate(),D=Object.keys(P);for(u=0;u<D.length;u++)f=D[u],(b[f]=b[f]||[])[w[c]]=P[f]}for(d=Object.keys(b),c=0;c<d.length;c++)for(f=d[c],u=0;u<x.length;u++)b[f].hasOwnProperty(u)||(b[f][u]=void 0);n.restyle(e,b,x)}}}},{"../../lib":738,"../../plotly":780,"../../registry":861}],671:[function(t,e,r){"use strict";var n=t("../../registry");r.legendGetsTrace=function(t){return t.visible&&n.traceIs(t,"showLegend")},r.isGrouped=function(t){return-1!==(t.traceorder||"").indexOf("grouped")},r.isVertical=function(t){return"h"!==t.orientation},r.isReversed=function(t){return-1!==(t.traceorder||"").indexOf("reversed")}},{"../../registry":861}],672:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"legend",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),draw:t("./draw"),style:t("./style")}},{"./attributes":665,"./defaults":667,"./draw":668,"./style":673}],673:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../registry"),a=t("../../lib"),o=t("../drawing"),s=t("../color"),l=t("../../traces/scatter/subtypes"),c=t("../../traces/pie/style_one");e.exports=function(t,e){t.each(function(t){var e=n.select(this).selectAll("g.layers").data([0]);e.enter().append("g").classed("layers",!0),e.style("opacity",t[0].trace.opacity);e.selectAll("g.legendfill").data([t]).enter().append("g").classed("legendfill",!0);e.selectAll("g.legendlines").data([t]).enter().append("g").classed("legendlines",!0);var r=e.selectAll("g.legendsymbols").data([t]);r.enter().append("g").classed("legendsymbols",!0),r.selectAll("g.legendpoints").data([t]).enter().append("g").classed("legendpoints",!0)}).each(function(t){var e=t[0].trace,r=e.marker||{},a=r.line||{},o=n.select(this).select("g.legendpoints").selectAll("path.legendbar").data(i.traceIs(e,"bar")?[t]:[]);o.enter().append("path").classed("legendbar",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),o.exit().remove(),o.each(function(t){var e=n.select(this),i=t[0],o=(i.mlw+1||a.width+1)-1;e.style("stroke-width",o+"px").call(s.fill,i.mc||r.color),o&&e.call(s.stroke,i.mlc||a.color)})}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendbox").data(i.traceIs(e,"box-violin")&&e.visible?[t]:[]);r.enter().append("path").classed("legendbox",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.each(function(){var t=e.line.width,r=n.select(this);r.style("stroke-width",t+"px").call(s.fill,e.fillcolor),t&&r.call(s.stroke,e.line.color)})}).each(function(t){var e=t[0].trace,r=n.select(this).select("g.legendpoints").selectAll("path.legendpie").data(i.traceIs(e,"pie")&&e.visible?[t]:[]);r.enter().append("path").classed("legendpie",!0).attr("d","M6,6H-6V-6H6Z").attr("transform","translate(20,0)"),r.exit().remove(),r.size()&&r.call(c,t[0],e)}).each(function(t){var e=t[0].trace,r=e.visible&&e.fill&&"none"!==e.fill,i=l.hasLines(e);e&&e._module&&"contourcarpet"===e._module.name&&(i=e.contours.showlines,r="fill"===e.contours.coloring);var a=n.select(this).select(".legendfill").selectAll("path").data(r?[t]:[]);a.enter().append("path").classed("js-fill",!0),a.exit().remove(),a.attr("d","M5,0h30v6h-30z").call(o.fillGroupStyle);var s=n.select(this).select(".legendlines").selectAll("path").data(i?[t]:[]);s.enter().append("path").classed("js-line",!0).attr("d","M5,0h30"),s.exit().remove(),s.call(o.lineGroupStyle)}).each(function(t){function r(t,e,r){var n=a.nestedProperty(h,t).get(),i=Array.isArray(n)&&e?e(n):n;if(r){if(i<r[0])return r[0];if(i>r[1])return r[1]}return i}function i(t){return t[0]}var s,c,u=t[0],h=u.trace,f=l.hasMarkers(h),d=l.hasText(h),p=l.hasLines(h);if(f||d||p){var m={},g={};f&&(m.mc=r("marker.color",i),m.mo=r("marker.opacity",a.mean,[.2,1]),m.ms=r("marker.size",a.mean,[2,16]),m.mlc=r("marker.line.color",i),m.mlw=r("marker.line.width",a.mean,[0,5]),g.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),p&&(g.line={width:r("line.width",i,[0,10])}),d&&(m.tx="Aa",m.tp=r("textposition",i),m.ts=10,m.tc=r("textfont.color",i),m.tf=r("textfont.family",i)),s=[a.minExtend(u,m)],c=a.minExtend(h,g)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(f?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,c,e),f&&(s[0].mrc=3);var b=v.selectAll("g.pointtext").data(d?s:[]);b.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),b.exit().remove(),b.selectAll("text").call(o.textPointStyle,c,e)})}},{"../../lib":738,"../../registry":861,"../../traces/pie/style_one":1040,"../../traces/scatter/subtypes":1076,"../color":613,"../drawing":638,d3:123}],674:[function(t,e,r){"use strict";function n(t,e){var r,n,i=e.currentTarget,a=i.getAttribute("data-attr"),o=i.getAttribute("data-val")||!0,s=t._fullLayout,l={},c=f.list(t,null,!0),h="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,g=(1-p)/2;for(n=0;n<c.length;n++)if(!(r=c[n]).fixedrange)if(d=r._name,"auto"===o)l[d+".autorange"]=!0;else if("reset"===o){if(void 0===r._rangeInitial)l[d+".autorange"]=!0;else{var v=r._rangeInitial.slice();l[d+".range[0]"]=v[0],l[d+".range[1]"]=v[1]}void 0!==r._showSpikeInitial&&(l[d+".showspikes"]=r._showSpikeInitial,"on"!==h||r._showSpikeInitial||(h="off"))}else{var y=[r.r2l(r.range[0]),r.r2l(r.range[1])],b=[m*y[0]+g*y[1],m*y[1]+g*y[0]];l[d+".range[0]"]=r.l2r(b[0]),l[d+".range[1]"]=r.l2r(b[1])}s._cartesianSpikesEnabled=h}else{if("hovermode"!==a||"x"!==o&&"y"!==o){if("hovermode"===a&&"closest"===o){for(n=0;n<c.length;n++)r=c[n],"on"!==h||r.showspikes||(h="off");s._cartesianSpikesEnabled=h}}else o=s._isHoriz?"y":"x",i.setAttribute("data-val",o),"closest"!==o&&(s._cartesianSpikesEnabled="off");l[a]=o}u.relayout(t,l)}function i(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout._subplots.gl3d,o={},s=n.split("."),l=0;l<a.length;l++)o[a[l]+"."+s[1]]=i;u.relayout(t,o)}function a(t,e){for(var r=e.currentTarget.getAttribute("data-attr"),n=t._fullLayout,i=n._subplots.gl3d,a={},o=0;o<i.length;o++){var s=i[o],l=s+".camera",c=n[s]._scene;"resetDefault"===r?a[l]=null:"resetLastSave"===r&&(a[l]=d.extendDeep({},c.cameraInitial))}u.relayout(t,a)}function o(t,e){var r=e.currentTarget,n=r._previousVal||!1,i=t.layout,a=t._fullLayout,o=a._subplots.gl3d,s=["xaxis","yaxis","zaxis"],l=["showspikes","spikesides","spikethickness","spikecolor"],c={},h={},f={};if(n)f=d.extendDeep(i,n),r._previousVal=null;else{f={"allaxes.showspikes":!1};for(var p=0;p<o.length;p++){var m=o[p],g=a[m],v=c[m]={};v.hovermode=g.hovermode,f[m+".hovermode"]=!1;for(var y=0;y<3;y++){var b=s[y];h=v[b]={};for(var x=0;x<l.length;x++){var _=l[x];h[_]=g[b][_]}}}r._previousVal=d.extendDeep({},c)}u.relayout(t,f)}function s(t,e){for(var r=e.currentTarget,n=r.getAttribute("data-attr"),i=r.getAttribute("data-val")||!0,a=t._fullLayout,o=a._subplots.geo,s=0;s<o.length;s++){var l=o[s],h=a[l];if("zoom"===n){var f=h.projection.scale,d="in"===i?2*f:.5*f;u.relayout(t,l+".projection.scale",d)}else"reset"===n&&c(t,"geo")}}function l(t){var e,r=t._fullLayout;e=r._has("cartesian")?r._isHoriz?"y":"x":"closest";var n=!t._fullLayout.hovermode&&e;u.relayout(t,"hovermode",n)}function c(t,e){for(var r=t._fullLayout,n=r._subplots[e],i={},a=0;a<n.length;a++)for(var o=n[a],s=r[o]._subplot.viewInitial,l=Object.keys(s),c=0;c<l.length;c++){var h=l[c];i[o+"."+h]=s[h]}u.relayout(t,i)}var u=t("../../plotly"),h=t("../../plots/plots"),f=t("../../plots/cartesian/axis_ids"),d=t("../../lib"),p=t("../../snapshot/download"),m=t("../../../build/ploticon"),g=d._,v=e.exports={};v.toImage={name:"toImage",title:function(t){return g(t,"Download plot as a png")},icon:m.camera,click:function(t){var e="png";d.notifier(g(t,"Taking snapshot - this may take a few seconds"),"long"),d.isIE()&&(d.notifier(g(t,"IE only supports svg. Changing format to svg."),"long"),e="svg"),p(t,{format:e}).then(function(e){d.notifier(g(t,"Snapshot succeeded")+" - "+e,"long")}).catch(function(){d.notifier(g(t,"Sorry, there was a problem downloading your snapshot!"),"long")})}},v.sendDataToCloud={name:"sendDataToCloud",title:function(t){return g(t,"Edit in Chart Studio")},icon:m.disk,click:function(t){h.sendDataToCloud(t)}},v.zoom2d={name:"zoom2d",title:function(t){return g(t,"Zoom")},attr:"dragmode",val:"zoom",icon:m.zoombox,click:n},v.pan2d={name:"pan2d",title:function(t){return g(t,"Pan")},attr:"dragmode",val:"pan",icon:m.pan,click:n},v.select2d={name:"select2d",title:function(t){return g(t,"Box Select")},attr:"dragmode",val:"select",icon:m.selectbox,click:n},v.lasso2d={name:"lasso2d",title:function(t){return g(t,"Lasso Select")},attr:"dragmode",val:"lasso",icon:m.lasso,click:n},v.zoomIn2d={name:"zoomIn2d",title:function(t){return g(t,"Zoom in")},attr:"zoom",val:"in",icon:m.zoom_plus,click:n},v.zoomOut2d={name:"zoomOut2d",title:function(t){return g(t,"Zoom out")},attr:"zoom",val:"out",icon:m.zoom_minus,click:n},v.autoScale2d={name:"autoScale2d",title:function(t){return g(t,"Autoscale")},attr:"zoom",val:"auto",icon:m.autoscale,click:n},v.resetScale2d={name:"resetScale2d",title:function(t){return g(t,"Reset axes")},attr:"zoom",val:"reset",icon:m.home,click:n},v.hoverClosestCartesian={name:"hoverClosestCartesian",title:function(t){return g(t,"Show closest data on hover")},attr:"hovermode",val:"closest",icon:m.tooltip_basic,gravity:"ne",click:n},v.hoverCompareCartesian={name:"hoverCompareCartesian",title:function(t){return g(t,"Compare data on hover")},attr:"hovermode",val:function(t){return t._fullLayout._isHoriz?"y":"x"},icon:m.tooltip_compare,gravity:"ne",click:n},v.zoom3d={name:"zoom3d",title:function(t){return g(t,"Zoom")},attr:"scene.dragmode",val:"zoom",icon:m.zoombox,click:i},v.pan3d={name:"pan3d",title:function(t){return g(t,"Pan")},attr:"scene.dragmode",val:"pan",icon:m.pan,click:i},v.orbitRotation={name:"orbitRotation",title:function(t){return g(t,"Orbital rotation")},attr:"scene.dragmode",val:"orbit",icon:m["3d_rotate"],click:i},v.tableRotation={name:"tableRotation",title:function(t){return g(t,"Turntable rotation")},attr:"scene.dragmode",val:"turntable",icon:m["z-axis"],click:i},v.resetCameraDefault3d={name:"resetCameraDefault3d",title:function(t){return g(t,"Reset camera to default")},attr:"resetDefault",icon:m.home,click:a},v.resetCameraLastSave3d={name:"resetCameraLastSave3d",title:function(t){return g(t,"Reset camera to last save")},attr:"resetLastSave",icon:m.movie,click:a},v.hoverClosest3d={name:"hoverClosest3d",title:function(t){return g(t,"Toggle show closest data on hover")},attr:"hovermode",val:null,toggle:!0,icon:m.tooltip_basic,gravity:"ne",click:o},v.zoomInGeo={name:"zoomInGeo",title:function(t){return g(t,"Zoom in")},attr:"zoom",val:"in",icon:m.zoom_plus,click:s},v.zoomOutGeo={name:"zoomOutGeo",title:function(t){return g(t,"Zoom out")},attr:"zoom",val:"out",icon:m.zoom_minus,click:s},v.resetGeo={name:"resetGeo",title:function(t){return g(t,"Reset")},attr:"reset",val:null,icon:m.autoscale,click:s},v.hoverClosestGeo={name:"hoverClosestGeo",title:function(t){return g(t,"Toggle show closest data on hover")},attr:"hovermode",val:null,toggle:!0,icon:m.tooltip_basic,gravity:"ne",click:l},v.hoverClosestGl2d={name:"hoverClosestGl2d",title:function(t){return g(t,"Toggle show closest data on hover")},attr:"hovermode",val:null,toggle:!0,icon:m.tooltip_basic,gravity:"ne",click:l},v.hoverClosestPie={name:"hoverClosestPie",title:function(t){return g(t,"Toggle show closest data on hover")},attr:"hovermode",val:"closest",icon:m.tooltip_basic,gravity:"ne",click:l},v.toggleHover={name:"toggleHover",title:function(t){return g(t,"Toggle show closest data on hover")},attr:"hovermode",val:null,toggle:!0,icon:m.tooltip_basic,gravity:"ne",click:function(t,e){l(t),o(t,e)}},v.resetViews={name:"resetViews",title:function(t){return g(t,"Reset views")},icon:m.home,click:function(t,e){var r=e.currentTarget;r.setAttribute("data-attr","zoom"),r.setAttribute("data-val","reset"),n(t,e),r.setAttribute("data-attr","resetLastSave"),a(t,e),c(t,"geo"),c(t,"mapbox")}},v.toggleSpikelines={name:"toggleSpikelines",title:function(t){return g(t,"Toggle Spike Lines")},icon:m.spikeline,attr:"_cartesianSpikesEnabled",val:"on",click:function(t){var e=t._fullLayout;e._cartesianSpikesEnabled="closest"===e.hovermode&&"on"===e._cartesianSpikesEnabled?"off":"on";var r=function(t){for(var e=t._fullLayout,r=f.list(t,null,!0),n={},i=0;i<r.length;i++)n[r[i]._name+".showspikes"]="on"===e._cartesianSpikesEnabled;return n}(t);r.hovermode="closest",u.relayout(t,r)}},v.resetViewMapbox={name:"resetViewMapbox",title:function(t){return g(t,"Reset view")},attr:"reset",icon:m.home,click:function(t){c(t,"mapbox")}}},{"../../../build/ploticon":2,"../../lib":738,"../../plotly":780,"../../plots/cartesian/axis_ids":788,"../../plots/plots":846,"../../snapshot/download":863}],675:[function(t,e,r){"use strict";r.manage=t("./manage")},{"./manage":676}],676:[function(t,e,r){"use strict";function n(t,e,r){function n(t){for(var r=[],n=0;n<t.length;n++){var i=t[n];-1===e.indexOf(i)&&r.push(c[i])}y.push(r)}var l=t._fullLayout,u=t._fullData,h=l._has("cartesian"),f=l._has("gl3d"),d=l._has("geo"),p=l._has("pie"),m=l._has("gl2d"),g=l._has("ternary"),v=l._has("mapbox"),y=[];if(n(["toImage","sendDataToCloud"]),(h||m||p||g)+d+f>1)return n(["resetViews","toggleHover"]),i(y,r);f&&(n(["zoom3d","pan3d","orbitRotation","tableRotation"]),n(["resetCameraDefault3d","resetCameraLastSave3d"]),n(["hoverClosest3d"]));var b=function(t){for(var e=a.list({_fullLayout:t},null,!0),r=0;r<e.length;r++)if(!e[r].fixedrange)return!1;return!0}(l),x=[];return((h||m)&&!b||g)&&(x=["zoom2d","pan2d"]),(v||d)&&(x=["pan2d"]),function(t){for(var e=!1,r=0;r<t.length&&!e;r++){var n=t[r];n._module&&n._module.selectPoints&&(s.traceIs(n,"scatter-like")?(o.hasMarkers(n)||o.hasText(n))&&(e=!0):s.traceIs(n,"box-violin")?"all"!==n.boxpoints&&"all"!==n.points||(e=!0):e=!0)}return e}(u)&&(x.push("select2d"),x.push("lasso2d")),x.length&&n(x),!h&&!m||b||g||n(["zoomIn2d","zoomOut2d","autoScale2d","resetScale2d"]),h&&p?n(["toggleHover"]):m?n(["hoverClosestGl2d"]):h?n(["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]):p?n(["hoverClosestPie"]):v?n(["resetViewMapbox","toggleHover"]):d&&(n(["zoomInGeo","zoomOutGeo","resetGeo"]),n(["hoverClosestGeo"])),i(y,r)}function i(t,e){if(e.length)if(Array.isArray(e[0]))for(var r=0;r<e.length;r++)t.push(e[r]);else t.push(e);return t}var a=t("../../plots/cartesian/axis_ids"),o=t("../../traces/scatter/subtypes"),s=t("../../registry"),l=t("./modebar"),c=t("./buttons");e.exports=function(t){var e=t._fullLayout,r=t._context,i=e._modeBar;if(r.displayModeBar){if(!Array.isArray(r.modeBarButtonsToRemove))throw new Error(["*modeBarButtonsToRemove* configuration options","must be an array."].join(" "));if(!Array.isArray(r.modeBarButtonsToAdd))throw new Error(["*modeBarButtonsToAdd* configuration options","must be an array."].join(" "));var a,o=r.modeBarButtons;a=Array.isArray(o)&&o.length?function(t){for(var e=0;e<t.length;e++)for(var r=t[e],n=0;n<r.length;n++){var i=r[n];if("string"==typeof i){if(void 0===c[i])throw new Error(["*modeBarButtons* configuration options","invalid button name"].join(" "));t[e][n]=c[i]}}return t}(o):n(t,r.modeBarButtonsToRemove,r.modeBarButtonsToAdd),i?i.update(t,a):e._modeBar=l(t,a)}else i&&(i.destroy(),delete e._modeBar)}},{"../../plots/cartesian/axis_ids":788,"../../registry":861,"../../traces/scatter/subtypes":1076,"./buttons":674,"./modebar":677}],677:[function(t,e,r){"use strict";function n(t){this.container=t.container,this.element=document.createElement("div"),this.update(t.graphInfo,t.buttons),this.container.appendChild(this.element)}var i=t("d3"),a=t("../../lib"),o=t("../../../build/ploticon"),s=n.prototype;s.update=function(t,e){this.graphInfo=t;var r=this.graphInfo._context;"hover"===r.displayModeBar?this.element.className="modebar modebar--hover":this.element.className="modebar";var n=!this.hasButtons(e),i=this.hasLogo!==r.displaylogo;(n||i)&&(this.removeAllButtons(),this.updateButtons(e),r.displaylogo&&(this.element.appendChild(this.getLogo()),this.hasLogo=!0)),this.updateActiveButton()},s.updateButtons=function(t){var e=this;this.buttons=t,this.buttonElements=[],this.buttonsNames=[],this.buttons.forEach(function(t){var r=e.createGroup();t.forEach(function(t){var n=t.name;if(!n)throw new Error("must provide button 'name' in button config");if(-1!==e.buttonsNames.indexOf(n))throw new Error("button name '"+n+"' is taken");e.buttonsNames.push(n);var i=e.createButton(t);e.buttonElements.push(i),r.appendChild(i)}),e.element.appendChild(r)})},s.createGroup=function(){var t=document.createElement("div");return t.className="modebar-group",t},s.createButton=function(t){var e=this,r=document.createElement("a");r.setAttribute("rel","tooltip"),r.className="modebar-btn";var n=t.title;void 0===n?n=t.name:"function"==typeof n&&(n=n(this.graphInfo)),(n||0===n)&&r.setAttribute("data-title",n),void 0!==t.attr&&r.setAttribute("data-attr",t.attr);var a=t.val;void 0!==a&&("function"==typeof a&&(a=a(this.graphInfo)),r.setAttribute("data-val",a));if("function"!=typeof t.click)throw new Error("must provide button 'click' function in button config");return r.addEventListener("click",function(r){t.click(e.graphInfo,r),e.updateActiveButton(r.currentTarget)}),r.setAttribute("data-toggle",t.toggle||!1),t.toggle&&i.select(r).classed("active",!0),r.appendChild(this.createIcon(t.icon||o.question,t.name)),r.setAttribute("data-gravity",t.gravity||"n"),r},s.createIcon=function(t,e){var r=t.ascent-t.descent,n="http://www.w3.org/2000/svg",i=document.createElementNS(n,"svg"),a=document.createElementNS(n,"path");i.setAttribute("height","1em"),i.setAttribute("width",t.width/r+"em"),i.setAttribute("viewBox",[0,0,t.width,r].join(" "));var o="toggleSpikelines"===e?"matrix(1.5 0 0 -1.5 0 "+t.ascent+")":"matrix(1 0 0 -1 0 "+t.ascent+")";return a.setAttribute("d",t.path),a.setAttribute("transform",o),i.appendChild(a),i},s.updateActiveButton=function(t){var e=this.graphInfo._fullLayout,r=void 0!==t?t.getAttribute("data-attr"):null;this.buttonElements.forEach(function(t){var n=t.getAttribute("data-val")||!0,o=t.getAttribute("data-attr"),s="true"===t.getAttribute("data-toggle"),l=i.select(t);if(s)o===r&&l.classed("active",!l.classed("active"));else{var c=null===o?o:a.nestedProperty(e,o).get();l.classed("active",c===n)}})},s.hasButtons=function(t){var e=this.buttons;if(!e)return!1;if(t.length!==e.length)return!1;for(var r=0;r<t.length;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n<t[r].length;n++)if(t[r][n].name!==e[r][n].name)return!1}return!0},s.getLogo=function(){var t=this.createGroup(),e=document.createElement("a");return e.href="https://plot.ly/",e.target="_blank",e.setAttribute("data-title",a._(this.graphInfo,"Produced with Plotly")),e.className="modebar-btn plotlyjsicon modebar-btn--logo",e.appendChild(this.createIcon(o.plotlylogo)),t.appendChild(e),t},s.removeAllButtons=function(){for(;this.element.firstChild;)this.element.removeChild(this.element.firstChild);this.hasLogo=!1},s.destroy=function(){a.removeElement(this.container.querySelector(".modebar"))},e.exports=function(t,e){var r=t._fullLayout,a=new n({graphInfo:t,container:r._paperdiv.node(),buttons:e});return r._privateplot&&i.select(a.element).append("span").classed("badge-private float--left",!0).text("PRIVATE"),a}},{"../../../build/ploticon":2,"../../lib":738,d3:123}],678:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("./button_attributes");o=a(o,{_isLinkedToArray:"button"}),e.exports={visible:{valType:"boolean",editType:"plot"},buttons:o,x:{valType:"number",min:-2,max:3,editType:"plot"},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left",editType:"plot"},y:{valType:"number",min:-2,max:3,editType:"plot"},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"bottom",editType:"plot"},font:n({editType:"plot"}),bgcolor:{valType:"color",dflt:i.lightLine,editType:"plot"},activecolor:{valType:"color",editType:"plot"},bordercolor:{valType:"color",dflt:i.defaultLine,editType:"plot"},borderwidth:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"plot"}},{"../../lib/extend":727,"../../plots/font_attributes":810,"../color/attributes":612,"./button_attributes":679}],679:[function(t,e,r){"use strict";e.exports={step:{valType:"enumerated",values:["month","year","day","hour","minute","second","all"],dflt:"month",editType:"plot"},stepmode:{valType:"enumerated",values:["backward","todate"],dflt:"backward",editType:"plot"},count:{valType:"number",min:0,dflt:1,editType:"plot"},label:{valType:"string",editType:"plot"},editType:"plot"}},{}],680:[function(t,e,r){"use strict";e.exports={yPad:.02,minButtonWidth:30,rx:3,ry:3,lightAmount:25,darkAmount:10}},{}],681:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../color"),a=t("./attributes"),o=t("./button_attributes"),s=t("./constants");e.exports=function(t,e,r,l,c){function u(t,e){return n.coerce(h,f,a,t,e)}var h=t.rangeselector||{},f=e.rangeselector={};if(u("visible",function(t,e,r){function i(t,e){return n.coerce(a,s,o,t,e)}for(var a,s,l=t.buttons||[],c=e.buttons=[],u=0;u<l.length;u++)if(a=l[u],s={},n.isPlainObject(a)){var h=i("step");"all"!==h&&(!r||"gregorian"===r||"month"!==h&&"year"!==h?i("stepmode"):s.stepmode="backward",i("count")),i("label"),s._index=u,c.push(s)}return c}(h,f,c).length>0)){var d=function(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,a=0;a<n.length;a++){var o=e[n[a]].domain;o&&(i=Math.max(o[1],i))}return[t.domain[0],i+s.yPad]}(e,r,l);u("x",d[0]),u("y",d[1]),n.noneOrAll(t,e,["x","y"]),u("xanchor"),u("yanchor"),n.coerceFont(u,"font",r.font);var p=u("bgcolor");u("activecolor",i.contrast(p,s.lightAmount,s.darkAmount)),u("bordercolor"),u("borderwidth")}}},{"../../lib":738,"../color":613,"./attributes":678,"./button_attributes":679,"./constants":680}],682:[function(t,e,r){"use strict";function n(t){return t._id}function i(t,e,r){var n=t.selectAll("rect").data([0]);n.enter().append("rect").classed("selector-rect",!0),n.attr("shape-rendering","crispEdges"),n.attr({rx:m.rx,ry:m.ry}),n.call(c.stroke,e.bordercolor).call(c.fill,function(t,e){return e.isActive||e.isHovered?t.activecolor:t.bgcolor}(e,r)).style("stroke-width",e.borderwidth+"px")}function a(t,e,r,n){var i=t.selectAll("text").data([0]);i.enter().append("text").classed("selector-text",!0).classed("user-select-none",!0),i.attr("text-anchor","middle"),i.call(u.font,e.font).text(function(t){return t.label?t.label:"all"===t.step?"all":t.count+t.step.charAt(0)}(r)).call(function(t){h.convertToTspans(t,n)})}var o=t("d3"),s=t("../../plotly"),l=t("../../plots/plots"),c=t("../color"),u=t("../drawing"),h=t("../../lib/svg_text_utils"),f=t("../../plots/cartesian/axis_ids"),d=t("../legend/anchor_utils"),p=t("../../constants/alignment").LINE_SPACING,m=t("./constants"),g=t("./get_update_object");e.exports=function(t){var e=t._fullLayout._infolayer.selectAll(".rangeselector").data(function(t){for(var e=f.list(t,"x",!0),r=[],n=0;n<e.length;n++){var i=e[n];i.rangeselector&&i.rangeselector.visible&&r.push(i)}return r}(t),n);e.enter().append("g").classed("rangeselector",!0),e.exit().remove(),e.style({cursor:"pointer","pointer-events":"all"}),e.each(function(e){var r=o.select(this),n=e,c=n.rangeselector,f=r.selectAll("g.button").data(c.buttons);f.enter().append("g").classed("button",!0),f.exit().remove(),f.each(function(e){var r=o.select(this),l=g(n,e);e.isActive=function(t,e,r){if("all"===e.step)return!0===t.autorange;var n=Object.keys(r);return t.range[0]===r[n[0]]&&t.range[1]===r[n[1]]}(n,e,l),r.call(i,c,e),r.call(a,c,e,t),r.on("click",function(){t._dragged||s.relayout(t,l)}),r.on("mouseover",function(){e.isHovered=!0,r.call(i,c,e)}),r.on("mouseout",function(){e.isHovered=!1,r.call(i,c,e)})}),function(t,e,r,n){r.width=0,r.height=0;var i=r.borderwidth;e.each(function(){var t=o.select(this).select(".selector-text"),e=r.font.size*p,n=Math.max(e*h.lineCount(t),16)+3;r.height=Math.max(r.height,n)}),e.each(function(){var t=o.select(this),e=t.select(".selector-rect"),n=t.select(".selector-text"),a=n.node()&&u.bBox(n.node()).width,s=r.font.size*p,l=h.lineCount(n),c=Math.max(a+10,m.minButtonWidth);t.attr("transform","translate("+(i+r.width)+","+i+")"),e.attr({x:0,y:0,width:c,height:r.height}),h.positionText(n,c/2,r.height/2-(l-1)*s/2+3),r.width+=c+5}),e.selectAll("rect").attr("height",r.height);var a=t._fullLayout._size;r.lx=a.l+a.w*r.x,r.ly=a.t+a.h*(1-r.y);var s="left";d.isRightAnchor(r)&&(r.lx-=r.width,s="right"),d.isCenterAnchor(r)&&(r.lx-=r.width/2,s="center");var c="top";d.isBottomAnchor(r)&&(r.ly-=r.height,c="bottom"),d.isMiddleAnchor(r)&&(r.ly-=r.height/2,c="middle"),r.width=Math.ceil(r.width),r.height=Math.ceil(r.height),r.lx=Math.round(r.lx),r.ly=Math.round(r.ly),l.autoMargin(t,n+"-range-selector",{x:r.x,y:r.y,l:r.width*({right:1,center:.5}[s]||0),r:r.width*({left:1,center:.5}[s]||0),b:r.height*({top:1,middle:.5}[c]||0),t:r.height*({bottom:1,middle:.5}[c]||0)})}(t,f,c,n._name),r.attr("transform","translate("+c.lx+","+c.ly+")")})}},{"../../constants/alignment":711,"../../lib/svg_text_utils":761,"../../plotly":780,"../../plots/cartesian/axis_ids":788,"../../plots/plots":846,"../color":613,"../drawing":638,"../legend/anchor_utils":664,"./constants":680,"./get_update_object":683,d3:123}],683:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t,e){var r=t._name,i={};if("all"===e.step)i[r+".autorange"]=!0;else{var a=function(t,e){var r,i=t.range,a=new Date(t.r2l(i[1])),o=e.step,s=e.count;switch(e.stepmode){case"backward":r=t.l2r(+n.time[o].utc.offset(a,-s));break;case"todate":var l=n.time[o].utc.offset(a,-s);r=t.l2r(+n.time[o].utc.ceil(l))}return[r,i[1]]}(t,e);i[r+".range[0]"]=a[0],i[r+".range[1]"]=a[1]}return i}},{d3:123}],684:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"rangeselector",schema:{subplots:{xaxis:{rangeselector:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),draw:t("./draw")}},{"./attributes":678,"./defaults":681,"./draw":682}],685:[function(t,e,r){"use strict";var n=t("../color/attributes");e.exports={bgcolor:{valType:"color",dflt:n.background,editType:"calc"},bordercolor:{valType:"color",dflt:n.defaultLine,editType:"calc"},borderwidth:{valType:"integer",dflt:0,min:0,editType:"calc"},autorange:{valType:"boolean",dflt:!0,editType:"calc"},range:{valType:"info_array",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}],editType:"calc"},thickness:{valType:"number",dflt:.15,min:0,max:1,editType:"calc"},visible:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"}},{"../color/attributes":612}],686:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("./constants");e.exports=function(t){for(var e=n.list(t,"x",!0),r=0;r<e.length;r++){var a=e[r],o=a[i.name];o&&o.visible&&o.autorange&&a._min.length&&a._max.length&&(o._input.autorange=!0,o._input.range=o.range=n.getAutoRange(a))}}},{"../../plots/cartesian/axes":785,"./constants":687}],687:[function(t,e,r){"use strict";e.exports={name:"rangeslider",containerClassName:"rangeslider-container",bgClassName:"rangeslider-bg",rangePlotClassName:"rangeslider-rangeplot",maskMinClassName:"rangeslider-mask-min",maskMaxClassName:"rangeslider-mask-max",slideBoxClassName:"rangeslider-slidebox",grabberMinClassName:"rangeslider-grabber-min",grabAreaMinClassName:"rangeslider-grabarea-min",handleMinClassName:"rangeslider-handle-min",grabberMaxClassName:"rangeslider-grabber-max",grabAreaMaxClassName:"rangeslider-grabarea-max",handleMaxClassName:"rangeslider-handle-max",maskColor:"rgba(0,0,0,0.4)",slideBoxFill:"transparent",slideBoxCursor:"ew-resize",grabAreaFill:"transparent",grabAreaCursor:"col-resize",grabAreaWidth:10,handleWidth:4,handleRadius:1,handleStrokeWidth:1,extraPad:15}},{}],688:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){function a(t,e){return n.coerce(o,l,i,t,e)}if(t[r].rangeslider){n.isPlainObject(t[r].rangeslider)||(t[r].rangeslider={});var o=t[r].rangeslider,s=e[r],l=s.rangeslider={};if(a("visible")){if(a("bgcolor",e.plot_bgcolor),a("bordercolor"),a("borderwidth"),a("thickness"),a("autorange",!s.isValidRange(o.range)),a("range"),l.range){var c=l.range,u=s.range;c[0]=s.l2r(Math.min(s.r2l(c[0]),s.r2l(u[0]))),c[1]=s.l2r(Math.max(s.r2l(c[1]),s.r2l(u[1])))}s.cleanRange("rangeslider.range"),l._input=o}}}},{"../../lib":738,"./attributes":685}],689:[function(t,e,r){"use strict";function n(t,e,r,n){var i=t.select("rect."+x.slideBoxClassName).node(),a=t.select("rect."+x.grabAreaMinClassName).node(),o=t.select("rect."+x.grabAreaMaxClassName).node();t.on("mousedown",function(){function s(t){var s,l,c,y=+t.clientX-p;switch(f){case i:c="ew-resize",s=g+y,l=v+y;break;case a:c="col-resize",s=g+y,l=v;break;case o:c="col-resize",s=g,l=v+y;break;default:c="ew-resize",s=m,l=m+y}if(l<s){var _=l;l=s,s=_}n._pixelMin=s,n._pixelMax=l,b(u.select(x),c),function(t,e,r,n){function i(t){return r.l2r(d.constrain(t,n._rl[0],n._rl[1]))}var a=i(n.p2d(n._pixelMin)),o=i(n.p2d(n._pixelMax));window.requestAnimationFrame(function(){h.relayout(e,r._name+".range",[a,o])})}(0,e,r,n)}function l(){x.removeEventListener("mousemove",s),x.removeEventListener("mouseup",l),d.removeElement(x)}var c=u.event,f=c.target,p=c.clientX,m=p-t.node().getBoundingClientRect().left,g=n.d2p(r._rl[0]),v=n.d2p(r._rl[1]),x=y.coverSlip();x.addEventListener("mousemove",s),x.addEventListener("mouseup",l)})}function i(t,e,r,n){var i=t.selectAll("rect."+x.bgClassName).data([0]);i.enter().append("rect").classed(x.bgClassName,!0).attr({x:0,y:0,"shape-rendering":"crispEdges"});var a=n.borderwidth%2==0?n.borderwidth:n.borderwidth-1,o=-n._offsetShift,s=p.crispRound(e,n.borderwidth);i.attr({width:n._width+a,height:n._height+a,transform:"translate("+o+","+o+")",fill:n.bgcolor,stroke:n.bordercolor,"stroke-width":s})}function a(t,e,r,n){var i=e._fullLayout._topdefs.selectAll("#"+n._clipId).data([0]);i.enter().append("clipPath").attr("id",n._clipId).append("rect").attr({x:0,y:0}),i.select("rect").attr({width:n._width,height:n._height})}function o(t,e,r,n){var i=v.getSubplots(e,r),a=e.calcdata,o=t.selectAll("g."+x.rangePlotClassName).data(i,d.identity);o.enter().append("g").attr("class",function(t){return x.rangePlotClassName+" "+t}).call(p.setClipUrl,n._clipId),o.order(),o.exit().remove();var s;o.each(function(t,i){var o=u.select(this),l=0===i,c=v.getFromId(e,t,"y"),h=c._name,d={data:[],layout:{xaxis:{type:r.type,domain:[0,1],range:n.range.slice(),calendar:r.calendar},width:n._width,height:n._height,margin:{t:0,b:0,l:0,r:0}},_context:e._context};d.layout[h]={type:c.type,domain:[0,1],range:c.range.slice(),calendar:c.calendar},f.supplyDefaults(d);var p={id:t,plotgroup:o,xaxis:d._fullLayout.xaxis,yaxis:d._fullLayout[h]};l?s=p:(p.mainplot="xy",p.mainplotinfo=s),g.rangePlot(e,p,function(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=i[0].trace;a.xaxis+a.yaxis===e&&r.push(i)}return r}(a,t))})}function s(t,e,r,n){var i=t.selectAll("rect."+x.maskMinClassName).data([0]);i.enter().append("rect").classed(x.maskMinClassName,!0).attr({x:0,y:0}).attr("shape-rendering","crispEdges"),i.attr("height",n._height).call(m.fill,x.maskColor);var a=t.selectAll("rect."+x.maskMaxClassName).data([0]);a.enter().append("rect").classed(x.maskMaxClassName,!0).attr("y",0).attr("shape-rendering","crispEdges"),a.attr("height",n._height).call(m.fill,x.maskColor)}function l(t,e,r,n){if(!e._context.staticPlot){var i=t.selectAll("rect."+x.slideBoxClassName).data([0]);i.enter().append("rect").classed(x.slideBoxClassName,!0).attr("y",0).attr("cursor",x.slideBoxCursor).attr("shape-rendering","crispEdges"),i.attr({height:n._height,fill:x.slideBoxFill})}}function c(t,e,r,n){var i=t.selectAll("g."+x.grabberMinClassName).data([0]);i.enter().append("g").classed(x.grabberMinClassName,!0);var a=t.selectAll("g."+x.grabberMaxClassName).data([0]);a.enter().append("g").classed(x.grabberMaxClassName,!0);var o={x:0,width:x.handleWidth,rx:x.handleRadius,fill:m.background,stroke:m.defaultLine,"stroke-width":x.handleStrokeWidth,"shape-rendering":"crispEdges"},s={y:Math.round(n._height/4),height:Math.round(n._height/2)},l=i.selectAll("rect."+x.handleMinClassName).data([0]);l.enter().append("rect").classed(x.handleMinClassName,!0).attr(o),l.attr(s);var c=a.selectAll("rect."+x.handleMaxClassName).data([0]);if(c.enter().append("rect").classed(x.handleMaxClassName,!0).attr(o),c.attr(s),!e._context.staticPlot){var u={width:x.grabAreaWidth,x:0,y:0,fill:x.grabAreaFill,cursor:x.grabAreaCursor},h=i.selectAll("rect."+x.grabAreaMinClassName).data([0]);h.enter().append("rect").classed(x.grabAreaMinClassName,!0).attr(u),h.attr("height",n._height);var f=a.selectAll("rect."+x.grabAreaMaxClassName).data([0]);f.enter().append("rect").classed(x.grabAreaMaxClassName,!0).attr(u),f.attr("height",n._height)}}var u=t("d3"),h=t("../../plotly"),f=t("../../plots/plots"),d=t("../../lib"),p=t("../drawing"),m=t("../color"),g=t("../../plots/cartesian"),v=t("../../plots/cartesian/axes"),y=t("../dragelement"),b=t("../../lib/setcursor"),x=t("./constants");e.exports=function(t){var e=t._fullLayout,r=function(t){var e=v.list({_fullLayout:t},"x",!0),r=x.name,n=[];if(t._has("gl2d"))return n;for(var i=0;i<e.length;i++){var a=e[i];a[r]&&a[r].visible&&n.push(a)}return n}(e),h=e._infolayer.selectAll("g."+x.containerClassName).data(r,function(t){return t._name});h.enter().append("g").classed(x.containerClassName,!0).attr("pointer-events","all"),h.exit().each(function(t){var r=u.select(this),n=t[x.name];r.remove(),e._topdefs.select("#"+n._clipId).remove()}),h.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];-1!==i.indexOf(x.name)&&f.autoMargin(t,i)}}(t),0!==r.length&&h.each(function(r){var h=u.select(this),p=r[x.name],m=e[v.id2name(r.anchor)],g=e.margin,y=e._size,b=r.domain,_=m.domain,w=(r._boundingBox||{}).height||0;p._id=x.name+r._id,p._clipId=p._id+"-"+e._uid,p._width=y.w*(b[1]-b[0]),p._height=(e.height-g.b-g.t)*p.thickness,p._offsetShift=Math.floor(p.borderwidth/2);var M=Math.round(g.l+y.w*b[0]),k=Math.round(g.t+y.h*(1-_[0])+w+p._offsetShift+x.extraPad);h.attr("transform","translate("+M+","+k+")");var T=r.r2l(p.range[0]),A=r.r2l(p.range[1]),S=A-T;p.p2d=function(t){return t/p._width*S+T},p.d2p=function(t){return(t-T)/S*p._width},p._rl=[T,A],h.call(i,t,r,p).call(a,t,r,p).call(o,t,r,p).call(s,t,r,p).call(l,t,r,p).call(c,t,r,p),n(h,t,r,p),function(t,e,r,n){function i(t){return d.constrain(t,0,n._width)}function a(t){return d.constrain(t,-o,n._width+o)}var o=x.handleWidth/2,s=i(n.d2p(r._rl[0])),l=i(n.d2p(r._rl[1]));t.select("rect."+x.slideBoxClassName).attr("x",s).attr("width",l-s),t.select("rect."+x.maskMinClassName).attr("width",s),t.select("rect."+x.maskMaxClassName).attr("x",l).attr("width",n._width-l);var c=Math.round(a(s-o))-.5,u=Math.round(a(l-o))+.5;t.select("g."+x.grabberMinClassName).attr("transform","translate("+c+",0.5)"),t.select("g."+x.grabberMaxClassName).attr("transform","translate("+u+",0.5)")}(h,0,r,p),f.autoMargin(t,p._id,{x:b[0],y:_[0],l:0,r:0,t:0,b:p._height+g.b+w,pad:x.extraPad+2*p._offsetShift})})}},{"../../lib":738,"../../lib/setcursor":757,"../../plotly":780,"../../plots/cartesian":796,"../../plots/cartesian/axes":785,"../../plots/plots":846,"../color":613,"../dragelement":635,"../drawing":638,"./constants":687,d3:123}],690:[function(t,e,r){"use strict";e.exports={moduleType:"component",name:"rangeslider",schema:{subplots:{xaxis:{rangeslider:t("./attributes")}}},layoutAttributes:t("./attributes"),handleDefaults:t("./defaults"),calcAutorange:t("./calc_autorange"),draw:t("./draw")}},{"./attributes":685,"./calc_autorange":686,"./defaults":688,"./draw":689}],691:[function(t,e,r){"use strict";var n=t("../annotations/attributes"),i=t("../../traces/scatter/attributes").line,a=t("../drawing/attributes").dash,o=t("../../lib/extend").extendFlat;e.exports={_isLinkedToArray:"shape",visible:{valType:"boolean",dflt:!0,editType:"calcIfAutorange"},type:{valType:"enumerated",values:["circle","rect","path","line"],editType:"calcIfAutorange"},layer:{valType:"enumerated",values:["below","above"],dflt:"above",editType:"arraydraw"},xref:o({},n.xref,{}),x0:{valType:"any",editType:"calcIfAutorange"},x1:{valType:"any",editType:"calcIfAutorange"},yref:o({},n.yref,{}),y0:{valType:"any",editType:"calcIfAutorange"},y1:{valType:"any",editType:"calcIfAutorange"},path:{valType:"string",editType:"calcIfAutorange"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"arraydraw"},line:{color:o({},i.color,{editType:"arraydraw"}),width:o({},i.width,{editType:"calcIfAutorange"}),dash:o({},a,{editType:"arraydraw"}),editType:"calcIfAutorange"},fillcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"arraydraw"},editType:"arraydraw"}},{"../../lib/extend":727,"../../traces/scatter/attributes":1054,"../annotations/attributes":596,"../drawing/attributes":637}],692:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a="category"===t.type?t.r2c:t.d2c;if(void 0!==e)return[a(e),a(r)];if(n){var l,c,u,h,f=1/0,d=-1/0,p=n.match(o.segmentRE);for("date"===t.type&&(a=s.decodeDate(a)),l=0;l<p.length;l++)void 0!==(c=i[p[l].charAt(0)].drawn)&&(!(u=p[l].substr(1).match(o.paramRE))||u.length<c||((h=a(u[c]))<f&&(f=h),h>d&&(d=h)));return d>=f?[f,d]:void 0}}var i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("./constants"),s=t("./helpers");e.exports=function(t){var e=t._fullLayout,r=i.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var s=0;s<r.length;s++){var l,c,u=r[s],h=u.line.width/2;"paper"!==u.xref&&(c=n(l=a.getFromId(t,u.xref),u.x0,u.x1,u.path,o.paramIsX))&&a.expand(l,c,{ppad:h}),"paper"!==u.yref&&(c=n(l=a.getFromId(t,u.yref),u.y0,u.y1,u.path,o.paramIsY))&&a.expand(l,c,{ppad:h})}}},{"../../lib":738,"../../plots/cartesian/axes":785,"./constants":693,"./helpers":696}],693:[function(t,e,r){"use strict";e.exports={segmentRE:/[MLHVQCTSZ][^MLHVQCTSZ]*/g,paramRE:/[^\s,]+/g,paramIsX:{M:{0:!0,drawn:0},L:{0:!0,drawn:0},H:{0:!0,drawn:0},V:{},Q:{0:!0,2:!0,drawn:2},C:{0:!0,2:!0,4:!0,drawn:4},T:{0:!0,drawn:0},S:{0:!0,2:!0,drawn:2},Z:{}},paramIsY:{M:{1:!0,drawn:1},L:{1:!0,drawn:1},H:{},V:{0:!0,drawn:0},Q:{1:!0,3:!0,drawn:3},C:{1:!0,3:!0,5:!0,drawn:5},T:{1:!0,drawn:1},S:{1:!0,3:!0,drawn:5},Z:{}},numParams:{M:2,L:2,H:1,V:1,Q:4,C:6,T:2,S:4,Z:0}}},{}],694:[function(t,e,r){"use strict";var n=t("../../plots/array_container_defaults"),i=t("./shape_defaults");e.exports=function(t,e){n(t,e,{name:"shapes",handleItemDefaults:i})}},{"../../plots/array_container_defaults":782,"./shape_defaults":698}],695:[function(t,e,r){"use strict";function n(t,e){function r(r){var n={"data-index":e,"fill-rule":"evenodd",d:i(t,s)},d=s.line.width?s.line.color:"rgba(0,0,0,0)",m=r.append("path").attr(n).style("opacity",s.opacity).call(c.stroke,d).call(c.fill,s.fillcolor).call(u.dashLine,s.line.dash,s.line.width),g=(s.xref+s.yref).replace(/paper/g,"");m.call(u.setClipUrl,g?"clip"+t._fullLayout._uid+g:null),t._context.edits.shapePosition&&function(t,e,r,n){function s(t){var r=W.right-W.left,n=W.bottom-W.top,i=t.clientX-W.left,a=t.clientY-W.top,o=r>q&&n>G&&!t.shiftKey?h.getCursor(i/r,1-a/n):"move";f(e,o),H=o.split("-")[0]}function c(n,o){if("path"===r.type){var s=function(t){return U(N(t)+n)};R&&"date"===R.type&&(s=p.encodeDate(s));var l=function(t){return V(B(t)+o)};j&&"date"===j.type&&(l=p.encodeDate(l)),r.path=a(O,s,l),d[F]=r.path}else d[b]=r.x0=U(m+n),d[x]=r.y0=V(g+o),d[_]=r.x1=U(v+n),d[w]=r.y1=V(y+o);e.attr("d",i(t,r))}function u(n,o){if("path"===r.type){var s=function(t){return U(N(t)+n)};R&&"date"===R.type&&(s=p.encodeDate(s));var l=function(t){return V(B(t)+o)};j&&"date"===j.type&&(l=p.encodeDate(l)),r.path=a(O,s,l),d[F]=r.path}else{var c=~H.indexOf("n")?M+o:M,u=~H.indexOf("s")?k+o:k,h=~H.indexOf("w")?T+n:T,f=~H.indexOf("e")?A+n:A;u-c>G&&(d[S]=r[I]=V(c),d[E]=r[P]=V(u)),f-h>q&&(d[L]=r[D]=U(h),d[C]=r[z]=U(f))}e.attr("d",i(t,r))}var d,m,g,v,y,b,x,_,w,M,k,T,A,S,E,L,C,I,P,D,z,O,F,R,j,N,B,U,V,H,q=10,G=10,Y={element:e.node(),gd:t,prepFn:function(e){R=l.getFromId(t,r.xref),j=l.getFromId(t,r.yref),N=p.getDataToPixel(t,R),B=p.getDataToPixel(t,j,!0),U=p.getPixelToData(t,R),V=p.getPixelToData(t,j,!0);var i="shapes["+n+"]";"path"===r.type?(O=r.path,F=i+".path"):(m=N(r.x0),g=B(r.y0),v=N(r.x1),y=B(r.y1),b=i+".x0",x=i+".y0",_=i+".x1",w=i+".y1");m<v?(T=m,L=i+".x0",D="x0",A=v,C=i+".x1",z="x1"):(T=v,L=i+".x1",D="x1",A=m,C=i+".x0",z="x0");g<y?(M=g,S=i+".y0",I="y0",k=y,E=i+".y1",P="y1"):(M=y,S=i+".y1",I="y1",k=g,E=i+".y0",P="y0");d={},s(e),Y.moveFn="move"===H?c:u},doneFn:function(){f(e),o.relayout(t,d)}},W=Y.element.getBoundingClientRect();h.init(Y),e.node().onmousemove=s}(t,m,s,e)}t._fullLayout._paperdiv.selectAll('.shapelayer [data-index="'+e+'"]').remove();var n=(t.layout.shapes||[])[e],s=t._fullLayout.shapes[e];if(n&&!1!==s.visible)if("below"!==s.layer)r(t._fullLayout._shapeUpperLayer);else if("paper"===s.xref||"paper"===s.yref)r(t._fullLayout._shapeLowerLayer);else{var d=t._fullLayout._plots[s.xref+s.yref];if(d){r((d.mainplotinfo||d).shapelayer)}else r(t._fullLayout._shapeLowerLayer)}}function i(t,e){var r,n,i,a,o=e.type,c=l.getFromId(t,e.xref),u=l.getFromId(t,e.yref),h=t._fullLayout._size;if(c?(r=p.shapePositionToRange(c),n=function(t){return c._offset+c.r2p(r(t,!0))}):n=function(t){return h.l+h.w*t},u?(i=p.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return h.t+h.h*(1-t)},"path"===o)return c&&"date"===c.type&&(n=p.decodeDate(n)),u&&"date"===u.type&&(a=p.decodeDate(a)),function(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],l=d.numParams[i],c=t.substr(1).replace(d.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),++n>l&&(t="X"),t});return n>l&&(c=c.replace(/[\s,]*X.*/,""),s.log("Ignoring extra params in segment "+t)),i+c})}(e.path,n,a);var f=n(e.x0),m=n(e.x1),g=a(e.y0),v=a(e.y1);if("line"===o)return"M"+f+","+g+"L"+m+","+v;if("rect"===o)return"M"+f+","+g+"H"+m+"V"+v+"H"+f+"Z";var y=(f+m)/2,b=(g+v)/2,x=Math.abs(y-f),_=Math.abs(b-g),w="A"+x+","+_,M=y+x+","+b;return"M"+M+w+" 0 1,1 "+(y+","+(b-_))+w+" 0 0,1 "+M+"Z"}function a(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?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var o=t("../../plotly"),s=t("../../lib"),l=t("../../plots/cartesian/axes"),c=t("../color"),u=t("../drawing"),h=t("../dragelement"),f=t("../../lib/setcursor"),d=t("./constants"),p=t("./helpers");e.exports={draw:function(t){var e=t._fullLayout;e._shapeUpperLayer.selectAll("path").remove(),e._shapeLowerLayer.selectAll("path").remove(),e._shapeSubplotLayers.selectAll("path").remove();for(var r=0;r<e.shapes.length;r++)e.shapes[r].visible&&n(t,r)},drawOne:n}},{"../../lib":738,"../../lib/setcursor":757,"../../plotly":780,"../../plots/cartesian/axes":785,"../color":613,"../dragelement":635,"../drawing":638,"./constants":693,"./helpers":696}],696:[function(t,e,r){"use strict";r.rangeToShapePosition=function(t){return"log"===t.type?t.r2d:function(t){return t}},r.shapePositionToRange=function(t){return"log"===t.type?t.d2r:function(t){return t}},r.decodeDate=function(t){return function(e){return e.replace&&(e=e.replace("_"," ")),t(e)}},r.encodeDate=function(t){return function(e){return t(e).replace(" ","_")}},r.getDataToPixel=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.shapePositionToRange(e);i=function(t){return e._offset+e.r2p(o(t,!0))},"date"===e.type&&(i=r.decodeDate(i))}else i=n?function(t){return a.t+a.h*(1-t)}:function(t){return a.l+a.w*t};return i},r.getPixelToData=function(t,e,n){var i,a=t._fullLayout._size;if(e){var o=r.rangeToShapePosition(e);i=function(t){return o(e.p2r(t-e._offset))}}else i=n?function(t){return 1-(t-a.t)/a.h}:function(t){return(t-a.l)/a.w};return i}},{}],697:[function(t,e,r){"use strict";var n=t("./draw");e.exports={moduleType:"component",name:"shapes",layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),includeBasePlot:t("../../plots/cartesian/include_components")("shapes"),calcAutorange:t("./calc_autorange"),draw:n.draw,drawOne:n.drawOne}},{"../../plots/cartesian/include_components":795,"./attributes":691,"./calc_autorange":692,"./defaults":694,"./draw":695}],698:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("./attributes"),o=t("./helpers");e.exports=function(t,e,r,s,l){function c(r,i){return n.coerce(t,e,a,r,i)}s=s||{};if(!c("visible",!(l=l||{}).itemIsNotPlainObject))return e;c("layer"),c("opacity"),c("fillcolor"),c("line.color"),c("line.width"),c("line.dash");for(var u=c("type",t.path?"path":"rect"),h=["x","y"],f=0;f<2;f++){var d=h[f],p={_fullLayout:r},m=i.coerceRef(t,e,p,d,"","paper");if("path"!==u){var g,v,y;"paper"!==m?(g=i.getFromId(p,m),y=o.rangeToShapePosition(g),v=o.shapePositionToRange(g)):v=y=n.identity;var b=d+"0",x=d+"1",_=t[b],w=t[x];t[b]=v(t[b],!0),t[x]=v(t[x],!0),i.coercePosition(e,p,c,m,b,.25),i.coercePosition(e,p,c,m,x,.75),e[b]=y(e[b]),e[x]=y(e[x]),t[b]=_,t[x]=w}}return"path"===u?c("path"):n.noneOrAll(t,e,["x0","x1","y0","y1"]),e}},{"../../lib":738,"../../plots/cartesian/axes":785,"./attributes":691,"./helpers":696}],699:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/pad_attributes"),a=t("../../lib/extend").extendDeepAll,o=t("../../plot_api/edit_types").overrideAll,s=t("../../plots/animation_attributes"),l=t("./constants");e.exports=o({_isLinkedToArray:"slider",visible:{valType:"boolean",dflt:!0},active:{valType:"number",min:0,dflt:0},steps:{_isLinkedToArray:"step",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string"},value:{valType:"string"},execute:{valType:"boolean",dflt:!0}},lenmode:{valType:"enumerated",values:["fraction","pixels"],dflt:"fraction"},len:{valType:"number",min:0,dflt:1},x:{valType:"number",min:-2,max:3,dflt:0},pad:a({},i,{},{t:{dflt:20}}),xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"left"},y:{valType:"number",min:-2,max:3,dflt:0},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},transition:{duration:{valType:"number",min:0,dflt:150},easing:{valType:"enumerated",values:s.transition.easing.values,dflt:"cubic-in-out"}},currentvalue:{visible:{valType:"boolean",dflt:!0},xanchor:{valType:"enumerated",values:["left","center","right"],dflt:"left"},offset:{valType:"number",dflt:10},prefix:{valType:"string"},suffix:{valType:"string"},font:n({})},font:n({}),activebgcolor:{valType:"color",dflt:l.gripBgActiveColor},bgcolor:{valType:"color",dflt:l.railBgColor},bordercolor:{valType:"color",dflt:l.railBorderColor},borderwidth:{valType:"number",min:0,dflt:l.railBorderWidth},ticklen:{valType:"number",min:0,dflt:l.tickLength},tickcolor:{valType:"color",dflt:l.tickColor},tickwidth:{valType:"number",min:0,dflt:1},minorticklen:{valType:"number",min:0,dflt:l.minorTickLength}},"arraydraw","from-root")},{"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/animation_attributes":781,"../../plots/font_attributes":810,"../../plots/pad_attributes":845,"./constants":700}],700:[function(t,e,r){"use strict";e.exports={name:"sliders",containerClassName:"slider-container",groupClassName:"slider-group",inputAreaClass:"slider-input-area",railRectClass:"slider-rail-rect",railTouchRectClass:"slider-rail-touch-rect",gripRectClass:"slider-grip-rect",tickRectClass:"slider-tick-rect",inputProxyClass:"slider-input-proxy",labelsClass:"slider-labels",labelGroupClass:"slider-label-group",labelClass:"slider-label",currentValueClass:"slider-current-value",railHeight:5,menuIndexAttrName:"slider-active-index",autoMarginIdRoot:"slider-",minWidth:30,minHeight:30,textPadX:40,arrowOffsetX:4,railRadius:2,railWidth:5,railBorder:4,railBorderWidth:1,railBorderColor:"#bec8d9",railBgColor:"#f8fafc",railInset:8,stepInset:10,gripRadius:10,gripWidth:20,gripHeight:20,gripBorder:20,gripBorderWidth:1,gripBorderColor:"#bec8d9",gripBgColor:"#f6f8fa",gripBgActiveColor:"#dbdde0",labelPadding:8,labelOffset:0,tickWidth:1,tickColor:"#333",tickOffset:25,tickLength:7,minorTickOffset:25,minorTickColor:"#333",minorTickLength:4,currentValuePadding:8,currentValueInset:0}},{}],701:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,o,r,n)}if(n("visible",function(t,e){function r(t,e){return i.coerce(n,a,l,t,e)}var n,a,o=t.steps||[],s=e.steps=[];for(var c=0;c<o.length;c++)n=o[c],a={},r("method"),i.isPlainObject(n)&&("skip"===a.method||Array.isArray(n.args))&&(r("args"),r("label","step-"+c),r("value",a.label),r("execute"),s.push(a));return s}(t,e).length>0)){n("active"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("len"),n("lenmode"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font);n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),i.coerceFont(n,"currentvalue.font",e.font)),n("transition.duration"),n("transition.easing"),n("bgcolor"),n("activebgcolor"),n("bordercolor"),n("borderwidth"),n("ticklen"),n("tickwidth"),n("tickcolor"),n("minorticklen")}}var i=t("../../lib"),a=t("../../plots/array_container_defaults"),o=t("./attributes"),s=t("./constants").name,l=o.steps;e.exports=function(t,e){a(t,e,{name:s,handleItemDefaults:n})}},{"../../lib":738,"../../plots/array_container_defaults":782,"./attributes":699,"./constants":700}],702:[function(t,e,r){"use strict";function n(t){return t._index}function i(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]);switch(e.currentvalue.xanchor){case"right":n=e.inputAreaLength-M.currentValueInset-e.currentValueMaxWidth,i="left";break;case"center":n=.5*e.inputAreaLength,i="middle";break;default:n=M.currentValueInset,i="left"}a.enter().append("text").classed(M.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var o=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)o+=r;else{o+=e.steps[e.active].label}e.currentvalue.suffix&&(o+=e.currentvalue.suffix),a.call(x.font,e.currentvalue.font).text(o).call(_.convertToTspans,e.gd);var s=_.lineCount(a),l=(e.currentValueMaxLines+1-s)*e.currentvalue.font.size*k;return _.positionText(a,n,l),a}}function a(t,e,r){var n=t.selectAll("rect."+M.gripRectClass).data([0]);n.enter().append("rect").classed(M.gripRectClass,!0).call(u,e,t,r).style("pointer-events","all"),n.attr({width:M.gripWidth,height:M.gripHeight,rx:M.gripRadius,ry:M.gripRadius}).call(b.stroke,r.bordercolor).call(b.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function o(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(M.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(x.font,r.font).text(e.step.label).call(_.convertToTspans,r.gd),n}function s(t,e){var r=t.selectAll("g."+M.labelsClass).data([0]);r.enter().append("g").classed(M.labelsClass,!0);var n=r.selectAll("g."+M.labelGroupClass).data(e.labelSteps);n.enter().append("g").classed(M.labelGroupClass,!0),n.exit().remove(),n.each(function(t){var r=v.select(this);r.call(o,t,e),x.setTranslate(r,d(e,t.fraction),M.tickOffset+e.ticklen+e.font.size*k+M.labelOffset+e.currentValueTotalHeight)})}function l(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&c(t,e,r,a,!0,i)}function c(t,e,r,n,a,o){var s=r.active;r._input.active=r.active=n;var l=r.steps[r.active];e.call(f,r,r.active/(r.steps.length-1),o),e.call(i,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:a,previousActive:s}),l&&l.method&&a&&(e._nextMethod?(e._nextMethod.step=l,e._nextMethod.doCallback=a,e._nextMethod.doTransition=o):(e._nextMethod={step:l,doCallback:a,doTransition:o},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&y.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function u(t,e,r){function n(){return r.data()[0]}var i=r.node(),a=v.select(e);t.on("mousedown",function(){var t=n();e.emit("plotly_sliderstart",{slider:t});var o=r.select("."+M.gripRectClass);v.event.stopPropagation(),v.event.preventDefault(),o.call(b.fill,t.activebgcolor);var s=p(t,v.mouse(i)[0]);l(e,r,t,s,!0),t._dragging=!0,a.on("mousemove",function(){var t=n(),a=p(t,v.mouse(i)[0]);l(e,r,t,a,!1)}),a.on("mouseup",function(){var t=n();t._dragging=!1,o.call(b.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function h(t,e){var r=t.selectAll("rect."+M.tickRectClass).data(e.steps);r.enter().append("rect").classed(M.tickRectClass,!0),r.exit().remove(),r.attr({width:e.tickwidth+"px","shape-rendering":"crispEdges"}),r.each(function(t,r){var n=r%e.labelStride==0,i=v.select(this);i.attr({height:n?e.ticklen:e.minorticklen}).call(b.fill,e.tickcolor),x.setTranslate(i,d(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?M.tickOffset:M.minorTickOffset)+e.currentValueTotalHeight)})}function f(t,e,r,n){var i=t.select("rect."+M.gripRectClass),a=d(e,r);if(!e._invokingCommand){var o=i;n&&e.transition.duration>0&&(o=o.transition().duration(e.transition.duration).ease(e.transition.easing)),o.attr("transform","translate("+(a-.5*M.gripWidth)+","+e.currentValueTotalHeight+")")}}function d(t,e){return t.inputAreaStart+M.stepInset+(t.inputAreaLength-2*M.stepInset)*Math.min(1,Math.max(0,e))}function p(t,e){return Math.min(1,Math.max(0,(e-M.stepInset-t.inputAreaStart)/(t.inputAreaLength-2*M.stepInset-2*t.inputAreaStart)))}function m(t,e,r){var n=t.selectAll("rect."+M.railTouchRectClass).data([0]);n.enter().append("rect").classed(M.railTouchRectClass,!0).call(u,e,t,r).style("pointer-events","all"),n.attr({width:r.inputAreaLength,height:Math.max(r.inputAreaWidth,M.tickOffset+r.ticklen+r.labelHeight)}).call(b.fill,r.bgcolor).attr("opacity",0),x.setTranslate(n,0,r.currentValueTotalHeight)}function g(t,e){var r=t.selectAll("rect."+M.railRectClass).data([0]);r.enter().append("rect").classed(M.railRectClass,!0);var n=e.inputAreaLength-2*M.railInset;r.attr({width:n,height:M.railWidth,rx:M.railRadius,ry:M.railRadius,"shape-rendering":"crispEdges"}).call(b.stroke,e.bordercolor).call(b.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),x.setTranslate(r,M.railInset,.5*(e.inputAreaWidth-M.railWidth)+e.currentValueTotalHeight)}var v=t("d3"),y=t("../../plots/plots"),b=t("../color"),x=t("../drawing"),_=t("../../lib/svg_text_utils"),w=t("../legend/anchor_utils"),M=t("./constants"),k=t("../../constants/alignment").LINE_SPACING;e.exports=function(t){var e=t._fullLayout,r=function(t,e){for(var r=t[M.name],n=[],i=0;i<r.length;i++){var a=r[i];a.visible&&a.steps.length&&(a.gd=e,n.push(a))}return n}(e,t),l=e._infolayer.selectAll("g."+M.containerClassName).data(r.length>0?[0]:[]);if(l.enter().append("g").classed(M.containerClassName,!0).style("cursor","ew-resize"),l.exit().remove(),l.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];-1!==i.indexOf(M.autoMarginIdRoot)&&y.autoMargin(t,i)}}(t),0!==r.length){var u=l.selectAll("g."+M.groupClassName).data(r,n);u.enter().append("g").classed(M.groupClassName,!0),u.exit().each(function(e){v.select(this).remove(),e._commandObserver.remove(),delete e._commandObserver,y.autoMargin(t,M.autoMarginIdRoot+e._index)});for(var d=0;d<r.length;d++){var p=r[d];!function(t,e){var r=x.tester.selectAll("g."+M.labelGroupClass).data(e.steps);r.enter().append("g").classed(M.labelGroupClass,!0);var n=0,a=0;r.each(function(t){var r=o(v.select(this),{step:t},e).node();if(r){var i=x.bBox(r);a=Math.max(a,i.height),n=Math.max(n,i.width)}}),r.remove(),e.inputAreaWidth=Math.max(M.railWidth,M.gripHeight);var s=t._fullLayout._size;e.lx=s.l+s.w*e.x,e.ly=s.t+s.h*(1-e.y),"fraction"===e.lenmode?e.outerLength=Math.round(s.w*e.len):e.outerLength=e.len,e.lenPad=Math.round(.5*M.gripWidth),e.inputAreaStart=0,e.inputAreaLength=Math.round(e.outerLength-e.pad.l-e.pad.r);var l=(e.inputAreaLength-2*M.stepInset)/(e.steps.length-1),c=n+M.labelPadding;if(e.labelStride=Math.max(1,Math.ceil(c/l)),e.labelHeight=a,e.currentValueMaxWidth=0,e.currentValueHeight=0,e.currentValueTotalHeight=0,e.currentValueMaxLines=1,e.currentvalue.visible){var u=x.tester.append("g");r.each(function(t){var r=i(u,e,t.label),n=r.node()&&x.bBox(r.node())||{width:0,height:0},a=_.lineCount(r);e.currentValueMaxWidth=Math.max(e.currentValueMaxWidth,Math.ceil(n.width)),e.currentValueHeight=Math.max(e.currentValueHeight,Math.ceil(n.height)),e.currentValueMaxLines=Math.max(e.currentValueMaxLines,a)}),e.currentValueTotalHeight=e.currentValueHeight+e.currentvalue.offset,u.remove()}e.height=e.currentValueTotalHeight+M.tickOffset+e.ticklen+M.labelOffset+e.labelHeight+e.pad.t+e.pad.b;var h="left";w.isRightAnchor(e)&&(e.lx-=e.outerLength,h="right"),w.isCenterAnchor(e)&&(e.lx-=e.outerLength/2,h="center");var f="top";w.isBottomAnchor(e)&&(e.ly-=e.height,f="bottom"),w.isMiddleAnchor(e)&&(e.ly-=e.height/2,f="middle"),e.outerLength=Math.ceil(e.outerLength),e.height=Math.ceil(e.height),e.lx=Math.round(e.lx),e.ly=Math.round(e.ly),y.autoMargin(t,M.autoMarginIdRoot+e._index,{x:e.x,y:e.y,l:e.outerLength*({right:1,center:.5}[h]||0),r:e.outerLength*({left:1,center:.5}[h]||0),b:e.height*({top:1,middle:.5}[f]||0),t:e.height*({bottom:1,middle:.5}[f]||0)})}(t,p)}u.each(function(e){if(!(e.steps.length<2)){var r=v.select(this);!function(t){t.labelSteps=[];for(var e=t.steps.length,r=0;r<e;r+=t.labelStride)t.labelSteps.push({fraction:r/(e-1),step:t.steps[r]})}(e),y.manageCommandObserver(t,e,e.steps,function(e){var n=r.data()[0];n.active!==e.index&&(n._dragging||c(t,r,n,e.index,!1,!0))}),function(t,e,r){r.active>=r.steps.length&&(r.active=0),e.call(i,r).call(g,r).call(s,r).call(h,r).call(m,t,r).call(a,t,r),x.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(f,r,r.active/(r.steps.length-1),!1),e.call(i,r)}(t,v.select(this),e)}})}}},{"../../constants/alignment":711,"../../lib/svg_text_utils":761,"../../plots/plots":846,"../color":613,"../drawing":638,"../legend/anchor_utils":664,"./constants":700,d3:123}],703:[function(t,e,r){"use strict";var n=t("./constants");e.exports={moduleType:"component",name:n.name,layoutAttributes:t("./attributes"),supplyLayoutDefaults:t("./defaults"),draw:t("./draw")}},{"./attributes":699,"./constants":700,"./defaults":701,"./draw":702}],704:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../../plotly"),o=t("../../plots/plots"),s=t("../../lib"),l=t("../drawing"),c=t("../color"),u=t("../../lib/svg_text_utils"),h=t("../../constants/interactions"),f=/ [XY][0-9]* /;(e.exports={}).draw=function(t,e,r){function d(t){s.syncOrAsync([p,m],t)}function p(e){return e.attr("transform",M?"rotate("+[M.rotate,w.x,w.y]+") translate(0, "+M.offset+")":null),e.style({"font-family":A,"font-size":n.round(S,2)+"px",fill:c.rgb(E),opacity:L*c.opacity(E),"font-weight":o.fontWeight}).attr(w).call(u.convertToTspans,t),o.previousPromises(t)}function m(t){var e=n.select(t.node().parentNode);if(_&&_.selection&&_.side&&I){e.attr("transform",null);var r=0,a={left:"right",right:"left",top:"bottom",bottom:"top"}[_.side],o=-1!==["left","top"].indexOf(_.side)?-1:1,c=i(_.pad)?_.pad:2,u=l.bBox(e.node()),h={left:0,top:0,right:T.width,bottom:T.height},f=_.maxShift||(h[_.side]-u[_.side])*("left"===_.side||"top"===_.side?-1:1);if(f<0)r=f;else{var d=_.offsetLeft||0,p=_.offsetTop||0;u.left-=d,u.right-=d,u.top-=p,u.bottom-=p,_.selection.each(function(){var t=l.bBox(this);s.bBoxIntersect(u,t,c)&&(r=Math.max(r,o*(t[_.side]-u[a])+c))}),r=Math.min(f,r)}if(r>0||f<0){var m={left:[-r,0],right:[r,0],top:[0,-r],bottom:[0,r]}[_.side];e.attr("transform","translate("+m+")")}}}var g,v=r.propContainer,y=r.propName,b=r.placeholder,x=r.traceIndex,_=r.avoid||{},w=r.attributes,M=r.transform,k=r.containerGroup,T=t._fullLayout,A=v.titlefont.family,S=v.titlefont.size,E=v.titlefont.color,L=1,C=!1,I=v.title.trim();"title"===y?g="titleText":-1!==y.indexOf("axis")?g="axisTitleText":y.indexOf(!0)&&(g="colorbarTitleText");var P=t._context.edits[g];""===I?L=0:I.replace(f," % ")===b.replace(f," % ")&&(L=.2,C=!0,P||(I=""));var D=I||P;k||(k=T._infolayer.selectAll(".g-"+e).data([0])).enter().append("g").classed("g-"+e,!0);var z=k.selectAll("text").data(D?[0]:[]);z.enter().append("text"),z.text(I).attr("class",e),z.exit().remove(),D&&(z.call(d),P&&(I?z.on(".opacity",null):(L=0,C=!0,z.text(b).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)})),z.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==x?a.restyle(t,y,e,x):a.relayout(t,y,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(d)}).on("input",function(t){this.text(t||" ").call(u.positionText,w.x,w.y)})),z.classed("js-placeholder",C))}},{"../../constants/interactions":716,"../../lib":738,"../../lib/svg_text_utils":761,"../../plotly":780,"../../plots/plots":846,"../color":613,"../drawing":638,d3:123,"fast-isnumeric":132}],705:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../color/attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,s=t("../../plots/pad_attributes");e.exports=o({_isLinkedToArray:"updatemenu",_arrayAttrRegexps:[/^updatemenus\[(0|[1-9][0-9]+)\]\.buttons/],visible:{valType:"boolean"},type:{valType:"enumerated",values:["dropdown","buttons"],dflt:"dropdown"},direction:{valType:"enumerated",values:["left","right","up","down"],dflt:"down"},active:{valType:"integer",min:-1,dflt:0},showactive:{valType:"boolean",dflt:!0},buttons:{_isLinkedToArray:"button",method:{valType:"enumerated",values:["restyle","relayout","animate","update","skip"],dflt:"restyle"},args:{valType:"info_array",freeLength:!0,items:[{valType:"any"},{valType:"any"},{valType:"any"}]},label:{valType:"string",dflt:""},execute:{valType:"boolean",dflt:!0}},x:{valType:"number",min:-2,max:3,dflt:-.05},xanchor:{valType:"enumerated",values:["auto","left","center","right"],dflt:"right"},y:{valType:"number",min:-2,max:3,dflt:1},yanchor:{valType:"enumerated",values:["auto","top","middle","bottom"],dflt:"top"},pad:a({},s,{}),font:n({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:i.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}},"arraydraw","from-root")},{"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/font_attributes":810,"../../plots/pad_attributes":845,"../color/attributes":612}],706:[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"}}},{}],707:[function(t,e,r){"use strict";function n(t,e,r){function n(r,n){return i.coerce(t,e,o,r,n)}n("visible",function(t,e){function r(t,e){return i.coerce(n,a,l,t,e)}var n,a,o=t.buttons||[],s=e.buttons=[];for(var c=0;c<o.length;c++)n=o[c],a={},r("method"),i.isPlainObject(n)&&("skip"===a.method||Array.isArray(n.args))&&(r("args"),r("label"),r("execute"),a._index=c,s.push(a));return s}(t,e).length>0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),i.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),i.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}var i=t("../../lib"),a=t("../../plots/array_container_defaults"),o=t("./attributes"),s=t("./constants").name,l=o.buttons;e.exports=function(t,e){a(t,e,{name:s,handleItemDefaults:n})}},{"../../lib":738,"../../plots/array_container_defaults":782,"./attributes":705,"./constants":706}],708:[function(t,e,r){"use strict";function n(t){return t._index}function i(t,e){return+t.attr(M.menuIndexAttrName)===e._index}function a(t,e,r,n,i,a,l,c){e._input.active=e.active=l,"buttons"===e.type?s(t,n,null,null,e):"dropdown"===e.type&&(i.attr(M.menuIndexAttrName,"-1"),o(t,n,i,a,e),c||s(t,n,i,a,e))}function o(t,e,r,n,a){var o=e.selectAll("g."+M.headerClassName).data([0]);o.enter().append("g").classed(M.headerClassName,!0).style("pointer-events","all");var c=a.active,u=a.buttons[c]||M.blankHeaderOpts,h={y:a.pad.t,yPad:0,x:a.pad.l,xPad:0,index:0},g={width:a.headerWidth,height:a.headerHeight};o.call(l,a,u,t).call(p,a,h,g);var v=e.selectAll("text."+M.headerArrowClassName).data([0]);v.enter().append("text").classed(M.headerArrowClassName,!0).classed("user-select-none",!0).attr("text-anchor","end").call(b.font,a.font).text(M.arrowSymbol[a.direction]),v.attr({x:a.headerWidth-M.arrowOffsetX+a.pad.l,y:a.headerHeight/2+M.textOffsetY+a.pad.t}),o.on("click",function(){r.call(m),r.attr(M.menuIndexAttrName,i(r,a)?-1:String(a._index)),s(t,e,r,n,a)}),o.on("mouseover",function(){o.call(f)}),o.on("mouseout",function(){o.call(d,a)}),b.setTranslate(e,a.lx,a.ly)}function s(t,e,r,n,i){r||(r=e).attr("pointer-events","all");var o=function(t){return-1==+t.attr(M.menuIndexAttrName)}(r)&&"buttons"!==i.type?[]:i.buttons,s="dropdown"===i.type?M.dropdownButtonClassName:M.buttonClassName,c=r.selectAll("g."+s).data(o),u=c.enter().append("g").classed(s,!0),m=c.exit();"dropdown"===i.type?(u.attr("opacity","0").transition().attr("opacity","1"),m.transition().attr("opacity","0").remove()):m.remove();var y=0,b=0,x=-1!==["up","down"].indexOf(i.direction);"dropdown"===i.type&&(x?b=i.headerHeight+M.gapButtonHeader:y=i.headerWidth+M.gapButtonHeader),"dropdown"===i.type&&"up"===i.direction&&(b=-M.gapButtonHeader+M.gapButton-i.openHeight),"dropdown"===i.type&&"left"===i.direction&&(y=-M.gapButtonHeader+M.gapButton-i.openWidth);var _={x:i.lx+y+i.pad.l,y:i.ly+b+i.pad.t,yPad:M.gapButton,xPad:M.gapButton,index:0},w={l:_.x+i.borderwidth,t:_.y+i.borderwidth};c.each(function(o,s){var u=g.select(this);u.call(l,i,o,t).call(p,i,_),u.on("click",function(){g.event.defaultPrevented||(a(t,i,0,e,r,n,s),o.execute&&v.executeAPICommand(t,o.method,o.args),t.emit("plotly_buttonclicked",{menu:i,button:o,active:i.active}))}),u.on("mouseover",function(){u.call(f)}),u.on("mouseout",function(){u.call(d,i),c.call(h,i)})}),c.call(h,i),x?(w.w=Math.max(i.openWidth,i.headerWidth),w.h=_.y-w.t):(w.w=_.x-w.l,w.h=Math.max(i.openHeight,i.headerHeight)),w.direction=i.direction,n&&(c.size()?function(t,e,r,n,i,a){var o,s,l,c=i.direction,u="up"===c||"down"===c,h=i.active;if(u)for(s=0,l=0;l<h;l++)s+=i.heights[l]+M.gapButton;else for(o=0,l=0;l<h;l++)o+=i.widths[l]+M.gapButton;n.enable(a,o,s),n.hbar&&n.hbar.attr("opacity","0").transition().attr("opacity","1");n.vbar&&n.vbar.attr("opacity","0").transition().attr("opacity","1")}(0,0,0,n,i,w):function(t){var e=!!t.hbar,r=!!t.vbar;e&&t.hbar.transition().attr("opacity","0").each("end",function(){e=!1,r||t.disable()});r&&t.vbar.transition().attr("opacity","0").each("end",function(){r=!1,e||t.disable()})}(n))}function l(t,e,r,n){t.call(c,e).call(u,e,r,n)}function c(t,e){var r=t.selectAll("rect").data([0]);r.enter().append("rect").classed(M.itemRectClassName,!0).attr({rx:M.rx,ry:M.ry,"shape-rendering":"crispEdges"}),r.call(y.stroke,e.bordercolor).call(y.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px")}function u(t,e,r,n){var i=t.selectAll("text").data([0]);i.enter().append("text").classed(M.itemTextClassName,!0).classed("user-select-none",!0).attr({"text-anchor":"start","data-notex":1}),i.call(b.font,e.font).text(r.label).call(x.convertToTspans,n)}function h(t,e){var r=e.active;t.each(function(t,n){var i=g.select(this);n===r&&e.showactive&&i.select("rect."+M.itemRectClassName).call(y.fill,M.activeColor)})}function f(t){t.select("rect."+M.itemRectClassName).call(y.fill,M.hoverColor)}function d(t,e){t.select("rect."+M.itemRectClassName).call(y.fill,e.bgcolor)}function p(t,e,r,n){n=n||{};var i=t.select("."+M.itemRectClassName),a=t.select("."+M.itemTextClassName),o=e.borderwidth,s=r.index;b.setTranslate(t,o+r.x,o+r.y);var l=-1!==["up","down"].indexOf(e.direction),c=n.height||(l?e.heights[s]:e.height1);i.attr({x:0,y:0,width:n.width||(l?e.width1:e.widths[s]),height:c});var u=e.font.size*w,h=(x.lineCount(a)-1)*u/2;x.positionText(a,M.textOffsetX,c/2-h+M.textOffsetY),l?r.y+=e.heights[s]+r.yPad:r.x+=e.widths[s]+r.xPad,r.index++}function m(t){t.selectAll("g."+M.dropdownButtonClassName).remove()}var g=t("d3"),v=t("../../plots/plots"),y=t("../color"),b=t("../drawing"),x=t("../../lib/svg_text_utils"),_=t("../legend/anchor_utils"),w=t("../../constants/alignment").LINE_SPACING,M=t("./constants"),k=t("./scrollbox");e.exports=function(t){var e=t._fullLayout,r=function(t){for(var e=t[M.name],r=[],n=0;n<e.length;n++){var i=e[n];i.visible&&r.push(i)}return r}(e),c=e._menulayer.selectAll("g."+M.containerClassName).data(r.length>0?[0]:[]);if(c.enter().append("g").classed(M.containerClassName,!0).style("cursor","pointer"),c.exit().remove(),c.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n<r.length;n++){var i=r[n];-1!==i.indexOf(M.autoMarginIdRoot)&&v.autoMargin(t,i)}}(t),0!==r.length){var u=c.selectAll("g."+M.headerGroupClassName).data(r,n);u.enter().append("g").classed(M.headerGroupClassName,!0);var h=c.selectAll("g."+M.dropdownButtonGroupClassName).data([0]);h.enter().append("g").classed(M.dropdownButtonGroupClassName,!0).style("pointer-events","all");for(var f=0;f<r.length;f++){var d=r[f];!function(t,e){e.width1=0,e.height1=0,e.heights=[],e.widths=[],e.totalWidth=0,e.totalHeight=0,e.openWidth=0,e.openHeight=0,e.lx=0,e.ly=0;var r=b.tester.selectAll("g."+M.dropdownButtonClassName).data(e.buttons);r.enter().append("g").classed(M.dropdownButtonClassName,!0);var n=-1!==["up","down"].indexOf(e.direction);r.each(function(r,i){var a=g.select(this);a.call(l,e,r,t);var o=a.select("."+M.itemTextClassName),s=o.node()&&b.bBox(o.node()).width,c=Math.max(s+M.textPadX,M.minWidth),u=e.font.size*w,h=x.lineCount(o),f=Math.max(u*h,M.minHeight)+M.textOffsetY;f=Math.ceil(f),c=Math.ceil(c),e.widths[i]=c,e.heights[i]=f,e.height1=Math.max(e.height1,f),e.width1=Math.max(e.width1,c),n?(e.totalWidth=Math.max(e.totalWidth,c),e.openWidth=e.totalWidth,e.totalHeight+=f+M.gapButton,e.openHeight+=f+M.gapButton):(e.totalWidth+=c+M.gapButton,e.openWidth+=c+M.gapButton,e.totalHeight=Math.max(e.totalHeight,f),e.openHeight=e.totalHeight)}),n?e.totalHeight-=M.gapButton:e.totalWidth-=M.gapButton,e.headerWidth=e.width1+M.arrowPadX,e.headerHeight=e.height1,"dropdown"===e.type&&(n?(e.width1+=M.arrowPadX,e.totalHeight=e.height1):e.totalWidth=e.width1,e.totalWidth+=M.arrowPadX),r.remove();var i=e.totalWidth+e.pad.l+e.pad.r,a=e.totalHeight+e.pad.t+e.pad.b,o=t._fullLayout._size;e.lx=o.l+o.w*e.x,e.ly=o.t+o.h*(1-e.y);var s="left";_.isRightAnchor(e)&&(e.lx-=i,s="right"),_.isCenterAnchor(e)&&(e.lx-=i/2,s="center");var c="top";_.isBottomAnchor(e)&&(e.ly-=a,c="bottom"),_.isMiddleAnchor(e)&&(e.ly-=a/2,c="middle"),e.totalWidth=Math.ceil(e.totalWidth),e.totalHeight=Math.ceil(e.totalHeight),e.lx=Math.round(e.lx),e.ly=Math.round(e.ly),v.autoMargin(t,M.autoMarginIdRoot+e._index,{x:e.x,y:e.y,l:i*({right:1,center:.5}[s]||0),r:i*({left:1,center:.5}[s]||0),b:a*({top:1,middle:.5}[c]||0),t:a*({bottom:1,middle:.5}[c]||0)})}(t,d)}var p="updatemenus"+e._uid,y=new k(t,h,p);u.enter().size()&&(h.node().parentNode.appendChild(h.node()),h.call(m).attr(M.menuIndexAttrName,"-1")),u.exit().each(function(e){g.select(this).remove(),h.call(m).attr(M.menuIndexAttrName,"-1"),v.autoMargin(t,M.autoMarginIdRoot+e._index)}),u.each(function(e){var r=g.select(this),n="dropdown"===e.type?h:null;v.manageCommandObserver(t,e,e.buttons,function(i){a(t,e,e.buttons[i.index],r,n,y,i.index,!0)}),"dropdown"===e.type?(o(t,r,h,y,e),i(h,e)&&s(t,r,h,y,e)):s(t,r,null,null,e)})}}},{"../../constants/alignment":711,"../../lib/svg_text_utils":761,"../../plots/plots":846,"../color":613,"../drawing":638,"../legend/anchor_utils":664,"./constants":706,"./scrollbox":710,d3:123}],709:[function(t,e,r){arguments[4][703][0].apply(r,arguments)},{"./attributes":705,"./constants":706,"./defaults":707,"./draw":708,dup:703}],710:[function(t,e,r){"use strict";function n(t,e,r){this.gd=t,this.container=e,this.id=r,this.position=null,this.translateX=null,this.translateY=null,this.hbar=null,this.vbar=null,this.bg=this.container.selectAll("rect.scrollbox-bg").data([0]),this.bg.exit().on(".drag",null).on("wheel",null).remove(),this.bg.enter().append("rect").classed("scrollbox-bg",!0).style("pointer-events","all").attr({opacity:0,x:0,y:0,width:0,height:0})}e.exports=n;var i=t("d3"),a=t("../color"),o=t("../drawing"),s=t("../../lib");n.barWidth=2,n.barLength=20,n.barRadius=2,n.barPad=1,n.barColor="#808BA4",n.prototype.enable=function(t,e,r){var s=this.gd._fullLayout,l=s.width,c=s.height;this.position=t;var u,h,f,d,p=this.position.l,m=this.position.w,g=this.position.t,v=this.position.h,y=this.position.direction,b="down"===y,x="left"===y,_="up"===y,w=m,M=v;b||x||"right"===y||_||(this.position.direction="down",b=!0);b||_?(h=(u=p)+w,b?(f=g,M=(d=Math.min(f+M,c))-f):M=(d=g+M)-(f=Math.max(d-M,0))):(d=(f=g)+M,x?w=(h=p+w)-(u=Math.max(h-w,0)):(u=p,w=(h=Math.min(u+w,l))-u)),this._box={l:u,t:f,w:w,h:M};var k=m>w,T=n.barLength+2*n.barPad,A=n.barWidth+2*n.barPad,S=p,E=g+v;E+A>c&&(E=c-A);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(a.fill,n.barColor),k?(this.hbar=L.attr({rx:n.barRadius,ry:n.barRadius,x:S,y:E,width:T,height:A}),this._hbarXMin=S+T/2,this._hbarTranslateMax=w-T):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var C=v>M,I=n.barWidth+2*n.barPad,P=n.barLength+2*n.barPad,D=p+m,z=g;D+I>l&&(D=l-I);var O=this.container.selectAll("rect.scrollbar-vertical").data(C?[0]:[]);O.exit().on(".drag",null).remove(),O.enter().append("rect").classed("scrollbar-vertical",!0).call(a.fill,n.barColor),C?(this.vbar=O.attr({rx:n.barRadius,ry:n.barRadius,x:D,y:z,width:I,height:P}),this._vbarYMin=z+P/2,this._vbarTranslateMax=M-P):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,R=u-.5,j=C?h+I+.5:h+.5,N=f-.5,B=k?d+A+.5:d+.5,U=s._topdefs.selectAll("#"+F).data(k||C?[0]:[]);if(U.exit().remove(),U.enter().append("clipPath").attr("id",F).append("rect"),k||C?(this._clipRect=U.select("rect").attr({x:Math.floor(R),y:Math.floor(N),width:Math.ceil(j)-Math.floor(R),height:Math.ceil(B)-Math.floor(N)}),this.container.call(o.setClipUrl,F),this.bg.attr({x:p,y:g,width:m,height:v})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.setClipUrl,null),delete this._clipRect),k||C){var V=i.behavior.drag().on("dragstart",function(){i.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=i.behavior.drag().on("dragstart",function(){i.event.sourceEvent.preventDefault(),i.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));k&&this.hbar.on(".drag",null).call(H),C&&this.vbar.on(".drag",null).call(H)}this.setTranslate(e,r)},n.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(o.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)},n.prototype._onBoxDrag=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t-=i.event.dx),this.vbar&&(e-=i.event.dy),this.setTranslate(t,e)},n.prototype._onBoxWheel=function(){var t=this.translateX,e=this.translateY;this.hbar&&(t+=i.event.deltaY),this.vbar&&(e+=i.event.deltaY),this.setTranslate(t,e)},n.prototype._onBarDrag=function(){var t=this.translateX,e=this.translateY;if(this.hbar){var r=t+this._hbarXMin,n=r+this._hbarTranslateMax;t=(s.constrain(i.event.x,r,n)-r)/(n-r)*(this.position.w-this._box.w)}if(this.vbar){var a=e+this._vbarYMin,o=a+this._vbarTranslateMax;e=(s.constrain(i.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,e)},n.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=s.constrain(t||0,0,r),e=s.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(o.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(o.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(o.setTranslate,t,e+a*this._vbarTranslateMax)}}},{"../../lib":738,"../color":613,"../drawing":638,d3:123}],711:[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},LINE_SPACING:1.3,MID_SHIFT:.35,OPPOSITE_SIDE:{left:"right",right:"left",top:"bottom",bottom:"top"}}},{}],712:[function(t,e,r){"use strict";e.exports={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]}},{}],713:[function(t,e,r){"use strict";for(var n=t("../lib/extend").extendFlat,i={circle:{unicode:"\u25cf"},square:{unicode:"\u25a0"},diamond:{unicode:"\u25c6"},cross:{unicode:"\u271a"},x:{unicode:"\u274c"},"triangle-up":{unicode:"\u25b2"},"triangle-down":{unicode:"\u25bc"},"triangle-left":{unicode:"\u25c4"},"triangle-right":{unicode:"\u25ba"},"triangle-ne":{unicode:"\u25e5"},"triangle-nw":{unicode:"\u25e4"},"triangle-se":{unicode:"\u25e2"},"triangle-sw":{unicode:"\u25e3"},pentagon:{unicode:"\u2b1f"},hexagon:{unicode:"\u2b22"},hexagon2:{unicode:"\u2b23"},star:{unicode:"\u2605"},"diamond-tall":{unicode:"\u2666"},bowtie:{unicode:"\u29d3"},"diamond-x":{unicode:"\u2756"},"cross-thin":{unicode:"+",noBorder:!0},asterisk:{unicode:"\u2733",noBorder:!0},"y-up":{unicode:"\u2144",noBorder:!0},"y-down":{unicode:"Y",noBorder:!0},"line-ew":{unicode:"\u2500",noBorder:!0},"line-ns":{unicode:"\u2502",noBorder:!0}},a={},o=Object.keys(i),s=0;s<o.length;s++){var l=o[s];a[l+"-open"]=n({},i[l])}e.exports=n({},i,a,{"circle-cross-open":{unicode:"\u2a01",noFill:!0},"circle-x-open":{unicode:"\u2a02",noFill:!0},"square-cross-open":{unicode:"\u229e",noFill:!0},"square-x-open":{unicode:"\u22a0",noFill:!0}})},{"../lib/extend":727}],714:[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]}},{}],715:[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"}},{}],716:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],717:[function(t,e,r){"use strict";e.exports={BADNUM:void 0,FP_SAFE:Number.MAX_VALUE/1e4,ONEAVGYEAR:315576e5,ONEAVGMONTH:26298e5,ONEDAY:864e5,ONEHOUR:36e5,ONEMIN:6e4,ONESEC:1e3,EPOCHJD:2440587.5,ALMOST_EQUAL:1-1e-6,MINUS_SIGN:"\u2212"}},{}],718:[function(t,e,r){"use strict";e.exports={entityToUnicode:{mu:"\u03bc","#956":"\u03bc",amp:"&","#28":"&",lt:"<","#60":"<",gt:">","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}}},{}],719:[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}},{}],720:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.32.0",t("es6-promise").polyfill(),t("../build/plotcss"),t("./fonts/mathjax_config"),r.plot=n.plot,r.newPlot=n.newPlot,r.restyle=n.restyle,r.relayout=n.relayout,r.redraw=n.redraw,r.update=n.update,r.extendTraces=n.extendTraces,r.prependTraces=n.prependTraces,r.addTraces=n.addTraces,r.deleteTraces=n.deleteTraces,r.moveTraces=n.moveTraces,r.purge=n.purge,r.setPlotConfig=t("./plot_api/set_plot_config"),r.register=t("./plot_api/register"),r.toImage=t("./plot_api/to_image"),r.downloadImage=t("./snapshot/download"),r.validate=t("./plot_api/validate"),r.addFrames=n.addFrames,r.deleteFrames=n.deleteFrames,r.animate=n.animate,r.register(t("./traces/scatter")),r.register([t("./components/fx"),t("./components/legend"),t("./components/annotations"),t("./components/annotations3d"),t("./components/shapes"),t("./components/images"),t("./components/updatemenus"),t("./components/sliders"),t("./components/rangeslider"),t("./components/rangeselector")]),r.register([t("./locale-en"),t("./locale-en-us")]),r.Icons=t("../build/ploticon"),r.Plots=n.Plots,r.Fx=t("./components/fx"),r.Snapshot=t("./snapshot"),r.PlotSchema=t("./plot_api/plot_schema"),r.Queue=t("./lib/queue"),r.d3=t("d3")},{"../build/plotcss":1,"../build/ploticon":2,"./components/annotations":604,"./components/annotations3d":609,"./components/fx":655,"./components/images":663,"./components/legend":672,"./components/rangeselector":684,"./components/rangeslider":690,"./components/shapes":697,"./components/sliders":703,"./components/updatemenus":709,"./fonts/mathjax_config":721,"./lib/queue":752,"./locale-en":767,"./locale-en-us":766,"./plot_api/plot_schema":774,"./plot_api/register":775,"./plot_api/set_plot_config":776,"./plot_api/to_image":778,"./plot_api/validate":779,"./plotly":780,"./snapshot":866,"./snapshot/download":863,"./traces/scatter":1066,d3:123,"es6-promise":129}],721:[function(t,e,r){"use strict";"undefined"!=typeof MathJax?(r.MathJax=!0,MathJax.Hub.Config({messageStyle:"none",skipStartupTypeset:!0,displayAlign:"left",tex2jax:{inlineMath:[["$","$"],["\\(","\\)"]]}}),MathJax.Hub.Configured()):r.MathJax=!1},{}],722:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../constants/numerical").BADNUM,a=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g;e.exports=function(t){return"string"==typeof t&&(t=t.replace(a,"")),n(t)?Number(t):i}},{"../constants/numerical":717,"fast-isnumeric":132}],723:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("tinycolor2"),a=t("../plots/attributes"),o=t("../components/colorscale/get_scale"),s=(Object.keys(t("../components/colorscale/scales")),t("./nested_property")),l=t("./regex").counter,c=t("../constants/interactions").DESELECTDIM;r.valObjectMeta={data_array:{coerceFunction:function(t,e,r){Array.isArray(t)?e.set(t):void 0!==r&&e.set(r)}},enumerated:{coerceFunction:function(t,e,r,n){n.coerceNumber&&(t=+t),-1===n.values.indexOf(t)?e.set(r):e.set(t)},validateFunction:function(t,e){e.coerceNumber&&(t=+t);for(var r=e.values,n=0;n<r.length;n++){var i=String(r[n]);if("/"===i.charAt(0)&&"/"===i.charAt(i.length-1)){if(new RegExp(i.substr(1,i.length-2)).test(t))return!0}else if(t===r[n])return!0}return!1}},boolean:{coerceFunction:function(t,e,r){!0===t||!1===t?e.set(t):e.set(r)}},number:{coerceFunction:function(t,e,r,i){!n(t)||void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&t<i.min||void 0!==i.max&&t>i.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every(function(t){return i(t).isValid()})?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?(Math.abs(t)>180&&(t-=360*Math.round(t/360)),e.set(+t)):e.set(r)}},subplotid:{coerceFunction:function(t,e,r){"string"==typeof t&&l(r).test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!l(r).test(t)}},flaglist:{coerceFunction:function(t,e,r,n){if("string"==typeof t)if(-1===(n.extras||[]).indexOf(t)){for(var i=t.split("+"),a=0;a<i.length;){var o=i[a];-1===n.flags.indexOf(o)||i.indexOf(o)<a?i.splice(a,1):a++}i.length?e.set(i.join("+")):e.set(r)}else e.set(t);else e.set(r)}},any:{coerceFunction:function(t,e,r){void 0===t?e.set(r):e.set(t)}},info_array:{coerceFunction:function(t,e,n,i){if(Array.isArray(t)){var a=i.items,o=[];n=Array.isArray(n)?n:[];for(var s=0;s<a.length;s++)r.coerce(t,o,a,"["+s+"]",n[s]);e.set(o)}else e.set(n)},validateFunction:function(t,e){if(!Array.isArray(t))return!1;var n=e.items;if(!e.freeLength&&t.length!==n.length)return!1;for(var i=0;i<t.length;i++){if(!r.validate(t[i],e.items[i]))return!1}return!0}}},r.coerce=function(t,e,n,i,a){var o=s(n,i).get(),l=s(t,i),c=s(e,i),u=l.get();return void 0===a&&(a=o.dflt),o.arrayOk&&Array.isArray(u)?(c.set(u),u):(r.valObjectMeta[o.valType].coerceFunction(u,c,a,o),c.get())},r.coerce2=function(t,e,n,i,a){var o=s(t,i),l=r.coerce(t,e,n,i,a),c=o.get();return void 0!==c&&null!==c&&l},r.coerceFont=function(t,e,r){var n={};return r=r||{},n.family=t(e+".family",r.family),n.size=t(e+".size",r.size),n.color=t(e+".color",r.color),n},r.coerceHoverinfo=function(t,e,n){var i,o=e._module.attributes,s=o.hoverinfo?{hoverinfo:o.hoverinfo}:a,l=s.hoverinfo;if(1===n._dataLength){var c="all"===l.dflt?l.flags.slice():l.dflt.split("+");c.splice(c.indexOf("name"),1),i=c.join("+")}return r.coerce(t,e,s,"hoverinfo",i)},r.coerceSelectionMarkerOpacity=function(t,e){if(t.marker){var r,n,i=t.marker.opacity;Array.isArray(i)||t.selected||t.unselected||(r=i,n=c*i),e("selected.marker.opacity",r),e("unselected.marker.opacity",n)}},r.validate=function(t,e){var n=r.valObjectMeta[e.valType];if(e.arrayOk&&Array.isArray(t))return!0;if(n.validateFunction)return n.validateFunction(t,e);var i={},a=i,o={set:function(t){a=t}};return n.coerceFunction(t,o,i,e),a!==i}},{"../components/colorscale/get_scale":626,"../components/colorscale/scales":632,"../constants/interactions":716,"../plots/attributes":783,"./nested_property":746,"./regex":753,"fast-isnumeric":132,tinycolor2:543}],724:[function(t,e,r){"use strict";function n(t){return t&&b.componentsRegistry.calendars&&"string"==typeof t&&"gregorian"!==t}function i(t,e){return String(t+Math.pow(10,e)).substr(1)}function a(t,e,r,n,a){if((e||r||n||a)&&(t+=" "+i(e,2)+":"+i(r,2),(n||a)&&(t+=":"+i(n,2),a))){for(var o=4;a%10==0;)o-=1,a/=10;t+="."+i(a,o)}return t}function o(t,e){var r=h(t+.05,p),n=i(Math.floor(r/m),2)+":"+i(h(Math.floor(r/g),60),2);if("M"!==e){c(e)||(e=0);var a=(100+Math.min(h(t/v,60),C[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),n+=":"+a}return n}function s(t){return t.formatDate("yyyy")}var l=t("d3"),c=t("fast-isnumeric"),u=t("./loggers"),h=t("./mod"),f=t("../constants/numerical"),d=f.BADNUM,p=f.ONEDAY,m=f.ONEHOUR,g=f.ONEMIN,v=f.ONESEC,y=f.EPOCHJD,b=t("../registry"),x=l.time.format.utc,_=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\d)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,w=/^\s*(-?\d\d\d\d|\d\d)(-(\d?\di?)(-(\d?\d)([ Tt]([01]?\d|2[0-3])(:([0-5]\d)(:([0-5]\d(\.\d+)?))?(Z|z|[+\-]\d\d:?\d\d)?)?)?)?)?\s*$/m,M=(new Date).getFullYear()-70;r.dateTick0=function(t,e){return n(t)?e?b.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:b.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?b.getComponentMethod("calendars","DFLTRANGE")[t]:["2000-01-01","2001-01-01"]},r.isJSDate=function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.getTime};var k,T;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return(t=Number(t)-t.getTimezoneOffset()*g)>=k&&t<=T?t:d;if("string"!=typeof t&&"number"!=typeof t)return d;t=String(t);var i=n(e),a=t.charAt(0);!i||"G"!==a&&"g"!==a||(t=t.substr(1),e="");var o=i&&"chinese"===e.substr(0,7),s=t.match(o?w:_);if(!s)return d;var l=s[1],c=s[3]||"1",u=Number(s[5]||1),h=Number(s[7]||0),f=Number(s[9]||0),x=Number(s[11]||0);if(i){if(2===l.length)return d;l=Number(l);var A;try{var S=b.getComponentMethod("calendars","getCal")(e);if(o){var E="i"===c.charAt(c.length-1);c=parseInt(c,10),A=S.newDate(l,S.toMonthIndex(l,c,E),u)}else A=S.newDate(l,Number(c),u)}catch(t){return d}return A?(A.toJD()-y)*p+h*m+f*g+x*v:d}l=2===l.length?(Number(l)+2e3-M)%100+M:Number(l),c-=1;var L=new Date(Date.UTC(2e3,c,u,h,f));return L.setUTCFullYear(l),L.getUTCMonth()!==c?d:L.getUTCDate()!==u?d:L.getTime()+x*v},k=r.MIN_MS=r.dateTime2ms("-9999"),T=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==d};var A=90*p,S=3*m,E=5*g;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=k&&t<=T))return d;e||(e=0);var i,o,s,l,c,u,f=Math.floor(10*h(t+.05,1)),_=Math.round(t-f/10);if(n(r)){var w=Math.floor(_/p)+y,M=Math.floor(h(t,p));try{i=b.getComponentMethod("calendars","getCal")(r).fromJD(w).formatDate("yyyy-mm-dd")}catch(t){i=x("G%Y-%m-%d")(new Date(_))}if("-"===i.charAt(0))for(;i.length<11;)i="-0"+i.substr(1);else for(;i.length<10;)i="0"+i;o=e<A?Math.floor(M/m):0,s=e<A?Math.floor(M%m/g):0,l=e<S?Math.floor(M%g/v):0,c=e<E?M%v*10+f:0}else u=new Date(_),i=x("%Y-%m-%d")(u),o=e<A?u.getUTCHours():0,s=e<A?u.getUTCMinutes():0,l=e<S?u.getUTCSeconds():0,c=e<E?10*u.getUTCMilliseconds()+f:0;return a(i,o,s,l,c)},r.ms2DateTimeLocal=function(t){if(!(t>=k+p&&t<=T-p))return d;var e=Math.floor(10*h(t+.05,1)),r=new Date(Math.round(t-e/10));return a(l.time.format("%Y-%m-%d")(r),r.getHours(),r.getMinutes(),r.getSeconds(),10*r.getUTCMilliseconds()+e)},r.cleanDate=function(t,e,i){if(r.isJSDate(t)||"number"==typeof t){if(n(i))return u.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,i))return u.error("unrecognized date",t),e;return t};var L=/%\d?f/g,C=[59,59.9,59.99,59.999,59.9999];r.formatDate=function(t,e,r,i,a){var l,c;if(a=n(a)&&a,e)return function(t,e,r,i){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(i))try{t=b.getComponentMethod("calendars","worldCalFmt")(t,e,i)}catch(t){return"Invalid"}return r(t)(a)}(e,t,i,a);if(a)try{var u=Math.floor((t+.05)/p)+y,h=b.getComponentMethod("calendars","getCal")(a).fromJD(u);"y"===r?c=s(h):"m"===r?c=function(t){return t.formatDate("M yyyy")}(h):"d"===r?(l=s(h),c=function(t){return t.formatDate("M d")}(h)):(l=function(t){return t.formatDate("M d, yyyy")}(h),c=o(t,r))}catch(t){return"Invalid"}else{var f=new Date(Math.floor(t+.05));"y"===r?c=i("%Y")(f):"m"===r?c=i("%b %Y")(f):"d"===r?(l=i("%Y")(f),c=i("%b %-d")(f)):(l=i("%b %-d, %Y")(f),c=o(t,r))}return c+(l?"\n"+l:"")};var I=3*p;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=h(t,p);if(t=Math.round(t-i),r)try{var a=Math.round(t/p)+y,o=b.getComponentMethod("calendars","getCal")(r),s=o.fromJD(a);return e%12?o.add(s,e,"m"):o.add(s,e/12,"y"),(s.toJD()-y)*p+i}catch(e){u.error("invalid ms "+t+" in calendar "+r)}var l=new Date(t+I);return l.setUTCMonth(l.getUTCMonth()+e)+i-I},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&b.getComponentMethod("calendars","getCal")(e),h=0;h<t.length;h++)if(i=t[h],c(i)){if(!(i%p))if(u)try{1===(r=u.fromJD(i/p+y)).day()?1===r.month()?a++:o++:s++}catch(t){}else 1===(r=new Date(i)).getUTCDate()?0===r.getUTCMonth()?a++:o++:s++}else l++;s+=o+=a;var f=t.length-l;return{exactYears:a/f,exactMonths:o/f,exactDays:s/f}}},{"../constants/numerical":717,"../registry":861,"./loggers":743,"./mod":745,d3:123,"fast-isnumeric":132}],725:[function(t,e,r){"use strict";e.exports=function(t,e){return Array.isArray(t)||(t=[]),t.length=e,t}},{}],726:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i={init:function(t){if(t._ev instanceof n)return t;var e=new n,r=new n;return t._ev=e,t._internalEv=r,t.on=e.on.bind(e),t.once=e.once.bind(e),t.removeListener=e.removeListener.bind(e),t.removeAllListeners=e.removeAllListeners.bind(e),t._internalOn=r.on.bind(r),t._internalOnce=r.once.bind(r),t._removeInternalListener=r.removeListener.bind(r),t._removeAllInternalListeners=r.removeAllListeners.bind(r),t.emit=function(n,i){"undefined"!=typeof jQuery&&jQuery(t).trigger(n,i),e.emit(n,i),r.emit(n,i)},t},triggerHandler:function(t,e,r){var n,i;"undefined"!=typeof jQuery&&(n=jQuery(t).triggerHandler(e,r));var a=t._ev;if(!a)return n;var o=a._events[e];if(!o)return n;"function"==typeof o&&(o=[o]);for(var s=o.pop(),l=0;l<o.length;l++)o[l](r);return i=s(r),void 0!==n?n:i},purge:function(t){return delete t._ev,delete t.on,delete t.once,delete t.removeListener,delete t.removeAllListeners,delete t.emit,delete t._ev,delete t._internalEv,delete t._internalOn,delete t._internalOnce,delete t._removeInternalListener,delete t._removeAllInternalListeners,t}};e.exports=i},{events:130}],727:[function(t,e,r){"use strict";function n(t,e,r,o){var s,l,c,u,h,f,d=t[0],p=t.length;if(2===p&&a(d)&&a(t[1])&&0===d.length){if(function(t,e){var r,n;for(r=0;r<t.length;r++){if(null!==(n=t[r])&&"object"==typeof n)return!1;void 0!==n&&(e[r]=n)}return!0}(t[1],d))return d;d.splice(0,d.length)}for(var m=1;m<p;m++){s=t[m];for(l in s)c=d[l],u=s[l],o&&a(u)?d[l]=u:e&&u&&(i(u)||(h=a(u)))?(h?(h=!1,f=c&&a(c)?c:[]):f=c&&i(c)?c:{},d[l]=n([f,u],e,r,o)):(void 0!==u||r)&&(d[l]=u)}return d}var i=t("./is_plain_object.js"),a=Array.isArray;r.extendFlat=function(){return n(arguments,!1,!1,!1)},r.extendDeep=function(){return n(arguments,!0,!1,!1)},r.extendDeepAll=function(){return n(arguments,!0,!0,!1)},r.extendDeepNoArrays=function(){return n(arguments,!0,!1,!0)}},{"./is_plain_object.js":740}],728:[function(t,e,r){"use strict";e.exports=function(t){for(var e={},r=[],n=0,i=0;i<t.length;i++){var a=t[i];1!==e[a]&&(e[a]=1,r[n++]=a)}return r}},{}],729:[function(t,e,r){"use strict";e.exports=function(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];!0===n.visible&&e.push(n)}return e}},{}],730:[function(t,e,r){"use strict";var n=t("country-regex"),i=t("../lib"),a=Object.keys(n),o={"ISO-3":i.identity,"USA-states":i.identity,"country names":function(t){for(var e=0;e<a.length;e++){var r=a[e];if(new RegExp(n[r]).test(t.trim().toLowerCase()))return r}return i.log("Unrecognized country name: "+t+"."),!1}};r.locationToFeature=function(t,e,r){if(!e||"string"!=typeof e)return!1;var n=function(t,e){return(0,o[t])(e)}(t,e);if(n){for(var a=0;a<r.length;a++){var s=r[a];if(s.id===n)return s}i.log(["Location with id",n,"does not have a matching topojson feature at this resolution."].join(" "))}return!1}},{"../lib":738,"country-regex":108}],731:[function(t,e,r){"use strict";var n=t("../constants/numerical").BADNUM;r.calcTraceToLineCoords=function(t){for(var e=t[0].trace.connectgaps,r=[],i=[],a=0;a<t.length;a++){var o=t[a].lonlat;o[0]!==n?i.push(o):!e&&i.length>0&&(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;r<t.length;r++)e[r]=[t[r]];return{type:"MultiPolygon",coordinates:e}},r.makeBlank=function(){return{type:"Point",coordinates:[]}}},{"../constants/numerical":717}],732:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s){var l=r-t,c=i-t,u=o-i,h=n-e,f=a-e,d=s-a,p=l*d-u*h;if(0===p)return null;var m=(c*d-u*f)/p,g=(c*h-l*f)/p;return g<0||g>1||m<0||m>1?null:{x:t+l*m,y:e+h*m}}function i(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}var a=t("./mod");r.segmentsIntersect=n,r.segmentDistance=function(t,e,r,a,o,s,l,c){if(n(t,e,r,a,o,s,l,c))return 0;var u=r-t,h=a-e,f=l-o,d=c-s,p=u*u+h*h,m=f*f+d*d,g=Math.min(i(u,h,p,o-t,s-e),i(u,h,p,l-t,c-e),i(f,d,m,t-o,e-s),i(f,d,m,r-o,a-s));return Math.sqrt(g)};var o,s,l;r.getTextLocation=function(t,e,r,n){if(t===s&&n===l||(o={},s=t,l=n),o[r])return o[r];var i=t.getPointAtLength(a(r-n/2,e)),c=t.getPointAtLength(a(r+n/2,e)),u=Math.atan((c.y-i.y)/(c.x-i.x)),h=t.getPointAtLength(a(r,e)),f={x:(4*h.x+i.x+c.x)/6,y:(4*h.y+i.y+c.y)/6,theta:u};return o[r]=f,f},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?i=r:e===h&&(a=r);var n=r.x<o?o-r.x:r.x>s?r.x-s:0,u=r.y<l?l-r.y:r.y>c?r.y-c:0;return Math.sqrt(n*n+u*u)}for(var i,a,o=e.left,s=e.right,l=e.top,c=e.bottom,u=0,h=t.getTotalLength(),f=h,d=n(u);d;){if((u+=d+r)>f)return;d=n(u)}for(d=n(f);d;){if(f-=d+r,u>f)return;d=n(f)}return{min:u,max:f,len:f-u,total:h,isClosed:0===u&&f===h&&Math.abs(i.x-a.x)<.1&&Math.abs(i.y-a.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,h=0,f=0,d=s;h<c;){if(i=(f+d)/2,a=t.getPointAtLength(i),o=a[r]-e,Math.abs(o)<l)return a;u*o>0?d=i:f=i,h++}return a}},{"./mod":745}],733:[function(t,e,r){"use strict";e.exports=function(t){var e;if("string"==typeof t){if(null===(e=document.getElementById(t)))throw new Error("No DOM element with id '"+t+"' exists on the page.");return e}if(null===t||void 0===t)throw new Error("DOM element provided is null or undefined");return t}},{}],734:[function(t,e,r){"use strict";function n(t,e){var r=t;return r[3]*=e,r}function i(t){if(o(t))return u;var e=s(t);return e.length?e:u}function a(t){return o(t)?t:h}var o=t("fast-isnumeric"),s=t("color-rgba"),l=t("../components/colorscale"),c=t("../components/color/attributes").defaultLine,u=s(c),h=1;e.exports=function(t,e,r){var o,c,f,d,p,m=t.color,g=Array.isArray(m),v=Array.isArray(e),y=[];if(o=void 0!==t.colorscale?l.makeColorScaleFunc(l.extractScale(t.colorscale,t.cmin,t.cmax)):i,c=g?function(t,e){return void 0===t[e]?u:s(o(t[e]))}:i,f=v?function(t,e){return void 0===t[e]?h:a(t[e])}:a,g||v)for(var b=0;b<r;b++)d=c(m,b),p=f(e,b),y[b]=n(d,p);else y=n(s(m),e);return y}},{"../components/color/attributes":612,"../components/colorscale":628,"color-rgba":96,"fast-isnumeric":132}],735:[function(t,e,r){"use strict";function n(t){return[t]}var i=t("./identity");e.exports={keyFun:function(t){return t.key},repeat:n,descend:i,wrap:n,unwrap:function(t){return t[0]}}},{"./identity":737}],736:[function(t,e,r){"use strict";var n=t("superscript-text"),i=t("../constants/string_mappings");e.exports=function(t){return""+function(t){for(var e=i.entityToUnicode,r=0;(r=t.indexOf("&",r))>=0;){var n=t.indexOf(";",r);if(n<r)r+=1;else{var a=e[t.slice(r+1,n)];t=a?t.slice(0,r)+a+t.slice(n+1):t.slice(0,r)+t.slice(n+1)}}return t}(function(t){return t.replace(/\<.*\>/g,"")}(function(t){for(var e=0;(e=t.indexOf("<sup>",e))>=0;){var r=t.indexOf("</sup>",e);if(r<e)break;t=t.slice(0,e)+n(t.slice(e+5,r))+t.slice(r+6)}return t}(function(t){return t.replace(/\<br\>/g,"\n")}(t))))}},{"../constants/string_mappings":718,"superscript-text":539}],737:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],738:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=t("../constants/numerical"),o=a.FP_SAFE,s=a.BADNUM,l=e.exports={};l.nestedProperty=t("./nested_property"),l.keyedContainer=t("./keyed_container"),l.relativeAttr=t("./relative_attr"),l.isPlainObject=t("./is_plain_object"),l.isArray=t("./is_array"),l.mod=t("./mod"),l.toLogRange=t("./to_log_range"),l.relinkPrivateKeys=t("./relink_private"),l.ensureArray=t("./ensure_array");var c=t("./coerce");l.valObjectMeta=c.valObjectMeta,l.coerce=c.coerce,l.coerce2=c.coerce2,l.coerceFont=c.coerceFont,l.coerceHoverinfo=c.coerceHoverinfo,l.coerceSelectionMarkerOpacity=c.coerceSelectionMarkerOpacity,l.validate=c.validate;var u=t("./dates");l.dateTime2ms=u.dateTime2ms,l.isDateTime=u.isDateTime,l.ms2DateTime=u.ms2DateTime,l.ms2DateTimeLocal=u.ms2DateTimeLocal,l.cleanDate=u.cleanDate,l.isJSDate=u.isJSDate,l.formatDate=u.formatDate,l.incrementMonth=u.incrementMonth,l.dateTick0=u.dateTick0,l.dfltRange=u.dfltRange,l.findExactDates=u.findExactDates,l.MIN_MS=u.MIN_MS,l.MAX_MS=u.MAX_MS;var h=t("./search");l.findBin=h.findBin,l.sorterAsc=h.sorterAsc,l.sorterDes=h.sorterDes,l.distinctVals=h.distinctVals,l.roundUp=h.roundUp;var f=t("./stats");l.aggNums=f.aggNums,l.len=f.len,l.mean=f.mean,l.variance=f.variance,l.stdev=f.stdev,l.interp=f.interp;var d=t("./matrix");l.init2dArray=d.init2dArray,l.transposeRagged=d.transposeRagged,l.dot=d.dot,l.translationMatrix=d.translationMatrix,l.rotationMatrix=d.rotationMatrix,l.rotationXYMatrix=d.rotationXYMatrix,l.apply2DTransform=d.apply2DTransform,l.apply2DTransform2=d.apply2DTransform2;var p=t("./geometry2d");l.segmentsIntersect=p.segmentsIntersect,l.segmentDistance=p.segmentDistance,l.getTextLocation=p.getTextLocation,l.clearLocationCache=p.clearLocationCache,l.getVisibleSegment=p.getVisibleSegment,l.findPointOnPath=p.findPointOnPath;var m=t("./extend");l.extendFlat=m.extendFlat,l.extendDeep=m.extendDeep,l.extendDeepAll=m.extendDeepAll,l.extendDeepNoArrays=m.extendDeepNoArrays;var g=t("./loggers");l.log=g.log,l.warn=g.warn,l.error=g.error;var v=t("./regex");l.counterRegex=v.counter;var y=t("./throttle");l.throttle=y.throttle,l.throttleDone=y.done,l.clearThrottle=y.clear,l.getGraphDiv=t("./get_graph_div"),l._=t("./localize"),l.notifier=t("./notifier"),l.filterUnique=t("./filter_unique"),l.filterVisible=t("./filter_visible"),l.pushUnique=t("./push_unique"),l.cleanNumber=t("./clean_number"),l.ensureNumber=function(t){return i(t)?(t=Number(t))<-o||t>o?s:i(t)?Number(t):s:s},l.noop=t("./noop"),l.identity=t("./identity"),l.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;i<e.length;i++){var a=e[i],o=l.nestedProperty(t,a.replace("?",r)),s=l.nestedProperty(t,a.replace("?",n)),c=o.get();o.set(s.get()),s.set(c)}},l.pauseEvent=function(t){return t.stopPropagation&&t.stopPropagation(),t.preventDefault&&t.preventDefault(),t.cancelBubble=!0,!1},l.raiseToTop=function(t){t.parentNode.appendChild(t)},l.cancelTransition=function(t){return t.transition().duration(0)},l.constrain=function(t,e,r){return e>r?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o<i;o++)a[o]=e(t[o],r,n);return a},l.randstr=function t(e,r,n){if(n||(n=16),void 0===r&&(r=24),r<=0)return"0";var i,a,o=Math.log(Math.pow(2,r))/Math.log(n),s="";for(i=2;o===1/0;i*=2)o=Math.log(Math.pow(2,r/i))/Math.log(n)*i;var l=o-Math.floor(o);for(i=0;i<Math.floor(o);i++)s=Math.floor(Math.random()*n).toString(n)+s;l&&(a=Math.pow(n,l),s=Math.floor(Math.random()*a).toString(n)+s);var c=parseInt(s,n);return e&&e.indexOf(s)>-1||c!==1/0&&c>=Math.pow(2,r)?t(e,r,n):s},l.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={};return r.optionList=[],r._newoption=function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)},r["_"+e]=t,r},l.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,c=new Array(l),u=new Array(o);for(r=0;r<l;r++)c[r]=(1-Math.cos(Math.PI*(r+1)/e))/(2*e);for(r=0;r<o;r++){for(a=0,n=0;n<l;n++)(i=r+n+1-e)<-o?i-=s*Math.round(i/s):i>=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},l.syncOrAsync=function(t,e,r){function n(){return l.syncOrAsync(t,e,r)}for(var i,a;t.length;)if(a=t.splice(0,1)[0],(i=a(e))&&i.then)return i.then(n).then(void 0,l.promiseError);return r&&r(e)},l.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},l.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n<r.length;n++)void 0!==(i=t[r[n]])&&null!==i?a=!0:o=!1;if(a&&!o)for(n=0;n<r.length;n++)t[r[n]]=e[r[n]]}},l.mergeArray=function(t,e,r){if(Array.isArray(t))for(var n=Math.min(t.length,e.length),i=0;i<n;i++)e[i][r]=t[i]},l.fillArray=function(t,e,r,n){if(n=n||l.identity,Array.isArray(t))for(var i=0;i<e.length;i++)e[i][r]=n(t[i])},l.castOption=function(t,e,r,n){n=n||l.identity;var i=l.nestedProperty(t,r).get();return Array.isArray(i)?Array.isArray(e)&&Array.isArray(i[e[0]])?n(i[e[0]][e[1]]):n(i[e]):i},l.extractOption=function(t,e,r,n){if(r in t)return t[r];var i=l.nestedProperty(e,n).get();return Array.isArray(i)?void 0:i},l.tagSelected=function(t,e,r){function n(t){return i(t)&&t>=0&&t%1==0}function a(e){return void 0!==e&&e<t.length}var o,s=e.selectedpoints,l=e._indexToPoints;if(l){o={};for(var c in l)for(var u=l[c],h=0;h<u.length;h++)o[u[h]]=c}for(var f=0;f<s.length;f++){var d=s[f];if(n(d)){var p=o?o[d]:d,m=r?r[p]:p;a(m)&&(t[m].selected=1)}}},l.getTargetArray=function(t,e){var r=e.target;if("string"==typeof r&&r){var n=l.nestedProperty(t,r).get();return!!Array.isArray(n)&&n}return!!Array.isArray(r)&&r},l.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,i,a,o=Object.keys(t);for(n=0;n<o.length;n++)a=t[i=o[n]],"_"!==i.charAt(0)&&"function"!=typeof a&&("module"===i?r[i]=a:Array.isArray(a)?r[i]=a.slice(0,3):r[i]=a&&"object"==typeof a?l.minExtend(t[i],e[i]):a);for(o=Object.keys(e),n=0;n<o.length;n++)"object"==typeof(a=e[i=o[n]])&&i in r&&"object"==typeof r[i]||(r[i]=a);return r},l.titleCase=function(t){return t.charAt(0).toUpperCase()+t.substr(1)},l.containsAny=function(t,e){for(var r=0;r<e.length;r++)if(-1!==t.indexOf(e[r]))return!0;return!1},l.isPlotDiv=function(t){var e=n.select(t);return e.node()instanceof HTMLElement&&e.size()&&e.classed("js-plotly-plot")},l.removeElement=function(t){var e=t&&t.parentNode;e&&e.removeChild(t)},l.addStyleRule=function(t,e){if(!l.styleSheet){var r=document.createElement("style");r.appendChild(document.createTextNode("")),document.head.appendChild(r),l.styleSheet=r.sheet}var n=l.styleSheet;n.insertRule?n.insertRule(t+"{"+e+"}",0):n.addRule?n.addRule(t,e,0):l.warn("addStyleRule failed")},l.isIE=function(){return void 0!==window.navigator.msSaveBlob},l.isD3Selection=function(t){return t&&"function"==typeof t.classed},l.objectFromPath=function(t,e){for(var r,n=t.split("."),i=r={},a=0;a<n.length;a++){var o=n[a],s=null,l=n[a].match(/(.*)\[([0-9]+)\]/);l?(o=l[1],s=l[2],r=r[o]=[],a===n.length-1?r[s]=e:r[s]={},r=r[s]):(a===n.length-1?r[o]=e:r[o]={},r=r[o])}return i};var b=/^([^\[\.]+)\.(.+)?/,x=/^([^\.]+)\[([0-9]+)\](\.)?(.+)?/;l.expandObjectPaths=function(t){var e,r,n,i,a,o,s;if("object"==typeof t&&!Array.isArray(t))for(r in t)t.hasOwnProperty(r)&&((e=r.match(b))?(i=t[r],n=e[1],delete t[r],t[n]=l.extendDeepNoArrays(t[n]||{},l.objectFromPath(r,l.expandObjectPaths(i))[n])):(e=r.match(x))?(i=t[r],n=e[1],a=parseInt(e[2]),delete t[r],t[n]=t[n]||[],"."===e[3]?(s=e[4],o=t[n][a]=t[n][a]||{},l.extendDeepNoArrays(o,l.objectFromPath(s,l.expandObjectPaths(i)))):t[n][a]=l.expandObjectPaths(i)):t[r]=l.expandObjectPaths(t[r]));return t},l.numSeparate=function(t,e,r){if(r||(r=!1),"string"!=typeof e||0===e.length)throw new Error("Separator string required for formatting!");"number"==typeof t&&(t=String(t));var n=/(\d+)(\d{3})/,i=e.charAt(0),a=e.charAt(1),o=t.split("."),s=o[0],l=o.length>1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l};var _=/%{([^\s%{}]*)}/g,w=/^\w*$/;l.templateString=function(t,e){var r={};return t.replace(_,function(t,n){return w.test(n)?e[n]||"":(r[n]=r[n]||l.nestedProperty(e,n).get,r[n]()||"")})};l.subplotSort=function(t,e){for(var r=Math.min(t.length,e.length)+1,n=0,i=0,a=0;a<r;a++){var o=t.charCodeAt(a)||0,s=e.charCodeAt(a)||0,l=o>=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}},{"../constants/numerical":717,"./clean_number":722,"./coerce":723,"./dates":724,"./ensure_array":725,"./extend":727,"./filter_unique":728,"./filter_visible":729,"./geometry2d":732,"./get_graph_div":733,"./identity":737,"./is_array":739,"./is_plain_object":740,"./keyed_container":741,"./localize":742,"./loggers":743,"./matrix":744,"./mod":745,"./nested_property":746,"./noop":747,"./notifier":748,"./push_unique":751,"./regex":753,"./relative_attr":754,"./relink_private":755,"./search":756,"./stats":759,"./throttle":762,"./to_log_range":763,d3:123,"fast-isnumeric":132}],739:[function(t,e,r){"use strict";var n="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer:{isView:function(){return!1}};e.exports=function(t){return Array.isArray(t)||n.isView(t)}},{}],740:[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}},{}],741:[function(t,e,r){"use strict";var n=t("./nested_property"),i=/^\w*$/;e.exports=function(t,e,r,a){r=r||"name",a=a||"value";var o,s,l={};s=e&&e.length?n(t,e).get():t,e=e||"",s=s||[];var c={};for(o=0;o<s.length;o++)c[s[o][r]]=o;var u=i.test(a),h={set:function(t,e){var i=null===e?4:0,o=c[t];void 0===o?(i|=3,o=s.length,c[t]=o):e!==(u?s[o][a]:n(s[o],a).get())&&(i|=2);var f=s[o]=s[o]||{};return f[r]=t,u?f[a]=e:n(f,a).set(e),null!==e&&(i&=-5),l[o]=l[o]|i,h},get:function(t){var e=c[t];return void 0===e?void 0:u?s[e][a]:n(s[e],a).get()},rename:function(t,e){var n=c[t];return void 0===n?h:(l[n]=1|l[n],c[e]=n,delete c[t],s[n][r]=e,h)},remove:function(t){var e=c[t];if(void 0===e)return h;var i=s[e];if(Object.keys(i).length>2)return l[e]=2|l[e],h.set(t,null);if(u){for(o=e;o<s.length;o++)l[o]=3|l[o];for(o=e;o<s.length;o++)c[s[o][r]]--;s.splice(e,1),delete c[t]}else n(i,a).set(null),l[e]=6|l[e];return h},constructUpdate:function(){for(var t,i,o={},c=Object.keys(l),h=0;h<c.length;h++)i=c[h],t=e+"["+i+"]",s[i]?(1&l[i]&&(o[t+"."+r]=s[i][r]),2&l[i]&&(o[t+"."+a]=u?4&l[i]?null:s[i][a]:4&l[i]?null:n(s[i],a).get())):o[t]=null;return o}};return h}},{"./nested_property":746}],742:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t,e){for(var r=t._context.locale,i=0;i<2;i++){for(var a=t._context.locales,o=0;o<2;o++){var s=(a[r]||{}).dictionary;if(s){var l=s[e];if(l)return l}a=n.localeRegistry}var c=r.split("-")[0];if(c===r)break;r=c}return e}},{"../registry":861}],743:[function(t,e,r){"use strict";function n(t,e){if(t.apply)t.apply(t,e);else for(var r=0;r<e.length;r++)t(e[r])}var i=t("../plot_api/plot_config"),a=e.exports={};a.log=function(){if(i.logging>1){for(var t=["LOG:"],e=0;e<arguments.length;e++)t.push(arguments[e]);n(console.trace||console.log,t)}},a.warn=function(){if(i.logging>0){for(var t=["WARN:"],e=0;e<arguments.length;e++)t.push(arguments[e]);n(console.trace||console.log,t)}},a.error=function(){if(i.logging>0){for(var t=["ERROR:"],e=0;e<arguments.length;e++)t.push(arguments[e]);n(console.error,t)}}},{"../plot_api/plot_config":773}],744:[function(t,e,r){"use strict";r.init2dArray=function(t,e){for(var r=new Array(t),n=0;n<t;n++)r[n]=new Array(e);return r},r.transposeRagged=function(t){var e,r,n=0,i=t.length;for(e=0;e<i;e++)n=Math.max(n,t[e].length);var a=new Array(n);for(e=0;e<n;e++)for(a[e]=new Array(i),r=0;r<i;r++)a[e][r]=t[r][e];return a},r.dot=function(t,e){if(!t.length||!e.length||t.length!==e.length)return null;var n,i,a=t.length;if(t[0].length)for(n=new Array(a),i=0;i<a;i++)n[i]=r.dot(t[i],e);else if(e[0].length){var o=r.transposeRagged(e);for(n=new Array(o.length),i=0;i<o.length;i++)n[i]=r.dot(t,o[i])}else for(n=0,i=0;i<a;i++)n+=t[i]*e[i];return n},r.translationMatrix=function(t,e){return[[1,0,t],[0,1,e],[0,0,1]]},r.rotationMatrix=function(t){var e=t*Math.PI/180;return[[Math.cos(e),-Math.sin(e),0],[Math.sin(e),Math.cos(e),0],[0,0,1]]},r.rotationXYMatrix=function(t,e,n){return r.dot(r.dot(r.translationMatrix(e,n),r.rotationMatrix(t)),r.translationMatrix(-e,-n))},r.apply2DTransform=function(t){return function(){var e=arguments;3===e.length&&(e=e[0]);var n=1===arguments.length?e[0]:[e[0],e[1]];return r.dot(t,[n[0],n[1],1]).slice(0,2)}},r.apply2DTransform2=function(t){var e=r.apply2DTransform(t);return function(t){return e(t.slice(0,2)).concat(e(t.slice(2,4)))}}},{}],745:[function(t,e,r){"use strict";e.exports=function(t,e){var r=t%e;return r<0?r+e:r}},{}],746:[function(t,e,r){"use strict";function n(t,e){return function(){var r,i,a,o,s,l=t;for(o=0;o<e.length-1;o++){if(-1===(r=e[o])){for(i=!0,a=[],s=0;s<l.length;s++)a[s]=n(l[s],e.slice(o+1))(),a[s]!==a[0]&&(i=!1);return i?a[0]:a}if("number"==typeof r&&!c(l))return;if("object"!=typeof(l=l[r])||null===l)return}if("object"==typeof l&&null!==l&&null!==(a=l[e[o]]))return a}}function i(t,e){if(!function(t){return void 0===t||null===t||"object"==typeof t&&(c(t)?!t.length:!Object.keys(t).length)}(t)||u(t)&&"]"===e.charAt(e.length-1)||e.match(d)&&void 0!==t)return!1;if(!c(t))return!0;if(e.match(f))return!0;var r=h(e);return r&&""===r.index}function a(t,e,r){return function(n){var l,u,h=t,f="",d=[[t,f]],p=i(n,r);for(u=0;u<e.length-1;u++){if("number"==typeof(l=e[u])&&!c(h))throw"array index but container is not an array";if(-1===l){if(p=!function(t,e,r,n){var o,l=c(r),u=!0,h=r,f=n.replace("-1",0),d=!l&&i(r,f),p=e[0];for(o=0;o<t.length;o++)f=n.replace("-1",o),l&&(h=r[o%r.length],d=i(h,f)),d&&(u=!1),s(t,o,p,d)&&a(t[o],e,n.replace("-1",o))(h);return u}(h,e.slice(u+1),n,r))break;return}if(!s(h,l,e[u+1],p))break;if("object"!=typeof(h=h[l])||null===h)throw"container is not an object";f=o(f,l),d.push([h,f])}p?(u===e.length-1&&delete h[e[u]],function(t){var e,r,n,a,s,l;for(e=t.length-1;e>=0;e--){if(n=t[e][0],a=t[e][1],l=!1,c(n))for(r=n.length-1;r>=0;r--)i(n[r],o(a,r))?l?n[r]=void 0:n.pop():l=!0;else if("object"==typeof n&&null!==n)for(s=Object.keys(n),l=!1,r=s.length-1;r>=0;r--)i(n[s[r]],o(a,s[r]))?delete n[s[r]]:l=!0;if(l)return}}(d)):h[e[u]]=n}}function o(t,e){var r=e;return l(e)?r="["+e+"]":t&&(r="."+e),t+r}function s(t,e,r,n){if(void 0===t[e]){if(n)return!1;t[e]="number"==typeof r?[]:{}}return!0}var l=t("fast-isnumeric"),c=t("./is_array"),u=t("./is_plain_object"),h=t("../plot_api/container_array_match");e.exports=function(t,e){if(l(e))e=String(e);else if("string"!=typeof e||"[-1]"===e.substr(e.length-4))throw"bad property string";for(var r,i,o,s=0,c=e.split(".");s<c.length;){if(r=String(c[s]).match(/^([^\[\]]*)((\[\-?[0-9]*\])+)$/)){if(r[1])c[s]=r[1];else{if(0!==s)throw"bad property string";c.splice(0,1)}for(i=r[2].substr(1,r[2].length-2).split("]["),o=0;o<i.length;o++)s++,c.splice(s,0,Number(i[o]))}s++}return"object"!=typeof t?function(t,e,r){return{set:function(){throw"bad container"},get:function(){},astr:e,parts:r,obj:t}}(t,e,c):{set:a(t,c,e),get:n(t,c),astr:e,parts:c,obj:t}};var f=/(^|\.)((domain|range)(\.[xy])?|args|parallels)$/,d=/(^|\.)args\[/},{"../plot_api/container_array_match":768,"./is_array":739,"./is_plain_object":740,"fast-isnumeric":132}],747:[function(t,e,r){"use strict";e.exports=function(){}},{}],748:[function(t,e,r){"use strict";var n=t("d3"),i=t("fast-isnumeric"),a=[];e.exports=function(t,e){function r(t){t.duration(700).style("opacity",0).each("end",function(t){var e=a.indexOf(t);-1!==e&&a.splice(e,1),n.select(this).remove()})}if(-1===a.indexOf(t)){a.push(t);var o=1e3;i(e)?o=e:"long"===e&&(o=3e3);var s=n.select("body").selectAll(".plotly-notifier").data([0]);s.enter().append("div").classed("plotly-notifier",!0);s.selectAll(".notifier-note").data(a).enter().append("div").classed("notifier-note",!0).style("opacity",0).each(function(t){var e=n.select(this);e.append("button").classed("notifier-close",!0).html("&times;").on("click",function(){e.transition().call(r)});for(var i=e.append("p"),a=t.split(/<br\s*\/?>/g),s=0;s<a.length;s++)s&&i.append("br"),i.append("span").text(a[s]);e.transition().duration(700).style("opacity",1).transition().delay(o).call(r)})}}},{d3:123,"fast-isnumeric":132}],749:[function(t,e,r){"use strict";var n=t("./setcursor"),i="data-savedcursor";e.exports=function(t,e){var r=t.attr(i);if(e){if(!r){for(var a=(t.attr("class")||"").split(" "),o=0;o<a.length;o++){var s=a[o];0===s.indexOf("cursor-")&&t.attr(i,s.substr(7)).classed(s,!1)}t.attr(i)||t.attr(i,"!!")}n(t,e)}else r&&(t.attr(i,null),"!!"===r?n(t):n(t,r))}},{"./setcursor":757}],750:[function(t,e,r){"use strict";var n=t("./matrix").dot,i=t("../constants/numerical").BADNUM,a=e.exports={};a.tester=function(t){if(Array.isArray(t[0][0]))return a.multitester(t);var e,r=t.slice(),n=r[0][0],o=n,s=r[0][1],l=s;for(r.push(r[0]),e=1;e<r.length;e++)n=Math.min(n,r[e][0]),o=Math.max(o,r[e][0]),s=Math.min(s,r[e][1]),l=Math.max(l,r[e][1]);var c,u=!1;5===r.length&&(r[0][0]===r[1][0]?r[2][0]===r[3][0]&&r[0][1]===r[3][1]&&r[1][1]===r[2][1]&&(u=!0,c=function(t){return t[0]===r[0][0]}):r[0][1]===r[1][1]&&r[2][1]===r[3][1]&&r[0][0]===r[3][0]&&r[1][0]===r[2][0]&&(u=!0,c=function(t){return t[1]===r[0][1]}));var h=!0,f=r[0];for(e=1;e<r.length;e++)if(f[0]!==r[e][0]||f[1]!==r[e][1]){h=!1;break}return{xmin:n,xmax:o,ymin:s,ymax:l,pts:r,contains:u?function(t,e){var r=t[0],a=t[1];return!(r===i||r<n||r>o||a===i||a<s||a>l||e&&c(t))}:function(t,e){var a=t[0],c=t[1];if(a===i||a<n||a>o||c===i||c<s||c>l)return!1;var u,h,f,d,p,m=r.length,g=r[0][0],v=r[0][1],y=0;for(u=1;u<m;u++)if(h=g,f=v,g=r[u][0],v=r[u][1],d=Math.min(h,g),!(a<d||a>Math.max(h,g)||c>Math.max(f,v)))if(c<Math.min(f,v))a!==d&&y++;else{if(p=g===h?c:f+(a-h)*(v-f)/(g-h),c===p)return 1!==u||!e;c<=p&&a!==d&&y++}return y%2==1},isRect:u,degenerate:h}},a.multitester=function(t){for(var e=[],r=t[0][0][0],n=r,i=t[0][0][1],o=i,s=0;s<t.length;s++){var l=a.tester(t[s]);l.subtract=t[s].subtract,e.push(l),r=Math.min(r,l.xmin),n=Math.max(n,l.xmax),i=Math.min(i,l.ymin),o=Math.max(o,l.ymax)}return{xmin:r,xmax:n,ymin:i,ymax:o,pts:[],contains:function(t,r){for(var n=!1,i=0;i<e.length;i++)e[i].contains(t,r)&&(n=!1===e[i].subtract);return n},isRect:!1,degenerate:!1}};var o=a.isSegmentBent=function(t,e,r,i){var a,o,s,l=t[e],c=[t[r][0]-l[0],t[r][1]-l[1]],u=n(c,c),h=Math.sqrt(u),f=[-c[1]/h,c[0]/h];for(a=e+1;a<r;a++)if(o=[t[a][0]-l[0],t[a][1]-l[1]],(s=n(o,c))<0||s>u||Math.abs(n(o,f))>i)return!0;return!1};a.filter=function(t,e){function r(r){t.push(r);var s=n.length,l=i;n.splice(a+1);for(var c=l+1;c<t.length;c++)(c===t.length-1||o(t,l,c+1,e))&&(n.push(t[c]),n.length<s-2&&(i=c,a=n.length-1),l=c)}var n=[t[0]],i=0,a=0;if(t.length>1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":717,"./matrix":744}],751:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;r<t.length;r++)if(t[r]instanceof RegExp&&t[r].toString()===n)return t;t.push(e)}else e&&-1===t.indexOf(e)&&t.push(e);return t}},{}],752:[function(t,e,r){"use strict";var n=t("../lib"),i=t("../plot_api/plot_config"),a={};a.add=function(t,e,r,n,a){var o,s;t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},s=t.undoQueue.index,t.autoplay?t.undoQueue.inSequence||(t.autoplay=!1):(!t.undoQueue.sequence||t.undoQueue.beginSequence?(o={undo:{calls:[],args:[]},redo:{calls:[],args:[]}},t.undoQueue.queue.splice(s,t.undoQueue.queue.length-s,o),t.undoQueue.index+=1):o=t.undoQueue.queue[s-1],t.undoQueue.beginSequence=!1,o&&(o.undo.calls.unshift(e),o.undo.args.unshift(r),o.redo.calls.push(n),o.redo.args.push(a)),t.undoQueue.queue.length>i.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--))},a.startSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},a.stopSequence=function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},a.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<e.undo.calls.length;r++)a.plotDo(t,e.undo.calls[r],e.undo.args[r]);t.undoQueue.inSequence=!1,t.autoplay=!1}},a.redo=function(t){var e,r;if(t.framework&&t.framework.isPolar)t.framework.redo();else if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index>=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r<e.redo.calls.length;r++)a.plotDo(t,e.redo.calls[r],e.redo.args[r]);t.undoQueue.inSequence=!1,t.autoplay=!1,t.undoQueue.index++}},a.plotDo=function(t,e,r){t.autoplay=!0,r=function(t,e){for(var r,i=[],a=0;a<e.length;a++)r=e[a],i[a]=r===t?r:"object"==typeof r?Array.isArray(r)?n.extendDeep([],r):n.extendDeepAll({},r):r;return i}(t,r),e.apply(null,r)},e.exports=a},{"../lib":738,"../plot_api/plot_config":773}],753:[function(t,e,r){"use strict";r.counter=function(t,e,r){return new RegExp("^"+t+"([2-9]|[1-9][0-9]+)?"+(e||"")+(r?"":"$"))}},{}],754:[function(t,e,r){"use strict";var n=/^(.*)(\.[^\.\[\]]+|\[\d\])$/,i=/^[^\.\[\]]+$/;e.exports=function(t,e){for(;e;){var r=t.match(n);if(r)t=r[1];else{if(!t.match(i))throw new Error("bad relativeAttr call:"+[t,e]);t=""}if("^"!==e.charAt(0))break;e=e.slice(1)}return t&&"["!==e.charAt(0)?t+"."+e:t+e}},{}],755:[function(t,e,r){"use strict";var n=t("./is_array"),i=t("./is_plain_object");e.exports=function t(e,r){for(var a=Object.keys(r||{}),o=0;o<a.length;o++){var s=a[o],l=r[s],c=e[s];if("_"===s.charAt(0)||"function"==typeof l){if(s in e)continue;e[s]=l}else if(n(l)&&n(c)&&i(l[0]))for(var u=0;u<l.length;u++)i(l[u])&&i(c[u])&&t(c[u],l[u]);else i(l)&&i(c)&&(t(c,l),Object.keys(c).length||delete e[s])}}},{"./is_array":739,"./is_plain_object":740}],756:[function(t,e,r){"use strict";function n(t,e){return t<e}function i(t,e){return t<=e}function a(t,e){return t>e}function o(t,e){return t>=e}var s=t("fast-isnumeric"),l=t("./loggers");r.findBin=function(t,e,r){if(s(e.start))return r?Math.ceil((t-e.start)/e.size-1e-9)-1:Math.floor((t-e.start)/e.size+1e-9);var c,u,h=0,f=e.length,d=0,p=f>1?(e[f-1]-e[0])/(f-1):1;for(u=p>=0?r?n:i:r?o:a,t+=1e-9*p*(r?-1:1)*(p>=0?1:-1);h<f&&d++<100;)u(e[c=Math.floor((h+f)/2)],t)?h=c+1:f=c;return d>90&&l.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){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,a=i/(n||1)/1e4,o=[e[0]],s=0;s<n;s++)e[s+1]>e[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,c=r?Math.ceil:Math.floor;i<a&&o++<100;)e[n=c((i+a)/2)]<=t?i=n+s:a=n-l;return e[i]}},{"./loggers":743,"fast-isnumeric":132}],757:[function(t,e,r){"use strict";e.exports=function(t,e){(t.attr("class")||"").split(" ").forEach(function(e){0===e.indexOf("cursor-")&&t.classed(e,!1)}),e&&t.classed("cursor-"+e,!0)}},{}],758:[function(t,e,r){"use strict";var n=t("../components/color"),i=function(){};e.exports=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=i);t.destroy=function(){t.container.parentNode.removeChild(t.container)};var r=document.createElement("div");return r.textContent="Webgl is not supported by your browser - visit http://get.webgl.org for more info",r.style.cursor="pointer",r.style.fontSize="24px",r.style.color=n.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1}},{"../components/color":613}],759:[function(t,e,r){"use strict";var n=t("fast-isnumeric");r.aggNums=function(t,e,i,a){var o,s;if(a||(a=i.length),n(e)||(e=!1),Array.isArray(i[0])){for(s=new Array(a),o=0;o<a;o++)s[o]=r.aggNums(t,e,i[o]);i=s}for(o=0;o<a;o++)n(e)?n(i[o])&&(e=t(+e,+i[o])):e=i[o];return e},r.len=function(t){return r.aggNums(function(t){return t+1},0,t)},r.mean=function(t,e){return e||(e=r.len(t)),r.aggNums(function(t,e){return t+e},0,t)/e},r.variance=function(t,e,i){return e||(e=r.len(t)),n(i)||(i=r.mean(t,e)),r.aggNums(function(t,e){return t+Math.pow(e-i,2)},0,t)/e},r.stdev=function(t,e,n){return Math.sqrt(r.variance(t,e,n))},r.interp=function(t,e){if(!n(e))throw"n should be a finite number";if((e=e*t.length-.5)<0)return t[0];if(e>t.length-1)return t[t.length-1];var r=e%1;return r*t[Math.ceil(e)]+(1-r)*t[Math.floor(e)]}},{"fast-isnumeric":132}],760:[function(t,e,r){"use strict";var n=t("color-rgba");e.exports=function(t){var e=n(t);return e.length?e:[0,0,0,1]}},{"color-rgba":96}],761:[function(t,e,r){"use strict";function n(t,e){return t.node().getBoundingClientRect()[e]}function i(t,e,r){var n="math-output-"+c.randstr([],64),i=l.select("body").append("div").attr({id:n}).style({visibility:"hidden",position:"absolute"}).style({"font-size":e.fontSize+"px"}).text(function(t){return t.replace(p,"\\lt ").replace(m,"\\gt ")}(t));MathJax.Hub.Queue(["Typeset",MathJax.Hub,i.node()],function(){var e=l.select("body").select("#MathJax_SVG_glyphs");if(i.select(".MathJax_SVG").empty()||!i.select("svg").node())c.log("There was an error in the tex syntax.",t),r();else{var n=i.select("svg").node().getBoundingClientRect();r(i.select(".MathJax_SVG"),e,n)}i.remove()})}function a(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}function o(t,e){function r(){p++;var e=document.createElementNS(u.svg,"tspan");l.select(e).attr({class:"line",dy:p*f+"em"}),t.appendChild(e),s=e;var r=d;if(d=[{node:e}],r.length>1)for(var i=1;i<r.length;i++)n(r[i])}function n(t){var e,r=t.type,n={};if("a"===r){e="a";var a=t.target,o=t.href,c=t.popup;o&&(n={"xlink:xlink:show":"_blank"===a||"_"!==a.charAt(0)?"new":"replace",target:a,"xlink:xlink:href":o},c&&(n.onclick='window.open(this.href.baseVal,this.target.baseVal,"'+c+'");return false;'))}else e="tspan";t.style&&(n.style=t.style);var h=document.createElementNS(u.svg,e);if("sup"===r||"sub"===r){i(s,b),s.appendChild(h);var f=document.createElementNS(u.svg,"tspan");i(f,b),l.select(f).attr("dy",y[r]),n.dy=v[r],s.appendChild(h),s.appendChild(f)}else s.appendChild(h);l.select(h).attr(n),s=t.node=h,d.push(t)}function i(t,e){t.appendChild(document.createTextNode(e))}function o(t){if(1!==d.length){var r=d.pop();t!==r.type&&c.log("Start tag <"+r.type+"> doesnt match end tag <"+t+">. Pretending it did match.",e),s=d[d.length-1].node}else c.log("Ignoring unexpected end tag </"+t+">.",e)}e=function(t){return function(t,e){if(!t)return"";for(var r=0;r<e.length;r++){var n=e[r];t=t.replace(n.regExp,n.sub)}return t}(t,w)}(e).replace(M," ");var s,h=!1,d=[],p=-1;A.test(e)?r():(s=t,d=[{node:t}]);for(var m=e.split(k),_=0;_<m.length;_++){var P=m[_],D=P.match(T),z=D&&D[2].toLowerCase(),O=g[z];if("br"===z)r();else if(void 0===O)i(s,P);else if(D[1])o(z);else{var F=D[4],R={type:z},j=a(F,S);if(j?(j=j.replace(I,"$1 fill:"),O&&(j+=";"+O)):O&&(j=O),j&&(R.style=j),"a"===z){h=!0;var N=a(F,E);if(N){var B=document.createElement("a");B.href=N,-1!==x.indexOf(B.protocol)&&(R.href=encodeURI(N),R.target=a(F,L)||"_blank",R.popup=a(F,C))}}n(R)}}return h}function s(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),c=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()-c.top+"px",left:a()-c.left+"px","z-index":1e3}),this}}var l=t("d3"),c=t("../lib"),u=t("../constants/xmlns_namespaces"),h=t("../constants/string_mappings"),f=t("../constants/alignment").LINE_SPACING,d=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;r.convertToTspans=function(t,e,a){function s(){h.empty()||(f=t.attr("class")+"-math",h.select("svg."+f).remove()),t.text("").style("white-space","pre");o(t.node(),c)&&t.style("pointer-events","all"),r.positionText(t),a&&a.call(t)}var c=t.text(),u=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&c.match(d),h=l.select(t.node().parentNode);if(!h.empty()){var f=t.attr("class")?t.attr("class").split(" ")[0]:"text";return f+="-math",h.selectAll("svg."+f).remove(),h.selectAll("g."+f+"-group").remove(),t.style("display",null).attr({"data-unformatted":c,"data-math":"N"}),u?(e&&e._promises||[]).push(new Promise(function(e){t.style("display","none");var r=parseInt(t.node().style.fontSize,10);i(u[2],{fontSize:r},function(i,o,l){h.selectAll("svg."+f).remove(),h.selectAll("g."+f+"-group").remove();var u=i&&i.select("svg");if(!u||!u.node())return s(),void e();var d=h.append("g").classed(f+"-group",!0).attr({"pointer-events":"none","data-unformatted":c,"data-math":"Y"});d.node().appendChild(u.node()),o&&o.node()&&u.node().insertBefore(o.node().cloneNode(!0),u.node().firstChild),u.attr({class:f,height:l.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var p=t.node().style.fill||"black";u.select("g").attr({fill:p,stroke:p});var m=n(u,"width"),g=n(u,"height"),v=+t.attr("x")-m*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],y=-(r||n(t,"height"))/4;"y"===f[0]?(d.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-m/2,y-g/2]+")"}),u.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===f[0]?u.attr({x:t.attr("x"),y:y-g/2}):"a"===f[0]?u.attr({x:0,y:y}):u.attr({x:v,y:+t.attr("y")+y-g/2}),a&&a.call(t,d),e(d)})})):s(),t}};var p=/(<|&lt;|&#60;)/g,m=/(>|&gt;|&#62;)/g,g={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"},v={sub:"0.3em",sup:"-0.6em"},y={sub:"-0.21em",sup:"0.42em"},b="\u200b",x=["http:","https:","mailto:","",void 0,":"],_=new RegExp("</?("+Object.keys(g).join("|")+")( [^>]*)?/?>","g"),w=Object.keys(h.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:h.entityToUnicode[t]}}),M=/(\r\n?|\n)/g,k=/(<[^<>]*>)/,T=/<(\/?)([^ >]*)(\s+(.*))?>/i,A=/<br(\s+.*)?>/i,S=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,E=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,L=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,C=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i,I=/(^|;)\s*color:/;r.plainText=function(t){return(t||"").replace(_," ")},r.lineCount=function(t){return t.selectAll("tspan.line").size()||1},r.positionText=function(t,e,r){return t.each(function(){function t(t,e){return void 0===e?null===(e=n.attr(t))&&(n.attr(t,0),e=0):n.attr(t,e),e}var n=l.select(this),i=t("x",e),a=t("y",r);"text"===this.nodeName&&n.selectAll("tspan.line").attr({x:i,y:a})})},r.makeEditable=function(t,e){function r(){!function(){var r=l.select(i).select(".svg-container"),a=r.append("div"),c=t.node().style,u=parseFloat(c.fontSize||12);a.classed("plugin-editable editable",!0).style({position:"absolute","font-family":c.fontFamily||"Arial","font-size":u,color:e.fill||c.fill||"black",opacity:1,"background-color":e.background||"transparent",outline:"#ffffff33 1px solid",margin:[-u/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(e.text||t.attr("data-unformatted")).call(s(t,r,e)).on("blur",function(){i._editing=!1,t.text(this.textContent).style({opacity:1});var e,r=l.select(this).attr("class");(e=r?"."+r.split(" ")[0]+"-math-group":"[class*=-math-group]")&&l.select(t.node().parentNode).select(e).style({opacity:0});var n=this.textContent;l.select(this).transition().duration(0).remove(),l.select(document).on("mouseup",null),o.edit.call(t,n)}).on("focus",function(){var t=this;i._editing=!0,l.select(document).on("mouseup",function(){if(l.event.target===t)return!1;document.activeElement===a.node()&&a.node().blur()})}).on("keyup",function(){27===l.event.which?(i._editing=!1,t.style({opacity:1}),l.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),o.cancel.call(t,this.textContent)):(o.input.call(t,this.textContent),l.select(this).call(s(t,r,e)))}).on("keydown",function(){13===l.event.which&&this.blur()}).call(n)}(),t.style({opacity:0});var r,a=c.attr("class");(r=a?"."+a.split(" ")[0]+"-math-group":"[class*=-math-group]")&&l.select(t.node().parentNode).select(r).style({opacity:0})}function n(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}var i=e.gd,a=e.delegate,o=l.dispatch("edit","input","cancel"),c=a||t;if(t.style({"pointer-events":a?"none":"all"}),1!==t.size())throw new Error("boo");return e.immediate?r():c.on("click",r),l.rebind(t,o,"on")}},{"../constants/alignment":711,"../constants/string_mappings":718,"../constants/xmlns_namespaces":719,"../lib":738,d3:123}],762:[function(t,e,r){"use strict";function n(t){t&&null!==t.timer&&(clearTimeout(t.timer),t.timer=null)}var i={};r.throttle=function(t,e,r){function a(){r(),o.ts=Date.now(),o.onDone&&(o.onDone(),o.onDone=null)}var o=i[t],s=Date.now();if(!o){for(var l in i)i[l].ts<s-6e4&&delete i[l];o=i[t]={ts:0,timer:null}}n(o),s>o.ts+e?a():o.timer=setTimeout(function(){a(),o.timer=null},e)},r.done=function(t){var e=i[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)n(i[t]),delete i[t];else for(var e in i)r.clear(e)}},{}],763:[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":132}],764:[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":812,"topojson-client":545}],765:[function(t,e,r){"use strict";e.exports=function(t,e){if(t instanceof Float32Array)return function(t,e){for(var r=new Float32Array(e),n=0;n<e;n++)r[n]=t[n];return r}(t,e);if(t instanceof Float64Array)return function(t,e){for(var r=new Float64Array(e),n=0;n<e;n++)r[n]=t[n];return r}(t,e);throw new Error("This array type is not yet supported by `truncate`.")}},{}],766:[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"}}},{}],767:[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"],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:["$",""]}}},{}],768:[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;s<a.length;s++)if((r=t.match(a[s]))&&0===r.index){e=r[0];break}if(e||(e=i[i.indexOf(o)]),!e)return!1;var l=t.substr(e.length);return l?!!(r=l.match(/^\[(0|[1-9][0-9]*)\](\.(.+))?$/))&&{array:e,index:Number(r[1]),property:r[3]||""}:{array:e,index:"",property:""}}},{"../registry":861}],769:[function(t,e,r){"use strict";function n(t){for(var e={},r=0;r<t.length;r++)e[t[r]]=!1;return e}function i(t,e,r){var n=s({},t);for(var i in n){var o=n[i];l(o)&&(n[i]=a(o,e,r,i))}return"from-root"===r&&(n.editType=e),n}function a(t,e,r,n){if(t.valType){var o=s({},t);if(o.editType=e,Array.isArray(t.items)){o.items=new Array(t.items.length);for(var l=0;l<t.items.length;l++)o.items[l]=a(t.items[l],e,"from-root")}return o}return i(t,e,"_"===n.charAt(0)?"nested":"from-root")}var o=t("../lib"),s=o.extendFlat,l=o.isPlainObject,c={valType:"flaglist",extras:["none"],flags:["calc","calcIfAutorange","clearAxisTypes","plot","style","colorbars"]},u={valType:"flaglist",extras:["none"],flags:["calc","calcIfAutorange","plot","legend","ticks","layoutstyle","modebar","camera","arraydraw"]},h=c.flags.slice().concat(["clearCalc","fullReplot"]),f=u.flags.slice().concat("layoutReplot");e.exports={traces:c,layout:u,traceFlags:function(){return n(h)},layoutFlags:function(){return n(f)},update:function(t,e){var r=e.editType;if(r&&"none"!==r)for(var n=r.split("+"),i=0;i<n.length;i++)t[n[i]]=!0},overrideAll:i}},{"../lib":738}],770:[function(t,e,r){"use strict";function n(t,e){var r=t[e],n=e.charAt(0);r&&"paper"!==r&&(t[e]=d(r,n))}function i(t){var e="middle",r="center";return-1!==t.indexOf("top")?e="top":-1!==t.indexOf("bottom")&&(e="bottom"),-1!==t.indexOf("left")?r="left":-1!==t.indexOf("right")&&(r="right"),e+" "+r}function a(t,e){return e in t&&"object"==typeof t[e]&&0===Object.keys(t[e]).length}function o(t){var e=t.search(g);if(e>0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),h=t("../plots/plots"),f=t("../plots/cartesian/axis_ids"),d=f.cleanId,p=f.getFromTrace,m=t("../components/color");r.clearPromiseQueue=function(t){Array.isArray(t._promises)&&t._promises.length>0&&u.log("Clearing previous rejected promises from queue."),t._promises=[]},r.cleanLayout=function(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var i=(h.subplotsRegistry.cartesian||{}).attrRegex,o=(h.subplotsRegistry.gl3d||{}).attrRegex,s=Object.keys(t);for(e=0;e<s.length;e++){var c=s[e];if(i&&i.test(c)){var f=t[c];f.anchor&&"free"!==f.anchor&&(f.anchor=d(f.anchor)),f.overlaying&&(f.overlaying=d(f.overlaying)),f.type||(f.isdate?f.type="date":f.islog?f.type="log":!1===f.isdate&&!1===f.islog&&(f.type="linear")),"withzero"!==f.autorange&&"tozero"!==f.autorange||(f.autorange=!0,f.rangemode="tozero"),delete f.islog,delete f.isdate,delete f.categories,a(f,"domain")&&delete f.domain,void 0!==f.autotick&&(void 0===f.tickmode&&(f.tickmode=f.autotick?"auto":"linear"),delete f.autotick)}else if(o&&o.test(c)){var p=t[c],g=p.cameraposition;if(Array.isArray(g)&&4===g[0].length){var v=g[0],y=g[1],b=g[2],x=l([],v),_=[];for(r=0;r<3;++r)_[r]=y[r]+b*x[2+4*r];p.camera={eye:{x:_[0],y:_[1],z:_[2]},center:{x:y[0],y:y[1],z:y[2]},up:{x:x[1],y:x[5],z:x[9]}},delete p.cameraposition}}}var w=Array.isArray(t.annotations)?t.annotations.length:0;for(e=0;e<w;e++){var M=t.annotations[e];u.isPlainObject(M)&&(M.ref&&("paper"===M.ref?(M.xref="paper",M.yref="paper"):"data"===M.ref&&(M.xref="x",M.yref="y"),delete M.ref),n(M,"xref"),n(M,"yref"))}var k=Array.isArray(t.shapes)?t.shapes.length:0;for(e=0;e<k;e++){var T=t.shapes[e];u.isPlainObject(T)&&(n(T,"xref"),n(T,"yref"))}var A=t.legend;return A&&(A.x>3?(A.x=1.02,A.xanchor="left"):A.x<-2&&(A.x=-.02,A.xanchor="right"),A.y>3?(A.y=1.02,A.yanchor="bottom"):A.y<-2&&(A.y=-.02,A.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),m.clean(t),t},r.cleanData=function(t,e){for(var n=[],o=t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid}),s=0;s<t.length;s++){var l,f=t[s];if(!("uid"in f)||-1!==n.indexOf(f.uid)){var p;for(l=0;l<100&&(p=u.randstr(o),-1!==n.indexOf(p));l++);f.uid=u.randstr(o),o.push(f.uid)}if(n.push(f.uid),"histogramy"===f.type&&"xbins"in f&&!("ybins"in f)&&(f.ybins=f.xbins,delete f.xbins),f.error_y&&"opacity"in f.error_y){var g=m.defaults,v=f.error_y.color||(c.traceIs(f,"bar")?m.defaultLine:g[s%g.length]);f.error_y.color=m.addOpacity(m.rgb(v),m.opacity(v)*f.error_y.opacity),delete f.error_y.opacity}if("bardir"in f&&("h"!==f.bardir||!c.traceIs(f,"bar")&&"histogram"!==f.type.substr(0,9)||(f.orientation="h",r.swapXYData(f)),delete f.bardir),"histogramy"===f.type&&r.swapXYData(f),"histogramx"!==f.type&&"histogramy"!==f.type||(f.type="histogram"),"scl"in f&&(f.colorscale=f.scl,delete f.scl),"reversescl"in f&&(f.reversescale=f.reversescl,delete f.reversescl),f.xaxis&&(f.xaxis=d(f.xaxis,"x")),f.yaxis&&(f.yaxis=d(f.yaxis,"y")),c.traceIs(f,"gl3d")&&f.scene&&(f.scene=h.subplotsRegistry.gl3d.cleanId(f.scene)),c.traceIs(f,"pie")||c.traceIs(f,"bar")||(Array.isArray(f.textposition)?f.textposition=f.textposition.map(i):f.textposition&&(f.textposition=i(f.textposition))),c.traceIs(f,"2dMap")&&("YIGnBu"===f.colorscale&&(f.colorscale="YlGnBu"),"YIOrRd"===f.colorscale&&(f.colorscale="YlOrRd")),c.traceIs(f,"markerColorscale")&&f.marker){var y=f.marker;"YIGnBu"===y.colorscale&&(y.colorscale="YlGnBu"),"YIOrRd"===y.colorscale&&(y.colorscale="YlOrRd")}if("surface"===f.type&&u.isPlainObject(f.contours)){var b=["x","y","z"];for(l=0;l<b.length;l++){var x=f.contours[b[l]];u.isPlainObject(x)&&(x.highlightColor&&(x.highlightcolor=x.highlightColor,delete x.highlightColor),x.highlightWidth&&(x.highlightwidth=x.highlightWidth,delete x.highlightWidth))}}if(Array.isArray(f.transforms)){var _=f.transforms;for(l=0;l<_.length;l++){var w=_[l];if(u.isPlainObject(w))switch(w.type){case"filter":w.filtersrc&&(w.target=w.filtersrc,delete w.filtersrc),w.calendar&&(w.valuecalendar||(w.valuecalendar=w.calendar),delete w.calendar);break;case"groupby":if(w.styles=w.styles||w.style,w.styles&&!Array.isArray(w.styles)){var M=w.styles,k=Object.keys(M);w.styles=[];for(var T=0;T<k.length;T++)w.styles.push({target:k[T],value:M[k[T]]})}}}}a(f,"line")&&delete f.line,"marker"in f&&(a(f.marker,"line")&&delete f.marker.line,a(f,"marker")&&delete f.marker),m.clean(f)}},r.swapXYData=function(t){var e;if(u.swapAttrs(t,["?","?0","d?","?bins","nbins?","autobin?","?src","error_?"]),Array.isArray(t.z)&&Array.isArray(t.z[0])&&(t.transpose?delete t.transpose:t.transpose=!0),t.error_x&&t.error_y){var r=t.error_y,n="copy_ystyle"in r?r.copy_ystyle:!(r.color||r.thickness||r.width);u.swapAttrs(t,["error_?.copy_ystyle"]),n&&u.swapAttrs(t,["error_?.color","error_?.thickness","error_?.width"])}if("string"==typeof t.hoverinfo){var i=t.hoverinfo.split("+");for(e=0;e<i.length;e++)"x"===i[e]?i[e]="y":"y"===i[e]&&(i[e]="x");t.hoverinfo=i.join("+")}},r.coerceTraceIndices=function(t,e){return s(e)?[e]:Array.isArray(e)&&e.length?e:t.data.map(function(t,e){return e})},r.manageArrayContainers=function(t,e,r){var n=t.obj,i=t.parts,a=i.length,o=i[a-1],l=s(o);if(l&&null===e){var c=i.slice(0,a-1).join(".");u.nestedProperty(n,c).get().splice(o,1)}else l&&void 0===t.get()?(void 0===t.get()&&(r[t.astr]=null),t.set(e)):t.set(e)};var g=/(\.[^\[\]\.]+|\[[^\[\]\.]+\])$/;r.hasParent=function(t,e){for(var r=o(e);r;){if(r in t)return!0;r=o(r)}return!1};var v=["x","y","z"];r.clearAxisTypes=function(t,e,r){for(var n=0;n<e.length;n++)for(var i=t._fullData[n],a=0;a<3;a++){var o=p(t,i,v[a]);if(o&&"log"!==o.type){var s=o._name,l=o._id.substr(1);if("scene"===l.substr(0,5)){if(void 0!==r[l])continue;s=l+"."+s}var c=s+".type";void 0===r[s]&&void 0===r[c]&&u.nestedProperty(t.layout,c).set(null)}}}},{"../components/color":613,"../lib":738,"../plots/cartesian/axis_ids":788,"../plots/plots":846,"../registry":861,"fast-isnumeric":132,"gl-mat4/fromQuat":179}],771:[function(t,e,r){"use strict";var n=t("../lib/nested_property"),i=t("../lib/is_plain_object"),a=t("../lib/noop"),o=t("../lib/loggers"),s=t("../lib/search").sorterAsc,l=t("../registry");r.containerArrayMatch=t("./container_array_match");var c=r.isAddVal=function(t){return"add"===t||i(t)},u=r.isRemoveVal=function(t){return null===t||"remove"===t};r.applyContainerArrayChanges=function(t,e,r,i){var h=e.astr,f=l.getComponentMethod(h,"supplyLayoutDefaults"),d=l.getComponentMethod(h,"draw"),p=l.getComponentMethod(h,"drawOne"),m=i.replot||i.recalc||f===a||d===a,g=t.layout,v=t._fullLayout;if(r[""]){Object.keys(r).length>1&&o.warn("Full array edits are incompatible with other edits",h);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",h,y),!0;e.set(y)}return!m&&(f(g,v),d(t),!0)}var b,x,_,w,M,k,T,A=Object.keys(r).map(Number).sort(s),S=e.get(),E=S||[],L=n(v,h).get(),C=[],I=-1,P=E.length;for(b=0;b<A.length;b++)if(_=A[b],w=r[_],M=Object.keys(w),k=w[""],T=c(k),_<0||_>E.length-(T?0:1))o.warn("index out of range",h,_);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",h,_),u(k)?C.push(_):T?("add"===k&&(k={}),E.splice(_,0,k),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",h,_,k),-1===I&&(I=_);else for(x=0;x<M.length;x++)n(E[_],M[x]).set(w[M[x]]);for(b=C.length-1;b>=0;b--)E.splice(C[b],1),L&&L.splice(C[b],1);if(E.length?S||e.set(E):e.set(null),m)return!1;if(f(g,v),p!==a){var D;if(-1===I)D=A;else{for(P=Math.max(E.length,P),D=[],b=0;b<A.length&&!((_=A[b])>=I);b++)D.push(_);for(b=I;b<P;b++)D.push(b)}for(b=0;b<D.length;b++)p(t,D[b])}else d(t);return!0}},{"../lib/is_plain_object":740,"../lib/loggers":743,"../lib/nested_property":746,"../lib/noop":747,"../lib/search":756,"../registry":861,"./container_array_match":768}],772:[function(t,e,r){"use strict";function n(t,e){try{t._fullLayout._paper.style("background",e)}catch(t){v.error(t)}}function i(t,e){n(t,A.combine(e,"white"))}function a(t,e){var r,n,i=e+1,a=[];for(r=0;r<t.length;r++)(n=t[r])<0?a.push(i+n):a.push(n);return a}function o(t,e,r){var n,i;for(n=0;n<e.length;n++){if((i=e[n])!==parseInt(i,10))throw new Error("all values in "+r+" must be integers");if(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 s(t,e,r){if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("currentIndices is a required argument.");if(Array.isArray(e)||(e=[e]),o(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&o(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function l(t,e,r,n,i,s){!function(t,e,r,n){var i=v.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!v.isPlainObject(e))throw new Error("update must be a key:value object");if(void 0===r)throw new Error("indices must be an integer or array of integers");o(t,r,"indices");for(var a in 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,c,u,h=function(t,e,r,n){var i,o,s,l,c,u=v.isPlainObject(n),h=[];Array.isArray(r)||(r=[r]),r=a(r,t.data.length-1);for(var f in e)for(var d=0;d<r.length;d++){if(i=t.data[r[d]],s=v.nestedProperty(i,f),o=s.get(),l=e[f][d],!Array.isArray(l))throw new Error("attribute: "+f+" index: "+d+" must be an array");if(!Array.isArray(o))throw new Error("cannot extend missing or non-array attribute: "+f);c=u?n[f][d]:n,p(c)||(c=-1),h.push({prop:s,target:o,insert:l,maxp:Math.floor(c)})}return h}(t,e,r,n),f=[],d={},m={},g=0;g<h.length;g++)c=h[g].prop,u=h[g].maxp,l=i(h[g].target,h[g].insert),u>=0&&u<l.length&&(f=s(l,u)),u=h[g].target.length,c.set(l),Array.isArray(d[c.astr])||(d[c.astr]=[]),Array.isArray(m[c.astr])||(m[c.astr]=[]),d[c.astr].push(f),m[c.astr].push(u);return{update:d,maxPoints:m}}function c(t){return void 0===t?null:t}function u(t,e,r){function n(){return r.map(function(){})}function i(t){var e=g.Axes.id2name(t);-1===u.indexOf(e)&&u.push(e)}function a(t){return"LAYOUT"+t+".autorange"}function o(t){return"LAYOUT"+t+".range"}function s(i,a,o){if(Array.isArray(i))i.forEach(function(t){s(t,a,o)});else if(!(i in e||I.hasParent(e,i))){var l;l="LAYOUT"===i.substr(0,6)?v.nestedProperty(t.layout,i.replace("LAYOUT","")):v.nestedProperty(d[r[o]],i),i in y||(y[i]=n()),void 0===y[i][o]&&(y[i][o]=c(l.get())),void 0!==a&&l.set(a)}}var l,u,h=t._fullLayout,f=t._fullData,d=t.data,p=D.traceFlags(),m={},y={},b={};for(var M in e){if(I.hasParent(e,M))throw new Error("cannot set "+M+"and a parent attribute simultaneously");var k,T,A,S,E,L,C=e[M];if(m[M]=C,"LAYOUT"!==M.substr(0,6)){for(y[M]=n(),l=0;l<r.length;l++)if(k=d[r[l]],T=f[r[l]],A=v.nestedProperty(k,M),S=A.get(),void 0!==(E=Array.isArray(C)?C[l%C.length]:C)){if((L=_.getTraceValObject(T,A.parts))&&L.impliedEdits&&null!==E)for(var P in L.impliedEdits)s(v.relativeAttr(M,P),L.impliedEdits[P],l);else if("colorbar.thicknessmode"===M&&A.get()!==E&&-1!==["fraction","pixels"].indexOf(E)&&T.colorbar){var z=-1!==["top","bottom"].indexOf(T.colorbar.orient)?h.height-h.margin.t-h.margin.b:h.width-h.margin.l-h.margin.r;s("colorbar.thickness",T.colorbar.thickness*("fraction"===E?1/z:z),l)}else if("colorbar.lenmode"===M&&A.get()!==E&&-1!==["fraction","pixels"].indexOf(E)&&T.colorbar){var O=-1!==["top","bottom"].indexOf(T.colorbar.orient)?h.width-h.margin.l-h.margin.r:h.height-h.margin.t-h.margin.b;s("colorbar.len",T.colorbar.len*("fraction"===E?1/O:O),l)}else"colorbar.tick0"!==M&&"colorbar.dtick"!==M||s("colorbar.tickmode","linear",l);if("type"===M&&"pie"===E!=("pie"===S)){var F="x",R="y";"bar"!==E&&"bar"!==S||"h"!==k.orientation||(F="y",R="x"),v.swapAttrs(k,["?","?src"],"labels",F),v.swapAttrs(k,["d?","?0"],"label",F),v.swapAttrs(k,["?","?src"],"values",R),"pie"===S?(v.nestedProperty(k,"marker.color").set(v.nestedProperty(k,"marker.colors").get()),h._pielayer.selectAll("g.trace").remove()):x.traceIs(k,"cartesian")&&(v.nestedProperty(k,"marker.colors").set(v.nestedProperty(k,"marker.color").get()),b[k.xaxis||"x"]=!0,b[k.yaxis||"y"]=!0)}y[M][l]=c(S);if(-1!==["swapxy","swapxyaxes","orientation","orientationaxes"].indexOf(M)){if("orientation"===M){A.set(E);var j=k.x&&!k.y?"h":"v";if((A.get()||j)===T.orientation)continue}else"orientationaxes"===M&&(k.orientation={v:"h",h:"v"}[T.orientation]);I.swapXYData(k),p.calc=p.clearAxisTypes=!0}else-1!==w.dataArrayContainers.indexOf(A.parts[0])?(I.manageArrayContainers(A,E,y),p.calc=!0):(L?L.arrayOk&&(Array.isArray(E)||Array.isArray(S))?p.calc=!0:D.update(p,L):p.calc=!0,A.set(E))}if(-1!==["swapxyaxes","orientationaxes"].indexOf(M)&&g.Axes.swap(t,r),"orientationaxes"===M){var N=v.nestedProperty(t.layout,"hovermode");"x"===N.get()?N.set("y"):"y"===N.get()&&N.set("x")}if(-1!==["orientation","type"].indexOf(M)){for(u=[],l=0;l<r.length;l++){var B=d[r[l]];x.traceIs(B,"cartesian")&&(i(B.xaxis||"x"),i(B.yaxis||"y"),"type"===M&&s(["autobinx","autobiny"],!0,l))}s(u.map(a),!0,0),s(u.map(o),[0,1],0)}}else A=v.nestedProperty(t.layout,M.replace("LAYOUT","")),y[M]=[c(A.get())],A.set(Array.isArray(C)?C[0]:C),p.calc=!0}var U=!1,V=g.Axes.list(t);for(l=0;l<V.length;l++)if(V[l].autorange){U=!0;break}var H=Object.keys(b);t:for(l=0;l<H.length;l++){for(var q=H[l],G=q.charAt(0),Y=G+"axis",W=0;W<d.length;W++)if(x.traceIs(d[W],"cartesian")&&(d[W][Y]||G)===q)continue t;s("LAYOUT"+g.Axes.id2name(q),null,0)}return(p.calc||p.calcIfAutorange&&U)&&(p.clearCalc=!0),(p.calc||p.plot||p.calcIfAutorange)&&(p.fullReplot=!0),{flags:p,undoit:y,redoit:m,traces:r,eventData:v.extendDeepNoArrays([],[m,r])}}function h(t,e){function r(t,n){if(Array.isArray(t))t.forEach(function(t){r(t,n)});else if(!(t in e||I.hasParent(e,t))){var i=v.nestedProperty(l,t);t in T||(T[t]=c(i.get())),void 0!==n&&i.set(n)}}function n(e,r){if(!v.isPlainObject(e))return!1;var n=e[r+"ref"]||r,i=g.Axes.getFromId(t,n);return i||n.charAt(0)!==r||(i=g.Axes.getFromId(t,r)),(i||{}).autorange}function i(t){var e=j.name2id(t.split(".")[0]);return A[e]=1,e}var a,o,s,l=t.layout,u=t._fullLayout,h=Object.keys(e),f=g.Axes.list(t),d={};for(o=0;o<h.length;o++)if(0===h[o].indexOf("allaxes")){for(s=0;s<f.length;s++){var p=f[s]._id.substr(1),m=-1!==p.indexOf("scene")?p+".":"",y=h[o].replace("allaxes",m+f[s]._name);e[y]||(e[y]=e[h[o]])}delete e[h[o]]}var b,M=D.layoutFlags(),k={},T={},A={};for(var S in e){if(I.hasParent(e,S))throw new Error("cannot set "+S+"and a parent attribute simultaneously");var E=v.nestedProperty(l,S),L=e[S],P=E.parts.length,O="string"==typeof E.parts[P-1]?P-1:P-2,F=E.parts[O],R=E.parts[O-1]+"."+F,N=E.parts.slice(0,O).join("."),B=v.nestedProperty(t.layout,N).get(),U=v.nestedProperty(u,N).get(),V=E.get();if(void 0!==L){k[S]=L,T[S]="reverse"===F?L:c(V);var H=_.getLayoutValObject(u,E.parts);if(H&&H.impliedEdits&&null!==L)for(var q in H.impliedEdits)r(v.relativeAttr(S,q),H.impliedEdits[q]);if(-1!==["width","height"].indexOf(S)&&null===L)u[S]=t._initialAutoSize[S];else if(R.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/))i(R),v.nestedProperty(u,N+"._inputRange").set(null);else if(R.match(/^[xyz]axis[0-9]*\.autorange$/)){i(R),v.nestedProperty(u,N+"._inputRange").set(null);var G=v.nestedProperty(u,N).get();G._inputDomain&&(G._input.domain=G._inputDomain.slice())}else R.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)&&v.nestedProperty(u,N+"._inputDomain").set(null);if("type"===F){var Y=B,W="linear"===U.type&&"log"===L,X="log"===U.type&&"linear"===L;if(W||X){if(Y&&Y.range)if(U.autorange)W&&(Y.range=Y.range[1]>Y.range[0]?[1,2]:[2,1]);else{var Z=Y.range[0],J=Y.range[1];W?(Z<=0&&J<=0&&r(N+".autorange",!0),Z<=0?Z=J/1e6:J<=0&&(J=Z/1e6),r(N+".range[0]",Math.log(Z)/Math.LN10),r(N+".range[1]",Math.log(J)/Math.LN10)):(r(N+".range[0]",Math.pow(10,Z)),r(N+".range[1]",Math.pow(10,J)))}else r(N+".autorange",!0);x.getComponentMethod("annotations","convertCoords")(t,U,L,r),x.getComponentMethod("images","convertCoords")(t,U,L,r)}else r(N+".autorange",!0),r(N+".range",null);v.nestedProperty(u,N+"._inputRange").set(null)}else if(F.match(z.AX_NAME_PATTERN)){var K=v.nestedProperty(u,S).get(),Q=(L||{}).type;Q&&"-"!==Q||(Q="linear"),x.getComponentMethod("annotations","convertCoords")(t,K,Q,r),x.getComponentMethod("images","convertCoords")(t,K,Q,r)}var $=C.containerArrayMatch(S);if($){a=$.array,o=$.index;var tt=$.property,et=(v.nestedProperty(l,a)||[])[o]||{},rt=et,nt=H||{editType:"calc"},it=-1!==nt.editType.indexOf("calcIfAutorange");""===o?(it?M.calc=!0:D.update(M,nt),it=!1):""===tt&&(rt=L,C.isAddVal(L)?T[S]=null:C.isRemoveVal(L)?(T[S]=et,rt=et):v.warn("unrecognized full object value",e)),it&&(n(rt,"x")||n(rt,"y"))?M.calc=!0:D.update(M,nt),d[a]||(d[a]={});var at=d[a][o];at||(at=d[a][o]={}),at[tt]=L,delete e[S]}else"reverse"===F?(B.range?B.range.reverse():(r(N+".autorange",!0),B.range=[1,0]),U.autorange?M.calc=!0:M.plot=!0):((!u._has("gl2d")&&!u._has("regl")||"dragmode"!==S||"lasso"!==L&&"select"!==L||"lasso"===V||"select"===V)&&H?D.update(M,H):M.calc=!0,E.set(L))}}for(a in d){C.applyContainerArrayChanges(t,v.nestedProperty(l,a),d[a],M)||(M.plot=!0)}var ot=u._axisConstraintGroups||[];for(b in A)for(o=0;o<ot.length;o++){var st=ot[o];if(st[b]){M.calc=!0;for(var lt in st)A[lt]||(j.getFromId(t,lt)._constraintShrinkable=!0)}}var ct=u.width,ut=u.height;t.layout.autosize&&w.plotAutoSize(t,t.layout,u);return(e.height||e.width||u.width!==ct||u.height!==ut)&&(M.calc=!0),(M.plot||M.calc)&&(M.layoutReplot=!0),{flags:M,undoit:T,redoit:k,eventData:v.extendDeep({},k)}}function f(t){var e=d.select(t),r=t._fullLayout;if(r._container=e.selectAll(".plot-container").data([0]),r._container.enter().insert("div",":first-child").classed("plot-container",!0).classed("plotly",!0),r._paperdiv=r._container.selectAll(".svg-container").data([0]),r._paperdiv.enter().append("div").classed("svg-container",!0).style("position","relative"),r._glcontainer=r._paperdiv.selectAll(".gl-container").data([{}]),r._glcontainer.enter().append("div").classed("gl-container",!0),r._glcanvas=null,r._paperdiv.selectAll(".main-svg").remove(),r._paper=r._paperdiv.insert("svg",":first-child").classed("main-svg",!0),r._toppaper=r._paperdiv.append("svg").classed("main-svg",!0),!r._uid){var n=[];d.selectAll("defs").each(function(){this.id&&n.push(this.id.split("-")[1])}),r._uid=v.randstr(n)}r._paperdiv.selectAll(".main-svg").attr(E.svgAttrs),r._defs=r._paper.append("defs").attr("id","defs-"+r._uid),r._clips=r._defs.append("g").classed("clips",!0),r._topdefs=r._toppaper.append("defs").attr("id","topdefs-"+r._uid),r._topclips=r._topdefs.append("g").classed("clips",!0),r._bgLayer=r._paper.append("g").classed("bglayer",!0),r._draggers=r._paper.append("g").classed("draglayer",!0);var i=r._paper.append("g").classed("layer-below",!0);r._imageLowerLayer=i.append("g").classed("imagelayer",!0),r._shapeLowerLayer=i.append("g").classed("shapelayer",!0),r._cartesianlayer=r._paper.append("g").classed("cartesianlayer",!0),r._ternarylayer=r._paper.append("g").classed("ternarylayer",!0),r._geolayer=r._paper.append("g").classed("geolayer",!0),r._pielayer=r._paper.append("g").classed("pielayer",!0),r._glimages=r._paper.append("g").classed("glimages",!0);var a=r._toppaper.append("g").classed("layer-above",!0);r._imageUpperLayer=a.append("g").classed("imagelayer",!0),r._shapeUpperLayer=a.append("g").classed("shapelayer",!0),r._infolayer=r._toppaper.append("g").classed("infolayer",!0),r._menulayer=r._toppaper.append("g").classed("menulayer",!0),r._zoomlayer=r._toppaper.append("g").classed("zoomlayer",!0),r._hoverlayer=r._toppaper.append("g").classed("hoverlayer",!0),t.emit("plotly_framework")}var d=t("d3"),p=t("fast-isnumeric"),m=t("has-hover"),g=t("../plotly"),v=t("../lib"),y=t("../lib/events"),b=t("../lib/queue"),x=t("../registry"),_=t("./plot_schema"),w=t("../plots/plots"),M=t("../plots/polar"),k=t("../plots/cartesian/graph_interact"),T=t("../components/drawing"),A=t("../components/color"),S=t("../components/errorbars"),E=t("../constants/xmlns_namespaces"),L=t("../lib/svg_text_utils"),C=t("./manage_arrays"),I=t("./helpers"),P=t("./subroutines"),D=t("./edit_types"),z=t("../plots/cartesian/constants"),O=t("../plots/cartesian/constraints"),F=O.enforce,R=O.clean,j=t("../plots/cartesian/axis_ids");g.plot=function(t,e,r,a){function o(){var e,r,n,i=t.calcdata;for(x.getComponentMethod("legend","draw")(t),x.getComponentMethod("rangeselector","draw")(t),x.getComponentMethod("sliders","draw")(t),x.getComponentMethod("updatemenus","draw")(t),e=0;e<i.length;e++)!0===(n=(r=i[e])[0].trace).visible&&n._module.colorbar?n._module.colorbar(t,r):w.autoMargin(t,"cb"+n.uid);return w.doAutoMargin(t),w.previousPromises(t)}function s(){if(!t._transitioning){for(var e=g.Axes.list(t,"",!0),r=0;r<e.length;r++){var n=e[r];R(t,n),g.Axes.doAutoRange(n)}F(t),u&&g.Axes.saveRangeInitial(t)}}var l;if(t=v.getGraphDiv(t),y.init(t),v.isPlainObject(e)){var c=e;e=c.data,r=c.layout,a=c.config,l=c.frames}if(!1===y.triggerHandler(t,"plotly_beforeplot",[e,r,a]))return Promise.reject();e||r||v.isPlotDiv(t)||v.warn("Calling Plotly.plot as if redrawing but this container doesn't yet have a plot.",t),function(t,e){t._context||(t._context=v.extendDeep({},g.defaultConfig));var r,a,o,s=t._context;if(e){for(a=Object.keys(e),r=0;r<a.length;r++)"editable"!==(o=a[r])&&"edits"!==o&&o in s&&("setBackground"===o&&"opaque"===e[o]?s[o]=i:s[o]=e[o]);e.plot3dPixelRatio&&!s.plotGlPixelRatio&&(s.plotGlPixelRatio=s.plot3dPixelRatio);var l=e.editable;if(void 0!==l)for(s.editable=l,a=Object.keys(s.edits),r=0;r<a.length;r++)s.edits[a[r]]=l;if(e.edits)for(a=Object.keys(e.edits),r=0;r<a.length;r++)(o=a[r])in s.edits&&(s.edits[o]=e.edits[o])}s.staticPlot&&(s.editable=!1,s.edits={},s.autosizable=!1,s.scrollZoom=!1,s.doubleClick=!1,s.showTips=!1,s.showLink=!1,s.displayModeBar=!1),"hover"!==s.displayModeBar||m||(s.displayModeBar=!0),"transparent"!==s.setBackground&&"function"==typeof s.setBackground||(s.setBackground=n)}(t,a),r||(r={}),d.select(t).classed("js-plotly-plot",!0),T.makeTester(),Array.isArray(t._promises)||(t._promises=[]);var u=0===(t.data||[]).length&&Array.isArray(e);if(Array.isArray(e)&&(I.cleanData(e,t.data),u?t.data=e:t.data.push.apply(t.data,e),t.empty=!1),t.layout&&!u||(t.layout=I.cleanLayout(r)),t._dragging&&!t._transitioning)return t._replotPending=!0,Promise.reject();t._replotPending=!1,w.supplyDefaults(t);var h=t._fullLayout;if(e&&e[0]&&e[0].r)return function(t,e,r){var n=d.select(t).selectAll(".plot-container").data([0]);n.enter().insert("div",":first-child").classed("plot-container plotly",!0);var i=n.selectAll(".svg-container").data([0]);i.enter().append("div").classed("svg-container",!0).style("position","relative"),i.html(""),e&&(t.data=e),r&&(t.layout=r),M.manager.fillLayout(t),i.style({width:t._fullLayout.width+"px",height:t._fullLayout.height+"px"}),t.framework=M.manager.framework(t),t.framework({data:t.data,layout:t.layout},i.node()),t.framework.setUndoPoint();var a=t.framework.svg(),o=1,s=t._fullLayout.title;""!==s&&s||(o=0);var l=function(){this.call(L.convertToTspans,t)},c=a.select(".title-group text").call(l);if(t._context.edits.titleText){var u=v._(t,"Click to enter Plot title");s&&s!==u||(o=.2,c.attr({"data-unformatted":u}).text(u).style({opacity:o}).on("mouseover.opacity",function(){d.select(this).transition().duration(100).style("opacity",1)}).on("mouseout.opacity",function(){d.select(this).transition().duration(1e3).style("opacity",0)}));var h=function(){this.call(L.makeEditable,{gd:t}).on("edit",function(e){t.framework({layout:{title:e}}),this.text(e).call(l),this.call(h)}).on("cancel",function(){var t=this.attr("data-unformatted");this.text(t).call(l)})};c.call(h)}return t._context.setBackground(t,t._fullLayout.paper_bgcolor),w.addLinks(t),Promise.resolve()}(t,e,r);h._replotting=!0,u&&f(t),t.framework!==f&&(t.framework=f,f(t)),T.initGradients(t),u&&g.Axes.saveShowSpikeInitial(t);var p=!t.calcdata||t.calcdata.length!==(t._fullData||[]).length;p&&w.doCalcdata(t);for(var b=0;b<t.calcdata.length;b++)t.calcdata[b][0].trace=t._fullData[b];var _=JSON.stringify(h._size),A=[w.previousPromises,function(){if(l)return g.addFrames(t,l)},function(){for(var e=h._basePlotModules,r=0;r<e.length;r++)e[r].drawFramework&&e[r].drawFramework(t);return!h._glcanvas&&h._has("gl")&&(h._glcanvas=h._glcontainer.selectAll(".gl-canvas").data([{key:"contextLayer",context:!0,pick:!1},{key:"focusLayer",context:!1,pick:!1},{key:"pickLayer",context:!1,pick:!0}],function(t){return t.key}),h._glcanvas.enter().append("canvas").attr("class",function(t){return"gl-canvas gl-canvas-"+t.key.replace("Layer","")}).style({position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible"}).attr("width",h.width).attr("height",h.height),h._glcanvas.filter(function(t){return!t.pick}).style({"pointer-events":"none"})),v.syncOrAsync([P.layoutStyles],t)},o,function(){if(JSON.stringify(h._size)!==_)return v.syncOrAsync([o,P.layoutStyles],t)},function(){if(p){var e,r,n,i=h._subplots.cartesian,a=h._modules,o=[];for(n=0;n<a.length;n++)v.pushUnique(o,a[n].setPositions);if(o.length)for(r=0;r<i.length;r++)for(e=h._plots[i[r]],n=0;n<o.length;n++)o[n](t,e);return S.calc(t),v.syncOrAsync([x.getComponentMethod("shapes","calcAutorange"),x.getComponentMethod("annotations","calcAutorange"),s,x.getComponentMethod("rangeslider","calcAutorange")],t)}F(t)},P.layoutStyles,function(){return g.Axes.doTicks(t,"redraw")},function(){var e,r=t.calcdata,n=h._infolayer.selectAll("g.rangeslider-container");for(e=0;e<r.length;e++){var i=r[e][0].trace,a=!0===i.visible,o=i.uid;if(!a||!x.traceIs(i,"2dMap")){var s=".hm"+o+",.contour"+o+",#clip"+o;h._paper.selectAll(s).remove(),n.selectAll(s).remove()}a&&i._module.colorbar||h._infolayer.selectAll(".cb"+o).remove()}var l=h._basePlotModules;for(e=0;e<l.length;e++)l[e].plot(t);var c=h._paper.selectAll(".layer-subplot");return h._shapeSubplotLayers=c.selectAll(".shapelayer"),w.style(t),x.getComponentMethod("shapes","draw")(t),x.getComponentMethod("annotations","draw")(t),w.addLinks(t),h._replotting=!1,w.previousPromises(t)},function(){x.getComponentMethod("shapes","draw")(t),x.getComponentMethod("images","draw")(t),x.getComponentMethod("annotations","draw")(t),x.getComponentMethod("legend","draw")(t),x.getComponentMethod("rangeslider","draw")(t),x.getComponentMethod("rangeselector","draw")(t),x.getComponentMethod("sliders","draw")(t),x.getComponentMethod("updatemenus","draw")(t)},k,w.rehover,w.previousPromises],E=v.syncOrAsync(A,t);return E&&E.then||(E=Promise.resolve()),E.then(function(){return t.emit("plotly_afterplot"),t})},g.redraw=function(t){if(t=v.getGraphDiv(t),!v.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t);return I.cleanData(t.data,t.data),I.cleanLayout(t.layout),t.calcdata=void 0,g.plot(t).then(function(){return t.emit("plotly_redraw"),t})},g.newPlot=function(t,e,r,n){return t=v.getGraphDiv(t),w.cleanPlot([],{},t._fullData||{},t._fullLayout||{}),w.purge(t),g.plot(t,e,r,n)},g.extendTraces=function t(e,r,n,i){var a=l(e=v.getGraphDiv(e),r,n,i,function(t,e){return t.concat(e)},function(t,e){return t.splice(0,t.length-e)}),o=g.redraw(e),s=[e,a.update,n,a.maxPoints];return b.add(e,g.prependTraces,s,t,arguments),o},g.prependTraces=function t(e,r,n,i){var a=l(e=v.getGraphDiv(e),r,n,i,function(t,e){return e.concat(t)},function(t,e){return t.splice(e,t.length)}),o=g.redraw(e),s=[e,a.update,n,a.maxPoints];return b.add(e,g.extendTraces,s,t,arguments),o},g.addTraces=function t(e,r,n){e=v.getGraphDiv(e);var i,a,o=[],l=g.deleteTraces,c=t,u=[e,o],h=[e,r];for(function(t,e,r){var n,i;if(!Array.isArray(t.data))throw new Error("gd.data must be an array.");if(void 0===e)throw new Error("traces must be defined.");for(Array.isArray(e)||(e=[e]),n=0;n<e.length;n++)if("object"!=typeof(i=e[n])||Array.isArray(i)||null===i)throw new Error("all values in traces array must be non-array objects");if(void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&r.length!==e.length)throw new Error("if indices is specified, traces.length must equal indices.length")}(e,r,n),Array.isArray(r)||(r=[r]),r=r.map(function(t){return v.extendFlat({},t)}),I.cleanData(r,e.data),i=0;i<r.length;i++)e.data.push(r[i]);for(i=0;i<r.length;i++)o.push(-r.length+i);if(void 0===n)return a=g.redraw(e),b.add(e,l,u,c,h),a;Array.isArray(n)||(n=[n]);try{s(e,o,n)}catch(t){throw e.data.splice(e.data.length-r.length,r.length),t}return b.startSequence(e),b.add(e,l,u,c,h),a=g.moveTraces(e,o,n),b.stopSequence(e),a},g.deleteTraces=function t(e,r){e=v.getGraphDiv(e);var n,i,s=[],l=g.addTraces,c=t,u=[e,s,r],h=[e,r];if(void 0===r)throw new Error("indices must be an integer or array of integers.");for(Array.isArray(r)||(r=[r]),o(e,r,"indices"),(r=a(r,e.data.length-1)).sort(v.sorterDes),n=0;n<r.length;n+=1)i=e.data.splice(r[n],1)[0],s.push(i);var f=g.redraw(e);return b.add(e,l,u,c,h),f},g.moveTraces=function t(e,r,n){var i,o=[],l=[],c=t,u=t,h=[e=v.getGraphDiv(e),n,r],f=[e,r,n];if(s(e,r,n),r=Array.isArray(r)?r:[r],void 0===n)for(n=[],i=0;i<r.length;i++)n.push(-r.length+i);for(n=Array.isArray(n)?n:[n],r=a(r,e.data.length-1),n=a(n,e.data.length-1),i=0;i<e.data.length;i++)-1===r.indexOf(i)&&o.push(e.data[i]);for(i=0;i<r.length;i++)l.push({newIndex:n[i],trace:e.data[r[i]]});for(l.sort(function(t,e){return t.newIndex-e.newIndex}),i=0;i<l.length;i+=1)o.splice(l[i].newIndex,0,l[i].trace);e.data=o;var d=g.redraw(e);return b.add(e,c,h,u,f),d},g.restyle=function t(e,r,n,i){e=v.getGraphDiv(e),I.clearPromiseQueue(e);var a={};if("string"==typeof r)a[r]=n;else{if(!v.isPlainObject(r))return v.warn("Restyle fail.",r,n,i),Promise.reject();a=v.extendFlat({},r),void 0===i&&(i=n)}Object.keys(a).length&&(e.changed=!0);var o=I.coerceTraceIndices(e,i),s=u(e,a,o),l=s.flags;l.clearCalc&&(e.calcdata=void 0),l.clearAxisTypes&&I.clearAxisTypes(e,o,{});var c=[];l.fullReplot?c.push(g.plot):(c.push(w.previousPromises),w.supplyDefaults(e),l.style&&c.push(P.doTraceStyle),l.colorbars&&c.push(P.doColorBars)),c.push(w.rehover),b.add(e,t,[e,s.undoit,s.traces],t,[e,s.redoit,s.traces]);var h=v.syncOrAsync(c,e);return h&&h.then||(h=Promise.resolve()),h.then(function(){return e.emit("plotly_restyle",s.eventData),e})},g.relayout=function t(e,r,n){if(e=v.getGraphDiv(e),I.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);var i={};if("string"==typeof r)i[r]=n;else{if(!v.isPlainObject(r))return v.warn("Relayout fail.",r,n),Promise.reject();i=v.extendFlat({},r)}Object.keys(i).length&&(e.changed=!0);var a=h(e,i),o=a.flags;o.calc&&(e.calcdata=void 0);var s=[w.previousPromises];o.layoutReplot?s.push(P.layoutReplot):Object.keys(i).length&&(w.supplyDefaults(e),o.legend&&s.push(P.doLegend),o.layoutstyle&&s.push(P.layoutStyles),o.ticks&&s.push(P.doTicksRelayout),o.modebar&&s.push(P.doModeBar),o.camera&&s.push(P.doCamera)),s.push(w.rehover),b.add(e,t,[e,a.undoit],t,[e,a.redoit]);var l=v.syncOrAsync(s,e);return l&&l.then||(l=Promise.resolve(e)),l.then(function(){return e.emit("plotly_relayout",a.eventData),e})},g.update=function t(e,r,n,i){if(e=v.getGraphDiv(e),I.clearPromiseQueue(e),e.framework&&e.framework.isPolar)return Promise.resolve(e);v.isPlainObject(r)||(r={}),v.isPlainObject(n)||(n={}),Object.keys(r).length&&(e.changed=!0),Object.keys(n).length&&(e.changed=!0);var a=I.coerceTraceIndices(e,i),o=u(e,v.extendFlat({},r),a),s=o.flags,l=h(e,v.extendFlat({},n)),c=l.flags;(s.clearCalc||c.calc)&&(e.calcdata=void 0),s.clearAxisTypes&&I.clearAxisTypes(e,a,n);var f=[];if(s.fullReplot&&c.layoutReplot){var d=e.data,p=e.layout;e.data=void 0,e.layout=void 0,f.push(function(){return g.plot(e,d,p)})}else s.fullReplot?f.push(g.plot):c.layoutReplot?f.push(P.layoutReplot):(f.push(w.previousPromises),w.supplyDefaults(e),s.style&&f.push(P.doTraceStyle),s.colorbars&&f.push(P.doColorBars),c.legend&&f.push(P.doLegend),c.layoutstyle&&f.push(P.layoutStyles),c.ticks&&f.push(P.doTicksRelayout),c.modebar&&f.push(P.doModeBar),c.camera&&f.push(P.doCamera));f.push(w.rehover),b.add(e,t,[e,o.undoit,l.undoit,o.traces],t,[e,o.redoit,l.redoit,o.traces]);var m=v.syncOrAsync(f,e);return m&&m.then||(m=Promise.resolve(e)),m.then(function(){return e.emit("plotly_update",{data:o.eventData,layout:l.eventData}),e})},g.animate=function(t,e,r){function n(t){return Array.isArray(s)?t>=s.length?s[0]:s[t]:s}function i(t){return Array.isArray(l)?t>=l.length?l[0]:l[t]:l}function a(t,e){var r=0;return function(){if(t&&++r===e)return t()}}if(t=v.getGraphDiv(t),!v.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before animating it. For more details, see https://plot.ly/javascript/animations/");var o=t._transitionData;o._frameQueue||(o._frameQueue=[]);var s=(r=w.supplyAnimationDefaults(r)).transition,l=r.frame;return void 0===o._frameWaitingCnt&&(o._frameWaitingCnt=0),new Promise(function(l,c){function u(e){if(0!==e.length){for(var s=0;s<e.length;s++){var u;u="byname"===e[s].type?w.computeFrame(t,e[s].name):e[s].data;var h=i(s),f=n(s);f.duration=Math.min(f.duration,h.duration);var d={frame:u,name:e[s].name,frameOpts:h,transitionOpts:f};s===e.length-1&&(d.onComplete=a(l,2),d.onInterrupt=c),o._frameQueue.push(d)}"immediate"===r.mode&&(o._lastFrameAt=-1/0),o._animationRaf||function(){t.emit("plotly_animating"),o._lastFrameAt=-1/0,o._timeToNext=0,o._runningTransitions=0,o._currentFrame=null;var e=function(){o._animationRaf=window.requestAnimationFrame(e),Date.now()-o._lastFrameAt>o._timeToNext&&function(){o._currentFrame&&o._currentFrame.onComplete&&o._currentFrame.onComplete();var e=o._currentFrame=o._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,o._lastFrameAt=Date.now(),o._timeToNext=e.frameOpts.duration,w.transition(t,e.frame.data,e.frame.layout,I.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(o._animationRaf),o._animationRaf=null}()};e()}()}}function h(t){return Array.isArray(s)?p>=s.length?t.transitionOpts=s[p]:t.transitionOpts=s[0]:t.transitionOpts=s,p++,t}var f,d,p=0,m=[],g=void 0===e||null===e,y=Array.isArray(e);if(!g&&!y&&v.isPlainObject(e))m.push({type:"object",data:h(v.extendFlat({},e))});else if(g||-1!==["string","number"].indexOf(typeof e))for(f=0;f<o._frames.length;f++)(d=o._frames[f])&&(g||String(d.group)===String(e))&&m.push({type:"byname",name:String(d.name),data:h({name:d.name})});else if(y)for(f=0;f<e.length;f++){var b=e[f];-1!==["number","string"].indexOf(typeof b)?(b=String(b),m.push({type:"byname",name:b,data:h({name:b})})):v.isPlainObject(b)&&m.push({type:"object",data:h(v.extendFlat({},b))})}for(f=0;f<m.length;f++)if("byname"===(d=m[f]).type&&!o._frameHash[d.data.name])return v.warn('animate failure: frame not found: "'+d.data.name+'"'),void c();-1!==["next","immediate"].indexOf(r.mode)&&function(){if(0!==o._frameQueue.length){for(;o._frameQueue.length;){var e=o._frameQueue.pop();e.onInterrupt&&e.onInterrupt()}t.emit("plotly_animationinterrupted",[])}}(),"reverse"===r.direction&&m.reverse();var x=t._fullLayout._currentFrame;if(x&&r.fromcurrent){var _=-1;for(f=0;f<m.length;f++)if("byname"===(d=m[f]).type&&d.name===x){_=f;break}if(_>0&&_<m.length-1){var M=[];for(f=0;f<m.length;f++)d=m[f],("byname"!==m[f].type||f>_)&&M.push(d);m=M}}m.length>0?u(m):(t.emit("plotly_animated"),l())})},g.addFrames=function(t,e,r){t=v.getGraphDiv(t);var n=0;if(null===e||void 0===e)return Promise.resolve();if(!v.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t+". It's likely that you've failed to create a plot before adding frames. For more details, see https://plot.ly/javascript/animations/");var i,a,o,s,l=t._transitionData._frames,c=t._transitionData._frameHash;if(!Array.isArray(e))throw new Error("addFrames failure: frameList must be an Array of frame definitions"+e);var u=l.length+2*e.length,h=[];for(i=e.length-1;i>=0;i--)if(v.isPlainObject(e[i])){var f=(c[e[i].name]||{}).name,d=e[i].name;f&&d&&"number"==typeof d&&c[f]&&(n++,v.warn('addFrames: overwriting frame "'+c[f].name+'" with a frame whose name of type "number" also equates to "'+f+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),n>5&&v.warn("addFrames: This API call has yielded too many warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h.push({frame:w.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:u+i})}h.sort(function(t,e){return t.index>e.index?-1:t.index<e.index?1:0});var p=[],m=[],g=l.length;for(i=h.length-1;i>=0;i--){if("number"==typeof(a=h[i].frame).name&&v.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(o=0;o<l.length&&(l[o]||{}).name!==a.name;o++);p.push({type:"replace",index:o,value:a}),m.unshift({type:"replace",index:o,value:l[o]})}else s=Math.max(0,Math.min(h[i].index,g)),p.push({type:"insert",index:s,value:a}),m.unshift({type:"delete",index:s}),g++}var y=w.modifyFrames,x=w.modifyFrames,_=[t,m],M=[t,p];return b&&b.add(t,y,_,x,M),w.modifyFrames(t,p)},g.deleteFrames=function(t,e){if(t=v.getGraphDiv(t),!v.isPlotDiv(t))throw new Error("This element is not a Plotly plot: "+t);var r,n,i=t._transitionData._frames,a=[],o=[];if(!e)for(e=[],r=0;r<i.length;r++)e.push(r);for((e=e.slice(0)).sort(),r=e.length-1;r>=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=w.modifyFrames,l=w.modifyFrames,c=[t,o],u=[t,a];return b&&b.add(t,s,c,l,u),w.modifyFrames(t,a)},g.purge=function(t){var e=(t=v.getGraphDiv(t))._fullLayout||{},r=t._fullData||[];return w.cleanPlot([],{},r,e),w.purge(t),y.purge(t),e._container&&e._container.remove(),delete t._context,t}},{"../components/color":613,"../components/drawing":638,"../components/errorbars":644,"../constants/xmlns_namespaces":719,"../lib":738,"../lib/events":726,"../lib/queue":752,"../lib/svg_text_utils":761,"../plotly":780,"../plots/cartesian/axis_ids":788,"../plots/cartesian/constants":790,"../plots/cartesian/constraints":792,"../plots/cartesian/graph_interact":794,"../plots/plots":846,"../plots/polar":849,"../registry":861,"./edit_types":769,"./helpers":770,"./manage_arrays":771,"./plot_schema":774,"./subroutines":777,d3:123,"fast-isnumeric":132,"has-hover":289}],773:[function(t,e,r){"use strict";e.exports={staticPlot:!1,editable:!1,edits:{annotationPosition:!1,annotationTail:!1,annotationText:!1,axisTitleText:!1,colorbarPosition:!1,colorbarTitleText:!1,legendPosition:!1,legendText:!1,shapePosition:!1,titleText:!1},autosizable:!1,queueLength:0,fillFrame:!1,frameMargins:0,scrollZoom:!1,doubleClick:"reset+autosize",showTips:!0,showAxisDragHandles:!0,showAxisRangeEntryBoxes:!0,showLink:!1,sendData:!0,linkText:"Edit chart",showSources:!1,displayModeBar:"hover",modeBarButtonsToRemove:[],modeBarButtonsToAdd:[],modeBarButtons:!1,displaylogo:!0,plotGlPixelRatio:2,setBackground:"transparent",topojsonURL:"https://cdn.plot.ly/",mapboxAccessToken:null,logging:1,globalTransforms:[],locale:"en-US",locales:{}}},{}],774:[function(t,e,r){"use strict";function n(t,e,r){if(!t)return!1;if(t._isLinkedToArray)if(i(e[r]))r++;else if(r<e.length)return!1;for(;r<e.length;r++){var n=t[e[r]];if(!u.isPlainObject(n))break;if(t=n,r===e.length-1)break;if(t._isLinkedToArray){if(r++,!i(e[r]))return!1}else if("info_array"===t.valType){var a=e[++r];if(!i(a)||a>=t.items.length)return!1;t=t.items[a]}}return t}function i(t){return t===Math.round(t)&&t>=0}function a(){var t,e,r={};b(r,f);for(t in c.subplotsRegistry)if((e=c.subplotsRegistry[t]).layoutAttributes)if("cartesian"===e.name)s(r,e,"xaxis"),s(r,e,"yaxis");else{s(r,e,"subplot"===e.attr?e.name:e.attr)}r=function(t){return y(t,{radialaxis:g.radialaxis,angularaxis:g.angularaxis}),y(t,g.layout),t}(r);for(t in c.componentsRegistry){var n=(e=c.componentsRegistry[t]).schema;if(n&&(n.subplots||n.layout)){var i=n.subplots;if(i&&i.xaxis&&!i.yaxis)for(var a in i.xaxis)delete r.yaxis[a]}else e.layoutAttributes&&l(r,e.layoutAttributes,e.name)}return{layoutAttributes:o(r)}}function o(t){return function(t){r.crawl(t,function(t,e,n){r.isValObject(t)?"data_array"===t.valType?(t.role="data",n[e+"src"]={valType:"string",editType:"none"}):!0===t.arrayOk&&(n[e+"src"]={valType:"string",editType:"none"}):u.isPlainObject(t)&&(t.role="object")})}(t),function(t){r.crawl(t,function(t,e,r){if(!t)return;var n=t[_];if(!n)return;delete t[_],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"})}(t),t}function s(t,e,r){var n=u.nestedProperty(t,r),i=b({},e.layoutAttributes);i[x]=!0,n.set(i)}function l(t,e,r){var n=u.nestedProperty(t,r);n.set(b(n.get()||{},e))}var c=t("../registry"),u=t("../lib"),h=t("../plots/attributes"),f=t("../plots/layout_attributes"),d=t("../plots/frame_attributes"),p=t("../plots/animation_attributes"),m=t("../plots/polar/area_attributes"),g=t("../plots/polar/axis_attributes"),v=t("./edit_types"),y=u.extendFlat,b=u.extendDeepAll,x="_isSubplotObj",_="_isLinkedToArray",w=[x,_,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=x,r.IS_LINKED_TO_ARRAY=_,r.DEPRECATED="_deprecated",r.UNDERSCORE_ATTRS=w,r.get=function(){var t={};c.allTypes.concat("area").forEach(function(e){t[e]=function(t){var e,r;"area"===t?(e={attributes:m},r={}):r=(e=c.modules[t]._module).basePlotModule;var n={};n.type=null,b(n,h),b(n,e.attributes),r.attributes&&b(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};b(a,e.layoutAttributes),i.layoutAttributes=o(a)}return i}(e)});var e={};return Object.keys(c.transformsRegistry).forEach(function(t){e[t]=function(t){var e=c.transformsRegistry[t],r=b({},e.attributes);return Object.keys(c.componentsRegistry).forEach(function(e){var n=c.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){l(r,n.schema.transforms[t][e],e)})}),{attributes:o(r)}}(t)}),{defs:{valObjects:u.valObjectMeta,metaKeys:w.concat(["description","role","editType","impliedEdits"]),editType:{traces:v.traces,layout:v.layout},impliedEdits:{}},traces:t,layout:a(),transforms:e,frames:function(){var t={frames:u.extendDeepAll({},d)};return o(t),t.frames}(),animation:o(p)}},r.crawl=function(t,e,n,i){var a=n||0;i=i||"",Object.keys(t).forEach(function(n){var o=t[n];if(-1===w.indexOf(n)){var s=(i?i+".":"")+n;e(o,n,t,a,s),r.isValObject(o)||u.isPlainObject(o)&&"impliedEdits"!==n&&r.crawl(o,e,a+1,s)}})},r.isValObject=function(t){return t&&void 0!==t.valType},r.findArrayAttributes=function(t){function e(e,r,a,o){i=i.slice(0,o).concat([r]);if(e&&("data_array"===e.valType||!0===e.arrayOk)&&!("colorbar"===i[o-1]&&("ticktext"===r||"tickvals"===r))){var s=function(t){return t.join(".")}(i),l=u.nestedProperty(t,s).get();Array.isArray(l)&&n.push(s)}}var n=[],i=[];if(r.crawl(h,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var a=t.transforms,o=0;o<a.length;o++){var s=a[o]._module;s&&(i=["transforms["+o+"]"],r.crawl(s.attributes,e,1))}return t._fullInput&&t._fullInput._module&&t._fullInput._module.attributes&&(r.crawl(t._fullInput._module.attributes,e),n=u.filterUnique(n)),n},r.getTraceValObject=function(t,e){var r,a,o=e[0],s=1;if("transforms"===o){if(!Array.isArray(t.transforms))return!1;var l=e[1];if(!i(l)||l>=t.transforms.length)return!1;a=(r=(c.transformsRegistry[t.transforms[l].type]||{}).attributes)&&r[e[2]],s=3}else if("area"===t.type)a=m[o];else{var u=t._module;if(u||(u=(c.modules[t.type||h.type.dflt]||{})._module),!u)return!1;if(r=u.attributes,!(a=r&&r[o])){var f=u.basePlotModule;f&&f.attributes&&(a=f.attributes[o])}a||(a=h[o])}return n(a,e,s)},r.getLayoutValObject=function(t,e){return n(function(t,e){var r,n,i,a,o=t._basePlotModules;if(o){var s;for(r=0;r<o.length;r++){if((i=o[r]).attrRegex&&i.attrRegex.test(e)){if(i.layoutAttrOverrides)return i.layoutAttrOverrides;!s&&i.layoutAttributes&&(s=i.layoutAttributes)}var l=i.baseLayoutAttrOverrides;if(l&&e in l)return l[e]}if(s)return s}var u=t._modules;if(u)for(r=0;r<u.length;r++)if((a=u[r].layoutAttributes)&&e in a)return a[e];for(n in c.componentsRegistry)if(!(i=c.componentsRegistry[n]).schema&&e===i.name)return i.layoutAttributes;return e in f?f[e]:"radialaxis"===e||"angularaxis"===e?g[e]:g.layout[e]||!1}(t,e[0]),e,1)}},{"../lib":738,"../plots/animation_attributes":781,"../plots/attributes":783,"../plots/frame_attributes":811,"../plots/layout_attributes":837,"../plots/polar/area_attributes":847,"../plots/polar/axis_attributes":848,"../registry":861,"./edit_types":769}],775:[function(t,e,r){"use strict";var n=t("../registry"),i=t("../lib");e.exports=function(t){if(!t)throw new Error("No argument passed to Plotly.register.");t&&!Array.isArray(t)&&(t=[t]);for(var e=0;e<t.length;e++){var r=t[e];if(!r)throw new Error("Invalid module was attempted to be registered!");switch(r.moduleType){case"trace":!function(t){n.register(t,t.name,t.categories,t.meta),n.subplotsRegistry[t.basePlotModule.name]||n.registerSubplot(t.basePlotModule)}(r);break;case"transform":!function(t){if("string"!=typeof t.name)throw new Error("Transform module *name* must be a string.");var e="Transform module "+t.name,r="function"==typeof t.transform,a="function"==typeof t.calcTransform;if(!r&&!a)throw new Error(e+" is missing a *transform* or *calcTransform* method.");r&&a&&i.log([e+" has both a *transform* and *calcTransform* methods.","Please note that all *transform* methods are executed","before all *calcTransform* methods."].join(" ")),i.isPlainObject(t.attributes)||i.log(e+" registered without an *attributes* object."),"function"!=typeof t.supplyDefaults&&i.log(e+" registered without a *supplyDefaults* method."),n.registerTransform(t)}(r);break;case"component":!function(t){if("string"!=typeof t.name)throw new Error("Component module *name* must be a string.");n.registerComponent(t)}(r);break;case"locale":n.registerLocale(r);break;default:throw new Error("Invalid module was attempted to be registered!")}}}},{"../lib":738,"../registry":861}],776:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("../lib");e.exports=function(t){return i.extendFlat(n.defaultConfig,t)}},{"../lib":738,"../plotly":780}],777:[function(t,e,r){"use strict";function n(t,e){return(t.ticks||t.showline)&&(e===t._mainSubplot||"all"===t.mirror||"allticks"===t.mirror)}function i(t,e,r){if(!r.showline||!r._lw)return!1;if("all"===r.mirror||"allticks"===r.mirror)return!0;var n=r._anchorAxis;if(!n)return!1;var i=v.FROM_BL[e];return r.side===e?n.domain[i]===t.domain[i]:r.mirror&&n.domain[1-i]===t.domain[1-i]}function a(t,e,r,n){if(i(t,e,r))return r._lw;for(var a=0;a<n.length;a++){var o=n[a];if(o._mainAxis===r._mainAxis&&i(t,e,o))return o._lw}return 0}var o=t("d3"),s=t("../plotly"),l=t("../registry"),c=t("../plots/plots"),u=t("../lib"),h=t("../components/color"),f=t("../components/drawing"),d=t("../components/titles"),p=t("../components/modebar"),m=t("../plots/cartesian/graph_interact"),g=t("../plots/cartesian/constants"),v=t("../constants/alignment");r.layoutStyles=function(t){return u.syncOrAsync([c.doAutoMargin,r.lsInner],t)},r.lsInner=function(t){function e(t,e,r){var n=t._lw/2;return"x"===t._id.charAt(0)?e?"top"===r?e._offset-u-n:e._offset+e._length+u+n:c.t+c.h*(1-(t.position||0))+n%1:e?"right"===r?e._offset+e._length+u+n:e._offset-u-n:c.l+c.w*(t.position||0)+n%1}var i,l=t._fullLayout,c=l._size,u=c.p,d=s.Axes.list(t),m=l._has("cartesian");for(i=0;i<d.length;i++){var y=d[i];y.setScale();var b=y._anchorAxis;y._linepositions={},y._lw=f.crispRound(t,y.linewidth,1),y._mainLinePosition=e(y,b,y.side),y._mainMirrorPosition=y.mirror&&b?e(y,b,v.OPPOSITE_SIDE[y.side]):null}l._paperdiv.style({width:l.width+"px",height:l.height+"px"}).selectAll(".main-svg").call(f.setSize,l.width,l.height),t._context.setBackground(t,l.paper_bgcolor);var x=l._paper.selectAll("g.subplot"),_=[],w=[];x.each(function(t){var e=l._plots[t];if(e.mainplot)return e.bg&&e.bg.remove(),void(e.bg=void 0);var r=e.xaxis.domain,n=e.yaxis.domain,i=[];!function(t,e,r){for(var n=0;n<r.length;n++){var i=r[n][0],a=r[n][1];if(!(i[0]>=t[1]||i[1]<=t[0])&&a[0]<e[1]&&a[1]>e[0])return!0}return!1}(r,n,w)?(_.push(t),w.push([r,n])):i=[0];var a=e.plotgroup.selectAll(".bg").data(i);a.enter().append("rect").classed("bg",!0),a.exit().remove(),a.each(function(){e.bg=a;var t=e.plotgroup.node();t.insertBefore(this,t.childNodes[0])})});var M=l._bgLayer.selectAll(".bg").data(_);return M.enter().append("rect").classed("bg",!0),M.exit().remove(),M.each(function(t){l._plots[t].bg=o.select(this)}),x.each(function(t){function r(t){return"M"+k+","+t+"H"+T}function o(t){return"M"+y._offset+","+t+"h"+y._length}function s(t){return"M"+t+","+I+"V"+C}function c(t){return"M"+t+","+b._offset+"v"+b._length}function p(e,r,n){if(!e.showline||t!==e._mainSubplot)return"";if(!e._anchorAxis)return n(e._mainLinePosition);var i=r(e._mainLinePosition);return e.mirror&&(i+=r(e._mainMirrorPosition)),i}var v=l._plots[t],y=v.xaxis,b=v.yaxis;v.bg&&m&&v.bg.call(f.setRect,y._offset-u,b._offset-u,y._length+2*u,b._length+2*u).call(h.fill,l.plot_bgcolor).style("stroke-width",0),v.clipId="clip"+l._uid+t+"plot";var x=l._clips.selectAll("#"+v.clipId).data([0]);x.enter().append("clipPath").attr({class:"plotclip",id:v.clipId}).append("rect"),x.selectAll("rect").attr({width:y._length,height:b._length}),f.setTranslate(v.plot,y._offset,b._offset);var _,w;for(v._hasClipOnAxisFalse?(_=null,w=v.clipId):(_=v.clipId,w=null),f.setClipUrl(v.plot,_),i=0;i<g.traceLayerClasses.length;i++){var M=g.traceLayerClasses[i];"scatterlayer"!==M&&v.plot.selectAll("g."+M).call(f.setClipUrl,w)}if(v.layerClipId=w,m){var k,T,A,S,E,L,C,I,P,D,z,O,F;if(n(y,t)){E=a(y,"left",b,d),k=y._offset-(E?u+E:0),L=a(y,"right",b,d),T=y._offset+y._length+(L?u+L:0),A=e(y,b,"bottom"),S=e(y,b,"top"),(F=!y._anchorAxis||t!==y._mainSubplot)&&y.ticks&&"allticks"===y.mirror&&(y._linepositions[t]=[A,S]);var R=p(y,r,o);F&&y.showline&&("all"===y.mirror||"allticks"===y.mirror)&&(R+=r(A)+r(S)),v.xlines.attr("d",R||"M0,0").style("stroke-width",y._lw+"px").call(h.stroke,y.showline?y.linecolor:"rgba(0,0,0,0)")}if(n(b,t)){z=a(b,"bottom",y,d),C=b._offset+b._length+(z?u:0),O=a(b,"top",y,d),I=b._offset-(O?u:0),P=e(b,y,"left"),D=e(b,y,"right"),(F=!b._anchorAxis||t!==y._mainSubplot)&&b.ticks&&"allticks"===b.mirror&&(b._linepositions[t]=[P,D]);var j=p(b,s,c);F&&b.showline&&("all"===b.mirror||"allticks"===b.mirror)&&(j+=s(P)+s(D)),v.ylines.attr("d",j||"M0,0").style("stroke-width",b._lw+"px").call(h.stroke,b.showline?b.linecolor:"rgba(0,0,0,0)")}}}),s.Axes.makeClipPaths(t),r.drawMainTitle(t),p.manage(t),t._promises.length&&Promise.all(t._promises)},r.drawMainTitle=function(t){var e=t._fullLayout;d.draw(t,"gtitle",{propContainer:e,propName:"title",placeholder:e._dfltTitle.plot,attributes:{x:e.width/2,y:e._size.t/2,"text-anchor":"middle"}})},r.doTraceStyle=function(t){for(var e=0;e<t.calcdata.length;e++){var r=t.calcdata[e],n=(((r[0]||{}).trace||{})._module||{}).arraysToCalcdata;n&&n(r,r[0].trace)}return c.style(t),l.getComponentMethod("legend","draw")(t),c.previousPromises(t)},r.doColorBars=function(t){for(var e=0;e<t.calcdata.length;e++){var r=t.calcdata[e][0];if((r.t||{}).cb){var n=r.trace,i=r.t.cb;l.traceIs(n,"contour")&&i.line({width:!1!==n.contours.showlines?n.line.width:0,dash:n.line.dash,color:"line"===n.contours.coloring?i._opts.line.color:n.line.color}),l.traceIs(n,"markerColorscale")?i.options(n.marker.colorbar)():i.options(n.colorbar)()}}return c.previousPromises(t)},r.layoutReplot=function(t){var e=t.layout;return t.layout=void 0,s.plot(t,"",e)},r.doLegend=function(t){return l.getComponentMethod("legend","draw")(t),c.previousPromises(t)},r.doTicksRelayout=function(t){return s.Axes.doTicks(t,"redraw"),r.drawMainTitle(t),c.previousPromises(t)},r.doModeBar=function(t){var e=t._fullLayout;p.manage(t),m(t);for(var r=0;r<e._basePlotModules.length;r++){var n=e._basePlotModules[r].updateFx;n&&n(e)}return c.previousPromises(t)},r.doCamera=function(t){for(var e=t._fullLayout,r=e._subplots.gl3d,n=0;n<r.length;n++){var i=e[r[n]];i._scene.setCamera(i.camera)}}},{"../components/color":613,"../components/drawing":638,"../components/modebar":675,"../components/titles":704,"../constants/alignment":711,"../lib":738,"../plotly":780,"../plots/cartesian/constants":790,"../plots/cartesian/graph_interact":794,"../plots/plots":846,"../registry":861,d3:123}],778:[function(t,e,r){"use strict";var n=t("../plotly"),i=t("../lib"),a=t("../snapshot/helpers"),o=t("../snapshot/tosvg"),s=t("../snapshot/svgtoimg"),l={format:{valType:"enumerated",values:["png","jpeg","webp","svg"],dflt:"png"},width:{valType:"number",min:1},height:{valType:"number",min:1},scale:{valType:"number",min:0,dflt:1},setBackground:{valType:"any",dflt:!1},imageDataOnly:{valType:"boolean",dflt:!1}},c=/^data:image\/\w+;base64,/;e.exports=function(t,e){function r(t){return!(t in e)||i.validate(e[t],l[t])}function u(t,r){return i.coerce(e,g,l,t,r)}function h(){return new Promise(function(t){setTimeout(t,a.getDelay(M._fullLayout))})}function f(){return new Promise(function(t,e){var r=o(M,v,x),a=M._fullLayout.width,l=M._fullLayout.height;if(n.purge(M),document.body.removeChild(M),"svg"===v)return t(w?r:"data:image/svg+xml,"+encodeURIComponent(r));var c=document.createElement("canvas");c.id=i.randstr(),s({format:v,width:a,height:l,scale:x,canvas:c,svg:r,promise:!0}).then(t).catch(e)})}e=e||{};var d,p,m;if(i.isPlainObject(t)?(d=t.data||[],p=t.layout||{},m=t.config||{}):(t=i.getGraphDiv(t),d=i.extendDeep([],t.data),p=i.extendDeep({},t.layout),m=t._context),!r("width")||!r("height"))throw new Error("Height and width should be pixel values.");if(!r("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var g={},v=u("format"),y=u("width"),b=u("height"),x=u("scale"),_=u("setBackground"),w=u("imageDataOnly"),M=document.createElement("div");M.style.position="absolute",M.style.left="-5000px",document.body.appendChild(M);var k=i.extendFlat({},p);y&&(k.width=y),b&&(k.height=b);var T=i.extendFlat({},m,{staticPlot:!0,setBackground:_}),A=a.getRedrawFunc(M);return new Promise(function(t,e){n.plot(M,d,k,T).then(A).then(h).then(f).then(function(e){t(function(t){return w?t.replace(c,""):t}(e))}).catch(function(t){e(t)})})}},{"../lib":738,"../plotly":780,"../snapshot/helpers":865,"../snapshot/svgtoimg":867,"../snapshot/tosvg":869}],779:[function(t,e,r){"use strict";function n(t,e,r,i,l,c){c=c||[];for(var u=Object.keys(t),d=0;d<u.length;d++){var p=u[d];if("transforms"!==p){var m=c.slice();m.push(p);var g=t[p],v=e[p],y=function(t,e){var r=o(e);return t[r.keyMinusId]}(r,p),b="info_array"===(y||{}).valType,x="colorscale"===(y||{}).valType;if(function(t,e){var r=o(e),n=r.keyMinusId,i=r.id;if(n in t&&t[n]._isSubplotObj&&i)return!0;return e in t}(r,p))if(h(g)&&h(v))n(g,v,y,i,l,m);else if(y.items&&!b&&f(g)){var _,w,M=y.items,k=M[Object.keys(M)[0]],T=[];for(_=0;_<v.length;_++){var A=v[_]._index||_;(w=m.slice()).push(A),h(g[A])&&h(v[_])&&(T.push(A),n(g[A],v[_],k,i,l,w))}for(_=0;_<g.length;_++)(w=m.slice()).push(_),h(g[_])?-1===T.indexOf(_)&&i.push(a("unused",l,w)):i.push(a("object",l,w,g[_]))}else!h(g)&&h(v)?i.push(a("object",l,m,g)):f(g)||!f(v)||b||x?p in e?s.validate(g,y)?"enumerated"===y.valType&&(y.coerceNumber&&g!==+v||g!==v)&&i.push(a("dynamic",l,m,g,v)):i.push(a("value",l,m,g)):i.push(a("unused",l,m,g)):i.push(a("array",l,m,g));else i.push(a("schema",l,m))}}return i}function i(t){return f(t)?"In data trace "+t[1]+", ":"In "+t+", "}function a(t,e,r,n,i){r=r||"";var a,o;f(e)?(a=e[0],o=e[1]):(a=e,o=null);var l=function(t){if(!f(t))return String(t);for(var e="",r=0;r<t.length;r++){var n=t[r];"number"==typeof n?e=e.substr(0,e.length-1)+"["+n+"]":e+=n,r<t.length-1&&(e+=".")}return e}(r),c=d[t](e,l,n,i);return s.log(c),{code:t,container:a,trace:o,path:r,astr:l,msg:c}}function o(t){var e=t.match(p);return{keyMinusId:e&&e[1],id:e&&e[2]}}var s=t("../lib"),l=t("../plots/plots"),c=t("./plot_schema"),u=t("./plot_config"),h=s.isPlainObject,f=Array.isArray;e.exports=function(t,e){var r,i,o=c.get(),d=[],p={_context:s.extendFlat({},u)};f(t)?(p.data=s.extendDeep([],t),r=t):(p.data=[],r=[],d.push(a("array","data"))),h(e)?(p.layout=s.extendDeep({},e),i=e):(p.layout={},i={},arguments.length>1&&d.push(a("object","layout"))),l.supplyDefaults(p);for(var m=p._fullData,g=r.length,v=0;v<g;v++){var y=r[v],b=["data",v];if(h(y)){var x=m[v],_=x.type,w=o.traces[_].attributes;w.type={valType:"enumerated",values:[_]},!1===x.visible&&!1!==y.visible&&d.push(a("invisible",b)),n(y,x,w,d,b);var M=y.transforms,k=x.transforms;if(M){f(M)||d.push(a("array",b,["transforms"])),b.push("transforms");for(var T=0;T<M.length;T++){var A=["transforms",T],S=M[T].type;if(h(M[T])){var E=o.transforms[S]?o.transforms[S].attributes:{};E.type={valType:"enumerated",values:Object.keys(o.transforms)},n(M[T],k[T],E,d,b,A)}else d.push(a("object",b,A))}}}else d.push(a("object",b))}return n(i,p._fullLayout,function(t,e){for(var r=0;r<e.length;r++){var n=e[r].type,i=t.traces[n].layoutAttributes;i&&s.extendFlat(t.layout.layoutAttributes,i)}return t.layout.layoutAttributes}(o,m),d,"layout"),0===d.length?void 0:d};var d={object:function(t,e){return("layout"===t&&""===e?"The layout argument":"data"===t[0]&&""===e?"Trace "+t[1]+" in the data argument":i(t)+"key "+e)+" must be linked to an object container"},array:function(t,e){return("data"===t?"The data argument":i(t)+"key "+e)+" must be linked to an array container"},schema:function(t,e){return i(t)+"key "+e+" is not part of the schema"},unused:function(t,e,r){var n=h(r)?"container":"key";return i(t)+n+" "+e+" did not get coerced"},dynamic:function(t,e,r,n){return[i(t)+"key",e,"(set to '"+r+"')","got reset to","'"+n+"'","during defaults."].join(" ")},invisible:function(t){return"Trace "+t[1]+" got defaulted to be not visible"},value:function(t,e,r){return[i(t)+"key "+e,"is set to an invalid value ("+r+")"].join(" ")}},p=s.counterRegex("([a-z]+)")},{"../lib":738,"../plots/plots":846,"./plot_config":773,"./plot_schema":774}],780:[function(t,e,r){"use strict";r.defaultConfig=t("./plot_api/plot_config"),r.Plots=t("./plots/plots"),r.Axes=t("./plots/cartesian/axes"),r.ModeBar=t("./components/modebar"),t("./plot_api/plot_api")},{"./components/modebar":675,"./plot_api/plot_api":772,"./plot_api/plot_config":773,"./plots/cartesian/axes":785,"./plots/plots":846}],781:[function(t,e,r){"use strict";e.exports={mode:{valType:"enumerated",dflt:"afterall",values:["immediate","next","afterall"]},direction:{valType:"enumerated",values:["forward","reverse"],dflt:"forward"},fromcurrent:{valType:"boolean",dflt:!1},frame:{duration:{valType:"number",min:0,dflt:500},redraw:{valType:"boolean",dflt:!0}},transition:{duration:{valType:"number",min:0,dflt:500},easing:{valType:"enumerated",dflt:"cubic-in-out",values:["linear","quad","cubic","sin","exp","circle","elastic","back","bounce","linear-in","quad-in","cubic-in","sin-in","exp-in","circle-in","elastic-in","back-in","bounce-in","linear-out","quad-out","cubic-out","sin-out","exp-out","circle-out","elastic-out","back-out","bounce-out","linear-in-out","quad-in-out","cubic-in-out","sin-in-out","exp-in-out","circle-in-out","elastic-in-out","back-in-out","bounce-in-out"]}}}},{}],782:[function(t,e,r){"use strict";var n=t("../lib");e.exports=function(t,e,r){var i,a=r.name,o=e[a],s=n.isArray(t[a])?t[a]:[],l=e[a]=[];for(i=0;i<s.length;i++){var c=s[i],u={},h={};n.isPlainObject(c)||(h.itemIsNotPlainObject=!0,c={}),r.handleItemDefaults(c,u,e,r,h),u._input=c,u._index=i,l.push(u)}if(n.isArray(o)){var f=Math.min(o.length,l.length);for(i=0;i<f;i++)n.relinkPrivateKeys(l[i],o[i])}}},{"../lib":738}],783:[function(t,e,r){"use strict";var n=t("../components/fx/attributes");e.exports={type:{valType:"enumerated",values:[],dflt:"scatter",editType:"calc+clearAxisTypes"},visible:{valType:"enumerated",values:[!0,!1,"legendonly"],dflt:!0,editType:"calc"},showlegend:{valType:"boolean",dflt:!0,editType:"style"},legendgroup:{valType:"string",dflt:"",editType:"style"},opacity:{valType:"number",min:0,max:1,dflt:1,editType:"style"},name:{valType:"string",editType:"style"},uid:{valType:"string",dflt:"",editType:"calc"},ids:{valType:"data_array",editType:"calc"},customdata:{valType:"data_array",editType:"calc"},selectedpoints:{valType:"any",editType:"calc"},hoverinfo:{valType:"flaglist",flags:["x","y","z","text","name"],extras:["all","none","skip"],arrayOk:!0,dflt:"all",editType:"none"},hoverlabel:n.hoverlabel,stream:{token:{valType:"string",noBlank:!0,strict:!0,editType:"calc"},maxpoints:{valType:"number",min:0,max:1e4,dflt:500,editType:"calc"},editType:"calc"}}},{"../components/fx/attributes":647}],784:[function(t,e,r){"use strict";e.exports={xaxis:{valType:"subplotid",dflt:"x",editType:"calc+clearAxisTypes"},yaxis:{valType:"subplotid",dflt:"y",editType:"calc+clearAxisTypes"}}},{}],785:[function(t,e,r){"use strict";function n(t){return+t}function i(t){return String(t)}function a(t,e,r){return e*g.roundUp(t/e,r)}function o(t){var e=t.dtick;if(t._tickexponent=0,p(e)||"string"==typeof e||(e=1),"category"===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>=T&&i<=10||e>=15*T)t._tickround="d";else if(e>=S&&i<=16||e>=A)t._tickround="M";else if(e>=E&&i<=19||e>=S)t._tickround="S";else{var a=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(p(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);p(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var s=Math.max(Math.abs(o[0]),Math.abs(o[1])),u=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(u)>3&&(l(t.exponentformat)&&!c(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function s(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}}function l(t){return"SI"===t||"B"===t}function c(t){return t>14||t<-15}function u(t,e,r,n){var i=t<0,a=e._tickround,s=r||e.exponentformat||"B",u=e._tickexponent,h=P.getTickFormat(e),f=e.separatethousands;if(n){var d={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:p(t)?Math.abs(t)||1:1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};o(d),a=(Number(d._tickround)||0)+4,u=d._tickexponent,e.hoverformat&&(h=e.hoverformat)}if(h)return e._numFormat(h)(t).replace(/-/g,L);var m=Math.pow(10,-a)/2;if("none"===s&&(u=0),(t=Math.abs(t))<m)t="0",i=!1;else{if(t+=m,u&&(t*=Math.pow(10,-u),a+=u),0===a)t=String(Math.floor(t));else if(a<0){t=(t=String(Math.round(t))).substr(0,t.length+a);for(var v=a;v<0;v++)t+="0"}else{var y=(t=String(t)).indexOf(".")+1;y&&(t=t.substr(0,y+a).replace(/\.?0+$/,""))}t=g.numSeparate(t,e._separators,f)}if(u&&"hide"!==s){l(s)&&c(u)&&(s="power");var b;b=u<0?L+-u:"power"!==s?"+"+u:String(u),"e"===s?t+="e"+b:"E"===s?t+="E"+b:"power"===s?t+="\xd710<sup>"+b+"</sup>":"B"===s&&9===u?t+="B":l(s)&&(t+=V[u/3+5])}return i?L+t:t}function h(t,e){for(var r=0;r<e.length;r++)-1===t.indexOf(e[r])&&t.push(e[r])}function f(t,e,r){var n,i,a=[],o=[],s=t.layout;for(n=0;n<e.length;n++)a.push(P.getFromId(t,e[n]));for(n=0;n<r.length;n++)o.push(P.getFromId(t,r[n]));var l=Object.keys(a[0]),c=["anchor","domain","overlaying","position","side","tickangle"],u=["linear","log"];for(n=0;n<l.length;n++){var h=l[n],f=a[0][h],d=o[0][h],p=!0,m=!1,v=!1;if("_"!==h.charAt(0)&&"function"!=typeof f&&-1===c.indexOf(h)){for(i=1;i<a.length&&p;i++){var y=a[i][h];"type"===h&&-1!==u.indexOf(f)&&-1!==u.indexOf(y)&&f!==y?m=!0:y!==f&&(p=!1)}for(i=1;i<o.length&&p;i++){var b=o[i][h];"type"===h&&-1!==u.indexOf(d)&&-1!==u.indexOf(b)&&d!==b?v=!0:o[i][h]!==d&&(p=!1)}p&&(m&&(s[a[0]._name].type="linear"),v&&(s[o[0]._name].type="linear"),function(t,e,r,n,i){var a,o=g.nestedProperty,s=o(t[r[0]._name],e).get(),l=o(t[n[0]._name],e).get();"title"===e&&(s===i.x&&(s=i.y),l===i.y&&(l=i.x));for(a=0;a<r.length;a++)o(t,r[a]._name+"."+e).set(l);for(a=0;a<n.length;a++)o(t,n[a]._name+"."+e).set(s)}(s,h,a,o,t._fullLayout._dfltTitle))}}for(n=0;n<t._fullLayout.annotations.length;n++){var x=t._fullLayout.annotations[n];-1!==e.indexOf(x.xref)&&-1!==r.indexOf(x.yref)&&g.swapAttrs(s.annotations[n],["?"])}}var d=t("d3"),p=t("fast-isnumeric"),m=t("../../registry"),g=t("../../lib"),v=t("../../lib/svg_text_utils"),y=t("../../components/titles"),b=t("../../components/color"),x=t("../../components/drawing"),_=t("../../constants/numerical"),w=_.FP_SAFE,M=_.ONEAVGYEAR,k=_.ONEAVGMONTH,T=_.ONEDAY,A=_.ONEHOUR,S=_.ONEMIN,E=_.ONESEC,L=_.MINUS_SIGN,C=_.BADNUM,I=t("../../constants/alignment").MID_SHIFT,P=e.exports={};P.setConvert=t("./set_convert");var D=t("./axis_autotype"),z=t("./axis_ids");P.id2name=z.id2name,P.cleanId=z.cleanId,P.list=z.list,P.listIds=z.listIds,P.getFromId=z.getFromId,P.getFromTrace=z.getFromTrace,P.coerceRef=function(t,e,r,n,i,a){var o=n.charAt(n.length-1),s=r._fullLayout._subplots[o+"axis"],l=n+"ref",c={};return i||(i=s[0]||a),a||(a=i),c[l]={valType:"enumerated",values:s.concat(a?[a]:[]),dflt:i},g.coerce(t,e,c,l)},P.coercePosition=function(t,e,r,n,i,a){var o,s;if("paper"===n||"pixel"===n)o=g.ensureNumber,s=r(i,a);else{var l=P.getFromId(e,n);s=r(i,a=l.fraction2r(a)),o=l.cleanPos}t[i]=o(s)},P.cleanPosition=function(t,e,r){return("paper"===r||"pixel"===r?g.ensureNumber:P.getFromId(e,r).cleanPos)(t)};var O=P.getDataConversions=function(t,e,r,a){var o,s="x"===r||"y"===r||"z"===r?r:a;if(Array.isArray(s)){if(o={type:D(a),_categories:[]},P.setConvert(o),"category"===o.type)for(var l=0;l<a.length;l++)o.d2c(a[l])}else o=P.getFromTrace(t,e,s);return o?{d2c:o.d2c,c2d:o.c2d}:"ids"===s?{d2c:i,c2d:i}:{d2c:n,c2d:n}};P.getDataToCoordFunc=function(t,e,r,n){return O(t,e,r,n).d2c},P.counterLetter=function(t){var e=t.charAt(0);return"x"===e?"y":"y"===e?"x":void 0},P.minDtick=function(t,e,r,n){-1===["log","category"].indexOf(t.type)&&n?void 0===t._minDtick?(t._minDtick=e,t._forceTick0=r):t._minDtick&&((t._minDtick/e+1e-6)%1<2e-6&&((r-t._forceTick0)/e%1+1.000001)%1<2e-6?(t._minDtick=e,t._forceTick0=r):((e/t._minDtick+1e-6)%1>2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},P.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e<t._min.length&&n===i;e++)n=Math.min(n,t._min[e].val);for(e=1;e<t._max.length&&n===i;e++)i=Math.max(i,t._max[e].val);var a,o,s,l,c,u,h,f=0,d=!1;if(t.range){var p=g.simpleMap(t.range,t.r2l);d=p[1]<p[0]}for("reversed"===t.autorange&&(d=!0,t.autorange=!0),e=0;e<t._min.length;e++)for(o=t._min[e],a=0;a<t._max.length;a++)h=(s=t._max[a]).val-o.val,u=t._length-o.pad-s.pad,h>0&&u>0&&h/u>f&&(l=o,c=s,f=h/u);if(n===i){var m=n-1,v=n+1;r="tozero"===t.rangemode?n<0?[m,0]:[0,v]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,v)]:[m,v]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(l.val>=0&&(l={val:0,pad:0}),c.val<=0&&(c={val:0,pad:0})):"nonnegative"===t.rangemode&&(l.val-f*l.pad<0&&(l={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),f=(c.val-l.val)/(t._length-l.pad-c.pad)),r=[l.val-f*l.pad,c.val+f*c.pad]);return r[0]===r[1]&&("tozero"===t.rangemode?r=r[0]<0?[r[0],0]:r[0]>0?[0,r[0]]:[0,1]:(r=[r[0]-1,r[0]+1],"nonnegative"===t.rangemode&&(r[0]=Math.max(0,r[0])))),d&&r.reverse(),g.simpleMap(r,t.l2r||Number)},P.doAutoRange=function(t){t._length||t.setScale();var e=t._min&&t._max&&t._min.length&&t._max.length;if(t.autorange&&e){t.range=P.getAutoRange(t),t._r=t.range.slice(),t._rl=g.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},P.saveRangeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i=0;i<r.length;i++){var a=r[i],o=void 0===a._rangeInitial,s=o||!(a.range[0]===a._rangeInitial[0]&&a.range[1]===a._rangeInitial[1]);(o&&!1===a.autorange||e&&s)&&(a._rangeInitial=a.range.slice(),n=!0)}return n},P.saveShowSpikeInitial=function(t,e){for(var r=P.list(t,"",!0),n=!1,i="on",a=0;a<r.length;a++){var o=r[a],s=void 0===o._showSpikeInitial,l=s||!(o.showspikes===o._showspikes);(s||e&&l)&&(o._showSpikeInitial=o.showspikes,n=!0),"on"!==i||o.showspikes||(i="off")}return t._fullLayout._cartesianSpikesEnabled=i,n},P.expand=function(t,e,r){function n(t){if(Array.isArray(t))return function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}function i(r){function n(t){return p(t)&&Math.abs(t)<w}if(l=e[r],p(l)){if(h=_(r)+b,f=M(r)+b,m=l-T(r),v=l+k(r),"log"===t.type&&m<v/10&&(m=v/10),c=t.c2l(m),u=t.c2l(v),x&&(c=Math.min(0,c),u=Math.max(0,u)),n(c)){for(d=!0,o=0;o<t._min.length&&d;o++)(s=t._min[o]).val<=c&&s.pad>=f?d=!1:s.val>=c&&s.pad<=f&&(t._min.splice(o,1),o--);d&&t._min.push({val:c,pad:x&&0===c?0:f})}if(n(u)){for(d=!0,o=0;o<t._max.length&&d;o++)(s=t._max[o]).val>=u&&s.pad>=h?d=!1:s.val<=u&&s.pad<=h&&(t._max.splice(o,1),o--);d&&t._max.push({val:u,pad:x&&0===u?0:h})}}}if((t.autorange||!!g.nestedProperty(t,"rangeslider.autorange").get())&&e){t._min||(t._min=[]),t._max||(t._max=[]),r||(r={}),t._m||t.setScale();var a,o,s,l,c,u,h,f,d,m,v,y=e.length,b=r.padded?.05*t._length:0,x=r.tozero&&("linear"===t.type||"-"===t.type);b&&"domain"===t.constrain&&t._inputDomain&&(b*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var _=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),M=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),T=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=y-1;a>5;a--)i(a)}},P.autoBin=function(t,e,r,n,i){var a=g.aggNums(Math.min,null,t),o=g.aggNums(Math.max,null,t);if(i||(i=e.calendar),"category"===e.type)return{start:a-.5,end:o+.5,size:1,_count:o-a+1};var s;if(r)s=(o-a)/r;else{var l=g.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),u=c*g.roundUp(l.minDiff/c,[.9,1.9,4.9,9.9],!0);s=Math.max(u,2*g.stdev(t)/Math.pow(t.length,n?.25:.4)),p(s)||(s=1)}var h;h="log"===e.type?{type:"linear",range:[a,o]}:{type:e.type,range:g.simpleMap([a,o],e.c2r,0,i),calendar:i},P.setConvert(h),P.autoTicks(h,s);var f,d,m=P.tickIncrement(P.tickFirst(h),h.dtick,"reverse",i);if("number"==typeof h.dtick)f=(m=function(t,e,r,n,i){function a(e){return(1+100*(e-t)/r.dtick)%100<2}for(var o=0,s=0,l=0,c=0,u=0;u<e.length;u++)e[u]%1==0?l++:p(e[u])||c++,a(e[u])&&o++,a(e[u]+r.dtick/2)&&s++;var h=e.length-c;if(l===h&&"date"!==r.type)r.dtick<1?t=n-.5*r.dtick:(t-=.5)+r.dtick<n&&(t+=r.dtick);else if(s<.1*h&&(o>.3*h||a(n)||a(i))){var f=r.dtick/2;t+=t+f<n?f:-f}return t}(m,t,h,a,o))+(d=1+Math.floor((o-m)/h.dtick))*h.dtick;else for("M"===h.dtick.charAt(0)&&(m=function(t,e,r,n,i){var a=g.findExactDates(e,i);if(a.exactDays>.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=P.tickIncrement(t,"M6","reverse")+1.5*T:a.exactMonths>.8?t=P.tickIncrement(t,"M1","reverse")+15.5*T:t-=T/2;var s=P.tickIncrement(t,r);if(s<=n)return s}return t}(m,t,h.dtick,a,i)),f=m,d=0;f<=o;)f=P.tickIncrement(f,h.dtick,!1,i),d++;return{start:e.c2r(m,0,i),end:e.c2r(f,0,i),size:h.dtick,_count:d}},P.calcTicks=function(t){var e=g.simpleMap(t.range,t.r2l);if("auto"===t.tickmode||!t.dtick){var r,n=t.nticks;n||("category"===t.type?(r=t.tickfont?1.2*(t.tickfont.size||12):15,n=t._length/r):(r="y"===t._id.charAt(0)?40:80,n=g.constrain(t._length/r,4,9)+1)),"array"===t.tickmode&&(n*=100),P.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}if(t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),o(t),"array"===t.tickmode)return function(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=g.simpleMap(t.range,t.r2l),l=1.0001*o[0]-1e-4*o[1],c=1.0001*o[1]-1e-4*o[0],u=Math.min(l,c),h=Math.max(l,c),f=0;Array.isArray(i)||(i=[]);var d="category"===t.type?t.d2l_noadd:t.d2l;for("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)),r=0;r<n.length;r++)(e=d(n[r]))>u&&e<h&&(void 0===i[r]?a[f]=P.tickText(t,e):a[f]=s(t,e,String(i[r])),f++);return f<n.length&&a.splice(f,n.length-f),a}(t);t._tmin=P.tickFirst(t);var i=e[1]<e[0],a=[],l=1.0001*e[1]-1e-4*e[0];"category"===t.type&&(l=i?Math.max(-.5,l):Math.min(t._categories.length-.5,l));for(var c=null,u=Math.max(1e3,t._length||0),h=t._tmin;(i?h>=l:h<=l)&&!(a.length>u||h===c);h=P.tickIncrement(h,t.dtick,i,t.calendar))c=h,a.push(h);t._tmax=a[a.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var f=new Array(a.length),d=0;d<a.length;d++)f[d]=P.tickText(t,a[d]);return t._inCalcTicks=!1,f};var F=[2,5,10],R=[1,2,3,6,12],j=[1,2,5,10,15,30],N=[1,2,3,7,14],B=[-.046,0,.301,.477,.602,.699,.778,.845,.903,.954,1],U=[-.301,0,.301,.699,1];P.autoTicks=function(t,e){var r;if("date"===t.type){t.tick0=g.dateTick0(t.calendar);var n=2*e;n>M?(e/=M,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="M"+12*a(e,r,F)):n>k?(e/=k,t.dtick="M"+a(e,1,R)):n>T?(t.dtick=a(e,T,N),t.tick0=g.dateTick0(t.calendar,!0)):n>A?t.dtick=a(e,A,R):n>S?t.dtick=a(e,S,j):n>E?t.dtick=a(e,E,j):(r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,F))}else if("log"===t.type){t.tick0=0;var i=g.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(i[1]-i[0])<1){var o=1.5*Math.abs((i[1]-i[0])/e);e=Math.abs(Math.pow(10,i[1])-Math.pow(10,i[0]))/o,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick="L"+a(e,r,F)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):(t.tick0=0,r=Math.pow(10,Math.floor(Math.log(e)/Math.LN10)),t.dtick=a(e,r,F));if(0===t.dtick&&(t.dtick=1),!p(t.dtick)&&"string"!=typeof t.dtick){var s=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(s)}},P.tickIncrement=function(t,e,r,n){var i=r?-1:1;if(p(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return g.incrementMonth(t,o,n);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?U:B,l=t+.01*i,c=g.roundUp(g.mod(l,1),s,r);return Math.floor(l)+Math.log(d.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},P.tickFirst=function(t){var e=t.r2l||Number,r=g.simpleMap(t.range,e),n=r[1]<r[0],i=n?Math.floor:Math.ceil,a=1.0001*r[0]-1e-4*r[1],o=t.dtick,s=e(t.tick0);if(p(o)){var l=i((a-s)/o)*o+s;return"category"===t.type&&(l=g.constrain(l,0,t._categories.length-1)),l}var c=o.charAt(0),u=Number(o.substr(1));if("M"===c){for(var h,f,m,v=0,y=s;v<10;){if(((h=P.tickIncrement(y,o,n,t.calendar))-a)*(y-a)<=0)return n?Math.min(y,h):Math.max(y,h);f=(a-(y+h)/2)/(h-y),m=c+(Math.abs(Math.round(f))||1)*u,y=P.tickIncrement(y,m,f<0?!n:n,t.calendar),v++}return g.error("tickFirst did not converge",t),y}if("L"===c)return Math.log(i((Math.pow(10,a)-s)/u)*u+s)/Math.LN10;if("D"===c){var b="D2"===o?U:B,x=g.roundUp(g.mod(a,1),b,n);return Math.floor(a)+Math.log(d.round(Math.pow(10,x),1))/Math.LN10}throw"unrecognized dtick "+String(o)},P.tickText=function(t,e,r){function n(n){var i;return void 0===n||(r?"none"===n:(i={first:t._tmin,last:t._tmax}[n],"all"!==n&&e!==i))}var i,a,o=s(t,e),h="array"===t.tickmode,f=r||h,d="category"===t.type?t.d2l_noadd:t.d2l;if(h&&Array.isArray(t.ticktext)){var m=g.simpleMap(t.range,t.r2l),v=Math.abs(m[1]-m[0])/1e4;for(a=0;a<t.ticktext.length&&!(Math.abs(e-d(t.tickvals[a]))<v);a++);if(a<t.ticktext.length)return o.text=String(t.ticktext[a]),o}return i=r?"never":"none"!==t.exponentformat&&n(t.showexponent)?"hide":"","date"===t.type?function(t,e,r,n){var i=t._tickround,a=r&&t.hoverformat||P.getTickFormat(t);n&&(i=p(i)?4:{y:"m",m:"d",d:"M",M:"S",S:4}[i]);var o,s=g.formatDate(e.x,a,i,t._dateFormat,t.calendar),l=s.indexOf("\n");-1!==l&&(o=s.substr(l+1),s=s.substr(0,l)),n&&("00:00:00"===s||"00:00"===s?(s=o,o=""):8===s.length&&(s=s.replace(/:00$/,""))),o&&(r?"d"===i?s+=", "+o:s=o+(s?", "+s:""):t._inCalcTicks&&o===t._prevDateHead||(s+="<br>"+o,t._prevDateHead=o)),e.text=s}(t,o,r,f):"log"===t.type?function(t,e,r,n,i){var a=t.dtick,o=e.x,s=t.tickformat;if("never"===i&&(i=""),!n||"string"==typeof a&&"L"===a.charAt(0)||(a="L3"),s||"string"==typeof a&&"L"===a.charAt(0))e.text=u(Math.pow(10,o),t,i,n);else if(p(a)||"D"===a.charAt(0)&&g.mod(o+.01,1)<.1){var h=Math.round(o);-1!==["e","E","power"].indexOf(t.exponentformat)||l(t.exponentformat)&&c(h)?(e.text=0===h?1:1===h?"10":h>1?"10<sup>"+h+"</sup>":"10<sup>"+L+-h+"</sup>",e.fontSize*=1.25):(e.text=u(Math.pow(10,o),t,"","fakehover"),"D1"===a&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==a.charAt(0))throw"unrecognized dtick "+String(a);e.text=String(Math.round(Math.pow(10,g.mod(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var f=String(e.text).charAt(0);"0"!==f&&"1"!==f||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}(t,o,0,f,i):"category"===t.type?function(t,e){var r=t._categories[Math.round(e.x)];void 0===r&&(r=""),e.text=String(r)}(t,o):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=u(e.x,t,i,n)}(t,o,0,f,i),t.tickprefix&&!n(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!n(t.showticksuffix)&&(o.text+=t.ticksuffix),o},P.hoverLabelText=function(t,e,r){if(r!==C&&r!==e)return P.hoverLabelText(t,e)+" - "+P.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=P.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":L+i:i};var V=["f","p","n","\u03bc","m","","k","M","G","T"];P.getTickFormat=function(t){function e(t){return"string"!=typeof t?t:Number(t.replace("M",""))*k}function r(t,e){var r=["L","D"];if(typeof t==typeof e){if("number"==typeof t)return t-e;var n=r.indexOf(t.charAt(0)),i=r.indexOf(e.charAt(0));return n===i?Number(t.replace(/(L|D)/g,""))-Number(e.replace(/(L|D)/g,"")):n-i}return"number"==typeof t?1:-1}function n(t,e,r){var n=r||function(t){return t},i=e[0],a=e[1];return(!i&&"number"!=typeof i||n(i)<=n(t))&&(!a&&"number"!=typeof a||n(a)>=n(t))}function i(t,e){var n=null===e[0],i=null===e[1],a=r(t,e[0])>=0,o=r(t,e[1])<=0;return(n||a)&&(i||o)}var a,o;if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(a=0;a<t.tickformatstops.length;a++)if(n(t.dtick,t.tickformatstops[a].dtickrange,e)){o=t.tickformatstops[a];break}break;case"log":for(a=0;a<t.tickformatstops.length;a++)if(i(t.dtick,t.tickformatstops[a].dtickrange)){o=t.tickformatstops[a];break}}return o?o.value:t.tickformat},P.getSubplots=function(t,e){var r=t._fullLayout._subplots,n=r.cartesian.concat(r.gl2d||[]),i=e?P.findSubplotsWithAxis(n,e):n;return i.sort(function(t,e){var r=t.substr(1).split("y"),n=e.substr(1).split("y");return r[0]===n[0]?+r[1]-+n[1]:+r[0]-+n[0]}),i},P.findSubplotsWithAxis=function(t,e){for(var r=new RegExp("x"===e._id.charAt(0)?"^"+e._id+"y":e._id+"$"),n=[],i=0;i<t.length;i++){var a=t[i];r.test(a)&&n.push(a)}return n},P.makeClipPaths=function(t){var e,r,n=t._fullLayout,i={_offset:0,_length:n.width,_id:""},a={_offset:0,_length:n.height,_id:""},o=P.list(t,"x",!0),s=P.list(t,"y",!0),l=[];for(e=0;e<o.length;e++)for(l.push({x:o[e],y:a}),r=0;r<s.length;r++)0===e&&l.push({x:i,y:s[r]}),l.push({x:o[e],y:s[r]});var c=n._clips.selectAll(".axesclip").data(l,function(t){return t.x._id+t.y._id});c.enter().append("clipPath").classed("axesclip",!0).attr("id",function(t){return"clip"+n._uid+t.x._id+t.y._id}).append("rect"),c.exit().remove(),c.each(function(t){d.select(this).select("rect").attr({x:t.x._offset||0,y:t.y._offset||0,width:t.x._length||1,height:t.y._length||1})})},P.doTicks=function(t,e,r){function n(t){var e=c.l2p(t.x);return e>1&&e<c._length-1}function i(t,e){var r=t.selectAll("path."+L).data("inside"===c.ticks?q:S,E);e&&c.ticks?(r.enter().append("path").classed(L,1).classed("ticks",1).classed("crisp",1).call(b.stroke,c.tickcolor).style("stroke-width",B+"px").attr("d",e),r.attr("transform",_),r.exit().remove()):r.remove()}function a(r,n){function i(t,e){t.each(function(t){var r=f(e),n=d.select(this),i=n.select(".text-math-group"),a=_(t)+(p(e)&&0!=+e?" rotate("+e+","+l(t)+","+(h(t)-t.fontSize/2)+")":"");if(i.empty())n.select("text").attr({transform:a,"text-anchor":r});else{var o=x.bBox(i.node()).width*{end:-.5,start:.5}[r];i.attr("transform",a+(o?"translate("+o+",0)":""))}})}function a(){function e(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.max(t[1],e[1])}if(c.showticklabels){var n=t.getBoundingClientRect(),i=r.node().getBoundingClientRect();c._boundingBox={width:i.width,height:i.height,left:i.left-n.left,right:i.right-n.left,top:i.top-n.top,bottom:i.bottom-n.top}}else{var a,o=u._size;"x"===T?(a="free"===c.anchor?o.t+o.h*(1-c.position):o.t+o.h*(1-c._anchorAxis.domain[{bottom:0,top:1}[c.side]]),c._boundingBox={top:a,bottom:a,left:c._offset,rigth:c._offset+c._length,width:c._length,height:0}):(a="free"===c.anchor?o.l+o.w*c.position:o.l+o.w*c._anchorAxis.domain[{left:0,right:1}[c.side]],c._boundingBox={left:a,right:a,bottom:c._offset+c._length,top:c._offset,height:c._length,width:0})}if(M){var s=c._counterSpan=[1/0,-1/0];for(k=0;k<M.length;k++){var l=u._plots[M[k]]["x"===T?"yaxis":"xaxis"];e(s,[l._offset,l._offset+l._length])}"free"===c.anchor&&e(s,"x"===T?[c._boundingBox.bottom,c._boundingBox.top]:[c._boundingBox.right,c._boundingBox.left])}}var s=r.selectAll("g."+L).data(S,E);if(!p(n))return s.remove(),void o();if(!c.showticklabels)return s.remove(),o(),void a();var l,h,f,m,y;"x"===T?(l=function(t){return t.dx+R*y},m=n+(F+O)*(y="bottom"===V?1:-1),h=function(t){return t.dy+m+t.fontSize*("bottom"===V?1:-.2)},f=function(t){return p(t)&&0!==t&&180!==t?t*y<0?"end":"start":"middle"}):(y="right"===V?1:-1,h=function(t){return t.dy+t.fontSize*I-R*y},l=function(t){return t.dx+n+(F+O+(90===Math.abs(c.tickangle)?t.fontSize/2:0))*y},f=function(t){return p(t)&&90===Math.abs(t)?"middle":"right"===V?"start":"end"});var b=0,w=0,A=[];s.enter().append("g").classed(L,1).append("text").attr("text-anchor","middle").each(function(e){var r=d.select(this),n=t._promises.length;r.call(v.positionText,l(e),h(e)).call(x.font,e.font,e.fontSize,e.fontColor).text(e.text).call(v.convertToTspans,t),(n=t._promises[n])?A.push(t._promises.pop().then(function(){i(r,c.tickangle)})):i(r,c.tickangle)}),s.exit().remove(),s.each(function(t){b=Math.max(b,t.fontSize)}),i(s,c._lastangle||c.tickangle);var C=g.syncOrAsync([function(){return A.length&&Promise.all(A)},function(){if(i(s,c.tickangle),"x"===T&&!p(c.tickangle)&&("log"!==c.type||"D"!==String(c.dtick).charAt(0))){var t=[];for(s.each(function(e){var r=d.select(this),n=r.select(".text-math-group"),i=c.l2p(e.x);n.empty()&&(n=r.select("text"));var a=x.bBox(n.node());t.push({top:0,bottom:10,height:10,left:i-a.width/2,right:i+a.width/2+2,width:a.width+2})}),k=0;k<t.length-1;k++)if(g.bBoxIntersect(t[k],t[k+1])){w=30;break}w&&(Math.abs((S[S.length-1].x-S[0].x)*c._m)/(S.length-1)<2.5*b&&(w=90),i(s,w)),c._lastangle=w}return o(),e+" done"},a]);return C&&C.then&&t._promises.push(C),C}function o(){if(!r){var n,i,a,o,s=z.getFromId(t,e),l=d.select(t).selectAll("g."+e+"tick"),c={selection:l,side:s.side},h=e.charAt(0),f=t._fullLayout._size,p=s.titlefont.size;if(l.size()){var m=x.getTranslate(l.node().parentNode);c.offsetLeft=m.x,c.offsetTop=m.y}var g=10+1.5*p+(s.linewidth?s.linewidth-1:0);"x"===h?(i="free"===s.anchor?{_offset:f.t+(1-(s.position||0))*f.h,_length:0}:z.getFromId(t,s.anchor),a=s._offset+s._length/2,o="top"===s.side?-g-p*(s.showticklabels?1:0):i._length+g+p*(s.showticklabels?1.5:.5),o+=i._offset,s.rangeslider&&s.rangeslider.visible&&s._boundingBox&&(o+=(u.height-u.margin.b-u.margin.t)*s.rangeslider.thickness+s._boundingBox.height),c.side||(c.side="bottom")):(i="free"===s.anchor?{_offset:f.l+(s.position||0)*f.w,_length:0}:z.getFromId(t,s.anchor),o=s._offset+s._length/2,a="right"===s.side?i._length+g+p*(s.showticklabels?1:.5):-g-p*(s.showticklabels?.5:0),a+=i._offset,n={rotate:"-90",offset:0},c.side||(c.side="left")),y.draw(t,e+"title",{propContainer:s,propName:s._name+".title",placeholder:u._dfltTitle[h],avoid:c,transform:n,attributes:{x:a,y:o,"text-anchor":"middle"}})}}function s(t,e){return!0===t.visible&&t.xaxis+t.yaxis===e&&(!(!m.traceIs(t,"bar")||t.orientation!=={x:"h",y:"v"}[T])||t.fill&&t.fill.charAt(t.fill.length-1)===T)}function l(r,i,a){var o=r.gridlayer.selectAll("."+e),l=r.zerolinelayer,u=r["hidegrid"+T]?[]:q,h=c._gridpath||("x"===T?"M0,"+i._offset+"v":"M"+i._offset+",0h")+i._length,f=o.selectAll("path."+C).data(!1===c.showgrid?[]:u,E);if(f.enter().append("path").classed(C,1).classed("crisp",1).attr("d",h).each(function(t){c.zeroline&&("linear"===c.type||"-"===c.type)&&Math.abs(t.x)<c.dtick/100&&d.select(this).remove()}),f.attr("transform",_).call(b.stroke,c.gridcolor||"#ddd").style("stroke-width",j+"px"),f.exit().remove(),l){for(var p=!1,m=0;m<t._fullData.length;m++)if(s(t._fullData[m],a)){p=!0;break}var v=g.simpleMap(c.range,c.r2l),y=v[0]*v[1]<=0&&c.zeroline&&("linear"===c.type||"-"===c.type)&&u.length&&(p||n({x:0})||!c.showline),x=l.selectAll("path."+D).data(y?[{x:0,id:e}]:[]);x.enter().append("path").classed(D,1).classed("zl",1).classed("crisp",1).attr("d",h).each(function(){l.selectAll("path").sort(function(t,e){return z.idSort(t.id,e.id)})}),x.attr("transform",_).call(b.stroke,c.zerolinecolor||b.defaultLine).style("stroke-width",N+"px"),x.exit().remove()}}var c,u=t._fullLayout,h=!1;if("object"==typeof e)e=(c=e)._id,h=!0;else if(c=P.getFromId(t,e),"redraw"===e&&u._paper.selectAll("g.subplot").each(function(t){var e=u._plots[t],r=e.xaxis,n=e.yaxis;e.xaxislayer.selectAll("."+r._id+"tick").remove(),e.yaxislayer.selectAll("."+n._id+"tick").remove(),e.gridlayer.selectAll("path").remove(),e.zerolinelayer.selectAll("path").remove(),u._infolayer.select(".g-"+r._id+"title").remove(),u._infolayer.select(".g-"+n._id+"title").remove()}),!e||"redraw"===e)return g.syncOrAsync(P.list(t,"",!0).map(function(r){return function(){if(r._id){var n=P.doTicks(t,r._id);return"redraw"===e&&(r._r=r.range.slice(),r._rl=g.simpleMap(r._r,r.r2l)),n}}}));c.tickformat||(-1===["none","e","E","power","SI","B"].indexOf(c.exponentformat)&&(c.exponentformat="e"),-1===["all","first","last","none"].indexOf(c.showexponent)&&(c.showexponent="all")),c.setScale();var f,_,w,M,k,T=e.charAt(0),A=P.counterLetter(e),S=P.calcTicks(c),E=function(t){return[t.text,t.x,c.mirror].join("_")},L=e+"tick",C=e+"grid",D=e+"zl",O=(c.linewidth||1)/2,F="outside"===c.ticks?c.ticklen:0,R=0,j=x.crispRound(t,c.gridwidth,1),N=x.crispRound(t,c.zerolinewidth,j),B=x.crispRound(t,c.tickwidth,1);if(c._counterangle&&"outside"===c.ticks){var U=c._counterangle*Math.PI/180;F=c.ticklen*Math.cos(U)+1,R=c.ticklen*Math.sin(U)}if(c.showticklabels&&("outside"===c.ticks||c.showline)&&(F+=.2*c.tickfont.size),"x"===T)f=["bottom","top"],_=function(t){return"translate("+(c._offset+c.l2p(t.x))+",0)"},w=function(t,e){if(c._counterangle){var r=c._counterangle*Math.PI/180;return"M0,"+t+"l"+Math.sin(r)*e+","+Math.cos(r)*e}return"M0,"+t+"v"+e};else{if("y"!==T)return void g.warn("Unrecognized doTicks axis:",e);f=["left","right"],_=function(t){return"translate(0,"+(c._offset+c.l2p(t.x))+")"},w=function(t,e){if(c._counterangle){var r=c._counterangle*Math.PI/180;return"M"+t+",0l"+Math.cos(r)*e+","+-Math.sin(r)*e}return"M"+t+",0h"+e}}var V=c.side||f[0],H=[-1,1,V===f[1]?1:-1];if("inside"!==c.ticks==("x"===T)&&(H=H.map(function(t){return-t})),c.visible){var q=S.filter(n);if(h){if(i(c._axislayer,w(c._pos+O*H[2],H[2]*c.ticklen)),c._counteraxis){l({gridlayer:c._gridlayer,zerolinelayer:c._zerolinelayer},c._counteraxis)}return a(c._axislayer,c._pos)}if(u._has("cartesian")){var G={};(M=P.getSubplots(t,c)).map(function(t){var e=u._plots[t],r=e[A+"axis"],n=r._mainAxis._id;G[n]||(G[n]=1,l(e,r,t))});var Y=c._mainSubplot,W=u._plots[Y],X=[];if(c.ticks){var Z=H[2],J=w(c._mainLinePosition+O*Z,Z*c.ticklen);c._anchorAxis&&c.mirror&&!0!==c.mirror&&(J+=w(c._mainMirrorPosition-O*Z,-Z*c.ticklen)),i(W[T+"axislayer"],J),X=Object.keys(c._linepositions)}X.map(function(t){function e(t){var e=H[t];return w(n[t]+O*e,e*c.ticklen)}var r=u._plots[t][T+"axislayer"],n=c._linepositions[t]||[];i(r,e(0)+e(1))});return a(W[T+"axislayer"],c._mainLinePosition)}}},P.swap=function(t,e){for(var r=function(t,e){var r,n,i=[];for(r=0;r<e.length;r++){var a=[],o=t._fullData[e[r]].xaxis,s=t._fullData[e[r]].yaxis;if(o&&s){for(n=0;n<i.length;n++)-1===i[n].x.indexOf(o)&&-1===i[n].y.indexOf(s)||a.push(n);if(a.length){var l,c=i[a[0]];if(a.length>1)for(n=1;n<a.length;n++)l=i[a[n]],h(c.x,l.x),h(c.y,l.y);h(c.x,[o]),h(c.y,[s])}else i.push({x:[o],y:[s]})}}return i}(t,e),n=0;n<r.length;n++)f(t,r[n].x,r[n].y)}},{"../../components/color":613,"../../components/drawing":638,"../../components/titles":704,"../../constants/alignment":711,"../../constants/numerical":717,"../../lib":738,"../../lib/svg_text_utils":761,"../../registry":861,"./axis_autotype":786,"./axis_ids":788,"./set_convert":803,d3:123,"fast-isnumeric":132}],786:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../constants/numerical").BADNUM;e.exports=function(t,e){return function(t,e){for(var r,a=0,o=0,s=Math.max(1,(t.length-1)/1e3),l=0;l<t.length;l+=s)r=t[Math.round(l)],i.isDateTime(r,e)&&(a+=1),n(r)&&(o+=1);return a>2*o}(t,e)?"date":function(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,o=0,s=0;s<t.length;s+=r)e=t[Math.round(s)],i.cleanNumber(e)!==a?n++:"string"==typeof e&&""!==e&&"None"!==e&&o++;return o>2*n}(t)?"category":function(t){if(!t)return!1;for(var e=0;e<t.length;e++)if(n(t[e]))return!0;return!1}(t)?"linear":"-"}},{"../../constants/numerical":717,"../../lib":738,"fast-isnumeric":132}],787:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../registry"),a=t("../../lib"),o=t("../../components/color/attributes").lightFraction,s=t("./layout_attributes"),l=t("./tick_value_defaults"),c=t("./tick_mark_defaults"),u=t("./tick_label_defaults"),h=t("./category_order_defaults"),f=t("./set_convert"),d=t("./ordered_categories");e.exports=function(t,e,r,p,m){function g(r,n){return a.coerce2(t,e,s,r,n)}var v=p.letter,y=p.font||{},b=r("visible",!p.cheateronly),x=e.type;if("date"===x){i.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",p.calendar)}f(e,m);if(r("autorange",!e.isValidRange(t.range))&&r("rangemode"),r("range"),e.cleanRange(),h(t,e,r),e._initialCategories="category"===x?d(v,e.categoryorder,e.categoryarray,p.data):[],!b)return e;var _=r("color"),w=_===t.color?_:y.color;r("title",m._dfltTitle[v]),a.coerceFont(r,"titlefont",{family:y.family,size:Math.round(1.2*y.size),color:w}),l(t,e,r,x),u(t,e,r,x,p),c(t,e,r,p);var M=g("linecolor",_),k=g("linewidth"),T=r("showline",!!M||!!k);T||(delete e.linecolor,delete e.linewidth),(T||e.ticks)&&r("mirror");var A=g("gridcolor",n(_,p.bgColor,o).toRgbString()),S=g("gridwidth");r("showgrid",p.showGrid||!!A||!!S)||(delete e.gridcolor,delete e.gridwidth);var E=g("zerolinecolor",_),L=g("zerolinewidth");return r("zeroline",p.showGrid||!!E||!!L)||(delete e.zerolinecolor,delete e.zerolinewidth),e}},{"../../components/color/attributes":612,"../../lib":738,"../../registry":861,"./category_order_defaults":789,"./layout_attributes":797,"./ordered_categories":799,"./set_convert":803,"./tick_label_defaults":804,"./tick_mark_defaults":805,"./tick_value_defaults":806,tinycolor2:543}],788:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("./constants");r.id2name=function(t){if("string"==typeof t&&t.match(i.AX_ID_PATTERN)){var e=t.substr(1);return"1"===e&&(e=""),t.charAt(0)+"axis"+e}},r.name2id=function(t){if(t.match(i.AX_NAME_PATTERN)){var e=t.substr(5);return"1"===e&&(e=""),t.charAt(0)+e}},r.cleanId=function(t,e){if(t.match(i.AX_ID_PATTERN)&&(!e||t.charAt(0)===e)){var r=t.substr(1).replace(/^0+/,"");return"1"===r&&(r=""),t.charAt(0)+r}},r.list=function(t,e,n){var i=t._fullLayout;if(!i)return[];var a,o=r.listIds(t,e),s=new Array(o.length);for(a=0;a<o.length;a++){var l=o[a];s[a]=i[l.charAt(0)+"axis"+l.substr(1)]}if(!n){var c=i._subplots.gl3d||[];for(a=0;a<c.length;a++){var u=i[c[a]];e?s.push(u[e+"axis"]):s.push(u.xaxis,u.yaxis,u.zaxis)}}return s},r.listIds=function(t,e){var r=t._fullLayout;if(!r)return[];var n=r._subplots;return e?n[e+"axis"]:n.xaxis.concat(n.yaxis)},r.getFromId=function(t,e,n){var i=t._fullLayout;return"x"===n?e=e.replace(/y[0-9]*/,""):"y"===n&&(e=e.replace(/x[0-9]*/,"")),i[r.id2name(e)]},r.getFromTrace=function(t,e,i){var a=t._fullLayout,o=null;if(n.traceIs(e,"gl3d")){var s=e.scene;"scene"===s.substr(0,5)&&(o=a[s][i+"axis"])}else o=r.getFromId(t,e[i+"axis"]||i);return o},r.idSort=function(t,e){var r=t.charAt(0),n=e.charAt(0);return r!==n?r>n?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)}},{"../../registry":861,"./constants":790}],789:[function(t,e,r){"use strict";e.exports=function(t,e,r){if("category"===e.type){var n,i=t.categoryarray,a=Array.isArray(i)&&i.length>0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}}},{}],790:[function(t,e,r){"use strict";var n=t("../../lib").counterRegex;e.exports={idRegex:{x:n("x"),y:n("y")},attrRegex:n("[xy]axis"),xAxisMatch:n("xaxis"),yAxisMatch:n("yaxis"),AX_ID_PATTERN:/^[xyz][0-9]*$/,AX_NAME_PATTERN:/^[xyz]axis[0-9]*$/,SUBPLOT_PATTERN:/^x([0-9]*)y([0-9]*)$/,MINDRAG:8,MINSELECT:12,MINZOOM:20,DRAGGERSIZE:20,BENDPX:1.5,REDRAWDELAY:50,SELECTDELAY:100,SELECTID:"-select",DFLTRANGEX:[-1,6],DFLTRANGEY:[-1,4],traceLayerClasses:["imagelayer","maplayer","barlayer","carpetlayer","violinlayer","boxlayer","scatterlayer"],layerValue2layerClass:{"above traces":"above","below traces":"below"}}},{"../../lib":738}],791:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./axis_ids").id2name;e.exports=function(t,e,r,a,o){var s=o._axisConstraintGroups,l=e._id,c=l.charAt(0);if(!e.fixedrange&&(r("constrain"),n.coerce(t,e,{constraintoward:{valType:"enumerated",values:"x"===c?["left","center","right"]:["bottom","middle","top"],dflt:"x"===c?"center":"middle"}},"constraintoward"),t.scaleanchor)){var u=function(t,e,r,n){var a,o,s,l,c=n[i(e)].type,u=[];for(o=0;o<r.length;o++)(s=r[o])!==e&&((l=n[i(s)]).type!==c||l.fixedrange||u.push(s));for(a=0;a<t.length;a++)if(t[a][e]){var h=t[a],f=[];for(o=0;o<u.length;o++)h[s=u[o]]||f.push(s);return{linkableAxes:f,thisGroup:h}}return{linkableAxes:u,thisGroup:null}}(s,l,a,o),h=n.coerce(t,e,{scaleanchor:{valType:"enumerated",values:u.linkableAxes}},"scaleanchor");if(h){var f=r("scaleratio");f||(f=e.scaleratio=1),function(t,e,r,n,i){var a,o,s,l,c;null===e?((e={})[r]=1,c=t.length,t.push(e)):c=t.indexOf(e);var u=Object.keys(e);for(a=0;a<t.length;a++)if(s=t[a],a!==c&&s[n]){var h=s[n];for(o=0;o<u.length;o++)s[l=u[o]]=h*i*e[l];return void t.splice(c,1)}if(1!==i)for(o=0;o<u.length;o++)e[u[o]]*=i;e[n]=1}(s,u.thisGroup,l,h,f)}else-1!==a.indexOf(t.scaleanchor)&&n.warn("ignored "+e._name+'.scaleanchor: "'+t.scaleanchor+'" to avoid either an infinite loop and possibly inconsistent scaleratios, or because the targetaxis has fixed range.')}}},{"../../lib":738,"./axis_ids":788}],792:[function(t,e,r){"use strict";function n(t,e){var r=t._inputDomain,n=s[t.constraintoward],i=r[0]+(r[1]-r[0])*n;t.domain=t._input.domain=[i+(r[0]-i)/e,i+(r[1]-i)/e]}var i=t("./axis_ids").id2name,a=t("./scale_zoom"),o=t("../../constants/numerical").ALMOST_EQUAL,s=t("../../constants/alignment").FROM_BL;r.enforce=function(t){var e,r,s,l,c,u,h,f=t._fullLayout,d=f._axisConstraintGroups||[];for(e=0;e<d.length;e++){var p=d[e],m=Object.keys(p),g=1/0,v=0,y=1/0,b={},x={},_=!1;for(r=0;r<m.length;r++)x[s=m[r]]=l=f[i(s)],l._inputDomain?l.domain=l._inputDomain.slice():l._inputDomain=l.domain.slice(),l._inputRange||(l._inputRange=l.range.slice()),l.setScale(),b[s]=c=Math.abs(l._m)/p[s],g=Math.min(g,c),"domain"!==l.constrain&&l._constraintShrinkable||(y=Math.min(y,c)),delete l._constraintShrinkable,v=Math.max(v,c),"domain"===l.constrain&&(_=!0);if(!(g>o*v)||_)for(r=0;r<m.length;r++)if(s=m[r],c=b[s],l=x[s],u=l.constrain,c!==y||"domain"===u)if(h=c/y,"range"===u)a(l,h);else{var w=l._inputDomain,M=(l.domain[1]-l.domain[0])/(w[1]-w[0]),k=(l.r2l(l.range[1])-l.r2l(l.range[0]))/(l.r2l(l._inputRange[1])-l.r2l(l._inputRange[0]));if((h/=M)*k<1){l.domain=l._input.domain=w.slice(),a(l,h);continue}if(k<1&&(l.range=l._input.range=l._inputRange.slice(),h*=k),l.autorange&&l._min.length&&l._max.length){var T=l.r2l(l.range[0]),A=l.r2l(l.range[1]),S=(T+A)/2,E=S,L=S,C=Math.abs(A-S),I=S-C*h*1.0001,P=S+C*h*1.0001;n(l,h),l.setScale();var D,z,O=Math.abs(l._m);for(z=0;z<l._min.length;z++)(D=l._min[z].val-l._min[z].pad/O)>I&&D<E&&(E=D);for(z=0;z<l._max.length;z++)(D=l._max[z].val+l._max[z].pad/O)<P&&D>L&&(L=D);h/=(L-E)/(2*C),E=l.l2r(E),L=l.l2r(L),l.range=l._input.range=T<A?[E,L]:[L,E]}n(l,h)}}},r.clean=function(t,e){if(e._inputDomain){for(var r=!1,n=e._id,i=t._fullLayout._axisConstraintGroups,a=0;a<i.length;a++)if(i[a][n]){r=!0;break}r&&"domain"===e.constrain||(e._input.domain=e.domain=e._inputDomain,delete e._inputDomain)}}},{"../../constants/alignment":711,"../../constants/numerical":717,"./axis_ids":788,"./scale_zoom":801}],793:[function(t,e,r){"use strict";function n(t,e){for(var r=0;r<t.length;r++)if(!t[r].fixedrange)return e;return""}function i(t,e,r,n,a){var o,s,l,c;for(o=0;o<t.length;o++)(s=t[o]).fixedrange||(l=s._rl[0],c=s._rl[1]-l,s.range=[s.l2r(l+c*e),s.l2r(l+c*r)],n[s._name+".range[0]"]=s.range[0],n[s._name+".range[1]"]=s.range[1]);if(a&&a.length){var u=(e+(1-r))/2;i(a,u,1-u,n)}}function a(t,e){for(var r=0;r<t.length;r++){var n=t[r];n.fixedrange||(n.range=[n.l2r(n._rl[0]-e/n._m),n.l2r(n._rl[1]-e/n._m)])}}function o(t){t.selectAll(".select-outline").remove()}function s(t){u.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function l(t){return"lasso"===t||"select"===t}function c(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"}var u=t("d3"),h=t("tinycolor2"),f=t("../../plotly"),d=t("../../registry"),p=t("../../lib"),m=t("../../lib/svg_text_utils"),g=t("../../components/color"),v=t("../../components/drawing"),y=t("../../components/fx"),b=t("../../lib/setcursor"),x=t("../../components/dragelement"),_=t("../../constants/alignment").FROM_TL,w=t("../plots"),M=t("./axes").doTicks,k=t("./axis_ids").getFromId,T=t("./select"),A=t("./scale_zoom"),S=t("./constants"),E=S.MINDRAG,L=S.MINZOOM,C=!0;e.exports=function(t,e,r,I,P,D,z,O){function F(){Y=[e.xaxis],W=[e.yaxis];var r=Y[0],i=W[0];J=r._length,K=i._length;var a=it._axisConstraintGroups,o=[r._id],s=[i._id];G=[e].concat(z&&O?e.overlays:[]);for(var l=1;l<G.length;l++){var c=G[l].xaxis,u=G[l].yaxis;-1===Y.indexOf(c)&&(Y.push(c),o.push(c._id)),-1===W.indexOf(u)&&(W.push(u),s.push(u._id))}Q=n(Y,O),$=n(W,z),tt=function(t,e){return t?"nsew"===t?"pan"===e?"move":"crosshair":t.toLowerCase()+"-resize":"pointer"}($+Q,it.dragmode),X=r._offset,Z=i._offset;var h=function(t,e,r){var n,i,a,o,s,l,c=!1,u={},h={};for(n=0;n<t.length;n++){for(o=t[n],i=0;i<e.length;i++)if(o[e[i]]){for(s in o)-1===("x"===s.charAt(0)?e:r).indexOf(s)&&(u[s]=1);for(a=0;a<r.length;a++)o[r[a]]&&(c=!0)}for(i=0;i<r.length;i++)if(o[r[i]])for(l in o)-1===("x"===l.charAt(0)?e:r).indexOf(l)&&(h[l]=1)}return c&&(p.extendFlat(u,h),h={}),{x:u,y:h,xy:c}}(a,o,s);et=h.xy,rt=[];for(var f in h.x)rt.push(k(t,f));nt=[];for(var d in h.y)nt.push(k(t,d))}function R(e,r,n){var i=lt.getBoundingClientRect();ut=r-i.left,ht=n-i.top,ft={l:ut,r:ut,w:0,t:ht,b:ht,h:0},dt=t._hmpixcount?t._hmlumcount/t._hmpixcount:h(t._fullLayout.plot_bgcolor).getLuminance(),mt=!1,gt="xy",vt=function(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")}(at,dt,X,Z,pt="M0,0H"+J+"V"+K+"H0V0"),yt=function(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:g.background,stroke:g.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}(at,X,Z),o(at)}function j(e,r){function n(){gt="",ft.r=ft.l,ft.t=ft.b,yt.attr("d","M0,0Z")}if(t._transitioningWithDuration)return!1;var i=Math.max(0,Math.min(J,e+ut)),a=Math.max(0,Math.min(K,r+ht)),o=Math.abs(i-ut),s=Math.abs(a-ht);ft.l=Math.min(ut,i),ft.r=Math.max(ut,i),ft.t=Math.min(ht,a),ft.b=Math.max(ht,a),et?o>L||s>L?(gt="xy",o/J>s/K?(s=o*K/J,ht>a?ft.t=ht-s:ft.b=ht+s):(o=s*J/K,ut>i?ft.l=ut-o:ft.r=ut+o),yt.attr("d",c(ft))):n():!$||s<Math.min(Math.max(.6*o,E),L)?o<E?n():(ft.t=0,ft.b=K,gt="x",yt.attr("d",function(t,e){return"M"+(t.l-.5)+","+(e-L-.5)+"h-3v"+(2*L+1)+"h3ZM"+(t.r+.5)+","+(e-L-.5)+"h3v"+(2*L+1)+"h-3Z"}(ft,ht))):!Q||o<Math.min(.6*s,L)?(ft.l=0,ft.r=J,gt="y",yt.attr("d",function(t,e){return"M"+(e-L-.5)+","+(t.t-.5)+"v-3h"+(2*L+1)+"v3ZM"+(e-L-.5)+","+(t.b+.5)+"v3h"+(2*L+1)+"v-3Z"}(ft,ut))):(gt="xy",yt.attr("d",c(ft))),ft.w=ft.r-ft.l,ft.h=ft.b-ft.t,function(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"),i||(t.transition().style("fill",a>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}(vt,yt,ft,pt,mt,dt),mt=!0}function N(){if(Math.min(ft.h,ft.w)<2*E)return s(t);"xy"!==gt&&"x"!==gt||i(Y,ft.l/J,ft.r/J,bt,rt),"xy"!==gt&&"y"!==gt||i(W,(K-ft.b)/K,(K-ft.t)/K,bt,nt),s(t),H(),C&&t.data&&t._context.showTips&&(p.notifier(p._(t,"Double-click to zoom back out"),"long"),C=!1)}function B(e){function r(t,e,r){if(!t.fixedrange){var n=p.simpleMap(t.range,t.r2l),i=n[0]+(n[1]-n[0])*e;t.range=n.map(function(e){return t.l2r(i+(e-i)*r)})}}if(t._context.scrollZoom||it._enablescrollzoom){if(t._transitioningWithDuration)return p.pauseEvent(e);var n=t.querySelector(".plotly");if(F(),!(n.scrollHeight-n.clientHeight>10||n.scrollWidth-n.clientWidth>10)){clearTimeout(_t);var i=-e.deltaY;if(isFinite(i)||(i=e.wheelDelta/10),isFinite(i)){var a,o=Math.exp(-Math.min(Math.max(i,-20),20)/200),s=Mt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,c=(s.bottom-e.clientY)/s.height;if(O||et){for(O||(l=.5),a=0;a<Y.length;a++)r(Y[a],l,o);xt[2]*=o,xt[0]+=xt[2]*l*(1/o-1)}if(z||et){for(z||(c=.5),a=0;a<W.length;a++)r(W[a],c,o);xt[3]*=o,xt[1]+=xt[3]*(1-c)*(1/o-1)}return q(xt),V(z,O),_t=setTimeout(function(){xt=[0,0,J,K];H()},wt),p.pauseEvent(e)}p.log("Did not find wheel motion attributes: ",e)}}}function U(e,r){function n(t,e,r){for(var n,i,a=1-e,o=0;o<t.length;o++){var s=t[o];if(!s.fixedrange){n=s,i=s._rl[a]+(s._rl[e]-s._rl[a])/function(t){return 1-(t>=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}(r/s._length);var l=s.l2r(i);!1!==l&&void 0!==l&&(s.range[e]=l)}}return n._length*(n._rl[e]-i)/(n._rl[e]-n._rl[a])}if(!t._transitioningWithDuration){if(F(),"ew"===Q||"ns"===$)return Q&&a(Y,e),$&&a(W,r),q([Q?-e:0,$?-r:0,J,K]),void V($,Q);if(et&&Q&&$){var i="w"===Q==("n"===$)?1:-1,o=(e/J+i*r/K)/2;e=o*J,r=i*o*K}"w"===Q?e=n(Y,0,e):"e"===Q?e=n(Y,1,-e):Q||(e=0),"n"===$?r=n(W,1,r):"s"===$?r=n(W,0,-r):$||(r=0);var s="w"===Q?e:0,l="n"===$?r:0;if(et){var c;if(!Q&&1===$.length){for(c=0;c<Y.length;c++)Y[c].range=Y[c]._r.slice(),A(Y[c],1-r/K);s=(e=r*J/K)/2}if(!$&&1===Q.length){for(c=0;c<W.length;c++)W[c].range=W[c]._r.slice(),A(W[c],1-e/J);l=(r=e*K/J)/2}}q([s,l,J-e,K-r]),V($,Q)}}function V(e,r){function n(t){for(a=0;a<t.length;a++)t[a].fixedrange||o.push(t[a]._id)}function i(n,i,s){for(a=0;a<n.length;a++){var l=n[a];if((r&&-1!==o.indexOf(l.xref)||e&&-1!==o.indexOf(l.yref))&&(i(t,a),s))return}}var a,o=[];for((r||et)&&(n(Y),n(rt)),(e||et)&&(n(W),n(nt)),bt={},a=0;a<o.length;a++){var s=o[a];M(t,s,!0);var l=k(t,s);bt[l._name+".range[0]"]=l.range[0],bt[l._name+".range[1]"]=l.range[1]}i(it.annotations||[],d.getComponentMethod("annotations","drawOne")),i(it.shapes||[],d.getComponentMethod("shapes","drawOne")),i(it.images||[],d.getComponentMethod("images","draw"),!0)}function H(){q([0,0,J,K]),p.syncOrAsync([w.previousPromises,function(){f.relayout(t,bt)}],t)}function q(t){function e(t){return t.fixedrange?0:d&&-1!==rt.indexOf(t)?h:m&&-1!==(et?rt:nt).indexOf(t)?f:0}function r(t,e){return e?(t.range=t._r.slice(),A(t,e),n(t,e)):0}function n(t,e){return t._length*(1-e)*_[t.constraintoward||"middle"]}var i,a,o,s,l,c=it._plots,u=Object.keys(c),h=t[2]/Y[0]._length,f=t[3]/W[0]._length,d=O||et,m=z||et;for(it._glcanvas&&it._glcanvas.size()&&it._glcanvas.each(function(t){t.regl&&t.regl.clear({color:!0})}),i=0;i<u.length;i++){var g=c[u[i]],y=g.xaxis,b=g.yaxis,x=d&&!y.fixedrange&&-1!==Y.indexOf(y),w=m&&!b.fixedrange&&-1!==W.indexOf(b);if(g._scene&&g._scene.update){var M=p.simpleMap(y.range,y.r2l),k=p.simpleMap(b.range,b.r2l);g._scene.update({range:[M[0],k[0],M[1],k[1]]})}if(x?(a=h,s=O?t[0]:n(y,a)):s=r(y,a=e(y)),w?(o=f,l=z?t[1]:n(b,o)):l=r(b,o=e(b)),a||o){a||(a=1),o||(o=1);var T=y._offset-s/a,S=b._offset-l/o;it._defs.select("#"+g.clipId+"> rect").call(v.setTranslate,s,l).call(v.setScale,a,o);var E=g.plot.selectAll(".scatterlayer .trace, .boxlayer .trace, .violinlayer .trace");g.plot.call(v.setTranslate,T,S).call(v.setScale,1/a,1/o),E.selectAll(".point").call(v.setPointGroupScale,a,o),E.selectAll(".textpoint").call(v.setTextPointsScale,a,o),E.call(v.hideOutsideRangePoints,g)}}}var G,Y,W,X,Z,J,K,Q,$,tt,et,rt,nt,it=t._fullLayout,at=t._fullLayout._zoomlayer,ot=z+O==="nsew",st=1===(z+O).length;F();var lt=function(t,e,r,n,i,a,o){var s=t.draglayer.selectAll("."+e).data([0]);return s.enter().append("rect").classed("drag",!0).classed(e,!0).style({fill:"transparent","stroke-width":0}).attr("data-subplot",t.id),s.call(v.setRect,n,i,a,o).call(b,r),s.node()}(e,z+O+"drag",tt,r,I,P,D);if(!$&&!Q&&!l(it.dragmode))return lt.onmousedown=null,lt.style.pointerEvents=ot?"all":"none",lt;var ct={element:lt,gd:t,plotinfo:e,prepFn:function(e,r,n){var i=t._fullLayout.dragmode;ot?e.shiftKey?"pan"===i?i="zoom":l(i)||(i="pan"):e.ctrlKey&&(i="pan"):i="pan",ct.minDrag="lasso"===i?1:void 0,"zoom"===i?(ct.moveFn=j,ct.doneFn=N,ct.minDrag=1,R(0,r,n)):"pan"===i?(ct.moveFn=U,ct.doneFn=H,o(at)):l(i)&&(ct.xaxes=Y,ct.yaxes=W,T(e,r,n,ct,i))},clickFn:function(r,n){if(s(t),2!==r||st||function(){if(!t._transitioningWithDuration){var e,r,n,i=t._context.doubleClick,a=(Q?Y:[]).concat($?W:[]),o={};if("reset+autosize"===i)for(i="autosize",r=0;r<a.length;r++)if((e=a[r])._rangeInitial&&(e.range[0]!==e._rangeInitial[0]||e.range[1]!==e._rangeInitial[1])||!e._rangeInitial&&!e.autorange){i="reset";break}if("autosize"===i)for(r=0;r<a.length;r++)(e=a[r]).fixedrange||(o[e._name+".autorange"]=!0);else if("reset"===i)for((Q||et)&&(a=a.concat(rt)),$&&!et&&(a=a.concat(nt)),et&&(Q?$||(a=a.concat(W)):a=a.concat(Y)),r=0;r<a.length;r++)(e=a[r])._rangeInitial?(n=e._rangeInitial,o[e._name+".range[0]"]=n[0],o[e._name+".range[1]"]=n[1]):o[e._name+".autorange"]=!0;t.emit("plotly_doubleclick",null),f.relayout(t,o)}}(),ot)y.click(t,n,e.id);else if(1===r&&st){var i=z?W[0]:Y[0],a="s"===z||"w"===O?0:1,o=i._name+".range["+a+"]",l=function(t,e){var r,n=t.range[e],i=Math.abs(n-t.range[1-e]);return"date"===t.type?n:"log"===t.type?(r=Math.ceil(Math.max(0,-Math.log(i)/Math.LN10))+3,u.format("."+r+"g")(Math.pow(10,n))):(r=Math.floor(Math.log(Math.abs(n))/Math.LN10)-Math.floor(Math.log(i)/Math.LN10)+4,u.format("."+String(r)+"g")(n))}(i,a),c="left",h="middle";if(i.fixedrange)return;z?(h="n"===z?"top":"bottom","right"===i.side&&(c="right")):"e"===O&&(c="right"),t._context.showAxisRangeEntryBoxes&&u.select(lt).call(m.makeEditable,{gd:t,immediate:!0,background:it.paper_bgcolor,text:String(l),fill:i.tickfont?i.tickfont.color:"#444",horizontalAlign:c,verticalAlign:h}).on("edit",function(e){var r=i.d2r(e);void 0!==r&&f.relayout(t,o,r)})}}};x.init(ct);var ut,ht,ft,dt,pt,mt,gt,vt,yt,bt={},xt=[0,0,J,K],_t=null,wt=S.REDRAWDELAY,Mt=e.mainplot?it._plots[e.mainplot]:e;return z.length*O.length!=1&&(void 0!==lt.onwheel?lt.onwheel=B:void 0!==lt.onmousewheel&&(lt.onmousewheel=B)),lt}},{"../../components/color":613,"../../components/dragelement":635,"../../components/drawing":638,"../../components/fx":655,"../../constants/alignment":711,"../../lib":738,"../../lib/setcursor":757,"../../lib/svg_text_utils":761,"../../plotly":780,"../../registry":861,"../plots":846,"./axes":785,"./axis_ids":788,"./constants":790,"./scale_zoom":801,"./select":802,d3:123,tinycolor2:543}],794:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../components/dragelement"),a=t("./constants"),o=t("./dragbox");e.exports=function(t){var e=t._fullLayout;if((e._has("cartesian")||e._has("gl2d"))&&!t._context.staticPlot){Object.keys(e._plots||{}).sort(function(t,r){if((e._plots[t].mainplot&&!0)===(e._plots[r].mainplot&&!0)){var n=t.split("y"),i=r.split("y");return n[0]===i[0]?Number(n[1]||1)-Number(i[1]||1):Number(n[0]||1)-Number(i[0]||1)}return e._plots[t].mainplot?1:-1}).forEach(function(r){var s=e._plots[r],l=s.xaxis,c=s.yaxis,u=a.DRAGGERSIZE;if(!s.mainplot){var h=o(t,s,l._offset,c._offset,l._length,c._length,"ns","ew");h.onmousemove=function(e){t._fullLayout._rehover=function(){t._fullLayout._hoversubplot===r&&n.hover(t,e,r)},n.hover(t,e,r),t._fullLayout._lasthover=h,t._fullLayout._hoversubplot=r},h.onmouseout=function(e){t._dragging||(t._fullLayout._hoversubplot=null,i.unhover(t,e))},t._context.showAxisDragHandles&&(o(t,s,l._offset-u,c._offset-u,u,u,"n","w"),o(t,s,l._offset+l._length,c._offset-u,u,u,"n","e"),o(t,s,l._offset-u,c._offset+c._length,u,u,"s","w"),o(t,s,l._offset+l._length,c._offset+c._length,u,u,"s","e"))}if(t._context.showAxisDragHandles){if(r===l._mainSubplot){var f=l._mainLinePosition;"top"===l.side&&(f-=u),o(t,s,l._offset+.1*l._length,f,.8*l._length,u,"","ew"),o(t,s,l._offset,f,.1*l._length,u,"","w"),o(t,s,l._offset+.9*l._length,f,.1*l._length,u,"","e")}if(r===c._mainSubplot){var d=c._mainLinePosition;"right"!==c.side&&(d-=u),o(t,s,d,c._offset+.1*c._length,u,.8*c._length,"ns",""),o(t,s,d,c._offset+.9*c._length,u,.1*c._length,"s",""),o(t,s,d,c._offset,u,.1*c._length,"n","")}}});var r=e._hoverlayer.node();r.onmousemove=function(r){r.target=e._lasthover,n.hover(t,r,e._hoversubplot)},r.onclick=function(r){r.target=e._lasthover,n.click(t,r)},r.onmousedown=function(t){e._lasthover.onmousedown(t)}}}},{"../../components/dragelement":635,"../../components/fx":655,"./constants":790,"./dragbox":793}],795:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib");e.exports=function(t){return function(e,r){var a=e[t];if(Array.isArray(a))for(var o=n.subplotsRegistry.cartesian,s=o.idRegex,l=r._subplots,c=l.xaxis,u=l.yaxis,h=l.cartesian,f=r._has("cartesian")||r._has("gl2d"),d=0;d<a.length;d++){var p=a[d];if(i.isPlainObject(p)){var m=p.xref,g=p.yref,v=s.x.test(m),y=s.y.test(g);if(v||y){f||i.pushUnique(r._basePlotModules,o);var b=!1;v&&-1===c.indexOf(m)&&(c.push(m),b=!0),y&&-1===u.indexOf(g)&&(u.push(g),b=!0),b&&v&&y&&h.push(m+g)}}}}}},{"../../lib":738,"../../registry":861}],796:[function(t,e,r){"use strict";function n(t,e,r,n,i){var a=t._fullLayout._modules;e.plot&&e.plot.selectAll("g:not(.scatterlayer)").selectAll("g.trace").remove();for(var o=0;o<a.length;o++){var s=a[o];if("cartesian"===s.basePlotModule.name){var l=u(r,s);s.plot(t,e,l,n,i)}}}function i(t){var e=t.plotgroup,r=t.id,n=f.layerValue2layerClass[t.xaxis.layer],i=f.layerValue2layerClass[t.yaxis.layer];if(t.mainplot){var a=t.mainplotinfo,s=a.plotgroup,l=r+"-x",c=r+"-y";t.gridlayer=a.gridlayer,t.zerolinelayer=a.zerolinelayer,o(a.overlinesBelow,"path",l),o(a.overlinesBelow,"path",c),o(a.overaxesBelow,"g",l),o(a.overaxesBelow,"g",c),t.plot=o(a.overplot,"g",r),o(a.overlinesAbove,"path",l),o(a.overlinesAbove,"path",c),o(a.overaxesAbove,"g",l),o(a.overaxesAbove,"g",c),t.xlines=s.select(".overlines-"+n).select("."+l),t.ylines=s.select(".overlines-"+i).select("."+c),t.xaxislayer=s.select(".overaxes-"+n).select("."+l),t.yaxislayer=s.select(".overaxes-"+i).select("."+c)}else{var u=o(e,"g","layer-subplot");t.shapelayer=o(u,"g","shapelayer"),t.imagelayer=o(u,"g","imagelayer"),t.gridlayer=o(e,"g","gridlayer"),t.zerolinelayer=o(e,"g","zerolinelayer"),o(e,"path","xlines-below"),o(e,"path","ylines-below"),t.overlinesBelow=o(e,"g","overlines-below"),o(e,"g","xaxislayer-below"),o(e,"g","yaxislayer-below"),t.overaxesBelow=o(e,"g","overaxes-below"),t.plot=o(e,"g","plot"),t.overplot=o(e,"g","overplot"),o(e,"path","xlines-above"),o(e,"path","ylines-above"),t.overlinesAbove=o(e,"g","overlines-above"),o(e,"g","xaxislayer-above"),o(e,"g","yaxislayer-above"),t.overaxesAbove=o(e,"g","overaxes-above"),t.xlines=e.select(".xlines-"+n),t.ylines=e.select(".ylines-"+i),t.xaxislayer=e.select(".xaxislayer-"+n),t.yaxislayer=e.select(".yaxislayer-"+i)}o(t.gridlayer,"g",t.xaxis._id,t.xaxis._id),o(t.gridlayer,"g",t.yaxis._id,t.yaxis._id),t.gridlayer.selectAll("g").sort(h.idSort);for(var d=0;d<f.traceLayerClasses.length;d++)o(t.plot,"g",f.traceLayerClasses[d]);t.xlines.style("fill","none").classed("crisp",!0),t.ylines.style("fill","none").classed("crisp",!0)}function a(t,e){if(t){var r={};t.each(function(t){var n=s.select(this),i="clip"+e._uid+t+"plot";n.remove(),e._draggers.selectAll("g."+t).remove(),e._defs.select("#"+i).remove(),r[t]=!0});for(var n=e._plots,i=Object.keys(n),a=0;a<i.length;a++)for(var o=n[i[a]].overlays||[],l=0;l<o.length;l++){var c=o[l];r[c.id]&&c.plot.selectAll(".trace").remove()}}}function o(t,e,r,n){var i=t.selectAll("."+r).data([n||0]);return i.enter().append(e).classed(r,!0),i}var s=t("d3"),l=t("../../lib"),c=t("../plots"),u=t("../get_data").getModuleCalcData,h=t("./axis_ids"),f=t("./constants");r.name="cartesian",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=f.idRegex,r.attrRegex=f.attrRegex,r.attributes=t("./attributes"),r.layoutAttributes=t("./layout_attributes"),r.supplyLayoutDefaults=t("./layout_defaults"),r.transitionAxes=t("./transition_axes"),r.finalizeSubplots=function(t,e){var r,n,i,a=e._subplots,o=a.xaxis,s=a.yaxis,c=a.cartesian,u=c.concat(a.gl2d||[]),d={},p={};for(r=0;r<u.length;r++){var m=u[r].split("y");d[m[0]]=1,p["y"+m[1]]=1}for(r=0;r<o.length;r++)d[n=o[r]]||(i=(t[h.id2name(n)]||{}).anchor,f.idRegex.y.test(i)||(i="y"),c.push(n+i),u.push(n+i),p[i]||(p[i]=1,l.pushUnique(s,i)));for(r=0;r<s.length;r++)p[i=s[r]]||(n=(t[h.id2name(i)]||{}).anchor,f.idRegex.x.test(n)||(n="x"),c.push(n+i),u.push(n+i),d[n]||(d[n]=1,l.pushUnique(o,n)));if(!u.length){var g=Object.keys(t);for(n="",i="",r=0;r<g.length;r++){var v=g[r];if(f.attrRegex.test(v)){"x"===v.charAt(0)?(!n||+v.substr(5)<+n.substr(5))&&(n=v):(!i||+v.substr(5)<+i.substr(5))&&(i=v)}}n=n?h.name2id(n):"x",i=i?h.name2id(i):"y",o.push(n),s.push(i),c.push(n+i)}},r.plot=function(t,e,r,i){var a,o=t._fullLayout,s=o._subplots.cartesian,l=t.calcdata;if(!Array.isArray(e))for(e=[],a=0;a<l.length;a++)e.push(a);for(o._glcanvas&&o._glcanvas.size()&&o._glcanvas.each(function(t){t.regl&&t.regl.clear({color:!0})}),a=0;a<s.length;a++){for(var c,u=s[a],h=o._plots[u],f=[],d=0;d<l.length;d++){var p=l[d],m=p[0].trace;m.xaxis+m.yaxis===u&&((-1!==e.indexOf(m.index)||m.carpet)&&(c&&c[0].trace.xaxis+c[0].trace.yaxis===u&&-1!==["tonextx","tonexty","tonext"].indexOf(m.fill)&&-1===f.indexOf(c)&&f.push(c),f.push(p)),c=p)}n(t,h,f,r,i)}},r.clean=function(t,e,r,n){var i,o,s,l=n._modules||[],c=e._modules||[];for(s=0;s<l.length;s++)if("scatter"===l[s].name){i=!0;break}for(s=0;s<c.length;s++)if("scatter"===c[s].name){o=!0;break}if(i&&!o){var u=n._plots,h=Object.keys(u||{});for(s=0;s<h.length;s++){var f=u[h[s]];f.plot&&f.plot.select("g.scatterlayer").selectAll("g.trace").remove()}n._infolayer.selectAll("g.rangeslider-container").select("g.scatterlayer").selectAll("g.trace").remove()}var d=n._subplots||{},p=e._subplots||{xaxis:[],yaxis:[]};if(d.xaxis&&d.yaxis){var m=d.xaxis.concat(d.yaxis),g=p.xaxis.concat(p.yaxis);for(s=0;s<m.length;s++)-1===g.indexOf(m[s])&&n._infolayer.selectAll(".g-"+m[s]+"title").remove()}var v=n._has&&n._has("cartesian"),y=e._has&&e._has("cartesian");v&&!y&&(a(n._cartesianlayer.selectAll(".subplot"),n),n._defs.selectAll(".axesclip").remove())},r.drawFramework=function(t){var e=t._fullLayout,r=function(t){for(var e=t._fullLayout,r=Object.keys(e._plots),n=[],i=[],a=0;a<r.length;a++){var o=r[a],s=e._plots[o],l=s.xaxis,c=s.yaxis,u=l._mainAxis,h=c._mainAxis,f=u._id+h._id;f!==o&&-1!==r.indexOf(f)?(s.mainplot=f,s.mainplotinfo=e._plots[f],i.push(o)):n.push(o)}return n=n.concat(i)}(t),n=e._cartesianlayer.selectAll(".subplot").data(r,l.identity);n.enter().append("g").attr("class",function(t){return"subplot "+t}),n.order(),n.exit().call(a,e),n.each(function(t){var r=e._plots[t];if(r.plotgroup=s.select(this),r.overlays=[],i(r),r.mainplot){e._plots[r.mainplot].overlays.push(r)}r.draglayer=o(e._draggers,"g",t)})},r.rangePlot=function(t,e,r){i(e),n(t,e,r),c.style(t)}},{"../../lib":738,"../get_data":820,"../plots":846,"./attributes":784,"./axis_ids":788,"./constants":790,"./layout_attributes":797,"./layout_defaults":798,"./transition_axes":807,d3:123}],797:[function(t,e,r){"use strict";var n=t("../font_attributes"),i=t("../../components/color/attributes"),a=t("../../components/drawing/attributes").dash,o=t("../../lib/extend").extendFlat,s=t("./constants");e.exports={visible:{valType:"boolean",editType:"plot"},color:{valType:"color",dflt:i.defaultLine,editType:"ticks"},title:{valType:"string",editType:"ticks"},titlefont:n({editType:"ticks"}),type:{valType:"enumerated",values:["-","linear","log","date","category"],dflt:"-",editType:"calc"},autorange:{valType:"enumerated",values:[!0,!1,"reversed"],dflt:!0,editType:"calc",impliedEdits:{"range[0]":void 0,"range[1]":void 0}},rangemode:{valType:"enumerated",values:["normal","tozero","nonnegative"],dflt:"normal",editType:"calc"},range:{valType:"info_array",items:[{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}},{valType:"any",editType:"plot",impliedEdits:{"^autorange":!1}}],editType:"plot",impliedEdits:{autorange:!1}},fixedrange:{valType:"boolean",dflt:!1,editType:"calc"},scaleanchor:{valType:"enumerated",values:[s.idRegex.x.toString(),s.idRegex.y.toString()],editType:"calc"},scaleratio:{valType:"number",min:0,dflt:1,editType:"calc"},constrain:{valType:"enumerated",values:["range","domain"],dflt:"range",editType:"calc"},constraintoward:{valType:"enumerated",values:["left","center","right","top","middle","bottom"],editType:"calc"},tickmode:{valType:"enumerated",values:["auto","linear","array"],editType:"ticks",impliedEdits:{tick0:void 0,dtick:void 0}},nticks:{valType:"integer",min:0,dflt:0,editType:"ticks"},tick0:{valType:"any",editType:"ticks",impliedEdits:{tickmode:"linear"}},dtick:{valType:"any",editType:"ticks",impliedEdits:{tickmode:"linear"}},tickvals:{valType:"data_array",editType:"ticks"},ticktext:{valType:"data_array",editType:"ticks"},ticks:{valType:"enumerated",values:["outside","inside",""],editType:"ticks"},mirror:{valType:"enumerated",values:[!0,"ticks",!1,"all","allticks"],dflt:!1,editType:"ticks+layoutstyle"},ticklen:{valType:"number",min:0,dflt:5,editType:"ticks"},tickwidth:{valType:"number",min:0,dflt:1,editType:"ticks"},tickcolor:{valType:"color",dflt:i.defaultLine,editType:"ticks"},showticklabels:{valType:"boolean",dflt:!0,editType:"ticks"},showspikes:{valType:"boolean",dflt:!1,editType:"modebar"},spikecolor:{valType:"color",dflt:null,editType:"none"},spikethickness:{valType:"number",dflt:3,editType:"none"},spikedash:o({},a,{dflt:"dash",editType:"none"}),spikemode:{valType:"flaglist",flags:["toaxis","across","marker"],dflt:"toaxis",editType:"none"},tickfont:n({editType:"ticks"}),tickangle:{valType:"angle",dflt:"auto",editType:"ticks"},tickprefix:{valType:"string",dflt:"",editType:"ticks"},showtickprefix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"ticks"},ticksuffix:{valType:"string",dflt:"",editType:"ticks"},showticksuffix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"ticks"},showexponent:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"ticks"},exponentformat:{valType:"enumerated",values:["none","e","E","power","SI","B"],dflt:"B",editType:"ticks"},separatethousands:{valType:"boolean",dflt:!1,editType:"ticks"},tickformat:{valType:"string",dflt:"",editType:"ticks"},tickformatstops:{_isLinkedToArray:"tickformatstop",dtickrange:{valType:"info_array",items:[{valType:"any",editType:"ticks"},{valType:"any",editType:"ticks"}],editType:"ticks"},value:{valType:"string",dflt:"",editType:"ticks"},editType:"ticks"},hoverformat:{valType:"string",dflt:"",editType:"none"},showline:{valType:"boolean",dflt:!1,editType:"layoutstyle"},linecolor:{valType:"color",dflt:i.defaultLine,editType:"layoutstyle"},linewidth:{valType:"number",min:0,dflt:1,editType:"ticks+layoutstyle"},showgrid:{valType:"boolean",editType:"ticks"},gridcolor:{valType:"color",dflt:i.lightLine,editType:"ticks"},gridwidth:{valType:"number",min:0,dflt:1,editType:"ticks"},zeroline:{valType:"boolean",editType:"ticks"},zerolinecolor:{valType:"color",dflt:i.defaultLine,editType:"ticks"},zerolinewidth:{valType:"number",dflt:1,editType:"ticks"},anchor:{valType:"enumerated",values:["free",s.idRegex.x.toString(),s.idRegex.y.toString()],editType:"plot"},side:{valType:"enumerated",values:["top","bottom","left","right"],editType:"plot"},overlaying:{valType:"enumerated",values:["free",s.idRegex.x.toString(),s.idRegex.y.toString()],editType:"calc"},layer:{valType:"enumerated",values:["above traces","below traces"],dflt:"above traces",editType:"plot"},domain:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"calc"},{valType:"number",min:0,max:1,editType:"calc"}],dflt:[0,1],editType:"calc"},position:{valType:"number",min:0,max:1,dflt:0,editType:"plot"},categoryorder:{valType:"enumerated",values:["trace","category ascending","category descending","array"],dflt:"trace",editType:"calc"},categoryarray:{valType:"data_array",editType:"calc"},editType:"calc",_deprecated:{autotick:{valType:"boolean",editType:"ticks"}}}},{"../../components/color/attributes":612,"../../components/drawing/attributes":637,"../../lib/extend":727,"../font_attributes":810,"./constants":790}],798:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/color"),o=t("../layout_attributes"),s=t("./layout_attributes"),l=t("./type_defaults"),c=t("./axis_defaults"),u=t("./constraint_defaults"),h=t("./position_defaults"),f=t("./axis_ids");e.exports=function(t,e,r){function d(t,e){return i.coerce(D,z,s,t,e)}function p(t){return"x"===t?A:T}function m(e,r){for(var n="x"===e?S:E,i=[],a=0;a<n.length;a++){var o=n[a];o===r||(t[o]||{}).overlaying||i.push(f.name2id(o))}return i}var g,v={},y={},b={},x={};for(g=0;g<r.length;g++){var _=r[g];if(n.traceIs(_,"cartesian")||n.traceIs(_,"gl2d")){var w=f.id2name(_.xaxis),M=f.id2name(_.yaxis);if(n.traceIs(_,"carpet")&&("carpet"!==_.type||_._cheater)||w&&(y[w]=1),"carpet"===_.type&&_._cheater&&w&&(v[w]=1),n.traceIs(_,"2dMap")&&(b[w]=!0,b[M]=!0),n.traceIs(_,"oriented")){x["h"===_.orientation?M:w]=!0}}}var k=e._subplots,T=k.xaxis,A=k.yaxis,S=i.simpleMap(T,f.id2name),E=i.simpleMap(A,f.id2name),L=S.concat(E),C=a.background;T.length&&A.length&&(C=i.coerce(t,e,o,"plot_bgcolor"));var I,P,D,z,O=a.combine(C,e.paper_bgcolor),F={x:p("x"),y:p("y")};for(g=0;g<L.length;g++){I=L[g],i.isPlainObject(t[I])||(t[I]={}),D=t[I],z=e[I]={},l(D,z,d,r,I);var R=m(P=I.charAt(0),I),j={letter:P,font:e.font,outerTicks:b[I],showGrid:!x[I],data:r,bgColor:O,calendar:e.calendar,cheateronly:"x"===P&&v[I]&&!y[I]};c(D,z,d,j,e);d("showspikes")&&(d("spikecolor"),d("spikethickness"),d("spikedash"),d("spikemode"));var N={letter:P,counterAxes:F[P],overlayableAxes:R};h(D,z,d,N),z._input=D}var B=n.getComponentMethod("rangeslider","handleDefaults"),U=n.getComponentMethod("rangeselector","handleDefaults");for(g=0;g<S.length;g++)I=S[g],D=t[I],z=e[I],B(t,e,I),"date"===z.type&&U(D,z,e,E,z.calendar),d("fixedrange");for(g=0;g<E.length;g++){I=E[g],D=t[I],z=e[I];var V=e[f.id2name(z.anchor)];d("fixedrange",V&&V.rangeslider&&V.rangeslider.visible)}e._axisConstraintGroups=[];var H=F.x.concat(F.y);for(g=0;g<L.length;g++)P=(I=L[g]).charAt(0),D=t[I],z=e[I],u(D,z,d,H,e)}},{"../../components/color":613,"../../lib":738,"../../registry":861,"../layout_attributes":837,"./axis_defaults":787,"./axis_ids":788,"./constraint_defaults":791,"./layout_attributes":797,"./position_defaults":800,"./type_defaults":808}],799:[function(t,e,r){"use strict";function n(t,e,r){var n,a,o,s,l,c=[],u=r.map(function(e){return e[t]}),h=i.bisector(e).left;for(n=0;n<u.length;n++)for(o=u[n],a=0;a<o.length;a++)null!==(s=o[a])&&void 0!==s&&((l=h(c,s))<c.length&&c[l]===s||c.splice(l,0,s));return c}var i=t("d3");e.exports=function(t,e,r,a){switch(e){case"array":return Array.isArray(r)?r.slice():[];case"category ascending":return n(t,i.ascending,a);case"category descending":return n(t,i.descending,a);case"trace":default:return[]}}},{d3:123}],800:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");e.exports=function(t,e,r,a){var o=a.counterAxes||[],s=a.overlayableAxes||[],l=a.letter;"free"===i.coerce(t,e,{anchor:{valType:"enumerated",values:["free"].concat(o),dflt:n(t.position)?"free":o[0]||"free"}},"anchor")&&r("position"),i.coerce(t,e,{side:{valType:"enumerated",values:"x"===l?["bottom","top"]:["left","right"],dflt:"x"===l?"bottom":"left"}},"side");var c=!1;if(s.length&&(c=i.coerce(t,e,{overlaying:{valType:"enumerated",values:[!1].concat(s),dflt:!1}},"overlaying")),!c){var u=r("domain");u[0]>u[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return r("layer"),e}},{"../../lib":738,"fast-isnumeric":132}],801:[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":711}],802:[function(t,e,r){"use strict";function n(t){return t._id}function i(t,e,r){var n,i,a;if(r){var o=r.points||[];for(n=0;n<e.length;n++)(a=e[n].cd[0].trace).selectedpoints=[],a._input.selectedpoints=[];for(n=0;n<o.length;n++){var s=o[n],l=s.data,c=s.fullData;s.pointIndices?(l.selectedpoints=l.selectedpoints.concat(s.pointIndices),c.selectedpoints=c.selectedpoints.concat(s.pointIndices)):(l.selectedpoints.push(s.pointIndex),c.selectedpoints.push(s.pointIndex))}}else for(n=0;n<e.length;n++)delete(a=e[n].cd[0].trace).selectedpoints,delete a._input.selectedpoints;for(n=0;n<e.length;n++)(i=e[n]).style&&i.style(t,i.cd)}var a=t("polybooljs"),o=t("../../lib/polygon"),s=t("../../lib/throttle"),l=t("../../components/color"),c=t("../../components/fx/helpers").makeEventData,u=t("./axes"),h=t("./constants"),f=o.filter,d=o.tester,p=o.multitester,m=h.MINSELECT;e.exports=function(t,e,r,o,g){function v(t){var e="y"===t._id.charAt(0)?1:0;return function(r){return t.p2d(r[e])}}function y(t,e){return t-e}var b,x,_,w,M=o.gd,k=M._fullLayout,T=k._zoomlayer,A=o.element.getBoundingClientRect(),S=o.plotinfo,E=S.xaxis._offset,L=S.yaxis._offset,C=e-A.left,I=r-A.top,P=C,D=I,z="M"+C+","+I,O=o.xaxes[0]._length,F=o.yaxes[0]._length,R=o.xaxes.map(n),j=o.yaxes.map(n),N=o.xaxes.concat(o.yaxes),B=t.altKey;(t.shiftKey||t.altKey)&&S.selection&&S.selection.polygons&&!o.polygons?(o.polygons=S.selection.polygons,o.mergedPolygons=S.selection.mergedPolygons):(!t.shiftKey&&!t.altKey||(t.shiftKey||t.altKey)&&!S.selection)&&(S.selection={},S.selection.polygons=o.polygons=[],S.selection.mergedPolygons=o.mergedPolygons=[]),"lasso"===g&&(b=f([[C,I]],h.BENDPX));var U=T.selectAll("path.select-outline").data([1,2]);U.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t}).attr("transform","translate("+E+", "+L+")").attr("d",z+"Z");var V,H,q,G,Y,W=T.append("path").attr("class","zoombox-corners").style({fill:l.background,stroke:l.defaultLine,"stroke-width":1}).attr("transform","translate("+E+", "+L+")").attr("d","M0,0Z"),X=[],Z=k._uid+h.SELECTID,J=[];for(V=0;V<M.calcdata.length;V++)if(H=M.calcdata[V],!0===(q=H[0].trace).visible&&q._module&&q._module.selectPoints)if(o.subplot)q.subplot!==o.subplot&&q.geo!==o.subplot||X.push({selectPoints:q._module.selectPoints,style:q._module.style,cd:H,xaxis:o.xaxes[0],yaxis:o.yaxes[0]});else{if(-1===R.indexOf(q.xaxis))continue;if(-1===j.indexOf(q.yaxis))continue;X.push({selectPoints:q._module.selectPoints,style:q._module.style,cd:H,xaxis:u.getFromId(M,q.xaxis),yaxis:u.getFromId(M,q.yaxis)})}var K;K=S.fillRangeItems?S.fillRangeItems:"select"===g?function(t,e){var r=t.range={};for(V=0;V<N.length;V++){var n=N[V],i=n._id.charAt(0);r[n._id]=[n.p2d(e[i+"min"]),n.p2d(e[i+"max"])].sort(y)}}:function(t,e,r){var n=t.lassoPoints={};for(V=0;V<N.length;V++){var i=N[V];n[i._id]=r.filtered.map(v(i))}},o.moveFn=function(t,e){P=Math.max(0,Math.min(O,t+C)),D=Math.max(0,Math.min(F,e+I));var r=Math.abs(P-C),n=Math.abs(D-I);"select"===g?n<Math.min(.6*r,m)?((w=[[C,0],[C,F],[P,F],[P,0]]).xmin=Math.min(C,P),w.xmax=Math.max(C,P),w.ymin=Math.min(0,F),w.ymax=Math.max(0,F),W.attr("d","M"+w.xmin+","+(I-m)+"h-4v"+2*m+"h4ZM"+(w.xmax-1)+","+(I-m)+"h4v"+2*m+"h-4Z")):r<Math.min(.6*n,m)?((w=[[0,I],[0,D],[O,D],[O,I]]).xmin=Math.min(0,O),w.xmax=Math.max(0,O),w.ymin=Math.min(I,D),w.ymax=Math.max(I,D),W.attr("d","M"+(C-m)+","+w.ymin+"v-4h"+2*m+"v4ZM"+(C-m)+","+(w.ymax-1)+"v4h"+2*m+"v-4Z")):((w=[[C,I],[C,D],[P,D],[P,I]]).xmin=Math.min(C,P),w.xmax=Math.max(C,P),w.ymin=Math.min(I,D),w.ymax=Math.max(I,D),W.attr("d","M0,0Z")):"lasso"===g&&(b.addPt([P,D]),w=b.filtered),o.polygons&&o.polygons.length?(_=function(t,e,r){return r?a.difference({regions:t,inverted:!1},{regions:[e],inverted:!1}).regions:a.union({regions:t,inverted:!1},{regions:[e],inverted:!1}).regions}(o.mergedPolygons,w,B),w.subtract=B,x=p(o.polygons.concat([w]))):(_=[w],x=d(w));var l=[];for(V=0;V<_.length;V++){var u=_[V];l.push(u.join("L")+"L"+u[0])}U.attr("d","M"+l.join("M")+"Z"),s.throttle(Z,h.SELECTDELAY,function(){J=[];var t,e=[];for(V=0;V<X.length;V++){t=(G=X[V]).selectPoints(G,x),e.push(t);var r=function(t,e){if(Array.isArray(t))for(var r=e.cd,n=e.cd[0].trace,i=0;i<t.length;i++)t[i]=c(t[i],n,r);return t}(t,G);if(J.length)for(var n=0;n<r.length;n++)J.push(r[n]);else J=r}i(M,X,Y={points:J}),K(Y,w,b),o.gd.emit("plotly_selecting",Y)})},o.clickFn=function(t){W.remove(),s.done(Z).then(function(){if(s.clear(Z),2===t){for(U.remove(),V=0;V<X.length;V++)(G=X[V]).selectPoints(G,!1);i(M,X),M.emit("plotly_deselect",null)}else M.emit("plotly_selected",void 0)})},o.doneFn=function(){W.remove(),s.done(Z).then(function(){s.clear(Z),o.gd.emit("plotly_selected",Y),w&&o.polygons&&(w.subtract=B,o.polygons.push(w),o.mergedPolygons.length=0,[].push.apply(o.mergedPolygons,_))})}}},{"../../components/color":613,"../../components/fx/helpers":652,"../../lib/polygon":750,"../../lib/throttle":762,"./axes":785,"./constants":790,polybooljs:487}],803:[function(t,e,r){"use strict";function n(t){return Math.pow(10,t)}var i=t("d3"),a=t("fast-isnumeric"),o=t("../../lib"),s=o.cleanNumber,l=o.ms2DateTime,c=o.dateTime2ms,u=o.ensureNumber,h=t("../../constants/numerical"),f=h.FP_SAFE,d=h.BADNUM,p=t("./constants"),m=t("./axis_ids");e.exports=function(t,e){function r(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-3*M*Math.abs(n-i))}return d}function h(e,r,n){var i=c(e,n||t.calendar);if(i===d){if(!a(e))return d;i=c(new Date(+e))}return i}function g(e,r,n){return l(e,r,n||t.calendar)}function v(e){return t._categories[Math.round(e)]}function y(e){if(null!==e&&void 0!==e){if(void 0===t._categoriesMap&&(t._categoriesMap={}),void 0!==t._categoriesMap[e])return t._categoriesMap[e];t._categories.push(e);var r=t._categories.length-1;return t._categoriesMap[e]=r,r}return d}function b(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(a(e))return+e}function x(e){return a(e)?i.round(t._b+t._m*e,2):d}function _(e){return(e-t._b)/t._m}e=e||{};var w=(t._id||"x").charAt(0),M=10;t.c2l="log"===t.type?r:u,t.l2c="log"===t.type?n:u,t.l2p=x,t.p2l=_,t.c2p="log"===t.type?function(t,e){return x(r(t,e))}:x,t.p2c="log"===t.type?function(t){return n(_(t))}:_,-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=_,t.cleanPos=u):"log"===t.type?(t.d2r=t.d2l=function(t,e){return r(s(t),e)},t.r2d=t.r2c=function(t){return n(s(t))},t.d2c=t.r2l=s,t.c2d=t.l2r=u,t.c2r=r,t.l2d=n,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return n(_(t))},t.r2p=function(e){return t.l2p(s(e))},t.p2r=_,t.cleanPos=u):"date"===t.type?(t.d2r=t.r2d=o.identity,t.d2c=t.r2c=t.d2l=t.r2l=h,t.c2d=t.c2r=t.l2d=t.l2r=g,t.d2p=t.r2p=function(e,r,n){return t.l2p(h(e,0,n))},t.p2d=t.p2r=function(t,e,r){return g(_(t),e,r)},t.cleanPos=function(e){return o.cleanDate(e,d,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=y,t.r2d=t.c2d=t.l2d=v,t.d2r=t.d2l_noadd=b,t.r2c=function(e){var r=b(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=b,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return v(_(t))},t.r2p=t.d2p,t.p2r=_,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:u(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e){e||(e="range");var r,n,i=o.nestedProperty(t,e).get();if(n="date"===t.type?o.dfltRange(t.calendar):"y"===w?p.DFLTRANGEY:p.DFLTRANGEX,n=n.slice(),i&&2===i.length)for("date"===t.type&&(i[0]=o.cleanDate(i[0],d,t.calendar),i[1]=o.cleanDate(i[1],d,t.calendar)),r=0;r<2;r++)if("date"===t.type){if(!o.isDateTime(i[r],t.calendar)){t[e]=n;break}if(t.r2l(i[0])===t.r2l(i[1])){var s=o.constrain(t.r2l(i[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);i[0]=t.l2r(s-1e3),i[1]=t.l2r(s+1e3);break}}else{if(!a(i[r])){if(!a(i[1-r])){t[e]=n;break}i[r]=i[1-r]*(r?10:.1)}if(i[r]<-f?i[r]=-f:i[r]>f&&(i[r]=f),i[0]===i[1]){var l=Math.max(1,Math.abs(1e-6*i[0]));i[0]-=l,i[1]+=l}}else o.nestedProperty(t,e).set(n)},t.setScale=function(r){var n=e._size;if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var i=m.getFromId({_fullLayout:e},t.overlaying);t.domain=i.domain}var a=r&&t._r?"_r":"range",o=t.calendar;t.cleanRange(a);var s=t.r2l(t[a][0],o),l=t.r2l(t[a][1],o);if("y"===w?(t._offset=n.t+(1-t.domain[1])*n.h,t._length=n.h*(t.domain[1]-t.domain[0]),t._m=t._length/(s-l),t._b=-t._m*l):(t._offset=n.l+t.domain[0]*n.w,t._length=n.w*(t.domain[1]-t.domain[0]),t._m=t._length/(l-s),t._b=-t._m*s),!isFinite(t._m)||!isFinite(t._b))throw e._replotting=!1,new Error("Something went wrong with axis scaling")},t.makeCalcdata=function(e,r){var n,i,a,o="date"===t.type&&e[r+"calendar"];if(r in e)for(n=e[r],i=new Array(n.length),a=0;a<n.length;a++)i[a]=t.d2c(n[a],0,o);else{var s=r+"0"in e?t.d2c(e[r+"0"],0,o):0,l=e["d"+r]?Number(e["d"+r]):1;for(n=e[{x:"y",y:"x"}[r]],i=new Array(n.length),a=0;a<n.length;a++)i[a]=s+a*l}return i},t.isValidRange=function(e){return Array.isArray(e)&&2===e.length&&a(t.r2l(e[0]))&&a(t.r2l(e[1]))},t.isPtWithinRange=function(e,r){var n=t.c2l(e[w],null,r);return n>=t.r2l(t.range[0])&&n<=t.r2l(t.range[1])},t._min=[],t._max=[];var k=e._d3locale;"date"===t.type&&(t._dateFormat=k?k.timeFormat.utc:i.time.format.utc),t._separators=e.separators,t._numFormat=k?k.numberFormat:i.format,delete t._minDtick,delete t._forceTick0}},{"../../constants/numerical":717,"../../lib":738,"./axis_ids":788,"./constants":790,d3:123,"fast-isnumeric":132}],804:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r,a,o){var s=function(t){var e=["showexponent","showtickprefix","showticksuffix"].filter(function(e){return void 0!==t[e]});if(e.every(function(r){return t[r]===t[e[0]]})||1===e.length)return t[e[0]]}(t);r("tickprefix")&&r("showtickprefix",s);r("ticksuffix")&&r("showticksuffix",s);if(r("showticklabels")){var l=o.font||{},c=e.color===t.color?e.color:l.color;if(n.coerceFont(r,"tickfont",{family:l.family,size:l.size,color:c}),r("tickangle"),"category"!==a){var u=r("tickformat");!function(t,e){function r(t,e){return n.coerce(s,l,i.tickformatstops,t,e)}var a=t.tickformatstops,o=e.tickformatstops=[];if(Array.isArray(a))for(var s,l,c=0;c<a.length;c++)s=a[c],l={},r("dtickrange"),r("value"),o.push(l)}(t,e),u||"date"===a||(r("showexponent",s),r("exponentformat"),r("separatethousands"))}}"category"===a||o.noHover||r("hoverformat")}},{"../../lib":738,"./layout_attributes":797}],805:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e,r,a){var o=n.coerce2(t,e,i,"ticklen"),s=n.coerce2(t,e,i,"tickwidth"),l=n.coerce2(t,e,i,"tickcolor",e.color);r("ticks",a.outerTicks||o||s||l?"outside":"")||(delete e.ticklen,delete e.tickwidth,delete e.tickcolor)}},{"../../lib":738,"./layout_attributes":797}],806:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../constants/numerical").ONEDAY;e.exports=function(t,e,r,o){var s="auto";"array"!==t.tickmode||"log"!==o&&"date"!==o||(t.tickmode="auto"),Array.isArray(t.tickvals)?s="array":t.dtick&&(s="linear");var l=r("tickmode",s);if("auto"===l)r("nticks");else if("linear"===l){var c="date"===o?a:1,u=r("dtick",c);if(n(u))e.dtick=u>0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var h=u.charAt(0),f=u.substr(1);((f=n(f)?Number(f):0)<=0||!("date"===o&&"M"===h&&f===Math.round(f)||"log"===o&&"L"===h||"log"===o&&"D"===h&&(1===f||2===f)))&&(e.dtick=c)}var d="date"===o?i.dateTick0(e.calendar):0,p=r("tick0",d);"date"===o?e.tick0=i.cleanDate(p,d):n(p)&&"D1"!==u&&"D2"!==u?e.tick0=Number(p):e.tick0=d}else{void 0===r("tickvals")?e.tickmode="auto":r("ticktext")}}},{"../../constants/numerical":717,"../../lib":738,"fast-isnumeric":132}],807:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../plotly"),a=t("../../registry"),o=t("../../components/drawing"),s=t("./axes"),l=t("./constants").attrRegex;e.exports=function(t,e,r,c){function u(t){var e=t.xaxis,r=t.yaxis;d._defs.select("#"+t.clipId+"> 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 h(e,r){var n,i,l,c=m[e.xaxis._id],u=m[e.yaxis._id],h=[];if(c){i=(n=t._fullLayout[c.axisName])._r,l=c.to,h[0]=(i[0]*(1-r)+r*l[0]-i[0])/(i[1]-i[0])*e.xaxis._length;var f=i[1]-i[0],p=l[1]-l[0];n.range[0]=i[0]*(1-r)+r*l[0],n.range[1]=i[1]*(1-r)+r*l[1],h[2]=e.xaxis._length*(1-r+r*p/f)}else h[0]=0,h[2]=e.xaxis._length;if(u){i=(n=t._fullLayout[u.axisName])._r,l=u.to,h[1]=(i[1]*(1-r)+r*l[1]-i[1])/(i[0]-i[1])*e.yaxis._length;var g=i[1]-i[0],v=l[1]-l[0];n.range[0]=i[0]*(1-r)+r*l[0],n.range[1]=i[1]*(1-r)+r*l[1],h[3]=e.yaxis._length*(1-r+r*v/g)}else h[1]=0,h[3]=e.yaxis._length;!function(e,r){function n(e,r,n){for(i=0;i<e.length;i++){var a=e[i];if(-1===o.indexOf(a.xref)&&-1===o.indexOf(a.yref)||r(t,i),n)return}}var i,o=[];for(o=[e._id,r._id],i=0;i<o.length;i++)s.doTicks(t,o[i],!0);n(d.annotations||[],a.getComponentMethod("annotations","drawOne")),n(d.shapes||[],a.getComponentMethod("shapes","drawOne")),n(d.images||[],a.getComponentMethod("images","draw"),!0)}(e.xaxis,e.yaxis);var y=e.xaxis,b=e.yaxis,x=!!c,_=!!u,w=x?y._length/h[2]:1,M=_?b._length/h[3]:1,k=x?h[0]:0,T=_?h[1]:0,A=x?h[0]/h[2]*y._length:0,S=_?h[1]/h[3]*b._length:0,E=y._offset-A,L=b._offset-S;d._defs.select("#"+e.clipId+"> rect").call(o.setTranslate,k,T).call(o.setScale,1/w,1/M),e.plot.call(o.setTranslate,E,L).call(o.setScale,w,M).selectAll(".points").selectAll(".point").call(o.setPointGroupScale,1/w,1/M),e.plot.selectAll(".points").selectAll(".textpoint").call(o.setTextPointsScale,1/w,1/M)}function f(){x=Date.now();for(var e=Math.min(1,(x-b)/r.duration),n=w(e),a=0;a<v.length;a++)h(v[a],n);x-b>r.duration?(!function(){for(var e={},r=0;r<g.length;r++){var n=t._fullLayout[m[g[r]].axisName],a=m[g[r]].to;e[n._name+".range[0]"]=a[0],e[n._name+".range[1]"]=a[1],n.range=a.slice()}y&&y(),i.relayout(t,e).then(function(){for(var t=0;t<v.length;t++)u(v[t])})}(),_=window.cancelAnimationFrame(f)):_=window.requestAnimationFrame(f)}var d=t._fullLayout,p=[],m=function(t){var e,r,n,i,a={};for(e in t)if((r=e.split("."))[0].match(l)){var o=e.charAt(0),s=r[0];if(n=d[s],i={},Array.isArray(t[e])?i.to=t[e].slice(0):Array.isArray(t[e].range)&&(i.to=t[e].range.slice(0)),!i.to)continue;i.axisName=s,i.length=n._length,p.push(o),a[o]=i}return a}(e),g=Object.keys(m),v=function(t,e,r){var n,i,a,o=t._plots,s=[];for(n in o){var l=o[n];if(-1===s.indexOf(l)){var c=l.xaxis._id,u=l.yaxis._id,h=l.xaxis.range,f=l.yaxis.range;l.xaxis._r=l.xaxis.range.slice(),l.yaxis._r=l.yaxis.range.slice(),i=r[c]?r[c].to:h,a=r[u]?r[u].to:f,h[0]===i[0]&&h[1]===i[1]&&f[0]===a[0]&&f[1]===a[1]||-1===e.indexOf(c)&&-1===e.indexOf(u)||s.push(l)}}return s}(d,g,m);if(!v.length)return function(){function e(e,r,n){for(var i=0;i<e.length;i++)if(r(t,i),n)return}e(d.annotations||[],a.getComponentMethod("annotations","drawOne")),e(d.shapes||[],a.getComponentMethod("shapes","drawOne")),e(d.images||[],a.getComponentMethod("images","draw"),!0)}(),!1;var y;c&&(y=c());var b,x,_,w=n.ease(r.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(_),_=null,function(){for(var e={},r=0;r<g.length;r++){var n=t._fullLayout[g[r]+"axis"];e[n._name+".range[0]"]=n.range[0],e[n._name+".range[1]"]=n.range[1],n.range=n._r.slice()}return i.relayout(t,e).then(function(){for(var t=0;t<v.length;t++)u(v[t])})}()}),b=Date.now(),_=window.requestAnimationFrame(f),Promise.resolve()}},{"../../components/drawing":638,"../../plotly":780,"../../registry":861,"./axes":785,"./constants":790,d3:123}],808:[function(t,e,r){"use strict";function n(t,e){if("-"===t.type){var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var l=function(t,e,r){for(var n=0;n<t.length;n++){var i=t[n];if((i[r+"axis"]||r)===e){if(a(i,r))return i;if((i[r]||[]).length||i[r+"0"])return i}}}(e,r,n);if(l)if("histogram"!==l.type||n!=={v:"y",h:"x"}[l.orientation||"v"]){var c=n+"calendar",u=l[c];if(a(l,n)){for(var h,f=i(l),d=[],p=0;p<e.length;p++)h=e[p],o.traceIs(h,"box-violin")&&(h[n+"axis"]||n)===r&&(void 0!==h[f]?d.push(h[f][0]):void 0!==h.name?d.push(h.name):d.push("text"),h[c]!==u&&(u=void 0));t.type=s(d,u)}else t.type=s(l[n]||[l[n+"0"]],u)}else t.type="linear"}}function i(t){return{v:"x",h:"y"}[t.orientation||"v"]}function a(t,e){var r=i(t),n=o.traceIs(t,"box-violin"),a=o.traceIs(t._fullInput||{},"candlestick");return n&&!a&&e===r&&void 0===t[r]&&void 0===t[r+"0"]}var o=t("../../registry"),s=t("./axis_autotype"),l=t("./axis_ids").name2id;e.exports=function(t,e,r,i,a){a&&(e._name=a,e._id=l(a));"-"===r("type")&&(n(e,i),"-"===e.type?e.type="linear":t.type=e.type)}},{"../../registry":861,"./axis_autotype":786,"./axis_ids":788}],809:[function(t,e,r){"use strict";function n(t,e,r){var n,i,a,o=!1;if("data"===e.type)n=t._fullData[null!==e.traces?e.traces[0]:0];else{if("layout"!==e.type)return!1;n=t._fullLayout}return i=l.nestedProperty(n,e.prop).get(),(a=r[e.type]=r[e.type]||{}).hasOwnProperty(e.prop)&&a[e.prop]!==i&&(o=!0),a[e.prop]=i,{changed:o,value:i}}function i(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!l.isPlainObject(n))return r;i=n}return o(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function a(t,e){var r,n,i,a,s=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!l.isPlainObject(n))return s;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),o(a,function(e,n,i){var a;if(Array.isArray(i)){var o=Math.min(i.length,t.data.length);r&&(o=Math.min(o,r.length)),a=[];for(var l=0;l<o;l++)a[l]=r?r[l]:l}else a=r?r.slice(0):null;if(null===a)Array.isArray(i)&&(i=i[0]);else if(Array.isArray(a)){if(!Array.isArray(i)){var c=i;i=[];for(var u=0;u<a.length;u++)i[u]=c}i.length=Math.min(a.length,i.length)}s.push({type:"data",prop:e,traces:a,value:i})},"",0),s}function o(t,e,r,n){Object.keys(t).forEach(function(i){var a=t[i];if("_"!==i[0]){var s=r+(n>0?".":"")+i;l.isPlainObject(a)?o(a,e,s,n+1):e(s,i,a)}})}var s=t("../plotly"),l=t("../lib");r.manageCommandObserver=function(t,e,i,a){var o={},s=!0;e&&e._commandObserver&&(o=e._commandObserver),o.cache||(o.cache={}),o.lookupTable={};var c=r.hasSimpleAPICommandBindings(t,i,o.lookupTable);if(e&&e._commandObserver){if(c)return o;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,o}if(c){n(t,c,o.cache),o.check=function(){if(s){var e=n(t,c,o.cache);return e.changed&&a&&void 0!==o.lookupTable[e.value]&&(o.disable(),Promise.resolve(a({value:e.value,type:c.type,prop:c.prop,traces:c.traces,index:o.lookupTable[e.value]})).then(o.enable,o.enable)),e.changed}};for(var u=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],h=0;h<u.length;h++)t._internalOn(u[h],o.check);o.remove=function(){for(var e=0;e<u.length;e++)t._removeInternalListener(u[e],o.check)}}else l.log("Unable to automatically bind plot updates to API command"),o.lookupTable={},o.remove=function(){};return o.disable=function(){s=!1},o.enable=function(){s=!0},e&&(e._commandObserver=o),o},r.hasSimpleAPICommandBindings=function(t,e,n){var i,a,o=e.length;for(i=0;i<o;i++){var s,l=e[i],c=l.method,u=l.args;if(Array.isArray(u)||(u=[]),!c)return!1;var h=r.computeAPICommandBindings(t,c,u);if(1!==h.length)return!1;if(a){if((s=h[0]).type!==a.type)return!1;if(s.prop!==a.prop)return!1;if(Array.isArray(a.traces)){if(!Array.isArray(s.traces))return!1;s.traces.sort();for(var f=0;f<a.traces.length;f++)if(a.traces[f]!==s.traces[f])return!1}else if(s.prop!==a.prop)return!1}else a=h[0],Array.isArray(a.traces)&&a.traces.sort();var d=(s=h[0]).value;if(Array.isArray(d)){if(1!==d.length)return!1;d=d[0]}n&&(n[d]=i)}return a},r.executeAPICommand=function(t,e,r){if("skip"===e)return Promise.resolve();var n=s[e],i=[t];Array.isArray(r)||(r=[]);for(var a=0;a<r.length;a++)i.push(r[a]);return n.apply(null,i).catch(function(t){return l.warn("API call to Plotly."+e+" rejected.",t),Promise.reject(t)})},r.computeAPICommandBindings=function(t,e,r){var n;switch(Array.isArray(r)||(r=[]),e){case"restyle":n=a(t,r);break;case"relayout":n=i(0,r);break;case"update":n=a(t,[r[0],r[2]]).concat(i(0,[r[1]]));break;case"animate":n=function(t,e){return Array.isArray(e[0])&&1===e[0].length&&-1!==["string","number"].indexOf(typeof e[0][0])?[{type:"layout",prop:"_currentFrame",value:e[0][0].toString()}]:[]}(0,r);break;default:n=[]}return n}},{"../lib":738,"../plotly":780}],810:[function(t,e,r){"use strict";e.exports=function(t){var e=t.editType,r=t.colorEditType;void 0===r&&(r=e);var n={family:{valType:"string",noBlank:!0,strict:!0,editType:e},size:{valType:"number",min:1,editType:e},color:{valType:"color",editType:r},editType:e};return t.arrayOk&&(n.family.arrayOk=!0,n.size.arrayOk=!0,n.color.arrayOk=!0),n}},{}],811:[function(t,e,r){"use strict";e.exports={_isLinkedToArray:"frames_entry",group:{valType:"string"},name:{valType:"string"},traces:{valType:"any"},baseframe:{valType:"string"},data:{valType:"any"},layout:{valType:"any"}}},{}],812:[function(t,e,r){"use strict";r.projNames={equirectangular:"equirectangular",mercator:"mercator",orthographic:"orthographic","natural earth":"naturalEarth",kavrayskiy7:"kavrayskiy7",miller:"miller",robinson:"robinson",eckert4:"eckert4","azimuthal equal area":"azimuthalEqualArea","azimuthal equidistant":"azimuthalEquidistant","conic equal area":"conicEqualArea","conic conformal":"conicConformal","conic equidistant":"conicEquidistant",gnomonic:"gnomonic",stereographic:"stereographic",mollweide:"mollweide",hammer:"hammer","transverse mercator":"transverseMercator","albers usa":"albersUsa","winkel tripel":"winkel3",aitoff:"aitoff",sinusoidal:"sinusoidal"},r.axesNames=["lonaxis","lataxis"],r.lonaxisSpan={orthographic:180,"azimuthal equal area":360,"azimuthal equidistant":360,"conic conformal":180,gnomonic:160,stereographic:180,"transverse mercator":180,"*":360},r.lataxisSpan={"conic conformal":150,stereographic:179.5,"*":180},r.scopeDefaults={world:{lonaxisRange:[-180,180],lataxisRange:[-90,90],projType:"equirectangular",projRotate:[0,0,0]},usa:{lonaxisRange:[-180,-50],lataxisRange:[15,80],projType:"albers usa"},europe:{lonaxisRange:[-30,60],lataxisRange:[30,85],projType:"conic conformal",projRotate:[15,0,0],projParallels:[0,60]},asia:{lonaxisRange:[22,160],lataxisRange:[-15,55],projType:"mercator",projRotate:[0,0,0]},africa:{lonaxisRange:[-30,60],lataxisRange:[-40,40],projType:"mercator",projRotate:[0,0,0]},"north america":{lonaxisRange:[-180,-45],lataxisRange:[5,85],projType:"conic conformal",projRotate:[-100,0,0],projParallels:[29.5,45.5]},"south america":{lonaxisRange:[-100,-30],lataxisRange:[-60,15],projType:"mercator",projRotate:[0,0,0]}},r.clipPad=.001,r.precision=.1,r.landColor="#F0DC82",r.waterColor="#3399FF",r.locationmodeToLayer={"ISO-3":"countries","USA-states":"subunits","country names":"countries"},r.sphereSVG={type:"Sphere"},r.fillLayers={ocean:1,land:1,lakes:1},r.lineLayers={subunits:1,countries:1,coastlines:1,rivers:1,frame:1},r.layers=["bg","ocean","land","lakes","subunits","countries","coastlines","rivers","lataxis","lonaxis","frame","backplot","frontplot"],r.layersForChoropleth=["bg","ocean","land","subunits","countries","coastlines","lataxis","lonaxis","frame","backplot","rivers","lakes","frontplot"],r.layerNameToAdjective={ocean:"ocean",land:"land",lakes:"lake",subunits:"subunit",countries:"country",coastlines:"coastline",rivers:"river",frame:"frame"}},{}],813:[function(t,e,r){"use strict";function n(t){this.id=t.id,this.graphDiv=t.graphDiv,this.container=t.container,this.topojsonURL=t.topojsonURL,this.isStatic=t.staticPlot,this.topojsonName=null,this.topojson=null,this.projection=null,this.viewInitial=null,this.fitScale=null,this.bounds=null,this.midPt=null,this.hasChoropleth=!1,this.traceHash={},this.layers={},this.basePaths={},this.dataPaths={},this.dataPoints={},this.clipDef=null,this.clipRect=null,this.bgRect=null,this.makeFramework()}var i=t("d3"),a=t("../../plotly"),o=t("../../lib"),s=t("../../components/color"),l=t("../../components/drawing"),c=t("../../components/fx"),u=t("../plots"),h=t("../cartesian/axes"),f=t("../../components/dragelement"),d=t("../cartesian/select"),p=t("./zoom"),m=t("./constants"),g=t("../../lib/topojson_utils"),v=t("topojson-client").feature;t("./projections")(i);var y=n.prototype;e.exports=function(t){return new n(t)},y.plot=function(t,e,r){var n=this,i=e[this.id],a=g.getTopojsonName(i);null===n.topojson||a!==n.topojsonName?(n.topojsonName=a,void 0===PlotlyGeoAssets.topojson[n.topojsonName]?r.push(n.fetchTopojson().then(function(r){PlotlyGeoAssets.topojson[n.topojsonName]=r,n.topojson=r,n.update(t,e)})):(n.topojson=PlotlyGeoAssets.topojson[n.topojsonName],n.update(t,e))):n.update(t,e)},y.fetchTopojson=function(){var t=g.getTopojsonPath(this.topojsonURL,this.topojsonName);return new Promise(function(e,r){i.json(t,function(n,i){if(n)return 404===n.status?r(new Error(["plotly.js could not find topojson file at",t,".","Make sure the *topojsonURL* plot config option","is set properly."].join(" "))):r(new Error(["unexpected error while fetching topojson file at",t].join(" ")));e(i)})})},y.update=function(t,e){var r=e[this.id];if(!this.updateProjection(e,r)){this.hasChoropleth=!1;for(var n=0;n<t.length;n++)if("choropleth"===t[n][0].trace.type){this.hasChoropleth=!0;break}this.viewInitial||this.saveViewInitial(r),this.updateBaseLayers(e,r),this.updateDims(e,r),this.updateFx(e,r),u.generalUpdatePerTraceModule(this,t,r);var i=this.layers.frontplot.select(".scatterlayer");this.dataPoints.point=i.selectAll(".point"),this.dataPoints.text=i.selectAll("text"),this.dataPaths.line=i.selectAll(".js-line");var a=this.layers.backplot.select(".choroplethlayer");this.dataPaths.choropleth=a.selectAll("path"),this.render()}},y.updateProjection=function(t,e){var r=t._size,n=e.domain,s=e.projection,l=s.rotation||{},c=e.center||{},u=this.projection=function(t){for(var e=t.projection.type,r=i.geo[m.projNames[e]](),n=t._isClipped?m.lonaxisSpan[e]/2:null,a=["center","rotate","parallels","clipExtent"],o=function(t){return t?r:[]},s=0;s<a.length;s++){var l=a[s];"function"!=typeof r[l]&&(r[l]=o)}return r.isLonLatOverEdges=function(t){if(null===r(t))return!0;if(n){var e=r.rotate();return i.geo.distance(t,[-e[0],-e[1]])>n*Math.PI/180}return!1},r.getPath=function(){return i.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(m.precision),n&&r.clipAngle(n-m.clipPad),r}(e);u.center([c.lon-l.lon,c.lat-l.lat]).rotate([-l.lon,-l.lat,l.roll]).parallels(s.parallels);var h=[[r.l+r.w*n.x[0],r.t+r.h*(1-n.y[1])],[r.l+r.w*n.x[1],r.t+r.h*(1-n.y[0])]],f=e.lonaxis,d=e.lataxis,p=function(t,e){var r=m.clipPad,n=t[0]+r,i=t[1]-r,a=e[0]+r,o=e[1]-r;n>0&&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]]]}}(f.range,d.range);u.fitExtent(h,p);var g=this.bounds=u.getBounds(p),v=this.fitScale=u.scale(),y=u.translate();if(!isFinite(g[0][0])||!isFinite(g[0][1])||!isFinite(g[1][0])||!isFinite(g[1][1])||isNaN(y[0])||isNaN(y[0])){for(var b=this.graphDiv,x=["projection.rotation","center","lonaxis.range","lataxis.range"],_="Invalid geo settings, relayout'ing to default view.",w={},M=0;M<x.length;M++)w[this.id+"."+x[M]]=null;return this.viewInitial=null,o.warn(_),b._promises.push(a.relayout(b,w)),_}var k=this.midPt=[(g[0][0]+g[1][0])/2,(g[0][1]+g[1][1])/2];if(u.scale(s.scale*v).translate([y[0]+(k[0]-y[0]),y[1]+(k[1]-y[1])]).clipExtent(g),e._isAlbersUsa){var T=u([c.lon,c.lat]),A=u.translate();u.translate([A[0]-(T[0]-A[0]),A[1]-(T[1]-A[1])])}},y.updateBaseLayers=function(t,e){function r(t){return"lonaxis"===t||"lataxis"===t}function n(t){return Boolean(m.lineLayers[t])}function a(t){return Boolean(m.fillLayers[t])}var o=this,c=o.topojson,u=o.layers,h=o.basePaths,f=(this.hasChoropleth?m.layersForChoropleth:m.layers).filter(function(t){return n(t)||a(t)?e["show"+t]:!r(t)||e[t].showgrid}),d=o.framework.selectAll(".layer").data(f,String);d.exit().each(function(t){delete u[t],delete h[t],i.select(this).remove()}),d.enter().append("g").attr("class",function(t){return"layer "+t}).each(function(t){var e=u[t]=i.select(this);"bg"===t?o.bgRect=e.append("rect").style("pointer-events","all"):r(t)?h[t]=e.append("path").style("fill","none"):"backplot"===t?e.append("g").classed("choroplethlayer",!0):"frontplot"===t?e.append("g").classed("scatterlayer",!0):n(t)?h[t]=e.append("path").style("fill","none").style("stroke-miterlimit",2):a(t)&&(h[t]=e.append("path").style("stroke","none"))}),d.order(),d.each(function(t){var o=h[t],u=m.layerNameToAdjective[t];"frame"===t?o.datum(m.sphereSVG):n(t)||a(t)?o.datum(v(c,c.objects[t])):r(t)&&o.datum(function(t,e){var r=e[t].dtick,n=m.scopeDefaults[e.scope],a=n.lonaxisRange,o=n.lataxisRange,s="lonaxis"===t?[r]:[0,r];return i.geo.graticule().extent([[a[0],o[0]],[a[1],o[1]]]).step(s)}(t,e)).call(s.stroke,e[t].gridcolor).call(l.dashLine,"",e[t].gridwidth),n(t)?o.call(s.stroke,e[u+"color"]).call(l.dashLine,"",e[u+"width"]):a(t)&&o.call(s.fill,e[u+"color"])})},y.updateDims=function(t,e){var r=this.bounds,n=(e.framewidth||0)/2,i=r[0][0]-n,a=r[0][1]-n,o=r[1][0]-i+n,c=r[1][1]-a+n;l.setRect(this.clipRect,i,a,o,c),this.bgRect.call(l.setRect,i,a,o,c).call(s.fill,e.bgcolor),this.xaxis._offset=i,this.xaxis._length=o,this.yaxis._offset=a,this.yaxis._length=c},y.updateFx=function(t,e){function r(){var t=o.viewInitial,e={};for(var r in t)e[o.id+"."+r]=t[r];a.relayout(s,e),s.emit("plotly_doubleclick",null)}function n(t){return o.projection.invert([t[0]+o.xaxis._offset,t[1]+o.yaxis._offset])}var o=this,s=o.graphDiv,l=o.bgRect,u=t.dragmode;if(!o.isStatic){if("pan"===u)l.node().onmousedown=null,l.call(p(o,e)),l.on("dblclick.zoom",r);else if("select"===u||"lasso"===u){l.on(".zoom",null);var h;"select"===u?h=function(t,e){(t.range={})[o.id]=[n([e.xmin,e.ymin]),n([e.xmax,e.ymax])]}:"lasso"===u&&(h=function(t,e,r){(t.lassoPoints={})[o.id]=r.filtered.map(n)});var m={element:o.bgRect.node(),gd:s,plotinfo:{xaxis:o.xaxis,yaxis:o.yaxis,fillRangeItems:h},xaxes:[o.xaxis],yaxes:[o.yaxis],subplot:o.id,clickFn:function(e){2===e&&t._zoomlayer.selectAll(".select-outline").remove()}};m.prepFn=function(t,e,r){d(t,e,r,m,u)},f.init(m)}l.on("mousemove",function(){var t=o.projection.invert(i.mouse(this));if(!t||isNaN(t[0])||isNaN(t[1]))return f.unhover(s,i.event);o.xaxis.p2c=function(){return t[0]},o.yaxis.p2c=function(){return t[1]},c.hover(s,i.event,o.id)}),l.on("mouseout",function(){f.unhover(s,i.event)}),l.on("click",function(){c.click(s,i.event)})}},y.makeFramework=function(){var t=this,e=t.graphDiv._fullLayout,r="clip"+e._uid+t.id;t.clipDef=e._clips.append("clipPath").attr("id",r),t.clipRect=t.clipDef.append("rect"),t.framework=i.select(t.container).append("g").attr("class","geo "+t.id).call(l.setClipUrl,r),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"},h.setConvert(t.mockAxis,e)},y.saveViewInitial=function(t){var e=t.center||{},r=t.projection,n=r.rotation||{};t._isScoped?this.viewInitial={"center.lon":e.lon,"center.lat":e.lat,"projection.scale":r.scale}:t._isClipped?this.viewInitial={"projection.scale":r.scale,"projection.rotation.lon":n.lon,"projection.rotation.lat":n.lat}:this.viewInitial={"center.lon":e.lon,"center.lat":e.lat,"projection.scale":r.scale,"projection.rotation.lon":n.lon}},y.render=function(){function t(t){var e=n(t.lonlat);return e?"translate("+e[0]+","+e[1]+")":null}function e(t){return n.isLonLatOverEdges(t.lonlat)?"none":null}var r,n=this.projection,i=n.getPath();for(r in this.basePaths)this.basePaths[r].attr("d",i);for(r in this.dataPaths)this.dataPaths[r].attr("d",function(t){return i(t.geojson)});for(r in this.dataPoints)this.dataPoints[r].attr("display",e).attr("transform",t)}},{"../../components/color":613,"../../components/dragelement":635,"../../components/drawing":638,"../../components/fx":655,"../../lib":738,"../../lib/topojson_utils":764,"../../plotly":780,"../cartesian/axes":785,"../cartesian/select":802,"../plots":846,"./constants":812,"./projections":818,"./zoom":819,d3:123,"topojson-client":545}],814:[function(t,e,r){"use strict";var n=t("./geo"),i=t("../../plots/get_data").getSubplotCalcData,a=t("../../lib").counterRegex;r.name="geo",r.attr="geo",r.idRoot="geo",r.idRegex=r.attrRegex=a("geo"),r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){var e=t._fullLayout,r=t.calcdata,a=e._subplots.geo;void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var o=0;o<a.length;o++){var s=a[o],l=i(r,"geo",s),c=e[s]._subplot;c||(c=n({id:s,graphDiv:t,container:e._geolayer.node(),topojsonURL:t._context.topojsonURL,staticPlot:t._context.staticPlot}),e[s]._subplot=c),c.plot(l,e,t._promises)}},r.clean=function(t,e,r,n){for(var i=n._subplots.geo||[],a=0;a<i.length;a++){var o=i[a],s=n[o]._subplot;!e[o]&&s&&(s.framework.remove(),s.clipDef.remove())}},r.updateFx=function(t){for(var e=t._subplots.geo,r=0;r<e.length;r++){var n=t[e[r]];n._subplot.updateFx(t,n)}}},{"../../lib":738,"../../plots/get_data":820,"./geo":813,"./layout/attributes":815,"./layout/defaults":816,"./layout/layout_attributes":817}],815:[function(t,e,r){"use strict";e.exports={geo:{valType:"subplotid",dflt:"geo",editType:"calc"}}},{}],816:[function(t,e,r){"use strict";function n(t,e,r){var n=r("resolution"),i=r("scope"),o=a.scopeDefaults[i],l=r("projection.type",o.projType),c=e._isAlbersUsa="albers usa"===l;c&&(i=e.scope="usa");var u=e._isScoped="world"!==i,h=e._isConic=-1!==l.indexOf("conic");e._isClipped=!!a.lonaxisSpan[l];for(var f=0;f<s.length;f++){var d,p=s[f],m=[30,10][f];if(u)d=o[p+"Range"];else{var g=a[p+"Span"],v=(g[l]||g["*"])/2,y=r("projection.rotation."+p.substr(0,3),o.projRotate[f]);d=[y-v,y+v]}r(p+".tick0",r(p+".range",d)[0]),r(p+".dtick",m),r(p+".showgrid")&&(r(p+".gridcolor"),r(p+".gridwidth"))}var b=e.lonaxis.range,x=e.lataxis.range,_=b[0],w=b[1];_>0&&w<0&&(w+=360);var M,k=(_+w)/2;if(!c){var T=u?o.projRotate:[k,0,0];M=r("projection.rotation.lon",T[0]),r("projection.rotation.lat",T[1]),r("projection.rotation.roll",T[2]),r("showcoastlines",!u)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean")&&r("oceancolor")}var A,S;if(c?(A=-96.6,S=38.7):(A=u?k:M,S=(x[0]+x[1])/2),r("center.lon",A),r("center.lat",S),h){r("projection.parallels",o.projParallels||[0,60])}r("projection.scale"),r("showland")&&r("landcolor"),r("showlakes")&&r("lakecolor"),r("showrivers")&&(r("rivercolor"),r("riverwidth")),r("showcountries",u&&"usa"!==i)&&(r("countrycolor"),r("countrywidth")),("usa"===i||"north america"===i&&50===n)&&(r("showsubunits",!0),r("subunitcolor"),r("subunitwidth")),u||r("showframe",!0)&&(r("framecolor"),r("framewidth")),r("bgcolor")}var i=t("../../subplot_defaults"),a=t("../constants"),o=t("./layout_attributes"),s=a.axesNames;e.exports=function(t,e,r){i(t,e,r,{type:"geo",attributes:o,handleDefaults:n,partition:"y"})}},{"../../subplot_defaults":853,"../constants":812,"./layout_attributes":817}],817:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../constants"),a=t("../../../plot_api/edit_types").overrideAll,o={range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},showgrid:{valType:"boolean",dflt:!1},tick0:{valType:"number"},dtick:{valType:"number"},gridcolor:{valType:"color",dflt:n.lightLine},gridwidth:{valType:"number",min:0,dflt:1}};e.exports=a({domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:!0},scope:{valType:"enumerated",values:Object.keys(i.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:Object.keys(i.projNames)},rotation:{lon:{valType:"number"},lat:{valType:"number"},roll:{valType:"number"}},parallels:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},scale:{valType:"number",min:0,dflt:1}},center:{lon:{valType:"number"},lat:{valType:"number"}},showcoastlines:{valType:"boolean"},coastlinecolor:{valType:"color",dflt:n.defaultLine},coastlinewidth:{valType:"number",min:0,dflt:1},showland:{valType:"boolean",dflt:!1},landcolor:{valType:"color",dflt:i.landColor},showocean:{valType:"boolean",dflt:!1},oceancolor:{valType:"color",dflt:i.waterColor},showlakes:{valType:"boolean",dflt:!1},lakecolor:{valType:"color",dflt:i.waterColor},showrivers:{valType:"boolean",dflt:!1},rivercolor:{valType:"color",dflt:i.waterColor},riverwidth:{valType:"number",min:0,dflt:1},showcountries:{valType:"boolean"},countrycolor:{valType:"color",dflt:n.defaultLine},countrywidth:{valType:"number",min:0,dflt:1},showsubunits:{valType:"boolean"},subunitcolor:{valType:"color",dflt:n.defaultLine},subunitwidth:{valType:"number",min:0,dflt:1},showframe:{valType:"boolean"},framecolor:{valType:"color",dflt:n.defaultLine},framewidth:{valType:"number",min:0,dflt:1},bgcolor:{valType:"color",dflt:n.background},lonaxis:o,lataxis:o},"plot","from-root")},{"../../../components/color/attributes":612,"../../../plot_api/edit_types":769,"../constants":812}],818:[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(!M.hasOwnProperty(e.type))return null;var i=M[e.type];return t.geo.stream(e,n(i)),i.result()}function n(){}function i(t){return t>1?S:t<-1?-S:Math.asin(t)}function a(t){return t>1?0:t<-1?A:Math.acos(t)}function o(t,e){var r=(2+S)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>k;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(A*(4+A))*t*(1+Math.cos(e)),2*Math.sqrt(A/(4+A))*Math.sin(e)]}function s(t,e){function r(r,n){var i=P(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?P:e===1/0?l:(r.invert=function(r,n){var i=P.invert(r/t,n);return i[0]*=e,i},r)}function l(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function c(t,e){return[3*t/(2*A)*Math.sqrt(A*A/3-e*e),e]}function u(t,e){return[t,1.25*Math.log(Math.tan(A/4+.4*e))]}function h(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)>k&&--i>0);return e/2}}function f(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)))]}function d(t,e){var r,n=Math.min(18,36*Math.abs(e)/A),i=Math.floor(n),a=n-i,o=(r=z[i])[0],s=r[1],l=(r=z[++i])[0],c=r[1],u=(r=z[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(u-o)/2+a*a*(u-2*l+o)/2),(e>0?S:-S)*(c+a*(h-s)/2+a*a*(h-2*c+s)/2)]}function p(t,e){return[t*Math.cos(e),e]}function m(t,e){var r=Math.cos(e),n=function(t){return t?t/Math.sin(t):1}(a(r*Math.cos(t/=2)));return[2*r*Math.sin(t)*n,Math.sin(e)*n]}function g(t,e){var r=m(t,e);return[(r[0]+t/S)/2,(r[1]+e)/2]}t.geo.project=function(t,e){var n=e.stream;if(!n)throw new Error("not yet supported");return(t&&v.hasOwnProperty(t.type)?v[t.type]:r)(t,n)};var v={Feature:e,FeatureCollection:function(t,r){return{type:"FeatureCollection",features:t.features.map(function(t){return e(t,r)})}}},y=[],b=[],x={point:function(t,e){y.push([t,e])},result:function(){var t=y.length?y.length<2?{type:"Point",coordinates:y[0]}:{type:"MultiPoint",coordinates:y}:null;return y=[],t}},_={lineStart:n,point:function(t,e){y.push([t,e])},lineEnd:function(){y.length&&(b.push(y),y=[])},result:function(){var t=b.length?b.length<2?{type:"LineString",coordinates:b[0]}:{type:"MultiLineString",coordinates:b}:null;return b=[],t}},w={polygonStart:n,lineStart:n,point:function(t,e){y.push([t,e])},lineEnd:function(){var t=y.length;if(t){do{y.push(y[0].slice())}while(++t<4);b.push(y),y=[]}},polygonEnd:n,result:function(){if(!b.length)return null;var t=[],e=[];return b.forEach(function(r){!function(t){if((e=t.length)<4)return!1;for(var e,r=0,n=t[e-1][1]*t[0][0]-t[e-1][0]*t[0][1];++r<e;)n+=t[r-1][1]*t[r][0]-t[r-1][0]*t[r][1];return n<=0}(r)?e.push(r):t.push([r])}),e.forEach(function(e){var r=e[0];t.some(function(t){if(function(t,e){for(var r=e[0],n=e[1],i=!1,a=0,o=t.length,s=o-1;a<o;s=a++){var l=t[a],c=l[0],u=l[1],h=t[s],f=h[0],d=h[1];u>n^d>n&&r<(f-c)*(n-u)/(d-u)+c&&(i=!i)}return i}(t[0],r))return t.push(e),!0})||t.push([e])}),b=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},M={Point:x,MultiPoint:x,LineString:_,MultiLineString:_,Polygon:w,MultiPolygon:w,Sphere:w},k=1e-6,T=k*k,A=Math.PI,S=A/2,E=(Math.sqrt(A),A/180),L=180/A,C=t.geo.projection,I=t.geo.projectionMutator;t.geo.interrupt=function(e){function r(t,r){for(var n=r<0?-1:1,i=a[+(r<0)],o=0,s=i.length-1;o<s&&t>i[o][2][0];++o);var l=e(t-i[o][1][0],r);return l[0]+=e(i[o][1][0],n*r>n*i[o][0][1]?i[o][0][1]:r)[0],l}function n(t,e){for(var r,n,i,a=-1,o=t.length,s=t[0],l=[];++a<o;){n=((r=t[a])[0]-s[0])/e,i=(r[1]-s[1])/e;for(var c=0;c<e;++c)l.push([s[0]+c*n,s[1]+c*i]);s=r}return l.push(r),l}var i,a=[[[[-A,0],[0,S],[A,0]]],[[[-A,0],[0,-S],[A,0]]]];e.invert&&(r.invert=function(t,n){for(var o=i[+(n<0)],s=a[+(n<0)],l=0,c=o.length;l<c;++l){var u=o[l];if(u[0][0]<=t&&t<u[1][0]&&u[0][1]<=n&&n<u[1][1]){var h=e.invert(t-e(s[l][1][0],0)[0],n);return h[0]+=s[l][1][0],function(t,e){return Math.abs(t[0]-e[0])<k&&Math.abs(t[1]-e[1])<k}(r(h[0],h[1]),[t,n])?h:null}}});var o=t.geo.projection(r),s=o.stream;return o.stream=function(e){var r=o.rotate(),i=s(e),l=(o.rotate([0,0]),s(e));return o.rotate(r),i.sphere=function(){t.geo.stream(function(){for(var e=[],r=0,i=a[0].length;r<i;++r){var o=180*(h=a[0][r])[0][0]/A,s=180*h[0][1]/A,l=180*h[1][1]/A,c=180*h[2][0]/A,u=180*h[2][1]/A;e.push(n([[o+1e-6,s+1e-6],[o+1e-6,l-1e-6],[c-1e-6,l-1e-6],[c-1e-6,u+1e-6]],30))}for(r=a[1].length-1;r>=0;--r){var h;o=180*(h=a[1][r])[0][0]/A,s=180*h[0][1]/A,l=180*h[1][1]/A,c=180*h[2][0]/A,u=180*h[2][1]/A,e.push(n([[c-1e-6,u-1e-6],[c-1e-6,l+1e-6],[o+1e-6,l+1e-6],[o+1e-6,s-1e-6]],30))}return{type:"Polygon",coordinates:[t.merge(e)]}}(),l)},i},o.lobes=function(t){return arguments.length?(a=t.map(function(t){return t.map(function(t){return[[t[0][0]*A/180,t[0][1]*A/180],[t[1][0]*A/180,t[1][1]*A/180],[t[2][0]*A/180,t[2][1]*A/180]]})}),i=a.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]]})}),o):a.map(function(t){return t.map(function(t){return[[180*t[0][0]/A,180*t[0][1]/A],[180*t[1][0]/A,180*t[1][1]/A],[180*t[2][0]/A,180*t[2][1]/A]]})})},o},o.invert=function(t,e){var r=.5*e*Math.sqrt((4+A)/A),n=i(r),a=Math.cos(n);return[t/(2/Math.sqrt(A*(4+A))*(1+a)),i((n+r*(a+2))/(2+S))]},(t.geo.eckert4=function(){return C(o)}).raw=o;var P=t.geo.azimuthalEqualArea.raw;l.invert=function(t,e){var r=2*i(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(t.geo.hammer=function(){var t=2,e=I(s),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}).raw=s,c.invert=function(t,e){return[2/3*A*t/Math.sqrt(A*A/3-e*e),e]},(t.geo.kavrayskiy7=function(){return C(c)}).raw=c,u.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*A]},(t.geo.miller=function(){return C(u)}).raw=u,h(A);var D=function(t,e,r){function n(r,n){return[t*r*Math.cos(n=a(n)),e*Math.sin(n)]}var a=h(r);return n.invert=function(n,a){var o=i(a/e);return[n/(t*Math.cos(o)),i((2*o+Math.sin(2*o))/r)]},n}(Math.SQRT2/S,Math.SQRT2,A);(t.geo.mollweide=function(){return C(D)}).raw=D,f.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)>k&&--i>0);return[t/(.8707+(a=n*n)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return C(f)}).raw=f;var z=[[.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]];z.forEach(function(t){t[1]*=1.0144}),d.invert=function(t,e){var r=e/S,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=z[a][1],s=z[a+1][1],l=z[Math.min(19,a+2)][1],c=l-o,u=l-2*s+o,h=2*(Math.abs(r)-s)/c,f=u/c,d=h*(1-f*h*(1-2*f*h));if(d>=0||1===a){n=(e>=0?5:-5)*(d+i);var p,m=50;do{d=(i=Math.min(18,Math.abs(n)/5))-(a=Math.floor(i)),o=z[a][1],s=z[a+1][1],l=z[Math.min(19,a+2)][1],n-=(p=(e>=0?S:-S)*(s+d*(l-o)/2+d*d*(l-2*s+o)/2)-e)*L}while(Math.abs(p)>T&&--m>0);break}}while(--a>=0);var g=z[a][0],v=z[a+1][0],y=z[Math.min(19,a+2)][0];return[t/(v+d*(y-g)/2+d*d*(y-2*v+g)/2),n*E]},(t.geo.robinson=function(){return C(d)}).raw=d,p.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return C(p)}).raw=p,m.invert=function(t,e){if(!(t*t+4*e*e>A*A+k)){var r=t,n=e,i=25;do{var o,s=Math.sin(r),l=Math.sin(r/2),c=Math.cos(r/2),u=Math.sin(n),h=Math.cos(n),f=Math.sin(2*n),d=u*u,p=h*h,m=l*l,g=1-p*c*c,v=g?a(h*c)*Math.sqrt(o=1/g):o=0,y=2*v*h*l-t,b=v*u-e,x=o*(p*m+v*h*c*d),_=o*(.5*s*f-2*v*u*l),w=.25*o*(f*l-v*u*p*s),M=o*(d*c+v*m*h),T=_*w-M*x;if(!T)break;var S=(b*_-y*M)/T,E=(y*w-b*x)/T;r-=S,n-=E}while((Math.abs(S)>k||Math.abs(E)>k)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return C(m)}).raw=m,g.invert=function(t,e){var r=t,n=e,i=25;do{var o,s=Math.cos(n),l=Math.sin(n),c=Math.sin(2*n),u=l*l,h=s*s,f=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),m=p*p,g=1-h*d*d,v=g?a(s*d)*Math.sqrt(o=1/g):o=0,y=.5*(2*v*s*p+r/S)-t,b=.5*(v*l+n)-e,x=.5*o*(h*m+v*s*d*u)+.5/S,_=o*(f*c/4-v*l*p),w=.125*o*(c*p-v*l*h*f),M=.5*o*(u*d+v*m*s)+.5,T=_*w-M*x,A=(b*_-y*M)/T,E=(y*w-b*x)/T;r-=A,n-=E}while((Math.abs(A)>k||Math.abs(E)>k)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return C(g)}).raw=g}},{}],819:[function(t,e,r){"use strict";function n(t,e){return d.behavior.zoom().translate(e.translate()).scale(e.scale())}function i(t,e,r){function n(t,e){var r=p.nestedProperty(s,t);r.get()!==e&&(r.set(e),p.nestedProperty(o,t).set(e),l[i+"."+t]=e)}var i=t.id,a=t.graphDiv,o=a.layout[i],s=a._fullLayout[i],l={};r(n),n("projection.scale",e.scale()/t.fitScale),a.emit("plotly_relayout",l)}function a(t,e){function r(r){var n=e.invert(t.midPt);r("center.lon",n[0]),r("center.lat",n[1])}var a=n(0,e);return a.on("zoomstart",function(){d.select(this).style(v)}).on("zoom",function(){e.scale(d.event.scale).translate(d.event.translate),t.render()}).on("zoomend",function(){d.select(this).style(y),i(t,e,r)}),a}function o(t,e){function r(t){return e.invert(t)}function a(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])}var o,s,l,c,u,h,f,p,m=n(0,e),g=2;return m.on("zoomstart",function(){d.select(this).style(v),o=d.mouse(this),s=e.rotate(),l=e.translate(),c=s,u=r(o)}).on("zoom",function(){if(h=d.mouse(this),function(t){var n=e(r(t));return Math.abs(n[0]-t[0])>g||Math.abs(n[1]-t[1])>g}(o))return m.scale(e.scale()),void m.translate(e.translate());e.scale(d.event.scale),e.translate([l[0],d.event.translate[1]]),u?r(h)&&(p=r(h),f=[c[0]+(p[0]-u[0]),s[1],s[2]],e.rotate(f),c=f):u=r(o=h),t.render()}).on("zoomend",function(){d.select(this).style(y),i(t,e,a)}),m}function s(t,e){function r(t){var r=e.rotate();t("projection.rotation.lon",-r[0]),t("projection.rotation.lat",-r[1])}var a,o={r:e.rotate(),k:e.scale()},s=n(0,e),u=function(t){var e=0,r=arguments.length,n=[];for(;++e<r;)n.push(arguments[e]);var i=d.dispatch.apply(null,n);return i.of=function(e,r){return function(n){var a;try{a=n.sourceEvent=d.event,n.target=t,d.event=n,i[n.type].apply(e,r)}finally{d.event=a}}},i}(s,"zoomstart","zoom","zoomend"),p=0,b=s.on;return s.on("zoomstart",function(){d.select(this).style(v);var t=d.mouse(this),r=e.rotate(),n=r,i=e.translate(),y=function(t){var e=.5*t[0]*m,r=.5*t[1]*m,n=.5*t[2]*m,i=Math.sin(e),a=Math.cos(e),o=Math.sin(r),s=Math.cos(r),l=Math.sin(n),c=Math.cos(n);return[a*s*c+i*o*l,i*s*c-a*o*l,a*o*c+i*s*l,a*s*l-i*o*c]}(r);a=l(e,t),b.call(s,"zoom",function(){var s=d.mouse(this);if(e.scale(o.k=d.event.scale),a){if(l(e,s)){e.rotate(r).translate(i);var p=l(e,s),m=function(t,e){if(!t||!e)return;var r=function(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]]}(t,e),n=Math.sqrt(f(r,r)),i=.5*Math.acos(Math.max(-1,Math.min(1,f(t,e)))),a=Math.sin(i)/n;return n&&[Math.cos(i),r[2]*a,-r[1]*a,r[0]*a]}(a,p),v=function(t){return[Math.atan2(2*(t[0]*t[1]+t[2]*t[3]),1-2*(t[1]*t[1]+t[2]*t[2]))*g,Math.asin(Math.max(-1,Math.min(1,2*(t[0]*t[2]-t[3]*t[1]))))*g,Math.atan2(2*(t[0]*t[3]+t[1]*t[2]),1-2*(t[2]*t[2]+t[3]*t[3]))*g]}(function(t,e){var r=t[0],n=t[1],i=t[2],a=t[3],o=e[0],s=e[1],l=e[2],c=e[3];return[r*o-n*s-i*l-a*c,r*s+n*o+i*c-a*l,r*l-n*c+i*o+a*s,r*c+n*l-i*s+a*o]}(y,m)),b=o.r=function(t,e,r){var n=h(e,2,t[0]);n=h(n=h(n,1,t[1]),0,t[2]-r[2]);var i,a,o=e[0],s=e[1],l=e[2],u=n[0],f=n[1],d=n[2],p=Math.atan2(s,o)*g,m=Math.sqrt(o*o+s*s);Math.abs(f)>m?(a=(f>0?90:-90)-p,i=0):(a=Math.asin(f/m)*g-p,i=Math.sqrt(m*m-f*f));var v=180-a-2*p,y=(Math.atan2(d,u)-Math.atan2(l,i))*g,b=(Math.atan2(d,u)-Math.atan2(l,-i))*g,x=c(r[0],r[1],a,y),_=c(r[0],r[1],v,b);return x<=_?[a,y,r[2]]:[v,b,r[2]]}(v,a,n);isFinite(b[0])&&isFinite(b[1])&&isFinite(b[2])||(b=n),e.rotate(b),n=b}}else a=l(e,t=s);!function(t){t({type:"zoom"})}(u.of(this,arguments))}),function(t){p++||t({type:"zoomstart"})}(u.of(this,arguments))}).on("zoomend",function(){d.select(this).style(y),b.call(s,"zoom",null),function(t){--p||t({type:"zoomend"})}(u.of(this,arguments)),i(t,e,r)}).on("zoom.redraw",function(){t.render()}),d.rebind(s,u,"on")}function l(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&function(t){var e=t[0]*m,r=t[1]*m,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}(r)}function c(t,e,r,n){var i=u(r-t),a=u(n-e);return Math.sqrt(i*i+a*a)}function u(t){return(t%360+540)%360-180}function h(t,e,r){var n=r*m,i=t.slice(),a=0===e?1:0,o=2===e?1:2,s=Math.cos(n),l=Math.sin(n);return i[a]=t[a]*s-t[o]*l,i[o]=t[o]*s+t[a]*l,i}function f(t,e){for(var r=0,n=0,i=t.length;n<i;++n)r+=t[n]*e[n];return r}var d=t("d3"),p=t("../../lib"),m=Math.PI/180,g=180/Math.PI,v={cursor:"pointer"},y={cursor:"auto"};e.exports=function(t,e){var r=t.projection;return(e._isScoped?a:e._isClipped?s:o)(t,r)}},{"../../lib":738,d3:123}],820:[function(t,e,r){"use strict";var n=t("../registry"),i=t("./cartesian/constants").SUBPLOT_PATTERN;r.getSubplotCalcData=function(t,e,r){var i=n.subplotsRegistry[e];if(!i)return[];for(var a=i.attr,o=[],s=0;s<t.length;s++){var l=t[s];l[0].trace[a]===r&&o.push(l)}return o},r.getModuleCalcData=function(t,e){var r=[],i="string"==typeof e?n.getModule(e):e;if(!i)return r;for(var a=0;a<t.length;a++){var o=t[a],s=o[0].trace;s._module===i&&!0===s.visible&&r.push(o)}return r},r.getSubplotData=function(t,e,r){if(!n.subplotsRegistry[e])return[];var a,o,s,l=n.subplotsRegistry[e].attr,c=[];if("gl2d"===e){var u=r.match(i);o="x"+u[1],s="y"+u[2]}for(var h=0;h<t.length;h++)a=t[h],"gl2d"===e&&n.traceIs(a,"gl2d")?a[l[0]]===o&&a[l[1]]===s&&c.push(a):a[l]===r&&c.push(a);return c}},{"../registry":861,"./cartesian/constants":790}],821:[function(t,e,r){"use strict";var n=t("mouse-change"),i=t("mouse-wheel"),a=t("mouse-event-offset"),o=t("../cartesian/constants");e.exports=function(t){function e(){t.xaxis.autorange=!1,t.yaxis.autorange=!1}function r(r,n,i){function a(e,r,n){var i=Math.min(r,n),a=Math.max(r,n);i!==a?(h[e]=i,h[e+2]=a,c.dataBox=h,t.setRanges(h)):(t.selectBox.selectBox=[0,0,1,1],t.glplot.setDirty())}var s,u,h=t.calcDataBox(),f=l.viewBox,d=c.lastPos[0],p=c.lastPos[1],m=o.MINDRAG*l.pixelRatio,g=o.MINZOOM*l.pixelRatio;switch(n*=l.pixelRatio,i*=l.pixelRatio,i=f[3]-f[1]-i,t.fullLayout.dragmode){case"zoom":if(r){var v=n/(f[2]-f[0])*(h[2]-h[0])+h[0],y=i/(f[3]-f[1])*(h[3]-h[1])+h[1];c.boxInited||(c.boxStart[0]=v,c.boxStart[1]=y,c.dragStart[0]=n,c.dragStart[1]=i),c.boxEnd[0]=v,c.boxEnd[1]=y,c.boxInited=!0,c.boxEnabled||c.boxStart[0]===c.boxEnd[0]&&c.boxStart[1]===c.boxEnd[1]||(c.boxEnabled=!0);var b=Math.abs(c.dragStart[0]-n)<g,x=Math.abs(c.dragStart[1]-i)<g;if(!function(){for(var e=t.graphDiv._fullLayout._axisConstraintGroups,r=t.xaxis._id,n=t.yaxis._id,i=0;i<e.length;i++)if(-1!==e[i][r]){if(-1!==e[i][n])return!0;break}return!1}()||b&&x)b&&(c.boxEnd[0]=c.boxStart[0]),x&&(c.boxEnd[1]=c.boxStart[1]);else{s=c.boxEnd[0]-c.boxStart[0],u=c.boxEnd[1]-c.boxStart[1];var _=(h[3]-h[1])/(h[2]-h[0]);Math.abs(s*_)>Math.abs(u)?(c.boxEnd[1]=c.boxStart[1]+Math.abs(s)*_*(u>=0?1:-1),c.boxEnd[1]<h[1]?(c.boxEnd[1]=h[1],c.boxEnd[0]=c.boxStart[0]+(h[1]-c.boxStart[1])/Math.abs(_)):c.boxEnd[1]>h[3]&&(c.boxEnd[1]=h[3],c.boxEnd[0]=c.boxStart[0]+(h[3]-c.boxStart[1])/Math.abs(_))):(c.boxEnd[0]=c.boxStart[0]+Math.abs(u)/_*(s>=0?1:-1),c.boxEnd[0]<h[0]?(c.boxEnd[0]=h[0],c.boxEnd[1]=c.boxStart[1]+(h[0]-c.boxStart[0])*Math.abs(_)):c.boxEnd[0]>h[2]&&(c.boxEnd[0]=h[2],c.boxEnd[1]=c.boxStart[1]+(h[2]-c.boxStart[0])*Math.abs(_)))}}else c.boxEnabled?(s=c.boxStart[0]!==c.boxEnd[0],u=c.boxStart[1]!==c.boxEnd[1],s||u?(s&&(a(0,c.boxStart[0],c.boxEnd[0]),t.xaxis.autorange=!1),u&&(a(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,r?(c.panning||(c.dragStart[0]=n,c.dragStart[1]=i),Math.abs(c.dragStart[0]-n)<m&&(n=c.dragStart[0]),Math.abs(c.dragStart[1]-i)<m&&(i=c.dragStart[1]),s=(d-n)*(h[2]-h[0])/(l.viewBox[2]-l.viewBox[0]),u=(p-i)*(h[3]-h[1])/(l.viewBox[3]-l.viewBox[1]),h[0]+=s,h[2]+=s,h[1]+=u,h[3]+=u,t.setRanges(h),c.panning=!0,c.lastInputTime=Date.now(),e(),t.cameraChanged(),t.handleAnnotations()):c.panning&&(c.panning=!1,t.relayoutCallback())}c.lastPos[0]=n,c.lastPos[1]=i}var s=t.mouseContainer,l=t.glplot,c=new function(t,e){this.element=t,this.plot=e,this.mouseListener=null,this.wheelListener=null,this.lastInputTime=Date.now(),this.lastPos=[0,0],this.boxEnabled=!1,this.boxInited=!1,this.boxStart=[0,0],this.boxEnd=[0,0],this.dragStart=[0,0]}(s,l);return c.mouseListener=n(s,r),s.addEventListener("touchstart",function(t){var e=a(t.changedTouches[0],s);r(0,e[0],e[1]),r(1,e[0],e[1])}),s.addEventListener("touchmove",function(t){t.preventDefault();var e=a(t.changedTouches[0],s);r(1,e[0],e[1])}),s.addEventListener("touchend",function(){r(0,c.lastPos[0],c.lastPos[1])}),c.wheelListener=i(s,function(r,n){if(!t.scrollZoom)return!1;var i=t.calcDataBox(),a=l.viewBox,o=c.lastPos[0],s=c.lastPos[1],u=Math.exp(5*n/(a[3]-a[1])),h=o/(a[2]-a[0])*(i[2]-i[0])+i[0],f=s/(a[3]-a[1])*(i[3]-i[1])+i[1];return i[0]=(i[0]-h)*u+h,i[2]=(i[2]-h)*u+h,i[1]=(i[1]-f)*u+f,i[3]=(i[3]-f)*u+f,t.setRanges(i),c.lastInputTime=Date.now(),e(),t.cameraChanged(),t.handleAnnotations(),t.relayoutCallback(),!0}),c}},{"../cartesian/constants":790,"mouse-change":453,"mouse-event-offset":454,"mouse-wheel":456}],822:[function(t,e,r){"use strict";function n(t){this.scene=t,this.gl=t.gl,this.pixelRatio=t.pixelRatio,this.screenBox=[0,0,1,1],this.viewBox=[0,0,1,1],this.dataBox=[-1,-1,1,1],this.borderLineEnable=[!1,!1,!1,!1],this.borderLineWidth=[1,1,1,1],this.borderLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.ticks=[[],[]],this.tickEnable=[!0,!0,!1,!1],this.tickPad=[15,15,15,15],this.tickAngle=[0,0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickMarkLength=[0,0,0,0],this.tickMarkWidth=[0,0,0,0],this.tickMarkColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labels=["x","y"],this.labelEnable=[!0,!0,!1,!1],this.labelAngle=[0,Math.PI/2,0,3*Math.PI/2],this.labelPad=[15,15,15,15],this.labelSize=[12,12],this.labelFont=["sans-serif","sans-serif"],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.title="",this.titleEnable=!0,this.titleCenter=[0,0,0,0],this.titleAngle=0,this.titleColor=[0,0,0,1],this.titleFont="sans-serif",this.titleSize=18,this.gridLineEnable=[!0,!0],this.gridLineColor=[[0,0,0,.5],[0,0,0,.5]],this.gridLineWidth=[1,1],this.zeroLineEnable=[!0,!0],this.zeroLineWidth=[1,1],this.zeroLineColor=[[0,0,0,1],[0,0,0,1]],this.borderColor=!1,this.backgroundColor=[0,0,0,0],this.static=this.scene.staticPlot}var i=t("../cartesian/axes"),a=t("../../lib/html2unicode"),o=t("../../lib/str2rgbarray"),s=n.prototype,l=["xaxis","yaxis"];s.merge=function(t){this.titleEnable=!1,this.backgroundColor=o(t.plot_bgcolor);var e,r,n,i,s,c,u,h,f,d,p;for(d=0;d<2;++d){var m=(e=l[d]).charAt(0);for(n=(r=t[this.scene[e]._name]).title===this.scene.fullLayout._dfltTitle[m]?"":r.title,p=0;p<=2;p+=2)this.labelEnable[d+p]=!1,this.labels[d+p]=a(n),this.labelColor[d+p]=o(r.titlefont.color),this.labelFont[d+p]=r.titlefont.family,this.labelSize[d+p]=r.titlefont.size,this.labelPad[d+p]=this.getLabelPad(e,r),this.tickEnable[d+p]=!1,this.tickColor[d+p]=o((r.tickfont||{}).color),this.tickAngle[d+p]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[d+p]=this.getTickPad(r),this.tickMarkLength[d+p]=0,this.tickMarkWidth[d+p]=r.tickwidth||0,this.tickMarkColor[d+p]=o(r.tickcolor),this.borderLineEnable[d+p]=!1,this.borderLineColor[d+p]=o(r.linecolor),this.borderLineWidth[d+p]=r.linewidth||0;u=this.hasSharedAxis(r),s=this.hasAxisInDfltPos(e,r)&&!u,c=this.hasAxisInAltrPos(e,r)&&!u,i=r.mirror||!1,h=u?-1!==String(i).indexOf("all"):!!i,f=u?"allticks"===i:-1!==String(i).indexOf("ticks"),s?this.labelEnable[d]=!0:c&&(this.labelEnable[d+2]=!0),s?this.tickEnable[d]=r.showticklabels:c&&(this.tickEnable[d+2]=r.showticklabels),(s||h)&&(this.borderLineEnable[d]=r.showline),(c||h)&&(this.borderLineEnable[d+2]=r.showline),(s||f)&&(this.tickMarkLength[d]=this.getTickMarkLength(r)),(c||f)&&(this.tickMarkLength[d+2]=this.getTickMarkLength(r)),this.gridLineEnable[d]=r.showgrid,this.gridLineColor[d]=o(r.gridcolor),this.gridLineWidth[d]=r.gridwidth,this.zeroLineEnable[d]=r.zeroline,this.zeroLineColor[d]=o(r.zerolinecolor),this.zeroLineWidth[d]=r.zerolinewidth}},s.hasSharedAxis=function(t){var e=this.scene,r=e.fullLayout._subplots.gl2d;return 0!==i.findSubplotsWithAxis(r,t).indexOf(e.id)},s.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},s.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},s.getLabelPad=function(t,e){var r=e.titlefont.size,n=e.showticklabels;return"xaxis"===t?"top"===e.side?r*(1.5+(n?1:0))-10:r*(1.5+(n?.5:0))-10:"yaxis"===t?"right"===e.side?10+r*(1.5+(n?1:.5)):10+r*(1.5+(n?.5:0)):void 0},s.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},s.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e},e.exports=function(t){return new n(t)}},{"../../lib/html2unicode":736,"../../lib/str2rgbarray":760,"../cartesian/axes":785}],823:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("./scene2d"),a=t("../layout_attributes"),o=t("../../constants/xmlns_namespaces"),s=t("../cartesian/constants"),l=t("../cartesian"),c=t("../../components/fx/layout_attributes"),u=t("../get_data").getSubplotData;r.name="gl2d",r.attr=["xaxis","yaxis"],r.idRoot=["x","y"],r.idRegex=s.idRegex,r.attrRegex=s.attrRegex,r.attributes=t("../cartesian/attributes"),r.supplyLayoutDefaults=function(t,e,r){e._has("cartesian")||l.supplyLayoutDefaults(t,e,r)},r.layoutAttrOverrides=n(l.layoutAttributes,"plot","from-root"),r.baseLayoutAttrOverrides=n({plot_bgcolor:a.plot_bgcolor,hoverlabel:c.hoverlabel},"plot","nested"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=e._subplots.gl2d,a=0;a<n.length;a++){var o=n[a],s=e._plots[o],l=u(r,"gl2d",o),c=s._scene2d;void 0===c&&(c=new i({id:o,graphDiv:t,container:t.querySelector(".gl-container"),staticPlot:t._context.staticPlot,plotGlPixelRatio:t._context.plotGlPixelRatio},e),s._scene2d=c),c.plot(l,t.calcdata,e,t.layout)}},r.clean=function(t,e,r,n){for(var i=n._subplots.gl2d||[],a=0;a<i.length;a++){var o=i[a],s=n._plots[o];if(s._scene2d){0===u(t,"gl2d",o).length&&(s._scene2d.destroy(),delete n._plots[o])}}l.clean.apply(this,arguments)},r.drawFramework=function(t){t._context.staticPlot||l.drawFramework(t)},r.toSVG=function(t){for(var e=t._fullLayout,r=e._subplots.gl2d,n=0;n<r.length;n++){var i=e._plots[r[n]]._scene2d,a=i.toImage("png");e._glimages.append("svg:image").attr({xmlns:o.svg,"xlink:href":a,x:0,y:0,width:"100%",height:"100%",preserveAspectRatio:"none"}),i.destroy()}},r.updateFx=function(t){for(var e=t._subplots.gl2d,r=0;r<e.length;r++){t._plots[e[r]]._scene2d.updateFx(t.dragmode)}}},{"../../components/fx/layout_attributes":656,"../../constants/xmlns_namespaces":719,"../../plot_api/edit_types":769,"../cartesian":796,"../cartesian/attributes":784,"../cartesian/constants":790,"../get_data":820,"../layout_attributes":837,"./scene2d":824}],824:[function(t,e,r){"use strict";function n(t,e){this.container=t.container,this.graphDiv=t.graphDiv,this.pixelRatio=t.plotGlPixelRatio||window.devicePixelRatio,this.id=t.id,this.staticPlot=!!t.staticPlot,this.scrollZoom=this.graphDiv._context.scrollZoom,this.fullData=null,this.updateRefs(e),this.makeFramework(),this.glplotOptions=d(this),this.glplotOptions.merge(e),this.glplot=c(this.glplotOptions),this.camera=p(this),this.traces={},this.spikes=u(this.glplot),this.selectBox=h(this.glplot,{innerFill:!1,outerFill:!0}),this.lastButtonState=0,this.pickResult=null,this.isMouseOver=!0,this.bounds=[1/0,1/0,-1/0,-1/0],this.stopped=!1,this.redraw=this.draw.bind(this),this.redraw()}var i,a,o=t("../../registry"),s=t("../../plots/cartesian/axes"),l=t("../../components/fx"),c=t("gl-plot2d"),u=t("gl-spikes2d"),h=t("gl-select-box"),f=t("webgl-context"),d=t("./convert"),p=t("./camera"),m=t("../../lib/html2unicode"),g=t("../../lib/show_no_webgl_msg"),v=t("../cartesian/constraints"),y=v.enforce,b=v.clean,x=["xaxis","yaxis"],_=t("../cartesian/constants").SUBPLOT_PATTERN;e.exports=n;var w=n.prototype;w.makeFramework=function(){if(this.staticPlot){if(!(a||(i=document.createElement("canvas"),a=f({canvas:i,preserveDrawingBuffer:!1,premultipliedAlpha:!0,antialias:!0}))))throw new Error("Error creating static canvas/context for image server");this.canvas=i,this.gl=a}else{var t=this.container.querySelector(".gl-canvas-focus"),e=f({canvas:t,preserveDrawingBuffer:!0,premultipliedAlpha:!0});e||g(this),this.canvas=t,this.gl=e}var r=this.canvas;r.style.width="100%",r.style.height="100%",r.style.position="absolute",r.style.top="0px",r.style.left="0px",r.style["pointer-events"]="none",this.updateSize(r),r.className+=" user-select-none";var n=this.svgContainer=document.createElementNS("http://www.w3.org/2000/svg","svg");n.style.position="absolute",n.style.top=n.style.left="0px",n.style.width=n.style.height="100%",n.style["z-index"]=20,n.style["pointer-events"]="none";var o=this.mouseContainer=document.createElement("div");o.style.position="absolute",o.style["pointer-events"]="auto",this.pickCanvas=this.container.querySelector(".gl-canvas-pick");var s=this.container;s.appendChild(n),s.appendChild(o);var l=this;o.addEventListener("mouseout",function(){l.isMouseOver=!1,l.unhover()}),o.addEventListener("mouseover",function(){l.isMouseOver=!0})},w.toImage=function(t){t||(t="png"),this.stopped=!0,this.staticPlot&&this.container.appendChild(i),this.updateSize(this.canvas);var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.clearColor(1,1,1,0),e.clear(e.COLOR_BUFFER_BIT|e.DEPTH_BUFFER_BIT),this.glplot.setDirty(),this.glplot.draw(),e.bindFramebuffer(e.FRAMEBUFFER,null);var a=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,a);for(var o=0,s=n-1;o<s;++o,--s)for(var l=0;l<r;++l)for(var c=0;c<4;++c){var u=a[4*(r*o+l)+c];a[4*(r*o+l)+c]=a[4*(r*s+l)+c],a[4*(r*s+l)+c]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(a),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticPlot&&this.container.removeChild(i),p},w.updateSize=function(t){t||(t=this.canvas);var e=this.pixelRatio,r=this.fullLayout,n=r.width,i=r.height,a=0|Math.ceil(e*n),o=0|Math.ceil(e*i);return t.width===a&&t.height===o||(t.width=a,t.height=o),this.redraw&&this.redraw(),t},w.computeTickMarks=function(){this.xaxis.setScale(),this.yaxis.setScale();for(var t=[s.calcTicks(this.xaxis),s.calcTicks(this.yaxis)],e=0;e<2;++e)for(var r=0;r<t[e].length;++r)t[e][r].text=m(t[e][r].text+"");return t},w.updateRefs=function(t){this.fullLayout=t;var e=this.id.match(_),r="xaxis"+e[1],n="yaxis"+e[2];this.xaxis=this.fullLayout[r],this.yaxis=this.fullLayout[n]},w.relayoutCallback=function(){var t=this.graphDiv,e=this.xaxis,r=this.yaxis,n=t.layout;n.xaxis.autorange=e.autorange,n.xaxis.range=e.range.slice(0),n.yaxis.autorange=r.autorange,n.yaxis.range=r.range.slice(0);var i={lastInputTime:this.camera.lastInputTime};i[e._name]=e.range.slice(0),i[r._name]=r.range.slice(0),t.emit("plotly_relayout",i)},w.cameraChanged=function(){var t=this.camera;this.glplot.setDataBox(this.calcDataBox());var e=this.computeTickMarks();(function(t,e){for(var r=0;r<2;++r){var n=t[r],i=e[r];if(n.length!==i.length)return!0;for(var a=0;a<n.length;++a)if(n[a].x!==i[a].x)return!0}return!1})(e,this.glplotOptions.ticks)&&(this.glplotOptions.ticks=e,this.glplotOptions.dataBox=t.dataBox,this.glplot.update(this.glplotOptions),this.handleAnnotations())},w.handleAnnotations=function(){for(var t=this.graphDiv,e=this.fullLayout.annotations,r=0;r<e.length;r++){var n=e[r];n.xref===this.xaxis._id&&n.yref===this.yaxis._id&&o.getComponentMethod("annotations","drawOne")(t,r)}},w.destroy=function(){if(this.glplot){var t=this.traces;t&&Object.keys(t).map(function(e){t[e].dispose(),delete t[e]}),this.glplot.dispose(),this.container.removeChild(this.svgContainer),this.container.removeChild(this.mouseContainer),this.fullData=null,this.glplot=null,this.stopped=!0,this.camera.mouseListener.enabled=!1,this.mouseContainer.removeEventListener("wheel",this.camera.wheelListener),this.camera=null}},w.plot=function(t,e,r){var n=this.glplot;this.updateRefs(r),this.updateTraces(t,e),this.updateFx(r.dragmode);var i=r.width,a=r.height;this.updateSize(this.canvas);var o=this.glplotOptions;o.merge(r),o.screenBox=[0,0,i,a];var l={_fullLayout:{_axisConstraintGroups:this.graphDiv._fullLayout._axisConstraintGroups,xaxis:this.xaxis,yaxis:this.yaxis}};b(l,this.xaxis),b(l,this.yaxis);var c=r._size,u=this.xaxis.domain,h=this.yaxis.domain;o.viewBox=[c.l+u[0]*c.w,c.b+h[0]*c.h,i-c.r-(1-u[1])*c.w,a-c.t-(1-h[1])*c.h],this.mouseContainer.style.width=c.w*(u[1]-u[0])+"px",this.mouseContainer.style.height=c.h*(h[1]-h[0])+"px",this.mouseContainer.height=c.h*(h[1]-h[0]),this.mouseContainer.style.left=c.l+u[0]*c.w+"px",this.mouseContainer.style.top=c.t+(1-h[1])*c.h+"px";var f=this.bounds;f[0]=f[1]=1/0,f[2]=f[3]=-1/0;var d,p,m=Object.keys(this.traces);for(p=0;p<m.length;++p)for(var g=this.traces[m[p]],v=0;v<2;++v)f[v]=Math.min(f[v],g.bounds[v]),f[v+2]=Math.max(f[v+2],g.bounds[v+2]);for(p=0;p<2;++p)f[p]>f[p+2]&&(f[p]=-1,f[p+2]=1),(d=this[x[p]])._length=o.viewBox[p+2]-o.viewBox[p],s.doAutoRange(d),d.setScale();y(l),o.ticks=this.computeTickMarks(),o.dataBox=this.calcDataBox(),o.merge(r),n.update(o),this.glplot.draw()},w.calcDataBox=function(){var t=this.xaxis,e=this.yaxis,r=t.range,n=e.range,i=t.r2l,a=e.r2l;return[i(r[0]),a(n[0]),i(r[1]),a(n[1])]},w.setRanges=function(t){var e=this.xaxis,r=this.yaxis,n=e.l2r,i=r.l2r;e.range=[n(t[0]),n(t[2])],r.range=[i(t[1]),i(t[3])]},w.updateTraces=function(t,e){var r,n,i,a=Object.keys(this.traces);this.fullData=t;t:for(r=0;r<a.length;r++){var o=a[r],s=this.traces[o];for(n=0;n<t.length;n++)if((i=t[n]).uid===o&&i.type===s.type)continue t;s.dispose(),delete this.traces[o]}for(r=0;r<t.length;r++){i=t[r];var l=e[r],c=this.traces[i.uid];c?c.update(i,l):(c=i._module.plot(this,i,l),this.traces[i.uid]=c)}this.glplot.objects.sort(function(t,e){return t._trace.index-e._trace.index})},w.updateFx=function(t){"lasso"===t||"select"===t?(this.pickCanvas.style["pointer-events"]="none",this.mouseContainer.style["pointer-events"]="none"):(this.pickCanvas.style["pointer-events"]="auto",this.mouseContainer.style["pointer-events"]="auto"),this.mouseContainer.style.cursor="pan"===t?"move":"zoom"===t?"crosshair":null},w.emitPointAction=function(t,e){for(var r,n=t.trace.uid,i=t.pointIndex,a=0;a<this.fullData.length;a++)this.fullData[a].uid===n&&(r=this.fullData[a]);var o={x:t.traceCoord[0],y:t.traceCoord[1],curveNumber:r.index,pointNumber:i,data:r._input,fullData:this.fullData,xaxis:this.xaxis,yaxis:this.yaxis};l.appendArrayPointValue(o,r,i),this.graphDiv.emit(e,{points:[o]})},w.draw=function(){if(!this.stopped){requestAnimationFrame(this.redraw);var t=this.glplot,e=this.camera,r=e.mouseListener,n=1===this.lastButtonState&&0===r.buttons,i=this.fullLayout;this.lastButtonState=r.buttons,this.cameraChanged();var a,o=r.x*t.pixelRatio,s=this.canvas.height-t.pixelRatio*r.y;if(e.boxEnabled&&"zoom"===i.dragmode){this.selectBox.enabled=!0;for(var c=this.selectBox.selectBox=[Math.min(e.boxStart[0],e.boxEnd[0]),Math.min(e.boxStart[1],e.boxEnd[1]),Math.max(e.boxStart[0],e.boxEnd[0]),Math.max(e.boxStart[1],e.boxEnd[1])],u=0;u<2;u++)e.boxStart[u]===e.boxEnd[u]&&(c[u]=t.dataBox[u],c[u+2]=t.dataBox[u+2]);t.setDirty()}else if(!e.panning&&this.isMouseOver){this.selectBox.enabled=!1;var h=i._size,f=this.xaxis.domain,d=this.yaxis.domain,p=(a=t.pick(o/t.pixelRatio+h.l+f[0]*h.w,s/t.pixelRatio-(h.t+(1-d[1])*h.h)))&&a.object._trace.handlePick(a);if(p&&n&&this.emitPointAction(p,"plotly_click"),a&&"skip"!==a.object._trace.hoverinfo&&i.hovermode&&p&&(!this.lastPickResult||this.lastPickResult.traceUid!==p.trace.uid||this.lastPickResult.dataCoord[0]!==p.dataCoord[0]||this.lastPickResult.dataCoord[1]!==p.dataCoord[1])){var m=p;this.lastPickResult={traceUid:p.trace?p.trace.uid:null,dataCoord:p.dataCoord.slice()},this.spikes.update({center:a.dataCoord}),m.screenCoord=[((t.viewBox[2]-t.viewBox[0])*(a.dataCoord[0]-t.dataBox[0])/(t.dataBox[2]-t.dataBox[0])+t.viewBox[0])/t.pixelRatio,(this.canvas.height-(t.viewBox[3]-t.viewBox[1])*(a.dataCoord[1]-t.dataBox[1])/(t.dataBox[3]-t.dataBox[1])-t.viewBox[1])/t.pixelRatio],this.emitPointAction(p,"plotly_hover");var g=this.fullData[m.trace.index]||{},v=m.pointIndex,y=l.castHoverinfo(g,i,v);if(y&&"all"!==y){var b=y.split("+");-1===b.indexOf("x")&&(m.traceCoord[0]=void 0),-1===b.indexOf("y")&&(m.traceCoord[1]=void 0),-1===b.indexOf("z")&&(m.traceCoord[2]=void 0),-1===b.indexOf("text")&&(m.textLabel=void 0),-1===b.indexOf("name")&&(m.name=void 0)}l.loneHover({x:m.screenCoord[0],y:m.screenCoord[1],xLabel:this.hoverFormatter("xaxis",m.traceCoord[0]),yLabel:this.hoverFormatter("yaxis",m.traceCoord[1]),zLabel:m.traceCoord[2],text:m.textLabel,name:m.name,color:l.castHoverOption(g,v,"bgcolor")||m.color,borderColor:l.castHoverOption(g,v,"bordercolor"),fontFamily:l.castHoverOption(g,v,"font.family"),fontSize:l.castHoverOption(g,v,"font.size"),fontColor:l.castHoverOption(g,v,"font.color")},{container:this.svgContainer,gd:this.graphDiv})}}a||this.unhover(),t.draw()}},w.unhover=function(){this.lastPickResult&&(this.spikes.update({}),this.lastPickResult=null,this.graphDiv.emit("plotly_unhover"),l.loneUnhover(this.svgContainer))},w.hoverFormatter=function(t,e){if(void 0!==e){var r=this[t];return s.tickText(r,r.c2l(e),"hover").text}}},{"../../components/fx":655,"../../lib/html2unicode":736,"../../lib/show_no_webgl_msg":758,"../../plots/cartesian/axes":785,"../../registry":861,"../cartesian/constants":790,"../cartesian/constraints":792,"./camera":821,"./convert":822,"gl-plot2d":220,"gl-select-box":254,"gl-spikes2d":263,"webgl-context":572}],825:[function(t,e,r){"use strict";e.exports=function(t,e){function r(e,r,i,a){var o=p.keyBindingMode;if(!1!==o){var s="rotate"===o,l="pan"===o,u="zoom"===o,f=!!a.control,d=!!a.alt,y=!!a.shift,b=!!(1&e),x=!!(2&e),_=!!(4&e),w=1/t.clientHeight,M=w*(r-m),k=w*(i-g),T=p.flipX?1:-1,A=p.flipY?1:-1,S=n(),E=Math.PI*p.rotateSpeed;if((s&&b&&!f&&!d&&!y||b&&!f&&!d&&y)&&c.rotate(S,T*E*M,-A*E*k,0),(l&&b&&!f&&!d&&!y||x||b&&f&&!d&&!y)&&c.pan(S,-p.translateSpeed*M*h,p.translateSpeed*k*h,0),u&&b&&!f&&!d&&!y||_||b&&!f&&d&&!y){var L=-p.zoomSpeed*k/window.innerHeight*(S-c.lastT())*100;c.pan(S,0,0,h*(Math.exp(L)-1))}return m=r,g=i,v=a,!0}}t=t||document.body;var l=[.01,1/0];"distanceLimits"in(e=e||{})&&(l[0]=e.distanceLimits[0],l[1]=e.distanceLimits[1]),"zoomMin"in e&&(l[0]=e.zoomMin),"zoomMax"in e&&(l[1]=e.zoomMax);var c=i({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:l}),u=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],h=0,f=t.clientWidth,d=t.clientHeight,p={keyBindingMode:"rotate",view:c,element:t,delay:e.delay||16,rotateSpeed:e.rotateSpeed||1,zoomSpeed:e.zoomSpeed||1,translateSpeed:e.translateSpeed||1,flipX:!!e.flipX,flipY:!!e.flipY,modes:c.modes,tick:function(){var e=n(),r=this.delay,i=e-2*r;c.idle(e-r),c.recalcMatrix(i),c.flush(e-(100+2*r));for(var a=!0,o=c.computedMatrix,s=0;s<16;++s)a=a&&u[s]===o[s],u[s]=o[s];var l=t.clientWidth===f&&t.clientHeight===d;return f=t.clientWidth,d=t.clientHeight,a?!l:(h=Math.exp(c.computedRadius[0]),!0)},lookAt:function(t,e,r){c.lookAt(c.lastT(),t,e,r)},rotate:function(t,e,r){c.rotate(c.lastT(),t,e,r)},pan:function(t,e,r){c.pan(c.lastT(),t,e,r)},translate:function(t,e,r){c.translate(c.lastT(),t,e,r)}};Object.defineProperties(p,{matrix:{get:function(){return c.computedMatrix},set:function(t){return c.setMatrix(c.lastT(),t),c.computedMatrix},enumerable:!0},mode:{get:function(){return c.getMode()},set:function(t){var e=c.computedUp.slice(),r=c.computedEye.slice(),i=c.computedCenter.slice();if(c.setMode(t),"turntable"===t){var a=n();c._active.lookAt(a,r,i,e),c._active.lookAt(a+500,r,i,[0,0,1]),c._active.flush(a)}return c.getMode()},enumerable:!0},center:{get:function(){return c.computedCenter},set:function(t){return c.lookAt(c.lastT(),null,t),c.computedCenter},enumerable:!0},eye:{get:function(){return c.computedEye},set:function(t){return c.lookAt(c.lastT(),t),c.computedEye},enumerable:!0},up:{get:function(){return c.computedUp},set:function(t){return c.lookAt(c.lastT(),null,null,t),c.computedUp},enumerable:!0},distance:{get:function(){return h},set:function(t){return c.setDistance(c.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return c.getDistanceLimits(l)},set:function(t){return c.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var m=0,g=0,v={shift:!1,control:!1,alt:!1,meta:!1};return p.mouseListener=a(t,r),t.addEventListener("touchstart",function(e){var n=s(e.changedTouches[0],t);r(0,n[0],n[1],v),r(1,n[0],n[1],v)}),t.addEventListener("touchmove",function(e){var n=s(e.changedTouches[0],t);r(1,n[0],n[1],v)}),t.addEventListener("touchend",function(){r(0,m,g,v)}),p.wheelListener=o(t,function(t,e){if(!1!==p.keyBindingMode){var r=p.flipX?1:-1,i=p.flipY?1:-1,a=n();if(Math.abs(t)>Math.abs(e))c.rotate(a,0,0,-t*r*Math.PI*p.rotateSpeed/window.innerWidth);else{var o=-p.zoomSpeed*i*e/window.innerHeight*(a-c.lastT())/20;c.pan(a,0,0,h*(Math.exp(o)-1))}}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset")},{"3d-view":38,"mouse-change":453,"mouse-event-offset":454,"mouse-wheel":456,"right-now":511}],826:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("../../components/fx/layout_attributes"),a=t("./scene"),o=t("../get_data").getSubplotData,s=t("../../lib"),l=t("../../constants/xmlns_namespaces");r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=r.attrRegex=s.counterRegex("scene"),r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.baseLayoutAttrOverrides=n({hoverlabel:i.hoverlabel},"plot","nested"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=e._subplots.gl3d,i=0;i<n.length;i++){var l=n[i],c=o(r,"gl3d",l),u=e[l],h=u._scene;h||(h=new a({id:l,graphDiv:t,container:t.querySelector(".gl-container"),staticPlot:t._context.staticPlot,plotGlPixelRatio:t._context.plotGlPixelRatio},e),u._scene=h),h.cameraInitial||(h.cameraInitial=s.extendDeep({},u.camera)),h.plot(c,e,t.layout)}},r.clean=function(t,e,r,n){for(var i=n._subplots.gl3d||[],a=0;a<i.length;a++){var o=i[a];!e[o]&&n[o]._scene&&(n[o]._scene.destroy(),n._infolayer&&n._infolayer.selectAll(".annotation-"+o).remove())}},r.toSVG=function(t){for(var e=t._fullLayout,r=e._subplots.gl3d,n=e._size,i=0;i<r.length;i++){var a=e[r[i]],o=a.domain,s=a._scene,c=s.toImage("png");e._glimages.append("svg:image").attr({xmlns:l.svg,"xlink:href":c,x:n.l+n.w*o.x[0],y:n.t+n.h*(1-o.y[1]),width:n.w*(o.x[1]-o.x[0]),height:n.h*(o.y[1]-o.y[0]),preserveAspectRatio:"none"}),s.destroy()}},r.cleanId=function(t){if(t.match(/^scene[0-9]*$/)){var e=t.substr(5);return"1"===e&&(e=""),"scene"+e}},r.updateFx=function(t){for(var e=t._subplots.gl3d,r=0;r<e.length;r++){t[e[r]]._scene.updateFx(t.dragmode,t.hovermode)}}},{"../../components/fx/layout_attributes":656,"../../constants/xmlns_namespaces":719,"../../lib":738,"../../plot_api/edit_types":769,"../get_data":820,"./layout/attributes":827,"./layout/defaults":831,"./layout/layout_attributes":832,"./scene":836}],827:[function(t,e,r){"use strict";e.exports={scene:{valType:"subplotid",dflt:"scene",editType:"calc+clearAxisTypes"}}},{}],828:[function(t,e,r){"use strict";var n=t("../../../components/color"),i=t("../../cartesian/layout_attributes"),a=t("../../../lib/extend").extendFlat,o=t("../../../plot_api/edit_types").overrideAll;e.exports=o({visible:i.visible,showspikes:{valType:"boolean",dflt:!0},spikesides:{valType:"boolean",dflt:!0},spikethickness:{valType:"number",min:0,dflt:2},spikecolor:{valType:"color",dflt:n.defaultLine},showbackground:{valType:"boolean",dflt:!1},backgroundcolor:{valType:"color",dflt:"rgba(204, 204, 204, 0.5)"},showaxeslabels:{valType:"boolean",dflt:!0},color:i.color,categoryorder:i.categoryorder,categoryarray:i.categoryarray,title:i.title,titlefont:i.titlefont,type:i.type,autorange:i.autorange,rangemode:i.rangemode,range:i.range,tickmode:i.tickmode,nticks:i.nticks,tick0:i.tick0,dtick:i.dtick,tickvals:i.tickvals,ticktext:i.ticktext,ticks:i.ticks,mirror:i.mirror,ticklen:i.ticklen,tickwidth:i.tickwidth,tickcolor:i.tickcolor,showticklabels:i.showticklabels,tickfont:i.tickfont,tickangle:i.tickangle,tickprefix:i.tickprefix,showtickprefix:i.showtickprefix,ticksuffix:i.ticksuffix,showticksuffix:i.showticksuffix,showexponent:i.showexponent,exponentformat:i.exponentformat,separatethousands:i.separatethousands,tickformat:i.tickformat,tickformatstops:i.tickformatstops,hoverformat:i.hoverformat,showline:i.showline,linecolor:i.linecolor,linewidth:i.linewidth,showgrid:i.showgrid,gridcolor:a({},i.gridcolor,{dflt:"rgb(204, 204, 204)"}),gridwidth:i.gridwidth,zeroline:i.zeroline,zerolinecolor:i.zerolinecolor,zerolinewidth:i.zerolinewidth},"plot","from-root")},{"../../../components/color":613,"../../../lib/extend":727,"../../../plot_api/edit_types":769,"../../cartesian/layout_attributes":797}],829:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../../lib"),a=t("./axis_attributes"),o=t("../../cartesian/type_defaults"),s=t("../../cartesian/axis_defaults"),l=["xaxis","yaxis","zaxis"];e.exports=function(t,e,r){function c(t,e){return i.coerce(u,h,a,t,e)}for(var u,h,f=0;f<l.length;f++){var d=l[f];u=t[d]||{},h=e[d]={_id:d[0]+r.scene,_name:d},o(u,h,c,r.data),s(u,h,c,{font:r.font,letter:d[0],data:r.data,showGrid:!0,bgColor:r.bgColor,calendar:r.calendar},r.fullLayout),c("gridcolor",n(h.color,r.bgColor,13600/187).toRgbString()),c("title",d[0]),h.setScale=i.noop,c("showspikes")&&(c("spikesides"),c("spikethickness"),c("spikecolor",h.color)),c("showaxeslabels"),c("showbackground")&&c("backgroundcolor")}}},{"../../../lib":738,"../../cartesian/axis_defaults":787,"../../cartesian/type_defaults":808,"./axis_attributes":828,tinycolor2:543}],830:[function(t,e,r){"use strict";function n(){this.bounds=[[-10,-10,-10],[10,10,10]],this.ticks=[[],[],[]],this.tickEnable=[!0,!0,!0],this.tickFont=["sans-serif","sans-serif","sans-serif"],this.tickSize=[12,12,12],this.tickAngle=[0,0,0],this.tickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.tickPad=[18,18,18],this.labels=["x","y","z"],this.labelEnable=[!0,!0,!0],this.labelFont=["Open Sans","Open Sans","Open Sans"],this.labelSize=[20,20,20],this.labelAngle=[0,0,0],this.labelColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.labelPad=[30,30,30],this.lineEnable=[!0,!0,!0],this.lineMirror=[!1,!1,!1],this.lineWidth=[1,1,1],this.lineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.lineTickEnable=[!0,!0,!0],this.lineTickMirror=[!1,!1,!1],this.lineTickLength=[10,10,10],this.lineTickWidth=[1,1,1],this.lineTickColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.gridEnable=[!0,!0,!0],this.gridWidth=[1,1,1],this.gridColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroEnable=[!0,!0,!0],this.zeroLineColor=[[0,0,0,1],[0,0,0,1],[0,0,0,1]],this.zeroLineWidth=[2,2,2],this.backgroundEnable=[!0,!0,!0],this.backgroundColor=[[.8,.8,.8,.5],[.8,.8,.8,.5],[.8,.8,.8,.5]],this._defaultTickPad=this.tickPad.slice(),this._defaultLabelPad=this.labelPad.slice(),this._defaultLineTickLength=this.lineTickLength.slice()}var i=t("../../../lib/html2unicode"),a=t("../../../lib/str2rgbarray"),o=["xaxis","yaxis","zaxis"];n.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[o[e]];r.visible?(this.labels[e]=i(r.title),"titlefont"in r&&(r.titlefont.color&&(this.labelColor[e]=a(r.titlefont.color)),r.titlefont.family&&(this.labelFont[e]=r.titlefont.family),r.titlefont.size&&(this.labelSize[e]=r.titlefont.size)),"showline"in r&&(this.lineEnable[e]=r.showline),"linecolor"in r&&(this.lineColor[e]=a(r.linecolor)),"linewidth"in r&&(this.lineWidth[e]=r.linewidth),"showgrid"in r&&(this.gridEnable[e]=r.showgrid),"gridcolor"in r&&(this.gridColor[e]=a(r.gridcolor)),"gridwidth"in r&&(this.gridWidth[e]=r.gridwidth),"log"===r.type?this.zeroEnable[e]=!1:"zeroline"in r&&(this.zeroEnable[e]=r.zeroline),"zerolinecolor"in r&&(this.zeroLineColor[e]=a(r.zerolinecolor)),"zerolinewidth"in r&&(this.zeroLineWidth[e]=r.zerolinewidth),"ticks"in r&&r.ticks?this.lineTickEnable[e]=!0:this.lineTickEnable[e]=!1,"ticklen"in r&&(this.lineTickLength[e]=this._defaultLineTickLength[e]=r.ticklen),"tickcolor"in r&&(this.lineTickColor[e]=a(r.tickcolor)),"tickwidth"in r&&(this.lineTickWidth[e]=r.tickwidth),"tickangle"in r&&(this.tickAngle[e]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180),"showticklabels"in r&&(this.tickEnable[e]=r.showticklabels),"tickfont"in r&&(r.tickfont.color&&(this.tickColor[e]=a(r.tickfont.color)),r.tickfont.family&&(this.tickFont[e]=r.tickfont.family),r.tickfont.size&&(this.tickSize[e]=r.tickfont.size)),"mirror"in r?-1!==["ticks","all","allticks"].indexOf(r.mirror)?(this.lineTickMirror[e]=!0,this.lineMirror[e]=!0):!0===r.mirror?(this.lineTickMirror[e]=!1,this.lineMirror[e]=!0):(this.lineTickMirror[e]=!1,this.lineMirror[e]=!1):this.lineMirror[e]=!1,"showbackground"in r&&!1!==r.showbackground?(this.backgroundEnable[e]=!0,this.backgroundColor[e]=a(r.backgroundcolor)):this.backgroundEnable[e]=!1):(this.tickEnable[e]=!1,this.labelEnable[e]=!1,this.lineEnable[e]=!1,this.lineTickEnable[e]=!1,this.gridEnable[e]=!1,this.zeroEnable[e]=!1,this.backgroundEnable[e]=!1)}},e.exports=function(t){var e=new n;return e.merge(t),e}},{"../../../lib/html2unicode":736,"../../../lib/str2rgbarray":760}],831:[function(t,e,r){"use strict";function n(t,e,r,n){for(var i=r("bgcolor"),s=a.combine(i,n.paper_bgcolor),c=["up","center","eye"],u=0;u<c.length;u++)r("camera."+c[u]+".x"),r("camera."+c[u]+".y"),r("camera."+c[u]+".z");var h=!!r("aspectratio.x")&&!!r("aspectratio.y")&&!!r("aspectratio.z"),f=r("aspectmode",h?"manual":"auto");h||(t.aspectratio=e.aspectratio={x:1,y:1,z:1},"manual"===f&&(e.aspectmode="auto"),t.aspectmode=e.aspectmode),l(t,e,{font:n.font,scene:n.id,data:n.fullData,bgColor:s,calendar:n.calendar,fullLayout:n.fullLayout}),o.getComponentMethod("annotations3d","handleDefaults")(t,e,n),r("dragmode",n.getDfltFromLayout("dragmode")),r("hovermode",n.getDfltFromLayout("hovermode"))}var i=t("../../../lib"),a=t("../../../components/color"),o=t("../../../registry"),s=t("../../subplot_defaults"),l=t("./axis_defaults"),c=t("./layout_attributes");e.exports=function(t,e,r){var a=e._basePlotModules.length>1;s(t,e,r,{type:"gl3d",attributes:c,handleDefaults:n,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!a)return i.validate(t[e],c[e])?t[e]:void 0},paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})}},{"../../../components/color":613,"../../../lib":738,"../../../registry":861,"../../subplot_defaults":853,"./axis_defaults":829,"./layout_attributes":832}],832:[function(t,e,r){"use strict";function n(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"}}var i=t("./axis_attributes"),a=t("../../../lib/extend").extendFlat,o=t("../../../lib").counterRegex;e.exports={_arrayAttrRegexps:[o("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:a(n(0,0,1),{}),center:a(n(0,0,0),{}),eye:a(n(1.25,1.25,1.25),{}),editType:"camera"},domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"plot"},{valType:"number",min:0,max:1,editType:"plot"}],dflt:[0,1],editType:"plot"},y:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"plot"},{valType:"number",min:0,max:1,editType:"plot"}],dflt:[0,1],editType:"plot"},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:i,yaxis:i,zaxis:i,dragmode:{valType:"enumerated",values:["orbit","turntable","zoom","pan",!1],dflt:"turntable",editType:"plot"},hovermode:{valType:"enumerated",values:["closest",!1],dflt:"closest",editType:"modebar"},editType:"plot",_deprecated:{cameraposition:{valType:"info_array",editType:"camera"}}}},{"../../../lib":738,"../../../lib/extend":727,"./axis_attributes":828}],833:[function(t,e,r){"use strict";function n(){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]}var i=t("../../../lib/str2rgbarray"),a=["xaxis","yaxis","zaxis"];n.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]=i(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 n;return e.merge(t),e}},{"../../../lib/str2rgbarray":760}],834:[function(t,e,r){"use strict";e.exports=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,l=t.fullSceneLayout,c=[[],[],[]],u=0;u<3;++u){var h=l[o[u]];if(h._length=(r[u].hi-r[u].lo)*r[u].pixelsPerDataUnit/t.dataScale[u],Math.abs(h._length)===1/0)c[u]=[];else{h.range[0]=r[u].lo/t.dataScale[u],h.range[1]=r[u].hi/t.dataScale[u],h._m=1/(t.dataScale[u]*r[u].pixelsPerDataUnit),h.range[0]===h.range[1]&&(h.range[0]-=1,h.range[1]+=1);var f=h.tickmode;if("auto"===h.tickmode){h.tickmode="linear";var d=h.nticks||i.constrain(h._length/40,4,9);n.autoTicks(h,Math.abs(h.range[1]-h.range[0])/d)}for(var p=n.calcTicks(h),m=0;m<p.length;++m)p[m].x=p[m].x*t.dataScale[u],p[m].text=a(p[m].text);c[u]=p,h.tickmode=f}}for(e.ticks=c,u=0;u<3;++u)for(s[u]=.5*(t.glplot.bounds[0][u]+t.glplot.bounds[1][u]),m=0;m<2;++m)e.bounds[m][u]=t.glplot.bounds[m][u];t.contourLevels=function(t){for(var e=new Array(3),r=0;r<3;++r){for(var n=t[r],i=new Array(n.length),a=0;a<n.length;++a)i[a]=n[a].x;e[r]=i}return e}(c)};var n=t("../../cartesian/axes"),i=t("../../../lib"),a=t("../../../lib/html2unicode"),o=["xaxis","yaxis","zaxis"],s=[0,0,0]},{"../../../lib":738,"../../../lib/html2unicode":736,"../../cartesian/axes":785}],835:[function(t,e,r){"use strict";function n(t,e){var r,n,i=[0,0,0,0];for(r=0;r<4;++r)for(n=0;n<4;++n)i[n]+=t[4*r+n]*e[r];return i}e.exports=function(t,e){return n(t.projection,n(t.view,n(t.model,[e[0],e[1],e[2],1])))}},{}],836:[function(t,e,r){"use strict";function n(t,e,r,n){var i={canvas:r,gl:n,container:t.container,axes:t.axesOptions,spikes:t.spikeOptions,pickRadius:10,snapToData:!0,autoScale:!0,autoBounds:!1};if(t.staticMode){if(!(c||(l=document.createElement("canvas"),c=h({canvas:l,preserveDrawingBuffer:!0,premultipliedAlpha:!0,antialias:!0}))))throw new Error("error creating static canvas/context for image server");i.pixelRatio=t.pixelRatio,i.gl=c,i.canvas=l}try{t.glplot=u(i)}catch(e){v(t)}var a=function(t){if(!1!==t.fullSceneLayout.dragmode){var e={};e[t.id+".camera"]=s(t.camera),t.saveCamera(t.graphDiv.layout),t.graphDiv.emit("plotly_relayout",e)}};if(t.glplot.canvas.addEventListener("mouseup",a.bind(null,t)),t.glplot.canvas.addEventListener("wheel",a.bind(null,t)),t.staticMode||t.glplot.canvas.addEventListener("webglcontextlost",function(t){d.warn("Lost WebGL context."),t.preventDefault()}),!t.camera){var o=t.fullSceneLayout.camera;t.camera=y(t.container,{center:[o.center.x,o.center.y,o.center.z],eye:[o.eye.x,o.eye.y,o.eye.z],up:[o.up.x,o.up.y,o.up.z],zoomMin:.1,zoomMax:100,mode:"orbit"})}return t.glplot.camera=t.camera,t.glplot.oncontextloss=function(){t.recoverContext()},t.glplot.onrender=function(t){function e(e,r){var n=t.fullSceneLayout[e];return p.tickText(n,n.d2l(r),"hover").text}var r,n=t.svgContainer,i=t.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),w(t),t.glplot.axes.update(t.axesOptions);for(var s=Object.keys(t.traces),l=null,c=t.glplot.selection,u=0;u<s.length;++u)"skip"!==(r=t.traces[s[u]]).data.hoverinfo&&r.handlePick(c)&&(l=r),r.setContourLevels&&r.setContourLevels();var h;if(null!==l){var f=b(t.glplot.cameraParams,c.dataCoordinate);r=l.data;var d=c.index,g=m.castHoverinfo(r,t.fullLayout,d),v=e("xaxis",c.traceCoordinate[0]),y=e("yaxis",c.traceCoordinate[1]),x=e("zaxis",c.traceCoordinate[2]);if("all"!==g){var _=g.split("+");-1===_.indexOf("x")&&(v=void 0),-1===_.indexOf("y")&&(y=void 0),-1===_.indexOf("z")&&(x=void 0),-1===_.indexOf("text")&&(c.textLabel=void 0),-1===_.indexOf("name")&&(l.name=void 0)}t.fullSceneLayout.hovermode&&m.loneHover({x:(.5+.5*f[0]/f[3])*a,y:(.5-.5*f[1]/f[3])*o,xLabel:v,yLabel:y,zLabel:x,text:c.textLabel,name:l.name,color:m.castHoverOption(r,d,"bgcolor")||l.color,borderColor:m.castHoverOption(r,d,"bordercolor"),fontFamily:m.castHoverOption(r,d,"font.family"),fontSize:m.castHoverOption(r,d,"font.size"),fontColor:m.castHoverOption(r,d,"font.color")},{container:n,gd:t.graphDiv});var M={x:c.traceCoordinate[0],y:c.traceCoordinate[1],z:c.traceCoordinate[2],data:r._input,fullData:r,curveNumber:r.index,pointNumber:d};m.appendArrayPointValue(M,r,d);var k={points:[M]};c.buttons&&c.distance<5?t.graphDiv.emit("plotly_click",k):t.graphDiv.emit("plotly_hover",k),h=k}else m.loneUnhover(n),t.graphDiv.emit("plotly_unhover",h);t.drawAnnotations(t)}.bind(null,t),t.traces={},!0}function i(t,e){var r=document.createElement("div"),i=t.container;this.graphDiv=t.graphDiv;var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.style.position="absolute",a.style.top=a.style.left="0px",a.style.width=a.style.height="100%",a.style["z-index"]=20,a.style["pointer-events"]="none",r.appendChild(a),this.svgContainer=a,r.id=t.id,r.style.position="absolute",r.style.top=r.style.left="0px",r.style.width=r.style.height="100%",i.appendChild(r),this.fullLayout=e,this.id=t.id||"scene",this.fullSceneLayout=e[this.id],this.plotArgs=[[],{},{}],this.axesOptions=x(e[this.id]),this.spikeOptions=_(e[this.id]),this.container=r,this.staticMode=!!t.staticPlot,this.pixelRatio=t.plotGlPixelRatio||2,this.dataScale=[1,1,1],this.contourLevels=[[],[],[]],this.convertAnnotations=f.getComponentMethod("annotations3d","convert"),this.drawAnnotations=f.getComponentMethod("annotations3d","draw"),n(this)}function a(t,e,r,n,i){for(var a,o=0;o<e.length;++o)if(Array.isArray(e[o]))for(var s=0;s<e[o].length;++s)a=t.d2l(e[o][s],0,i),!isNaN(a)&&isFinite(a)&&(n[0][r]=Math.min(n[0][r],a),n[1][r]=Math.max(n[1][r],a));else a=t.d2l(e[o],0,i),!isNaN(a)&&isFinite(a)&&(n[0][r]=Math.min(n[0][r],a),n[1][r]=Math.max(n[1][r],a))}function o(t,e,r){var n=t.fullSceneLayout;a(n.xaxis,e.x,0,r,e.xcalendar),a(n.yaxis,e.y,1,r,e.ycalendar),a(n.zaxis,e.z,2,r,e.zcalendar)}function s(t){return{up:{x:t.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]}}}var l,c,u=t("gl-plot3d"),h=t("webgl-context"),f=t("../../registry"),d=t("../../lib"),p=t("../../plots/cartesian/axes"),m=t("../../components/fx"),g=t("../../lib/str2rgbarray"),v=t("../../lib/show_no_webgl_msg"),y=t("./camera"),b=t("./project"),x=t("./layout/convert"),_=t("./layout/spikes"),w=t("./layout/tick_marks"),M=i.prototype;M.recoverContext=function(){function t(){r.isContextLost()?requestAnimationFrame(t):n(e,e.fullLayout,i,r)?e.plot.apply(e,e.plotArgs):d.error("Catastrophic and unrecoverable WebGL error. Context lost.")}var e=this,r=this.glplot.gl,i=this.glplot.canvas;this.glplot.dispose(),requestAnimationFrame(t)};var k=["xaxis","yaxis","zaxis"];M.plot=function(t,e,r){if(this.plotArgs=[t,e,r],!this.glplot.contextLost){var n,i,a,s,l,c,u=e[this.id],h=r[this.id];u.bgcolor?this.glplot.clearColor=g(u.bgcolor):this.glplot.clearColor=[0,0,0,0],this.glplot.snapToData=!0,this.fullLayout=e,this.fullSceneLayout=u,this.glplotLayout=u,this.axesOptions.merge(u),this.spikeOptions.merge(u),this.setCamera(u.camera),this.updateFx(u.dragmode,u.hovermode),this.glplot.update({}),this.setConvert(l),t?Array.isArray(t)||(t=[t]):t=[];var f=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]];for(a=0;a<t.length;++a)!0===(n=t[a]).visible&&o(this,n,f);var d=[1,1,1];for(s=0;s<3;++s)f[0][s]>f[1][s]?d[s]=1:f[1][s]===f[0][s]?d[s]=1:d[s]=1/(f[1][s]-f[0][s]);for(this.dataScale=d,this.convertAnnotations(this),a=0;a<t.length;++a)!0===(n=t[a]).visible&&((i=this.traces[n.uid])?i.update(n):(i=n._module.plot(this,n),this.traces[n.uid]=i),i.name=n.name);var p=Object.keys(this.traces);t:for(a=0;a<p.length;++a){for(s=0;s<t.length;++s)if(t[s].uid===p[a]&&!0===t[s].visible)continue t;(i=this.traces[p[a]]).dispose(),delete this.traces[p[a]]}this.glplot.objects.sort(function(t,e){return t._trace.data.index-e._trace.data.index});var m=[[0,0,0],[0,0,0]],v=[],y={};for(a=0;a<3;++a){if(l=u[k[a]],(c=l.type)in y?(y[c].acc*=d[a],y[c].count+=1):y[c]={acc:d[a],count:1},l.autorange){m[0][a]=1/0,m[1][a]=-1/0;var b=this.glplot.objects,x=this.fullSceneLayout.annotations||[],_=l._name.charAt(0);for(s=0;s<b.length;s++){var w=b[s].bounds;m[0][a]=Math.min(m[0][a],w[0][a]/d[a]),m[1][a]=Math.max(m[1][a],w[1][a]/d[a])}for(s=0;s<x.length;s++){var M=x[s];if(M.visible){var T=l.r2l(M[_]);m[0][a]=Math.min(m[0][a],T),m[1][a]=Math.max(m[1][a],T)}}if("rangemode"in l&&"tozero"===l.rangemode&&(m[0][a]=Math.min(m[0][a],0),m[1][a]=Math.max(m[1][a],0)),m[0][a]>m[1][a])m[0][a]=-1,m[1][a]=1;else{var A=m[1][a]-m[0][a];m[0][a]-=A/32,m[1][a]+=A/32}}else{var S=l.range;m[0][a]=l.r2l(S[0]),m[1][a]=l.r2l(S[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.bounds[0][a]=m[0][a]*d[a],this.glplot.bounds[1][a]=m[1][a]*d[a]}var E=[1,1,1];for(a=0;a<3;++a){var L=y[c=(l=u[k[a]]).type];E[a]=Math.pow(L.acc,1/L.count)/d[a]}var C;if("auto"===u.aspectmode)C=Math.max.apply(null,E)/Math.min.apply(null,E)<=4?E:[1,1,1];else if("cube"===u.aspectmode)C=[1,1,1];else if("data"===u.aspectmode)C=E;else{if("manual"!==u.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var I=u.aspectratio;C=[I.x,I.y,I.z]}u.aspectratio.x=h.aspectratio.x=C[0],u.aspectratio.y=h.aspectratio.y=C[1],u.aspectratio.z=h.aspectratio.z=C[2],this.glplot.aspect=C;var P=u.domain||null,D=e._size||null;if(P&&D){var z=this.container.style;z.position="absolute",z.left=D.l+P.x[0]*D.w+"px",z.top=D.t+(1-P.y[1])*D.h+"px",z.width=D.w*(P.x[1]-P.x[0])+"px",z.height=D.h*(P.y[1]-P.y[0])+"px"}this.glplot.redraw()}},M.destroy=function(){this.glplot&&(this.camera.mouseListener.enabled=!1,this.container.removeEventListener("wheel",this.camera.wheelListener),this.camera=this.glplot.camera=null,this.glplot.dispose(),this.container.parentNode.removeChild(this.container),this.glplot=null)},M.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),s(this.glplot.camera)},M.setCamera=function(t){this.glplot.camera.lookAt.apply(this,function(t){return[[t.eye.x,t.eye.y,t.eye.z],[t.center.x,t.center.y,t.center.z],[t.up.x,t.up.y,t.up.z]]}(t))},M.saveCamera=function(t){function e(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 r=this.getCamera(),n=d.nestedProperty(t,this.id+".camera"),i=n.get(),a=!1;if(void 0===i)a=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!e(r,i,o,s)){a=!0;break}return a&&n.set(r),a},M.updateFx=function(t,e){var r=this.camera;r&&("orbit"===t?(r.mode="orbit",r.keyBindingMode="rotate"):"turntable"===t?(r.up=[0,0,1],r.mode="turntable",r.keyBindingMode="rotate"):r.keyBindingMode=t),this.fullSceneLayout.hovermode=e},M.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(l),this.glplot.redraw();var e=this.glplot.gl,r=e.drawingBufferWidth,n=e.drawingBufferHeight;e.bindFramebuffer(e.FRAMEBUFFER,null);var i=new Uint8Array(r*n*4);e.readPixels(0,0,r,n,e.RGBA,e.UNSIGNED_BYTE,i);for(var a=0,o=n-1;a<o;++a,--o)for(var s=0;s<r;++s)for(var c=0;c<4;++c){var u=i[4*(r*a+s)+c];i[4*(r*a+s)+c]=i[4*(r*o+s)+c],i[4*(r*o+s)+c]=u}var h=document.createElement("canvas");h.width=r,h.height=n;var f=h.getContext("2d"),d=f.createImageData(r,n);d.data.set(i),f.putImageData(d,0,0);var p;switch(t){case"jpeg":p=h.toDataURL("image/jpeg");break;case"webp":p=h.toDataURL("image/webp");break;default:p=h.toDataURL("image/png")}return this.staticMode&&this.container.removeChild(l),p},M.setConvert=function(){for(var t=0;t<3;t++){var e=this.fullSceneLayout[k[t]];p.setConvert(e,this.fullLayout),e.setScale=d.noop}},e.exports=i},{"../../components/fx":655,"../../lib":738,"../../lib/show_no_webgl_msg":758,"../../lib/str2rgbarray":760,"../../plots/cartesian/axes":785,"../../registry":861,"./camera":825,"./layout/convert":830,"./layout/spikes":833,"./layout/tick_marks":834,"./project":835,"gl-plot3d":222,"webgl-context":572}],837:[function(t,e,r){"use strict";var n=t("./font_attributes"),i=t("../components/color/attributes"),a=n({editType:"calc"});a.family.dflt='"Open Sans", verdana, arial, sans-serif',a.size.dflt=12,a.color.dflt=i.defaultLine,e.exports={font:a,title:{valType:"string",editType:"layoutstyle"},titlefont:n({editType:"layoutstyle"}),autosize:{valType:"boolean",dflt:!1,editType:"none"},width:{valType:"number",min:10,dflt:700,editType:"none"},height:{valType:"number",min:10,dflt:450,editType:"none"},margin:{l:{valType:"number",min:0,dflt:80,editType:"calc"},r:{valType:"number",min:0,dflt:80,editType:"calc"},t:{valType:"number",min:0,dflt:100,editType:"calc"},b:{valType:"number",min:0,dflt:80,editType:"calc"},pad:{valType:"number",min:0,dflt:0,editType:"calc"},autoexpand:{valType:"boolean",dflt:!0,editType:"calc"},editType:"calc"},paper_bgcolor:{valType:"color",dflt:i.background,editType:"plot"},plot_bgcolor:{valType:"color",dflt:i.background,editType:"layoutstyle"},separators:{valType:"string",editType:"plot"},hidesources:{valType:"boolean",dflt:!1,editType:"plot"},showlegend:{valType:"boolean",editType:"legend"},colorway:{valType:"colorlist",dflt:i.defaults,editType:"calc"}}},{"../components/color/attributes":612,"./font_attributes":810}],838:[function(t,e,r){"use strict";e.exports={styleUrlPrefix:"mapbox://styles/mapbox/",styleUrlSuffix:"v9",controlContainerClassName:"mapboxgl-control-container",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"),mapOnErrorMsg:"Mapbox error."}},{}],839:[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=Array.isArray(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}var h;return h=c[0]&&c[1]?c.join("-"):c[0]?c[0]:c[1]?c[1]:"center",{anchor:h,offset:u}}},{"../../lib":738}],840:[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("./mapbox"),l=t("./constants");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,c=function(t,e){var r=t._fullLayout,n=t._context;if(""===n.mapboxAccessToken)return"";for(var i=n.mapboxAccessToken,a=0;a<e.length;a++){var o=r[e[a]];if(o.accesstoken){i=o.accesstoken;break}}if(!i)throw new Error(l.noAccessTokenErrorMsg);return i}(t,o);n.accessToken=c;for(var u=0;u<o.length;u++){var h=o[u],f=a(r,"mapbox",h),d=e[h],p=d._subplot;d.accesstoken=c,p||(p=s({gd:t,container:e._glcontainer.node(),id:h,fullLayout:e,staticPlot:t._context.staticPlot}),e[h]._subplot=p),p.viewInitial||(p.viewInitial={center:i.extendFlat({},d.center),zoom:d.zoom,bearing:d.bearing,pitch:d.pitch}),p.plot(f,e,t._promises)}},r.clean=function(t,e,r,n){for(var i=n._subplots.mapbox||[],a=0;a<i.length;a++){var o=i[a];!e[o]&&n[o]._subplot&&n[o]._subplot.destroy()}},r.toSVG=function(t){for(var e=t._fullLayout,r=e._subplots.mapbox,n=e._size,i=0;i<r.length;i++){var a=e[r[i]],s=a.domain,l=a._subplot,c=l.toImage("png");e._glimages.append("svg:image").attr({xmlns:o.svg,"xlink:href":c,x:n.l+n.w*s.x[0],y:n.t+n.h*(1-s.y[1]),width:n.w*(s.x[1]-s.x[0]),height:n.h*(s.y[1]-s.y[0]),preserveAspectRatio:"none"}),l.destroy()}},r.updateFx=function(t){for(var e=t._subplots.mapbox,r=0;r<e.length;r++){t[e[r]]._subplot.updateFx(t)}}},{"../../constants/xmlns_namespaces":719,"../../lib":738,"../../plots/get_data":820,"./constants":838,"./layout_attributes":842,"./layout_defaults":843,"./mapbox":844,"mapbox-gl":344}],841:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=t.uid+"-layer"+e,this.idSource=this.uid+"-source",this.idLayer=this.uid+"-layer",this.sourceType=null,this.source=null,this.layerType=null,this.below=null,this.visible=!1}function i(t){var e=t.source;return a.isPlainObject(e)||"string"==typeof e&&e.length>0}var a=t("../../lib"),o=t("./convert_text_opts"),s=n.prototype;s.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)&&this.updateLayer(t):(this.updateSource(t),this.updateLayer(t)),this.updateStyle(t),this.visible=i(t)},s.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},s.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},s.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,i(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,i={type:r};return"geojson"===r?e="data":"vector"===r&&(e="string"==typeof n?"url":"tiles"),i[e]=n,i}(t);e.addSource(this.idSource,r)}},s.updateLayer=function(t){var e=this.map;if(e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,i(t)){e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type},t.below);this.mapbox.setOptions(this.idLayer,"setLayoutProperty",{visibility:"visible"})}},s.updateStyle=function(t){var e=function(t){var e={},r={};switch(t.type){case"circle":a.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":a.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":a.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=o(n.textposition,n.iconsize);a.extendFlat(e,{"icon-image":n.icon+"-15","icon-size":n.iconsize/10,"text-field":n.text,"text-size":n.textfont.size,"text-anchor":i.anchor,"text-offset":i.offset}),a.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}(t);i(t)&&(this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint))},s.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)},e.exports=function(t,e,r){var i=new n(t,e);return i.update(r),i}},{"../../lib":738,"./convert_text_opts":839}],842:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../font_attributes"),o=t("../../traces/scatter/attributes").textposition,s=t("../../plot_api/edit_types").overrideAll,l=a({});l.family.dflt="Open Sans Regular, Arial Unicode MS Regular",e.exports=s({_arrayAttrRegexps:[n.counterRegex("mapbox",".layers",!0)],domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},accesstoken:{valType:"string",noBlank:!0,strict:!0},style:{valType:"any",values:["basic","streets","outdoors","light","dark","satellite","satellite-streets"],dflt:"basic"},center:{lon:{valType:"number",dflt:0},lat:{valType:"number",dflt:0}},zoom:{valType:"number",dflt:1},bearing:{valType:"number",dflt:0},pitch:{valType:"number",dflt:0},layers:{_isLinkedToArray:"layer",sourcetype:{valType:"enumerated",values:["geojson","vector"],dflt:"geojson"},source:{valType:"any"},sourcelayer:{valType:"string",dflt:""},type:{valType:"enumerated",values:["circle","line","fill","symbol"],dflt:"circle"},below:{valType:"string",dflt:""},color:{valType:"color",dflt:i},opacity:{valType:"number",min:0,max:1,dflt:1},circle:{radius:{valType:"number",dflt:15}},line:{width:{valType:"number",dflt:2}},fill:{outlinecolor:{valType:"color",dflt:i}},symbol:{icon:{valType:"string",dflt:"marker"},iconsize:{valType:"number",dflt:10},text:{valType:"string",dflt:""},textfont:l,textposition:n.extendFlat({},o,{arrayOk:!1})}}},"plot","from-root")},{"../../components/color":613,"../../lib":738,"../../plot_api/edit_types":769,"../../traces/scatter/attributes":1054,"../font_attributes":810}],843:[function(t,e,r){"use strict";function n(t,e,r){r("accesstoken"),r("style"),r("center.lon"),r("center.lat"),r("zoom"),r("bearing"),r("pitch"),function(t,e){function r(t,e){return i.coerce(n,a,o.layers,t,e)}var n,a,s=t.layers||[],l=e.layers=[];for(var c=0;c<s.length;c++)if(n=s[c],a={},i.isPlainObject(n)){var u=r("sourcetype");r("source"),"vector"===u&&r("sourcelayer");var h=r("type");r("below"),r("color"),r("opacity"),"circle"===h&&r("circle.radius"),"line"===h&&r("line.width"),"fill"===h&&r("fill.outlinecolor"),"symbol"===h&&(r("symbol.icon"),r("symbol.iconsize"),r("symbol.text"),i.coerceFont(r,"symbol.textfont"),r("symbol.textposition")),a._index=c,l.push(a)}}(t,e),e._input=t}var i=t("../../lib"),a=t("../subplot_defaults"),o=t("./layout_attributes");e.exports=function(t,e,r){a(t,e,r,{type:"mapbox",attributes:o,handleDefaults:n,partition:"y"})}},{"../../lib":738,"../subplot_defaults":853,"./layout_attributes":842}],844:[function(t,e,r){"use strict";function n(t){this.id=t.id,this.gd=t.gd,this.container=t.container,this.isStatic=t.staticPlot;var e=t.fullLayout;this.uid=e._uid+"-"+this.id,this.opts=e[this.id],this.div=null,this.xaxis=null,this.yaxis=null,this.createFramework(e),this.map=null,this.accessToken=null,this.styleObj=null,this.traceHash={},this.layerList=[]}function i(t){var e=d.style.values,r=d.style.dflt,n={};return c.isPlainObject(t)?(n.id=t.id,n.style=t):"string"==typeof t?(n.id=t,n.style=-1!==e.indexOf(t)?a(t):t):(n.id=r,n.style=a(r)),n}function a(t){return f.styleUrlPrefix+t+"-"+f.styleUrlSuffix}function o(t){return[t.lon,t.lat]}var s=t("mapbox-gl"),l=t("../../components/fx"),c=t("../../lib"),u=t("../../components/dragelement"),h=t("../cartesian/select"),f=t("./constants"),d=t("./layout_attributes"),p=t("./layers"),m=n.prototype;e.exports=function(t){return new n(t)},m.plot=function(t,e,r){var n=this,i=n.opts=e[this.id];n.map&&i.accesstoken!==n.accessToken&&(n.map.remove(),n.map=null,n.styleObj=null,n.traceHash=[],n.layerList={});var a;a=n.map?new Promise(function(r,i){n.updateMap(t,e,r,i)}):new Promise(function(r,i){n.createMap(t,e,r,i)}),r.push(a)},m.createMap=function(t,e,r,n){function a(){l.loneUnhover(e._toppaper)}var u=this,h=u.gd,d=u.opts,p=u.styleObj=i(d.style);u.accessToken=d.accesstoken;var m=u.map=new s.Map({container:u.div,style:p.style,center:o(d.center),zoom:d.zoom,bearing:d.bearing,pitch:d.pitch,interactive:!u.isStatic,preserveDrawingBuffer:u.isStatic,doubleClickZoom:!1,boxZoom:!1}),g=f.controlContainerClassName,v=u.div.getElementsByClassName(g)[0];u.div.removeChild(v),m._canvas.canvas.style.left="0px",m._canvas.canvas.style.top="0px",u.rejectOnError(n),m.once("load",function(){u.updateData(t),u.updateLayout(e),u.resolveOnRender(r)}),u.isStatic||(m.on("moveend",function(t){if(u.map){var e=u.getView();if(d._input.center=d.center=e.center,d._input.zoom=d.zoom=e.zoom,d._input.bearing=d.bearing=e.bearing,d._input.pitch=d.pitch=e.pitch,t.originalEvent){var r={};r[u.id]=c.extendFlat({},e),h.emit("plotly_relayout",r)}}}),m.on("mousemove",function(t){var e=u.div.getBoundingClientRect();t.clientX=t.point.x+e.left,t.clientY=t.point.y+e.top,t.target.getBoundingClientRect=function(){return e},u.xaxis.p2c=function(){return t.lngLat.lng},u.yaxis.p2c=function(){return t.lngLat.lat},l.hover(h,t,u.id)}),m.on("click",function(t){l.click(h,t.originalEvent)}),m.on("dragstart",a),m.on("zoomstart",a),m.on("dblclick",function(){var t=u.viewInitial;m.setCenter(o(t.center)),m.setZoom(t.zoom),m.setBearing(t.bearing),m.setPitch(t.pitch);var e=u.getView();d._input.center=d.center=e.center,d._input.zoom=d.zoom=e.zoom,d._input.bearing=d.bearing=e.bearing,d._input.pitch=d.pitch=e.pitch,h.emit("plotly_doubleclick",null)}))},m.updateMap=function(t,e,r,n){var a=this,o=a.map;a.rejectOnError(n);var s=i(a.opts.style);a.styleObj.id!==s.id?(a.styleObj=s,o.setStyle(s.style),o.style.once("load",function(){a.traceHash={},a.updateData(t),a.updateLayout(e),a.resolveOnRender(r)})):(a.updateData(t),a.updateLayout(e),a.resolveOnRender(r))},m.updateData=function(t){var e,r,n,i,a=this.traceHash;for(n=0;n<t.length;n++){var o=t[n];(e=a[(r=o[0].trace).uid])?e.update(o):r._module&&(a[r.uid]=r._module.plot(this,o))}var s=Object.keys(a);t:for(n=0;n<s.length;n++){var l=s[n];for(i=0;i<t.length;i++)if(r=t[i][0].trace,l===r.uid)continue t;(e=a[l]).dispose(),delete a[l]}},m.updateLayout=function(t){var e=this.map,r=this.opts;e.setCenter(o(r.center)),e.setZoom(r.zoom),e.setBearing(r.bearing),e.setPitch(r.pitch),this.updateLayers(),this.updateFramework(t),this.updateFx(t),this.map.resize()},m.resolveOnRender=function(t){var e=this.map;e.on("render",function r(){e.loaded()&&(e.off("render",r),t())})},m.rejectOnError=function(t){function e(){t(new Error(f.mapOnErrorMsg))}var r=this.map;r.once("error",e),r.once("style.error",e),r.once("source.error",e),r.once("tile.error",e),r.once("layer.error",e)},m.createFramework=function(t){var e=this,r=e.div=document.createElement("div");r.id=e.uid,r.style.position="absolute",e.container.appendChild(r),e.xaxis={_id:"x",c2p:function(t){return e.project(t).x}},e.yaxis={_id:"y",c2p:function(t){return e.project(t).y}},e.updateFramework(t)},m.updateFx=function(t){function e(t){var e=r.map.unproject(t);return[e.lng,e.lat]}var r=this,n=r.map,i=r.gd;if(!r.isStatic){var a,o=t.dragmode;if(a="select"===o?function(t,n){(t.range={})[r.id]=[e([n.xmin,n.ymin]),e([n.xmax,n.ymax])]}:function(t,n,i){(t.lassoPoints={})[r.id]=i.filtered.map(e)},"select"===o||"lasso"===o){n.dragPan.disable();var s={element:r.div,gd:i,plotinfo:{xaxis:r.xaxis,yaxis:r.yaxis,fillRangeItems:a},xaxes:[r.xaxis],yaxes:[r.yaxis],subplot:r.id};s.prepFn=function(t,e,r){h(t,e,r,s,o)},u.init(s)}else n.dragPan.enable(),r.div.onmousedown=null}},m.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])},m.updateLayers=function(){var t,e=this.opts.layers,r=this.layerList;if(e.length!==r.length){for(t=0;t<r.length;t++)r[t].dispose();for(r=this.layerList=[],t=0;t<e.length;t++)r.push(p(this,t,e[t]))}else for(t=0;t<e.length;t++)r[t].update(e[t])},m.destroy=function(){this.map&&(this.map.remove(),this.map=null,this.container.removeChild(this.div))},m.toImage=function(){return this.map.getCanvas().toDataURL()},m.initSource=function(t){return this.map.addSource(t,{type:"geojson",data:{type:"Feature",geometry:{type:"Point",coordinates:[]}}})},m.setSourceData=function(t,e){this.map.getSource(t).setData(e)},m.setOptions=function(t,e,r){for(var n=this.map,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a];n[e](t,o,r[o])}},m.project=function(t){return this.map.project(new s.LngLat(t[0],t[1]))},m.getView=function(){var t=this.map,e=t.getCenter();return{center:{lon:e.lng,lat:e.lat},zoom:t.getZoom(),bearing:t.getBearing(),pitch:t.getPitch()}}},{"../../components/dragelement":635,"../../components/fx":655,"../../lib":738,"../cartesian/select":802,"./constants":838,"./layers":841,"./layout_attributes":842,"mapbox-gl":344}],845:[function(t,e,r){"use strict";e.exports={t:{valType:"number",dflt:0,editType:"arraydraw"},r:{valType:"number",dflt:0,editType:"arraydraw"},b:{valType:"number",dflt:0,editType:"arraydraw"},l:{valType:"number",dflt:0,editType:"arraydraw"},editType:"arraydraw"}},{}],846:[function(t,e,r){"use strict";function n(t){for(var e=0;e<t.length;e++){t[e]._categories=t[e]._initialCategories.slice(),t[e]._categoriesMap={};for(var r=0;r<t[e]._categories.length;r++)t[e]._categoriesMap[t[e]._categories[r]]=r}}var i=t("d3"),a=t("fast-isnumeric"),o=t("../plotly"),s=t("../plot_api/plot_schema"),l=t("../registry"),c=t("../plots/cartesian/axis_ids"),u=t("../lib"),h=u._,f=t("../components/color"),d=t("../constants/numerical").BADNUM,p=e.exports={},m=t("./animation_attributes"),g=t("./frame_attributes"),v=u.relinkPrivateKeys;u.extendFlat(p,l),p.attributes=t("./attributes"),p.attributes.type.values=p.allTypes,p.fontAttrs=t("./font_attributes"),p.layoutAttributes=t("./layout_attributes"),p.fontWeight="normal";var y=p.transformsRegistry,b=t("../components/errorbars"),x=t("./command");p.executeAPICommand=x.executeAPICommand,p.computeAPICommandBindings=x.computeAPICommandBindings,p.manageCommandObserver=x.manageCommandObserver,p.hasSimpleAPICommandBindings=x.hasSimpleAPICommandBindings,p.redrawText=function(t){if(!((t=u.getGraphDiv(t)).data&&t.data[0]&&t.data[0].r))return new Promise(function(e){setTimeout(function(){l.getComponentMethod("annotations","draw")(t),l.getComponentMethod("legend","draw")(t),(t.calcdata||[]).forEach(function(t){t[0]&&t[0].t&&t[0].t.cb&&t[0].t.cb()}),e(p.previousPromises(t))},300)})},p.resize=function(t){return t=u.getGraphDiv(t),new Promise(function(e,r){t&&!function(t){var e=window.getComputedStyle(t).display;return!e||"none"===e}(t)||r(new Error("Resize must be passed a displayed plot div element.")),t._redrawTimer&&clearTimeout(t._redrawTimer),t._redrawTimer=setTimeout(function(){if(t.layout.width&&t.layout.height)e(t);else{delete t.layout.width,delete t.layout.height;var r=t.changed;t.autoplay=!0,o.relayout(t,{autosize:!0}).then(function(){t.changed=r,e(t)})}},100)})},p.previousPromises=function(t){if((t._promises||[]).length)return Promise.all(t._promises).then(function(){t._promises=[]})},p.addLinks=function(t){if(t._context.showLink||t._context.showSources){var e=t._fullLayout,r=e._paper.selectAll("text.js-plot-link-container").data([0]);r.enter().append("text").classed("js-plot-link-container",!0).style({"font-family":'"Open Sans", Arial, sans-serif',"font-size":"12px",fill:f.defaultLine,"pointer-events":"all"}).each(function(){var t=i.select(this);t.append("tspan").classed("js-link-to-tool",!0),t.append("tspan").classed("js-link-spacer",!0),t.append("tspan").classed("js-sourcelinks",!0)});var n=r.node(),a={y:e._paper.attr("height")-9};document.body.contains(n)&&n.getComputedTextLength()>=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(){p.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()?" - ":"")}},p.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var e=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",r=i.select(t).append("div").attr("id","hiddenform").style("display","none"),n=r.append("form").attr({action:e+"/external",method:"post",target:"_blank"});return n.append("input").attr({type:"text",name:"data"}).node().value=p.graphJson(t,!1,"keepdata"),n.node().submit(),r.remove(),t.emit("plotly_afterexport"),!1},p.supplyDefaults=function(t){var e,r=t._fullLayout||{},n=t._fullLayout={},a=t.layout||{},o=t._fullData||[],s=t._fullData=[],f=t.data||[];t._transitionData||p.createTransitionData(t),n._dfltTitle={plot:h(t,"Click to enter Plot title"),x:h(t,"Click to enter X axis title"),y:h(t,"Click to enter Y axis title"),colorbar:h(t,"Click to enter Colorscale title")},n._traceWord=h(t,"trace");var d=function(t){function e(t){for(var e=!0,r=0;r<w.length;r++){var a=w[r];i[a]||(t[a]?i[a]=t[a]:e=!1)}e&&(n=!0)}for(var r=t._context.locale,n=!1,i={},a=0;a<2;a++){for(var o=t._context.locales,s=0;s<2;s++){var c=(o[r]||{}).format;if(c&&(e(c),n))break;o=l.localeRegistry}var u=r.split("-")[0];if(n||u===r)break;r=u}return n||e(l.localeRegistry.en.format),i}(t);if(r._initialAutoSizeIsDone){var m=r.width,g=r.height;p.supplyLayoutGlobalDefaults(a,n,d),a.width||(n.width=m),a.height||(n.height=g)}else{p.supplyLayoutGlobalDefaults(a,n,d);var y=!a.width||!a.height,b=n.autosize,x=t._context&&t._context.autosizable;y&&(b||x)?p.plotAutoSize(t,a,n):y&&p.sanitizeMargins(t),!b&&y&&(a.width=n.width,a.height=n.height)}n._d3locale=function(t,e){return t.decimal=e.charAt(0),t.thousands=e.charAt(1),i.locale(t)}(d,n.separators),n._initialAutoSizeIsDone=!0,n._dataLength=f.length,n._modules=[],n._basePlotModules=[],n._subplots=function(){var t,e,r={};if(!_){_=[];var n=l.subplotsRegistry;for(var i in n){var a=n[i].attr;if(a&&(_.push(i),Array.isArray(a)))for(e=0;e<a.length;e++)u.pushUnique(_,a[e])}}for(t=0;t<_.length;t++)r[_[t]]=[];return r}(),n._globalTransforms=(t._context||{}).globalTransforms,p.supplyDataDefaults(f,s,a,n),n._has=p._hasPlotType.bind(n);var M=n._modules;for(e=0;e<M.length;e++){var k=M[e];k.cleanData&&k.cleanData(s)}if(o.length===f.length)for(e=0;e<s.length;e++)v(s[e],o[e]);p.supplyLayoutModuleDefaults(a,n,s,t._transitionData),n._hasCartesian=n._has("cartesian"),n._hasGeo=n._has("geo"),n._hasGL3D=n._has("gl3d"),n._hasGL2D=n._has("gl2d"),n._hasTernary=n._has("ternary"),n._hasPie=n._has("pie"),p.cleanPlot(s,n,o,r),p.linkSubplots(s,n,o,r),v(n,r),p.doAutoMargin(t);var T=c.list(t);for(e=0;e<T.length;e++){T[e].setScale()}if((t.calcdata||[]).length===s.length)for(e=0;e<s.length;e++){var A=s[e],S=t.calcdata[e][0];S&&S.trace&&(S.trace._hasCalcTransform?function(t,e){var r,n,i=t.trace,a=i._arrayAttrs,o={};for(r=0;r<a.length;r++)o[n=a[r]]=u.nestedProperty(i,n).get().slice();for(t.trace=e,r=0;r<a.length;r++)n=a[r],u.nestedProperty(t.trace,n).set(o[n])}(S,A):S.trace=A)}};var _,w=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"];p.createTransitionData=function(t){t._transitionData||(t._transitionData={}),t._transitionData._frames||(t._transitionData._frames=[]),t._transitionData._frameHash||(t._transitionData._frameHash={}),t._transitionData._counter||(t._transitionData._counter=0),t._transitionData._interruptCallbacks||(t._transitionData._interruptCallbacks=[])},p._hasPlotType=function(t){var e,r=this._basePlotModules||[];for(e=0;e<r.length;e++){if(r[e].name===t)return!0}var n=this._modules||[];for(e=0;e<n.length;e++){var i=n[e];if(i.categories&&i.categories.indexOf(t)>=0)return!0}return!1},p.cleanPlot=function(t,e,r,n){var i,a,o=n._basePlotModules||[];for(i=0;i<o.length;i++){var s=o[i];s.clean&&s.clean(t,e,r,n)}var l=!!n._paper,c=!!n._infolayer,u=n._has&&n._has("gl"),h=e._has&&e._has("gl");u&&!h&&void 0!==n._glcontainer&&(n._glcontainer.selectAll(".gl-canvas").remove(),n._glcanvas=null);t:for(i=0;i<r.length;i++){var f=r[i].uid;for(a=0;a<t.length;a++){if(f===t[a].uid)continue t}var d=".hm"+f+",.contour"+f+",.carpet"+f+",#clip"+f+",.trace"+f;l&&n._paper.selectAll(d).remove(),c&&(n._infolayer.selectAll(".cb"+f).remove(),n._infolayer.selectAll("g.rangeslider-container").selectAll(d).remove())}n._zoomlayer&&n._zoomlayer.selectAll(".select-outline").remove()},p.linkSubplots=function(t,e,r,n){var i,a,o,s,l=n._plots||{},h=e._plots={},f=e._subplots,d={_fullData:t,_fullLayout:e},p=f.cartesian.concat(f.gl2d||[]);for(var m in f)f[m].sort(u.subplotSort);for(i=0;i<p.length;i++){var g,v=l[o=p[i]],y=c.getFromId(d,o,"x"),b=c.getFromId(d,o,"y");for(v?((g=h[o]=v)._scene2d&&g._scene2d.updateRefs(e),g.xaxis.layer!==y.layer&&(g.xlines.attr("d",null),g.xaxislayer.selectAll("*").remove()),g.yaxis.layer!==b.layer&&(g.ylines.attr("d",null),g.yaxislayer.selectAll("*").remove())):(g=h[o]={}).id=o,g.xaxis=y,g.yaxis=b,g._hasClipOnAxisFalse=!1,a=0;a<t.length;a++){var x=t[a];if(x.xaxis===g.xaxis._id&&x.yaxis===g.yaxis._id&&!1===x.cliponaxis){g._hasClipOnAxisFalse=!0;break}}}var _=c.list(d,null,!0);for(i=0;i<_.length;i++){var w=null;(s=_[i]).overlaying&&(w=c.getFromId(d,s.overlaying))&&w.overlaying&&(s.overlaying=!1,w=null),s._mainAxis=w||s,w&&(s.domain=w.domain.slice()),s._anchorAxis="free"===s.anchor?null:c.getFromId(d,s.anchor)}for(i=0;i<_.length;i++){var M="x"===(s=_[i])._id.charAt(0),k=s._mainAxis._anchorAxis,T="",A="",S="";if(k&&(S=k._mainAxis._id,T=M?s._id+S:S+s._id),!T||-1===p.indexOf(T))for(T="",a=0;a<p.length;a++){var E=(o=p[a]).indexOf("y"),L=M?o.substr(0,E):o.substr(E),C=M?o.substr(E):o.substr(0,E);if(L===s._id){A||(A=o);var I=c.getFromId(d,C);if(S&&I.overlaying===S){T=o;break}}}s._mainSubplot=T||A}},p.clearExpandedTraceDefaultColors=function(t){function e(t,e,i,a){n[a]=e,n.length=a+1,"color"===t.valType&&void 0===t.dflt&&r.push(n.join("."))}var r,n,i;for(n=[],(r=t._module._colorAttrs)||(t._module._colorAttrs=r=[],s.crawl(t._module.attributes,e)),i=0;i<r.length;i++){u.nestedProperty(t,"_input."+r[i]).get()||u.nestedProperty(t,r[i]).set(null)}},p.supplyDataDefaults=function(t,e,r,n){function i(t){e.push(t);var r=t._module;r&&(!0===t.visible&&u.pushUnique(c,r),u.pushUnique(h,t._module.basePlotModule),f++,!1!==t._input.visible&&d++)}var a,o,s,c=n._modules,h=n._basePlotModules,f=0,d=0;n._transformModules=[];var m={},g=[];for(a=0;a<t.length;a++){if(s=t[a],o=p.supplyTraceDefaults(s,d,n,a),o.index=a,o._input=s,o._expandedIndex=f,o.transforms&&o.transforms.length)for(var b=function(t,e,r,n){for(var i=t.transforms,a=[t],o=0;o<i.length;o++){var s=i[o],l=y[s.type];l&&l.transform&&(a=l.transform(a,{transform:s,fullTrace:t,fullData:e,layout:r,fullLayout:n,transformIndex:o}))}return a}(o,e,r,n),x=0;x<b.length;x++){var _=b[x],w=p.supplyTraceDefaults(_,f,n,a);v(w,_),_.uid=w.uid=o.uid+x,w.index=a,w._input=s,w._fullInput=o,w._expandedIndex=f,w._expandedInput=_,i(w)}else o._fullInput=o,o._expandedInput=o,i(o);l.traceIs(o,"carpetAxis")&&(m[o.carpet]=o),l.traceIs(o,"carpetDependent")&&g.push(a)}for(a=0;a<g.length;a++)if((o=e[g[a]]).visible){var M=m[o.carpet];o._carpet=M,M&&M.visible?(o.xaxis=M.xaxis,o.yaxis=M.yaxis):o.visible=!1}},p.supplyAnimationDefaults=function(t){function e(e,r){return u.coerce(t||{},n,m,e,r)}t=t||{};var r,n={};if(e("mode"),e("direction"),e("fromcurrent"),Array.isArray(t.frame))for(n.frame=[],r=0;r<t.frame.length;r++)n.frame[r]=p.supplyAnimationFrameDefaults(t.frame[r]||{});else n.frame=p.supplyAnimationFrameDefaults(t.frame||{});if(Array.isArray(t.transition))for(n.transition=[],r=0;r<t.transition.length;r++)n.transition[r]=p.supplyAnimationTransitionDefaults(t.transition[r]||{});else n.transition=p.supplyAnimationTransitionDefaults(t.transition||{});return n},p.supplyAnimationFrameDefaults=function(t){function e(e,n){return u.coerce(t||{},r,m.frame,e,n)}var r={};return e("duration"),e("redraw"),r},p.supplyAnimationTransitionDefaults=function(t){function e(e,n){return u.coerce(t||{},r,m.transition,e,n)}var r={};return e("duration"),e("easing"),r},p.supplyFrameDefaults=function(t){function e(e,n){return u.coerce(t,r,g,e,n)}var r={};return e("group"),e("name"),e("traces"),e("baseframe"),e("data"),e("layout"),r},p.supplyTraceDefaults=function(t,e,r,n){function i(e,r){return u.coerce(t,s,p.attributes,e,r)}var a,o=r.colorway||f.defaults,s={},c=o[e%o.length],h=i("visible");i("type"),i("uid"),i("name",r._traceWord+" "+n);var d=p.getModule(s);if(s._module=d,d){var m=d.basePlotModule,g=m.attr;if(g){var v=r._subplots,y=m.attributes,b="";if("gl2d"!==m.name||h){if(Array.isArray(g))for(a=0;a<g.length;a++){var x=g[a],_=u.coerce(t,s,y,x);v[x]&&u.pushUnique(v[x],_),b+=_}else b=u.coerce(t,s,y,g);v[m.name]&&u.pushUnique(v[m.name],b)}}}return h&&(i("customdata"),i("ids"),p.traceIs(s,"showLegend")&&(i("showlegend"),i("legendgroup")),l.getComponentMethod("fx","supplyDefaults")(t,s,c,r),d&&(d.supplyDefaults(t,s,c,r),u.coerceHoverinfo(t,s,r)),p.traceIs(s,"noOpacity")||i("opacity"),p.traceIs(s,"notLegendIsolatable")&&(s.visible=!!s.visible),d&&d.selectPoints&&"scattergl"!==s.type&&i("selectedpoints"),p.supplyTransformDefaults(t,s,r)),s},p.supplyTransformDefaults=function(t,e,r){var n=r._globalTransforms||[],i=r._transformModules||[];if(Array.isArray(t.transforms)||0!==n.length)for(var a=t.transforms||[],o=n.concat(a),s=e.transforms=[],l=0;l<o.length;l++){var c,h=o[l],f=h.type,d=y[f],p=!(h._module&&h._module===d),m=d&&"function"==typeof d.transform;d||u.warn("Unrecognized transform type "+f+"."),d&&d.supplyDefaults&&(p||m)?((c=d.supplyDefaults(h,e,r,t)).type=f,c._module=d,u.pushUnique(i,d)):c=u.extendFlat({},h),s.push(c)}},p.supplyLayoutGlobalDefaults=function(t,e,r){function n(r,n){return u.coerce(t,e,p.layoutAttributes,r,n)}var i=u.coerceFont(n,"font");n("title",e._dfltTitle.plot),u.coerceFont(n,"titlefont",{family:i.family,size:Math.round(1.4*i.size),color:i.color}),n("autosize",!(t.width&&t.height)),n("width"),n("height"),n("margin.l"),n("margin.r"),n("margin.t"),n("margin.b"),n("margin.pad"),n("margin.autoexpand"),t.width&&t.height&&p.sanitizeMargins(e),n("paper_bgcolor"),n("separators",r.decimal+r.thousands),n("hidesources"),n("colorway"),l.getComponentMethod("calendars","handleDefaults")(t,e,"calendar"),l.getComponentMethod("fx","supplyLayoutGlobalDefaults")(t,e,n)},p.plotAutoSize=function(t,e,r){var n,i,o=t._context||{},s=o.frameMargins,l=u.isPlotDiv(t);if(l&&t.emit("plotly_autosize"),o.fillFrame)n=window.innerWidth,i=window.innerHeight,document.body.style.overflow="hidden";else if(a(s)&&s>0){var c=function(t){var e,r={left:0,right:0,bottom:0,top:0};if(t)for(e in t)t.hasOwnProperty(e)&&(r.left+=t[e].left||0,r.right+=t[e].right||0,r.bottom+=t[e].bottom||0,r.top+=t[e].top||0);return r}(t._boundingBoxMargins),h=c.left+c.right,f=c.bottom+c.top,d=1-2*s,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(d*(m.width-h)),i=Math.round(d*(m.height-f))}else{var g=l?window.getComputedStyle(t):{};n=parseFloat(g.width)||r.width,i=parseFloat(g.height)||r.height}var v=p.layoutAttributes.width.min,y=p.layoutAttributes.height.min;n<v&&(n=v),i<y&&(i=y);var b=!e.width&&Math.abs(r.width-n)>1,x=!e.height&&Math.abs(r.height-i)>1;(x||b)&&(b&&(r.width=n),x&&(r.height=i)),t._initialAutoSize||(t._initialAutoSize={width:n,height:i}),p.sanitizeMargins(r)},p.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,o,s=l.componentsRegistry,c=e._basePlotModules,u=l.subplotsRegistry.cartesian;for(i in s)(o=s[i]).includeBasePlot&&o.includeBasePlot(t,e);for(c.length||c.push(u),e._has("cartesian")&&u.finalizeSubplots(t,e),a=0;a<c.length;a++)(o=c[a]).supplyLayoutDefaults&&o.supplyLayoutDefaults(t,e,r);var h=e._modules;for(a=0;a<h.length;a++)(o=h[a]).supplyLayoutDefaults&&o.supplyLayoutDefaults(t,e,r);var f=e._transformModules;for(a=0;a<f.length;a++)(o=f[a]).supplyLayoutDefaults&&o.supplyLayoutDefaults(t,e,r,n);for(i in s)(o=s[i]).supplyLayoutDefaults&&o.supplyLayoutDefaults(t,e,r)},p.purge=function(t){var e=t._fullLayout||{};void 0!==e._glcontainer&&(e._glcontainer.selectAll(".gl-canvas").remove(),e._glcontainer.remove(),e._glcanvas=null),void 0!==e._geocontainer&&e._geocontainer.remove(),e._modeBar&&e._modeBar.destroy(),t._transitionData&&(t._transitionData._interruptCallbacks&&(t._transitionData._interruptCallbacks.length=0),t._transitionData._animationRaf&&window.cancelAnimationFrame(t._transitionData._animationRaf)),u.clearThrottle(),delete t.data,delete t.layout,delete t._fullData,delete t._fullLayout,delete t.calcdata,delete t.framework,delete t.empty,delete t.fid,delete t.undoqueue,delete t.undonum,delete t.autoplay,delete t.changed,delete t._promises,delete t._redrawTimer,delete t.firstscatter,delete t._hmlumcount,delete t._hmpixcount,delete t._transitionData,delete t._transitioning,delete t._initialAutoSize,delete t._transitioningWithDuration,delete t._dragging,delete t._dragged,delete t._hoverdata,delete t._snapshotInProgress,delete t._editing,delete t._replotPending,delete t._mouseDownTime,delete t._legendMouseDownTime,t.removeAllListeners&&t.removeAllListeners()},p.style=function(t){for(var e=t._fullLayout._modules,r=0;r<e.length;r++){var n=e[r];n.style&&n.style(t)}},p.sanitizeMargins=function(t){if(t&&t.margin){var e,r=t.width,n=t.height,i=t.margin,a=r-(i.l+i.r),o=n-(i.t+i.b);a<0&&(e=(r-1)/(i.l+i.r),i.l=Math.floor(e*i.l),i.r=Math.floor(e*i.r)),o<0&&(e=(n-1)/(i.t+i.b),i.t=Math.floor(e*i.t),i.b=Math.floor(e*i.b))}},p.autoMargin=function(t,e,r){var n=t._fullLayout;if(n._pushmargin||(n._pushmargin={}),!1!==n.margin.autoexpand){if(r){var i=void 0===r.pad?12:r.pad;r.l+r.r>.5*n.width&&(r.l=r.r=0),r.b+r.t>.5*n.height&&(r.b=r.t=0),n._pushmargin[e]={l:{val:r.x,size:r.l+i},r:{val:r.x,size:r.r+i},b:{val:r.y,size:r.b+i},t:{val:r.y,size:r.t+i}}}else delete n._pushmargin[e];n._replotting||p.doAutoMargin(t)}},p.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var r=e._size,n=JSON.stringify(r),i=Math.max(e.margin.l||0,0),s=Math.max(e.margin.r||0,0),l=Math.max(e.margin.t||0,0),c=Math.max(e.margin.b||0,0),u=e._pushmargin;if(!1!==e.margin.autoexpand){u.base={l:{val:0,size:i},r:{val:1,size:s},t:{val:1,size:l},b:{val:0,size:c}};for(var h in u){var f=u[h].l||{},d=u[h].b||{},p=f.val,m=f.size,g=d.val,v=d.size;for(var y in u){if(a(m)&&u[y].r){var b=u[y].r.val,x=u[y].r.size;if(b>p){var _=(m*b+(x-e.width)*p)/(b-p),w=(x*(1-p)+(m-e.width)*(1-b))/(b-p);_>=0&&w>=0&&_+w>i+s&&(i=_,s=w)}}if(a(v)&&u[y].t){var M=u[y].t.val,k=u[y].t.size;if(M>g){var T=(v*M+(k-e.height)*g)/(M-g),A=(k*(1-g)+(v-e.height)*(1-M))/(M-g);T>=0&&A>=0&&T+A>c+l&&(c=T,l=A)}}}}}if(r.l=Math.round(i),r.r=Math.round(s),r.t=Math.round(l),r.b=Math.round(c),r.p=Math.round(e.margin.pad),r.w=Math.round(e.width)-r.l-r.r,r.h=Math.round(e.height)-r.t-r.b,!e._replotting&&"{}"!==n&&n!==JSON.stringify(e._size))return o.plot(t)},p.graphJson=function(t,e,r,n,i){function a(t){if("function"==typeof t)return null;if(u.isPlainObject(t)){var e,n,i={};for(e in t)if("function"!=typeof t[e]&&-1===["_","["].indexOf(e.charAt(0))){if("keepdata"===r){if("src"===e.substr(e.length-3))continue}else if("keepstream"===r){if("string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0&&!u.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=a(t[e])}return i}return Array.isArray(t)?t.map(a):u.isJSDate(t)?u.ms2DateTimeLocal(+t):t}(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&p.supplyDefaults(t);var o=i?t._fullData:t.data,s=i?t._fullLayout:t.layout,l=(t._transitionData||{})._frames,c={data:(o||[]).map(function(t){var r=a(t);return e&&delete r.fit,r})};return e||(c.layout=a(s)),t.framework&&t.framework.isPolar&&(c=t.framework.getConfig()),l&&(c.frames=a(l)),"object"===n?c:JSON.stringify(c)},p.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r<e.length;r++)switch((n=e[r]).type){case"replace":i=n.value;var s=(a[n.index]||{}).name,l=i.name;a[n.index]=o[l]=i,l!==s&&(delete o[s],o[l]=i);break;case"insert":o[(i=n.value).name]=i,a.splice(n.index,0,i);break;case"delete":delete o[(i=a[n.index]).name],a.splice(n.index,1)}return Promise.resolve()},p.computeFrame=function(t,e){var r,n,i,a,o=t._transitionData._frameHash;if(!e)throw new Error("computeFrame must be given a string frame name");var s=o[e.toString()];if(!s)return!1;for(var l=[s],c=[s.name];s.baseframe&&(s=o[s.baseframe.toString()])&&-1===c.indexOf(s.name);)l.push(s),c.push(s.name);for(var u={};s=l.pop();)if(s.layout&&(u.layout=p.extendLayout(u.layout,s.layout)),s.data){if(u.data||(u.data=[]),!(n=s.traces))for(n=[],r=0;r<s.data.length;r++)n[r]=r;for(u.traces||(u.traces=[]),r=0;r<s.data.length;r++)void 0!==(i=n[r])&&null!==i&&(-1===(a=u.traces.indexOf(i))&&(a=u.data.length,u.traces[a]=i),u.data[a]=p.extendTrace(u.data[a],s.data[r]))}return u},p.recomputeFrameHash=function(t){for(var e=t._transitionData._frameHash={},r=t._transitionData._frames,n=0;n<r.length;n++){var i=r[n];i&&i.name&&(e[i.name]=i)}},p.extendObjectWithContainers=function(t,e,r){var n,i,a,o,s,l,c,h,f=u.extendDeepNoArrays({},e||{}),d=u.expandObjectPaths(f),m={};if(r&&r.length)for(a=0;a<r.length;a++)void 0===(i=(n=u.nestedProperty(d,r[a])).get())?u.nestedProperty(m,r[a]).set(null):(n.set(null),u.nestedProperty(m,r[a]).set(i));if(t=u.extendDeepNoArrays(t||{},d),r&&r.length)for(a=0;a<r.length;a++)if(s=u.nestedProperty(m,r[a]),c=s.get()){for(h=(l=u.nestedProperty(t,r[a])).get(),Array.isArray(h)||(h=[],l.set(h)),o=0;o<c.length;o++){var g=c[o];h[o]=null===g?null:p.extendObjectWithContainers(h[o],g)}l.set(h)}return t},p.dataArrayContainers=["transforms"],p.layoutArrayContainers=l.layoutArrayContainers,p.extendTrace=function(t,e){return p.extendObjectWithContainers(t,e,p.dataArrayContainers)},p.extendLayout=function(t,e){return p.extendObjectWithContainers(t,e,p.layoutArrayContainers)},p.transition=function(t,e,r,n,i,a){var s,l,c=Array.isArray(e)?e.length:0,h=n.slice(0,c),f=[],d=!1;for(s=0;s<h.length;s++){l=h[s];var m=t._fullData[l]._module;if(m&&!m.animatable){var g={};for(var v in e[s])g[v]=[e[s][v]]}}var y=[p.previousPromises,function(){if(t._transitionData)return t._transitioning=!1,function(t){var e=Promise.resolve();if(!t)return e;for(;t.length;)e=e.then(t.shift());return e}(t._transitionData._interruptCallbacks)},function(){var n;for(n=0;n<h.length;n++){var i=h[n],a=t._fullData[i]._module;a&&(a.animatable&&f.push(i),t.data[h[n]]=p.extendTrace(t.data[h[n]],e[n]))}var o=u.expandObjectPaths(u.extendDeepNoArrays({},r)),s=/^[xy]axis[0-9]*$/;for(var l in o)s.test(l)&&delete o[l].range;return p.extendLayout(t.layout,o),delete t.calcdata,p.supplyDefaults(t),p.doCalcdata(t),b.calc(t),Promise.resolve()},p.rehover,function(){return t.emit("plotly_transitioning",[]),new Promise(function(e){function n(){return c++,function(){h++,d||h!==c||function(e){t._transitionData&&(function(t){if(t)for(;t.length;)t.shift()}(t._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(i.redraw)return o.redraw(t)}).then(function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])}).then(e))}(e)}}t._transitioning=!0,a.duration>0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){d=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return o.redraw(t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var s,l,c=0,h=0,p=t._fullLayout._basePlotModules,m=!1;if(r)for(l=0;l<p.length;l++)if(p[l].transitionAxes){var g=u.expandObjectPaths(r);m=p[l].transitionAxes(t,g,a,n)||m}for(m?(s=u.extendFlat({},a)).duration=0:s=a,l=0;l<p.length;l++)p[l].plot(t,f,s,n);setTimeout(n())})}],x=u.syncOrAsync(y,t);return x&&x.then||(x=Promise.resolve()),x.then(function(){return t})},p.doCalcdata=function(t,e){var r,i,a,o,u=c.list(t),h=t._fullData,f=t._fullLayout,p=new Array(h.length),m=(t.calcdata||[]).slice(0);for(t.calcdata=p,t.firstscatter=!0,f._numBoxes=0,f._numViolins=0,f._violinScaleGroupStats={},t._hmpixcount=0,t._hmlumcount=0,f._piecolormap={},f._piecolorway=null,f._piedefaultcolorcount=0,a=0;a<h.length;a++)Array.isArray(e)&&-1===e.indexOf(a)&&(p[a]=m[a]);for(a=0;a<h.length;a++)(r=h[a])._arrayAttrs=s.findArrayAttributes(r);n(u);var g=!1;for(a=0;a<h.length;a++)if(!0===(r=h[a]).visible&&r.transforms)for((i=r._module)&&i.calc&&i.calc(t,r),o=0;o<r.transforms.length;o++){var v=r.transforms[o];(i=y[v.type])&&i.calcTransform&&(r._hasCalcTransform=!0,g=!0,i.calcTransform(t,r,v))}if(g){for(a=0;a<u.length;a++)u[a]._min=[],u[a]._max=[],u[a]._categories=[],u[a]._categoriesMap={};n(u)}for(a=0;a<h.length;a++){var b=[];if(!0===(r=h[a]).visible){i=r._module;var x=r.transforms||[];for(o=x.length-1;o>=0;o--)if(x[o].enabled){r._indexToPoints=x[o]._indexToPoints;break}i&&i.calc&&(b=i.calc(t,r))}Array.isArray(b)&&b[0]||(b=[{x:d,y:d}]),b[0].t||(b[0].t={}),b[0].trace=r,p[a]=b}l.getComponentMethod("fx","calc")(t)},p.rehover=function(t){t._fullLayout._rehover&&t._fullLayout._rehover()},p.generalUpdatePerTraceModule=function(t,e,r){function n(t){for(var e=[],r=0;r<t.length;r++){var n=t[r];!0===n[0].trace.visible&&e.push(n)}return e}var i,a=t.traceHash,o={};for(i=0;i<e.length;i++){var s=e[i],l=s[0].trace;l.visible&&(o[l.type]=o[l.type]||[],o[l.type].push(s))}for(var c in a)if(!o[c]){var u=a[c][0];u[0].trace.visible=!1,o[c]=[u]}for(var h in o){var f=o[h];f[0][0].trace._module.plot(t,n(f),r)}t.traceHash=o}},{"../components/color":613,"../components/errorbars":644,"../constants/numerical":717,"../lib":738,"../plot_api/plot_schema":774,"../plotly":780,"../plots/cartesian/axis_ids":788,"../registry":861,"./animation_attributes":781,"./attributes":783,"./command":809,"./font_attributes":810,"./frame_attributes":811,"./layout_attributes":837,d3:123,"fast-isnumeric":132}],847:[function(t,e,r){"use strict";var n=t("../../traces/scatter/attributes"),i=n.marker;e.exports={r:n.r,t:n.t,marker:{color:i.color,size:i.size,symbol:i.symbol,opacity:i.opacity,editType:"calc"}}},{"../../traces/scatter/attributes":1054}],848:[function(t,e,r){"use strict";function n(t,e){return a({},e,{showline:{valType:"boolean"},showticklabels:{valType:"boolean"},tickorientation:{valType:"enumerated",values:["horizontal","vertical"]},ticklen:{valType:"number",min:0},tickcolor:{valType:"color"},ticksuffix:{valType:"string"},endpadding:{valType:"number"},visible:{valType:"boolean"}})}var i=t("../cartesian/layout_attributes"),a=t("../../lib/extend").extendFlat,o=t("../../plot_api/edit_types").overrideAll,s=a({},i.domain,{});e.exports=o({radialaxis:n(0,{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:s,orientation:{valType:"number"}}),angularaxis:n(0,{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:s}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}},"plot","nested")},{"../../lib/extend":727,"../../plot_api/edit_types":769,"../cartesian/layout_attributes":797}],849:[function(t,e,r){"use strict";(e.exports=t("./micropolar")).manager=t("./micropolar_manager")},{"./micropolar":850,"./micropolar_manager":851}],850:[function(t,e,r){var n=t("d3"),i=t("../../lib").extendDeepAll,a=t("../../constants/alignment").MID_SHIFT,o=e.exports={version:"0.2.2"};o.Axis=function(){var t,e,r,s,l={data:[],layout:{}},c={},u={},h=n.dispatch("hover"),f={};return f.render=function(c){return function(c){e=c||e;var h=l.data,f=l.layout;("string"==typeof e||e.nodeName)&&(e=n.select(e)),e.datum(h).each(function(e,l){function c(t,e){return s(t)%360+f.orientation}var h=e.slice();u={data:o.util.cloneJson(h),layout:o.util.cloneJson(f)};var d=0;h.forEach(function(t,e){t.color||(t.color=f.defaultColorRange[d],d=(d+1)%f.defaultColorRange.length),t.strokeColor||(t.strokeColor="LinePlot"===t.geometry?t.color:n.rgb(t.color).darker().toString()),u.data[e].color=t.color,u.data[e].strokeColor=t.strokeColor,u.data[e].strokeDash=t.strokeDash,u.data[e].strokeSize=t.strokeSize});var p=h.filter(function(t,e){var r=t.visible;return void 0===r||!0===r}),m=!1,g=p.map(function(t,e){return m=m||void 0!==t.groupId,t});if(m){var v=[],y=n.nest().key(function(t,e){return void 0!==t.groupId?t.groupId:"unstacked"}).entries(g).map(function(t,e){if("unstacked"===t.key)return t.values;var r=t.values[0].r.map(function(t,e){return 0});return t.values.forEach(function(t,e,n){t.yStack=[r],v.push(r),r=o.util.sumArrays(t.r,r)}),t.values});p=n.merge(y)}p.forEach(function(t,e){t.t=Array.isArray(t.t[0])?t.t:[t.t],t.r=Array.isArray(t.r[0])?t.r:[t.r]});var b=Math.min(f.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2;b=Math.max(10,b);var x,_=[f.margin.left+b,f.margin.top+b];x=m?[0,n.max(o.util.sumArrays(o.util.arrayLast(p).r[0],o.util.arrayLast(v)))]:n.extent(o.util.flattenArray(p.map(function(t,e){return t.r}))),f.radialAxis.domain!=o.DATAEXTENT&&(x[0]=0),r=n.scale.linear().domain(f.radialAxis.domain!=o.DATAEXTENT&&f.radialAxis.domain?f.radialAxis.domain:x).range([0,b]),u.layout.radialAxis.domain=r.domain();var w,M=o.util.flattenArray(p.map(function(t,e){return t.t})),k="string"==typeof M[0];k&&(M=o.util.deduplicate(M),w=M.slice(),M=n.range(M.length),p=p.map(function(t,e){var r=t;return t.t=[M],m&&(r.yStack=t.yStack),r}));var T=p.filter(function(t,e){return"LinePlot"===t.geometry||"DotPlot"===t.geometry}).length===p.length,A=null===f.needsEndSpacing?k||!T:f.needsEndSpacing,S=f.angularAxis.domain&&f.angularAxis.domain!=o.DATAEXTENT&&!k&&f.angularAxis.domain[0]>=0?f.angularAxis.domain:n.extent(M),E=Math.abs(M[1]-M[0]);T&&!k&&(E=0);var L=S.slice();A&&k&&(L[1]+=E);var C=f.angularAxis.ticksCount||4;C>8&&(C=C/(C/8)+C%8),f.angularAxis.ticksStep&&(C=(L[1]-L[0])/C);var I=f.angularAxis.ticksStep||(L[1]-L[0])/(C*(f.minorTicks+1));w&&(I=Math.max(Math.round(I),1)),L[2]||(L[2]=I);var P=n.range.apply(this,L);if(P=P.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(L.slice(0,2)).range("clockwise"===f.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=s.domain(),u.layout.angularAxis.endPadding=A?E:0,void 0===(t=n.select(this).select("svg.chart-root"))||t.empty()){var D=(new DOMParser).parseFromString("<svg xmlns='http://www.w3.org/2000/svg' class='chart-root'>' + '<g class='outer-group'>' + '<g class='chart-group'>' + '<circle class='background-circle'></circle>' + '<g class='geometry-group'></g>' + '<g class='radial axis-group'>' + '<circle class='outside-circle'></circle>' + '</g>' + '<g class='angular axis-group'></g>' + '<g class='guides-group'><line></line><circle r='0'></circle></g>' + '</g>' + '<g class='legend-group'></g>' + '<g class='tooltips-group'></g>' + '<g class='title-group'><text></text></g>' + '</g>' + '</svg>","application/xml"),z=this.appendChild(this.ownerDocument.importNode(D.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 O,F=t.select(".chart-group"),R={fill:"none",stroke:f.tickColor},j={"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){O=t.select(".legend-group").attr({transform:"translate("+[b,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=void 0===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:O,elements:N,reverseOrder:f.legend.reverseOrder})})();var B=O.node().getBBox();b=Math.min(f.width-B.width-f.margin.left-f.margin.right,f.height-f.margin.top-f.margin.bottom)/2,b=Math.max(10,b),_=[f.margin.left+b,f.margin.top+b],r.range([0,b]),u.layout.radialAxis.domain=r.domain(),O.attr("transform","translate("+[_[0]+b,_[1]-b]+")")}else O=t.select(".legend-group").style({display:"none"});t.attr({width:f.width,height:f.height}).style({opacity:f.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(f.width-(f.margin.left+f.margin.right+2*b+(B?B.width:0)))/2,(f.height-(f.margin.top+f.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+")"),f.title){var V=t.select("g.title-group text").style(j).text(f.title),H=V.node().getBBox();V.attr({x:_[0]-H.width/2,y:_[1]-b-20})}var q=t.select(".radial.axis-group");if(f.radialAxis.gridLinesVisible){var G=q.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(R),G.attr("r",r),G.exit().remove()}q.select("circle.outside-circle").attr({r:b}).style(R);var Y=t.select("circle.background-circle").attr({r:b}).style({fill:f.backgroundColor,stroke:f.stroke});if(f.radialAxis.visible){var W=n.svg.axis().scale(r).ticks(5).tickSize(5);q.call(W).attr({transform:"rotate("+f.radialAxis.orientation+")"}),q.selectAll(".domain").style(R),q.selectAll("g>text").text(function(t,e){return this.textContent+f.radialAxis.ticksSuffix}).style(j).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,j["font-size"]]+")":"translate("+[0,j["font-size"]]+")"}}),q.selectAll("g>line").style({stroke:"black"})}var X=t.select(".angular.axis-group").selectAll("g.angular-tick").data(P),Z=X.enter().append("g").classed("angular-tick",!0);X.attr({transform:function(t,e){return"rotate("+c(t)+")"}}).style({display:f.angularAxis.visible?"block":"none"}),X.exit().remove(),Z.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(R),Z.selectAll(".minor").style({stroke:f.minorTickColor}),X.select("line.grid-line").attr({x1:f.tickLength?b-f.tickLength:0,x2:b}).style({display:f.angularAxis.gridLinesVisible?"block":"none"}),Z.append("text").classed("axis-text",!0).style(j);var J=X.select("text.axis-text").attr({x:b+f.labelOffset,dy:a+"em",transform:function(t,e){var r=c(t),n=b+f.labelOffset,i=f.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: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(j);f.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(f.minorTicks+1)!=0?"":f.angularAxis.rewriteTicks(this.textContent,e)});var K=n.max(F.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));O.attr({transform:"translate("+[b+K,f.margin.top]+")"});var Q=t.select("g.geometry-group").selectAll("g").size()>0,$=t.select("g.geometry-group").selectAll("g.geometry").data(p);if($.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),$.exit().remove(),p[0]||Q){var tt=[];p.forEach(function(t,e){var n={};n.radialScale=r,n.angularScale=s,n.container=$.filter(function(t,r){return r==e}),n.geometry=t.geometry,n.orientation=f.orientation,n.direction=f.direction,n.index=e,tt.push({data:t,geometryConfig:n})});var et=[];n.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(tt).forEach(function(t,e){"unstacked"===t.key?et=et.concat(t.values.map(function(t,e){return[t]})):et.push(t.values)}),et.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 rt,nt,it=t.select(".guides-group"),at=t.select(".tooltips-group"),ot=o.tooltipPanel().config({container:at,fontSize:8})(),st=o.tooltipPanel().config({container:at,fontSize:8})(),lt=o.tooltipPanel().config({container:at,hasTick:!0})();if(!k){var ct=it.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(Y).angle;ct.attr({x2:-b,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-f.orientation)%360;rt=s.invert(n);var i=o.util.convertToCartesian(b+12,r+180);ot.text(o.util.round(rt)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.angular-guide",function(t,e){it.select("line").style({opacity:0})})}var ut=it.select("circle").style({stroke:"grey",fill:"none"});F.on("mousemove.radial-guide",function(t,e){var n=o.util.getMousePos(Y).radius;ut.attr({r:n}).style({opacity:.5}),nt=r.invert(o.util.getMousePos(Y).radius);var i=o.util.convertToCartesian(n,f.radialAxis.orientation);st.text(o.util.round(nt)).move([i[0]+_[0],i[1]+_[1]])}).on("mouseout.radial-guide",function(t,e){ut.style({opacity:0}),lt.hide(),ot.hide(),st.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,h=this.getBoundingClientRect(),f=t.node().getBoundingClientRect(),d=[h.left+h.width/2-U[0]-f.left,h.top+h.height/2-U[1]-f.top];lt.config({color:s}).text(u),lt.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")&&lt.show()}).on("mouseout.tooltip",function(t,e){lt.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},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]={}),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},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 i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i<a;i++)(e=t[i])in r?(r[e]++,n[e]=r[e]):r[e]=1;return n},o.util.duplicates=function(t){return Object.keys(o.util.duplicatesCount(t))},o.util.translator=function(t,e,r,n){if(n){var i=r.slice();r=e,e=i}var a=e.reduce(function(t,e){if(void 0!==t)return t[e]},t);void 0!==a&&(e.reduce(function(t,r,n){if(void 0!==t)return n===e.length-1&&delete t[r],t[r]},t),r.reduce(function(t,e,n){return void 0===t[e]&&(t[e]={}),n===r.length-1&&(t[e]=a),t[e]},t))},o.PolyChart=function(){function t(){var t=e[0].geometryConfig,r=t.container;"string"==typeof r&&(r=n.select(r)),r.datum(e).each(function(e,r){var i=!!e[0].data.yStack,o=e.map(function(t,e){return i?n.zip(t.data.t[0],t.data.r[0],t.data.yStack[0]):n.zip(t.data.t[0],t.data.r[0])}),s=t.angularScale,l=t.radialScale.domain()[0],c={};c.bar=function(r,i,a){var o=e[a].data,l=t.radialScale(r[1])-t.radialScale(0),c=t.radialScale(r[2]||0),u=o.barWidth;n.select(this).attr({class:"mark bar",d:"M"+[[l+c,-u/2],[l+c,u/2],[c,u/2],[c,-u/2]].join("L")+"Z",transform:function(e,r){return"rotate("+(t.orientation+s(e[0]))+")"}})},c.dot=function(r,i,a){var o=r[2]?[r[0],r[1]+r[2]]:r,s=n.svg.symbol().size(e[a].data.dotSize).type(e[a].data.dotType)(r,i);n.select(this).attr({class:"mark dot",d:s,transform:function(e,r){var n=function(t){return{x:t.r*Math.cos(t.t),y:t.r*Math.sin(t.t)}}(function(e,r){return{r:t.radialScale(e[1]),t:(t.angularScale(e[0])+t.orientation)*Math.PI/180}}(o));return"translate("+[n.x,n.y]+")"}})};var u=n.svg.line.radial().interpolate(e[0].data.lineInterpolation).radius(function(e){return t.radialScale(e[1])}).angle(function(e){return t.angularScale(e[0])*Math.PI/180});c.line=function(r,i,a){var s=r[2]?o[a].map(function(t,e){return[t[0],t[1]+t[2]]}):o[a];if(n.select(this).each(c.dot).style({opacity:function(t,r){return+e[a].data.dotVisible},fill:p.stroke(r,i,a)}).attr({class:"mark dot"}),!(i>0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:u(s),transform:function(e,r){return"rotate("+(t.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 h=t.angularScale.range(),f=Math.abs(h[1]-h[0])/o[0].length*Math.PI/180,d=n.svg.arc().startAngle(function(t){return-f/2}).endAngle(function(t){return f/2}).innerRadius(function(e){return t.radialScale(l+(e[2]||0))}).outerRadius(function(e){return t.radialScale(l+(e[2]||0))+t.radialScale(e[1])});c.arc=function(e,r,i){n.select(this).attr({class:"mark arc",d:d,transform:function(e,r){return"rotate("+(t.orientation+s(e[0])+90)+")"}})};var p={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,r,n){return a[e[n].data.strokeDash]},opacity:function(t,r,n){return e[n].data.opacity},display:function(t,r,n){return void 0===e[n].data.visible||e[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(p).each(c[t.geometryType]),g.exit().remove(),m.exit().remove()})}var e=[o.PolyChart.defaultConfig()],r=n.dispatch("hover"),a={solid:"none",dash:[5,2],dot:[2,5]};return t.config=function(t){return arguments.length?(t.forEach(function(t,r){e[r]||(e[r]={}),i(e[r],o.PolyChart.defaultConfig()),i(e[r],t)}),this):e},t.getColorScale=function(){},n.rebind(t,r,"on"),t},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(){function t(){var r=e.legendConfig,a=e.data.map(function(t,e){return[].concat(t).map(function(t,n){var a=i({},r.elements[e]);return a.name=t,a.color=[].concat(r.elements[e].color)[n],a})}),o=n.merge(a);o=o.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||void 0===r.elements[e].visibleInLegend)}),r.reverseOrder&&(o=o.reverse());var s=r.container;("string"==typeof s||s.nodeName)&&(s=n.select(s));var l=o.map(function(t,e){return t.color}),c=r.fontSize,u=null==r.isContinuous?"number"==typeof o[0]:r.isContinuous,h=u?r.height:c*o.length,f=s.classed("legend-group",!0).selectAll("svg").data([0]),d=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"});d.append("g").classed("legend-axis",!0),d.append("g").classed("legend-marks",!0);var p=n.range(o.length),m=n.scale[u?"linear":"ordinal"]().domain(p).range(l),g=n.scale[u?"linear":"ordinal"]().domain(p)[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:r.height,width:r.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,g(e)+c/2]+")"},d:function(t,e){return function(t,e){var r=3*e;return"line"===t?"M"+[[-e/2,-e/12],[e/2,-e/12],[e/2,e/12],[-e/2,e/12]]+"Z":-1!=n.svg.symbolTypes.indexOf(t)?n.svg.symbol().type(t).size(r)():n.svg.symbol().type("square").size(r)()}(t.symbol,c)},fill:function(t,e){return m(e)}}),y.exit().remove()}var b=n.svg.axis().scale(g).orient("right"),x=f.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:c,c/2]+")"}).call(b);return x.selectAll(".domain").style({fill:"none",stroke:"none"}),x.selectAll("line").style({fill:"none",stroke:u?r.textColor:"none"}),x.selectAll("text").style({fill:r.textColor,"font-size":r.fontSize}).text(function(t,e){return o[e].name}),t}var e=o.Legend.defaultConfig(),r=n.dispatch("hover");return t.config=function(t){return arguments.length?(i(e,t),this):e},n.rebind(t,r,"on"),t},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",h=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(h);var f=a.padding,d=e.node().getBBox(),p={fill:a.color,stroke:s,"stroke-width":"2px"},m=d.width+2*f+l,g=d.height+2*f;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(p),t.attr({transform:"translate("+[l,-g/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 i(a,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};return t.convert=function(t,e){var r={};if(t.data&&(r.data=t.data.map(function(t,r){var n=i({},t);return[[n,["marker","color"],["color"]],[n,["marker","opacity"],["opacity"]],[n,["marker","line","color"],["strokeColor"]],[n,["marker","line","dash"],["strokeDash"]],[n,["marker","line","width"],["strokeSize"]],[n,["marker","symbol"],["dotType"]],[n,["marker","size"],["dotSize"]],[n,["marker","barWidth"],["barWidth"]],[n,["line","interpolation"],["lineInterpolation"]],[n,["showlegend"],["visibleInLegend"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e||delete n.marker,e&&delete n.groupId,e?("LinePlot"===n.geometry?(n.type="scatter",!0===n.dotVisible?(delete n.dotVisible,n.mode="lines+markers"):n.mode="lines"):"DotPlot"===n.geometry?(n.type="scatter",n.mode="markers"):"AreaChart"===n.geometry?n.type="area":"BarChart"===n.geometry&&(n.type="bar"),delete n.geometry):("scatter"===n.type?"lines"===n.mode?n.geometry="LinePlot":"markers"===n.mode?n.geometry="DotPlot":"lines+markers"===n.mode&&(n.geometry="LinePlot",n.dotVisible=!0):"area"===n.type?n.geometry="AreaChart":"bar"===n.type&&(n.geometry="BarChart"),delete n.mode,delete n.type),n}),!e&&t.layout&&"stack"===t.layout.barmode)){var a=o.util.duplicates(r.data.map(function(t,e){return t.geometry}));r.data.forEach(function(t,e){var n=a.indexOf(t.geometry);-1!=n&&(r.data[e].groupId=n)})}if(t.layout){var s=i({},t.layout);if([[s,["plot_bgcolor"],["backgroundColor"]],[s,["showlegend"],["showLegend"]],[s,["radialaxis"],["radialAxis"]],[s,["angularaxis"],["angularAxis"]],[s.angularaxis,["showline"],["gridLinesVisible"]],[s.angularaxis,["showticklabels"],["labelsVisible"]],[s.angularaxis,["nticks"],["ticksCount"]],[s.angularaxis,["tickorientation"],["tickOrientation"]],[s.angularaxis,["ticksuffix"],["ticksSuffix"]],[s.angularaxis,["range"],["domain"]],[s.angularaxis,["endpadding"],["endPadding"]],[s.radialaxis,["showline"],["gridLinesVisible"]],[s.radialaxis,["tickorientation"],["tickOrientation"]],[s.radialaxis,["ticksuffix"],["ticksSuffix"]],[s.radialaxis,["range"],["domain"]],[s.angularAxis,["showline"],["gridLinesVisible"]],[s.angularAxis,["showticklabels"],["labelsVisible"]],[s.angularAxis,["nticks"],["ticksCount"]],[s.angularAxis,["tickorientation"],["tickOrientation"]],[s.angularAxis,["ticksuffix"],["ticksSuffix"]],[s.angularAxis,["range"],["domain"]],[s.angularAxis,["endpadding"],["endPadding"]],[s.radialAxis,["showline"],["gridLinesVisible"]],[s.radialAxis,["tickorientation"],["tickOrientation"]],[s.radialAxis,["ticksuffix"],["ticksSuffix"]],[s.radialAxis,["range"],["domain"]],[s.font,["outlinecolor"],["outlineColor"]],[s.legend,["traceorder"],["reverseOrder"]],[s,["labeloffset"],["labelOffset"]],[s,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,r){o.util.translator.apply(null,t.concat(e))}),e?(void 0!==s.tickLength&&(s.angularaxis.ticklen=s.tickLength,delete s.tickLength),s.tickColor&&(s.angularaxis.tickcolor=s.tickColor,delete s.tickColor)):(s.angularAxis&&void 0!==s.angularAxis.ticklen&&(s.tickLength=s.angularAxis.ticklen),s.angularAxis&&void 0!==s.angularAxis.tickcolor&&(s.tickColor=s.angularAxis.tickcolor)),s.legend&&"boolean"!=typeof s.legend.reverseOrder&&(s.legend.reverseOrder="normal"!=s.legend.reverseOrder),s.legend&&"boolean"==typeof s.legend.traceorder&&(s.legend.traceorder=s.legend.traceorder?"reversed":"normal",delete s.legend.reverseOrder),s.margin&&void 0!==s.margin.t){var l=["t","r","b","l","pad"],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},t}},{"../../constants/alignment":711,"../../lib":738,d3:123}],851:[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){function e(e,i){return i&&(h=i),n.select(n.select(h).node().parentNode).selectAll(".svg-container>*:not(.chart-root)").remove(),r=r?l(r,e):e,a||(a=o.Axis()),u=o.adapter.plotly().convert(r),a.config(u).render(h),t.data=r.data,t.layout=r.layout,c.fillLayout(t),r}var r,i,a,u,h,f=new s;return e.isPolar=!0,e.svg=function(){return a.svg()},e.getConfig=function(){return r},e.getLiveConfig=function(){return o.adapter.plotly().convert(a.getLiveConfig(),!0)},e.getLiveScales=function(){return{t:a.angularScale(),r:a.radialScale()}},e.setUndoPoint=function(){var t=this,e=o.util.cloneJson(r);!function(e,r){f.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){f.undo()},e.redo=function(){f.redo()},e},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":613,"../../lib":738,"./micropolar":850,"./undo_manager":852,d3:123}],852:[function(t,e,r){"use strict";e.exports=function(){function t(t,e){return t?(i=!0,t[e](),i=!1,this):this}var e,r=[],n=-1,i=!1;return{add:function(t){return i?this:(r.splice(n+1,r.length-n),r.push(t),n=r.length-1,this)},setCallback:function(t){e=t},undo:function(){var i=r[n];return i?(t(i,"undo"),n-=1,e&&e(i.undo),this):this},redo:function(){var i=r[n+1];return i?(t(i,"redo"),n+=1,e&&e(i.redo),this):this},clear:function(){r=[],n=-1},hasUndo:function(){return-1!==n},hasRedo:function(){return n<r.length-1},getCommands:function(){return r},getPreviousCommand:function(){return r[n-1]},getIndex:function(){return n}}}},{}],853:[function(t,e,r){"use strict";var n=t("../lib");e.exports=function(t,e,r,i){function a(t,e){return n.coerce(o,s,c,t,e)}for(var o,s,l=i.type,c=i.attributes,u=i.handleDefaults,h=i.partition||"x",f=e._subplots[l],d=f.length,p=0;p<d;p++){var m=f[p];o=t[m]?t[m]:t[m]={},e[m]=s={},a("domain."+h,[p/d,(p+1)/d]),a("domain."+{x:"y",y:"x"}[h]),i.id=m,u(o,s,a,i)}}},{"../lib":738}],854:[function(t,e,r){"use strict";var n=t("./ternary"),i=t("../../plots/get_data").getSubplotCalcData,a=t("../../lib").counterRegex;r.name="ternary",r.attr="subplot",r.idRoot="ternary",r.idRegex=r.attrRegex=a("ternary"),r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t.calcdata,a=e._subplots.ternary,o=0;o<a.length;o++){var s=a[o],l=i(r,"ternary",s),c=e[s]._subplot;c||(c=new n({id:s,graphDiv:t,container:e._ternarylayer.node()},e),e[s]._subplot=c),c.plot(l,e,t._promises)}},r.clean=function(t,e,r,n){for(var i=n._subplots.ternary||[],a=0;a<i.length;a++){var o=i[a],s=n[o]._subplot;!e[o]&&s&&(s.plotContainer.remove(),s.clipDef.remove(),s.clipDefRelative.remove())}}},{"../../lib":738,"../../plots/get_data":820,"./layout/attributes":855,"./layout/defaults":858,"./layout/layout_attributes":859,"./ternary":860}],855:[function(t,e,r){"use strict";e.exports={subplot:{valType:"subplotid",dflt:"ternary",editType:"calc"}}},{}],856:[function(t,e,r){"use strict";var n=t("../../cartesian/layout_attributes"),i=t("../../../lib/extend").extendFlat;e.exports={title:n.title,titlefont:n.titlefont,color:n.color,tickmode:n.tickmode,nticks:i({},n.nticks,{dflt:6,min:1}),tick0:n.tick0,dtick:n.dtick,tickvals:n.tickvals,ticktext:n.ticktext,ticks:n.ticks,ticklen:n.ticklen,tickwidth:n.tickwidth,tickcolor:n.tickcolor,showticklabels:n.showticklabels,showtickprefix:n.showtickprefix,tickprefix:n.tickprefix,showticksuffix:n.showticksuffix,ticksuffix:n.ticksuffix,showexponent:n.showexponent,exponentformat:n.exponentformat,separatethousands:n.separatethousands,tickfont:n.tickfont,tickangle:n.tickangle,tickformat:n.tickformat,tickformatstops:n.tickformatstops,hoverformat:n.hoverformat,showline:i({},n.showline,{dflt:!0}),linecolor:n.linecolor,linewidth:n.linewidth,showgrid:i({},n.showgrid,{dflt:!0}),gridcolor:n.gridcolor,gridwidth:n.gridwidth,layer:n.layer,min:{valType:"number",dflt:0,min:0}}},{"../../../lib/extend":727,"../../cartesian/layout_attributes":797}],857:[function(t,e,r){"use strict";var n=t("tinycolor2").mix,i=t("../../../lib"),a=t("./axis_attributes"),o=t("../../cartesian/tick_label_defaults"),s=t("../../cartesian/tick_mark_defaults"),l=t("../../cartesian/tick_value_defaults");e.exports=function(t,e,r){function c(r,n){return i.coerce(t,e,a,r,n)}e.type="linear";var u=c("color"),h=u===t.color?u:r.font.color,f=e._name.charAt(0).toUpperCase(),d="Component "+f,p=c("title",d);e._hovertitle=p===d?p:f,i.coerceFont(c,"titlefont",{family:r.font.family,size:Math.round(1.2*r.font.size),color:h}),c("min"),l(t,e,c,"linear"),o(t,e,c,"linear",{noHover:!1}),s(t,e,c,{outerTicks:!0});c("showticklabels")&&(i.coerceFont(c,"tickfont",{family:r.font.family,size:r.font.size,color:h}),c("tickangle"),c("tickformat")),c("hoverformat");c("showline")&&(c("linecolor",u),c("linewidth"));c("showgrid")&&(c("gridcolor",n(u,r.bgColor,60).toRgbString()),c("gridwidth")),c("layer")}},{"../../../lib":738,"../../cartesian/tick_label_defaults":804,"../../cartesian/tick_mark_defaults":805,"../../cartesian/tick_value_defaults":806,"./axis_attributes":856,tinycolor2:543}],858:[function(t,e,r){"use strict";function n(t,e,r,n){var a=r("bgcolor"),o=r("sum");n.bgColor=i.combine(a,n.paper_bgcolor);for(var c,u,h,f=0;f<l.length;f++)u=t[c=l[f]]||{},h=e[c]={_name:c,type:"linear"},s(u,h,n);var d=e.aaxis,p=e.baxis,m=e.caxis;d.min+p.min+m.min>=o&&(d.min=0,p.min=0,m.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var i=t("../../../components/color"),a=t("../../subplot_defaults"),o=t("./layout_attributes"),s=t("./axis_defaults"),l=["aaxis","baxis","caxis"];e.exports=function(t,e,r){a(t,e,r,{type:"ternary",attributes:o,handleDefaults:n,font:e.font,paper_bgcolor:e.paper_bgcolor})}},{"../../../components/color":613,"../../subplot_defaults":853,"./axis_defaults":857,"./layout_attributes":859}],859:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("./axis_attributes"),a=t("../../../plot_api/edit_types").overrideAll;e.exports=a({domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:i,baxis:i,caxis:i},"plot","from-root")},{"../../../components/color/attributes":612,"../../../plot_api/edit_types":769,"./axis_attributes":856}],860:[function(t,e,r){"use strict";function n(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e)}function i(t){a.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}var a=t("d3"),o=t("tinycolor2"),s=t("../../plotly"),l=t("../../lib"),c=l._,u=t("../../components/color"),h=t("../../components/drawing"),f=t("../cartesian/set_convert"),d=t("../../lib/extend").extendFlat,p=t("../plots"),m=t("../cartesian/axes"),g=t("../../components/dragelement"),v=t("../../components/fx"),y=t("../../components/titles"),b=t("../cartesian/select"),x=t("../cartesian/constants");e.exports=n;var _=n.prototype;_.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},_.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var i=0;i<t.length;i++){if(!1===t[i][0].trace.cliponaxis){this._hasClipOnAxisFalse=!0;break}}this.updateLayers(r),this.adjustLayout(r,n),p.generalUpdatePerTraceModule(this,t,r),this.layers.plotbg.select("path").call(u.fill,r.bgcolor)},_.makeFramework=function(t){var e=t[this.id],r=this.clipId="clip"+this.layoutId+this.id;this.clipDef=t._clips.selectAll("#"+r).data([0]),this.clipDef.enter().append("clipPath").attr("id",r).append("path").attr("d","M0,0Z");var n=this.clipIdRelative="clip-relative"+this.layoutId+this.id;this.clipDefRelative=t._clips.selectAll("#"+n).data([0]),this.clipDefRelative.enter().append("clipPath").attr("id",n).append("path").attr("d","M0,0Z"),this.plotContainer=this.container.selectAll("g."+this.id).data([0]),this.plotContainer.enter().append("g").classed(this.id,!0),this.updateLayers(e),h.setClipUrl(this.layers.backplot,r),h.setClipUrl(this.layers.grids,r)},_.updateLayers=function(t){var e=this.layers,r=["draglayer","plotbg","backplot","grids"];"below traces"===t.aaxis.layer&&r.push("aaxis","aline"),"below traces"===t.baxis.layer&&r.push("baxis","bline"),"below traces"===t.caxis.layer&&r.push("caxis","cline"),r.push("frontplot"),"above traces"===t.aaxis.layer&&r.push("aaxis","aline"),"above traces"===t.baxis.layer&&r.push("baxis","bline"),"above traces"===t.caxis.layer&&r.push("caxis","cline");var n=this.plotContainer.selectAll("g.toplevel").data(r,String),i=["agrid","bgrid","cgrid"];n.enter().append("g").attr("class",function(t){return"toplevel "+t}).each(function(t){var r=a.select(this);e[t]=r,"frontplot"===t?r.append("g").classed("scatterlayer",!0):"backplot"===t?r.append("g").classed("maplayer",!0):"plotbg"===t?r.append("path").attr("d","M0,0Z"):"aline"===t||"bline"===t||"cline"===t?r.append("path"):"grids"===t&&i.forEach(function(t){e[t]=r.append("g").classed("grid "+t,!0);var n="bgrid"===t?"x":"y";e[t].append("g").classed(n,!0)})}),n.order()};var w=Math.sqrt(4/3);_.adjustLayout=function(t,e){var r,n,i,a,o,s,l=this,c=t.domain,p=(c.x[0]+c.x[1])/2,m=(c.y[0]+c.y[1])/2,g=c.x[1]-c.x[0],v=c.y[1]-c.y[0],y=g*e.w,b=v*e.h,x=t.sum,_=t.aaxis.min,M=t.baxis.min,k=t.caxis.min;y>w*b?i=(a=b)*w:a=(i=y)/w,o=g*i/y,s=v*a/b,r=e.l+e.w*p-i/2,n=e.t+e.h*(1-m)-a/2,l.x0=r,l.y0=n,l.w=i,l.h=a,l.sum=x,l.xaxis={type:"linear",range:[_+2*k-x,x-_-2*M],domain:[p-o/2,p+o/2],_id:"x"},f(l.xaxis,l.graphDiv._fullLayout),l.xaxis.setScale(),l.xaxis.isPtWithinRange=function(t){return t.a>=l.aaxis.range[0]&&t.a<=l.aaxis.range[1]&&t.b>=l.baxis.range[1]&&t.b<=l.baxis.range[0]&&t.c>=l.caxis.range[1]&&t.c<=l.caxis.range[0]},l.yaxis={type:"linear",range:[_,x-M-k],domain:[m-s/2,m+s/2],_id:"y"},f(l.yaxis,l.graphDiv._fullLayout),l.yaxis.setScale(),l.yaxis.isPtWithinRange=function(){return!0};var T=l.yaxis.domain[0],A=l.aaxis=d({},t.aaxis,{visible:!0,range:[_,x-M-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[T,T+s*w],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});f(A,l.graphDiv._fullLayout),A.setScale();var S=l.baxis=d({},t.baxis,{visible:!0,range:[x-_-k,M],side:"bottom",_counterangle:30,domain:l.xaxis.domain,_axislayer:l.layers.baxis,_gridlayer:l.layers.bgrid,_counteraxis:l.aaxis,_pos:0,_id:"x",_length:i,_gridpath:"M0,0l-"+i/2+",-"+a});f(S,l.graphDiv._fullLayout),S.setScale(),A._counteraxis=S;var E=l.caxis=d({},t.caxis,{visible:!0,range:[x-_-M,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[T,T+s*w],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2});f(E,l.graphDiv._fullLayout),E.setScale();var L="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",L),l.layers.plotbg.select("path").attr("d",L);var C="M0,"+a+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDefRelative.select("path").attr("d",C);var I="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",I),l.clipDefRelative.select("path").attr("transform",null);var P="translate("+(r-S._offset)+","+(n+a)+")";l.layers.baxis.attr("transform",P),l.layers.bgrid.attr("transform",P);var D="translate("+(r+i/2)+","+n+")rotate(30)translate(0,-"+A._offset+")";l.layers.aaxis.attr("transform",D),l.layers.agrid.attr("transform",D);var z="translate("+(r+i/2)+","+n+")rotate(-30)translate(0,-"+E._offset+")";l.layers.caxis.attr("transform",z),l.layers.cgrid.attr("transform",z),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1),l.layers.aline.select("path").attr("d",A.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,A.linecolor||"#000").style("stroke-width",(A.linewidth||0)+"px"),l.layers.bline.select("path").attr("d",S.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(u.stroke,S.linecolor||"#000").style("stroke-width",(S.linewidth||0)+"px"),l.layers.cline.select("path").attr("d",E.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(u.stroke,E.linecolor||"#000").style("stroke-width",(E.linewidth||0)+"px"),l.graphDiv._context.staticPlot||l.initInteractions(),h.setClipUrl(l.layers.frontplot,l._hasClipOnAxisFalse?null:l.clipId)},_.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.aaxis,i=this.baxis,a=this.caxis;if(m.doTicks(e,n,!0),m.doTicks(e,i,!0),m.doTicks(e,a,!0),t){var o=Math.max(n.showticklabels?n.tickfont.size/2:0,(a.showticklabels?.75*a.tickfont.size:0)+("outside"===a.ticks?.87*a.ticklen:0));y.draw(e,"a"+r,{propContainer:n,propName:this.id+".aaxis.title",placeholder:c(e,"Click to enter Component A title"),attributes:{x:this.x0+this.w/2,y:this.y0-n.titlefont.size/3-o,"text-anchor":"middle"}});var s=(i.showticklabels?i.tickfont.size:0)+("outside"===i.ticks?i.ticklen:0)+3;y.draw(e,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:c(e,"Click to enter Component B title"),attributes:{x:this.x0-s,y:this.y0+this.h+.83*i.titlefont.size+s,"text-anchor":"middle"}}),y.draw(e,"c"+r,{propContainer:a,propName:this.id+".caxis.title",placeholder:c(e,"Click to enter Component C title"),attributes:{x:this.x0+this.w+s,y:this.y0+this.h+.83*a.titlefont.size+s,"text-anchor":"middle"}})}};var M=x.MINZOOM/2+.87,k="m-0.87,.5h"+M+"v3h-"+(M+5.2)+"l"+(M/2+2.6)+",-"+(.87*M+4.5)+"l2.6,1.5l-"+M/2+","+.87*M+"Z",T="m0.87,.5h-"+M+"v3h"+(M+5.2)+"l-"+(M/2+2.6)+",-"+(.87*M+4.5)+"l-2.6,1.5l"+M/2+","+.87*M+"Z",A="m0,1l"+M/2+","+.87*M+"l2.6,-1.5l-"+(M/2+2.6)+",-"+(.87*M+4.5)+"l-"+(M/2+2.6)+","+(.87*M+4.5)+"l2.6,1.5l"+M/2+",-"+.87*M+"Z",S="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",E=!0;_.initInteractions=function(){function t(t,e){return 1-e/O.h}function e(t,e){return 1-(t+(O.h-e)/Math.sqrt(3))/O.w}function r(t,e){return(t-(O.h-e)/Math.sqrt(3))/O.w}function n(n,i){var a=m+n,o=y+i,s=Math.max(0,Math.min(1,t(0,y),t(0,o))),l=Math.max(0,Math.min(1,e(m,y),e(a,o))),c=Math.max(0,Math.min(1,r(m,y),r(a,o))),u=(s/2+c)*O.w,h=(1-s/2-l)*O.w,f=(u+h)/2,d=h-u,p=(1-s)*O.h,g=p-d/w;d<x.MINZOOM?(L=_,D.attr("d",I),z.attr("d","M0,0Z")):(L={a:_.a+s*M,b:_.b+l*M,c:_.c+c*M},D.attr("d",I+"M"+u+","+p+"H"+h+"L"+f+","+g+"L"+u+","+p+"Z"),z.attr("d","M"+m+","+y+S+"M"+u+","+p+k+"M"+h+","+p+T+"M"+f+","+g+A)),P||(D.transition().style("fill",C>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),z.transition().style("opacity",1).duration(200),P=!0)}function a(){if(i(R),L!==_){var t={};t[O.id+".aaxis.min"]=L.a,t[O.id+".baxis.min"]=L.b,t[O.id+".caxis.min"]=L.c,s.relayout(R,t),E&&R.data&&R._context.showTips&&(l.notifier(c(R,"Double-click to zoom back out"),"long"),E=!1)}}function f(t,e){var r=t/O.xaxis._m,n=e/O.yaxis._m,i=[(L={a:_.a-n,b:_.b+(r+n)/2,c:_.c-(r-n)/2}).a,L.b,L.c].sort(),a=i.indexOf(L.a),o=i.indexOf(L.b),s=i.indexOf(L.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),L={a:i[a],b:i[o],c:i[s]},e=(_.a-L.a)*O.yaxis._m,t=(_.c-L.c-_.b+L.b)*O.xaxis._m);var l="translate("+(O.x0+t)+","+(O.y0+e)+")";O.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",l);var c="translate("+-t+","+-e+")";O.clipDefRelative.select("path").attr("transform",c),O.aaxis.range=[L.a,O.sum-L.b-L.c],O.baxis.range=[O.sum-L.a-L.c,L.b],O.caxis.range=[O.sum-L.a-L.b,L.c],O.drawAxes(!1),O.plotContainer.selectAll(".crisp").classed("crisp",!1),O._hasClipOnAxisFalse&&O.plotContainer.select(".scatterlayer").selectAll(".trace").call(h.hideOutsideRangePoints,O)}function d(){var t={};t[O.id+".aaxis.min"]=L.a,t[O.id+".baxis.min"]=L.b,t[O.id+".caxis.min"]=L.c,s.relayout(R,t)}function p(){j.selectAll(".select-outline").remove()}var m,y,_,M,L,C,I,P,D,z,O=this,F=O.layers.plotbg.select("path").node(),R=O.graphDiv,j=R._fullLayout._zoomlayer,N={element:F,gd:R,plotinfo:{xaxis:O.xaxis,yaxis:O.yaxis},subplot:O.id,prepFn:function(t,e,r){N.xaxes=[O.xaxis],N.yaxes=[O.yaxis];var i=R._fullLayout.dragmode;t.shiftKey&&(i="pan"===i?"zoom":"pan"),N.minDrag="lasso"===i?1:void 0,"zoom"===i?(N.moveFn=n,N.doneFn=a,function(t,e,r){var n=F.getBoundingClientRect();m=e-n.left,y=r-n.top,_={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=_,M=O.aaxis.range[1]-_.a,C=o(O.graphDiv._fullLayout[O.id].bgcolor).getLuminance(),I="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",P=!1,D=j.append("path").attr("class","zoombox").attr("transform","translate("+O.x0+", "+O.y0+")").style({fill:C>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",I),z=j.append("path").attr("class","zoombox-corners").attr("transform","translate("+O.x0+", "+O.y0+")").style({fill:u.background,stroke:u.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),p()}(0,e,r)):"pan"===i?(N.moveFn=f,N.doneFn=d,_={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=_,p()):"select"!==i&&"lasso"!==i||b(t,e,r,N,i)},clickFn:function(t,e){if(i(R),2===t){var r={};r[O.id+".aaxis.min"]=0,r[O.id+".baxis.min"]=0,r[O.id+".caxis.min"]=0,R.emit("plotly_doubleclick",null),s.relayout(R,r)}v.click(R,e,O.id)}};F.onmousemove=function(t){v.hover(R,t,O.id),R._fullLayout._lasthover=F,R._fullLayout._hoversubplot=O.id},F.onmouseout=function(t){R._dragging||g.unhover(R,t)},g.init(N)}},{"../../components/color":613,"../../components/dragelement":635,"../../components/drawing":638,"../../components/fx":655,"../../components/titles":704,"../../lib":738,"../../lib/extend":727,"../../plotly":780,"../cartesian/axes":785,"../cartesian/constants":790,"../cartesian/select":802,"../cartesian/set_convert":803,"../plots":846,d3:123,tinycolor2:543}],861:[function(t,e,r){"use strict";function n(t){if(t.layoutAttributes){var e=t.layoutAttributes._arrayAttrRegexps;if(e)for(var n=0;n<e.length;n++)u(r.layoutArrayRegexes,e[n])}}function i(t,e){var n=r.componentsRegistry[t].schema;if(n&&n.traces){var i=n.traces[e];i&&d(r.modules[e]._module.attributes,i)}}function a(t,e){var n=r.componentsRegistry[t].schema;if(n&&n.transforms){var i=n.transforms[e];i&&d(r.transformsRegistry[e].attributes,i)}}function o(t,e){var n=r.componentsRegistry[t].schema;if(n&&n.subplots){var i=r.subplotsRegistry[e],a=i.layoutAttributes,o="subplot"===i.attr?i.name:i.attr;Array.isArray(o)&&(o=o[0]);var s=n.subplots[o];a&&s&&d(a,s)}}function s(t){return"object"==typeof t&&(t=t.type),t}var l=t("./lib/loggers"),c=t("./lib/noop"),u=t("./lib/push_unique"),h=t("./lib/extend"),f=h.extendFlat,d=h.extendDeepAll,p=t("./plots/attributes"),m=t("./plots/layout_attributes");r.modules={},r.allCategories={},r.allTypes=[],r.subplotsRegistry={},r.transformsRegistry={},r.componentsRegistry={},r.layoutArrayContainers=[],r.layoutArrayRegexes=[],r.traceLayoutAttributes={},r.localeRegistry={},r.register=function(t,e,n,a){if(r.modules[e])l.log("Type "+e+" already registered");else{for(var o={},s=0;s<n.length;s++)o[n[s]]=!0,r.allCategories[n[s]]=!0;r.modules[e]={_module:t,categories:o},a&&Object.keys(a).length&&(r.modules[e].meta=a),r.allTypes.push(e);for(var c in r.componentsRegistry)i(c,e);t.layoutAttributes&&f(r.traceLayoutAttributes,t.layoutAttributes)}},r.registerSubplot=function(t){var e=t.name;if(r.subplotsRegistry[e])l.log("Plot type "+e+" already registered.");else{n(t),r.subplotsRegistry[e]=t;for(var i in r.componentsRegistry)o(i,t.name)}},r.registerComponent=function(t){var e=t.name;r.componentsRegistry[e]=t,t.layoutAttributes&&(t.layoutAttributes._isLinkedToArray&&u(r.layoutArrayContainers,e),n(t));for(var s in r.modules)i(e,s);for(var l in r.subplotsRegistry)o(e,l);for(var c in r.transformsRegistry)a(e,c);t.schema&&t.schema.layout&&d(m,t.schema.layout)},r.registerTransform=function(t){r.transformsRegistry[t.name]=t;for(var e in r.componentsRegistry)a(e,t.name)},r.getModule=function(t){if(void 0!==t.r)return l.warn("Tried to put a polar trace on an incompatible graph of cartesian data. Ignoring this dataset.",t),!1;var e=r.modules[s(t)];return!!e&&e._module},r.traceIs=function(t,e){if("various"===(t=s(t)))return!1;var n=r.modules[t];return n||(t&&"area"!==t&&l.log("Unrecognized trace type "+t+"."),n=r.modules[p.type.dflt]),!!n.categories[e]},r.getTransformIndices=function(t,e){for(var r=[],n=t.transforms||[],i=0;i<n.length;i++)n[i].type===e&&r.push(i);return r},r.hasTransform=function(t,e){for(var r=t.transforms||[],n=0;n<r.length;n++)if(r[n].type===e)return!0;return!1},r.getComponentMethod=function(t,e){var n=r.componentsRegistry[t];return n?n[e]||c:c},r.registerLocale=function(t){var e=t.name,n=e.split("-")[0],i=t.dictionary,a=t.format,o=i&&Object.keys(i).length,s=a&&Object.keys(a).length,l=r.localeRegistry,c=l[e];if(c||(l[e]=c={}),n!==e){var u=l[n];u||(l[n]=u={}),o&&u.dictionary===c.dictionary&&(u.dictionary=i),s&&u.format===c.format&&(u.format=a)}o&&(c.dictionary=i),s&&(c.format=a)}},{"./lib/extend":727,"./lib/loggers":743,"./lib/noop":747,"./lib/push_unique":751,"./plots/attributes":783,"./plots/layout_attributes":837}],862:[function(t,e,r){"use strict";function n(t){var e;switch(t){case"themes__thumb":e={autosize:!0,width:150,height:150,title:"",showlegend:!1,margin:{l:5,r:5,t:5,b:5,pad:0},annotations:[]};break;case"thumbnail":e={title:"",hidesources:!0,showlegend:!1,borderwidth:0,bordercolor:"",margin:{l:1,r:1,t:1,b:1,pad:0},annotations:[]};break;default:e={}}return e}function i(t){return["xaxis","yaxis","zaxis"].indexOf(t.slice(0,5))>-1}var a=t("../lib"),o=a.extendFlat,s=a.extendDeep;e.exports=function(t,e){t.framework&&t.framework.isPolar&&(t=t.framework.getConfig());var r,a=t.data,l=t.layout,c=s([],a),u=s({},l,n(e.tileClass)),h=t._context||{};if(e.width&&(u.width=e.width),e.height&&(u.height=e.height),"thumbnail"===e.tileClass||"themes__thumb"===e.tileClass){u.annotations=[];var f=Object.keys(u);for(r=0;r<f.length;r++)i(f[r])&&(u[f[r]].title="");for(r=0;r<c.length;r++){var d=c[r];d.showscale=!1,d.marker&&(d.marker.showscale=!1),"pie"===d.type&&(d.textposition="none")}}if(Array.isArray(e.annotations))for(r=0;r<e.annotations.length;r++)u.annotations.push(e.annotations[r]);var p=Object.keys(u).filter(function(t){return t.match(/^scene\d*$/)});if(p.length){var m={};for("thumbnail"===e.tileClass&&(m={title:"",showaxeslabels:!1,showticklabels:!1,linetickenable:!1}),r=0;r<p.length;r++){var g=u[p[r]];g.xaxis||(g.xaxis={}),g.yaxis||(g.yaxis={}),g.zaxis||(g.zaxis={}),o(g.xaxis,m),o(g.yaxis,m),o(g.zaxis,m),g._scene=null}}var v=document.createElement("div");e.tileClass&&(v.className=e.tileClass);var y={gd:v,td:v,layout:u,data:c,config:{staticPlot:void 0===e.staticPlot||e.staticPlot,plotGlPixelRatio:void 0===e.plotGlPixelRatio?2:e.plotGlPixelRatio,displaylogo:e.displaylogo||!1,showLink:e.showLink||!1,showTips:e.showTips||!1,mapboxAccessToken:h.mapboxAccessToken}};return"transparent"!==e.setBackground&&(y.config.setBackground=e.setBackground||"opaque"),y.gd.defaultLayout=n(e.tileClass),y}},{"../lib":738}],863:[function(t,e,r){"use strict";var n=t("../plot_api/to_image"),i=t("../lib"),a=t("./filesaver");e.exports=function(t,e){return e=e||{},e.format=e.format||"png",new Promise(function(r,o){t._snapshotInProgress&&o(new Error("Snapshotting already in progress.")),i.isIE()&&"svg"!==e.format&&o(new Error("Sorry IE does not support downloading from canvas. Try {format:'svg'} instead.")),t._snapshotInProgress=!0;var s=n(t,e),l=e.filename||t.fn||"newplot";l+="."+e.format,s.then(function(e){return t._snapshotInProgress=!1,a(e,l)}).then(function(t){r(t)}).catch(function(e){t._snapshotInProgress=!1,o(e)})})}},{"../lib":738,"../plot_api/to_image":778,"./filesaver":864}],864:[function(t,e,r){"use strict";e.exports=function(t,e){var r=document.createElement("a"),n="download"in r,i=/Version\/[\d\.]+.*Safari/.test(navigator.userAgent);return new Promise(function(a,o){if("undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent)&&o(new Error("IE < 10 unsupported")),i&&(document.location.href="data:application/octet-stream"+t.slice(t.search(/[,;]/)),a(e)),e||(e="download"),n&&(r.href=t,r.download=e,document.body.appendChild(r),r.click(),document.body.removeChild(r),a(e)),"undefined"!=typeof navigator&&navigator.msSaveBlob){var s=t.split(/^data:image\/svg\+xml,/)[1],l=decodeURIComponent(s);navigator.msSaveBlob(new Blob([l]),e),a(e)}o(new Error("download error"))})}},{}],865:[function(t,e,r){"use strict";r.getDelay=function(t){return t._has&&(t._has("gl3d")||t._has("gl2d"))?500:0},r.getRedrawFunc=function(t){if(!(t.data&&t.data[0]&&t.data[0].r))return function(){(t.calcdata||[]).forEach(function(t){t[0]&&t[0].t&&t[0].t.cb&&t[0].t.cb()})}}},{}],866:[function(t,e,r){"use strict";var n=t("./helpers"),i={getDelay:n.getDelay,getRedrawFunc:n.getRedrawFunc,clone:t("./cloneplot"),toSVG:t("./tosvg"),svgToImg:t("./svgtoimg"),toImage:t("./toimage"),downloadImage:t("./download")};e.exports=i},{"./cloneplot":862,"./download":863,"./helpers":865,"./svgtoimg":867,"./toimage":868,"./tosvg":869}],867:[function(t,e,r){"use strict";var n=t("../lib"),i=t("events").EventEmitter;e.exports=function(t){var e=t.emitter||new i,r=new Promise(function(i,a){var o=window.Image,s=t.svg,l=t.format||"png";if(n.isIE()&&"svg"!==l){var c=new Error("Sorry IE does not support downloading from canvas. Try {format:'svg'} instead.");return a(c),t.promise?r:e.emit("error",c)}var u=t.canvas,h=t.scale||1,f=h*(t.width||300),d=h*(t.height||150),p=u.getContext("2d"),m=new o,g="data:image/svg+xml,"+encodeURIComponent(s);u.width=f,u.height=d,m.onload=function(){var r;switch("svg"!==l&&p.drawImage(m,0,0,f,d),l){case"jpeg":r=u.toDataURL("image/jpeg");break;case"png":r=u.toDataURL("image/png");break;case"webp":r=u.toDataURL("image/webp");break;case"svg":r=g;break;default:var n="Image format is not jpeg, png, svg or webp.";if(a(new Error(n)),!t.promise)return e.emit("error",n)}i(r),t.promise||e.emit("success",r)},m.onerror=function(r){if(a(r),!t.promise)return e.emit("error",r)},m.src=g});return t.promise?r:e}},{"../lib":738,events:130}],868:[function(t,e,r){"use strict";var n=t("events").EventEmitter,i=t("../plotly"),a=t("../lib"),o=t("./helpers"),s=t("./cloneplot"),l=t("./tosvg"),c=t("./svgtoimg");e.exports=function(t,e){var r=new n,u=s(t,{format:"png"}),h=u.gd;h.style.position="absolute",h.style.left="-5000px",document.body.appendChild(h);var f=o.getRedrawFunc(h);return i.plot(h,u.data,u.layout,u.config).then(f).then(function(){var t=o.getDelay(h._fullLayout);setTimeout(function(){var t=l(h),n=document.createElement("canvas");n.id=a.randstr(),(r=c({format:e.format,width:h._fullLayout.width,height:h._fullLayout.height,canvas:n,emitter:r,svg:t})).clean=function(){h&&document.body.removeChild(h)}},t)}).catch(function(t){r.emit("error",t)}),r}},{"../lib":738,"../plotly":780,"./cloneplot":862,"./helpers":865,"./svgtoimg":867,"./tosvg":869,events:130}],869:[function(t,e,r){"use strict";var n=t("d3"),i=t("../lib"),a=t("../components/drawing"),o=t("../components/color"),s=t("../constants/xmlns_namespaces"),l=/"/g,c="TOBESTRIPPED",u=new RegExp('("'+c+")|("+c+'")',"g");e.exports=function(t,e,r){var h,f=t._fullLayout,d=f._paper,p=f._toppaper,m=f.width,g=f.height;d.insert("rect",":first-child").call(a.setRect,0,0,m,g).call(o.fill,f.paper_bgcolor);var v=f._basePlotModules||[];for(h=0;h<v.length;h++){var y=v[h];y.toSVG&&y.toSVG(t)}if(p){var b=p.node().childNodes,x=Array.prototype.slice.call(b);for(h=0;h<x.length;h++){var _=x[h];_.childNodes.length&&d.node().appendChild(_)}}f._draggers&&f._draggers.remove(),d.node().style.background="",d.selectAll("text").attr({"data-unformatted":null,"data-math":null}).each(function(){var t=n.select(this);if("hidden"!==this.style.visibility&&"none"!==this.style.display){t.style({visibility:null,display:null});var e=this.style.fontFamily;e&&-1!==e.indexOf('"')&&t.style("font-family",e.replace(l,c))}else t.remove()}),d.selectAll(".point,.scatterpts").each(function(){var t=n.select(this),e=this.style.fill;e&&-1!==e.indexOf("url(")&&t.style("fill",e.replace(l,c))}),"pdf"!==e&&"eps"!==e||d.selectAll("#MathJax_SVG_glyphs path").attr("stroke-width",0),d.node().setAttributeNS(s.xmlns,"xmlns",s.svg),d.node().setAttributeNS(s.xmlns,"xmlns:xlink",s.xlink),"svg"===e&&r&&(d.attr("width",r*m),d.attr("height",r*g),d.attr("viewBox","0 0 "+m+" "+g));var w=(new window.XMLSerializer).serializeToString(d.node());return w=function(t){var e=n.select("body").append("div").style({display:"none"}).html(""),r=t.replace(/(&[^;]*;)/gi,function(t){return"&lt;"===t?"&#60;":"&rt;"===t?"&#62;":-1!==t.indexOf("<")||-1!==t.indexOf(">")?"":e.html(t).text()});return e.remove(),r}(w),w=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&amp;")}(w),w=w.replace(u,"'"),i.isIE()&&(w=(w=(w=w.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),w}},{"../components/color":613,"../components/drawing":638,"../constants/xmlns_namespaces":719,"../lib":738,d3:123}],870:[function(t,e,r){"use strict";var n=t("../../lib").mergeArray;e.exports=function(t,e){for(var r=0;r<t.length;r++)t[r].i=r;n(e.text,t,"tx"),n(e.hovertext,t,"htx");var i=e.marker;if(i){n(i.opacity,t,"mo"),n(i.color,t,"mc");var a=i.line;a&&(n(a.color,t,"mlc"),n(a.width,t,"mlw"))}}},{"../../lib":738}],871:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../components/colorbar/attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend").extendFlat,c=s({editType:"calc",arrayOk:!0}),u=n.marker,h=l({line:l({width:l({},u.line.width,{dflt:0}),editType:"calc"},i("marker.line")),editType:"calc"},i("marker"),{showscale:u.showscale,colorbar:o,opacity:{valType:"number",arrayOk:!0,dflt:1,min:0,max:1,editType:"style"}});e.exports={x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:n.text,hovertext:n.hovertext,textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"none",arrayOk:!0,editType:"calc"},textfont:l({},c,{}),insidetextfont:l({},c,{}),outsidetextfont:l({},c,{}),constraintext:{valType:"enumerated",values:["inside","outside","both","none"],dflt:"both",editType:"calc"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},base:{valType:"any",dflt:null,arrayOk:!0,editType:"calc"},offset:{valType:"number",dflt:null,arrayOk:!0,editType:"calc"},width:{valType:"number",dflt:null,min:0,arrayOk:!0,editType:"calc"},marker:h,selected:{marker:{opacity:n.selected.marker.opacity,color:n.selected.marker.color,editType:"style"},textfont:n.selected.textfont,editType:"style"},unselected:{marker:{opacity:n.unselected.marker.opacity,color:n.unselected.marker.color,editType:"style"},textfont:n.unselected.textfont,editType:"style"},r:n.r,t:n.t,error_y:a,error_x:a,_deprecated:{bardir:{valType:"enumerated",editType:"calc",values:["v","h"]}}}},{"../../components/colorbar/attributes":614,"../../components/colorscale/color_attributes":621,"../../components/errorbars/attributes":640,"../../lib/extend":727,"../../plots/font_attributes":810,"../scatter/attributes":1054}],872:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/calc"),s=t("./arrays_to_calcdata"),l=t("../scatter/calc_selection");e.exports=function(t,e){var r,c,u,h,f,d=i.getFromId(t,e.xaxis||"x"),p=i.getFromId(t,e.yaxis||"y");"h"===(e.orientation||(e.x&&!e.y?"h":"v"))?(r=d,u=d.makeCalcdata(e,"x"),c=p.makeCalcdata(e,"y"),f=e.xcalendar):(r=p,u=p.makeCalcdata(e,"y"),c=d.makeCalcdata(e,"x"),f=e.ycalendar);var m=Math.min(c.length,u.length),g=new Array(m);for(h=0;h<m;h++)g[h]={p:c[h],s:u[h]},e.ids&&(g[h].id=String(e.ids[h]));var v,y=e.base;if(Array.isArray(y)){for(h=0;h<Math.min(y.length,g.length);h++)v=r.d2c(y[h],0,f),n(v)?(g[h].b=+v,g[h].hasB=1):g[h].b=0;for(;h<g.length;h++)g[h].b=0}else{v=r.d2c(y,0,f);var b=n(v);for(v=b?v:0,h=0;h<g.length;h++)g[h].b=v,b&&(g[h].hasB=1)}return a(e,"marker")&&o(e,e.marker.color,"marker","c"),a(e,"marker.line")&&o(e,e.marker.line.color,"marker.line","c"),s(g,e),l(g,e),g}},{"../../components/colorscale/calc":620,"../../components/colorscale/has_colorscale":627,"../../plots/cartesian/axes":785,"../scatter/calc_selection":1056,"./arrays_to_calcdata":870,"fast-isnumeric":132}],873:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("../scatter/xy_defaults"),o=t("../bar/style_defaults"),s=t("../../components/errorbars/defaults"),l=t("./attributes");e.exports=function(t,e,r,c){function u(r,i){return n.coerce(t,e,l,r,i)}var h=n.coerceFont;if(a(t,e,c,u)){u("orientation",e.x&&!e.y?"h":"v"),u("base"),u("offset"),u("width"),u("text"),u("hovertext");var f=u("textposition"),d=Array.isArray(f)||"auto"===f,p=d||"inside"===f,m=d||"outside"===f;if(p||m){var g=h(u,"textfont",c.font);p&&h(u,"insidetextfont",g),m&&h(u,"outsidetextfont",g),u("constraintext"),u("selected.textfont.color"),u("unselected.textfont.color")}o(t,e,u,r,c),s(t,e,i.defaultLine,{axis:"y"}),s(t,e,i.defaultLine,{axis:"x",inherit:"y"}),n.coerceSelectionMarkerOpacity(e,u)}else e.visible=!1}},{"../../components/color":613,"../../components/errorbars/defaults":643,"../../lib":738,"../bar/style_defaults":883,"../scatter/xy_defaults":1078,"./attributes":871}],874:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../components/errorbars"),a=t("../../components/color"),o=t("../scatter/fill_hover_text");e.exports=function(t,e,r,s){function l(t){return t[p]-t.w/2}function c(t){return t[p]+t.w/2}function u(t){return n.inbox(w(t)-f,M(t)-f)}function h(t){return n.inbox(t.b-d,t[m]-d)+(t[m]-d)/(t[m]-t.b)}var f,d,p,m,g,v,y=t.cd,b=y[0].trace,x=y[0].t,_="closest"===s,w=_?l:function(t){return Math.min(l(t),t.p-x.bardelta/2)},M=_?c:function(t){return Math.max(c(t),t.p+x.bardelta/2)};"h"===b.orientation?(f=r,d=e,p="y",m="x",g=h,v=u):(f=e,d=r,p="x",m="y",v=h,g=u);var k=t[p+"a"],T=t[m+"a"],A=n.getDistanceFunction(s,g,v);if(n.getClosest(y,A,t),!1!==t.index){_||(w=function(t){return Math.min(l(t),t.p-x.bargroupwidth/2)},M=function(t){return Math.max(c(t),t.p+x.bargroupwidth/2)});var S=y[t.index],E=S.mcc||b.marker.color,L=S.mlcc||b.marker.line.color,C=S.mlw||b.marker.line.width;a.opacity(E)?t.color=E:a.opacity(L)&&C&&(t.color=L);var I=b.base?S.b+S.s:S.s;return t[m+"0"]=t[m+"1"]=T.c2p(S[m],!0),t[m+"LabelVal"]=I,t[p+"0"]=k.c2p(w(S),!0),t[p+"1"]=k.c2p(M(S),!0),t[p+"LabelVal"]=S.p,o(S,b,t),i.hoverInfo(S,b,t),[t]}}},{"../../components/color":613,"../../components/errorbars":644,"../../components/fx":655,"../scatter/fill_hover_text":1062}],875:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.calc=t("./calc"),n.setPositions=t("./set_positions"),n.colorbar=t("../scatter/colorbar"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="bar",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","oriented","markerColorscale","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"../scatter/colorbar":1058,"./arrays_to_calcdata":870,"./attributes":871,"./calc":872,"./defaults":873,"./hover":874,"./layout_attributes":876,"./layout_defaults":877,"./plot":878,"./select":879,"./set_positions":880,"./style":882}],876:[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"}}},{}],877:[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,h={},f=0;f<r.length;f++){var d=r[f];if(n.traceIs(d,"bar")){if(l=!0,"overlay"!==t.barmode&&"stack"!==t.barmode){var p=d.xaxis+d.yaxis;h[p]&&(u=!0),h[p]=!0}if(d.visible&&"histogram"===d.type){"category"!==i.getFromId({_fullLayout:e},d["v"===d.orientation?"xaxis":"yaxis"]).type&&(c=!0)}}}if(l){"overlay"!==s("barmode")&&s("barnorm"),s("bargap",c&&!u?0:.2),s("bargroupgap")}}},{"../../lib":738,"../../plots/cartesian/axes":785,"../../registry":861,"./layout_attributes":876}],878:[function(t,e,r){"use strict";function n(t,e,r,n,l,c,u,h){function d(e,r,n){return e.append("text").text(r).attr({class:"bartext bartext-"+m,transform:"","text-anchor":"middle","data-notex":1}).call(p.font,n).call(f.convertToTspans,t)}var m,g=r[0].trace,M=g.orientation,k=function(t,e){var r=o(t.text,e);return s(v,r)}(g,n);if(k&&"none"!==(m=function(t,e){var r=o(t.textposition,e);return function(t,e,r){t.coerceNumber&&(e=+e);return-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt}(y,r)}(g,n))){var T,A,S,E,L=function(t,e,r){return a(b,t.textfont,e,r)}(g,n,t._fullLayout.font),C=function(t,e,r){return a(x,t.insidetextfont,e,r)}(g,n,L),I=function(t,e,r){return a(_,t.outsidetextfont,e,r)}(g,n,L),P=t._fullLayout.barmode,D="stack"===P||"relative"===P,z=r[n],O=!D||z._outmost,F=Math.abs(c-l)-2*w,R=Math.abs(h-u)-2*w;if("outside"===m&&(O||(m="inside")),"auto"===m)if(O){m="inside",T=d(e,k,C),S=(A=p.bBox(T.node())).width,E=A.height;S>0&&E>0&&(S<=F&&E<=R||S<=R&&E<=F||("h"===M?F>=S*(R/E):R>=E*(F/S)))?m="inside":(m="outside",T.remove(),T=null)}else m="inside";if(!T&&(T=d(e,k,"outside"===m?I:C),A=p.bBox(T.node()),S=A.width,E=A.height,S<=0||E<=0))T.remove();else{var j;j="outside"===m?function(t,e,r,n,a,o,s){var l,c="h"===o?Math.abs(n-r):Math.abs(e-t);c>2*w&&(l=w);var u=1;s&&(u="h"===o?Math.min(1,c/a.height):Math.min(1,c/a.width));var h,f,d,p,m=(a.left+a.right)/2,g=(a.top+a.bottom)/2;h=u*a.width,f=u*a.height,"h"===o?e<t?(d=e-l-h/2,p=(r+n)/2):(d=e+l+h/2,p=(r+n)/2):n>r?(d=(t+e)/2,p=n+l+f/2):(d=(t+e)/2,p=n-l-f/2);return i(m,g,d,p,u,!1)}(l,c,u,h,A,M,"both"===g.constraintext||"outside"===g.constraintext):function(t,e,r,n,a,o,s){var l,c,u,h,f,d=a.width,p=a.height,m=(a.left+a.right)/2,g=(a.top+a.bottom)/2,v=Math.abs(e-t),y=Math.abs(n-r);v>2*w&&y>2*w?(v-=2*(f=w),y-=2*f):f=0;var b,x;d<=v&&p<=y?(b=!1,x=1):d<=y&&p<=v?(b=!0,x=1):d<p==v<y?(b=!1,x=s?Math.min(v/d,y/p):1):(b=!0,x=s?Math.min(y/d,v/p):1);b&&(b=90);b?(l=x*p,c=x*d):(l=x*d,c=x*p);"h"===o?e<t?(u=e+f+l/2,h=(r+n)/2):(u=e-f-l/2,h=(r+n)/2):n>r?(u=(t+e)/2,h=n-f-c/2):(u=(t+e)/2,h=n+f+c/2);return i(m,g,u,h,x,b)}(l,c,u,h,A,M,"both"===g.constraintext||"inside"===g.constraintext),T.attr("transform",j)}}}function i(t,e,r,n,i,a){var o;i<1?o="scale("+i+") ":(i=1,o="");return"translate("+(r-i*t)+" "+(n-i*e)+")"+o+(a?"rotate("+a+" "+t+" "+e+") ":"")}function a(t,e,r,n){var i=o((e=e||{}).family,r),a=o(e.size,r),l=o(e.color,r);return{family:s(t.family,i,n.family),size:function(t,e,r){if(c(e)){e=+e;var n=t.min,i=t.max,a=void 0!==n&&e<n||void 0!==i&&e>i;if(!a)return e}return void 0!==r?r:t.dflt}(t.size,a,n.size),color:function(t,e,r){return u(e).isValid()?e:void 0!==r?r:t.dflt}(t.color,l,n.color)}}function o(t,e){var r;return Array.isArray(t)?e<t.length&&(r=t[e]):r=t,r}function s(t,e,r){if("string"==typeof e){if(e||!t.noBlank)return e}else if("number"==typeof e&&!t.strict)return String(e);return void 0!==r?r:t.dflt}var l=t("d3"),c=t("fast-isnumeric"),u=t("tinycolor2"),h=t("../../lib"),f=t("../../lib/svg_text_utils"),d=t("../../components/color"),p=t("../../components/drawing"),m=t("../../components/errorbars"),g=t("./attributes"),v=g.text,y=g.textposition,b=g.textfont,x=g.insidetextfont,_=g.outsidetextfont,w=3;e.exports=function(t,e,r){var i=e.xaxis,a=e.yaxis,o=t._fullLayout,s=e.plot.select(".barlayer").selectAll("g.trace.bars").data(r);s.enter().append("g").attr("class","trace bars"),s.each(function(t){t[0].node3=l.select(this)}),s.append("g").attr("class","points").each(function(e){var r=l.select(this),s=e[0].t,u=e[0].trace,f=s.poffset,p=Array.isArray(f);r.selectAll("g.point").data(h.identity).enter().append("g").classed("point",!0).each(function(r,s){function h(t){return 0===o.bargap&&0===o.bargroupgap?l.round(Math.round(t)-T,2):t}function m(t,e){return Math.abs(t-e)>=2?h(t):t>e?Math.ceil(t):Math.floor(t)}var g,v,y,b,x=r.p+(p?f[s]:f),_=x+r.w,w=r.b,M=w+r.s;if("h"===u.orientation?(y=a.c2p(x,!0),b=a.c2p(_,!0),g=i.c2p(w,!0),v=i.c2p(M,!0),r.ct=[v,(y+b)/2]):(g=i.c2p(x,!0),v=i.c2p(_,!0),y=a.c2p(w,!0),b=a.c2p(M,!0),r.ct=[(g+v)/2,b]),c(g)&&c(v)&&c(y)&&c(b)&&g!==v&&y!==b){var k=(r.mlw+1||u.marker.line.width+1||(r.trace?r.trace.marker.line.width:0)+1)-1,T=l.round(k/2%1,2);if(!t._context.staticPlot){var A=d.opacity(r.mc||u.marker.color)<1||k>.01?h:m;v=A(v,g=A(g,v)),b=A(b,y=A(y,b))}var S=l.select(this);S.append("path").style("vector-effect","non-scaling-stroke").attr("d","M"+g+","+y+"V"+b+"H"+v+"V"+y+"Z"),n(t,S,e,s,g,v,y,b)}else l.select(this).remove()})}),s.call(m.plot,e)}},{"../../components/color":613,"../../components/drawing":638,"../../components/errorbars":644,"../../lib":738,"../../lib/svg_text_utils":761,"./attributes":871,d3:123,"fast-isnumeric":132,tinycolor2:543}],879:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n=t.cd,i=t.xaxis,a=t.yaxis,o=[];if(!1===e)for(r=0;r<n.length;r++)n[r].selected=0;else for(r=0;r<n.length;r++){var s=n[r];e.contains(s.ct)?(o.push({pointNumber:r,x:i.c2d(s.x),y:a.c2d(s.y)}),s.selected=1):s.selected=0}return o}},{}],880:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.length){var g,b,x,_,w=t._fullLayout.barmode,M="group"===w;if("overlay"===w)i(t,e,r,n);else if(M){for(g=[],b=[],x=0;x<n.length;x++)void 0===(_=n[x])[0].trace.offset?b.push(_):g.push(_);b.length&&function(t,e,r,n){var i=t._fullLayout.barnorm,a=new y(n,!1,!i);(function(t,e,r){var n,i,a,c,u=t._fullLayout,h=u.bargap,f=u.bargroupgap,d=r.positions,p=r.distinctPositions,m=r.minDiff,g=r.traces,v=d.length!==p.length,y=g.length,b=m*(1-h),x=v?b/y:b,_=x*(1-f);for(n=0;n<y;n++){i=g[n],a=i[0];var w=v?((2*n+1-y)*x-_)/2:-_/2;(c=a.t).barwidth=_,c.poffset=w,c.bargroupwidth=b,c.bardelta=m}r.binWidth=g[0][0].t.barwidth/100,o(r),s(t,e,r),l(t,e,r,v)})(t,e,a),i?(h(t,r,a),f(t,r,a)):u(t,r,a)}(t,e,r,b),g.length&&i(t,e,r,g)}else{for(g=[],b=[],x=0;x<n.length;x++)void 0===(_=n[x])[0].trace.base?b.push(_):g.push(_);b.length&&function(t,e,r,n){var i=t._fullLayout.barmode,o="stack"===i,s="relative"===i,l=t._fullLayout.barnorm,u=new y(n,s,!(l||o||s));a(t,e,u),function(t,e,r){var n,i,a,o,s=t._fullLayout.barnorm,l=d(e),u=r.traces,h=[null,null];for(n=0;n<u.length;n++)for(i=u[n],a=0;a<i.length;a++)if((o=i[a]).s!==m){var f=r.put(o.p,o.b+o.s),g=f+o.b+o.s;o.b=f,o[l]=g,s||(p(e.c2l(g))&&c(h,g),o.hasB&&p(e.c2l(f))&&c(h,f))}s||v.expand(e,h,{tozero:!0,padded:!0})}(t,r,u);for(var h=0;h<n.length;h++)for(var g=n[h],b=0;b<g.length;b++){var x=g[b];if(x.s!==m){var _=x.b+x.s===u.get(x.p,x.s);_&&(x._outmost=!0)}}l&&f(t,r,u)}(t,e,r,b),g.length&&i(t,e,r,g)}}}function i(t,e,r,n){for(var i=t._fullLayout.barnorm,o=!i,s=0;s<n.length;s++){var l=n[s],c=new y([l],!1,o);a(t,e,c),i?(h(t,r,c),f(t,r,c)):u(t,r,c)}}function a(t,e,r){var n,i,a=t._fullLayout,c=a.bargap,u=a.bargroupgap,h=r.minDiff,f=r.traces,d=h*(1-c),p=d*(1-u),m=-p/2;for(n=0;n<f.length;n++)(i=f[n][0].t).barwidth=p,i.poffset=m,i.bargroupwidth=d,i.bardelta=h;r.binWidth=f[0][0].t.barwidth/100,o(r),s(t,e,r),l(t,e,r)}function o(t){var e,r,n,i,a,o,s=t.traces;for(e=0;e<s.length;e++){i=(n=(r=s[e])[0]).trace,o=n.t;var l,c=i.offset,u=o.poffset;if(Array.isArray(c)){for(l=c.slice(0,r.length),a=0;a<l.length;a++)p(l[a])||(l[a]=u);for(a=l.length;a<r.length;a++)l.push(u);o.poffset=l}else void 0!==c&&(o.poffset=c);var h=i.width,f=o.barwidth;if(Array.isArray(h)){var d=h.slice(0,r.length);for(a=0;a<d.length;a++)p(d[a])||(d[a]=f);for(a=d.length;a<r.length;a++)d.push(f);if(o.barwidth=d,void 0===c){for(l=[],a=0;a<r.length;a++)l.push(u+(f-d[a])/2);o.poffset=l}}else void 0!==h&&(o.barwidth=h,void 0===c&&(o.poffset=u+(f-h)/2))}}function s(t,e,r){for(var n=r.traces,i=d(e),a=0;a<n.length;a++)for(var o=n[a],s=o[0].t,l=s.poffset,c=Array.isArray(l),u=s.barwidth,h=Array.isArray(u),f=0;f<o.length;f++){var p=o[f],m=p.w=h?u[f]:u;p[i]=p.p+(c?l[f]:l)+m/2}}function l(t,e,r,n){var i=r.traces,a=r.distinctPositions,o=a[0],s=r.minDiff,l=s/2;v.minDtick(e,s,o,n);for(var c=Math.min.apply(Math,a)-l,u=Math.max.apply(Math,a)+l,h=0;h<i.length;h++){var f=i[h],d=f[0],p=d.trace;if(void 0!==p.width||void 0!==p.offset)for(var m=d.t,g=m.poffset,y=m.barwidth,b=Array.isArray(g),x=Array.isArray(y),_=0;_<f.length;_++){var w=f[_],M=b?g[_]:g,k=x?y[_]:y,T=w.p+M,A=T+k;c=Math.min(c,T),u=Math.max(u,A)}}v.expand(e,[c,u],{padded:!1})}function c(t,e){p(t[0])?t[0]=Math.min(t[0],e):t[0]=e,p(t[1])?t[1]=Math.max(t[1],e):t[1]=e}function u(t,e,r){for(var n=r.traces,i=d(e),a=[null,null],o=0;o<n.length;o++)for(var s=n[o],l=0;l<s.length;l++){var u=s[l],h=u.b,f=h+u.s;u[i]=f,p(e.c2l(f))&&c(a,f),u.hasB&&p(e.c2l(h))&&c(a,h)}v.expand(e,a,{tozero:!0,padded:!0})}function h(t,e,r){for(var n=r.traces,i=0;i<n.length;i++)for(var a=n[i],o=0;o<a.length;o++){var s=a[o];s.s!==m&&r.put(s.p,s.b+s.s)}}function f(t,e,r){function n(t){p(e.c2l(t))&&(t<l-s||t>u+s||!p(l))&&(f=!0,c(h,t))}for(var i=r.traces,a=d(e),o="fraction"===t._fullLayout.barnorm?1:100,s=o/1e9,l=e.l2c(e.c2l(0)),u="stack"===t._fullLayout.barmode?o:l,h=[l,u],f=!1,g=0;g<i.length;g++)for(var y=i[g],b=0;b<y.length;b++){var x=y[b];if(x.s!==m){var _=Math.abs(o/r.get(x.p,x.s));x.b*=_,x.s*=_;var w=x.b,M=w+x.s;x[a]=M,n(M),x.hasB&&n(w)}}v.expand(e,h,{tozero:!0,padded:f})}function d(t){return t._id.charAt(0)}var p=t("fast-isnumeric"),m=t("../../constants/numerical").BADNUM,g=t("../../registry"),v=t("../../plots/cartesian/axes"),y=t("./sieve.js");e.exports=function(t,e){var r,i=e.xaxis,a=e.yaxis,o=t._fullData,s=t.calcdata,l=[],c=[];for(r=0;r<o.length;r++){var u=o[r];!0===u.visible&&g.traceIs(u,"bar")&&u.xaxis===i._id&&u.yaxis===a._id&&("h"===u.orientation?l.push(s[r]):c.push(s[r]))}n(t,i,a,c),n(t,a,i,l)}},{"../../constants/numerical":717,"../../plots/cartesian/axes":785,"../../registry":861,"./sieve.js":881,"fast-isnumeric":132}],881:[function(t,e,r){"use strict";function n(t,e,r){this.traces=t,this.separateNegativeValues=e,this.dontMergeOverlappingData=r;for(var n=1/0,o=[],s=0;s<t.length;s++){for(var l=t[s],c=0;c<l.length;c++){var u=l[c];u.p!==a&&o.push(u.p)}l[0]&&l[0].width1&&(n=Math.min(l[0].width1,n))}this.positions=o;var h=i.distinctVals(o);this.distinctPositions=h.vals,1===h.vals.length&&n!==1/0?this.minDiff=n:this.minDiff=Math.min(h.minDiff,n),this.binWidth=this.minDiff,this.bins={}}e.exports=n;var i=t("../../lib"),a=t("../../constants/numerical").BADNUM;n.prototype.put=function(t,e){var r=this.getLabel(t,e),n=this.bins[r]||0;return this.bins[r]=n+e,n},n.prototype.get=function(t,e){var r=this.getLabel(t,e);return this.bins[r]||0},n.prototype.getLabel=function(t,e){return(e<0&&this.separateNegativeValues?"v":"^")+(this.dontMergeOverlappingData?t:Math.round(t/this.binWidth))}},{"../../constants/numerical":717,"../../lib":738}],882:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("../../components/errorbars");e.exports=function(t,e){var r=e?e[0].node3:n.select(t).selectAll("g.trace.bars"),o=r.size(),s=t._fullLayout;r.style("opacity",function(t){return t[0].trace.opacity}).each(function(t){("stack"===s.barmode&&o>1||0===s.bargap&&0===s.bargroupgap&&!t[0].trace.marker.line.width)&&n.select(this).attr("shape-rendering","crispEdges")}),r.selectAll("g.points").each(function(e){var r=n.select(this),a=r.selectAll("path"),o=r.selectAll("text"),s=e[0].trace;i.pointStyle(a,s,t),i.selectedPointStyle(a,s),o.each(function(t){function e(e){var n=r[e];return Array.isArray(n)?n[t.i]:n}var r,a=n.select(this);a.classed("bartext-inside")?r=s.insidetextfont:a.classed("bartext-outside")&&(r=s.outsidetextfont),r||(r=s.textfont),i.font(a,e("family"),e("size"),e("color"))}),i.selectedTextStyle(o,s)}),a.style(r)}},{"../../components/drawing":638,"../../components/errorbars":644,d3:123}],883:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),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":613,"../../components/colorscale/defaults":623,"../../components/colorscale/has_colorscale":627}],884:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/color/attributes"),a=t("../../lib/extend").extendFlat,o=n.marker,s=o.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"},name:{valType:"string",editType:"calc+clearAxisTypes"},text:a({},n.text,{}),whiskerwidth:{valType:"number",min:0,max:1,dflt:.5,editType:"calcIfAutorange"},boxpoints:{valType:"enumerated",values:["all","outliers","suspectedoutliers",!1],dflt:"outliers",editType:"calcIfAutorange"},boxmean:{valType:"enumerated",values:[!0,"sd",!1],dflt:!1,editType:"calcIfAutorange"},jitter:{valType:"number",min:0,max:1,editType:"calcIfAutorange"},pointpos:{valType:"number",min:-2,max:2,editType:"calcIfAutorange"},orientation:{valType:"enumerated",values:["v","h"],editType:"calc+clearAxisTypes"},marker:{outliercolor:{valType:"color",dflt:"rgba(0, 0, 0, 0)",editType:"style"},symbol:a({},o.symbol,{arrayOk:!1,editType:"plot"}),opacity:a({},o.opacity,{arrayOk:!1,dflt:1,editType:"style"}),size:a({},o.size,{arrayOk:!1,editType:"calcIfAutorange"}),color:a({},o.color,{arrayOk:!1,editType:"style"}),line:{color:a({},s.color,{arrayOk:!1,dflt:i.defaultLine,editType:"style"}),width:a({},s.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,selected:{marker:n.selected.marker,editType:"style"},unselected:{marker:n.unselected.marker,editType:"style"},hoveron:{valType:"flaglist",flags:["boxes","points"],dflt:"boxes+points",editType:"style"}}},{"../../components/color/attributes":612,"../../lib/extend":727,"../scatter/attributes":1054}],885:[function(t,e,r){"use strict";function n(t,e){return t.v-e.v}function i(t){return t.v}var a=t("fast-isnumeric"),o=t("../../lib"),s=o._,l=t("../../plots/cartesian/axes");e.exports=function(t,e){var r,c,u,h,f,d=t._fullLayout,p=l.getFromId(t,e.xaxis||"x"),m=l.getFromId(t,e.yaxis||"y"),g=[],v="violin"===e.type?"_numViolins":"_numBoxes";"h"===e.orientation?(c=p,u="x",h=m,f="y"):(c=m,u="y",h=p,f="x");var y=c.makeCalcdata(e,u),b=function(t,e,r,n,i){if(e in t)return r.makeCalcdata(t,e);var s;s=e+"0"in t?t[e+"0"]:"name"in t&&("category"===r.type||a(t.name)&&-1!==["linear","log"].indexOf(r.type)||o.isDateTime(t.name)&&"date"===r.type)?t.name:i;var l=r.d2c(s,0,t[e+"calendar"]);return n.map(function(){return l})}(e,f,h,y,d[v]),x=o.distinctVals(b),_=x.vals,w=x.minDiff/2,M=function(t,e){for(var r=t.length,n=new Array(r+1),i=0;i<r;i++)n[i]=t[i]-e;return n[r]=t[r-1]+e,n}(_,w),k=y.length,T=_.length,A=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=[];return e}(T);for(r=0;r<k;r++){var S=y[r];if(a(S)){var E=o.findBin(b[r],M);if(E>=0&&E<T){var L={v:S,i:r};!function(t,e,r){var n={text:"tx"};for(var i in n)Array.isArray(e[i])&&(t[n[i]]=e[i][r])}(L,e,r),A[E].push(L)}}}for(r=0;r<T;r++)if(A[r].length>0){var C=A[r].sort(n),I=C.map(i),P=I.length,D={pos:_[r],pts:C};D.min=I[0],D.max=I[P-1],D.mean=o.mean(I,P),D.sd=o.stdev(I,P,D.mean),D.q1=o.interp(I,.25),D.med=o.interp(I,.5),D.q3=o.interp(I,.75),D.lf=Math.min(D.q1,I[Math.min(o.findBin(2.5*D.q1-1.5*D.q3,I,!0)+1,P-1)]),D.uf=Math.max(D.q3,I[Math.max(o.findBin(2.5*D.q3-1.5*D.q1,I),0)]),D.lo=4*D.q1-3*D.q3,D.uo=4*D.q3-3*D.q1,g.push(D)}return function(t,e){if(Array.isArray(e.selectedpoints))for(var r=0;r<t.length;r++){for(var n=t[r].pts||[],i={},a=0;a<n.length;a++)i[n[a].i]=a;o.tagSelected(n,e,i)}}(g,e),l.expand(c,y,{padded:!0}),g.length>0?(g[0].t={num:d[v],dPos:w,posLetter:f,valLetter:u,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:")}},d[v]++,g):[{t:{empty:!0}}]}},{"../../lib":738,"../../plots/cartesian/axes":785,"fast-isnumeric":132}],886:[function(t,e,r){"use strict";function n(t,e,r,n){var i,a=r("y"),s=r("x");if(a&&a.length)i="v",s||r("x0");else{if(!s||!s.length)return void(e.visible=!1);i="h",r("y0")}o.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],n),r("orientation",i)}function i(t,e,r,n){var i=n.prefix,o=a.coerce2(t,e,l,"marker.outliercolor"),s=r("marker.line.outliercolor"),c=r(i+"points",o||s?"suspectedoutliers":void 0);c?(r("jitter","all"===c?.3:0),r("pointpos","all"===c?-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"===c&&(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")):delete e.marker,r("hoveron"),a.coerceSelectionMarkerOpacity(e,r)}var a=t("../../lib"),o=t("../../registry"),s=t("../../components/color"),l=t("./attributes");e.exports={supplyDefaults:function(t,e,r,o){function c(r,n){return a.coerce(t,e,l,r,n)}n(t,e,c,o),!1!==e.visible&&(c("line.color",(t.marker||{}).color||r),c("line.width"),c("fillcolor",s.addOpacity(e.line.color,.5)),c("whiskerwidth"),c("boxmean"),i(t,e,c,{prefix:"box"}))},handleSampleDefaults:n,handlePointsDefaults:i}},{"../../components/color":613,"../../lib":738,"../../registry":861,"./attributes":884}],887:[function(t,e,r){"use strict";function n(t,e,r,n){var i,c,u,h,f,d,p,m,g,v=t.cd,y=t.xa,b=t.ya,x=v[0].trace,_=v[0].t,w="violin"===x.type,M=[],k="closest"!==n||w?_.bdPos:2.5*_.bdPos,T=function(t){return t.pos+_.bPos-d};w&&"both"!==x.side?("positive"===x.side&&(g=function(t){var e=T(t);return s.inbox(e,e+k)}),"negative"===x.side&&(g=function(t){var e=T(t);return s.inbox(e-k,e)})):g=function(t){var e=T(t);return s.inbox(e-k,e+k)};var A;A=w?function(t){return s.inbox(t.span[0]-f,t.span[1]-f)}:function(t){return s.inbox(t.min-f,t.max-f)},"h"===x.orientation?(f=e,d=r,p=A,m=g,i="y",u=b,c="x",h=y):(f=r,d=e,p=g,m=A,i="x",u=y,c="y",h=b);var S=s.getDistanceFunction(n,p,m);if(s.getClosest(v,S,t),!1===t.index)return[];var E=v[t.index],L=x.line.color,C=(x.marker||{}).color;l.opacity(L)&&x.line.width?t.color=L:l.opacity(C)&&x.boxpoints?t.color=C:t.color=x.fillcolor,t[i+"0"]=u.c2p(E.pos+_.bPos-_.bdPos,!0),t[i+"1"]=u.c2p(E.pos+_.bPos+_.bdPos,!0),a.tickText(u,u.c2l(E.pos),"hover").text,t[i+"LabelVal"]=E.pos;var I={},P=["med","min","q1","q3","max"];(x.boxmean||(x.meanline||{}).visible)&&P.push("mean"),(x.boxpoints||x.points)&&P.push("lf","uf");for(var D=0;D<P.length;D++){var z=P[D];if(z in E&&!(E[z]in I)){I[E[z]]=!0;var O=E[z],F=h.c2p(O,!0),R=o.extendFlat({},t);R[c+"0"]=R[c+"1"]=F,R[c+"LabelVal"]=O,R[c+"Label"]=_.labels[z]+" "+a.hoverLabelText(h,O),"mean"===z&&"sd"in E&&"sd"===x.boxmean&&(R[c+"err"]=E.sd),t.name="",M.push(R)}}return M}function i(t,e,r){for(var n,i,a,l=t.cd,u=t.xa,h=t.ya,f=l[0].trace,d=u.c2p(e),p=h.c2p(r),m=s.quadrature(function(t){var e=Math.max(3,t.mrc||0);return Math.max(Math.abs(u.c2p(t.x)-d)-e,1-3/e)},function(t){var e=Math.max(3,t.mrc||0);return Math.max(Math.abs(h.c2p(t.y)-p)-e,1-3/e)}),g=!1,v=0;v<l.length;v++){i=l[v];for(var y=0;y<(i.pts||[]).length;y++){var b=m(a=i.pts[y]);b<=t.distance&&(t.distance=b,g=[v,y])}}if(!g)return!1;a=(i=l[g[0]]).pts[g[1]];var x=u.c2p(a.x,!0),_=h.c2p(a.y,!0),w=a.mrc||1;return n=o.extendFlat({},t,{index:a.i,color:(f.marker||{}).color,name:f.name,x0:x-w,x1:x+w,xLabelVal:a.x,y0:_-w,y1:_+w,yLabelVal:a.y}),c(a,f,n),n}var a=t("../../plots/cartesian/axes"),o=t("../../lib"),s=t("../../components/fx"),l=t("../../components/color"),c=t("../scatter/fill_hover_text");e.exports={hoverPoints:function(t,e,r,a){var o,s=t.cd[0].trace.hoveron,l=[];return-1!==s.indexOf("boxes")&&(l=l.concat(n(t,e,r,a))),-1!==s.indexOf("points")&&(o=i(t,e,r)),"closest"===a?o?[o]:l:o?(l.push(o),l):l},hoverOnBoxes:n,hoverOnPoints:i}},{"../../components/color":613,"../../components/fx":655,"../../lib":738,"../../plots/cartesian/axes":785,"../scatter/fill_hover_text":1062}],888:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("./layout_attributes"),n.supplyDefaults=t("./defaults").supplyDefaults,n.supplyLayoutDefaults=t("./layout_defaults").supplyLayoutDefaults,n.calc=t("./calc"),n.setPositions=t("./set_positions").setPositions,n.plot=t("./plot").plot,n.style=t("./style"),n.hoverPoints=t("./hover").hoverPoints,n.selectPoints=t("./select"),n.moduleType="trace",n.name="box",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","oriented","box-violin","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"./attributes":884,"./calc":885,"./defaults":886,"./hover":887,"./layout_attributes":889,"./layout_defaults":890,"./plot":891,"./select":892,"./set_positions":893,"./style":894}],889:[function(t,e,r){"use strict";e.exports={boxmode:{valType:"enumerated",values:["group","overlay"],dflt:"overlay",editType:"calc"},boxgap:{valType:"number",min:0,max:1,dflt:.3,editType:"calc"},boxgroupgap:{valType:"number",min:0,max:1,dflt:.3,editType:"calc"}}},{}],890:[function(t,e,r){"use strict";function n(t,e,r,n,i){for(var a,o=0;o<r.length;o++)if(r[o].type===i){a=!0;break}a&&(n(i+"mode"),n(i+"gap"),n(i+"groupgap"))}var i=t("../../lib"),a=t("./layout_attributes");e.exports={supplyLayoutDefaults:function(t,e,r){n(0,0,r,function(r,n){return i.coerce(t,e,a,r,n)},"box")},_supply:n}},{"../../lib":738,"./layout_attributes":889}],891:[function(t,e,r){"use strict";function n(){var t=u;return u=(69069*u+1)%4294967296,Math.abs(u-t)<429496729?n():u/4294967296}function i(t,e,r,n){var i,a,o=e.pos,c=e.val,u=n.bPos,h=n.wdPos||0,f=n.bPosPxOffset||0,d=r.whiskerwidth||0;Array.isArray(n.bdPos)?(i=n.bdPos[0],a=n.bdPos[1]):(i=n.bdPos,a=n.bdPos),t.selectAll("path.box").data(l.identity).enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","box").each(function(t){var e=t.pos,n=o.c2p(e+u,!0)+f,p=o.c2p(e+u-i,!0)+f,m=o.c2p(e+u+a,!0)+f,g=o.c2p(e+u-h,!0)+f,v=o.c2p(e+u+h,!0)+f,y=c.c2p(t.q1,!0),b=c.c2p(t.q3,!0),x=l.constrain(c.c2p(t.med,!0),Math.min(y,b)+1,Math.max(y,b)-1),_=c.c2p(!1===r.boxpoints?t.min:t.lf,!0),w=c.c2p(!1===r.boxpoints?t.max:t.uf,!0);"h"===r.orientation?s.select(this).attr("d","M"+x+","+p+"V"+m+"M"+y+","+p+"V"+m+"H"+b+"V"+p+"ZM"+y+","+n+"H"+_+"M"+b+","+n+"H"+w+(0===d?"":"M"+_+","+g+"V"+v+"M"+w+","+g+"V"+v)):s.select(this).attr("d","M"+p+","+x+"H"+m+"M"+p+","+y+"H"+m+"V"+b+"H"+p+"ZM"+n+","+y+"V"+_+"M"+n+","+b+"V"+w+(0===d?"":"M"+g+","+_+"H"+v+"M"+g+","+w+"H"+v))})}function a(t,e,r,i){var a=e.x,o=e.y,s=i.bdPos,d=i.bPos,p=r.boxpoints||r.points;u=2e9,t.selectAll("g.points").data(function(t){return t.forEach(function(t){t.t=i,t.trace=r}),t}).enter().append("g").attr("class","points").selectAll("path").data(function(t){var e,i,a="all"===p?t.pts:t.pts.filter(function(e){return e.v<t.lf||e.v>t.uf}),o=Math.max((t.max-t.min)/10,t.q3-t.q1),c=1e-9*o,u=o*f,m=[],g=0;if(r.jitter){if(0===o)for(g=1,m=new Array(a.length),e=0;e<a.length;e++)m[e]=1;else for(e=0;e<a.length;e++){var v=Math.max(0,e-h),y=a[v].v,b=Math.min(a.length-1,e+h),x=a[b].v;"all"!==p&&(a[e].v<t.lf?x=Math.min(x,t.lf):y=Math.max(y,t.uf));var _=Math.sqrt(u*(b-v)/(x-y+c))||0;_=l.constrain(Math.abs(_),0,1),m.push(_),g=Math.max(_,g)}i=2*r.jitter/g}for(e=0;e<a.length;e++){var w=a[e],M=w.v,k=r.jitter?i*m[e]*(n()-.5):0,T=t.pos+d+s*(r.pointpos+k);"h"===r.orientation?(w.y=T,w.x=M):(w.x=T,w.y=M),"suspectedoutliers"===p&&M<t.uo&&M>t.lo&&(w.so=!0)}return a}).enter().append("path").classed("point",!0).call(c.translatePoints,a,o)}function o(t,e,r,n){var i,a,o=e.pos,c=e.val,u=n.bPos,h=n.bPosPxOffset||0;Array.isArray(n.bdPos)?(i=n.bdPos[0],a=n.bdPos[1]):(i=n.bdPos,a=n.bdPos),t.selectAll("path.mean").data(l.identity).enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}).each(function(t){var e=o.c2p(t.pos+u,!0)+h,n=o.c2p(t.pos+u-i,!0)+h,l=o.c2p(t.pos+u+a,!0)+h,f=c.c2p(t.mean,!0),d=c.c2p(t.mean-t.sd,!0),p=c.c2p(t.mean+t.sd,!0);"h"===r.orientation?s.select(this).attr("d","M"+f+","+n+"V"+l+("sd"===r.boxmean?"m0,0L"+d+","+e+"L"+f+","+n+"L"+p+","+e+"Z":"")):s.select(this).attr("d","M"+n+","+f+"H"+l+("sd"===r.boxmean?"m0,0L"+e+","+d+"L"+n+","+f+"L"+e+","+p+"Z":""))})}var s=t("d3"),l=t("../../lib"),c=t("../../components/drawing"),u=2e9,h=5,f=.01;e.exports={plot:function(t,e,r){var n=t._fullLayout,l=e.xaxis,c=e.yaxis;e.plot.select(".boxlayer").selectAll("g.trace.boxes").data(r).enter().append("g").attr("class","trace boxes").each(function(t){var e=t[0],r=e.t,u=e.trace,h=e.node3=s.select(this),f=n._numBoxes,d="group"===n.boxmode&&f>1,p=r.dPos*(1-n.boxgap)*(1-n.boxgroupgap)/(d?f:1),m=d?2*r.dPos*((r.num+.5)/f-.5)*(1-n.boxgap):0,g=p*u.whiskerwidth;if(!0!==u.visible||r.empty)s.select(this).remove();else{var v,y;"h"===u.orientation?(v=c,y=l):(v=l,y=c),r.bPos=m,r.bdPos=p,r.wdPos=g,i(h,{pos:v,val:y},u,r),u.boxpoints&&a(h,{x:l,y:c},u,r),u.boxmean&&o(h,{pos:v,val:y},u,r)}})},plotBoxAndWhiskers:i,plotPoints:a,plotBoxMean:o}},{"../../components/drawing":638,"../../lib":738,d3:123}],892:[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<i.length;r++)for(n=0;n<(i[r].pts||[]).length;n++)i[r].pts[n].selected=0;else for(r=0;r<i.length;r++)for(n=0;n<(i[r].pts||[]).length;n++){var l=i[r].pts[n],c=a.c2p(l.x),u=o.c2p(l.y);e.contains([c,u])?(s.push({pointNumber:l.i,x:a.c2d(l.x),y:o.c2d(l.y)}),l.selected=1):l.selected=0}return s}},{}],893:[function(t,e,r){"use strict";function n(t,e,r,n,o){var s,l,c,u=e.calcdata,h=e._fullLayout,f=[],d="violin"===t?"_numViolins":"_numBoxes";for(s=0;s<r.length;s++)for(c=u[r[s]],l=0;l<c.length;l++)f.push(c[l].pos);if(f.length){var p=a.distinctVals(f),m=p.minDiff/2;for(f.length===p.vals.length&&(h[d]=1),i.minDtick(n,p.minDiff,p.vals[0],!0),s=0;s<r.length;s++)(c=u[r[s]])[0].t.dPos=m;var g=(1-h[t+"gap"])*(1-h[t+"groupgap"])*m/h[d];i.expand(n,p.vals,{vpadminus:m+o[0]*g,vpadplus:m+o[1]*g})}}var i=t("../../plots/cartesian/axes"),a=t("../../lib"),o=["v","h"];e.exports={setPositions:function(t,e){for(var r=t.calcdata,i=e.xaxis,a=e.yaxis,s=0;s<o.length;s++){for(var l=o[s],c="h"===l?a:i,u=[],h=0,f=0,d=0;d<r.length;d++){var p=r[d],m=p[0].t,g=p[0].trace;!0!==g.visible||"box"!==g.type||m.empty||g.orientation!==l||g.xaxis!==i._id||g.yaxis!==a._id||(u.push(d),!1!==g.boxpoints&&(h=Math.max(h,g.jitter-g.pointpos-1),f=Math.max(f,g.jitter+g.pointpos-1)))}n("box",t,u,c,[h,f])}},setPositionOffset:n}},{"../../lib":738,"../../plots/cartesian/axes":785}],894:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),a=t("../../components/drawing");e.exports=function(t,e){var r=e?e[0].node3:n.select(t).selectAll("g.trace.boxes");r.style("opacity",function(t){return t[0].trace.opacity}),r.each(function(e){var r=n.select(this),o=e[0].trace,s=o.line.width;r.selectAll("path.box").style("stroke-width",s+"px").call(i.stroke,o.line.color).call(i.fill,o.fillcolor),r.selectAll("path.mean").style({"stroke-width":s,"stroke-dasharray":2*s+"px,"+s+"px"}).call(i.stroke,o.line.color);var l=r.selectAll("path.point");a.pointStyle(l,o,t),a.selectedPointStyle(l,o)})}},{"../../components/color":613,"../../components/drawing":638,d3:123}],895:[function(t,e,r){"use strict";function n(t){return{name:a.increasing.name,showlegend:a.increasing.showlegend,line:{color:i({},o.line.color,{dflt:t}),width:o.line.width,editType:"style"},fillcolor:o.fillcolor,editType:"style"}}var i=t("../../lib").extendFlat,a=t("../ohlc/attributes"),o=t("../box/attributes");e.exports={x:a.x,open:a.open,high:a.high,low:a.low,close:a.close,line:{width:i({},o.line.width,{}),editType:"style"},increasing:n(a.increasing.line.color.dflt),decreasing:n(a.decreasing.line.color.dflt),text:a.text,whiskerwidth:i({},o.whiskerwidth,{dflt:0})}},{"../../lib":738,"../box/attributes":884,"../ohlc/attributes":1012}],896:[function(t,e,r){"use strict";function n(t,e,r,n){o(t,e,r,n),r(n+".line.color"),r(n+".line.width",e.line.width),r(n+".fillcolor")}var i=t("../../lib"),a=t("../ohlc/ohlc_defaults"),o=t("../ohlc/direction_defaults"),s=t("../ohlc/helpers"),l=t("./attributes");e.exports=function(t,e,r,o){function c(r,n){return i.coerce(t,e,l,r,n)}s.pushDummyTransformOpts(t,e);0!==a(t,e,c,o)?(c("line.width"),n(t,e,c,"increasing"),n(t,e,c,"decreasing"),c("text"),c("whiskerwidth")):e.visible=!1}},{"../../lib":738,"../ohlc/direction_defaults":1014,"../ohlc/helpers":1015,"../ohlc/ohlc_defaults":1017,"./attributes":895}],897:[function(t,e,r){"use strict";var n=t("../../plot_api/register");e.exports={moduleType:"trace",name:"candlestick",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend","candlestick"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},n(t("../box")),n(t("./transform"))},{"../../plot_api/register":775,"../../plots/cartesian":796,"../box":888,"./attributes":895,"./defaults":896,"./transform":898}],898:[function(t,e,r){"use strict";function n(t,e,r){var n={type:"box",boxpoints:!1,visible:t.visible,hoverinfo:t.hoverinfo,opacity:t.opacity,xaxis:t.xaxis,yaxis:t.yaxis,transforms:o.makeTransform(t,e,r)},i=t[r];return i&&a.extendFlat(n,{x:t.x||[0],xcalendar:t.xcalendar,y:[].concat(t.low).concat(t.high),whiskerwidth:t.whiskerwidth,text:t.text,name:i.name,showlegend:i.showlegend,line:i.line,fillcolor:i.fillcolor}),n}var i=t("fast-isnumeric"),a=t("../../lib"),o=t("../ohlc/helpers");r.moduleType="transform",r.name="candlestick",r.attributes={},r.supplyDefaults=function(t,e,r,n){return o.clearEphemeralTransformOpts(n),o.copyOHLC(t,e),t},r.transform=function(t,e){for(var r=[],i=0;i<t.length;i++){var a=t[i];"candlestick"===a.type?r.push(n(a,e,"increasing"),n(a,e,"decreasing")):r.push(a)}return o.addRangeSlider(r,e.layout),r},r.calcTransform=function(t,e,r){for(var n=r.direction,a=o.getFilterFn(n),s=e.open,l=e.high,c=e.low,u=e.close,h=s.length,f=[],d=[],p=e._fullInput.x?function(t){var r=e.x[t];f.push(r,r,r,r,r,r)}:function(t){f.push(t,t,t,t,t,t)},m=function(t,e,r,n){d.push(r,t,n,n,n,e)},g=0;g<h;g++)a(s[g],u[g])&&i(l[g])&&i(c[g])&&(p(g),m(s[g],l[g],c[g],u[g]));e.x=f,e.y=d}},{"../../lib":738,"../ohlc/helpers":1015,"fast-isnumeric":132}],899:[function(t,e,r){"use strict";var n=t("./axis_defaults");e.exports=function(t,e,r,i,a){i("a")||(i("da"),i("a0"));i("b")||(i("db"),i("b0")),function(t,e,r,i){["aaxis","baxis"].forEach(function(a){var o=a.charAt(0),s=t[a]||{},l={},c={tickfont:"x",id:o+"axis",letter:o,font:e.font,name:a,data:t[o],calendar:e.calendar,dfltColor:i,bgColor:r.paper_bgcolor,fullLayout:r};n(s,l,c),l._categories=l._categories||[],e[a]=l,t[a]||"-"===s.type||(t[a]={type:s.type})})}(t,e,r,a)}},{"./axis_defaults":904}],900:[function(t,e,r){"use strict";function n(t,e){if(!Array.isArray(t)||e>=10)return null;for(var r=1/0,i=-1/0,a=t.length,o=0;o<a;o++){var s=t[o];if(Array.isArray(s)){var l=n(s,e+1);l&&(r=Math.min(l[0],r),i=Math.max(l[1],i))}else r=Math.min(s,r),i=Math.max(s,i)}return[r,i]}e.exports=function(t){return n(t,0)}},{}],901:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("./axis_attributes"),a=t("../../components/color/attributes"),o=n({editType:"calc"});o.family.dflt='"Open Sans", verdana, arial, sans-serif',o.size.dflt=12,o.color.dflt=a.defaultLine,e.exports={carpet:{valType:"string",editType:"calc"},x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},a:{valType:"data_array",editType:"calc"},a0:{valType:"number",dflt:0,editType:"calc"},da:{valType:"number",dflt:1,editType:"calc"},b:{valType:"data_array",editType:"calc"},b0:{valType:"number",dflt:0,editType:"calc"},db:{valType:"number",dflt:1,editType:"calc"},cheaterslope:{valType:"number",dflt:1,editType:"calc"},aaxis:i,baxis:i,font:o,color:{valType:"color",dflt:a.defaultLine,editType:"plot"}}},{"../../components/color/attributes":612,"../../plots/font_attributes":810,"./axis_attributes":903}],902:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i,a,o,s,l,c,u,h,f,d,p,m,g,v=Array.isArray(r)?"a":"b",y=("a"===v?t.aaxis:t.baxis).smoothing,b="a"===v?t.a2i:t.b2j,x="a"===v?r:n,_="a"===v?n:r,w="a"===v?e.a.length:e.b.length,M="a"===v?e.b.length:e.a.length,k=Math.floor("a"===v?t.b2j(_):t.a2i(_)),T="a"===v?function(e){return t.evalxy([],e,k)}:function(e){return t.evalxy([],k,e)};y&&(o=Math.max(0,Math.min(M-2,k)),s=k-o,a="a"===v?function(e,r){return t.dxydi([],e,o,r,s)}:function(e,r){return t.dxydj([],o,e,s,r)});var A=b(x[0]),S=b(x[1]),E=A<S?1:-1,L=1e-8*(S-A),C=E>0?Math.floor:Math.ceil,I=E>0?Math.ceil:Math.floor,P=E>0?Math.min:Math.max,D=E>0?Math.max:Math.min,z=C(A+L),O=I(S-L),F=[[u=T(A)]];for(i=z;i*E<O*E;i+=E)l=[],p=D(A,i),g=(m=P(S,i+E))-p,c=Math.max(0,Math.min(w-2,Math.floor(.5*(p+m)))),h=T(m),y&&(f=a(c,p-c),d=a(c,m-c),l.push([u[0]+f[0]/3*g,u[1]+f[1]/3*g]),l.push([h[0]-d[0]/3*g,h[1]-d[1]/3*g])),l.push(h),F.push(l),u=h;return F}},{}],903:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../components/color/attributes"),a=t("../../plots/cartesian/layout_attributes"),o=t("../../plot_api/edit_types").overrideAll;e.exports={color:{valType:"color",editType:"calc"},smoothing:{valType:"number",dflt:1,min:0,max:1.3,editType:"calc"},title:{valType:"string",editType:"calc"},titlefont:n({editType:"calc"}),titleoffset:{valType:"number",dflt:10,editType:"calc"},type:{valType:"enumerated",values:["-","linear","date","category"],dflt:"-",editType:"calc"},autorange:{valType:"enumerated",values:[!0,!1,"reversed"],dflt:!0,editType:"calc"},rangemode:{valType:"enumerated",values:["normal","tozero","nonnegative"],dflt:"normal",editType:"calc"},range:{valType:"info_array",editType:"calc",items:[{valType:"any",editType:"calc"},{valType:"any",editType:"calc"}]},fixedrange:{valType:"boolean",dflt:!1,editType:"calc"},cheatertype:{valType:"enumerated",values:["index","value"],dflt:"value",editType:"calc"},tickmode:{valType:"enumerated",values:["linear","array"],dflt:"array",editType:"calc"},nticks:{valType:"integer",min:0,dflt:0,editType:"calc"},tickvals:{valType:"data_array",editType:"calc"},ticktext:{valType:"data_array",editType:"calc"},showticklabels:{valType:"enumerated",values:["start","end","both","none"],dflt:"start",editType:"calc"},tickfont:n({editType:"calc"}),tickangle:{valType:"angle",dflt:"auto",editType:"calc"},tickprefix:{valType:"string",dflt:"",editType:"calc"},showtickprefix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"calc"},ticksuffix:{valType:"string",dflt:"",editType:"calc"},showticksuffix:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"calc"},showexponent:{valType:"enumerated",values:["all","first","last","none"],dflt:"all",editType:"calc"},exponentformat:{valType:"enumerated",values:["none","e","E","power","SI","B"],dflt:"B",editType:"calc"},separatethousands:{valType:"boolean",dflt:!1,editType:"calc"},tickformat:{valType:"string",dflt:"",editType:"calc"},tickformatstops:o(a.tickformatstops,"calc","from-root"),categoryorder:{valType:"enumerated",values:["trace","category ascending","category descending","array"],dflt:"trace",editType:"calc"},categoryarray:{valType:"data_array",editType:"calc"},labelpadding:{valType:"integer",dflt:10,editType:"calc"},labelprefix:{valType:"string",editType:"calc"},labelsuffix:{valType:"string",dflt:"",editType:"calc"},showline:{valType:"boolean",dflt:!1,editType:"calc"},linecolor:{valType:"color",dflt:i.defaultLine,editType:"calc"},linewidth:{valType:"number",min:0,dflt:1,editType:"calc"},gridcolor:{valType:"color",editType:"calc"},gridwidth:{valType:"number",min:0,dflt:1,editType:"calc"},showgrid:{valType:"boolean",dflt:!0,editType:"calc"},minorgridcount:{valType:"integer",min:0,dflt:0,editType:"calc"},minorgridwidth:{valType:"number",min:0,dflt:1,editType:"calc"},minorgridcolor:{valType:"color",dflt:i.lightLine,editType:"calc"},startline:{valType:"boolean",editType:"calc"},startlinecolor:{valType:"color",editType:"calc"},startlinewidth:{valType:"number",dflt:1,editType:"calc"},endline:{valType:"boolean",editType:"calc"},endlinewidth:{valType:"number",dflt:1,editType:"calc"},endlinecolor:{valType:"color",editType:"calc"},tick0:{valType:"number",min:0,dflt:0,editType:"calc"},dtick:{valType:"number",min:0,dflt:1,editType:"calc"},arraytick0:{valType:"integer",min:0,dflt:0,editType:"calc"},arraydtick:{valType:"integer",min:1,dflt:1,editType:"calc"},editType:"calc"}},{"../../components/color/attributes":612,"../../plot_api/edit_types":769,"../../plots/cartesian/layout_attributes":797,"../../plots/font_attributes":810}],904:[function(t,e,r){"use strict";var n=t("./attributes"),i=t("../../components/color").addOpacity,a=t("../../registry"),o=t("../../lib"),s=t("../../plots/cartesian/tick_value_defaults"),l=t("../../plots/cartesian/tick_label_defaults"),c=t("../../plots/cartesian/category_order_defaults"),u=t("../../plots/cartesian/set_convert"),h=t("../../plots/cartesian/ordered_categories"),f=t("../../plots/cartesian/axis_autotype");e.exports=function(t,e,r){function d(r,n){return o.coerce(t,e,v,r,n)}function p(r,n){return o.coerce2(t,e,v,r,n)}var m=r.letter,g=r.font||{},v=n[m+"axis"];r.noHover=!0,r.name&&(e._name=r.name,e._id=r.name);var y=d("type");if("-"===y&&(r.data&&function(t,e){if("-"===t.type){var r=t[t._id.charAt(0)+"calendar"];t.type=f(e,r)}}(e,r.data),"-"===e.type?e.type="linear":y=t.type=e.type),d("smoothing"),d("cheatertype"),d("showticklabels"),d("labelprefix",m+" = "),d("labelsuffix"),d("showtickprefix"),d("showticksuffix"),d("separatethousands"),d("tickformat"),d("exponentformat"),d("showexponent"),d("categoryorder"),d("tickmode"),d("tickvals"),d("ticktext"),d("tick0"),d("dtick"),"array"===e.tickmode&&(d("arraytick0"),d("arraydtick")),d("labelpadding"),e._hovertitle=m,"date"===y){a.getComponentMethod("calendars","handleDefaults")(t,e,"calendar",r.calendar)}u(e,r.fullLayout);var b=d("color",r.dfltColor),x=b===t.color?b:g.color;d("title"),o.coerceFont(d,"titlefont",{family:g.family,size:Math.round(1.2*g.size),color:x}),d("titleoffset"),d("tickangle");d("autorange",!e.isValidRange(t.range))&&d("rangemode"),d("range"),e.cleanRange(),d("fixedrange"),s(t,e,d,y),l(t,e,d,y,r),c(t,e,d);var _=p("gridcolor",i(b,.3)),w=p("gridwidth"),M=d("showgrid");M||(delete e.gridcolor,delete e.gridwidth);var k=p("startlinecolor",b),T=p("startlinewidth",w);d("startline",e.showgrid||!!k||!!T)||(delete e.startlinecolor,delete e.startlinewidth);var A=p("endlinecolor",b),S=p("endlinewidth",w);return d("endline",e.showgrid||!!A||!!S)||(delete e.endlinecolor,delete e.endlinewidth),M?(d("minorgridcount"),d("minorgridwidth",w),d("minorgridcolor",i(_,.06)),e.minorgridcount||(delete e.minorgridwidth,delete e.minorgridcolor)):(delete e.gridcolor,delete e.gridWidth),e._initialCategories="category"===y?h(m,e.categoryorder,e.categoryarray,r.data):[],"none"===e.showticklabels&&(delete e.tickfont,delete e.tickangle,delete e.showexponent,delete e.exponentformat,delete e.tickformat,delete e.showticksuffix,delete e.showtickprefix),e.showticksuffix||delete e.ticksuffix,e.showtickprefix||delete e.tickprefix,d("tickmode"),(!e.title||e.title&&0===e.title.length)&&(delete e.titlefont,delete e.titleoffset),e}},{"../../components/color":613,"../../lib":738,"../../plots/cartesian/axis_autotype":786,"../../plots/cartesian/category_order_defaults":789,"../../plots/cartesian/ordered_categories":799,"../../plots/cartesian/set_convert":803,"../../plots/cartesian/tick_label_defaults":804,"../../plots/cartesian/tick_value_defaults":806,"../../registry":861,"./attributes":901}],905:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("./cheater_basis"),a=t("./array_minmax"),o=t("./map_2d_array"),s=t("./calc_gridlines"),l=t("./calc_labels"),c=t("./calc_clippath"),u=t("../heatmap/clean_2d_array"),h=t("./smooth_fill_2d_array");e.exports=function(t,e){var r,f=n.getFromId(t,e.xaxis||"x"),d=n.getFromId(t,e.yaxis||"y"),p=e.aaxis,m=e.baxis,g=e._a=e.a,v=e._b=e.b,y={},b=e.y;if(e._cheater){var x="index"===p.cheatertype?g.length:g,_="index"===m.cheatertype?v.length:v;e.x=r=i(x,_,e.cheaterslope)}else r=e.x;e._x=e.x=r=u(r),e._y=e.y=b=u(b),h(r,g,v),h(b,g,v),e.setScale(),y.xp=e.xp=o(e.xp,r,f.c2p),y.yp=e.yp=o(e.yp,b,d.c2p);var w=a(r),M=a(b),k=.5*(w[1]-w[0]),T=.5*(w[1]+w[0]),A=.5*(M[1]-M[0]),S=.5*(M[1]+M[0]);return w=[T-1.3*k,T+1.3*k],M=[S-1.3*A,S+1.3*A],n.expand(f,w,{padded:!0}),n.expand(d,M,{padded:!0}),s(e,y,"a","b"),s(e,y,"b","a"),l(e,p),l(e,m),y.clipsegments=c(e.xctrl,e.yctrl,p,m),y.x=r,y.y=b,y.a=g,y.b=v,[y]}},{"../../plots/cartesian/axes":785,"../heatmap/clean_2d_array":967,"./array_minmax":900,"./calc_clippath":906,"./calc_gridlines":907,"./calc_labels":908,"./cheater_basis":910,"./map_2d_array":922,"./smooth_fill_2d_array":926}],906:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i,a,o,s=[],l=!!r.smoothing,c=!!n.smoothing,u=t[0].length-1,h=t.length-1;for(i=0,a=[],o=[];i<=u;i++)a[i]=t[0][i],o[i]=e[0][i];for(s.push({x:a,y:o,bicubic:l}),i=0,a=[],o=[];i<=h;i++)a[i]=t[i][u],o[i]=e[i][u];for(s.push({x:a,y:o,bicubic:c}),i=u,a=[],o=[];i>=0;i--)a[u-i]=t[h][i],o[u-i]=e[h][i];for(s.push({x:a,y:o,bicubic:l}),i=h,a=[],o=[];i>=0;i--)a[h-i]=t[i][0],o[h-i]=e[i][0];return s.push({x:a,y:o,bicubic:c}),s}},{}],907:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e,r,a){function o(e){var n,i,o,s,l,c,u,h,f,d,p,g,v=[],y=[],b={};if("b"===r)for(i=t.b2j(e),o=Math.floor(Math.max(0,Math.min(z-2,i))),s=i-o,b.length=z,b.crossLength=D,b.xy=function(e){return t.evalxy([],e,i)},b.dxy=function(e,r){return t.dxydi([],e,o,r,s)},n=0;n<D;n++)c=Math.min(D-2,n),u=n-c,h=t.evalxy([],n,i),E.smoothing&&n>0&&(f=t.dxydi([],n-1,o,0,s),v.push(l[0]+f[0]/3),y.push(l[1]+f[1]/3),d=t.dxydi([],n-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(n=t.a2i(e),c=Math.floor(Math.max(0,Math.min(D-2,n))),u=n-c,b.length=D,b.crossLength=z,b.xy=function(e){return t.evalxy([],n,e)},b.dxy=function(e,r){return t.dxydj([],c,e,u,r)},i=0;i<z;i++)o=Math.min(z-2,i),s=i-o,h=t.evalxy([],n,i),E.smoothing&&i>0&&(p=t.dxydj([],c,i-1,u,0),v.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),g=t.dxydj([],c,i-1,u,1),v.push(h[0]-g[0]/3),y.push(h[1]-g[1]/3)),v.push(h[0]),y.push(h[1]),l=h;return b.axisLetter=r,b.axis=M,b.crossAxis=E,b.value=e,b.constvar=a,b.index=m,b.x=v,b.y=y,b.smoothing=E.smoothing,b}function s(e){var n,i,o,s,l,c=[],u=[],h={};if(h.length=w.length,h.crossLength=S.length,"b"===r)for(o=Math.max(0,Math.min(z-2,e)),l=Math.min(1,Math.max(0,e-o)),h.xy=function(r){return t.evalxy([],r,e)},h.dxy=function(e,r){return t.dxydi([],e,o,r,l)},n=0;n<I;n++)c[n]=L[e*O][n],u[n]=C[e*O][n];else for(i=Math.max(0,Math.min(D-2,e)),s=Math.min(1,Math.max(0,e-i)),h.xy=function(r){return t.evalxy([],e,r)},h.dxy=function(e,r){return t.dxydj([],i,e,s,r)},n=0;n<P;n++)c[n]=L[n][e*O],u[n]=C[n][e*O];return h.axisLetter=r,h.axis=M,h.crossAxis=E,h.value=w[e],h.constvar=a,h.index=e,h.x=c,h.y=u,h.smoothing=E.smoothing,h}var l,c,u,h,f,d,p,m,g,v,y,b,x,_,w=t[r],M=t[r+"axis"],k=M._gridlines=[],T=M._minorgridlines=[],A=M._boundarylines=[],S=t[a],E=t[a+"axis"];if("array"===M.tickmode)for(M.tickvals=[],l=0;l<w.length;l++)M.tickvals.push(w[l]);var L=t.xctrl,C=t.yctrl,I=L[0].length,P=L.length,D=t.a.length,z=t.b.length;n.calcTicks(M);var O=M.smoothing?3:1;if("array"===M.tickmode){for(h=5e-15,d=(f=[Math.floor((w.length-1-M.arraytick0)/M.arraydtick*(1+h)),Math.ceil(-M.arraytick0/M.arraydtick/(1+h))].sort(function(t,e){return t-e}))[0]-1,p=f[1]+1,m=d;m<p;m++)(c=M.arraytick0+M.arraydtick*m)<0||c>w.length-1||k.push(i(s(c),{color:M.gridcolor,width:M.gridwidth}));for(m=d;m<p;m++)if(u=M.arraytick0+M.arraydtick*m,y=Math.min(u+M.arraydtick,w.length-1),!(u<0||u>w.length-1||y<0||y>w.length-1))for(b=w[u],x=w[y],l=0;l<M.minorgridcount;l++)(_=y-u)<=0||(v=b+(x-b)*(l+1)/(M.minorgridcount+1)*(M.arraydtick/_))<w[0]||v>w[w.length-1]||T.push(i(o(v),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&A.push(i(s(0),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&A.push(i(s(w.length-1),{color:M.endlinecolor,width:M.endlinewidth}))}else{for(h=5e-15,d=(f=[Math.floor((w[w.length-1]-M.tick0)/M.dtick*(1+h)),Math.ceil((w[0]-M.tick0)/M.dtick/(1+h))].sort(function(t,e){return t-e}))[0],p=f[1],m=d;m<=p;m++)g=M.tick0+M.dtick*m,k.push(i(o(g),{color:M.gridcolor,width:M.gridwidth}));for(m=d-1;m<p+1;m++)for(g=M.tick0+M.dtick*m,l=0;l<M.minorgridcount;l++)(v=g+M.dtick*(l+1)/(M.minorgridcount+1))<w[0]||v>w[w.length-1]||T.push(i(o(v),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&A.push(i(o(w[0]),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&A.push(i(o(w[w.length-1]),{color:M.endlinecolor,width:M.endlinewidth}))}}},{"../../lib/extend":727,"../../plots/cartesian/axes":785}],908:[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;r<l.length;r++)o=l[r],-1!==["start","both"].indexOf(e.showticklabels)&&(a=n.tickText(e,o.value),i(a,{prefix:void 0,suffix:void 0,endAnchor:!0,xy:o.xy(0),dxy:o.dxy(0,0),axis:o.axis,length:o.crossAxis.length,font:o.axis.tickfont,isFirst:0===r,isLast:r===l.length-1}),s.push(a)),-1!==["end","both"].indexOf(e.showticklabels)&&(a=n.tickText(e,o.value),i(a,{endAnchor:!1,xy:o.xy(o.crossLength-1),dxy:o.dxy(o.crossLength-2,1),axis:o.axis,length:o.crossAxis.length,font:o.axis.tickfont,isFirst:0===r,isLast:r===l.length-1}),s.push(a))}},{"../../lib/extend":727,"../../plots/cartesian/axes":785}],909:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i=t[0]-e[0],a=t[1]-e[1],o=r[0]-e[0],s=r[1]-e[1],l=Math.pow(i*i+a*a,.25),c=Math.pow(o*o+s*s,.25),u=(c*c*i-l*l*o)*n,h=(c*c*a-l*l*s)*n,f=c*(l+c)*3,d=l*(l+c)*3;return[[e[0]+(f&&u/f),e[1]+(f&&h/f)],[e[0]-(d&&u/d),e[1]-(d&&h/d)]]}},{}],910:[function(t,e,r){"use strict";var n=t("../../lib").isArray;e.exports=function(t,e,r){var i,a,o,s,l,c=[],u=n(t)?t.length:t,h=n(e)?e.length:e,f=n(t)?t:null,d=n(e)?e:null;f&&(o=(f.length-1)/(f[f.length-1]-f[0])/(u-1)),d&&(s=(d.length-1)/(d[d.length-1]-d[0])/(h-1));var p,m=1/0,g=-1/0;for(a=0;a<h;a++)for(c[a]=[],l=d?(d[a]-d[0])*s:a/(h-1),i=0;i<u;i++)p=(f?(f[i]-f[0])*o:i/(u-1))-l*r,m=Math.min(p,m),g=Math.max(p,g),c[a][i]=p;var v=1/(g-m),y=-m*v;for(a=0;a<h;a++)for(i=0;i<u;i++)c[a][i]=v*c[a][i]+y;return c}},{"../../lib":738}],911:[function(t,e,r){"use strict";function n(t,e,r){var n=-.5*r[0]+1.5*e[0],i=-.5*r[1]+1.5*e[1];return[(2*n+t[0])/3,(2*i+t[1])/3]}var i=t("./catmull_rom"),a=t("../../lib").ensureArray;e.exports=function(t,e,r,o,s,l){var c,u,h,f,d,p,m,g,v,y,b=r[0].length,x=r.length,_=s?3*b-2:b,w=l?3*x-2:x;for(t=a(t,w),e=a(e,w),h=0;h<w;h++)t[h]=a(t[h],_),e[h]=a(e[h],_);for(u=0,f=0;u<x;u++,f+=l?3:1)for(d=t[f],p=e[f],m=r[u],g=o[u],c=0,h=0;c<b;c++,h+=s?3:1)d[h]=m[c],p[h]=g[c];if(s)for(u=0,f=0;u<x;u++,f+=l?3:1){for(c=1,h=3;c<b-1;c++,h+=3)v=i([r[u][c-1],o[u][c-1]],[r[u][c],o[u][c]],[r[u][c+1],o[u][c+1]],s),t[f][h-1]=v[0][0],e[f][h-1]=v[0][1],t[f][h+1]=v[1][0],e[f][h+1]=v[1][1];y=n([t[f][0],e[f][0]],[t[f][2],e[f][2]],[t[f][3],e[f][3]]),t[f][1]=y[0],e[f][1]=y[1],y=n([t[f][_-1],e[f][_-1]],[t[f][_-3],e[f][_-3]],[t[f][_-4],e[f][_-4]]),t[f][_-2]=y[0],e[f][_-2]=y[1]}if(l)for(h=0;h<_;h++){for(f=3;f<w-3;f+=3)v=i([t[f-3][h],e[f-3][h]],[t[f][h],e[f][h]],[t[f+3][h],e[f+3][h]],l),t[f-1][h]=v[0][0],e[f-1][h]=v[0][1],t[f+1][h]=v[1][0],e[f+1][h]=v[1][1];y=n([t[0][h],e[0][h]],[t[2][h],e[2][h]],[t[3][h],e[3][h]]),t[1][h]=y[0],e[1][h]=y[1],y=n([t[w-1][h],e[w-1][h]],[t[w-3][h],e[w-3][h]],[t[w-4][h],e[w-4][h]]),t[w-2][h]=y[0],e[w-2][h]=y[1]}if(s&&l)for(f=1;f<w;f+=(f+1)%3==0?2:1){for(h=3;h<_-3;h+=3)v=i([t[f][h-3],e[f][h-3]],[t[f][h],e[f][h]],[t[f][h+3],e[f][h+3]],s),t[f][h-1]=.5*(t[f][h-1]+v[0][0]),e[f][h-1]=.5*(e[f][h-1]+v[0][1]),t[f][h+1]=.5*(t[f][h+1]+v[1][0]),e[f][h+1]=.5*(e[f][h+1]+v[1][1]);y=n([t[f][0],e[f][0]],[t[f][2],e[f][2]],[t[f][3],e[f][3]]),t[f][1]=.5*(t[f][1]+y[0]),e[f][1]=.5*(e[f][1]+y[1]),y=n([t[f][_-1],e[f][_-1]],[t[f][_-3],e[f][_-3]],[t[f][_-4],e[f][_-4]]),t[f][_-2]=.5*(t[f][_-2]+y[0]),e[f][_-2]=.5*(e[f][_-2]+y[1])}return[t,e]}},{"../../lib":738,"./catmull_rom":909}],912:[function(t,e,r){"use strict";e.exports={RELATIVE_CULL_TOLERANCE:1e-6}},{}],913:[function(t,e,r){"use strict";e.exports=function(t,e,r){return e&&r?function(e,r,n,i,a){e||(e=[]);var o,s,l,c,u,h;r*=3,n*=3;var f=i*i,d=1-i,p=d*d,m=d*i*2,g=-3*p,v=3*(p-m),y=3*(m-f),b=3*f,x=a*a,_=x*a,w=1-a,M=w*w,k=M*w;for(h=0;h<t.length;h++)o=g*(u=t[h])[n][r]+v*u[n][r+1]+y*u[n][r+2]+b*u[n][r+3],s=g*u[n+1][r]+v*u[n+1][r+1]+y*u[n+1][r+2]+b*u[n+1][r+3],l=g*u[n+2][r]+v*u[n+2][r+1]+y*u[n+2][r+2]+b*u[n+2][r+3],c=g*u[n+3][r]+v*u[n+3][r+1]+y*u[n+3][r+2]+b*u[n+3][r+3],e[h]=k*o+3*(M*a*s+w*x*l)+_*c;return e}:e?function(e,r,n,i,a){e||(e=[]);var o,s,l,c;r*=3;var u=i*i,h=1-i,f=h*h,d=h*i*2,p=-3*f,m=3*(f-d),g=3*(d-u),v=3*u,y=1-a;for(l=0;l<t.length;l++)o=p*(c=t[l])[n][r]+m*c[n][r+1]+g*c[n][r+2]+v*c[n][r+3],s=p*c[n+1][r]+m*c[n+1][r+1]+g*c[n+1][r+2]+v*c[n+1][r+3],e[l]=y*o+a*s;return e}:r?function(e,r,n,i,a){e||(e=[]);var o,s,l,c,u,h;n*=3;var f=a*a,d=f*a,p=1-a,m=p*p,g=m*p;for(u=0;u<t.length;u++)o=(h=t[u])[n][r+1]-h[n][r],s=h[n+1][r+1]-h[n+1][r],l=h[n+2][r+1]-h[n+2][r],c=h[n+3][r+1]-h[n+3][r],e[u]=g*o+3*(m*a*s+p*f*l)+d*c;return e}:function(e,r,n,i,a){e||(e=[]);var o,s,l,c,u=1-a;for(l=0;l<t.length;l++)o=(c=t[l])[n][r+1]-c[n][r],s=c[n+1][r+1]-c[n+1][r],e[l]=u*o+a*s;return e}}},{}],914:[function(t,e,r){"use strict";e.exports=function(t,e,r){return e&&r?function(e,r,n,i,a){e||(e=[]);var o,s,l,c,u,h;r*=3,n*=3;var f=i*i,d=f*i,p=1-i,m=p*p,g=m*p,v=a*a,y=1-a,b=y*y,x=y*a*2,_=-3*b,w=3*(b-x),M=3*(x-v),k=3*v;for(h=0;h<t.length;h++)o=_*(u=t[h])[n][r]+w*u[n+1][r]+M*u[n+2][r]+k*u[n+3][r],s=_*u[n][r+1]+w*u[n+1][r+1]+M*u[n+2][r+1]+k*u[n+3][r+1],l=_*u[n][r+2]+w*u[n+1][r+2]+M*u[n+2][r+2]+k*u[n+3][r+2],c=_*u[n][r+3]+w*u[n+1][r+3]+M*u[n+2][r+3]+k*u[n+3][r+3],e[h]=g*o+3*(m*i*s+p*f*l)+d*c;return e}:e?function(e,r,n,i,a){e||(e=[]);var o,s,l,c,u,h;r*=3;var f=a*a,d=f*a,p=1-a,m=p*p,g=m*p;for(u=0;u<t.length;u++)o=(h=t[u])[n+1][r]-h[n][r],s=h[n+1][r+1]-h[n][r+1],l=h[n+1][r+2]-h[n][r+2],c=h[n+1][r+3]-h[n][r+3],e[u]=g*o+3*(m*a*s+p*f*l)+d*c;return e}:r?function(e,r,n,i,a){e||(e=[]);var o,s,l,c;n*=3;var u=1-i,h=a*a,f=1-a,d=f*f,p=f*a*2,m=-3*d,g=3*(d-p),v=3*(p-h),y=3*h;for(l=0;l<t.length;l++)o=m*(c=t[l])[n][r]+g*c[n+1][r]+v*c[n+2][r]+y*c[n+3][r],s=m*c[n][r+1]+g*c[n+1][r+1]+v*c[n+2][r+1]+y*c[n+3][r+1],e[l]=u*o+i*s;return e}:function(e,r,n,i,a){e||(e=[]);var o,s,l,c,u=1-i;for(l=0;l<t.length;l++)o=(c=t[l])[n+1][r]-c[n][r],s=c[n+1][r+1]-c[n][r+1],e[l]=u*o+i*s;return e}}},{}],915:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var a=e-2,o=r-2;return n&&i?function(e,r,n){e||(e=[]);var i,s,l,c,u,h,f=Math.max(0,Math.min(Math.floor(r),a)),d=Math.max(0,Math.min(Math.floor(n),o)),p=Math.max(0,Math.min(1,r-f)),m=Math.max(0,Math.min(1,n-d));f*=3,d*=3;var g=p*p,v=g*p,y=1-p,b=y*y,x=b*y,_=m*m,w=_*m,M=1-m,k=M*M,T=k*M;for(h=0;h<t.length;h++)i=x*(u=t[h])[d][f]+3*(b*p*u[d][f+1]+y*g*u[d][f+2])+v*u[d][f+3],s=x*u[d+1][f]+3*(b*p*u[d+1][f+1]+y*g*u[d+1][f+2])+v*u[d+1][f+3],l=x*u[d+2][f]+3*(b*p*u[d+2][f+1]+y*g*u[d+2][f+2])+v*u[d+2][f+3],c=x*u[d+3][f]+3*(b*p*u[d+3][f+1]+y*g*u[d+3][f+2])+v*u[d+3][f+3],e[h]=T*i+3*(k*m*s+M*_*l)+w*c;return e}:n?function(e,r,n){e||(e=[]);var i,s,l,c,u,h,f=Math.max(0,Math.min(Math.floor(r),a)),d=Math.max(0,Math.min(Math.floor(n),o)),p=Math.max(0,Math.min(1,r-f)),m=Math.max(0,Math.min(1,n-d));f*=3;var g=p*p,v=g*p,y=1-p,b=y*y,x=b*y,_=1-m;for(u=0;u<t.length;u++)i=_*(h=t[u])[d][f]+m*h[d+1][f],s=_*h[d][f+1]+m*h[d+1][f+1],l=_*h[d][f+2]+m*h[d+1][f+1],c=_*h[d][f+3]+m*h[d+1][f+1],e[u]=x*i+3*(b*p*s+y*g*l)+v*c;return e}:i?function(e,r,n){e||(e=[]);var i,s,l,c,u,h,f=Math.max(0,Math.min(Math.floor(r),a)),d=Math.max(0,Math.min(Math.floor(n),o)),p=Math.max(0,Math.min(1,r-f)),m=Math.max(0,Math.min(1,n-d));d*=3;var g=m*m,v=g*m,y=1-m,b=y*y,x=b*y,_=1-p;for(u=0;u<t.length;u++)i=_*(h=t[u])[d][f]+p*h[d][f+1],s=_*h[d+1][f]+p*h[d+1][f+1],l=_*h[d+2][f]+p*h[d+2][f+1],c=_*h[d+3][f]+p*h[d+3][f+1],e[u]=x*i+3*(b*m*s+y*g*l)+v*c;return e}:function(e,r,n){e||(e=[]);var i,s,l,c,u=Math.max(0,Math.min(Math.floor(r),a)),h=Math.max(0,Math.min(Math.floor(n),o)),f=Math.max(0,Math.min(1,r-u)),d=Math.max(0,Math.min(1,n-h)),p=1-d,m=1-f;for(l=0;l<t.length;l++)i=m*(c=t[l])[h][u]+f*c[h][u+1],s=m*c[h+1][u]+f*c[h+1][u+1],e[l]=p*i+d*s;return e}}},{}],916:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./xy_defaults"),a=t("./ab_defaults"),o=t("./set_convert"),s=t("./attributes"),l=t("../../components/color/attributes");e.exports=function(t,e,r,c){function u(r,i){return n.coerce(t,e,s,r,i)}e._clipPathId="clip"+e.uid+"carpet";var h=u("color",l.defaultLine);if(n.coerceFont(u,"font"),u("carpet"),a(t,e,c,u,h),e.a&&e.b){e.a.length<3&&(e.aaxis.smoothing=0),e.b.length<3&&(e.baxis.smoothing=0);var f=i(t,e,u);o(e),e._cheater&&u("cheaterslope"),f||(e.visible=!1)}else e.visible=!1}},{"../../components/color/attributes":612,"../../lib":738,"./ab_defaults":899,"./attributes":901,"./set_convert":925,"./xy_defaults":927}],917:[function(t,e,r){"use strict";e.exports=function(t){return Array.isArray(t[0])}},{}],918:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.plot=t("./plot"),n.calc=t("./calc"),n.animatable=!0,n.moduleType="trace",n.name="carpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","carpet","carpetAxis","notLegendIsolatable"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"./attributes":901,"./calc":905,"./defaults":916,"./plot":924}],919:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r,n=t._fullData.length,i=0;i<n;i++){var a=t._fullData[i];if(a.index!==e.index&&("carpet"===a.type&&(r||(r=a),a.carpet===e.carpet)))return a}return r}},{}],920:[function(t,e,r){"use strict";e.exports=function(t,e,r){if(0===t.length)return"";var n,i=[],a=r?3:1;for(n=0;n<t.length;n+=a)i.push(t[n]+","+e[n]),r&&n<t.length-a&&(i.push("C"),i.push([t[n+1]+","+e[n+1],t[n+2]+","+e[n+2]+" "].join(" ")));return i.join(r?"":"L")}},{}],921:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n;for(Array.isArray(t)?t.length>e.length&&(t=t.slice(0,e.length)):t=[],n=0;n<e.length;n++)t[n]=r(e[n]);return t}},{}],922:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i;for(Array.isArray(t)?t.length>e.length&&(t=t.slice(0,e.length)):t=[],n=0;n<e.length;n++)for(Array.isArray(t[n])?t[n].length>e.length&&(t[n]=t[n].slice(0,e.length)):t[n]=[],i=0;i<e[0].length;i++)t[n][i]=r(e[n][i]);return t}},{}],923:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i,a){var o=i[0]*t.dpdx(e),s=i[1]*t.dpdy(r),l=1,c=1;if(a){var u=Math.sqrt(i[0]*i[0]+i[1]*i[1]),h=Math.sqrt(a[0]*a[0]+a[1]*a[1]),f=(i[0]*a[0]+i[1]*a[1])/u/h;c=Math.max(0,f)}var d=180*Math.atan2(s,o)/Math.PI;return d<-90?(d+=180,l=-l):d>90&&(d-=180,l=-l),{angle:d,flip:l,p:t.c2p(n,e,r),offsetMultplier:c}}},{}],924:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll(e+"."+r).data([0]);return n.enter().append(e).classed(r,!0),n}function i(t,e,r){var i=r[0],l=r[0].trace,c=e.xaxis,f=e.yaxis,d=l.aaxis,p=l.baxis,m=t._fullLayout,g=e.plot.selectAll(".carpetlayer"),v=m._clips,y=n(g,"g","carpet"+l.uid).classed("trace",!0),b=n(y,"g","minorlayer"),x=n(y,"g","majorlayer"),_=n(y,"g","boundarylayer"),w=n(y,"g","labellayer");y.style("opacity",l.opacity),a(c,f,x,d,"a",d._gridlines),a(c,f,x,p,"b",p._gridlines),a(c,f,b,d,"a",d._minorgridlines),a(c,f,b,p,"b",p._minorgridlines),a(c,f,_,d,"a-boundary",d._boundarylines),a(c,f,_,p,"b-boundary",p._boundarylines);!function(t,e,r,n,i,a,o,l){var c,u,h,f;c=.5*(r.a[0]+r.a[r.a.length-1]),u=r.b[0],h=r.ab2xy(c,u,!0),f=r.dxyda_rough(c,u),s(t,e,r,n,h,f,r.aaxis,i,a,o,"a-title"),c=r.a[0],u=.5*(r.b[0]+r.b[r.b.length-1]),h=r.ab2xy(c,u,!0),f=r.dxydb_rough(c,u),s(t,e,r,n,h,f,r.baxis,i,a,l,"b-title")}(t,w,l,i,c,f,o(t,c,f,l,i,w,d._labels,"a-label"),o(t,c,f,l,i,w,p._labels,"b-label")),function(t,e,r,i,a){var o,s,l,c,f=r.select("#"+t._clipPathId);f.size()||(f=r.append("clipPath").classed("carpetclip",!0));var d=n(f,"path","carpetboundary"),p=e.clipsegments,m=[];for(c=0;c<p.length;c++)o=p[c],s=u([],o.x,i.c2p),l=u([],o.y,a.c2p),m.push(h(s,l,o.bicubic));var g="M"+m.join("L")+"Z";f.attr("id",t._clipPathId),d.attr("d",g)}(l,i,v,c,f)}function a(t,e,r,n,i,a){var o="const-"+i+"-lines",s=r.selectAll("."+o).data(a);s.enter().append("path").classed(o,!0).style("vector-effect","non-scaling-stroke"),s.each(function(r){var n=r,i=n.x,a=n.y,o=u([],i,t.c2p),s=u([],a,e.c2p),c="M"+h(o,s,n.smoothing);l.select(this).attr("d",c).style("stroke-width",n.width).style("stroke",n.color).style("fill","none")}),s.exit().remove()}function o(t,e,r,n,i,a,o,s){var u=a.selectAll("text."+s).data(o);u.enter().append("text").classed(s,!0);var h=0;return u.each(function(i){var a;if("auto"===i.axis.tickangle)a=f(n,e,r,i.xy,i.dxy);else{var o=(i.axis.tickangle+180)*Math.PI/180;a=f(n,e,r,i.xy,[Math.cos(o),Math.sin(o)])}var s=(i.endAnchor?-1:1)*a.flip,u=l.select(this).attr({"text-anchor":s>0?"start":"end","data-notex":1}).call(c.font,i.font).text(i.text).call(d.convertToTspans,t),p=c.bBox(this);u.attr("transform","translate("+a.p[0]+","+a.p[1]+") rotate("+a.angle+")translate("+i.axis.labelpadding*s+","+.3*p.height+")"),h=Math.max(h,p.width+i.axis.labelpadding)}),u.exit().remove(),h}function s(t,e,r,n,i,a,o,s,u,h,p){var m=[];o.title&&m.push(o.title);var g=e.selectAll("text."+p).data(m);g.enter().append("text").classed(p,!0),g.each(function(){var e=f(r,s,u,i,a);-1===["start","both"].indexOf(o.showticklabels)&&(h=0),h+=o.titlefont.size+o.titleoffset;l.select(this).text(o.title||"").call(d.convertToTspans,t).attr("transform","translate("+e.p[0]+","+e.p[1]+") rotate("+e.angle+") translate(0,"+h+")").classed("user-select-none",!0).attr("text-anchor","middle").call(c.font,o.titlefont)}),g.exit().remove()}var l=t("d3"),c=t("../../components/drawing"),u=t("./map_1d_array"),h=t("./makepath"),f=t("./orient_text"),d=t("../../lib/svg_text_utils");e.exports=function(t,e,r){for(var n=0;n<r.length;n++)i(t,e,r[n])}},{"../../components/drawing":638,"../../lib/svg_text_utils":761,"./makepath":920,"./map_1d_array":921,"./orient_text":923,d3:123}],925:[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=t.a.length,u=t.b.length,h=t.aaxis,f=t.baxis,d=e[0],p=e[c-1],m=r[0],g=r[u-1],v=e[e.length-1]-e[0],y=r[r.length-1]-r[0],b=v*n.RELATIVE_CULL_TOLERANCE,x=y*n.RELATIVE_CULL_TOLERANCE;d-=b,p+=b,m-=x,g+=x,t.isVisible=function(t,e){return t>d&&t<p&&e>m&&e<g},t.isOccluded=function(t,e){return t<d||t>p||e<m||e>g},h.c2p=function(t){return t},f.c2p=function(t){return t},t.setScale=function(){var e=t.x,r=t.y,n=a(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(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&&(n<e[0]||n>e[c-1]|i<r[0]||i>r[u-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(i),l=t.evalxy([],o,s);if(a){var h,f,d,p,m=0,g=0,v=[];n<e[0]?(h=0,f=0,m=(n-e[0])/(e[1]-e[0])):n>e[c-1]?(h=c-2,f=1,m=(n-e[c-1])/(e[c-1]-e[c-2])):f=o-(h=Math.max(0,Math.min(c-2,Math.floor(o)))),i<r[0]?(d=0,p=0,g=(i-r[0])/(r[1]-r[0])):i>r[u-1]?(d=u-2,p=1,g=(i-r[u-1])/(r[u-1]-r[u-2])):p=s-(d=Math.max(0,Math.min(u-2,Math.floor(s)))),m&&(t.dxydi(v,h,d,f,p),l[0]+=v[0]*m,l[1]+=v[1]*m),g&&(t.dxydj(v,h,d,f,p),l[0]+=v[0]*g,l[1]+=v[1]*g)}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":756,"./compute_control_points":911,"./constants":912,"./create_i_derivative_evaluator":913,"./create_j_derivative_evaluator":914,"./create_spline_evaluator":915}],926:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){function i(e,r){var n,i=0,a=0;return e>0&&void 0!==(n=t[r][e-1])&&(a++,i+=n),e<u-1&&void 0!==(n=t[r][e+1])&&(a++,i+=n),r>0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r<h-1&&void 0!==(n=t[r+1][e])&&(a++,i+=n),i/Math.max(1,a)}var a,o,s,l=[],c=[],u=t[0].length,h=t.length,f=0;for(a=0;a<u;a++)for(o=0;o<h;o++)void 0===t[o][a]&&(l.push(a),c.push(o),t[o][a]=i(a,o)),f=Math.max(f,Math.abs(t[o][a]));if(!l.length)return t;var d,p,m,g,v,y,b,x,_,w,M,k=0,T=0,A=l.length;do{for(k=0,s=0;s<A;s++){a=l[s],o=c[s];var S,E,L,C,I,P,D=0,z=0;0===a?(L=e[I=Math.min(u-1,2)],C=e[1],S=t[o][I],z+=(E=t[o][1])+(E-S)*(e[0]-C)/(C-L),D++):a===u-1&&(L=e[I=Math.max(0,u-3)],C=e[u-2],S=t[o][I],z+=(E=t[o][u-2])+(E-S)*(e[u-1]-C)/(C-L),D++),(0===a||a===u-1)&&o>0&&o<h-1&&(d=r[o+1]-r[o],z+=((p=r[o]-r[o-1])*t[o+1][a]+d*t[o-1][a])/(p+d),D++),0===o?(L=r[P=Math.min(h-1,2)],C=r[1],S=t[P][a],z+=(E=t[1][a])+(E-S)*(r[0]-C)/(C-L),D++):o===h-1&&(L=r[P=Math.max(0,h-3)],C=r[h-2],S=t[P][a],z+=(E=t[h-2][a])+(E-S)*(r[h-1]-C)/(C-L),D++),(0===o||o===h-1)&&a>0&&a<u-1&&(d=e[a+1]-e[a],z+=((p=e[a]-e[a-1])*t[o][a+1]+d*t[o][a-1])/(p+d),D++),D?z/=D:(m=e[a+1]-e[a],g=e[a]-e[a-1],x=(v=r[o+1]-r[o])*(y=r[o]-r[o-1])*(v+y),z=((b=m*g*(m+g))*(y*t[o+1][a]+v*t[o-1][a])+x*(g*t[o][a+1]+m*t[o][a-1]))/(x*(g+m)+b*(y+v))),k+=(w=(_=z-t[o][a])/f)*w,M=D?0:.85,t[o][a]+=_*(1+M)}k=Math.sqrt(k)}while(T++<100&&k>1e-5);return n.log("Smoother converged to",k,"after",T,"iterations"),t}},{"../../lib":738}],927:[function(t,e,r){"use strict";var n=t("./has_columns"),i=t("../heatmap/convert_column_xyz");e.exports=function(t,e,r){var a=[],o=r("x");o&&!n(o)&&a.push("x"),e._cheater=!o;var s=r("y");if(s&&!n(s)&&a.push("y"),o||s)return a.length&&i(e,e.aaxis,e.baxis,"a","b",a),!0}},{"../heatmap/convert_column_xyz":969,"./has_columns":917}],928:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../plots/attributes"),s=t("../../lib/extend"),l=s.extendFlat,c=s.extendDeepAll,u=n.marker.line;e.exports=l({locations:{valType:"data_array",editType:"calc"},locationmode:n.locationmode,z:{valType:"data_array",editType:"calc"},text:l({},n.text,{}),marker:{line:{color:u.color,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:n.selected.marker.opacity,editType:"plot"},editType:"plot"},unselected:{marker:{opacity:n.unselected.marker.opacity,editType:"plot"},editType:"plot"},hoverinfo:l({},o.hoverinfo,{editType:"calc",flags:["location","z","text","name"]})},c({},i,{zmax:{editType:"calc"},zmin:{editType:"calc"}}),{colorbar:a})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../../plots/attributes":783,"../scattergeo/attributes":1093}],929:[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");e.exports=function(t,e){for(var r=e.locations.length,l=new Array(r),c=0;c<r;c++){var u=l[c]={},h=e.locations[c],f=e.z[c];u.loc="string"==typeof h?h:null,u.z=n(f)?f:i}return o(l,e),a(e,e.z,"","z"),s(l,e),l}},{"../../components/colorscale/calc":620,"../../constants/numerical":717,"../scatter/arrays_to_calcdata":1053,"../scatter/calc_selection":1056,"fast-isnumeric":132}],930:[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,c=s("locations");if(c&&(l=c.length),c&&l){var u=s("z");Array.isArray(u)?(u.length>l&&(e.z=u.slice(0,l)),s("locationmode"),s("text"),s("marker.line.color"),s("marker.line.width"),s("marker.opacity"),i(t,e,o,s,{prefix:"",cLetter:"z"}),n.coerceSelectionMarkerOpacity(e,s)):e.visible=!1}else e.visible=!1}},{"../../components/colorscale/defaults":623,"../../lib":738,"./attributes":928}],931:[function(t,e,r){"use strict";e.exports=function(t,e){return t.location=e.location,t.z=e.z,t}},{}],932:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("./attributes"),a=t("../scatter/fill_hover_text");e.exports=function(t,e,r){var o,s,l,c,u=t.cd,h=u[0].trace,f=t.subplot;for(s=0;s<u.length;s++)if(o=u[s],c=!1,o._polygons){for(l=0;l<o._polygons.length;l++)o._polygons[l].contains([e,r])&&(c=!c),o._polygons[l].contains([e+360,r])&&(c=!c);if(c)break}if(c&&o)return t.x0=t.x1=t.xa.c2p(o.ct),t.y0=t.y1=t.ya.c2p(o.ct),t.index=o.index,t.location=o.loc,t.z=o.z,function(t,e,r,o){var s=r.hi||e.hoverinfo,l="all"===s?i.hoverinfo.flags:s.split("+"),c=-1!==l.indexOf("name"),u=-1!==l.indexOf("location"),h=-1!==l.indexOf("z"),f=-1!==l.indexOf("text"),d=[];!c&&u?t.nameOverride=r.loc:(c&&(t.nameOverride=e.name),u&&d.push(r.loc)),h&&d.push(function(t){return n.tickText(o,o.c2l(t),"hover").text}(r.z)),f&&a(r,e,d),t.extraText=d.join("<br>")}(t,h,o,f.mockAxis),[t]}},{"../../plots/cartesian/axes":785,"../scatter/fill_hover_text":1062,"./attributes":928}],933:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="choropleth",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","noOpacity"],n.meta={},e.exports=n},{"../../plots/geo":814,"../heatmap/colorbar":968,"./attributes":928,"./calc":929,"./defaults":930,"./event_data":931,"./hover":932,"./plot":934,"./select":935,"./style":936}],934:[function(t,e,r){"use strict";function n(t,e){for(var r=t[0].trace,n=t.length,i=s(r,e),a=0;a<n;a++){var c=t[a],u=l(r.locationmode,c.loc,i);u?(c.geojson=u,c.ct=u.properties.ct,c.index=a,c._polygons=function(t){function e(t){for(var e=0;e<t.length-1;e++)if(t[e][0]>0&&t[e+1][0]<0)return e;return null}var r,n,i,a,s=t.geometry,l=s.coordinates,c=t.id,u=[];r="RUS"===c||"FJI"===c?function(t){var r;if(null===e(t))r=t;else for(r=new Array(t.length),a=0;a<t.length;a++)r[a]=[t[a][0]<0?t[a][0]+360:t[a][0],t[a][1]];u.push(o.tester(r))}:"ATA"===c?function(t){var r=e(t);if(null===r)return u.push(o.tester(t));var n=new Array(t.length+1),i=0;for(a=0;a<t.length;a++)a>r?n[i++]=[t[a][0]+360,t[a][1]]:a===r?(n[i++]=t[a],n[i++]=[t[a][0],-90]):n[i++]=t[a];var s=o.tester(n);s.pts.pop(),u.push(s)}:function(t){u.push(o.tester(t))};switch(s.type){case"MultiPolygon":for(n=0;n<l.length;n++)for(i=0;i<l[n].length;i++)r(l[n][i]);break;case"Polygon":for(n=0;n<l.length;n++)r(l[n])}return u}(u)):c.geojson=null}}var i=t("d3"),a=t("../../lib"),o=t("../../lib/polygon"),s=t("../../lib/topojson_utils").getTopojsonFeatures,l=t("../../lib/geo_location_utils").locationToFeature,c=t("./style");e.exports=function(t,e){for(var r=0;r<e.length;r++)n(e[r],t.topojson);var o=t.layers.backplot.select(".choroplethlayer").selectAll("g.trace.choropleth").data(e,function(t){return t[0].trace.uid});o.enter().append("g").attr("class","trace choropleth"),o.exit().remove(),o.each(function(e){var r=(e[0].node3=i.select(this)).selectAll("path.choroplethlocation").data(a.identity);r.enter().append("path").classed("choroplethlocation",!0),r.exit().remove(),c(t.graphDiv,e)})}},{"../../lib":738,"../../lib/geo_location_utils":730,"../../lib/polygon":750,"../../lib/topojson_utils":764,"./style":936,d3:123}],935:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i,a,o,s=t.cd,l=t.xaxis,c=t.yaxis,u=[];if(!1===e)for(r=0;r<s.length;r++)s[r].selected=0;else for(r=0;r<s.length;r++)(i=(n=s[r]).ct)&&(a=l.c2p(i),o=c.c2p(i),e.contains([a,o])?(u.push({pointNumber:r,lon:i[0],lat:i[1]}),n.selected=1):n.selected=0);return u}},{}],936:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),a=t("../../components/drawing"),o=t("../../components/colorscale");e.exports=function(t,e){e&&function(t,e){var r=e[0].trace,s=e[0].node3.selectAll(".choroplethlocation"),l=r.marker||{},c=l.line||{},u=o.makeColorScaleFunc(o.extractScale(r.colorscale,r.zmin,r.zmax));s.each(function(t){n.select(this).attr("fill",u(t.z)).call(i.stroke,t.mlc||c.color).call(a.dashLine,"",t.mlw||c.width||0).style("opacity",l.opacity)}),a.selectedPointStyle(s,r)}(0,e)}},{"../../components/color":613,"../../components/colorscale":628,"../../components/drawing":638,d3:123}],937:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),i=t("../scatter/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../components/colorbar/attributes"),s=t("../../components/drawing/attributes").dash,l=t("../../plots/font_attributes"),c=t("../../lib/extend").extendFlat,u=i.line;e.exports=c({z:n.z,x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:n.text,transpose:n.transpose,xtype:n.xtype,ytype:n.ytype,zhoverformat:n.zhoverformat,connectgaps:n.connectgaps,autocontour:{valType:"boolean",dflt:!0,editType:"calc",impliedEdits:{"contours.start":void 0,"contours.end":void 0,"contours.size":void 0}},ncontours:{valType:"integer",dflt:15,min:1,editType:"calc"},contours:{start:{valType:"number",dflt:null,editType:"plot",impliedEdits:{"^autocontour":!1}},end:{valType:"number",dflt:null,editType:"plot",impliedEdits:{"^autocontour":!1}},size:{valType:"number",dflt:null,min:0,editType:"plot",impliedEdits:{"^autocontour":!1}},coloring:{valType:"enumerated",values:["fill","heatmap","lines","none"],dflt:"fill",editType:"calc"},showlines:{valType:"boolean",dflt:!0,editType:"plot"},showlabels:{valType:"boolean",dflt:!1,editType:"plot"},labelfont:l({editType:"plot",colorEditType:"style"}),labelformat:{valType:"string",dflt:"",editType:"plot"},editType:"calc",impliedEdits:{autocontour:!1}},line:{color:c({},u.color,{editType:"style+colorbars"}),width:c({},u.width,{editType:"style+colorbars"}),dash:s,smoothing:c({},u.smoothing,{}),editType:"plot"}},a,{autocolorscale:c({},a.autocolorscale,{dflt:!1}),zmin:c({},a.zmin,{editType:"calc"}),zmax:c({},a.zmax,{editType:"calc"})},{colorbar:o})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../components/drawing/attributes":637,"../../lib/extend":727,"../../plots/font_attributes":810,"../heatmap/attributes":965,"../scatter/attributes":1054}],938:[function(t,e,r){"use strict";function n(t,e,r){var n={type:"linear",range:[t,e]};return i.autoTicks(n,(e-t)/(r||15)),n}var i=t("../../plots/cartesian/axes"),a=t("../../lib").extendFlat,o=t("../heatmap/calc");e.exports=function(t,e){var r=o(t,e),s=e.contours;if(!1!==e.autocontour){var l=n(e.zmin,e.zmax,e.ncontours);s.size=l.dtick,s.start=i.tickFirst(l),l.range.reverse(),s.end=i.tickFirst(l),s.start===e.zmin&&(s.start+=s.size),s.end===e.zmax&&(s.end-=s.size),s.start>s.end&&(s.start=s.end=(s.start+s.end)/2),e._input.contours||(e._input.contours={}),a(e._input.contours,{start:s.start,end:s.end,size:s.size}),e._input.autocontour=!0}else{var c=s.start,u=s.end,h=e._input.contours;if(c>u&&(s.start=h.start=u,u=s.end=h.end=c,c=s.start),!(s.size>0)){var f;f=c===u?1:n(c,u,e.ncontours).dtick,h.size=s.size=f}}return r}},{"../../lib":738,"../../plots/cartesian/axes":785,"../heatmap/calc":966}],939:[function(t,e,r){"use strict";var n=t("../../plots/plots"),i=t("../../components/colorbar/draw"),a=t("./make_color_map"),o=t("./end_plus");e.exports=function(t,e){var r=e[0].trace,s="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+s).remove(),r.showscale){var l=i(t,s);e[0].t.cb=l;var c=r.contours,u=r.line,h=c.size||1,f=c.coloring,d=a(r,{isColorbar:!0});"heatmap"===f&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===f||"heatmap"===f?d:"").line({color:"lines"===f?d:u.color,width:!1!==c.showlines?u.width:0,dash:u.dash}).levels({start:c.start,end:o(c),size:h}).options(r.colorbar)()}else n.autoMargin(t,s)}},{"../../components/colorbar/draw":617,"../../plots/plots":846,"./end_plus":943,"./make_color_map":947}],940:[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}}},{}],941:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r){var a=n.coerce2(t,e,i,"contours.start"),o=n.coerce2(t,e,i,"contours.end"),s=!1===a||!1===o,l=r("contours.size");!(s?e.autocontour=!0:r("autocontour",!1))&&l||r("ncontours")}},{"../../lib":738,"./attributes":937}],942:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/has_columns"),a=t("../heatmap/xyz_defaults"),o=t("./contours_defaults"),s=t("./style_defaults"),l=t("./attributes");e.exports=function(t,e,r,c){function u(r,i){return n.coerce(t,e,l,r,i)}a(t,e,u,c)?(u("text"),u("connectgaps",i(e)),o(t,e,u),s(t,e,u,c)):e.visible=!1}},{"../../lib":738,"../heatmap/has_columns":972,"../heatmap/xyz_defaults":981,"./attributes":937,"./contours_defaults":941,"./style_defaults":951}],943:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],944:[function(t,e,r){"use strict";function n(t,e,r,n){return Math.abs(t[0]-e[0])<r&&Math.abs(t[1]-e[1])<n}function i(t,e){var r=t[2]-e[2],n=t[3]-e[3];return Math.sqrt(r*r+n*n)}function a(t,e,r,a,c){function u(t){return g[t%g.length]}var h,f=e.join(","),d=f,p=t.crossings[d],m=function(t,e,r){var n=0,i=0;t>20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==l.BOTTOMSTART.indexOf(t)?i=1:-1!==l.LEFTSTART.indexOf(t)?n=1:-1!==l.TOPSTART.indexOf(t)?i=-1:n=-1;return[n,i]}(p,r,e),g=[o(t,e,[-m[0],-m[1]])],v=m.join(","),y=t.z.length,b=t.z[0].length;for(h=0;h<1e4;h++){if(p>20?(p=l.CHOOSESADDLE[p][(m[0]||m[1])<0?0:1],t.crossings[d]=l.SADDLEREMAINDER[p]):delete t.crossings[d],!(m=l.NEWDELTA[p])){s.log("Found bad marching index:",p,e,t.level);break}g.push(o(t,e,m)),e[0]+=m[0],e[1]+=m[1],n(g[g.length-1],g[g.length-2],a,c)&&g.pop(),d=e.join(",");var x=m[0]&&(e[0]<0||e[0]>b-2)||m[1]&&(e[1]<0||e[1]>y-2);if(d===f&&m.join(",")===v||r&&x)break;p=t.crossings[d]}1e4===h&&s.log("Infinite loop in contour?");var _,w,M,k,T,A,S,E,L,C,I,P=n(g[0],g[g.length-1],a,c),D=0,z=.2*t.smoothing,O=[],F=0;for(h=1;h<g.length;h++)D+=S=i(g[h],g[h-1]),O.push(S);var R=D/O.length*z;for(h=g.length-2;h>=F;h--)if((_=O[h])<R){for(M=0,w=h-1;w>=F&&_+O[w]<R;w--)_+=O[w];if(P&&h===g.length-2)for(M=0;M<w&&_+O[M]<R;M++)_+=O[M];T=h-w+M+1,A=Math.floor((h+w+M+2)/2),k=P||h!==g.length-2?P||-1!==w?T%2?u(A):[(u(A)[0]+u(A+1)[0])/2,(u(A)[1]+u(A+1)[1])/2]:g[0]:g[g.length-1],g.splice(w+1,h-w+1,k),h=w+1,M&&(F=M),P&&(h===g.length-2?g[M]=g[g.length-1]:0===h&&(g[g.length-1]=g[0]))}for(g.splice(0,F),h=0;h<g.length;h++)g[h].length=2;if(!(g.length<2))if(P)g.pop(),t.paths.push(g);else{r||s.log("Unclosed interior contour?",t.level,f,g.join("L"));var j=!1;for(E=0;E<t.edgepaths.length;E++)if(C=t.edgepaths[E],!j&&n(C[0],g[g.length-1],a,c)){g.pop(),j=!0;var N=!1;for(L=0;L<t.edgepaths.length;L++)if(I=t.edgepaths[L],n(I[I.length-1],g[0],a,c)){N=!0,g.shift(),t.edgepaths.splice(E,1),L===E?t.paths.push(g.concat(I)):(L>E&&L--,t.edgepaths[L]=I.concat(g,C));break}N||(t.edgepaths[E]=g.concat(C))}for(E=0;E<t.edgepaths.length&&!j;E++)n((C=t.edgepaths[E])[C.length-1],g[0],a,c)&&(g.shift(),t.edgepaths[E]=C.concat(g),j=!0);j||t.edgepaths.push(g)}}function o(t,e,r){var n=e[0]+Math.max(r[0],0),i=e[1]+Math.max(r[1],0),a=t.z[i][n],o=t.xaxis,s=t.yaxis;if(r[1]){var l=(t.level-a)/(t.z[i][n+1]-a);return[o.c2p((1-l)*t.x[n]+l*t.x[n+1],!0),s.c2p(t.y[i],!0),n+l,i]}var c=(t.level-a)/(t.z[i+1][n]-a);return[o.c2p(t.x[n],!0),s.c2p((1-c)*t.y[i]+c*t.y[i+1],!0),n,i+c]}var s=t("../../lib"),l=t("./constants");e.exports=function(t,e,r){var n,i,o,l;for(e=e||.01,r=r||.01,i=0;i<t.length;i++){for(o=t[i],l=0;l<o.starts.length;l++)a(o,o.starts[l],"edge",e,r);for(n=0;Object.keys(o.crossings).length&&n<1e4;)n++,a(o,Object.keys(o.crossings)[0].split(",").map(Number),void 0,e,r);1e4===n&&s.log("Infinite loop in contour?")}}},{"../../lib":738,"./constants":940}],945:[function(t,e,r){"use strict";var n=t("../heatmap/hover");e.exports=function(t,e,r,i,a){return n(t,e,r,i,a,!0)}},{"../heatmap/hover":973}],946:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot").plot,n.style=t("./style"),n.colorbar=t("./colorbar"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="contour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"./attributes":937,"./calc":938,"./colorbar":939,"./defaults":942,"./hover":945,"./plot":949,"./style":950}],947:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/colorscale"),a=t("./end_plus");e.exports=function(t){var e=t.contours,r=e.start,o=a(e),s=e.size||1,l=Math.floor((o-r)/s)+1,c="lines"===e.coloring?0:1;isFinite(s)||(s=1,l=1);var u,h,f=t.colorscale,d=f.length,p=new Array(d),m=new Array(d);if("heatmap"===e.coloring){for(t.zauto&&!1===t.autocontour&&(t.zmin=r-s/2,t.zmax=t.zmin+l*s),h=0;h<d;h++)u=f[h],p[h]=u[0]*(t.zmax-t.zmin)+t.zmin,m[h]=u[1];var g=n.extent([t.zmin,t.zmax,e.start,e.start+s*(l-1)]),v=g[t.zmin<t.zmax?0:1],y=g[t.zmin<t.zmax?1:0];v!==t.zmin&&(p.splice(0,0,v),m.splice(0,0,Range[0])),y!==t.zmax&&(p.push(y),m.push(m[m.length-1]))}else for(h=0;h<d;h++)u=f[h],p[h]=(u[0]*(l+c-1)-c/2)*s+r,m[h]=u[1];return i.makeColorScaleFunc({domain:p,range:m},{noNumericCheck:!0})}},{"../../components/colorscale":628,"./end_plus":943,d3:123}],948:[function(t,e,r){"use strict";var n=t("./constants");e.exports=function(t){var e,r,i,a,o,s,l,c,u,h=t[0].z,f=h.length,d=h[0].length,p=2===f||2===d;for(r=0;r<f-1;r++)for(a=[],0===r&&(a=a.concat(n.BOTTOMSTART)),r===f-2&&(a=a.concat(n.TOPSTART)),e=0;e<d-1;e++)for(i=a.slice(),0===e&&(i=i.concat(n.LEFTSTART)),e===d-2&&(i=i.concat(n.RIGHTSTART)),o=e+","+r,s=[[h[r][e],h[r][e+1]],[h[r+1][e],h[r+1][e+1]]],u=0;u<t.length;u++)(l=function(t,e){var r=(e[0][0]>t?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);if(5===r||10===r)return t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208;return 15===r?0:r}((c=t[u]).level,s))&&(c.crossings[o]=l,-1!==i.indexOf(l)&&(c.starts.push([e,r]),p&&-1!==i.indexOf(l,i.indexOf(l)+1)&&c.starts.push([e,r])))}},{"./constants":940}],949:[function(t,e,r){"use strict";function n(t,e,n){var l=n[0].trace,c=n[0].x,u=n[0].y,g=l.contours,v=l.uid,y=e.xaxis,b=e.yaxis,x=t._fullLayout,_="contour"+v,w=function(t,e,r){for(var n=t.size,i=[],a=p(t),s=t.start;s<a;s+=n)if(i.push({level:s,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:e.xaxis,yaxis:e.yaxis,x:r.x,y:r.y,z:r.z,smoothing:r.trace.line.smoothing}),i.length>1e3){o.warn("Too many contours, clipping at 1000",t);break}return i}(g,e,n[0]);if(!0!==l.visible)return x._paper.selectAll("."+_+",.hm"+v).remove(),void x._infolayer.selectAll(".cb"+v).remove();"heatmap"===g.coloring?(l.zauto&&!1===l.autocontour&&(l._input.zmin=l.zmin=g.start-g.size/2,l._input.zmax=l.zmax=l.zmin+w.length*g.size),h(t,e,[n])):(x._paper.selectAll(".hm"+v).remove(),x._infolayer.selectAll("g.rangeslider-container").selectAll(".hm"+v).remove()),f(w),d(w);var M=y.c2p(c[0],!0),k=y.c2p(c[c.length-1],!0),T=b.c2p(u[0],!0),A=b.c2p(u[u.length-1],!0),S=[[M,A],[k,A],[k,T],[M,T]],E=r.makeContourGroup(e,n,_);!function(t,e,r){var n=t.selectAll("g.contourbg").data([0]);n.enter().append("g").classed("contourbg",!0);var i=n.selectAll("path").data("fill"===r.coloring?[0]:[]);i.enter().append("path"),i.exit().remove(),i.attr("d","M"+e.join("L")+"Z").style("stroke","none")}(E,S,g),function(t,e,r,n){var o=t.selectAll("g.contourfill").data([0]);o.enter().append("g").classed("contourfill",!0);var s=o.selectAll("path").data("fill"===n.coloring?e:[]);s.enter().append("path"),s.exit().remove(),s.each(function(t){var e=i(t,r);e?a.select(this).attr("d",e).style("stroke","none"):a.select(this).remove()})}(E,w,S,g),function(t,e,n,i,l,c){var u=t.selectAll("g.contourlines").data([0]);u.enter().append("g").classed("contourlines",!0);var h=!1!==l.showlines,f=l.showlabels,d=h&&f,p=r.createLines(u,h||f,e),g=r.createLineClip(u,d,n._fullLayout._clips,i.trace.uid),v=t.selectAll("g.contourlabels").data(f?[0]:[]);if(v.exit().remove(),v.enter().append("g").classed("contourlabels",!0),f){var y=[c],b=[];o.clearLocationCache();var x=r.labelFormatter(l,i.t.cb,n._fullLayout),_=s.tester.append("text").attr("data-notex",1).call(s.font,l.labelfont),w=e[0].xaxis._length,M=e[0].yaxis._length,k={left:Math.max(c[0][0],0),right:Math.min(c[2][0],w),top:Math.max(c[0][1],0),bottom:Math.min(c[2][1],M)};k.middle=(k.top+k.bottom)/2,k.center=(k.left+k.right)/2;var T=Math.sqrt(w*w+M*M),A=m.LABELDISTANCE*T/Math.max(1,e.length/m.LABELINCREASE);p.each(function(t){var e=r.calcTextOpts(t.level,x,_,n);a.select(this).selectAll("path").each(function(){var t=o.getVisibleSegment(this,k,e.height/2);if(t&&!(t.len<(e.width+e.height)*m.LABELMIN))for(var n=Math.min(Math.ceil(t.len/A),m.LABELMAX),i=0;i<n;i++){var a=r.findBestTextLocation(this,t,e,b,k);if(!a)break;r.addLabelData(a,e,b,y)}})}),_.remove(),r.drawLabels(v,b,n,g,d?y:null)}f&&!h&&p.remove()}(E,w,t,n[0],g,S),function(t,e,r,n,a){var o="clip"+n.trace.uid,l=r.selectAll("#"+o).data(n.trace.connectgaps?[]:[0]);if(l.enter().append("clipPath").classed("contourclip",!0).attr("id",o),l.exit().remove(),!1===n.trace.connectgaps){var c={level:.9,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:e.xaxis,yaxis:e.yaxis,x:n.x,y:n.y,z:function(t){var e,r,n=t.trace._emptypoints,i=[],a=t.z.length,o=t.z[0].length,s=[];for(e=0;e<o;e++)s.push(1);for(e=0;e<a;e++)i.push(s.slice());for(e=0;e<n.length;e++)r=n[e],i[r[0]][r[1]]=0;return t.zmask=i,i}(n),smoothing:0};f([c]),d([c]);var u=i(c,a),h=l.selectAll("path").data([0]);h.enter().append("path"),h.attr("d",u)}else o=null;t.call(s.setClipUrl,o),e.plot.selectAll(".hm"+n.trace.uid).call(s.setClipUrl,o)}(E,e,x._clips,n[0],S)}function i(t,e){function r(t){return Math.abs(t[1]-e[0][1])<.01}function n(t){return Math.abs(t[1]-e[2][1])<.01}function i(t){return Math.abs(t[0]-e[0][0])<.01}function a(t){return Math.abs(t[0]-e[2][0])<.01}for(var l,c,u,h,f,d,p=Math.min(t.z[0][0],t.z[0][1]),m=t.edgepaths.length||p<=t.level?"":"M"+e.join("L")+"Z",g=0,v=t.edgepaths.map(function(t,e){return e}),y=!0;v.length;){for(d=s.smoothopen(t.edgepaths[g],t.smoothing),m+=y?d:d.replace(/^M/,"L"),v.splice(v.indexOf(g),1),l=t.edgepaths[g][t.edgepaths[g].length-1],h=-1,u=0;u<4;u++){if(!l){o.log("Missing end?",g,t);break}for(r(l)&&!a(l)?c=e[1]:i(l)?c=e[0]:n(l)?c=e[3]:a(l)&&(c=e[2]),f=0;f<t.edgepaths.length;f++){var b=t.edgepaths[f][0];Math.abs(l[0]-c[0])<.01?Math.abs(l[0]-b[0])<.01&&(b[1]-l[1])*(c[1]-b[1])>=0&&(c=b,h=f):Math.abs(l[1]-c[1])<.01?Math.abs(l[1]-b[1])<.01&&(b[0]-l[0])*(c[0]-b[0])>=0&&(c=b,h=f):o.log("endpt to newendpt is not vert. or horz.",l,c,b)}if(l=c,h>=0)break;m+="L"+c}if(h===t.edgepaths.length){o.log("unclosed perimeter path");break}g=h,(y=-1===v.indexOf(g))&&(g=v[0],m+="Z")}for(g=0;g<t.paths.length;g++)m+=s.smoothclosed(t.paths[g],t.smoothing);return m}var a=t("d3"),o=t("../../lib"),s=t("../../components/drawing"),l=t("../../lib/svg_text_utils"),c=t("../../plots/cartesian/axes"),u=t("../../plots/cartesian/set_convert"),h=t("../heatmap/plot"),f=t("./make_crossings"),d=t("./find_all_paths"),p=t("./end_plus"),m=t("./constants"),g=m.LABELOPTIMIZER;r.plot=function(t,e,r){for(var i=0;i<r.length;i++)n(t,e,r[i])},r.makeContourGroup=function(t,e,r){var n=t.plot.select(".maplayer").selectAll("g.contour."+r).data(e);return n.enter().append("g").classed("contour",!0).classed(r,!0),n.exit().remove(),n},r.createLines=function(t,e,r){var n=r[0].smoothing,i=t.selectAll("g.contourlevel").data(e?r:[]);if(i.exit().remove(),i.enter().append("g").classed("contourlevel",!0),e){var a=i.selectAll("path.openline").data(function(t){return t.pedgepaths||t.edgepaths});a.exit().remove(),a.enter().append("path").classed("openline",!0),a.attr("d",function(t){return s.smoothopen(t,n)}).style("stroke-miterlimit",1).style("vector-effect","non-scaling-stroke");var o=i.selectAll("path.closedline").data(function(t){return t.ppaths||t.paths});o.exit().remove(),o.enter().append("path").classed("closedline",!0),o.attr("d",function(t){return s.smoothclosed(t,n)}).style("stroke-miterlimit",1).style("vector-effect","non-scaling-stroke")}return i},r.createLineClip=function(t,e,r,n){var i=e?"clipline"+n:null,a=r.selectAll("#"+i).data(e?[0]:[]);return a.exit().remove(),a.enter().append("clipPath").classed("contourlineclip",!0).attr("id",i),s.setClipUrl(t,i),a},r.labelFormatter=function(t,e,r){if(t.labelformat)return r._d3locale.numberFormat(t.labelformat);var n;return e?n=e.axis:(n={type:"linear",_id:"ycontour",nticks:(t.end-t.start)/t.size,showexponent:"all",range:[t.start,t.end]},u(n,r),c.calcTicks(n),n._tmin=null,n._tmax=null),function(t){return c.tickText(n,t).text}},r.calcTextOpts=function(t,e,r,n){var i=e(t);r.text(i).call(l.convertToTspans,n);var a=s.bBox(r.node(),!0);return{text:i,width:a.width,height:a.height,level:t,dy:(a.top+a.bottom)/2}},r.findBestTextLocation=function(t,e,r,n,i){var a,s,l,c,u,h=r.width;e.isClosed?(s=e.len/g.INITIALSEARCHPOINTS,a=e.min+s/2,l=e.max):(s=(e.len-h)/(g.INITIALSEARCHPOINTS+1),a=e.min+s+h/2,l=e.max-(s+h)/2);for(var f=1/0,d=0;d<g.ITERATIONS;d++){for(var p=a;p<l;p+=s){var m=o.getTextLocation(t,e.total,p,h),v=function(t,e,r,n){var i=e.width/2,a=e.height/2,s=t.x,l=t.y,c=t.theta,u=Math.cos(c)*i,h=Math.sin(c)*i,f=(s>n.center?n.right-s:s-n.left)/(u+Math.abs(Math.sin(c)*a)),d=(l>n.middle?n.bottom-l:l-n.top)/(Math.abs(h)+Math.cos(c)*a);if(f<1||d<1)return 1/0;var p=g.EDGECOST*(1/(f-1)+1/(d-1));p+=g.ANGLECOST*c*c;for(var m=s-u,v=l-h,y=s+u,b=l+h,x=0;x<r.length;x++){var _=r[x],w=Math.cos(_.theta)*_.width/2,M=Math.sin(_.theta)*_.width/2,k=2*o.segmentDistance(m,v,y,b,_.x-w,_.y-M,_.x+w,_.y+M)/(e.height+_.height),T=_.level===e.level,A=T?g.SAMELEVELDISTANCE:1;if(k<=A)return 1/0;p+=g.NEIGHBORCOST*(T?g.SAMELEVELFACTOR:1)/(k-A)}return p}(m,r,n,i);v<f&&(f=v,u=m,c=p)}if(f>2*g.MAXCOST)break;d&&(s/=2),l=(a=c-s/2)+1.5*s}if(f<=g.MAXCOST)return u},r.addLabelData=function(t,e,r,n){var i=e.width/2,a=e.height/2,o=t.x,s=t.y,l=t.theta,c=Math.sin(l),u=Math.cos(l),h=i*u,f=a*c,d=i*c,p=-a*u,m=[[o-h-f,s-d-p],[o+h-f,s+d-p],[o+h+f,s+d+p],[o-h+f,s-d+p]];r.push({text:e.text,x:o,y:s,dy:e.dy,theta:l,level:e.level,width:e.width,height:e.height}),n.push(m)},r.drawLabels=function(t,e,r,n,i){var o=t.selectAll("text").data(e,function(t){return t.text+","+t.x+","+t.y+","+t.theta});if(o.exit().remove(),o.enter().append("text").attr({"data-notex":1,"text-anchor":"middle"}).each(function(t){var e=t.x+Math.sin(t.theta)*t.dy,n=t.y-Math.cos(t.theta)*t.dy;a.select(this).text(t.text).attr({x:e,y:n,transform:"rotate("+180*t.theta/Math.PI+" "+e+" "+n+")"}).call(l.convertToTspans,r)}),i){for(var s="",c=0;c<i.length;c++)s+="M"+i[c].join("L")+"Z";var u=n.selectAll("path").data([0]);u.enter().append("path"),u.attr("d",s)}}},{"../../components/drawing":638,"../../lib":738,"../../lib/svg_text_utils":761,"../../plots/cartesian/axes":785,"../../plots/cartesian/set_convert":803,"../heatmap/plot":978,"./constants":940,"./end_plus":943,"./find_all_paths":944,"./make_crossings":948,d3:123}],950:[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.trace.opacity}),e.each(function(t){var e=n.select(this),r=t.trace,a=r.contours,s=r.line,l=a.size||1,c=a.start,u="constraint"===a.type,h=!u&&"lines"===a.coloring,f=!u&&"fill"===a.coloring,d=h||f?o(r):null;e.selectAll("g.contourlevel").each(function(t){n.select(this).selectAll("path").call(i.lineGroupStyle,s.width,h?d(t.level):s.color,s.dash)});var p=a.labelfont;if(e.selectAll("g.contourlabels text").each(function(t){i.font(n.select(this),{family:p.family,size:p.size,color:p.color||(h?d(t.level):s.color)})}),u)e.selectAll("g.contourfill path").style("fill",r.fillcolor);else if(f){var m;e.selectAll("g.contourfill path").style("fill",function(t){return void 0===m&&(m=t.level),d(t.level+.5*l)}),void 0===m&&(m=c),e.selectAll("g.contourbg path").style("fill",d(m-.5*l))}}),a(t)}},{"../../components/drawing":638,"../heatmap/style":979,"./make_color_map":947,d3:123}],951:[function(t,e,r){"use strict";var n=t("../../components/colorscale/defaults"),i=t("../../lib");e.exports=function(t,e,r,a,o){o||(o={});var s,l=r("contours.coloring"),c="";"fill"===l&&(s=r("contours.showlines")),!1!==s&&("lines"!==l&&(c=r("line.color",o.defaultColor||"#000")),r("line.width",void 0===o.defaultWidth?.5:o.defaultWidth),r("line.dash")),r("line.smoothing"),"none"!==l&&n(t,e,a,r,{prefix:"",cLetter:"z"});if(r("contours.showlabels")){var u=a.font;i.coerceFont(r,"contours.labelfont",{family:u.family,size:u.size,color:c}),r("contours.labelformat")}!1!==o.hasHover&&r("zhoverformat")}},{"../../components/colorscale/defaults":623,"../../lib":738}],952:[function(t,e,r){"use strict";var n=t("../heatmap/attributes"),i=t("../contour/attributes"),a=i.contours,o=t("../scatter/attributes"),s=t("../../components/colorscale/attributes"),l=t("../../components/colorbar/attributes"),c=t("../../lib/extend").extendFlat,u=o.line,h=t("./constants");e.exports=c({},{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,transpose:n.transpose,atype:n.xtype,btype:n.ytype,mode:{valType:"flaglist",flags:["lines","fill"],extras:["none"],editType:"calc"},connectgaps:n.connectgaps,fillcolor:{valType:"color",editType:"calc"},autocontour:i.autocontour,ncontours:i.ncontours,contours:{type:{valType:"enumerated",values:["levels","constraint"],dflt:"levels",editType:"calc"},start:a.start,end:a.end,size:a.size,coloring:{valType:"enumerated",values:["fill","lines","none"],dflt:"fill",editType:"calc"},showlines:a.showlines,showlabels:a.showlabels,labelfont:a.labelfont,labelformat:a.labelformat,operation:{valType:"enumerated",values:[].concat(h.INEQUALITY_OPS).concat(h.INTERVAL_OPS).concat(h.SET_OPS),dflt:"=",editType:"calc"},value:{valType:"any",dflt:0,editType:"calc"},editType:"calc"},line:{color:c({},u.color,{}),width:u.width,dash:u.dash,smoothing:c({},u.smoothing,{}),editType:"plot"}},s,{autocolorscale:c({},s.autocolorscale,{dflt:!1})},{colorbar:l})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../contour/attributes":937,"../heatmap/attributes":965,"../scatter/attributes":1054,"./constants":955}],953:[function(t,e,r){"use strict";function n(t,e,r){var n={type:"linear",range:[t,e]};return i.autoTicks(n,(e-t)/(r||15)),n}var i=t("../../plots/cartesian/axes"),a=t("../../lib").extendFlat,o=t("../../components/colorscale/calc"),s=t("../heatmap/has_columns"),l=t("../heatmap/convert_column_xyz"),c=t("../heatmap/clean_2d_array"),u=t("../heatmap/max_row_length"),h=t("../heatmap/interp2d"),f=t("../heatmap/find_empties"),d=t("../heatmap/make_bound_array"),p=t("./defaults"),m=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=m(t,e);if(r&&r.visible&&"legendonly"!==r.visible){if(!e.a||!e.b){var g=t.data[r.index],v=t.data[e.index];v.a||(v.a=g.a),v.b||(v.b=g.b),p(v,e,e._defaultColor,t._fullLayout)}var y=function(t,e){var r,n,i,a,p,m,g,v=e.carpetTrace,y=v.aaxis,b=v.baxis;y._minDtick=0,b._minDtick=0,s(e)&&l(e,y,b,"a","b",["z"]),r=e.a?y.makeCalcdata(e,"a"):[],a=e.b?b.makeCalcdata(e,"b"):[],n=e.a0||0,i=e.da||1,p=e.b0||0,m=e.db||1,g=c(e.z,e.transpose),e._emptypoints=f(g),e._interpz=h(g,e._emptypoints,e._interpz);var x=u(g),_="scaled"===e.xtype?"":r,w=d(e,_,n,i,x,y),M="scaled"===e.ytype?"":a,k={a:w,b:d(e,M,p,m,g.length,b),z:g};return"levels"===e.contours.type&&o(e,g,"","z"),[k]}(0,e),b=e.contours;if(!0===e.autocontour){var x=n(e.zmin,e.zmax,e.ncontours);b.size=x.dtick,b.start=i.tickFirst(x),x.range.reverse(),b.end=i.tickFirst(x),b.start===e.zmin&&(b.start+=b.size),b.end===e.zmax&&(b.end-=b.size),b.start>b.end&&(b.start=b.end=(b.start+b.end)/2),e._input.contours=a({},b)}else{var _=b.start,w=b.end,M=e._input.contours;if(_>w&&(b.start=M.start=w,w=b.end=M.end=_,_=b.start),!(b.size>0)){var k;k=_===w?1:n(_,w,e.ncontours).dtick,M.size=b.size=k}}return y}}},{"../../components/colorscale/calc":620,"../../lib":738,"../../plots/cartesian/axes":785,"../carpet/lookup_carpetid":919,"../heatmap/clean_2d_array":967,"../heatmap/convert_column_xyz":969,"../heatmap/find_empties":971,"../heatmap/has_columns":972,"../heatmap/interp2d":975,"../heatmap/make_bound_array":976,"../heatmap/max_row_length":977,"./defaults":959}],954:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){var i,a,o,s=n.a.length,l=n.b.length,c=n.z,u=-1/0,h=1/0;for(i=0;i<l;i++)h=Math.min(h,c[i][0]),h=Math.min(h,c[i][s-1]),u=Math.max(u,c[i][0]),u=Math.max(u,c[i][s-1]);for(i=1;i<s-1;i++)h=Math.min(h,c[0][i]),h=Math.min(h,c[l-1][i]),u=Math.max(u,c[0][i]),u=Math.max(u,c[l-1][i]);switch(e){case">":case">=":n.contours.value>u&&(t[0].prefixBoundary=!0);break;case"<":case"<=":n.contours.value<h&&(t[0].prefixBoundary=!0);break;case"[]":case"()":a=Math.min.apply(null,n.contours.value),(o=Math.max.apply(null,n.contours.value))<h&&(t[0].prefixBoundary=!0),a>u&&(t[0].prefixBoundary=!0);break;case"][":case")(":a=Math.min.apply(null,n.contours.value),o=Math.max.apply(null,n.contours.value),a<h&&o>u&&(t[0].prefixBoundary=!0)}}},{}],955:[function(t,e,r){"use strict";e.exports={INEQUALITY_OPS:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"]}},{}],956:[function(t,e,r){"use strict";function n(t,e){function r(t){return s(t)?+t:null}var n,i=Array.isArray(e);return-1!==o.INEQUALITY_OPS.indexOf(t)?n=r(i?e[0]:e):-1!==o.INTERVAL_OPS.indexOf(t)?n=i?[r(e[0]),r(e[1])]:[r(e),r(e)]:-1!==o.SET_OPS.indexOf(t)&&(n=i?e.map(r):[r(e)]),n}function i(t){return function(e){e=n(t,e);var r=Math.min(e[0],e[1]),i=Math.max(e[0],e[1]);return{start:r,end:i,size:i-r}}}function a(t){return function(e){return e=n(t,e),{start:e,end:1/0,size:1/0}}}var o=t("./constants"),s=t("fast-isnumeric");e.exports["[]"]=i("[]"),e.exports["()"]=i("()"),e.exports["[)"]=i("[)"),e.exports["(]"]=i("(]"),e.exports["]["]=i("]["),e.exports[")("]=i(")("),e.exports[")["]=i(")["),e.exports["]("]=i("]("),e.exports[">"]=a(">"),e.exports[">="]=a(">="),e.exports["<"]=a("<"),e.exports["<="]=a("<="),e.exports["="]=a("=")},{"./constants":955,"fast-isnumeric":132}],957:[function(t,e,r){"use strict";var n=t("./constraint_mapping"),i=t("fast-isnumeric");e.exports=function(t,e){var r;-1===["=","<","<=",">",">="].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])]:i(e.value)&&(r=parseFloat(e.value),e.value=[r,r+1])):(t("contours.value",0),i(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0));var a=n[e.operation](e.value);e.start=a.start,e.end=a.end,e.size=a.size}},{"./constraint_mapping":956,"fast-isnumeric":132}],958:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){var r,i,a,o=function(t){return t.reverse()},s=function(t){return t};switch(e){case"][":case")[":case"](":case")(":var l=o;o=s,s=l;case"[]":case"[)":case"(]":case"()":if(2!==t.length)return void n.warn("Contour data invalid for the specified inequality range operation.");for(i=t[0],a=t[1],r=0;r<i.edgepaths.length;r++)i.edgepaths[r]=o(i.edgepaths[r]);for(r=0;r<i.paths.length;r++)i.paths[r]=o(i.paths[r]);for(;a.edgepaths.length;)i.edgepaths.push(s(a.edgepaths.shift()));for(;a.paths.length;)i.paths.push(s(a.paths.shift()));t.pop();break;case">=":case">":if(1!==t.length)return void n.warn("Contour data invalid for the specified inequality operation.");for(i=t[0],r=0;r<i.edgepaths.length;r++)i.edgepaths[r]=o(i.edgepaths[r]);for(r=0;r<i.paths.length;r++)i.paths[r]=o(i.paths[r])}}},{"../../lib":738}],959:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../heatmap/xyz_defaults"),a=t("./attributes"),o=t("../contour/style_defaults"),s=t("../scatter/fillcolor_defaults"),l=t("../../plots/attributes"),c=t("./constraint_value_defaults"),u=t("../../components/color").addOpacity;e.exports=function(t,e,r,h){function f(r,i){return n.coerce(t,e,a,r,i)}if(f("carpet"),t.a&&t.b){var d,p,m;if(!i(t,e,f,h,"a","b"))return void(e.visible=!1);f("text"),f("contours.type");var g=e.contours;if("constraint"===g.type){f("contours.operation"),c(f,g),n.coerce(t,e,l,"showlegend",!0),f("contours.coloring","="===g.operation?"lines":"fill"),f("contours.showlines",!0),"="===g.operation&&(g.coloring="lines"),s(t,e,r,f);var v=e.fillcolor?u(e.fillcolor,1):r;o(t,e,f,h,{hasHover:!1,defaultColor:v,defaultWidth:2}),"="===g.operation&&(f("line.color",r),"fill"===g.coloring&&(g.coloring="lines"),"lines"===g.coloring&&delete e.fillcolor),delete e.showscale,delete e.autocontour,delete e.autocolorscale,delete e.colorscale,delete e.ncontours,delete e.colorbar,e.line&&(delete e.line.autocolorscale,delete e.line.colorscale,delete e.line.mincolor,delete e.line.maxcolor)}else n.coerce(t,e,l,"showlegend",!1),p=n.coerce2(t,e,a,"contours.start"),m=n.coerce2(t,e,a,"contours.end"),d=f("contours.size"),f("contours.coloring"),!(!1===p||!1===m?e.autocontour=!0:f("autocontour",!1))&&d||f("ncontours"),o(t,e,f,h,{hasHover:!1}),delete e.value,delete e.operation}else e._defaultColor=r}},{"../../components/color":613,"../../lib":738,"../../plots/attributes":783,"../contour/style_defaults":951,"../heatmap/xyz_defaults":981,"../scatter/fillcolor_defaults":1063,"./attributes":952,"./constraint_value_defaults":957}],960:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r){for(var i=t.size,a=[],o=r.trace.carpetTrace,s=t.start;s<t.end+i/10;s+=i)if(a.push({level:s,crossings:{},starts:[],edgepaths:[],paths:[],xaxis:o.aaxis,yaxis:o.baxis,x:r.a,y:r.b,z:r.z,smoothing:r.trace.line.smoothing}),a.length>1e3){n.warn("Too many contours, clipping at 1000",t);break}return a}},{"../../lib":738}],961:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../contour/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("../contour/style"),n.moduleType="trace",n.name="contourcarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","carpet","contour","symbols","showLegend","hasLines","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"../contour/colorbar":939,"../contour/style":950,"./attributes":952,"./calc":953,"./defaults":959,"./plot":964}],962:[function(t,e,r){"use strict";var n=t("../../components/drawing"),i=t("../carpet/axis_aligned_line"),a=t("../../lib");e.exports=function(t,e,r,o,s,l,c,u){function h(t){return Math.abs(t[1]-r[0][1])<S}function f(t){return Math.abs(t[1]-r[2][1])<S}function d(t){return Math.abs(t[0]-r[0][0])<A}function p(t){return Math.abs(t[0]-r[2][0])<A}function m(t,e){var r,n,a,o,m="";for(h(t)&&!p(t)||f(t)&&!d(t)?(o=s.aaxis,a=i(s,l,[t[0],e[0]],.5*(t[1]+e[1]))):(o=s.baxis,a=i(s,l,.5*(t[0]+e[0]),[t[1],e[1]])),r=1;r<a.length;r++)for(m+=o.smoothing?"C":"L",n=0;n<a[r].length;n++){var g=a[r][n];m+=[c.c2p(g[0]),u.c2p(g[1])]+" "}return m}var g,v,y,b,x,_,w,M="",k=e.edgepaths.map(function(t,e){return e}),T=!0,A=1e-4*Math.abs(r[0][0]-r[2][0]),S=1e-4*Math.abs(r[0][1]-r[2][1]);for(g=0,v=null;k.length;){var E=e.edgepaths[g][0];for(v&&(M+=m(v,E)),w=n.smoothopen(e.edgepaths[g].map(o),e.smoothing),M+=T?w:w.replace(/^M/,"L"),k.splice(k.indexOf(g),1),v=e.edgepaths[g][e.edgepaths[g].length-1],x=-1,b=0;b<4;b++){if(!v){a.log("Missing end?",g,e);break}for(h(v)&&!p(v)?y=r[1]:d(v)?y=r[0]:f(v)?y=r[3]:p(v)&&(y=r[2]),_=0;_<e.edgepaths.length;_++){var L=e.edgepaths[_][0];Math.abs(v[0]-y[0])<A?Math.abs(v[0]-L[0])<A&&(L[1]-v[1])*(y[1]-L[1])>=0&&(y=L,x=_):Math.abs(v[1]-y[1])<S?Math.abs(v[1]-L[1])<S&&(L[0]-v[0])*(y[0]-L[0])>=0&&(y=L,x=_):a.log("endpt to newendpt is not vert. or horz.",v,y,L)}if(x>=0)break;M+=m(v,y),v=y}if(x===e.edgepaths.length){a.log("unclosed perimeter path");break}g=x,(T=-1===k.indexOf(g))&&(g=k[0],M+=m(v,y)+"Z",v=null)}for(g=0;g<e.paths.length;g++)M+=n.smoothclosed(e.paths[g].map(o),e.smoothing);return M}},{"../../components/drawing":638,"../../lib":738,"../carpet/axis_aligned_line":902}],963:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i,a,o,s,l,c,u;for(r=0;r<t.length;r++){for(o=(a=t[r]).pedgepaths=[],s=a.ppaths=[],n=0;n<a.edgepaths.length;n++){for(u=a.edgepaths[n],l=[],i=0;i<u.length;i++)l[i]=e(u[i]);o.push(l)}for(n=0;n<a.paths.length;n++){for(u=a.paths[n],c=[],i=0;i<u.length;i++)c[i]=e(u[i]);s.push(c)}}}},{}],964:[function(t,e,r){"use strict";function n(t,e,r){function n(t){var e=M.ab2xy(t[0],t[1],!0);return[L.c2p(e[0]),C.c2p(e[1])]}var w=r[0].trace,M=w.carpetTrace=x(t,w),k=t.calcdata[M.index][0];if(M.visible&&"legendonly"!==M.visible){var T=r[0].a,A=r[0].b,S=w.contours,E=w.uid,L=e.xaxis,C=e.yaxis,I=t._fullLayout,P="contour"+E,D=y(S,e,r[0]),z="constraint"===w.contours.type;if(!0===w.visible){var O=[[T[0],A[A.length-1]],[T[T.length-1],A[A.length-1]],[T[T.length-1],A[0]],[T[0],A[0]]];f(D);var F=1e-8*(T[T.length-1]-T[0]),R=1e-8*(A[A.length-1]-A[0]);d(D,F,R),"constraint"===w.contours.type&&(g(D,w.contours.operation),_(D,w.contours.operation,O,w)),b(D,n);var j,N,B,U,V=p.makeContourGroup(e,r,P),H=[];for(U=k.clipsegments.length-1;U>=0;U--)j=k.clipsegments[U],N=l([],j.x,L.c2p),B=l([],j.y,C.c2p),N.reverse(),B.reverse(),H.push(c(N,B,j.bicubic));var q="M"+H.join("L")+"Z";!function(t,e,r,n,i,a){var o,s,u,h,f=t.selectAll("g.contourbg").data([0]);f.enter().append("g").classed("contourbg",!0);var d=f.selectAll("path").data("fill"!==a||i?[]:[0]);d.enter().append("path"),d.exit().remove();var p=[];for(h=0;h<e.length;h++)o=e[h],s=l([],o.x,r.c2p),u=l([],o.y,n.c2p),p.push(c(s,u,o.bicubic));d.attr("d","M"+p.join("L")+"Z").style("stroke","none")}(V,k.clipsegments,L,C,z,S.coloring),function(t,e,r,n,i,a,o,l,c,u,h){var f=e.selectAll("g.contourfill").data([0]);f.enter().append("g").classed("contourfill",!0);var d=f.selectAll("path").data("fill"===u?i:[]);d.enter().append("path"),d.exit().remove(),d.each(function(e){var i=v(t,e,a,o,l,c,r,n);e.prefixBoundary&&(i=h+i),i?s.select(this).attr("d",i).style("stroke","none"):s.select(this).remove()})}(w,V,L,C,D,O,n,M,k,S.coloring,q),function(t,e,r,n,l,c,f){var d=t.selectAll("g.contourlines").data([0]);d.enter().append("g").classed("contourlines",!0);var g=!1!==l.showlines,v=l.showlabels,y=g&&v,b=p.createLines(d,g||v,e),x=p.createLineClip(d,y,r._fullLayout._defs,n.trace.uid),_=t.selectAll("g.contourlabels").data(v?[0]:[]);if(_.exit().remove(),_.enter().append("g").classed("contourlabels",!0),v){var w=c.xaxis,M=c.yaxis,k=w._length,T=M._length,A=[[[0,0],[k,0],[k,T],[0,T]]],S=[];h.clearLocationCache();var E=p.labelFormatter(l,n.t.cb,r._fullLayout),L=u.tester.append("text").attr("data-notex",1).call(u.font,l.labelfont),C={left:0,right:k,center:k/2,top:0,bottom:T,middle:T/2},I=Math.sqrt(k*k+T*T),P=m.LABELDISTANCE*I/Math.max(1,e.length/m.LABELINCREASE);b.each(function(t){var e=p.calcTextOpts(t.level,E,L,r);s.select(this).selectAll("path").each(function(r){var n=h.getVisibleSegment(this,C,e.height/2);if(n&&(function(t,e,r,n,s,l){function c(t,e){var r,n=0;return(Math.abs(t[0]-f)<.1||Math.abs(t[0]-d)<.1)&&(r=a(s.dxydb_rough(t[0],t[1],.1)),n=Math.max(n,l*o(e,r)/2)),(Math.abs(t[1]-p)<.1||Math.abs(t[1]-m)<.1)&&(r=a(s.dxyda_rough(t[0],t[1],.1)),n=Math.max(n,l*o(e,r)/2)),n}for(var u,h=0;h<r.pedgepaths.length;h++)e===r.pedgepaths[h]&&(u=r.edgepaths[h]);if(!u)return;var f=s.a[0],d=s.a[s.a.length-1],p=s.b[0],m=s.b[s.b.length-1];var g=i(t,0,1),v=i(t,n.total,n.total-1),y=c(u[0],g),b=n.total-c(u[u.length-1],v);n.min<y&&(n.min=y);n.max>b&&(n.max=b);n.len=n.max-n.min}(this,r,t,n,f,e.height),!(n.len<(e.width+e.height)*m.LABELMIN)))for(var s=Math.min(Math.ceil(n.len/P),m.LABELMAX),l=0;l<s;l++){var c=p.findBestTextLocation(this,n,e,S,C);if(!c)break;p.addLabelData(c,e,S,A)}})}),L.remove(),p.drawLabels(_,S,r,x,y?A:null)}v&&!g&&b.remove()}(V,D,t,r[0],S,e,M),u.setClipUrl(V,M._clipPathId)}else I._infolayer.selectAll(".cb"+E).remove()}}function i(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 a(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]);return[t[0]/e,t[1]/e]}function o(t,e){var r=Math.abs(t[0]*e[0]+t[1]*e[1]);return Math.sqrt(1-r*r)/r}var s=t("d3"),l=t("../carpet/map_1d_array"),c=t("../carpet/makepath"),u=t("../../components/drawing"),h=t("../../lib"),f=t("../contour/make_crossings"),d=t("../contour/find_all_paths"),p=t("../contour/plot"),m=t("../contour/constants"),g=t("./convert_to_constraints"),v=t("./join_all_paths"),y=t("./empty_pathinfo"),b=t("./map_pathinfo"),x=t("../carpet/lookup_carpetid"),_=t("./close_boundaries");e.exports=function(t,e,r){for(var i=0;i<r.length;i++)n(t,e,r[i])}},{"../../components/drawing":638,"../../lib":738,"../carpet/lookup_carpetid":919,"../carpet/makepath":920,"../carpet/map_1d_array":921,"../contour/constants":940,"../contour/find_all_paths":944,"../contour/make_crossings":948,"../contour/plot":949,"./close_boundaries":954,"./convert_to_constraints":958,"./empty_pathinfo":960,"./join_all_paths":962,"./map_pathinfo":963,d3:123}],965:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../lib/extend").extendFlat;e.exports=o({},{z:{valType:"data_array",editType:"calc"},x:o({},n.x,{impliedEdits:{xtype:"array"}}),x0:o({},n.x0,{impliedEdits:{xtype:"scaled"}}),dx:o({},n.dx,{impliedEdits:{xtype:"scaled"}}),y:o({},n.y,{impliedEdits:{ytype:"array"}}),y0:o({},n.y0,{impliedEdits:{ytype:"scaled"}}),dy:o({},n.dy,{impliedEdits:{ytype:"scaled"}}),text:{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"},connectgaps:{valType:"boolean",dflt:!1,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"}},i,{autocolorscale:o({},i.autocolorscale,{dflt:!1})},{colorbar:a})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../scatter/attributes":1054}],966:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=t("../histogram2d/calc"),s=t("../../components/colorscale/calc"),l=t("./has_columns"),c=t("./convert_column_xyz"),u=t("./max_row_length"),h=t("./clean_2d_array"),f=t("./interp2d"),d=t("./find_empties"),p=t("./make_bound_array");e.exports=function(t,e){function r(t){L=e._input.zsmooth=e.zsmooth=!1,i.warn('cannot use zsmooth: "fast": '+t)}var m,g,v,y,b,x,_,w,M,k=a.getFromId(t,e.xaxis||"x"),T=a.getFromId(t,e.yaxis||"y"),A=n.traceIs(e,"contour"),S=n.traceIs(e,"histogram"),E=n.traceIs(e,"gl2d"),L=A?"best":e.zsmooth;if(k._minDtick=0,T._minDtick=0,S?(m=(M=o(t,e)).x,g=M.x0,v=M.dx,y=M.y,b=M.y0,x=M.dy,_=M.z):(l(e)?(c(e,k,T,"x","y",["z"]),m=e.x,y=e.y):(m=e.x?k.makeCalcdata(e,"x"):[],y=e.y?T.makeCalcdata(e,"y"):[]),g=e.x0||0,v=e.dx||1,b=e.y0||0,x=e.dy||1,_=h(e.z,e.transpose),(A||e.connectgaps)&&(e._emptypoints=d(_),e._interpz=f(_,e._emptypoints,e._interpz))),"fast"===L)if("log"===k.type||"log"===T.type)r("log axis found");else if(!S){if(m.length){var C=(m[m.length-1]-m[0])/(m.length-1),I=Math.abs(C/100);for(w=0;w<m.length-1;w++)if(Math.abs(m[w+1]-m[w]-C)>I){r("x scale is not linear");break}}if(y.length&&"fast"===L){var P=(y[y.length-1]-y[0])/(y.length-1),D=Math.abs(P/100);for(w=0;w<y.length-1;w++)if(Math.abs(y[w+1]-y[w]-P)>D){r("y scale is not linear");break}}}var z=u(_),O="scaled"===e.xtype?"":m,F=p(e,O,g,v,z,k),R="scaled"===e.ytype?"":y,j=p(e,R,b,x,_.length,T);E||(a.expand(k,F),a.expand(T,j));var N={x:F,y:j,z:_,text:e.text};if(S&&(N.xRanges=M.xRanges,N.yRanges=M.yRanges,N.pts=M.pts),s(e,_,"","z"),A&&e.contours&&"heatmap"===e.contours.coloring){var B={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};N.xfill=p(B,O,g,v,z,k),N.yfill=p(B,R,b,x,_.length,T)}return[N]}},{"../../components/colorscale/calc":620,"../../lib":738,"../../plots/cartesian/axes":785,"../../registry":861,"../histogram2d/calc":998,"./clean_2d_array":967,"./convert_column_xyz":969,"./find_empties":971,"./has_columns":972,"./interp2d":975,"./make_bound_array":976,"./max_row_length":977}],967:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t,e){function r(t){if(n(t))return+t}var i,a,o,s,l,c;if(e){for(i=0,l=0;l<t.length;l++)i=Math.max(i,t[l].length);if(0===i)return!1;o=function(t){return t.length},s=function(t,e,r){return t[r][e]}}else i=t.length,o=function(t,e){return t[e].length},s=function(t,e,r){return t[e][r]};var u=new Array(i);for(l=0;l<i;l++)for(a=o(t,l),u[l]=new Array(a),c=0;c<a;c++)u[l][c]=r(s(t,l,c));return u}},{"fast-isnumeric":132}],968:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l="cb"+r.uid,c=r.zmin,u=r.zmax;if(n(c)||(c=i.aggNums(Math.min,null,r.z)),n(u)||(u=i.aggNums(Math.max,null,r.z)),t._fullLayout._infolayer.selectAll("."+l).remove(),r.showscale){var h=e[0].t.cb=s(t,l),f=o.makeColorScaleFunc(o.extractScale(r.colorscale,c,u),{noNumericCheck:!0});h.fillcolor(f).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}else a.autoMargin(t,l)}},{"../../components/colorbar/draw":617,"../../components/colorscale":628,"../../lib":738,"../../plots/plots":846,"fast-isnumeric":132}],969:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r,a,o,s){a=a||"x",o=o||"y",s=s||["z"];var l,c,u,h=t[a].slice(),f=t[o].slice(),d=t.text,p=Math.min(h.length,f.length),m=void 0!==d&&!Array.isArray(d[0]),g=t[a+"calendar"],v=t[o+"calendar"];for(l=0;l<s.length;l++)(u=t[s[l]])&&(p=Math.min(p,u.length));for(p<h.length&&(h=h.slice(0,p)),p<f.length&&(f=f.slice(0,p)),l=0;l<p;l++)h[l]=e.d2c(h[l],0,g),f[l]=r.d2c(f[l],0,v);var y=n.distinctVals(h),b=y.vals,x=n.distinctVals(f),_=x.vals,w=[];for(l=0;l<s.length;l++)w[l]=n.init2dArray(_.length,b.length);var M,k,T;for(m&&(T=n.init2dArray(_.length,b.length)),l=0;l<p;l++)if(h[l]!==i&&f[l]!==i){for(M=n.findBin(h[l]+y.minDiff/2,b),k=n.findBin(f[l]+x.minDiff/2,_),c=0;c<s.length;c++)u=t[s[c]],w[c][k][M]=u[l];m&&(T[k][M]=d[l])}for(t[a]=b,t[o]=_,c=0;c<s.length;c++)t[s[c]]=w[c];m&&(t.text=T)}},{"../../constants/numerical":717,"../../lib":738}],970:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./has_columns"),a=t("./xyz_defaults"),o=t("./style_defaults"),s=t("../../components/colorscale/defaults"),l=t("./attributes");e.exports=function(t,e,r,c){function u(r,i){return n.coerce(t,e,l,r,i)}a(t,e,u,c)?(u("text"),o(t,e,u,c),u("connectgaps",i(e)&&!1!==e.zsmooth),s(t,e,c,u,{prefix:"",cLetter:"z"})):e.visible=!1}},{"../../components/colorscale/defaults":623,"../../lib":738,"./attributes":965,"./has_columns":972,"./style_defaults":980,"./xyz_defaults":981}],971:[function(t,e,r){"use strict";var n=t("./max_row_length");e.exports=function(t){var e,r,i,a,o,s,l,c,u=[],h={},f=[],d=t[0],p=[],m=[0,0,0],g=n(t);for(r=0;r<t.length;r++)for(e=p,p=d,d=t[r+1]||[],i=0;i<g;i++)void 0===p[i]&&((s=(void 0!==p[i-1]?1:0)+(void 0!==p[i+1]?1:0)+(void 0!==e[i]?1:0)+(void 0!==d[i]?1:0))?(0===r&&s++,0===i&&s++,r===t.length-1&&s++,i===p.length-1&&s++,s<4&&(h[[r,i]]=[r,i,s]),u.push([r,i,s])):f.push([r,i]));for(;f.length;){for(l={},c=!1,o=f.length-1;o>=0;o--)(s=((h[[(r=(a=f[o])[0])-1,i=a[1]]]||m)[2]+(h[[r+1,i]]||m)[2]+(h[[r,i-1]]||m)[2]+(h[[r,i+1]]||m)[2])/20)&&(l[a]=[r,i,s],f.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(a in l)h[a]=l[a],u.push(l[a])}return u.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":977}],972:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],973:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../lib"),a=t("../../plots/cartesian/axes"),o=n.constants.MAXDIST;e.exports=function(t,e,r,s,l,c){if(!(t.distance<o)){var u,h,f,d,p=t.cd[0],m=p.trace,g=t.xa,v=t.ya,y=p.x,b=p.y,x=p.z,_=p.zmask,w=[m.zmin,m.zmax],M=m.zhoverformat,k=y,T=b;if(!1!==t.index){try{f=Math.round(t.index[1]),d=Math.round(t.index[0])}catch(e){return void i.error("Error hovering on heatmap, pointNumber must be [row,col], found:",t.index)}if(f<0||f>=x[0].length||d<0||d>x.length)return}else{if(n.inbox(e-y[0],e-y[y.length-1])>o||n.inbox(r-b[0],r-b[b.length-1])>o)return;if(c){var A;for(k=[2*y[0]-y[1]],A=1;A<y.length;A++)k.push((y[A]+y[A-1])/2);for(k.push([2*y[y.length-1]-y[y.length-2]]),T=[2*b[0]-b[1]],A=1;A<b.length;A++)T.push((b[A]+b[A-1])/2);T.push([2*b[b.length-1]-b[b.length-2]])}f=Math.max(0,Math.min(k.length-2,i.findBin(e,k))),d=Math.max(0,Math.min(T.length-2,i.findBin(r,T)))}var S=g.c2p(y[f]),E=g.c2p(y[f+1]),L=v.c2p(b[d]),C=v.c2p(b[d+1]);c?(E=S,u=y[f],C=L,h=b[d]):(u=(y[f]+y[f+1])/2,h=(b[d]+b[d+1])/2,m.zsmooth&&(S=E=(S+E)/2,L=C=(L+C)/2));var I=x[d][f];_&&!_[d][f]&&(I=void 0);var P;Array.isArray(p.text)&&Array.isArray(p.text[d])&&(P=p.text[d][f]);var D,z={type:"linear",range:w,hoverformat:M,_separators:g._separators,_numFormat:g._numFormat};return D=a.tickText(z,I,"hover").text,[i.extendFlat(t,{index:[d,f],distance:o+10,x0:S,x1:E,y0:L,y1:C,xLabelVal:u,yLabelVal:h,zLabelVal:I,zLabel:D,text:P})]}}},{"../../components/fx":655,"../../lib":738,"../../plots/cartesian/axes":785}],974:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.moduleType="trace",n.name="heatmap",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"./attributes":965,"./calc":966,"./colorbar":968,"./defaults":970,"./hover":973,"./plot":978,"./style":979}],975:[function(t,e,r){"use strict";function n(t){return.5-.25*Math.min(1,.5*t)}function i(t,e,r){var n,i,a,s,l,c,u,h,f,d,p,m,g,v=0;for(s=0;s<e.length;s++){for(i=(n=e[s])[0],a=n[1],p=t[i][a],d=0,f=0,l=0;l<4;l++)(u=t[i+(c=o[l])[0]])&&void 0!==(h=u[a+c[1]])&&(0===d?m=g=h:(m=Math.min(m,h),g=Math.max(g,h)),f++,d+=h);if(0===f)throw"iterateInterp2d order is wrong: no defined neighbors";t[i][a]=d/f,void 0===p?f<4&&(v=1):(t[i][a]=(1+r)*t[i][a]-r*p,g>m&&(v=Math.max(v,Math.abs(t[i][a]-p)/(g-m))))}return v}var a=t("../../lib"),o=[[-1,0],[1,0],[0,-1],[0,1]];e.exports=function(t,e,r){var o,s,l=1;if(Array.isArray(r))for(o=0;o<e.length;o++)t[(s=e[o])[0]][s[1]]=r[s[0]][s[1]];else i(t,e);for(o=0;o<e.length&&!(e[o][2]<4);o++);for(e=e.slice(o),o=0;o<100&&l>.01;o++)l=i(t,e,n(l));return l>.01&&a.log("interp2d didn't converge quickly",l),t}},{"../../lib":738}],976:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i,a,o){var s,l,c,u=[],h=n.traceIs(t,"contour"),f=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!f&&"category"!==o.type){var p=e.length;if(!(p<=a))return h?e.slice(0,a):e.slice(0,a+1);if(h||d)u=e.slice(0,a);else if(1===a)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],c=1;c<p;c++)u.push(.5*(e[c-1]+e[c]));u.push(1.5*e[p-1]-.5*e[p-2])}if(p<a){var m=u[u.length-1],g=m-u[u.length-2];for(c=p;c<a;c++)m+=g,u.push(m)}}else{l=i||1;var v=t[o._id.charAt(0)+"calendar"];for(s=f||"category"===o.type?o.r2c(r,0,v)||0:Array.isArray(e)&&1===e.length?e[0]:void 0===r?0:o.d2c(r,0,v),c=h||d?0:-.5;c<a;c++)u.push(s+l*c)}return u}},{"../../registry":861}],977:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0,r=0;r<t.length;r++)e=Math.max(e,t[r].length);return e}},{}],978:[function(t,e,r){"use strict";var n=t("tinycolor2"),i=t("../../registry"),a=t("../../lib"),o=t("../../components/colorscale"),s=t("../../constants/xmlns_namespaces"),l=t("./max_row_length");e.exports=function(t,e,r){for(var c=0;c<r.length;c++)!function(t,e,r){function c(t,e){var r=e.length-2,n=a.constrain(a.findBin(t,e),0,r),i=e[n],o=e[n+1],s=a.constrain(n+(t-i)/(o-i)-.5,0,r),l=Math.round(s),c=Math.abs(s-l);return s&&s!==r&&c?{bin0:l,frac:c,bin1:Math.round(l+c/(s-l))}:{bin0:l,bin1:l,frac:0}}function u(t,e){if(void 0!==t){var r=G(t);return r[0]=Math.round(r[0]),r[1]=Math.round(r[1]),r[2]=Math.round(r[2]),et+=e,rt+=r[0]*e,nt+=r[1]*e,it+=r[2]*e,r}return[0,0,0,0]}function h(t,e,r){t[e]=r[0],t[e+1]=r[1],t[e+2]=r[2],t[e+3]=Math.round(255*r[3])}function f(t,e,r,n){var i=t[r.bin0];if(void 0===i)return u(void 0,1);var a,o=t[r.bin1],s=e[r.bin0],l=e[r.bin1],c=o-i||0,h=s-i||0;return a=void 0===o?void 0===l?0:void 0===s?2*(l-i):2*(2*l-s-i)/3:void 0===l?void 0===s?0:2*(2*i-o-s)/3:void 0===s?2*(2*l-o-i)/3:l+i-o-s,u(i+r.frac*c+n.frac*(h+r.frac*a))}var d=r[0].trace,p=d.uid,m=e.xaxis,g=e.yaxis,v=t._fullLayout,y="hm"+p;if(v._paper.selectAll(".contour"+p).remove(),v._infolayer.selectAll("g.rangeslider-container").selectAll(".contour"+p).remove(),!0!==d.visible)return v._paper.selectAll("."+y).remove(),void v._infolayer.selectAll(".cb"+p).remove();var b,x,_,w,M,k,T=r[0].z,A=r[0].x,S=r[0].y,E=i.traceIs(d,"contour"),L=E?"best":d.zsmooth,C=T.length,I=l(T),P=!1,D=!1;for(k=0;void 0===b&&k<A.length-1;)b=m.c2p(A[k]),k++;for(k=A.length-1;void 0===x&&k>0;)x=m.c2p(A[k]),k--;for(x<b&&(_=x,x=b,b=_,P=!0),k=0;void 0===w&&k<S.length-1;)w=g.c2p(S[k]),k++;for(k=S.length-1;void 0===M&&k>0;)M=g.c2p(S[k]),k--;if(M<w&&(_=w,w=M,M=_,D=!0),E&&(A=r[0].xfill,S=r[0].yfill),"fast"!==L){var z="best"===L?0:.5;b=Math.max(-z*m._length,b),x=Math.min((1+z)*m._length,x),w=Math.max(-z*g._length,w),M=Math.min((1+z)*g._length,M)}var O=Math.round(x-b),F=Math.round(M-w),R=O<=0||F<=0,j=e.plot.select(".imagelayer").selectAll("g.hm."+y).data(R?[]:[0]);if(j.enter().append("g").classed("hm",!0).classed(y,!0),j.exit().remove(),!R){var N,B;"fast"===L?(N=I,B=C):(N=O,B=F);var U=document.createElement("canvas");U.width=N,U.height=B;var V,H,q=U.getContext("2d"),G=o.makeColorScaleFunc(o.extractScale(d.colorscale,d.zmin,d.zmax),{noNumericCheck:!0,returnArray:!0});"fast"===L?(V=P?function(t){return I-1-t}:a.identity,H=D?function(t){return C-1-t}:a.identity):(V=function(t){return a.constrain(Math.round(m.c2p(A[t])-b),0,O)},H=function(t){return a.constrain(Math.round(g.c2p(S[t])-w),0,F)});var Y,W,X,Z,J,K=H(0),Q=[K,K],$=P?0:1,tt=D?0:1,et=0,rt=0,nt=0,it=0;if(L){var at,ot=0;try{at=new Uint8Array(O*F*4)}catch(t){at=new Array(O*F*4)}if("best"===L){var st,lt,ct,ut=new Array(A.length),ht=new Array(S.length),ft=new Array(O);for(k=0;k<A.length;k++)ut[k]=Math.round(m.c2p(A[k])-b);for(k=0;k<S.length;k++)ht[k]=Math.round(g.c2p(S[k])-w);for(k=0;k<O;k++)ft[k]=c(k,ut);for(W=0;W<F;W++)for(lt=T[(st=c(W,ht)).bin0],ct=T[st.bin1],k=0;k<O;k++,ot+=4)h(at,ot,J=f(lt,ct,ft[k],st))}else for(W=0;W<C;W++)for(Z=T[W],Q=H(W),k=0;k<O;k++)J=u(Z[k],1),h(at,ot=4*(Q*O+V(k)),J);var dt=q.createImageData(O,F);try{dt.data.set(at)}catch(t){var pt=dt.data,mt=pt.length;for(W=0;W<mt;W++)pt[W]=at[W]}q.putImageData(dt,0,0)}else{var gt=d.xgap,vt=d.ygap,yt=Math.floor(gt/2),bt=Math.floor(vt/2);for(W=0;W<C;W++)if(Z=T[W],Q.reverse(),Q[tt]=H(W+1),Q[0]!==Q[1]&&void 0!==Q[0]&&void 0!==Q[1])for(Y=[X=V(0),X],k=0;k<I;k++)Y.reverse(),Y[$]=V(k+1),Y[0]!==Y[1]&&void 0!==Y[0]&&void 0!==Y[1]&&(J=u(Z[k],(Y[1]-Y[0])*(Q[1]-Q[0])),q.fillStyle="rgba("+J.join(",")+")",q.fillRect(Y[0]+yt,Q[0]+bt,Y[1]-Y[0]-gt,Q[1]-Q[0]-vt))}rt=Math.round(rt/et),nt=Math.round(nt/et),it=Math.round(it/et);var xt=n("rgb("+rt+","+nt+","+it+")");t._hmpixcount=(t._hmpixcount||0)+et,t._hmlumcount=(t._hmlumcount||0)+et*xt.getLuminance();var _t=j.selectAll("image").data(r);_t.enter().append("svg:image").attr({xmlns:s.svg,preserveAspectRatio:"none"}),_t.attr({height:F,width:O,x:b,y:w,"xlink:href":U.toDataURL("image/png")}),_t.exit().remove()}}(t,e,r[c])}},{"../../components/colorscale":628,"../../constants/xmlns_namespaces":719,"../../lib":738,"../../registry":861,"./max_row_length":977,tinycolor2:543}],979:[function(t,e,r){"use strict";var n=t("d3");e.exports=function(t){n.select(t).selectAll(".hm image").style("opacity",function(t){return t.trace.opacity})}},{d3:123}],980:[function(t,e,r){"use strict";e.exports=function(t,e,r){!1===r("zsmooth")&&(r("xgap"),r("ygap")),r("zhoverformat")}},{}],981:[function(t,e,r){"use strict";function n(t,e){var r=e(t);return"scaled"===(r?e(t+"type","array"):"scaled")&&(e(t+"0"),e("d"+t)),r}var i=t("fast-isnumeric"),a=t("../../registry"),o=t("./has_columns");e.exports=function(t,e,r,s,l,c){var u=r("z");l=l||"x",c=c||"y";var h,f;if(void 0===u||!u.length)return 0;if(o(t)){if(h=r(l),f=r(c),!h||!f)return 0}else{if(h=n(l,r),f=n(c,r),!function(t){for(var e,r=!0,n=!1,a=!1,o=0;o<t.length;o++){if(e=t[o],!Array.isArray(e)){r=!1;break}e.length>0&&(n=!0);for(var s=0;s<e.length;s++)if(i(e[s])){a=!0;break}}return r&&n&&a}(u))return 0;r("transpose")}return a.getComponentMethod("calendars","handleTraceDefaults")(t,e,[l,c],s),e.z.length}},{"../../registry":861,"./has_columns":972,"fast-isnumeric":132}],982:[function(t,e,r){"use strict";for(var n=t("../heatmap/attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../lib/extend").extendFlat,s=t("../../plot_api/edit_types").overrideAll,l=["z","x","x0","dx","y","y0","dy","text","transpose","xtype","ytype"],c={},u=0;u<l.length;u++){var h=l[u];c[h]=n[h]}o(c,i,{autocolorscale:o({},i.autocolorscale,{dflt:!1})},{colorbar:a}),e.exports=s(c,"calc","nested")},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../../plot_api/edit_types":769,"../heatmap/attributes":965}],983:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="heatmapgl",this.name="",this.hoverinfo="all",this.xData=[],this.yData=[],this.zData=[],this.textLabels=[],this.idToIndex=[],this.bounds=[0,0,0,0],this.options={z:[],x:[],y:[],shape:[0,0],colorLevels:[0],colorValues:[0,0,0,1]},this.heatmap=i(t.glplot,this.options),this.heatmap._trace=this}var i=t("gl-heatmap2d"),a=t("../../plots/cartesian/axes"),o=t("../../lib/str2rgbarray"),s=n.prototype;s.handlePick=function(t){var e=this.options,r=e.shape,n=t.pointId,i=n%r[0],a=Math.floor(n/r[0]),o=n;return{trace:this,dataCoord:t.dataCoord,traceCoord:[e.x[i],e.y[a],e.z[o]],textLabel:this.textLabels[n],name:this.name,pointIndex:[a,i],hoverinfo:this.hoverinfo}},s.update=function(t,e){var r=e[0];this.index=t.index,this.name=t.name,this.hoverinfo=t.hoverinfo;var n=r.z;this.options.z=[].concat.apply([],n);var i=n[0].length,s=n.length;this.options.shape=[i,s],this.options.x=r.x,this.options.y=r.y;var l=function(t){for(var e=t.colorscale,r=t.zmin,n=t.zmax,i=e.length,a=new Array(i),s=new Array(4*i),l=0;l<i;l++){var c=e[l],u=o(c[1]);a[l]=r+c[0]*(n-r);for(var h=0;h<4;h++)s[4*l+h]=u[h]}return{colorLevels:a,colorValues:s}}(t);this.options.colorLevels=l.colorLevels,this.options.colorValues=l.colorValues,this.textLabels=[].concat.apply([],t.text),this.heatmap.update(this.options),a.expand(this.scene.xaxis,r.x),a.expand(this.scene.yaxis,r.y)},s.dispose=function(){this.heatmap.dispose()},e.exports=function(t,e,r){var i=new n(t,e.uid);return i.update(e,r),i}},{"../../lib/str2rgbarray":760,"../../plots/cartesian/axes":785,"gl-heatmap2d":167}],984:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("../heatmap/defaults"),n.colorbar=t("../heatmap/colorbar"),n.calc=t("../heatmap/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="heatmapgl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl","gl2d","2dMap"],n.meta={},e.exports=n},{"../../plots/gl2d":823,"../heatmap/calc":966,"../heatmap/colorbar":968,"../heatmap/defaults":970,"./attributes":982,"./convert":983}],985:[function(t,e,r){"use strict";function n(t){var e={};e["autobin"+t]=!1;var r={};return r["^autobin"+t]=!1,{start:{valType:"any",dflt:null,editType:"calc",impliedEdits:r},end:{valType:"any",dflt:null,editType:"calc",impliedEdits:r},size:{valType:"any",dflt:null,editType:"calc",impliedEdits:r},editType:"calc",impliedEdits:e}}var i=t("../bar/attributes");e.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},text:i.text,orientation:i.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"},autobinx:{valType:"boolean",dflt:null,editType:"calc",impliedEdits:{"xbins.start":void 0,"xbins.end":void 0,"xbins.size":void 0}},nbinsx:{valType:"integer",min:0,dflt:0,editType:"calc"},xbins:n("x"),autobiny:{valType:"boolean",dflt:null,editType:"calc",impliedEdits:{"ybins.start":void 0,"ybins.end":void 0,"ybins.size":void 0}},nbinsy:{valType:"integer",min:0,dflt:0,editType:"calc"},ybins:n("y"),marker:i.marker,selected:i.selected,unselected:i.unselected,error_y:i.error_y,error_x:i.error_x,_deprecated:{bardir:i._deprecated.bardir}}},{"../bar/attributes":871}],986:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=t.length,n=0,i=0;i<r;i++)e[i]?(t[i]/=e[i],n+=t[i]):t[i]=null;return n}},{}],987:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){return r("histnorm"),n.forEach(function(t){r(t+"bins.start"),r(t+"bins.end"),r(t+"bins.size"),r("autobin"+t),r("nbins"+t)}),e}},{}],988:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports={count:function(t,e,r){return r[t]++,1},sum:function(t,e,r,i){var a=i[e];return n(a)?(a=Number(a),r[t]+=a,a):0},avg:function(t,e,r,i,a){var o=i[e];return n(o)&&(o=Number(o),r[t]+=o,a[t]++),0},min: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]>a){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]<a){var o=a-r[t];return r[t]=a,o}}return 0}}},{"fast-isnumeric":132}],989:[function(t,e,r){"use strict";function n(t,e,r,n){if(t*e<=0)return 1/0;for(var o=Math.abs(e-t),l="date"===r.type,u=i(o,l),h=0;h<10;h++){var f=i(80*u,l);if(u===f)break;if(!function(t,e,r,n,i,o){if(n&&t>c){var l=a(e,i,o),u=a(r,i,o),h=t===s?0:1;return l[h]!==u[h]}return Math.floor(r/t)-Math.floor(e/t)>.1}(f,t,e,l,r,n))break;u=f}return u}function i(t,e){return e&&t>f?t>c?t>1.1*s?s:t>1.1*l?l:c:t>u?u:t>h?h:f:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function a(t,e,r){var n=e.c2d(t,s,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}var o=t("../../constants/numerical"),s=o.ONEAVGYEAR,l=o.ONEAVGMONTH,c=o.ONEDAY,u=o.ONEHOUR,h=o.ONEMIN,f=o.ONESEC,d=t("../../plots/cartesian/axes").tickIncrement;e.exports=function(t,e,r,i,a){var o,l,u=-1.1*e,h=-.1*e,f=t-h,p=r[0],m=r[1],g=Math.min(n(p+h,p+f,i,a),n(m+h,m+f,i,a)),v=Math.min(n(p+u,p+h,i,a),n(m+u,m+h,i,a));if(g>v&&v<Math.abs(m-p)/4e3?(o=g,l=!1):(o=Math.min(g,v),l=!0),"date"===i.type&&o>c){var y=o===s?1:6,b=o===s?"M12":"M1";return function(e,r){var n=i.c2d(e,s,a),o=n.indexOf("-",y);o>0&&(n=n.substr(0,o));var c=i.d2c(n,0,a);if(c<e){var u=d(c,b,!1,a);(c+u)/2<e+t&&(c=u)}return r&&l?d(c,b,!0,a):c}}return function(e,r){var n=o*Math.round(e/o);return n+o/10<e&&n+.9*o<e+t&&(n+=o),r&&l&&(n-=o),n}}},{"../../constants/numerical":717,"../../plots/cartesian/axes":785}],990:[function(t,e,r){"use strict";function n(t,e,r,c,u){var h,f,d,p,m,g=c+"bins",v="overlay"===t._fullLayout.barmode;if(e._autoBinFinished)delete e._autoBinFinished;else{var y=v?[e]:i(t,e),b=[],x=1/0,_=1/0,w=-1/0,M="autobin"+c;for(h=0;h<y.length;h++){m=(f=y[h])._pos0=r.makeCalcdata(f,c);var k=f[g];if(f[M]||!k||null===k.start||null===k.end){d=f[c+"calendar"];var T=f.cumulative;if(k=l.autoBin(m,r,f["nbins"+c],!1,d),v&&1===k._count&&"category"!==r.type){if(u)return[k,m,!0];k=function(t,e,r,a,o){var l,c,u=i(t,e),h=!1,f=1/0,d=[e];for(l=0;l<u.length;l++)if((c=u[l])===e)h=!0;else if(h){var p=n(t,c,r,a,!0),m=p[0],g=p[2];c._autoBinFinished=1,c._pos0=p[1],g?d.push(c):f=Math.min(f,m.size)}else f=Math.min(f,c[o].size);var v=new Array(d.length);for(l=0;l<d.length;l++)for(var y=d[l]._pos0,b=0;b<y.length;b++)if(void 0!==y[b]){v[l]=y[b];break}isFinite(f)||(f=s.distinctVals(v).minDiff);for(l=0;l<d.length;l++){var x=(c=d[l])[a+"calendar"];c._input[o]=c[o]={start:r.c2r(v[l]-f/2,0,x),end:r.c2r(v[l]+f/2,0,x),size:f}}return e[o]}(t,e,r,c,g)}T.enabled&&"include"!==T.currentbin&&("decreasing"===T.direction?_=Math.min(_,r.r2c(k.start,0,d)-k.size):w=Math.max(w,r.r2c(k.end,0,d)+k.size)),b.push(f)}else p||(p={size:k.size,start:r.r2c(k.start,0,d),end:r.r2c(k.end,0,d)});x=function(t,e){if(t===1/0)return e;var r=a(t);return a(e)<r?e:t}(x,k.size),_=Math.min(_,r.r2c(k.start,0,d)),w=Math.max(w,r.r2c(k.end,0,d)),h&&(f._autoBinFinished=1)}if(p&&o(p.size)&&o(x)){x=x>p.size/1.9?p.size:p.size/Math.ceil(p.size/x);var A=p.start+(p.size-x)/2;_=A-x*Math.ceil((A-_)/x)}for(h=0;h<b.length;h++)d=(f=b[h])[c+"calendar"],f._input[g]=f[g]={start:r.c2r(_,0,d),end:r.c2r(w,0,d),size:x},f._input[M]=f[M]}return m=e._pos0,delete e._pos0,[e[g],m]}function i(t,e){for(var r=e.xaxis,n=e.yaxis,i=e.orientation,a=[],o=t._fullData,s=0;s<o.length;s++){var l=o[s];"histogram"===l.type&&l.orientation===i&&l.xaxis===r&&l.yaxis===n&&a.push(l)}return a}function a(t){return o(t)?t:"string"==typeof t&&"M"===t.charAt(0)?p*+t.substr(1):1/0}var o=t("fast-isnumeric"),s=t("../../lib"),l=t("../../plots/cartesian/axes"),c=t("../bar/arrays_to_calcdata"),u=t("./bin_functions"),h=t("./norm_functions"),f=t("./average"),d=t("./clean_bins"),p=t("../../constants/numerical").ONEAVGMONTH,m=t("./bin_label_vals");e.exports=function(t,e){if(!0===e.visible){var r,i=[],a=[],p=l.getFromId(t,"h"===e.orientation?e.yaxis||"y":e.xaxis||"x"),g="h"===e.orientation?"y":"x",v={x:"y",y:"x"}[g],y=e[g+"calendar"],b=e.cumulative;d(e,p,g);var x,_,w,M=n(t,e,p,g),k=M[0],T=M[1],A="string"==typeof k.size,S=[],E=A?S:k,L=[],C=[],I=[],P=0,D=e.histnorm,z=e.histfunc,O=-1!==D.indexOf("density");b.enabled&&O&&(D=D.replace(/ ?density$/,""),O=!1);var F,R="max"===z||"min"===z?null:0,j=u.count,N=h[D],B=!1,U=function(t){return p.r2c(t,0,y)};for(Array.isArray(e[v])&&"count"!==z&&(F=e[v],B="avg"===z,j=u[z]),r=U(k.start),_=U(k.end)+(r-l.tickIncrement(r,k.size,!1,y))/1e6;r<_&&i.length<1e6&&(x=l.tickIncrement(r,k.size,!1,y),i.push((r+x)/2),a.push(R),I.push([]),S.push(r),O&&L.push(1/(x-r)),B&&C.push(0),!(x<=r));)r=x;S.push(r),A||"date"!==p.type||(E={start:U(E.start),end:U(E.end),size:E.size});var V=a.length,H=!0,q=1/0,G=1/0,Y={};for(r=0;r<T.length;r++){var W=T[r];(w=s.findBin(W,E))>=0&&w<V&&(P+=j(w,r,a,F,C),H&&I[w].length&&W!==T[I[w][0]]&&(H=!1),I[w].push(r),Y[r]=w,q=Math.min(q,W-S[w]),G=Math.min(G,S[w+1]-W))}var X;H||(X=m(q,G,S,p,y)),B&&(P=f(a,C)),N&&N(a,P,L),b.enabled&&function(t,e,r){function n(e){s=t[e],t[e]/=2}function i(e){o=t[e],t[e]=s+o/2,s+=o}var a,o,s;if("half"===r)if("increasing"===e)for(n(0),a=1;a<t.length;a++)i(a);else for(n(t.length-1),a=t.length-2;a>=0;a--)i(a);else if("increasing"===e){for(a=1;a<t.length;a++)t[a]+=t[a-1];"exclude"===r&&(t.unshift(0),t.pop())}else{for(a=t.length-2;a>=0;a--)t[a]+=t[a+1];"exclude"===r&&(t.push(0),t.shift())}}(a,b.direction,b.currentbin);var Z=Math.min(i.length,a.length),J=[],K=0,Q=Z-1;for(r=0;r<Z;r++)if(a[r]){K=r;break}for(r=Z-1;r>=K;r--)if(a[r]){Q=r;break}for(r=K;r<=Q;r++)if(o(i[r])&&o(a[r])){var $={p:i[r],s:a[r],b:0};b.enabled||($.pts=I[r],H?$.p0=$.p1=I[r].length?T[I[r][0]]:i[r]:($.p0=X(S[r]),$.p1=X(S[r+1],!0))),J.push($)}return 1===J.length&&(J[0].width1=l.tickIncrement(J[0].p,k.size,!1,y)-J[0].p),c(J,e),Array.isArray(e.selectedpoints)&&s.tagSelected(J,e,Y),J}}},{"../../constants/numerical":717,"../../lib":738,"../../plots/cartesian/axes":785,"../bar/arrays_to_calcdata":870,"./average":986,"./bin_functions":988,"./bin_label_vals":989,"./clean_bins":991,"./norm_functions":996,"fast-isnumeric":132}],991:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib").cleanDate,a=t("../../constants/numerical"),o=a.ONEDAY,s=a.BADNUM;e.exports=function(t,e,r){var a=e.type,l=r+"bins",c=t[l];c||(c=t[l]={});var u="date"===a?function(t){return t||0===t?i(t,s,c.calendar):null}:function(t){return n(t)?Number(t):null};c.start=u(c.start),c.end=u(c.end);var h="date"===a?o:1,f=c.size;if(n(f))c.size=f>0?Number(f):h;else if("string"!=typeof f)c.size=h;else{var d=f.charAt(0),p=f.substr(1);((p=n(p)?Number(p):0)<=0||"date"!==a||"M"!==d||p!==Math.round(p))&&(c.size=h)}var m="autobin"+r;"boolean"!=typeof t[m]&&(t[m]=!((c.start||0===c.start)&&(c.end||0===c.end))),t[m]||delete t["nbins"+r]}},{"../../constants/numerical":717,"../../lib":738,"fast-isnumeric":132}],992:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/color"),o=t("./bin_defaults"),s=t("../bar/style_defaults"),l=t("../../components/errorbars/defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function h(r,n){return i.coerce(t,e,c,r,n)}var f=h("x"),d=h("y");h("cumulative.enabled")&&(h("cumulative.direction"),h("cumulative.currentbin")),h("text");var p=h("orientation",d&&!f?"h":"v"),m=e["v"===p?"x":"y"];if(m&&m.length){n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],u);e["h"===p?"x":"y"]&&h("histfunc");o(t,e,h,"h"===p?["y"]:["x"]),s(t,e,h,r,u),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"}),i.coerceSelectionMarkerOpacity(e,h)}else e.visible=!1}},{"../../components/color":613,"../../components/errorbars/defaults":643,"../../lib":738,"../../registry":861,"../bar/style_defaults":883,"./attributes":985,"./bin_defaults":987}],993:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){if(t.x="xVal"in e?e.xVal:e.x,t.y="yVal"in e?e.yVal:e.y,e.xa&&(t.xaxis=e.xa),e.ya&&(t.yaxis=e.ya),!(r.cumulative||{}).enabled){var a=Array.isArray(i)?n[0].pts[i[0]][i[1]]:n[i].pts;t.pointNumbers=a,t.binNumber=t.pointNumber,delete t.pointNumber,delete t.pointIndex;var o;if(r._indexToPoints){o=[];for(var s=0;s<a.length;s++)o=o.concat(r._indexToPoints[a[s]])}else o=a;t.pointIndices=o}return t}},{}],994:[function(t,e,r){"use strict";var n=t("../bar/hover"),i=t("../../plots/cartesian/axes").hoverLabelText;e.exports=function(t,e,r,a){var o=n(t,e,r,a);if(o){var s=(t=o[0]).cd[t.index],l=t.cd[0].trace;if(!l.cumulative.enabled){var c="h"===l.orientation?"y":"x";t[c+"Label"]=i(t[c+"a"],s.p0,s.p1)}return o}}},{"../../plots/cartesian/axes":785,"../bar/hover":874}],995:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.layoutAttributes=t("../bar/layout_attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("../bar/layout_defaults"),n.calc=t("./calc"),n.setPositions=t("../bar/set_positions"),n.plot=t("../bar/plot"),n.style=t("../bar/style"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("./hover"),n.selectPoints=t("../bar/select"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="histogram",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"../bar/layout_attributes":876,"../bar/layout_defaults":877,"../bar/plot":878,"../bar/select":879,"../bar/set_positions":880,"../bar/style":882,"../scatter/colorbar":1058,"./attributes":985,"./calc":990,"./defaults":992,"./event_data":993,"./hover":994}],996:[function(t,e,r){"use strict";e.exports={percent:function(t,e){for(var r=t.length,n=100/e,i=0;i<r;i++)t[i]*=n},probability:function(t,e){for(var r=t.length,n=0;n<r;n++)t[n]/=e},density:function(t,e,r,n){var i=t.length;n=n||1;for(var a=0;a<i;a++)t[a]*=r[a]*n},"probability density":function(t,e,r,n){var i=t.length;n&&(e/=n);for(var a=0;a<i;a++)t[a]*=r[a]/e}}},{}],997:[function(t,e,r){"use strict";var n=t("../histogram/attributes"),i=t("../heatmap/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../components/colorbar/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({},{x:n.x,y:n.y,z:{valType:"data_array",editType:"calc"},marker:{color:{valType:"data_array",editType:"calc"},editType:"calc"},histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,xgap:i.xgap,ygap:i.ygap,zsmooth:i.zsmooth,zhoverformat:i.zhoverformat},a,{autocolorscale:s({},a.autocolorscale,{dflt:!1})},{colorbar:o})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../heatmap/attributes":965,"../histogram/attributes":985}],998:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o){var s=e+"bins",c="autobin"+e,u=t[s];f(t,n,e),!t[c]&&u&&null!==u.start&&null!==u.end||(u=l.autoBin(r,n,t["nbins"+e],"2d",o),"histogram2dcontour"===t.type&&(u.start=a(l.tickIncrement(i(u.start),u.size,!0,o)),u.end=a(l.tickIncrement(i(u.end),u.size,!1,o))),t._input[s]=t[s]=u,t._input[c]=t[c])}function i(t,e,r,n){var i,a=new Array(t);if(n)for(i=0;i<t;i++)a[i]=1/(e[i+1]-e[i]);else{var o=1/r;for(i=0;i<t;i++)a[i]=o}return a}function a(t,e){return{start:t(e.start),end:t(e.end),size:e.size}}function o(t,e,r,n,i,a){var o,s=t.length-1,l=new Array(s);if(e)for(o=0;o<s;o++)l[o]=[e[o],e[o]];else{var c=d(r,n,t,i,a);for(o=0;o<s;o++)l[o]=[c(t[o]),c(t[o+1],!0)]}return l}var s=t("../../lib"),l=t("../../plots/cartesian/axes"),c=t("../histogram/bin_functions"),u=t("../histogram/norm_functions"),h=t("../histogram/average"),f=t("../histogram/clean_bins"),d=t("../histogram/bin_label_vals");e.exports=function(t,e){var r,f,d,p,m=l.getFromId(t,e.xaxis||"x"),g=e.x?m.makeCalcdata(e,"x"):[],v=l.getFromId(t,e.yaxis||"y"),y=e.y?v.makeCalcdata(e,"y"):[],b=e.xcalendar,x=e.ycalendar,_=function(t){return m.r2c(t,0,b)},w=function(t){return v.r2c(t,0,x)},M=function(t){return m.c2r(t,0,b)},k=function(t){return v.c2r(t,0,x)},T=Math.min(g.length,y.length);g.length>T&&g.splice(T,g.length-T),y.length>T&&y.splice(T,y.length-T),n(e,"x",g,m,_,M,b),n(e,"y",y,v,w,k,x);var A=[],S=[],E=[],L="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,I=[],P=[],D=L?I:e.xbins,z=C?P:e.ybins,O=0,F=[],R=[],j=e.histnorm,N=e.histfunc,B=-1!==j.indexOf("density"),U="max"===N||"min"===N?null:0,V=c.count,H=u[j],q=!1,G=[],Y=[],W="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";W&&"count"!==N&&(q="avg"===N,V=c[N]);var X=e.xbins,Z=_(X.start),J=_(X.end)+(Z-l.tickIncrement(Z,X.size,!1,b))/1e6;for(r=Z;r<J;r=l.tickIncrement(r,X.size,!1,b))S.push(U),I.push(r),q&&E.push(0);I.push(r);var K=S.length,Q=_(e.xbins.start),$=(r-Q)/K,tt=M(Q+$/2);for(Z=w((X=e.ybins).start),J=w(X.end)+(Z-l.tickIncrement(Z,X.size,!1,x))/1e6,r=Z;r<J;r=l.tickIncrement(r,X.size,!1,x)){A.push(S.slice()),P.push(r);var et=new Array(K);for(f=0;f<K;f++)et[f]=[];R.push(et),q&&F.push(E.slice())}P.push(r);var rt=A.length,nt=w(e.ybins.start),it=(r-nt)/rt,at=k(nt+it/2);B&&(G=i(S.length,D,$,L),Y=i(A.length,z,it,C)),L||"date"!==m.type||(D=a(_,D)),C||"date"!==v.type||(z=a(w,z));var ot=!0,st=!0,lt=new Array(K),ct=new Array(rt),ut=1/0,ht=1/0,ft=1/0,dt=1/0;for(r=0;r<T;r++){var pt=g[r],mt=y[r];d=s.findBin(pt,D),p=s.findBin(mt,z),d>=0&&d<K&&p>=0&&p<rt&&(O+=V(d,r,A[p],W,F[p]),R[p][d].push(r),ot&&(void 0===lt[d]?lt[d]=pt:lt[d]!==pt&&(ot=!1)),st&&(void 0===ct[d]?ct[d]=mt:ct[d]!==mt&&(st=!1)),ut=Math.min(ut,pt-I[d]),ht=Math.min(ht,I[d+1]-pt),ft=Math.min(ft,mt-P[p]),dt=Math.min(dt,P[p+1]-mt))}if(q)for(p=0;p<rt;p++)O+=h(A[p],F[p]);if(H)for(p=0;p<rt;p++)H(A[p],O,G,Y[p]);return{x:g,xRanges:o(I,ot&&lt,ut,ht,m,b),x0:tt,dx:$,y:y,yRanges:o(P,st&&ct,ft,dt,v,x),y0:at,dy:it,z:A,pts:R}}},{"../../lib":738,"../../plots/cartesian/axes":785,"../histogram/average":986,"../histogram/bin_functions":988,"../histogram/bin_label_vals":989,"../histogram/clean_bins":991,"../histogram/norm_functions":996}],999:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./sample_defaults"),a=t("../heatmap/style_defaults"),o=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function c(r,i){return n.coerce(t,e,s,r,i)}i(t,e,c,l),!1!==e.visible&&(a(t,e,c,l),o(t,e,l,c,{prefix:"",cLetter:"z"}))}},{"../../components/colorscale/defaults":623,"../../lib":738,"../heatmap/style_defaults":980,"./attributes":997,"./sample_defaults":1002}],1e3:[function(t,e,r){"use strict";var n=t("../heatmap/hover"),i=t("../../plots/cartesian/axes").hoverLabelText;e.exports=function(t,e,r,a,o,s){var l=n(t,e,r,a,o,s);if(l){var c=(t=l[0]).index,u=c[0],h=c[1],f=t.cd[0],d=f.xRanges[h],p=f.yRanges[u];return t.xLabel=i(t.xa,d[0],d[1]),t.yLabel=i(t.ya,p[0],p[1]),l}}},{"../../plots/cartesian/axes":785,"../heatmap/hover":973}],1001:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../heatmap/calc"),n.plot=t("../heatmap/plot"),n.colorbar=t("../heatmap/colorbar"),n.style=t("../heatmap/style"),n.hoverPoints=t("./hover"),n.eventData=t("../histogram/event_data"),n.moduleType="trace",n.name="histogram2d",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"../heatmap/calc":966,"../heatmap/colorbar":968,"../heatmap/plot":978,"../heatmap/style":979,"../histogram/event_data":993,"./attributes":997,"./defaults":999,"./hover":1e3}],1002:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../histogram/bin_defaults");e.exports=function(t,e,r,a){var o=r("x"),s=r("y");if(o&&o.length&&s&&s.length){n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],a);(r("z")||r("marker.color"))&&r("histfunc");i(t,e,r,["x","y"])}else e.visible=!1}},{"../../registry":861,"../histogram/bin_defaults":987}],1003:[function(t,e,r){"use strict";var n=t("../histogram2d/attributes"),i=t("../contour/attributes"),a=t("../../components/colorscale/attributes"),o=t("../../components/colorbar/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s({x:n.x,y:n.y,z:n.z,marker:n.marker,histnorm:n.histnorm,histfunc:n.histfunc,autobinx:n.autobinx,nbinsx:n.nbinsx,xbins:n.xbins,autobiny:n.autobiny,nbinsy:n.nbinsy,ybins:n.ybins,autocontour:i.autocontour,ncontours:i.ncontours,contours:i.contours,line:i.line,zhoverformat:n.zhoverformat},a,{zmin:s({},a.zmin,{editType:"calc"}),zmax:s({},a.zmax,{editType:"calc"})},{colorbar:o})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../contour/attributes":937,"../histogram2d/attributes":997}],1004:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../histogram2d/sample_defaults"),a=t("../contour/contours_defaults"),o=t("../contour/style_defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function c(r,i){return n.coerce(t,e,s,r,i)}i(t,e,c,l),!1!==e.visible&&(a(t,e,c),o(t,e,c,l))}},{"../../lib":738,"../contour/contours_defaults":941,"../contour/style_defaults":951,"../histogram2d/sample_defaults":1002,"./attributes":1003}],1005:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../contour/calc"),n.plot=t("../contour/plot").plot,n.style=t("../contour/style"),n.colorbar=t("../contour/colorbar"),n.hoverPoints=t("../contour/hover"),n.moduleType="trace",n.name="histogram2dcontour",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","2dMap","contour","histogram"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"../contour/calc":938,"../contour/colorbar":939,"../contour/hover":945,"../contour/plot":949,"../contour/style":950,"./attributes":1003,"./defaults":1004}],1006:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/colorscale/attributes"),a=t("../../components/colorbar/attributes"),o=t("../surface/attributes"),s=t("../../lib/extend").extendFlat;e.exports=s(n("","calc",!1),{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"},delaunayaxis:{valType:"enumerated",values:["x","y","z"],dflt:"z",editType:"calc"},alphahull:{valType:"number",dflt:-1,editType:"calc"},intensity:{valType:"data_array",editType:"calc"},color:{valType:"color",editType:"calc"},vertexcolor:{valType:"data_array",editType:"calc"},facecolor:{valType:"data_array",editType:"calc"},opacity:o.opacity,flatshading:{valType:"boolean",dflt:!1,editType:"calc"},contour:{show:s({},o.contours.x.show,{}),color:o.contours.x.color,width:o.contours.x.width,editType:"calc"},showscale:i.showscale,colorbar:a,lightposition:{x:s({},o.lightposition.x,{dflt:1e5}),y:s({},o.lightposition.y,{dflt:1e5}),z:s({},o.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"},o.lighting)})},{"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../components/colorscale/color_attributes":621,"../../lib/extend":727,"../surface/attributes":1124}],1007:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.intensity&&n(e,e.intensity,"","c")}},{"../../components/colorscale/calc":620}],1008:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l="cb"+r.uid,c=r.cmin,u=r.cmax,h=r.intensity||[];if(n(c)||(c=i.aggNums(Math.min,null,h)),n(u)||(u=i.aggNums(Math.max,null,h)),t._fullLayout._infolayer.selectAll("."+l).remove(),r.showscale){var f=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,c,u),{noNumericCheck:!0});f.fillcolor(d).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}else a.autoMargin(t,l)}},{"../../components/colorbar/draw":617,"../../components/colorscale":628,"../../lib":738,"../../plots/plots":846,"fast-isnumeric":132}],1009:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.mesh=e,this.name="",this.color="#fff",this.data=null,this.showContour=!1}function i(t){return t.map(h)}function a(t,e,r){for(var n=new Array(t.length),i=0;i<t.length;++i)n[i]=[t[i],e[i],r[i]];return n}var o=t("gl-mesh3d"),s=t("tinycolor2"),l=t("delaunay-triangulate"),c=t("alpha-shape"),u=t("convex-hull"),h=t("../../lib/str2rgbarray"),f=n.prototype;f.handlePick=function(t){if(t.object===this.mesh){var e=t.index=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},f.update=function(t){function e(t,e,r,n){return e.map(function(e){return t.d2l(e,0,n)*r})}var r=this.scene,n=r.fullSceneLayout;this.data=t;var o,f=a(e(n.xaxis,t.x,r.dataScale[0],t.xcalendar),e(n.yaxis,t.y,r.dataScale[1],t.ycalendar),e(n.zaxis,t.z,r.dataScale[2],t.zcalendar));if(t.i&&t.j&&t.k)o=a(t.i,t.j,t.k);else if(0===t.alphahull)o=u(f);else if(t.alphahull>0)o=c(t.alphahull,f);else{var d=["x","y","z"].indexOf(t.delaunayaxis);o=l(f.map(function(t){return[t[(d+1)%3],t[(d+2)%3]]}))}var p={positions:f,cells:o,lightPosition:[t.lightposition.x,t.lightposition.y,t.lightposition.z],ambient:t.lighting.ambient,diffuse:t.lighting.diffuse,specular:t.lighting.specular,roughness:t.lighting.roughness,fresnel:t.lighting.fresnel,vertexNormalsEpsilon:t.lighting.vertexnormalsepsilon,faceNormalsEpsilon:t.lighting.facenormalsepsilon,opacity:t.opacity,contourEnable:t.contour.show,contourColor:h(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",p.vertexIntensity=t.intensity,p.vertexIntensityBounds=[t.cmin,t.cmax],p.colormap=function(t){return t.map(function(t){var e=t[0],r=s(t[1]).toRgb();return{index:e,rgb:[r.r,r.g,r.b,1]}})}(t.colorscale)):t.vertexcolor?(this.color=t.vertexcolor[0],p.vertexColors=i(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],p.cellColors=i(t.facecolor)):(this.color=t.color,p.meshColor=h(t.color)),this.mesh.update(p)},f.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()},e.exports=function(t,e){var r=t.glplot.gl,i=o({gl:r}),a=new n(t,i,e.uid);return i._trace=a,a.update(e),t.glplot.add(i),a}},{"../../lib/str2rgbarray":760,"alpha-shape":44,"convex-hull":104,"delaunay-triangulate":124,"gl-mesh3d":206,tinycolor2:543}],1010:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../../components/colorscale/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,n){return i.coerce(t,e,o,r,n)}function c(t){var e=t.map(function(t){var e=l(t);return e&&Array.isArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var u=c(["x","y","z"]),h=c(["i","j","k"]);if(u){h&&h.forEach(function(t){for(var e=0;e<t.length;++e)t[e]|=0});n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],s),["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lighting.vertexnormalsepsilon","lighting.facenormalsepsilon","lightposition.x","lightposition.y","lightposition.z","contour.show","contour.color","contour.width","colorscale","reversescale","flatshading","alphahull","delaunayaxis","opacity"].forEach(function(t){l(t)}),"intensity"in t?(l("intensity"),a(t,e,s,l,{prefix:"",cLetter:"c"})):(e.showscale=!1,"facecolor"in t?l("facecolor"):"vertexcolor"in t?l("vertexcolor"):l("color",r))}else e.visible=!1}},{"../../components/colorscale/defaults":623,"../../lib":738,"../../registry":861,"./attributes":1006}],1011:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.colorbar=t("./colorbar"),n.plot=t("./convert"),n.moduleType="trace",n.name="mesh3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d"],n.meta={},e.exports=n},{"../../plots/gl3d":826,"./attributes":1006,"./calc":1007,"./colorbar":1008,"./convert":1009,"./defaults":1010}],1012:[function(t,e,r){"use strict";function n(t){return{name:{valType:"string",editType:"style"},showlegend:{valType:"boolean",dflt:!0,editType:"style"},line:{color:i({},s.color,{dflt:t}),width:s.width,dash:o,editType:"style"},editType:"style"}}var i=t("../../lib").extendFlat,a=t("../scatter/attributes"),o=t("../../components/drawing/attributes").dash,s=a.line;e.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},open:{valType:"data_array",dflt:[],editType:"calc"},high:{valType:"data_array",dflt:[],editType:"calc"},low:{valType:"data_array",dflt:[],editType:"calc"},close:{valType:"data_array",dflt:[],editType:"calc"},line:{width:i({},s.width,{}),dash:i({},o,{}),editType:"style"},increasing:n("#3D9970"),decreasing:n("#FF4136"),text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},tickwidth:{valType:"number",min:0,max:.5,dflt:.3,editType:"calcIfAutorange"}}},{"../../components/drawing/attributes":637,"../../lib":738,"../scatter/attributes":1054}],1013:[function(t,e,r){"use strict";function n(t,e,r,n){o(t,e,r,n),r(n+".line.color"),r(n+".line.width",e.line.width),r(n+".line.dash",e.line.dash)}var i=t("../../lib"),a=t("./ohlc_defaults"),o=t("./direction_defaults"),s=t("./attributes"),l=t("./helpers");e.exports=function(t,e,r,o){function c(r,n){return i.coerce(t,e,s,r,n)}l.pushDummyTransformOpts(t,e);0!==a(t,e,c,o)?(c("line.width"),c("line.dash"),n(t,e,c,"increasing"),n(t,e,c,"decreasing"),c("text"),c("tickwidth")):e.visible=!1}},{"../../lib":738,"./attributes":1012,"./direction_defaults":1014,"./helpers":1015,"./ohlc_defaults":1017}],1014:[function(t,e,r){"use strict";e.exports=function(t,e,r,n){r(n+".showlegend"),!1===t.showlegend&&(e[n].showlegend=!1);r(n+".name",e.name+" - "+n)}},{}],1015:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib");r.pushDummyTransformOpts=function(t,e){var r={type:e.type,_ephemeral:!0};Array.isArray(t.transforms)?t.transforms.push(r):t.transforms=[r]},r.clearEphemeralTransformOpts=function(t){var e=t.transforms;if(Array.isArray(e)){for(var r=0;r<e.length;r++)e[r]._ephemeral&&e.splice(r,1);0===e.length&&delete t.transforms}},r.copyOHLC=function(t,e){t.open&&(e.open=t.open),t.high&&(e.high=t.high),t.low&&(e.low=t.low),t.close&&(e.close=t.close)},r.makeTransform=function(t,e,r){var n=i.extendFlat([],t.transforms);return n[e.transformIndex]={type:t.type,direction:r,open:t.open,high:t.high,low:t.low,close:t.close},n},r.getFilterFn=function(t){return new function(t){function e(t,e){return t===e?e>i?r=!0:e<i&&(r=!1):r=t<e,i=e,r}var r=!0,i=null;return"increasing"===t?function(t,r){return n(t)&&n(r)&&e(+t,+r)}:function(t,r){return n(t)&&n(r)&&!e(+t,+r)}}(t)},r.addRangeSlider=function(t,e){for(var r=!1,n=0;n<t.length;n++)if(!0===t[n].visible){r=!0;break}r&&(e.xaxis||(e.xaxis={}),e.xaxis.rangeslider||(e.xaxis.rangeslider={}))}},{"../../lib":738,"fast-isnumeric":132}],1016:[function(t,e,r){"use strict";var n=t("../../plot_api/register");e.exports={moduleType:"trace",name:"ohlc",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","showLegend"],meta:{},attributes:t("./attributes"),supplyDefaults:t("./defaults")},n(t("../scatter")),n(t("./transform"))},{"../../plot_api/register":775,"../../plots/cartesian":796,"../scatter":1066,"./attributes":1012,"./defaults":1013,"./transform":1018}],1017:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i){var a,o=r("x"),s=r("open"),l=r("high"),c=r("low"),u=r("close");return n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x"],i),a=Math.min(s.length,l.length,c.length,u.length),o&&(a=Math.min(a,o.length))<o.length&&(e.x=o.slice(0,a)),a<s.length&&(e.open=s.slice(0,a)),a<l.length&&(e.high=l.slice(0,a)),a<c.length&&(e.low=c.slice(0,a)),a<u.length&&(e.close=u.slice(0,a)),a}},{"../../registry":861}],1018:[function(t,e,r){"use strict";function n(t,e,r){var n={type:"scatter",mode:"lines",connectgaps:!1,visible:t.visible,opacity:t.opacity,xaxis:t.xaxis,yaxis:t.yaxis,hoverinfo:function(t){var e=t.hoverinfo;if("all"===e)return"x+text+name";var r=e.split("+"),n=r.indexOf("y"),i=r.indexOf("text");-1!==n&&(r.splice(n,1),-1===i&&r.push("text"));return r.join("+")}(t),transforms:s.makeTransform(t,e,r)},i=t[r];return i&&a.extendFlat(n,{x:t.x||[0],xcalendar:t.xcalendar,y:[].concat(t.low).concat(t.high),text:t.text,name:i.name,showlegend:i.showlegend,line:i.line}),n}var i=t("fast-isnumeric"),a=t("../../lib"),o=a._,s=t("./helpers"),l=t("../../plots/cartesian/axes"),c=t("../../plots/cartesian/axis_ids");r.moduleType="transform",r.name="ohlc",r.attributes={},r.supplyDefaults=function(t,e,r,n){return s.clearEphemeralTransformOpts(n),s.copyOHLC(t,e),t},r.transform=function(t,e){for(var r=[],i=0;i<t.length;i++){var a=t[i];"ohlc"===a.type?r.push(n(a,e,"increasing"),n(a,e,"decreasing")):r.push(a)}return s.addRangeSlider(r,e.layout),r},r.calcTransform=function(t,e,r){var n,u=r.direction,h=s.getFilterFn(u),f=c.getFromTrace(t,e,"x"),d=c.getFromTrace(t,e,"y"),p=function(t,e,r){var n=r._fullInput,i=n.tickwidth,o=n._minDiff;if(!o){var s=t._fullData,l=[];o=1/0;var c;for(c=0;c<s.length;c++){var u=s[c]._fullInput;if("ohlc"===u.type&&!0===u.visible&&u.xaxis===e._id&&(l.push(u),u.x&&u.x.length>1)){var h=a.simpleMap(u.x,e.d2c,0,r.xcalendar),f=a.distinctVals(h).minDiff;o=Math.min(o,f)}}for(o===1/0&&(o=1),c=0;c<l.length;c++)l[c]._minDiff=o}return o*i}(t,f,e),m=e.open,g=e.high,v=e.low,y=e.close,b=e.text,x=o(t,"open:")+" ",_=o(t,"high:")+" ",w=o(t,"low:")+" ",M=o(t,"close:")+" ",k=m.length,T=[],A=[],S=[];n=e._fullInput.x?function(t){var r=e.x[t],n=e.xcalendar,i=f.d2c(r,0,n);T.push(f.c2d(i-p,0,n),r,r,r,r,f.c2d(i+p,0,n),null)}:function(t){T.push(t-p,t,t,t,t,t+p,null)};for(var E=function(t,e,r,n){A.push(t,t,e,r,n,n,null)},L=function(t,e){return l.tickText(t,t.c2l(e),"hover").text},C=e._fullInput.hoverinfo,I=C.split("+"),P="all"===C,D=P||-1!==I.indexOf("y"),z=P||-1!==I.indexOf("text"),O=Array.isArray(b)?function(t){return b[t]||""}:function(){return b},F=function(t,e,r,n,i){var a=[];D&&(a.push(x+L(d,e)),a.push(_+L(d,r)),a.push(w+L(d,n)),a.push(M+L(d,i))),z&&a.push(O(t));var o=a.join("<br>");S.push(o,o,o,o,o,o,null)},R=0;R<k;R++)h(m[R],y[R])&&i(g[R])&&i(v[R])&&(n(R),E(m[R],g[R],v[R],y[R]),F(R,m[R],g[R],v[R],y[R]));e.x=T,e.y=A,e.text=S}},{"../../lib":738,"../../plots/cartesian/axes":785,"../../plots/cartesian/axis_ids":788,"./helpers":1015,"fast-isnumeric":132}],1019:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/colorbar/attributes"),a=t("../../components/colorscale/scales"),o=t("../../plots/cartesian/layout_attributes"),s=t("../../plots/font_attributes"),l=t("../../lib/extend"),c=l.extendDeepAll,u=l.extendFlat;e.exports={domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"calc"},{valType:"number",min:0,max:1,editType:"calc"}],dflt:[0,1],editType:"calc"},y:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"calc"},{valType:"number",min:0,max:1,editType:"calc"}],dflt:[0,1],editType:"calc"},editType:"calc"},labelfont:s({editType:"calc"}),tickfont:s({editType:"calc"}),rangefont:s({editType:"calc"}),dimensions:{_isLinkedToArray:"dimension",label:{valType:"string",editType:"calc"},tickvals:u({},o.tickvals,{editType:"calc"}),ticktext:u({},o.ticktext,{editType:"calc"}),tickformat:{valType:"string",dflt:"3s",editType:"calc"},visible:{valType:"boolean",dflt:!0,editType:"calc"},range:{valType:"info_array",items:[{valType:"number",editType:"calc"},{valType:"number",editType:"calc"}],editType:"calc"},constraintrange:{valType:"info_array",items:[{valType:"number",editType:"calc"},{valType:"number",editType:"calc"}],editType:"calc"},values:{valType:"data_array",dflt:[],editType:"calc"},editType:"calc"},line:u(c(n("line","calc"),{colorscale:{dflt:a.Viridis},autocolorscale:{dflt:!1}}),{showscale:{valType:"boolean",dflt:!1,editType:"calc"},colorbar:i,editType:"calc"})}},{"../../components/colorbar/attributes":614,"../../components/colorscale/color_attributes":621,"../../components/colorscale/scales":632,"../../lib/extend":727,"../../plots/cartesian/layout_attributes":797,"../../plots/font_attributes":810}],1020:[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");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,x:0,y:0,width:this.width,height:this.height,preserveAspectRatio:"none"})}),window.setTimeout(function(){n.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)}},{"../../constants/xmlns_namespaces":719,"../../plots/get_data":820,"./plot":1028,d3:123}],1021:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("../../lib"),o=t("../../lib/gup").wrap;e.exports=function(t,e){var r=!!e.line.colorscale&&a.isArray(e.line.color),s=r?e.line.color:Array.apply(0,Array(e.dimensions.reduce(function(t,e){return Math.max(t,e.values.length)},0))).map(function(){return.5}),l=r?e.line.colorscale:[[0,e.line.color],[1,e.line.color]];return n(e,"line")&&i(e,e.line.color,"line","c"),o({lineColor:s,cscale:l})}},{"../../components/colorscale/calc":620,"../../components/colorscale/has_colorscale":627,"../../lib":738,"../../lib/gup":735}],1022:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.line,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0!==l&&l.showscale){var u=l.color,h=l.cmin,f=l.cmax;n(h)||(h=i.aggNums(Math.min,null,u)),n(f)||(f=i.aggNums(Math.max,null,u));var d=e[0].t.cb=s(t,c),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,h,f),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:h,end:f,size:(f-h)/254}).options(l.colorbar)()}else a.autoMargin(t,c)}},{"../../components/colorbar/draw":617,"../../components/colorscale":628,"../../lib":738,"../../plots/plots":846,"fast-isnumeric":132}],1023:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,verticalPadding:2,tickDistance:50,canvasPixelRatio:1,blockLineCount:5e3,scatter:!1,layers:["contextLineLayer","focusLineLayer","pickLineLayer"],axisTitleOffset:28,axisExtentOffset:10,bar:{width:4,capturewidth:10,fillcolor:"magenta",fillopacity:1,strokecolor:"white",strokeopacity:1,strokewidth:1,handleheight:16,handleopacity:1,handleoverlap:0},cn:{axisExtentText:"axis-extent-text",parcoordsLineLayers:"parcoords-line-layers",parcoordsLineLayer:"parcoords-lines",parcoords:"parcoords",parcoordsControlView:"parcoords-control-view",yAxis:"y-axis",axisOverlays:"axis-overlays",axis:"axis",axisHeading:"axis-heading",axisTitle:"axis-title",axisExtent:"axis-extent",axisExtentTop:"axis-extent-top",axisExtentTopText:"axis-extent-top-text",axisExtentBottom:"axis-extent-bottom",axisExtentBottomText:"axis-extent-bottom-text",axisBrush:"axis-brush"},id:{filterBarPattern:"filter-bar-pattern"}}},{}],1024:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/colorscale/has_colorscale"),o=t("../../components/colorscale/defaults"),s=t("./constants").maxDimensionCount;e.exports=function(t,e,r,l){function c(r,a){return n.coerce(t,e,i,r,a)}var u=function(t,e){function r(t,e){return n.coerce(a,o,i.dimensions,t,e)}var a,o,l,c=t.dimensions||[],u=e.dimensions=[],h=1/0;for(c.length>s&&(n.log("parcoords traces support up to "+s+" dimensions at the moment"),c.splice(s)),l=0;l<c.length;l++)a=c[l],o={},n.isPlainObject(a)&&(r("visible",r("values").length>0)&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),h=Math.min(h,o.values.length)),o._index=l,u.push(o));if(isFinite(h))for(l=0;l<u.length;l++)(o=u[l]).visible&&o.values.length>h&&(o.values=o.values.slice(0,h));return u}(t,e);!function(t,e,r,i,s){s("line.color",r),a(t,"line")&&n.isArray(t.line.color)?(s("line.colorscale"),o(t,e,i,s,{prefix:"line.",cLetter:"c"})):s("line.color",r)}(t,e,r,l,c),c("domain.x"),c("domain.y"),Array.isArray(u)&&u.length||(e.visible=!1);var h={family:l.font.family,size:Math.round(l.font.size*(10/12)),color:l.font.color};n.coerceFont(c,"labelfont",h),n.coerceFont(c,"tickfont",h),n.coerceFont(c,"rangefont",h)}},{"../../components/colorscale/defaults":623,"../../components/colorscale/has_colorscale":627,"../../lib":738,"./attributes":1019,"./constants":1023}],1025:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.moduleType="trace",n.name="parcoords",n.basePlotModule=t("./base_plot"),n.categories=["gl","regl","noOpacity"],n.meta={},e.exports=n},{"./attributes":1019,"./base_plot":1020,"./calc":1021,"./colorbar":1022,"./defaults":1024,"./plot":1028}],1026:[function(t,e,r){"use strict";function n(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 i(t,e,r,i,a,o){function s(c){var u;u=Math.min(i,a-c*i),o.offset=f*c*i,o.count=f*u,0===c&&(window.cancelAnimationFrame(r.currentRafs[l]),delete r.currentRafs[l],n(t,o.scissorX,o.scissorY,o.scissorWidth,o.viewBoxSize[1])),r.clearOnly||(e(o),c*i+u<a&&(r.currentRafs[l]=window.requestAnimationFrame(function(){s(c+1)})),r.drawCompleted=!1)}var l=o.key;r.drawCompleted||(!function(t){t.read({x:0,y:0,width:1,height:1,data:m})}(t),r.drawCompleted=!0),s(0)}function a(t){return Math.max(u,Math.min(1-u,t))}function o(t,e){return(t>>>8*e)%256/255}function s(t,e){var r={};return[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15].map(function(r){return function(t,e,r){var n,i,a,o=[];for(i=0;i<t;i++)for(a=0;a<f;a++)for(n=0;n<d;n++)o.push(e[i*h+r*d+n]),r*d+n===h-1&&a%2==0&&(o[o.length-1]*=-1);return o}(t,e,r)}).forEach(function(t,e){r["p"+e.toString(16)]=t}),r}function l(t,e,r){return t+e<=r}var c=t("./constants"),u=1e-6,h=64,f=2,d=4,p=[119,119,119],m=new Uint8Array(4),g=new Uint8Array(4);e.exports=function(t,e,r){function u(t,e,r,n,i,a,o,s,u,h,d){var p,g,v,x,_=[t,e],w=c.verticalPadding/a,k=[0,1].map(function(){return[0,1,2,3].map(function(){return new Float32Array(16)})}),T=[0,1].map(function(){return[0,1,2,3].map(function(){return new Float32Array(16)})});for(p=0;p<2;p++)for(x=_[p],g=0;g<4;g++)for(v=0;v<16;v++){var S=v+16*g;k[p][g][v]=v+16*g===x?1:0,T[p][g][v]=(!M&&l(v,16*g,D)?A[0===S?0:1+(S-1)%(A.length-1)].filter[p]:p)+(2*p-1)*w}return{key:o,resolution:[y,b],viewBoxPosition:[r+P,n],viewBoxSize:[i,a],i:t,ii:e,dim1A:k[0][0],dim1B:k[0][1],dim1C:k[0][2],dim1D:k[0][3],dim2A:k[1][0],dim2B:k[1][1],dim2C:k[1][2],dim2D:k[1][3],loA:T[0][0],loB:T[0][1],loC:T[0][2],loD:T[0][3],hiA:T[1][0],hiB:T[1][1],hiC:T[1][2],hiD:T[1][3],colorClamp:N,scatter:s||0,scissorX:(u===h?0:r+P)+(f.pad.l-P)+f.layoutWidth*m.x[0],scissorWidth:(u===d?y-r+P:i+.5)+(u===h?r+P:0),scissorY:n+f.pad.b+f.layoutHeight*m.y[0],scissorHeight:a,viewportX:f.pad.l-P+f.layoutWidth*m.x[0],viewportY:f.pad.b+f.layoutHeight*m.y[0],viewportWidth:y,viewportHeight:b}}var f=e.model,d=e.viewModel,m=f.domain,v=f.lines,y=f.canvasWidth,b=f.canvasHeight,x=d.dimensions,_=d.panels,w=f.unitToColor,M=e.context,k=e.pick,T={currentRafs:{},drawCompleted:!0,clearOnly:!1},A=x.slice(),S=A.length,E=A[0]?A[0].values.length:0,L=M,C=k?v.color.map(function(t,e){return e/v.color.length}):v.color,I=Math.max(1/255,Math.pow(1/C.length,1/3)),P=v.canvasOverdrag,D=_.length,z=function(t,e,r,n){for(var i=[],s=0;s<t;s++)for(var l=0;l<h;l++)i.push(l<e?r[l].paddedUnitValues[s]:l===h-1?a(n[s]):l>=h-4?o(s,h-2-l):.5);return i}(E,S,A,C),O=s(E,z),F=e.regl,R=F.texture({shape:[256,1],format:"rgba",type:"uint8",mag:"nearest",min:"nearest",data:function(t,e,r){for(var n=[],i=0;i<256;i++){var a=t(i/255);n.push((e?p:a).concat(r))}return n}(w,M,Math.round(255*(M?I:1)))}),j=F({profile:!1,blend:{enable:L,func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:1,dstAlpha:1},equation:{rgb:"add",alpha:"add"},color:[0,0,0,0]},depth:{enable:!L,mask:!0,func:"less",range:[0,1]},cull:{enable:!0,face:"back"},scissor:{enable:!0,box:{x:F.prop("scissorX"),y:F.prop("scissorY"),width:F.prop("scissorWidth"),height:F.prop("scissorHeight")}},viewport:{x:F.prop("viewportX"),y:F.prop("viewportY"),width:F.prop("viewportWidth"),height:F.prop("viewportHeight")},dither:!1,vert:k?"precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D palette;\n\nuniform vec2 colorClamp;\n\nuniform float scatter;\n\nvarying vec4 fragColor;\n\nvec4 zero = vec4(0, 0, 0, 0);\nvec4 unit = vec4(1, 1, 1, 1);\nvec2 xyProjection = vec2(1, 1);\n\nmat4 mclamp(mat4 m, mat4 lo, mat4 hi) {\n return mat4(clamp(m[0], lo[0], hi[0]),\n clamp(m[1], lo[1], hi[1]),\n clamp(m[2], lo[2], hi[2]),\n clamp(m[3], lo[3], hi[3]));\n}\n\nbool mshow(mat4 p, mat4 lo, mat4 hi) {\n return mclamp(p, lo, hi) == p;\n}\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit, unit);\n}\n\nvoid main() {\n\n float x = 0.5 * sign(pf[3]) + 0.5;\n float prominence = abs(pf[3]);\n float depth = 1.0 - prominence;\n\n mat4 pA = mat4(p0, p1, p2, p3);\n mat4 pB = mat4(p4, p5, p6, p7);\n mat4 pC = mat4(p8, p9, pa, pb);\n mat4 pD = mat4(pc, pd, pe, abs(pf));\n\n float show = float(mshow(pA, loA, hiA) &&\n mshow(pB, loB, hiB) &&\n mshow(pC, loC, hiC) &&\n mshow(pD, loD, hiD));\n\n vec2 yy = show * vec2(val(pA, dim2A) + val(pB, dim2B) + val(pC, dim2C) + val(pD, dim2D),\n val(pA, dim1A) + val(pB, dim1B) + val(pC, dim1C) + val(pD, dim1D));\n\n vec2 dimensionToggle = vec2(x, 1.0 - x);\n\n vec2 scatterToggle = vec2(scatter, 1.0 - scatter);\n\n float y = dot(yy, dimensionToggle);\n mat2 xy = mat2(viewBoxSize * yy + dimensionToggle, viewBoxSize * vec2(x, y));\n\n vec2 viewBoxXY = viewBoxPosition + xy * scatterToggle;\n\n float depthOrHide = depth + 2.0 * (1.0 - show);\n\n gl_Position = vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depthOrHide,\n 1.0\n );\n\n // pick coloring\n fragColor = vec4(pf.rgb, 1.0);\n}\n":"precision highp float;\n#define GLSLIFY 1\n\nattribute vec4 p0, p1, p2, p3,\n p4, p5, p6, p7,\n p8, p9, pa, pb,\n pc, pd, pe;\n\nattribute vec4 pf;\n\nuniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D,\n loA, hiA, loB, hiB, loC, hiC, loD, hiD;\n\nuniform vec2 resolution,\n viewBoxPosition,\n viewBoxSize;\n\nuniform sampler2D palette;\n\nuniform vec2 colorClamp;\n\nuniform float scatter;\n\nvarying vec4 fragColor;\n\nvec4 zero = vec4(0, 0, 0, 0);\nvec4 unit = vec4(1, 1, 1, 1);\nvec2 xyProjection = vec2(1, 1);\n\nmat4 mclamp(mat4 m, mat4 lo, mat4 hi) {\n return mat4(clamp(m[0], lo[0], hi[0]),\n clamp(m[1], lo[1], hi[1]),\n clamp(m[2], lo[2], hi[2]),\n clamp(m[3], lo[3], hi[3]));\n}\n\nbool mshow(mat4 p, mat4 lo, mat4 hi) {\n return mclamp(p, lo, hi) == p;\n}\n\nfloat val(mat4 p, mat4 v) {\n return dot(matrixCompMult(p, v) * unit, unit);\n}\n\nvoid main() {\n\n float x = 0.5 * sign(pf[3]) + 0.5;\n float prominence = abs(pf[3]);\n float depth = 1.0 - prominence;\n\n mat4 pA = mat4(p0, p1, p2, p3);\n mat4 pB = mat4(p4, p5, p6, p7);\n mat4 pC = mat4(p8, p9, pa, pb);\n mat4 pD = mat4(pc, pd, pe, abs(pf));\n\n float show = float(mshow(pA, loA, hiA) &&\n mshow(pB, loB, hiB) &&\n mshow(pC, loC, hiC) &&\n mshow(pD, loD, hiD));\n\n vec2 yy = show * vec2(val(pA, dim2A) + val(pB, dim2B) + val(pC, dim2C) + val(pD, dim2D),\n val(pA, dim1A) + val(pB, dim1B) + val(pC, dim1C) + val(pD, dim1D));\n\n vec2 dimensionToggle = vec2(x, 1.0 - x);\n\n vec2 scatterToggle = vec2(scatter, 1.0 - scatter);\n\n float y = dot(yy, dimensionToggle);\n mat2 xy = mat2(viewBoxSize * yy + dimensionToggle, viewBoxSize * vec2(x, y));\n\n vec2 viewBoxXY = viewBoxPosition + xy * scatterToggle;\n\n float depthOrHide = depth + 2.0 * (1.0 - show);\n\n gl_Position = vec4(\n xyProjection * (2.0 * viewBoxXY / resolution - 1.0),\n depthOrHide,\n 1.0\n );\n\n // visible coloring\n float clampedColorIndex = clamp((prominence - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);\n fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));\n}\n",frag:"precision lowp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor;\n\nvoid main() {\n gl_FragColor = fragColor;\n}\n",primitive:"lines",lineWidth:1,attributes:O,uniforms:{resolution:F.prop("resolution"),viewBoxPosition:F.prop("viewBoxPosition"),viewBoxSize:F.prop("viewBoxSize"),dim1A:F.prop("dim1A"),dim2A:F.prop("dim2A"),dim1B:F.prop("dim1B"),dim2B:F.prop("dim2B"),dim1C:F.prop("dim1C"),dim2C:F.prop("dim2C"),dim1D:F.prop("dim1D"),dim2D:F.prop("dim2D"),loA:F.prop("loA"),hiA:F.prop("hiA"),loB:F.prop("loB"),hiB:F.prop("hiB"),loC:F.prop("loC"),hiC:F.prop("hiC"),loD:F.prop("loD"),hiD:F.prop("hiD"),palette:R,colorClamp:F.prop("colorClamp"),scatter:F.prop("scatter")},offset:F.prop("offset"),count:F.prop("count")}),N=[0,1],B=[];return{setColorDomain:function(t){N[0]=t[0],N[1]=t[1]},render:function(t,e,a){var o,s,l,c=1/0,h=-1/0;for(o=0;o<D;o++)t[o].dim2.canvasX>h&&(h=t[o].dim2.canvasX,l=o),t[o].dim1.canvasX<c&&(c=t[o].dim1.canvasX,s=o);for(0===D&&n(F,0,0,y,b),o=0;o<D;o++){var f=t[o],d=f.dim1,p=d.crossfilterDimensionIndex,m=f.canvasX,g=f.canvasY,x=f.dim2.crossfilterDimensionIndex,_=f.panelSizeX,w=f.panelSizeY,M=m+_;if(e||!B[p]||B[p][0]!==m||B[p][1]!==M){B[p]=[m,M];var k=u(p,x,m,g,_,w,d.crossfilterDimensionIndex,r||d.scatter?1:0,o,s,l);T.clearOnly=a,i(F,j,T,e?v.blockLineCount:E,E,k)}}},readPixel:function(t,e){return F.read({x:t,y:e,width:1,height:1,data:g}),g},readPixels:function(t,e,r,n){var i=new Uint8Array(4*r*n);return F.read({x:t,y:e,width:r,height:n,data:i}),i},destroy:function(){R.destroy()}}}},{"./constants":1023}],1027:[function(t,e,r){"use strict";function n(t){return!("visible"in t)||t.visible}function i(t){var e=t.range?t.range[0]:d.min(t.values),r=t.range?t.range[1]:d.max(t.values);return!isNaN(e)&&isFinite(e)||(e=0),!isNaN(r)&&isFinite(r)||(r=0),e===r&&(void 0===e?(e=0,r=1):0===e?(e-=1,r+=1):(e*=.9,r*=1.1)),[e,r]}function a(t,e){var r,n,i,a,o;for(r=0,i=1/0,a=(n=t.range())[0];r<n.length;r++){if((o=Math.abs(n[r]-e))>i)return a;i=o,a=n[r]}return n[n.length-1]}function o(t){return d.scale.linear().domain(i(t))}function s(t,e,r){var i=v(e),a=i.trace,s=i.lineColor,l=i.cscale,c=a.line,u=a.domain,p=a.dimensions,m=t.width,g=a.labelfont,y=a.tickfont,b=a.rangefont,x=f.extendDeep({},c,{color:s.map(o({values:s,range:[c.cmin,c.cmax]})),blockLineCount:h.blockLineCount,canvasOverdrag:h.overdrag*h.canvasPixelRatio}),_=Math.floor(m*(u.x[1]-u.x[0])),w=Math.floor(t.height*(u.y[1]-u.y[0])),M=t.margin||{l:80,r:80,t:100,b:80},k=_,T=w;return{key:r,colCount:p.filter(n).length,dimensions:p,tickDistance:h.tickDistance,unitToColor:function(t){var e=t.map(function(t){return t[0]}),r=t.map(function(t){return t[1]}).map(function(t){return d.rgb(t)}),n="rgb".split("").map(function(t){return d.scale.linear().clamp(!0).domain(e).range(r.map(function(t){return function(e){return e[t]}}(t)))});return function(t){return n.map(function(e){return e(t)})}}(l),lines:x,labelFont:g,tickFont:y,rangeFont:b,layoutWidth:m,layoutHeight:t.height,domain:u,translateX:u.x[0]*m,translateY:t.height-u.y[1]*t.height,pad:M,canvasWidth:k*h.canvasPixelRatio+2*x.canvasOverdrag,canvasHeight:T*h.canvasPixelRatio,width:k,height:T,canvasPixelRatio:h.canvasPixelRatio}}function l(t){var e=t.width,r=t.height,a=t.dimensions,s=t.canvasPixelRatio,l=function(r){return e*r/Math.max(1,t.colCount-1)},c=h.verticalPadding/(r*s),u=1-2*c,f=function(t){return c+u*t},p={key:t.key,xScale:l,model:t},m={};return p.dimensions=a.filter(n).map(function(e,n){var a=o(e),c=m[e.label];m[e.label]=(c||0)+1;return{key:e.label+(c?"__"+c:""),label:e.label,tickFormat:e.tickformat,tickvals:e.tickvals,ticktext:e.ticktext,ordinal:!!e.tickvals,scatter:h.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(a).map(f),xScale:l,x:l(n),canvasX:l(n)*s,unitScale:function(t,e){return d.scale.linear().range([t-e,e])}(r,h.verticalPadding),domainScale:function(t,e,r){var n=i(r),a=r.ticktext;return r.tickvals?d.scale.ordinal().domain(r.tickvals.map(function(t,e){return function(r,n){if(e){var i=e[n];return null===i||void 0===i?t(r):i}return t(r)}}(d.format(r.tickformat),a))).range(r.tickvals.map(function(t){return(t-n[0])/(n[1]-n[0])}).map(function(r){return t-e+r*(e-(t-e))})):d.scale.linear().domain(n).range([t-e,e])}(r,h.verticalPadding,e),ordinalScale:function(t){var e=i(t);return t.tickvals&&d.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-e[0])/(e[1]-e[0])}))}(e),domainToUnitScale:a,filter:e.constraintrange?e.constraintrange.map(a):[0,1],parent:p,model:t}}),p}function c(t){t.classed(h.cn.axisExtentText,!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var u=t("./lines"),h=t("./constants"),f=t("../../lib"),d=t("d3"),p=t("../../components/drawing"),m=t("../../lib/gup").keyFun,g=t("../../lib/gup").repeat,v=t("../../lib/gup").unwrap;e.exports=function(t,e,r,n,i,o){function y(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function b(t,e){return(h.scatter?function(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),i=n.length-1,a=i,o=0;o<i;o++)for(var s=0;s<i;s++){var l=r[s+o*i]||(r[s+o*i]={}),c=n[s],u=n[s+1];l.dim1=n[o+1],l.dim2=u,l.canvasX=c.canvasX,l.panelSizeX=u.canvasX-c.canvasX,l.panelSizeY=e.model.canvasHeight/a,l.y=o*l.panelSizeY,l.canvasY=e.model.canvasHeight-l.y-l.panelSizeY}}:function(t,e){for(var r=e.panels||(e.panels=[]),n=t.each(function(t){return t})[e.key].map(function(t){return t.__data__}),i=n.length-1,a=0;a<1;a++)for(var o=0;o<i;o++){var s=r[o+a*i]||(r[o+a*i]={}),l=n[o],c=n[o+1];s.dim1=l,s.dim2=c,s.canvasX=l.canvasX,s.panelSizeX=c.canvasX-l.canvasX,s.panelSizeY=e.model.canvasHeight/1,s.y=a*s.panelSizeY,s.canvasY=e.model.canvasHeight-s.y-s.panelSizeY}})(t,e)}function x(t){return t.ordinal?function(){return""}:d.format(t.tickFormat)}function _(){q=!0,k=!0}function w(t){T=!1;var e=t.parent,r=t.brush.extent(),n=e.dimensions,i=n[t.xIndex].filter,a=q&&r[0]===r[1];a&&(t.brush.clear(),d.select(this).select("rect.extent").attr("y",-100));var o=a?[0,1]:r.slice();if(o[0]!==i[0]||o[1]!==i[1]){n[t.xIndex].filter=o,e.focusLayer&&e.focusLayer.render(e.panels,!0);var s=y(e);!G&&s?(e.contextLayer&&e.contextLayer.render(e.panels,!0),G=!0):G&&!s&&(e.contextLayer&&e.contextLayer.render(e.panels,!0,!0),G=!1)}q=!1}function M(t){var e=t.parent,r=t.brush.extent(),n=r[0]===r[1],i=e.dimensions[t.xIndex].filter;if(!n&&t.ordinal&&(i[0]=a(t.ordinalScale,i[0]),i[1]=a(t.ordinalScale,i[1]),i[0]===i[1]&&(i[0]=Math.max(0,i[0]-.05),i[1]=Math.min(1,i[1]+.05)),d.select(this).transition().duration(150).call(t.brush.extent(i)),e.focusLayer.render(e.panels,!0)),e.pickLayer&&e.pickLayer.render(e.panels,!0),T=!0,k="ending",o&&o.filterChanged){var s=t.domainToUnitScale.invert,l=i.map(s);o.filterChanged(e.key,t.visibleIndex,l)}}var k=!1,T=!0,A=n.filter(function(t){return v(t).trace.visible}).map(s.bind(0,i)).map(l);r.each(function(t,e){return f.extendFlat(t,A[e])});var S=r.selectAll(".gl-canvas").each(function(t){t.viewModel=A[0],t.model=t.viewModel?t.viewModel.model:null}),E={renderers:[],dimensions:[]},L=null;S.filter(function(t){return t.pick}).on("mousemove",function(t){if(T&&t.lineLayer&&o&&o.hover){var e=d.event,r=this.width,n=this.height,i=d.mouse(this),a=i[0],s=i[1];if(a<0||s<0||a>=r||s>=n)return;var l=t.lineLayer.readPixel(a,n-1-s),c=0!==l[3],u=c?l[2]+256*(l[1]+256*l[0]):null,h={x:a,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:u};u!==L&&(c?o.hover(h):o.unhover&&o.unhover(h),L=u)}}),S.style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var C=e.selectAll("."+h.cn.parcoords).data(A,m);C.exit().remove(),C.enter().append("g").classed(h.cn.parcoords,!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","none").call(function(t){var e=t.selectAll("defs").data(g,m);e.enter().append("defs");var r=e.selectAll("#"+h.id.filterBarPattern).data(g,m);r.enter().append("pattern").attr("id",h.id.filterBarPattern).attr("patternUnits","userSpaceOnUse"),r.attr("x",-h.bar.width).attr("width",h.bar.capturewidth).attr("height",function(t){return t.model.height});var n=r.selectAll("rect").data(g,m);n.enter().append("rect").attr("shape-rendering","crispEdges"),n.attr("height",function(t){return t.model.height}).attr("width",h.bar.width).attr("x",h.bar.width/2).attr("fill",h.bar.fillcolor).attr("fill-opacity",h.bar.fillopacity).attr("stroke",h.bar.strokecolor).attr("stroke-opacity",h.bar.strokeopacity).attr("stroke-width",h.bar.strokewidth)}),C.attr("width",function(t){return t.model.width+t.model.pad.l+t.model.pad.r}).attr("height",function(t){return t.model.height+t.model.pad.t+t.model.pad.b}).attr("transform",function(t){return"translate("+t.model.translateX+","+t.model.translateY+")"});var I=C.selectAll("."+h.cn.parcoordsControlView).data(g,m);I.enter().append("g").classed(h.cn.parcoordsControlView,!0).style("box-sizing","content-box"),I.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var P=I.selectAll("."+h.cn.yAxis).data(function(t){return t.dimensions},m);P.enter().append("g").classed(h.cn.yAxis,!0).each(function(t){E.dimensions.push(t)}),I.each(function(t){b(P,t)}),S.filter(function(t){return!!t.viewModel}).each(function(t){t.lineLayer=u(this,t,h.scatter),t.viewModel[t.key]=t.lineLayer,E.renderers.push(function(){t.lineLayer.render(t.viewModel.panels,!0)}),t.lineLayer.render(t.viewModel.panels,!t.context)}),P.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),P.call(d.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;T=!1,k||(t.x=Math.max(-h.overdrag,Math.min(t.model.width+h.overdrag,d.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,P.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}),b(P,e),P.filter(function(e){return 0!==Math.abs(t.xIndex-e.xIndex)}).attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),d.select(this).attr("transform","translate("+t.x+", 0)"),P.each(function(r,n,i){i===t.parent.key&&(e.dimensions[n]=r)}),e.contextLayer&&e.contextLayer.render(e.panels,!1,!y(e)),e.focusLayer.render&&e.focusLayer.render(e.panels))}).on("dragend",function(t){var e=t.parent;k?"ending"===k&&(k=!1):(t.x=t.xScale(t.xIndex),t.canvasX=t.x*t.model.canvasPixelRatio,b(P,e),d.select(this).attr("transform",function(t){return"translate("+t.x+", 0)"}),e.contextLayer&&e.contextLayer.render(e.panels,!1,!y(e)),e.focusLayer&&e.focusLayer.render(e.panels),e.pickLayer&&e.pickLayer.render(e.panels,!0),T=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex})))})),P.exit().remove();var D=P.selectAll("."+h.cn.axisOverlays).data(g,m);D.enter().append("g").classed(h.cn.axisOverlays,!0),D.selectAll("."+h.cn.axis).remove();var z=D.selectAll("."+h.cn.axis).data(g,m);z.enter().append("g").classed(h.cn.axis,!0),z.each(function(t){var e=t.model.height/t.model.tickDistance,r=t.domainScale,n=r.domain();d.select(this).call(d.svg.axis().orient("left").tickSize(4).outerTickSize(2).ticks(e,t.tickFormat).tickValues(t.ordinal?n:null).tickFormat(t.ordinal?function(t){return t}:null).scale(r)),p.font(z.selectAll("text"),t.model.tickFont)}),z.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),z.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 O=D.selectAll("."+h.cn.axisHeading).data(g,m);O.enter().append("g").classed(h.cn.axisHeading,!0);var F=O.selectAll("."+h.cn.axisTitle).data(g,m);F.enter().append("text").classed(h.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),F.attr("transform","translate(0,"+-h.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){p.font(F,t.model.labelFont)});var R=D.selectAll("."+h.cn.axisExtent).data(g,m);R.enter().append("g").classed(h.cn.axisExtent,!0);var j=R.selectAll("."+h.cn.axisExtentTop).data(g,m);j.enter().append("g").classed(h.cn.axisExtentTop,!0),j.attr("transform","translate(0,"+-h.axisExtentOffset+")");var N=j.selectAll("."+h.cn.axisExtentTopText).data(g,m);N.enter().append("text").classed(h.cn.axisExtentTopText,!0).call(c),N.text(function(t){return x(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){p.font(N,t.model.rangeFont)});var B=R.selectAll("."+h.cn.axisExtentBottom).data(g,m);B.enter().append("g").classed(h.cn.axisExtentBottom,!0),B.attr("transform",function(t){return"translate(0,"+(t.model.height+h.axisExtentOffset)+")"});var U=B.selectAll("."+h.cn.axisExtentBottomText).data(g,m);U.enter().append("text").classed(h.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(c),U.text(function(t){return x(t)(t.domainScale.domain()[0])}).each(function(t){p.font(U,t.model.rangeFont)});var V=D.selectAll("."+h.cn.axisBrush).data(g,m),H=V.enter().append("g").classed(h.cn.axisBrush,!0);V.each(function(t){t.brush||(t.brush=d.svg.brush().y(t.unitScale).on("brushstart",_).on("brush",w).on("brushend",M),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),d.select(this).call(t.brush))}),H.selectAll("rect").attr("x",-h.bar.capturewidth/2).attr("width",h.bar.capturewidth),H.selectAll("rect.extent").attr("fill","url(#"+h.id.filterBarPattern+")").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),H.selectAll(".resize rect").attr("height",h.bar.handleheight).attr("opacity",0).style("visibility","visible"),H.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",h.bar.handleoverlap-h.bar.handleheight),H.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",h.bar.handleoverlap);var q=!1,G=!1;return E}},{"../../components/drawing":638,"../../lib":738,"../../lib/gup":735,"./constants":1023,"./lines":1026,d3:123}],1028:[function(t,e,r){(function(r){"use strict";var n=t("./parcoords"),i=t("regl");e.exports=function(t,e){var a=t._fullLayout,o=a._toppaper,s=a._paperdiv,l=a._glcontainer;a._glcanvas.each(function(e){e.regl||(e.regl=i({canvas:this,attributes:{antialias:!e.pick,preserveDrawingBuffer:!0},pixelRatio:t._context.plotGlPixelRatio||r.devicePixelRatio}))});var c={},u={},h=a._size;e.forEach(function(e,r){c[r]=t.data[r].dimensions,u[r]=t.data[r].dimensions.slice()});n(s,o,l,e,{width:h.w,height:h.h,margin:{t:h.t,r:h.r,b:h.b,l:h.l}},{filterChanged:function(e,r,n){var i=u[e][r],a=i.constraintrange;a&&2===a.length||(a=i.constraintrange=[]),a[0]=n[0],a[1]=n[1],t.emit("plotly_restyle")},hover:function(e){t.emit("plotly_hover",e)},unhover:function(e){t.emit("plotly_unhover",e)},axesMoved:function(e,r){function n(t){return!("visible"in t)||t.visible}function i(t,e,r){var n=e.indexOf(r),i=t.indexOf(n);return-1===i&&(i+=e.length),i}var a=function(t){return function(e,n){return i(r,t,e)-i(r,t,n)}}(u[e].filter(n));c[e].sort(a),u[e].filter(function(t){return!n(t)}).sort(function(t){return u[e].indexOf(t)}).forEach(function(t){c[e].splice(c[e].indexOf(t),1),c[e].splice(u[e].indexOf(t),0,t)}),t.emit("plotly_restyle")}})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./parcoords":1027,regl:508}],1029:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=t("../../lib/extend").extendFlat,s=i({editType:"calc",colorEditType:"style"});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:n.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:"calc"},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:o({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"calc"},textfont:o({},s,{}),insidetextfont:o({},s,{}),outsidetextfont:o({},s,{}),domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"calc"},{valType:"number",min:0,max:1,editType:"calc"}],dflt:[0,1],editType:"calc"},y:{valType:"info_array",items:[{valType:"number",min:0,max:1,editType:"calc"},{valType:"number",min:0,max:1,editType:"calc"}],dflt:[0,1],editType:"calc"},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"}}},{"../../components/color/attributes":612,"../../lib/extend":727,"../../plots/attributes":783,"../../plots/font_attributes":810}],1030:[function(t,e,r){"use strict";var n=t("../../registry");r.name="pie",r.plot=function(t){var e=n.getModule("pie"),r=function(t,e){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=i[0].trace;a._module===e&&!0===a.visible&&r.push(i)}return r}(t.calcdata,e);r.length&&e.plot(t,r)},r.clean=function(t,e,r,n){var i=n._has&&n._has("pie"),a=e._has&&e._has("pie");i&&!a&&n._pielayer.selectAll("g.trace").remove()}},{"../../registry":861}],1031:[function(t,e,r){"use strict";function n(t){var e,r=t.slice();for(e=0;e<t.length;e++)r.push(a(t[e]).lighten(20).toHexString());for(e=0;e<t.length;e++)r.push(a(t[e]).darken(20).toHexString());return r}var i=t("fast-isnumeric"),a=t("tinycolor2"),o=t("../../components/color"),s=t("./helpers");e.exports=function(t,e){function r(t,e){return!!t&&(!!(t=a(t)).isValid()&&(t=o.addOpacity(t,t.getAlpha()),_[e]||(_[e]=t),t))}var c,u,h,f,d,p=e.values,m=Array.isArray(p)&&p.length,g=e.labels,v=e.marker.colors,y=[],b=t._fullLayout,x=b.colorway,_=b._piecolormap,w={},M=0,k=b.hiddenlabels||[];if(b._piecolorway||x===o.defaults||(b._piecolorway=n(x)),e.dlabel)for(g=new Array(p.length),c=0;c<p.length;c++)g[c]=String(e.label0+c*e.dlabel);var T=(m?p:g).length;for(c=0;c<T;c++){if(m){if(u=p[c],!i(u))continue;if((u=+u)<0)continue}else u=1;void 0!==(h=g[c])&&""!==h||(h=c);var A=w[h=String(h)];void 0===A?(w[h]=y.length,(f=-1!==k.indexOf(h))||(M+=u),y.push({v:u,label:h,color:r(v[c]),i:c,pts:[c],hidden:f})):((d=y[A]).v+=u,d.pts.push(c),d.hidden||(M+=u),!1===d.color&&v[c]&&(d.color=r(v[c],h)))}for(e.sort&&y.sort(function(t,e){return e.v-t.v}),c=0;c<y.length;c++)!1===(d=y[c]).color&&(_[d.label]?d.color=_[d.label]:(_[d.label]=d.color=function(t,e){if(!l){var r=o.defaults;l=n(r)}var i=e||l;return i[t%i.length]}(b._piedefaultcolorcount,b._piecolorway),b._piedefaultcolorcount++));if(y[0]&&(y[0].vTotal=M),e.textinfo&&"none"!==e.textinfo){var S,E=-1!==e.textinfo.indexOf("label"),L=-1!==e.textinfo.indexOf("text"),C=-1!==e.textinfo.indexOf("value"),I=-1!==e.textinfo.indexOf("percent"),P=b.separators;for(c=0;c<y.length;c++){if(d=y[c],S=E?[d.label]:[],L){var D=s.getFirstFilled(e.text,d.pts);D&&S.push(D)}C&&S.push(s.formatPieValue(d.v,P)),I&&S.push(s.formatPiePercent(d.v/M,P)),d.text=S.join("<br>")}}return y};var l},{"../../components/color":613,"./helpers":1034,"fast-isnumeric":132,tinycolor2:543}],1032:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(r,a){return n.coerce(t,e,i,r,a)}var s=n.coerceFont,l=o("values"),c=o("labels");if(!Array.isArray(c)){if(!Array.isArray(l)||!l.length)return void(e.visible=!1);o("label0"),o("dlabel")}o("marker.line.width")&&o("marker.line.color");var u=o("marker.colors");Array.isArray(u)||(e.marker.colors=[]),o("scalegroup");var h=o("text"),f=o("textinfo",Array.isArray(h)?"text+percent":"percent");if(o("hovertext"),f&&"none"!==f){var d=o("textposition"),p=Array.isArray(d)||"auto"===d,m=p||"inside"===d,g=p||"outside"===d;if(m||g){var v=s(o,"textfont",a.font);m&&s(o,"insidetextfont",v),g&&s(o,"outsidetextfont",v)}}o("domain.x"),o("domain.y"),o("hole"),o("sort"),o("direction"),o("rotation"),o("pull")}},{"../../lib":738,"./attributes":1029}],1033:[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,v:t.v};return 1===t.pts.length&&(r.pointNumber=r.i=t.pts[0]),n(r,e,t.pts),r}},{"../../components/fx/helpers":652}],1034:[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<e.length;r++){var n=t[e[r]];if(n||0===n)return n}},r.castOption=function(t,e){return Array.isArray(t)?r.getFirstFilled(t,e):t||void 0}},{"../../lib":738}],1035:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.supplyLayoutDefaults=t("./layout_defaults"),n.layoutAttributes=t("./layout_attributes"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.styleOne=t("./style_one"),n.moduleType="trace",n.name="pie",n.basePlotModule=t("./base_plot"),n.categories=["pie","showLegend"],n.meta={},e.exports=n},{"./attributes":1029,"./base_plot":1030,"./calc":1031,"./defaults":1032,"./layout_attributes":1036,"./layout_defaults":1037,"./plot":1038,"./style":1039,"./style_one":1040}],1036:[function(t,e,r){"use strict";e.exports={hiddenlabels:{valType:"data_array",editType:"calc"}}},{}],1037:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./layout_attributes");e.exports=function(t,e){!function(r,a){n.coerce(t,e,i,r,a)}("hiddenlabels")}},{"../../lib":738,"./layout_attributes":1036}],1038:[function(t,e,r){"use strict";function n(t,e){if(t.v===e.vTotal&&!e.trace.hole)return 1;var r=Math.PI*Math.min(t.v/e.vTotal,.5);return Math.min(1/(1+1/Math.sin(r)),(1-e.trace.hole)/2)}function i(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}}var a=t("d3"),o=t("../../components/fx"),s=t("../../components/color"),l=t("../../components/drawing"),c=t("../../lib/svg_text_utils"),u=t("./helpers"),h=t("./event_data");e.exports=function(t,e){var r=t._fullLayout;!function(t,e){var r,n,i,a,o,s,l,c,u,h=[];for(i=0;i<t.length;i++){if(o=t[i][0],s=o.trace,r=e.w*(s.domain.x[1]-s.domain.x[0]),n=e.h*(s.domain.y[1]-s.domain.y[0]),l=s.pull,Array.isArray(l))for(l=0,a=0;a<s.pull.length;a++)s.pull[a]>l&&(l=s.pull[a]);o.r=Math.min(r,n)/(2+2*l),o.cx=e.l+e.w*(s.domain.x[1]+s.domain.x[0])/2,o.cy=e.t+e.h*(2-s.domain.y[1]-s.domain.y[0])/2,s.scalegroup&&-1===h.indexOf(s.scalegroup)&&h.push(s.scalegroup)}for(a=0;a<h.length;a++){for(u=1/0,c=h[a],i=0;i<t.length;i++)(o=t[i][0]).trace.scalegroup===c&&(u=Math.min(u,o.r*o.r/o.vTotal));for(i=0;i<t.length;i++)(o=t[i][0]).trace.scalegroup===c&&(o.r=Math.sqrt(u*o.vTotal))}}(e,r._size);var f=r._pielayer.selectAll("g.trace").data(e);f.enter().append("g").attr({"stroke-linejoin":"round",class:"trace"}),f.exit().remove(),f.order(),f.each(function(e){var f=a.select(this),d=e[0],p=d.trace;!function(t){function e(t){return[a.r*Math.sin(t),-a.r*Math.cos(t)]}var r,n,i,a=t[0],o=a.trace,s=o.rotation*Math.PI/180,l=2*Math.PI/a.vTotal,c="px0",u="px1";if("counterclockwise"===o.direction){for(r=0;r<t.length&&t[r].hidden;r++);if(r===t.length)return;s+=l*t[r].v,l*=-1,c="px1",u="px0"}for(i=e(s),r=0;r<t.length;r++)(n=t[r]).hidden||(n[c]=i,s+=l*n.v/2,n.pxmid=e(s),n.midangle=s,i=e(s+=l*n.v/2),n[u]=i,n.largeArc=n.v>a.vTotal/2?1:0)}(e),f.each(function(){var f=a.select(this).selectAll("g.slice").data(e);f.enter().append("g").classed("slice",!0),f.exit().remove();var m=[[[],[]],[[],[]]],g=!1;f.each(function(e){function s(t,r,n,i){return"a"+i*d.r+","+i*d.r+" 0 "+e.largeArc+(n?" 1 ":" 0 ")+i*(r[0]-t[0])+","+i*(r[1]-t[1])}if(e.hidden)a.select(this).selectAll("path,g").remove();else{e.pointNumber=e.i,e.curveNumber=p.index,m[e.pxmid[1]<0?0:1][e.pxmid[0]<0?0:1].push(e);var f=d.cx,v=d.cy,y=a.select(this),b=y.selectAll("path.surface").data([e]),x=!1,_=!1;if(b.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),y.select("path.textline").remove(),y.on("mouseover",function(){var i=t._fullLayout,s=t._fullData[p.index];if(!t._dragging&&!1!==i.hovermode){var l=s.hoverinfo;if(Array.isArray(l)&&(l=o.castHoverinfo({hoverinfo:[u.castOption(l,e.pts)],_module:p._module},i,0)),"all"===l&&(l="label+text+value+percent+name"),"none"!==l&&"skip"!==l&&l){var c=n(e,d),m=f+e.pxmid[0]*(1-c),g=v+e.pxmid[1]*(1-c),y=r.separators,b=[];if(-1!==l.indexOf("label")&&b.push(e.label),-1!==l.indexOf("text")){var w=u.castOption(s.hovertext||s.text,e.pts);w&&b.push(w)}-1!==l.indexOf("value")&&b.push(u.formatPieValue(e.v,y)),-1!==l.indexOf("percent")&&b.push(u.formatPiePercent(e.v/d.vTotal,y));var M=p.hoverlabel,k=M.font;o.loneHover({x0:m-c*d.r,x1:m+c*d.r,y:g,text:b.join("<br>"),name:-1!==l.indexOf("name")?s.name:void 0,idealAlign:e.pxmid[0]<0?"left":"right",color:u.castOption(M.bgcolor,e.pts)||e.color,borderColor:u.castOption(M.bordercolor,e.pts),fontFamily:u.castOption(k.family,e.pts),fontSize:u.castOption(k.size,e.pts),fontColor:u.castOption(k.color,e.pts)},{container:i._hoverlayer.node(),outerContainer:i._paper.node(),gd:t}),x=!0}t.emit("plotly_hover",{points:[h(e,s)],event:a.event}),_=!0}}).on("mouseout",function(r){var n=t._fullLayout,i=t._fullData[p.index];_&&(r.originalEvent=a.event,t.emit("plotly_unhover",{points:[h(e,i)],event:a.event}),_=!1),x&&(o.loneUnhover(n._hoverlayer.node()),x=!1)}).on("click",function(){var r=t._fullLayout,n=t._fullData[p.index];t._dragging||!1===r.hovermode||(t._hoverdata=[h(e,n)],o.click(t,a.event))}),p.pull){var w=+u.castOption(p.pull,e.pts)||0;w>0&&(f+=w*e.pxmid[0],v+=w*e.pxmid[1])}e.cxFinal=f,e.cyFinal=v;var M=p.hole;if(e.v===d.vTotal){var k="M"+(f+e.px0[0])+","+(v+e.px0[1])+s(e.px0,e.pxmid,!0,1)+s(e.pxmid,e.px0,!0,1)+"Z";M?b.attr("d","M"+(f+M*e.px0[0])+","+(v+M*e.px0[1])+s(e.px0,e.pxmid,!1,M)+s(e.pxmid,e.px0,!1,M)+"Z"+k):b.attr("d",k)}else{var T=s(e.px0,e.px1,!0,1);if(M){var A=1-M;b.attr("d","M"+(f+M*e.px1[0])+","+(v+M*e.px1[1])+s(e.px1,e.px0,!1,M)+"l"+A*e.px0[0]+","+A*e.px0[1]+T+"Z")}else b.attr("d","M"+f+","+v+"l"+e.px0[0]+","+e.px0[1]+T+"Z")}var S=u.castOption(p.textposition,e.pts),E=y.selectAll("g.slicetext").data(e.text&&"none"!==S?[0]:[]);E.enter().append("g").classed("slicetext",!0),E.exit().remove(),E.each(function(){var r=a.select(this).selectAll("text").data([0]);r.enter().append("text").attr("data-notex",1),r.exit().remove(),r.text(e.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(l.font,"outside"===S?p.outsidetextfont:p.insidetextfont).call(c.convertToTspans,t);var o,s=l.bBox(r.node());"outside"===S?o=i(s,e):(o=function(t,e,r){var i=Math.sqrt(t.width*t.width+t.height*t.height),a=t.width/t.height,o=Math.PI*Math.min(e.v/r.vTotal,.5),s=1-r.trace.hole,l=n(e,r),c={scale:l*r.r*2/i,rCenter:1-l,rotate:0};if(c.scale>=1)return c;var u=a+1/(2*Math.tan(o)),h=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),s/(Math.sqrt(a*a+s/2)+a)),f={scale:2*h/t.height,rCenter:Math.cos(h/r.r)-h*a/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},d=1/a,p=d+1/(2*Math.tan(o)),m=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),s/(Math.sqrt(d*d+s/2)+d)),g={scale:2*m/t.width,rCenter:Math.cos(m/r.r)-m/a/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=g.scale>f.scale?g:f;return c.scale<1&&v.scale>c.scale?v:c}(s,e,d),"auto"===S&&o.scale<1&&(r.call(l.font,p.outsidetextfont),p.outsidetextfont.family===p.insidetextfont.family&&p.outsidetextfont.size===p.insidetextfont.size||(s=l.bBox(r.node())),o=i(s,e)));var u=f+e.pxmid[0]*o.rCenter+(o.x||0),h=v+e.pxmid[1]*o.rCenter+(o.y||0);o.outside&&(e.yLabelMin=h-s.height/2,e.yLabelMid=h,e.yLabelMax=h+s.height/2,e.labelExtraX=0,e.labelExtraY=0,g=!0),r.attr("transform","translate("+u+","+h+")"+(o.scale<1?"scale("+o.scale+")":"")+(o.rotate?"rotate("+o.rotate+")":"")+"translate("+-(s.left+s.right)/2+","+-(s.top+s.bottom)/2+")")})}}),g&&function(t,e){function r(t,e){return t.pxmid[1]-e.pxmid[1]}function n(t,e){return e.pxmid[1]-t.pxmid[1]}function i(t,r){r||(r={});var n,i,a,s,d=r.labelExtraY+(o?r.yLabelMax:r.yLabelMin),p=o?t.yLabelMin:t.yLabelMax,g=o?t.yLabelMax:t.yLabelMin,v=t.cyFinal+c(t.px0[1],t.px1[1]),y=d-p;if(y*f>0&&(t.labelExtraY=y),Array.isArray(e.pull))for(i=0;i<m.length;i++)(a=m[i])===t||(u.castOption(e.pull,t.pts)||0)>=(u.castOption(e.pull,a.pts)||0)||((t.pxmid[1]-a.pxmid[1])*f>0?(y=a.cyFinal+c(a.px0[1],a.px1[1])-p-t.labelExtraY)*f>0&&(t.labelExtraY+=y):(g+t.labelExtraY-v)*f>0&&(n=3*h*Math.abs(i-m.indexOf(t)),(s=a.cxFinal+l(a.px0[0],a.px1[0])+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*h>0&&(t.labelExtraX+=s)))}var a,o,s,l,c,h,f,d,p,m,g,v,y;for(o=0;o<2;o++)for(s=o?r:n,c=o?Math.max:Math.min,f=o?1:-1,a=0;a<2;a++){for(l=a?Math.max:Math.min,h=a?1:-1,(d=t[o][a]).sort(s),p=t[1-o][a],m=p.concat(d),v=[],g=0;g<d.length;g++)void 0!==d[g].yLabelMid&&v.push(d[g]);for(y=!1,g=0;o&&g<p.length;g++)if(void 0!==p[g].yLabelMid){y=p[g];break}for(g=0;g<v.length;g++){var b=g&&v[g-1];y&&!g&&(b=y),i(v[g],b)}}}(m,p),f.each(function(t){if(t.labelExtraX||t.labelExtraY){var e=a.select(this),r=e.select("g.slicetext text");r.attr("transform","translate("+t.labelExtraX+","+t.labelExtraY+")"+r.attr("transform"));var n=t.cxFinal+t.pxmid[0],i="M"+n+","+(t.cyFinal+t.pxmid[1]),o=(t.yLabelMax-t.yLabelMin)*(t.pxmid[0]<0?-1:1)/4;if(t.labelExtraX){var l=t.labelExtraX*t.pxmid[1]/t.pxmid[0],c=t.yLabelMid+t.labelExtraY-(t.cyFinal+t.pxmid[1]);Math.abs(l)>Math.abs(c)?i+="l"+c*t.pxmid[0]/t.pxmid[1]+","+c+"H"+(n+t.labelExtraX+o):i+="l"+t.labelExtraX+","+l+"v"+(c-l)+"h"+o}else i+="V"+(t.yLabelMid+t.labelExtraY)+"h"+o;e.append("path").classed("textline",!0).call(s.stroke,p.outsidetextfont.color).attr({"stroke-width":Math.min(2,p.outsidetextfont.size/8),d:i,fill:"none"})}})})}),setTimeout(function(){f.selectAll("tspan").each(function(){var t=a.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":613,"../../components/drawing":638,"../../components/fx":655,"../../lib/svg_text_utils":761,"./event_data":1033,"./helpers":1034,d3:123}],1039:[function(t,e,r){"use strict";var n=t("d3"),i=t("./style_one");e.exports=function(t){t._fullLayout._pielayer.selectAll(".trace").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)})})}},{"./style_one":1040,d3:123}],1040:[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":613,"./helpers":1034}],1041:[function(t,e,r){"use strict";var n=t("../scattergl/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"}}},{"../scattergl/attributes":1102}],1042:[function(t,e,r){"use strict";function n(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=i(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}var i=t("gl-pointcloud2d"),a=t("../../lib/str2rgbarray"),o=t("../scatter/get_trace_color"),s=["xaxis","yaxis"],l=n.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,i,o,s,l=this.xData=this.pickXData=t.x,c=this.yData=this.pickYData=t.y,u=this.pickXYData=t.xy,h=t.xbounds&&t.ybounds,f=t.indices,d=this.bounds;if(u){if(n=u,e=u.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(s=0;s<e;s++)i=n[2*s],o=n[2*s+1],i<d[0]&&(d[0]=i),i>d[2]&&(d[2]=i),o<d[1]&&(d[1]=o),o>d[3]&&(d[3]=o);if(f)r=f;else for(r=new Int32Array(e),s=0;s<e;s++)r[s]=s}else for(e=l.length,n=new Float32Array(2*e),r=new Int32Array(e),s=0;s<e;s++)i=l[s],o=c[s],r[s]=s,n[2*s]=i,n[2*s+1]=o,i<d[0]&&(d[0]=i),i>d[2]&&(d[2]=i),o<d[1]&&(d[1]=o),o>d[3]&&(d[3]=o);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=a(t.marker.color),m=a(t.marker.border.color),g=t.opacity*t.marker.opacity;p[3]*=g,this.pointcloudOptions.color=p;var v=t.marker.blend;if(null===v){v=l.length<100||c.length<100}this.pointcloudOptions.blend=v,m[3]*=g,this.pointcloudOptions.borderColor=m;var y=t.marker.sizemin,b=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=b,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,b/2)},l.expandAxesFast=function(t,e){for(var r,n,i,a=e||.5,o=0;o<2;o++)(n=(r=this.scene[s[o]])._min)||(n=[]),n.push({val:t[o],pad:a}),(i=r._max)||(i=[]),i.push({val:t[o+2],pad:a})},l.dispose=function(){this.pointcloud.dispose()},e.exports=function(t,e){var r=new n(t,e.uid);return r.update(e),r}},{"../../lib/str2rgbarray":760,"../scatter/get_trace_color":1064,"gl-pointcloud2d":231}],1043:[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")}},{"../../lib":738,"./attributes":1041}],1044:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("../scatter3d/calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="pointcloud",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl","gl2d","showLegend"],n.meta={},e.exports=n},{"../../plots/gl2d":823,"../scatter3d/calc":1080,"./attributes":1041,"./convert":1042,"./defaults":1043}],1045:[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("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll;e.exports=l({hoverinfo:s({},i.hoverinfo,{flags:["label","text","value","percent","name"]}),hoverlabel:o.hoverlabel,domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},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({}),node:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},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}},link:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},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:[]}}},"calc","nested")},{"../../components/color/attributes":612,"../../components/fx/attributes":647,"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/attributes":783,"../../plots/font_attributes":810}],1046:[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");r.name="sankey",r.baseLayoutAttrOverrides=n({hoverlabel:o.hoverlabel},"plot","nested"),r.plot=function(t){var e=i(t.calcdata,"sankey");a(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("sankey"),a=e._has&&e._has("sankey");i&&!a&&n._paperdiv.selectAll(".sankey").remove()}},{"../../components/fx/layout_attributes":656,"../../plot_api/edit_types":769,"../../plots/get_data":820,"./plot":1051}],1047:[function(t,e,r){"use strict";var n=t("strongly-connected-components"),i=t("../../lib"),a=t("../../lib/gup").wrap;e.exports=function(t,e){return function(t,e,r){for(var i=t.map(function(){return[]}),a=0;a<Math.min(e.length,r.length);a++){if(e[a]===r[a])return!0;i[e[a]].push(r[a])}return n(i).components.some(function(t){return t.length>1})}(e.node.label,e.link.source,e.link.target)&&(i.error("Circularity is present in the Sankey data. Removing all nodes and links."),e.link.label=[],e.link.source=[],e.link.target=[],e.link.value=[],e.link.color=[],e.node.label=[],e.node.color=[]),a({link:e.link,node:e.node})}},{"../../lib":738,"../../lib/gup":735,"strongly-connected-components":537}],1048:[function(t,e,r){"use strict";e.exports={nodeTextOffsetHorizontal:4,nodeTextOffsetVertical:3,nodePadAcross:10,sankeyIterations:50,forceIterations:5,forceTicksPerFrame:10,duration:500,ease:"cubic-in-out",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"}}},{}],1049:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color/attributes").defaults,o=t("../../components/color"),s=t("tinycolor2");e.exports=function(t,e,r,l){function c(r,a){return n.coerce(t,e,i,r,a)}c("node.label"),c("node.pad"),c("node.thickness"),c("node.line.color"),c("node.line.width");c("node.color",e.node.label.map(function(t,e){return o.addOpacity(function(t){return a[t%a.length]}(e),.8)})),c("link.label"),c("link.source"),c("link.target"),c("link.value"),c("link.line.color"),c("link.line.width"),c("link.color",e.link.value.map(function(){return s(l.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)"})),c("domain.x"),c("domain.y"),c("orientation"),c("valueformat"),c("valuesuffix"),c("arrangement"),n.coerceFont(c,"textfont",n.extendFlat({},l.font));e.node.label.some(function(t,r){return-1===e.link.source.indexOf(r)&&-1===e.link.target.indexOf(r)})&&n.warn("Some of the nodes are neither sources nor targets, they will not be displayed.")}},{"../../components/color":613,"../../components/color/attributes":612,"../../lib":738,"./attributes":1045,tinycolor2:543}],1050:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.moduleType="trace",n.name="sankey",n.basePlotModule=t("./base_plot"),n.categories=["noOpacity"],n.meta={},e.exports=n},{"./attributes":1045,"./base_plot":1046,"./calc":1047,"./defaults":1049,"./plot":1051}],1051:[function(t,e,r){"use strict";function n(t){return""!==t}function i(t,e){return t.filter(function(t){return t.key===e.traceId})}function a(t,e){p.select(t).select("path").style("fill-opacity",e),p.select(t).select("rect").style("fill-opacity",e)}function o(t){p.select(t).select("text.name").style("fill","black")}function s(t){return function(e){return-1!==t.node.sourceLinks.indexOf(e.link)||-1!==t.node.targetLinks.indexOf(e.link)}}function l(t){return function(e){return-1!==e.node.sourceLinks.indexOf(t.link)||-1!==e.node.targetLinks.indexOf(t.link)}}function c(t,e,r){e&&r&&i(r,e).selectAll("."+b.sankeyLink).filter(s(e)).call(h.bind(0,e,r,!1))}function u(t,e,r){e&&r&&i(r,e).selectAll("."+b.sankeyLink).filter(s(e)).call(f.bind(0,e,r,!1))}function h(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",.4),a&&i(e,t).selectAll("."+b.sankeyLink).filter(function(t){return t.link.label===a}).style("fill-opacity",.4),r&&i(e,t).selectAll("."+b.sankeyNode).filter(l(t)).call(c)}function f(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha}),a&&i(e,t).selectAll("."+b.sankeyLink).filter(function(t){return t.link.label===a}).style("fill-opacity",function(t){return t.tinyColorAlpha}),r&&i(e,t).selectAll(b.sankeyNode).filter(l(t)).call(u)}function d(t,e){var r=t.hoverlabel||{},n=y.nestedProperty(r,e).get();return!Array.isArray(n)&&n}var p=t("d3"),m=t("./render"),g=t("../../components/fx"),v=t("../../components/color"),y=t("../../lib"),b=t("./constants").cn,x=y._;e.exports=function(t,e){var r=t._fullLayout,i=r._paper,s=r._size,l=x(t,"source:")+" ",y=x(t,"target:")+" ",_=x(t,"incoming flow count:")+" ",w=x(t,"outgoing flow count:")+" ";m(i,e,{width:s.w,height:s.h,margin:{t:s.t,r:s.r,b:s.b,l:s.l}},{linkEvents:{hover:function(e,r,n){p.select(e).call(h.bind(0,r,n,!0)),t.emit("plotly_hover",{event:p.event,points:[r.link]})},follow:function(e,i){var s=i.link.trace,c=t._fullLayout._paperdiv.node().getBoundingClientRect(),u=e.getBoundingClientRect(),h=u.left+u.width/2,f=u.top+u.height/2,m=g.loneHover({x:h-c.left,y:f-c.top,name:p.format(i.valueFormat)(i.link.value)+i.valueSuffix,text:[i.link.label||"",l+i.link.source.label,y+i.link.target.label].filter(n).join("<br>"),color:d(s,"bgcolor")||v.addOpacity(i.tinyColorHue,1),borderColor:d(s,"bordercolor"),fontFamily:d(s,"font.family"),fontSize:d(s,"font.size"),fontColor:d(s,"font.color"),idealAlign:p.event.x<h?"right":"left"},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t});a(m,.65),o(m)},unhover:function(e,n,i){p.select(e).call(f.bind(0,n,i,!0)),t.emit("plotly_unhover",{event:p.event,points:[n.link]}),g.loneUnhover(r._hoverlayer.node())},select:function(e,r){var n=r.link;n.originalEvent=p.event,t._hoverdata=[n],g.click(t,{target:!0})}},nodeEvents:{hover:function(e,r,n){p.select(e).call(c,r,n),t.emit("plotly_hover",{event:p.event,points:[r.node]})},follow:function(e,i){var s=i.node.trace,l=p.select(e).select("."+b.nodeRect),c=t._fullLayout._paperdiv.node().getBoundingClientRect(),u=l.node().getBoundingClientRect(),h=u.left-2-c.left,f=u.right+2-c.left,m=u.top+u.height/4-c.top,v=g.loneHover({x0:h,x1:f,y:m,name:p.format(i.valueFormat)(i.node.value)+i.valueSuffix,text:[i.node.label,_+i.node.targetLinks.length,w+i.node.sourceLinks.length].filter(n).join("<br>"),color:d(s,"bgcolor")||i.tinyColorHue,borderColor:d(s,"bordercolor"),fontFamily:d(s,"font.family"),fontSize:d(s,"font.size"),fontColor:d(s,"font.color"),idealAlign:"left"},{container:r._hoverlayer.node(),outerContainer:r._paper.node(),gd:t});a(v,.85),o(v)},unhover:function(e,n,i){p.select(e).call(u,n,i),t.emit("plotly_unhover",{event:p.event,points:[n.node]}),g.loneUnhover(r._hoverlayer.node())},select:function(e,r,n){var i=r.node;i.originalEvent=p.event,t._hoverdata=[i],p.select(e).call(u,r,n),g.click(t,{target:!0})}}})}},{"../../components/color":613,"../../components/fx":655,"../../lib":738,"./constants":1048,"./render":1052,d3:123}],1052:[function(t,e,r){"use strict";function n(t){t.lastDraggedX=t.x,t.lastDraggedY=t.y}function i(t){return function(e){return e.node.originalX===t.node.originalX}}function a(t){for(var e=0;e<t.length;e++)t[e].y=t[e].y+t[e].dy/2}function o(t){t.attr("transform",function(t){return"translate("+t.node.x.toFixed(3)+", "+(t.node.y-t.node.dy/2).toFixed(3)+")"})}function s(t){var e=t.sankey.nodes();!function(t){for(var e=0;e<t.length;e++)t[e].y=t[e].y-t[e].dy/2}(e);var r=t.sankey.link()(t.link);return a(e),r}function l(t){t.call(o)}function c(t,e){t.call(l),e.attr("d",s)}function u(t){t.attr("width",function(t){return t.visibleWidth}).attr("height",function(t){return t.visibleHeight})}function h(t){return t.link.dy>1||t.linkLineWidth>0}function f(t){return"translate("+t.translateX+","+t.translateY+")"+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function d(t){return"translate("+(t.horizontal?0:t.labelY)+" "+(t.horizontal?t.labelY:0)+")"}function p(t){return w.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+_.nodeTextOffsetHorizontal:_.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-_.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-_.nodeTextOffsetHorizontal,0]])}function m(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function g(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function v(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function y(t){return t.horizontal&&t.left?"100%":"0%"}function b(t,e,r){t.on(".basic",null).on("mouseover.basic",function(t){t.interactionState.dragInProgress||(r.hover(this,t,e),t.interactionState.hovered=[this,t])}).on("mousemove.basic",function(t){t.interactionState.dragInProgress||(r.follow(this,t),t.interactionState.hovered=[this,t])}).on("mouseout.basic",function(t){t.interactionState.dragInProgress||(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||r.select(this,t,e)})}function x(t,e,r){var a=w.behavior.drag().origin(function(t){return t.node}).on("dragstart",function(a){if("fixed"!==a.arrangement&&(E.raiseToTop(this),a.interactionState.dragInProgress=a.node,n(a.node),a.interactionState.hovered&&(r.nodeEvents.unhover.apply(0,a.interactionState.hovered),a.interactionState.hovered=!1),"snap"===a.arrangement)){var o=a.traceId+"|"+Math.floor(a.node.originalX);a.forceLayouts[o]?a.forceLayouts[o].alpha(1):function(t,e,r){var n=r.sankey.nodes().filter(function(t){return t.originalX===r.node.originalX});r.forceLayouts[e]=S.forceSimulation(n).alphaDecay(0).force("collide",S.forceCollide().radius(function(t){return t.dy/2+r.nodePad/2}).strength(1).iterations(_.forceIterations)).force("constrain",function(t,e,r,n){return function(){for(var t=0,i=0;i<r.length;i++){var a=r[i];a===n.interactionState.dragInProgress?(a.x=a.lastDraggedX,a.y=a.lastDraggedY):(a.vx=(a.originalX-a.x)/_.forceTicksPerFrame,a.y=Math.min(n.size-a.dy/2,Math.max(a.dy/2,a.y))),t=Math.max(t,Math.abs(a.vx),Math.abs(a.vy))}!n.interactionState.dragInProgress&&t<.1&&n.forceLayouts[e].alpha()>0&&n.forceLayouts[e].alpha(0)}}(0,e,n,r)).stop()}(0,o,a),function(t,e,r,n){window.requestAnimationFrame(function a(){for(var o=0;o<_.forceTicksPerFrame;o++)r.forceLayouts[n].tick();r.sankey.relayout(),c(t.filter(i(r)),e),r.forceLayouts[n].alpha()>0&&window.requestAnimationFrame(a)})}(t,e,a,o)}}).on("drag",function(r){if("fixed"!==r.arrangement){var a=w.event.x,o=w.event.y;"snap"===r.arrangement?(r.node.x=a,r.node.y=o):("freeform"===r.arrangement&&(r.node.x=a),r.node.y=Math.max(r.node.dy/2,Math.min(r.size-r.node.dy/2,o))),n(r.node),"snap"!==r.arrangement&&(r.sankey.relayout(),c(t.filter(i(r)),e))}}).on("dragend",function(t){t.interactionState.dragInProgress=!1});t.on(".drag",null).call(a)}var _=t("./constants"),w=t("d3"),M=t("tinycolor2"),k=t("../../components/color"),T=t("../../components/drawing"),A=t("@plotly/d3-sankey").sankey,S=t("d3-force"),E=t("../../lib"),L=t("../../lib/gup").keyFun,C=t("../../lib/gup").repeat,I=t("../../lib/gup").unwrap;e.exports=function(t,e,r,n){var i=t.selectAll("."+_.cn.sankey).data(e.filter(function(t){return I(t).trace.visible}).map(function(t,e,r){for(var n,i=I(e).trace,o=i.domain,s=i.node,l=i.link,c=i.arrangement,u="h"===i.orientation,h=i.node.pad,f=i.node.thickness,d=i.node.line.color,p=i.node.line.width,m=i.link.line.color,g=i.link.line.width,v=i.valueformat,y=i.valuesuffix,b=i.textfont,x=t.width*(o.x[1]-o.x[0]),w=t.height*(o.y[1]-o.y[0]),M=s.label.map(function(t,e){return{pointNumber:e,label:t,color:E.isArray(s.color)?s.color[e]:s.color}}),k=l.value.map(function(t,e){return{pointNumber:e,label:l.label[e],color:E.isArray(l.color)?l.color[e]:l.color,source:l.source[e],target:l.target[e],value:t}}),T=A().size(u?[x,w]:[w,x]).nodeWidth(f).nodePadding(h).nodes(M).links(k).layout(_.sankeyIterations),S=T.nodes(),L=0;L<S.length;L++)(n=S[L]).width=x,n.height=w;return a(M),{key:r,trace:i,guid:Math.floor(1e12*(1+Math.random())),horizontal:u,width:x,height:w,nodePad:h,nodeLineColor:d,nodeLineWidth:p,linkLineColor:m,linkLineWidth:g,valueFormat:v,valueSuffix:y,textFont:b,translateX:o.x[0]*x+t.margin.l,translateY:t.height-o.y[1]*t.height+t.margin.t,dragParallel:u?w:x,dragPerpendicular:u?x:w,nodes:M,links:k,arrangement:c,sankey:T,forceLayouts:{},interactionState:{dragInProgress:!1,hovered:!1}}}.bind(null,r)),L);i.exit().remove(),i.enter().append("g").classed(_.cn.sankey,!0).style("box-sizing","content-box").style("position","absolute").style("left",0).style("shape-rendering","geometricPrecision").style("pointer-events","auto").style("box-sizing","content-box").attr("transform",f),i.transition().ease(_.ease).duration(_.duration).attr("transform",f);var l=i.selectAll("."+_.cn.sankeyLinks).data(C,L);l.enter().append("g").classed(_.cn.sankeyLinks,!0).style("fill","none");var c=l.selectAll("."+_.cn.sankeyLink).data(function(t){return t.sankey.links().filter(function(t){return t.value}).map(function(t,e,r){var n=M(r.color),i=r.source.label+"|"+r.target.label,a=t[i];t[i]=(a||0)+1;var o=i+"__"+t[i];return r.trace=e.trace,r.curveNumber=e.trace.index,{key:o,traceId:e.key,link:r,tinyColorHue:k.tinyRGB(n),tinyColorAlpha:n.getAlpha(),linkLineColor:e.linkLineColor,linkLineWidth:e.linkLineWidth,valueFormat:e.valueFormat,valueSuffix:e.valueSuffix,sankey:e.sankey,interactionState:e.interactionState}}.bind(null,{},t))},L);c.enter().append("path").classed(_.cn.sankeyLink,!0).attr("d",s).call(b,i,n.linkEvents),c.style("stroke",function(t){return h(t)?k.tinyRGB(M(t.linkLineColor)):t.tinyColorHue}).style("stroke-opacity",function(t){return h(t)?k.opacity(t.linkLineColor):t.tinyColorAlpha}).style("stroke-width",function(t){return h(t)?t.linkLineWidth:1}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha}),c.transition().ease(_.ease).duration(_.duration).attr("d",s),c.exit().transition().ease(_.ease).duration(_.duration).style("opacity",0).remove();var w=i.selectAll("."+_.cn.sankeyNodeSet).data(C,L);w.enter().append("g").classed(_.cn.sankeyNodeSet,!0),w.style("cursor",function(t){switch(t.arrangement){case"fixed":return"default";case"perpendicular":return"ns-resize";default:return"move"}});var S=w.selectAll("."+_.cn.sankeyNode).data(function(t){var e=t.sankey.nodes();return function(t){var e,r=[];for(e=0;e<t.length;e++)t[e].originalX=t[e].x,t[e].originalY=t[e].y,-1===r.indexOf(t[e].x)&&r.push(t[e].x);for(r.sort(function(t,e){return t-e}),e=0;e<t.length;e++)t[e].originalLayerIndex=r.indexOf(t[e].originalX),t[e].originalLayer=t[e].originalLayerIndex/(r.length-1)}(e),e.filter(function(t){return t.value}).map(function(t,e,r){var n=M(r.color),i=_.nodePadAcross,a=e.nodePad/2,o=r.dx,s=Math.max(.5,r.dy),l=r.label,c=t[l];t[l]=(c||0)+1;var u=l+"__"+t[l];return r.trace=e.trace,r.curveNumber=e.trace.index,{key:u,traceId:e.key,node:r,nodePad:e.nodePad,nodeLineColor:e.nodeLineColor,nodeLineWidth:e.nodeLineWidth,textFont:e.textFont,size:e.horizontal?e.height:e.width,visibleWidth:Math.ceil(o),visibleHeight:s,zoneX:-i,zoneY:-a,zoneWidth:o+2*i,zoneHeight:s+2*a,labelY:e.horizontal?r.dy/2+1:r.dx/2+1,left:1===r.originalLayer,sizeAcross:e.width,forceLayouts:e.forceLayouts,horizontal:e.horizontal,darkBackground:n.getBrightness()<=128,tinyColorHue:k.tinyRGB(n),tinyColorAlpha:n.getAlpha(),valueFormat:e.valueFormat,valueSuffix:e.valueSuffix,sankey:e.sankey,arrangement:e.arrangement,uniqueNodeLabelPathId:[e.guid,e.key,u].join(" "),interactionState:e.interactionState}}.bind(null,{},t))},L);S.enter().append("g").classed(_.cn.sankeyNode,!0).call(o).call(b,i,n.nodeEvents),S.call(x,c,n),S.transition().ease(_.ease).duration(_.duration).call(o),S.exit().transition().ease(_.ease).duration(_.duration).style("opacity",0).remove();var P=S.selectAll("."+_.cn.nodeRect).data(C);P.enter().append("rect").classed(_.cn.nodeRect,!0).call(u),P.style("stroke-width",function(t){return t.nodeLineWidth}).style("stroke",function(t){return k.tinyRGB(M(t.nodeLineColor))}).style("stroke-opacity",function(t){return k.opacity(t.nodeLineColor)}).style("fill",function(t){return t.tinyColorHue}).style("fill-opacity",function(t){return t.tinyColorAlpha}),P.transition().ease(_.ease).duration(_.duration).call(u);var D=S.selectAll("."+_.cn.nodeCapture).data(C);D.enter().append("rect").classed(_.cn.nodeCapture,!0).style("fill-opacity",0),D.attr("x",function(t){return t.zoneX}).attr("y",function(t){return t.zoneY}).attr("width",function(t){return t.zoneWidth}).attr("height",function(t){return t.zoneHeight});var z=S.selectAll("."+_.cn.nodeCentered).data(C);z.enter().append("g").classed(_.cn.nodeCentered,!0).attr("transform",d),z.transition().ease(_.ease).duration(_.duration).attr("transform",d);var O=z.selectAll("."+_.cn.nodeLabelGuide).data(C);O.enter().append("path").classed(_.cn.nodeLabelGuide,!0).attr("id",function(t){return t.uniqueNodeLabelPathId}).attr("d",p).attr("transform",m),O.transition().ease(_.ease).duration(_.duration).attr("d",p).attr("transform",m);var F=z.selectAll("."+_.cn.nodeLabel).data(C);F.enter().append("text").classed(_.cn.nodeLabel,!0).attr("transform",g).style("user-select","none").style("cursor","default").style("fill","black"),F.style("text-shadow",function(t){return t.horizontal?"-1px 1px 1px #fff, 1px 1px 1px #fff, 1px -1px 1px #fff, -1px -1px 1px #fff":"none"}).each(function(t){T.font(F,t.textFont)}),F.transition().ease(_.ease).duration(_.duration).attr("transform",g);var R=F.selectAll("."+_.cn.nodeLabelTextPath).data(C);R.enter().append("textPath").classed(_.cn.nodeLabelTextPath,!0).attr("alignment-baseline","middle").attr("xlink:href",function(t){return"#"+t.uniqueNodeLabelPathId}).attr("startOffset",y).style("fill",v),R.text(function(t){return t.horizontal||t.node.dy>5?t.node.label:""}).attr("text-anchor",function(t){return t.horizontal&&t.left?"end":"start"}),R.transition().ease(_.ease).duration(_.duration).attr("startOffset",y).style("fill",v)}},{"../../components/color":613,"../../components/drawing":638,"../../lib":738,"../../lib/gup":735,"./constants":1048,"@plotly/d3-sankey":39,d3:123,"d3-force":119,tinycolor2:543}],1053:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;r<t.length;r++)t[r].i=r;n.mergeArray(e.text,t,"tx"),n.mergeArray(e.hovertext,t,"htx"),n.mergeArray(e.customdata,t,"data"),n.mergeArray(e.textposition,t,"tp"),e.textfont&&(n.mergeArray(e.textfont.size,t,"ts"),n.mergeArray(e.textfont.color,t,"tc"),n.mergeArray(e.textfont.family,t,"tf"));var i=e.marker;if(i){n.mergeArray(i.size,t,"ms"),n.mergeArray(i.opacity,t,"mo"),n.mergeArray(i.symbol,t,"mx"),n.mergeArray(i.color,t,"mc");var a=i.line;i.line&&(n.mergeArray(a.color,t,"mlc"),n.mergeArray(a.width,t,"mlw"));var o=i.gradient;o&&"none"!==o.type&&(n.mergeArray(o.type,t,"mgt"),n.mergeArray(o.color,t,"mgc"))}}},{"../../lib":738}],1054:[function(t,e,r){"use strict";var n=t("../../components/colorscale/color_attributes"),i=t("../../components/errorbars/attributes"),a=t("../../components/colorbar/attributes"),o=t("../../plots/font_attributes"),s=t("../../components/drawing/attributes").dash,l=t("../../components/drawing"),c=(t("./constants"),t("../../lib/extend").extendFlat);e.exports={x:{valType:"data_array",editType:"calc+clearAxisTypes"},x0:{valType:"any",dflt:0,editType:"calc+clearAxisTypes"},dx:{valType:"number",dflt:1,editType:"calc"},y:{valType:"data_array",editType:"calc+clearAxisTypes"},y0:{valType:"any",dflt:0,editType:"calc+clearAxisTypes"},dy:{valType:"number",dflt:1,editType:"calc"},text:{valType:"string",dflt:"",arrayOk:!0,editType:"calc"},hovertext:{valType:"string",dflt:"",arrayOk:!0,editType:"style"},mode:{valType:"flaglist",flags:["lines","markers","text"],extras:["none"],editType:"calc"},hoveron:{valType:"flaglist",flags:["points","fills"],editType:"style"},line:{color:{valType:"color",editType:"style"},width:{valType:"number",min:0,dflt:2,editType:"style"},shape:{valType:"enumerated",values:["linear","spline","hv","vh","hvh","vhv"],dflt:"linear",editType:"plot"},smoothing:{valType:"number",min:0,max:1.3,dflt:1,editType:"plot"},dash:c({},s,{editType:"style"}),simplify:{valType:"boolean",dflt:!0,editType:"plot"},editType:"plot"},connectgaps:{valType:"boolean",dflt:!1,editType:"calc"},cliponaxis:{valType:"boolean",dflt:!0,editType:"plot"},fill:{valType:"enumerated",values:["none","tozeroy","tozerox","tonexty","tonextx","toself","tonext"],dflt:"none",editType:"calc"},fillcolor:{valType:"color",editType:"style"},marker:c({symbol:{valType:"enumerated",values:l.symbolList,dflt:"circle",arrayOk:!0,editType:"style"},opacity:{valType:"number",min:0,max:1,arrayOk:!0,editType:"style"},size:{valType:"number",min:0,dflt:6,arrayOk:!0,editType:"calcIfAutorange"},maxdisplayed:{valType:"number",min:0,dflt:0,editType:"plot"},sizeref:{valType:"number",dflt:1,editType:"calc"},sizemin:{valType:"number",min:0,dflt:0,editType:"calc"},sizemode:{valType:"enumerated",values:["diameter","area"],dflt:"diameter",editType:"calc"},showscale:{valType:"boolean",dflt:!1,editType:"calc"},colorbar:a,line:c({width:{valType:"number",min:0,arrayOk:!0,editType:"style"},editType:"calc"},n("marker.line")),gradient:{type:{valType:"enumerated",values:["radial","horizontal","vertical","none"],arrayOk:!0,dflt:"none",editType:"calc"},color:{valType:"color",arrayOk:!0,editType:"calc"},editType:"calc"},editType:"calc"},n("marker")),selected:{marker:{opacity:{valType:"number",min:0,max:1,editType:"style"},color:{valType:"color",editType:"style"},size:{valType:"number",min:0,editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},unselected:{marker:{opacity:{valType:"number",min:0,max:1,editType:"style"},color:{valType:"color",editType:"style"},size:{valType:"number",min:0,editType:"style"},editType:"style"},textfont:{color:{valType:"color",editType:"style"},editType:"style"},editType:"style"},textposition:{valType:"enumerated",values:["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],dflt:"middle center",arrayOk:!0,editType:"calc"},textfont:o({editType:"calc",colorEditType:"style",arrayOk:!0}),r:{valType:"data_array",editType:"calc"},t:{valType:"data_array",editType:"calc"},error_y:i,error_x:i}},{"../../components/colorbar/attributes":614,"../../components/colorscale/color_attributes":621,"../../components/drawing":638,"../../components/drawing/attributes":637,"../../components/errorbars/attributes":640,"../../lib/extend":727,"../../plots/font_attributes":810,"./constants":1060}],1055:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../../constants/numerical").BADNUM,o=t("./subtypes"),s=t("./colorscale_calc"),l=t("./arrays_to_calcdata"),c=t("./calc_selection");e.exports=function(t,e){var r,u,h,f=i.getFromId(t,e.xaxis||"x"),d=i.getFromId(t,e.yaxis||"y"),p=f.makeCalcdata(e,"x"),m=d.makeCalcdata(e,"y"),g=Math.min(p.length,m.length);f._minDtick=0,d._minDtick=0,p.length>g&&p.splice(g,p.length-g),m.length>g&&m.splice(g,m.length-g);var v={padded:!0},y={padded:!0};if(o.hasMarkers(e)){if(r=e.marker,u=r.size,Array.isArray(u)){var b={type:"linear"};i.setConvert(b),(u=b.makeCalcdata(e.marker,"size")).length>g&&u.splice(g,u.length-g)}var x,_=1.6*(e.marker.sizeref||1);x="area"===e.marker.sizemode?function(t){return Math.max(Math.sqrt((t||0)/_),3)}:function(t){return Math.max((t||0)/_,3)},v.ppad=y.ppad=Array.isArray(u)?u.map(x):x(u)}s(e),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||p[0]===p[g-1]&&m[0]===m[g-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(o.hasMarkers(e)||o.hasText(e))||(v.padded=!1,v.ppad=0):v.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||p[0]===p[g-1]&&m[0]===m[g-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(y.padded=!1):y.tozero=!0,i.expand(f,p,v),i.expand(d,m,y);var w=new Array(g);for(h=0;h<g;h++)w[h]=n(p[h])&&n(m[h])?{x:p[h],y:m[h]}:{x:a,y:a},e.ids&&(w[h].id=String(e.ids[h]));return l(w,e),c(w,e),t.firstscatter=!1,w}},{"../../constants/numerical":717,"../../plots/cartesian/axes":785,"./arrays_to_calcdata":1053,"./calc_selection":1056,"./colorscale_calc":1059,"./subtypes":1076,"fast-isnumeric":132}],1056:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){Array.isArray(e.selectedpoints)&&n.tagSelected(t,e)}},{"../../lib":738}],1057:[function(t,e,r){"use strict";e.exports=function(t){for(var e=0;e<t.length;e++){var r=t[e];if("scatter"===r.type){var n=r.fill;if("none"!==n&&"toself"!==n&&(r.opacity=void 0,"tonexty"===n||"tonextx"===n))for(var i=e-1;i>=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],1058:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l=r.marker,c="cb"+r.uid;if(t._fullLayout._infolayer.selectAll("."+c).remove(),void 0!==l&&l.showscale){var u=l.color,h=l.cmin,f=l.cmax;n(h)||(h=i.aggNums(Math.min,null,u)),n(f)||(f=i.aggNums(Math.max,null,u));var d=e[0].t.cb=s(t,c),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,h,f),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:h,end:f,size:(f-h)/254}).options(l.colorbar)()}else a.autoMargin(t,c)}},{"../../components/colorbar/draw":617,"../../components/colorscale":628,"../../lib":738,"../../plots/plots":846,"fast-isnumeric":132}],1059:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/calc"),a=t("./subtypes");e.exports=function(t){a.hasLines(t)&&n(t,"line")&&i(t,t.line.color,"line","c"),a.hasMarkers(t)&&(n(t,"marker")&&i(t,t.marker.color,"marker","c"),n(t,"marker.line")&&i(t,t.marker.line.color,"marker.line","c"))}},{"../../components/colorscale/calc":620,"../../components/colorscale/has_colorscale":627,"./subtypes":1076}],1060:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20}},{}],1061:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("./constants"),o=t("./subtypes"),s=t("./xy_defaults"),l=t("./marker_defaults"),c=t("./line_defaults"),u=t("./line_shape_defaults"),h=t("./text_defaults"),f=t("./fillcolor_defaults"),d=t("../../components/errorbars/defaults");e.exports=function(t,e,r,p){function m(r,a){return n.coerce(t,e,i,r,a)}var g=s(t,e,p,m),v=g<a.PTS_LINESONLY?"lines+markers":"lines";if(g){m("text"),m("hovertext"),m("mode",v),o.hasLines(e)&&(c(t,e,r,p,m),u(t,e,m),m("connectgaps"),m("line.simplify")),o.hasMarkers(e)&&l(t,e,r,p,m,{gradient:!0}),o.hasText(e)&&h(t,e,p,m);var y=[];(o.hasMarkers(e)||o.hasText(e))&&(m("marker.maxdisplayed"),y.push("points")),m("fill"),"none"!==e.fill&&(f(t,e,r,m),o.hasLines(e)||u(t,e,m)),"tonext"!==e.fill&&"toself"!==e.fill||y.push("fills"),m("hoveron",y.join("+")||"points"),d(t,e,r,{axis:"y"}),d(t,e,r,{axis:"x",inherit:"y"}),m("cliponaxis"),n.coerceSelectionMarkerOpacity(e,m)}else e.visible=!1}},{"../../components/errorbars/defaults":643,"../../lib":738,"./attributes":1054,"./constants":1060,"./fillcolor_defaults":1063,"./line_defaults":1067,"./line_shape_defaults":1069,"./marker_defaults":1072,"./subtypes":1076,"./text_defaults":1077,"./xy_defaults":1078}],1062:[function(t,e,r){"use strict";function n(t){return t||0===t}var i=t("../../lib");e.exports=function(t,e,r){var a=Array.isArray(r)?function(t){r.push(t)}:function(t){r.text=t},o=i.extractOption(t,e,"htx","hovertext");if(n(o))return a(o);var s=i.extractOption(t,e,"tx","text");return n(s)?a(s):void 0}},{"../../lib":738}],1063:[function(t,e,r){"use strict";var n=t("../../components/color");e.exports=function(t,e,r,i){var a=!1;if(e.marker){var o=e.marker.color,s=(e.marker.line||{}).color;o&&!Array.isArray(o)?a=o:s&&!Array.isArray(s)&&(a=s)}i("fillcolor",n.addOpacity((e.line||{}).color||a||r,.5))}},{"../../components/color":613}],1064:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("./subtypes");e.exports=function(t,e){var r,a;if("lines"===t.mode)return(r=t.line.color)&&n.opacity(r)?r:t.fillcolor;if("none"===t.mode)return t.fill?t.fillcolor:"";var o=e.mcc||(t.marker||{}).color,s=e.mlcc||((t.marker||{}).line||{}).color;return(a=o&&n.opacity(o)?o:s&&n.opacity(s)&&(e.mlw||((t.marker||{}).line||{}).width)?s:"")?n.opacity(a)<.3?n.addOpacity(a,.3):a:(r=(t.line||{}).color)&&n.opacity(r)&&i.hasLines(t)&&t.line.width?r:t.fillcolor}},{"../../components/color":613,"./subtypes":1076}],1065:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/fx"),a=t("../../components/errorbars"),o=t("./get_trace_color"),s=t("../../components/color"),l=t("./fill_hover_text"),c=i.constants.MAXDIST;e.exports=function(t,e,r,u){var h=t.cd,f=h[0].trace,d=t.xa,p=t.ya,m=d.c2p(e),g=p.c2p(r),v=[m,g],y=f.hoveron||"",b=-1!==f.mode.indexOf("markers")?3:.5;if(-1!==y.indexOf("points")){var x=function(t){var e=Math.max(3,t.mrc||0),r=1-1/e,n=Math.abs(d.c2p(t.x)-m);return n<e?r*n/e:n-e+r},_=function(t){var e=Math.max(3,t.mrc||0),r=1-1/e,n=Math.abs(p.c2p(t.y)-g);return n<e?r*n/e:n-e+r},w=function(t){var e=Math.max(b,t.mrc||0),r=d.c2p(t.x)-m,n=p.c2p(t.y)-g;return Math.max(Math.sqrt(r*r+n*n)-e,1-b/e)},M=i.getDistanceFunction(u,x,_,w);if(i.getClosest(h,M,t),!1!==t.index){var k=h[t.index],T=d.c2p(k.x,!0),A=p.c2p(k.y,!0),S=k.mrc||1;return n.extendFlat(t,{color:o(f,k),x0:T-S,x1:T+S,xLabelVal:k.x,y0:A-S,y1:A+S,yLabelVal:k.y}),l(k,f,t),a.hoverInfo(k,f,t),[t]}}if(-1!==y.indexOf("fills")&&f._polygons){var E,L,C,I,P,D,z,O,F=f._polygons,R=[],j=!1,N=1/0,B=-1/0,U=1/0,V=-1/0;for(E=0;E<F.length;E++)(C=F[E]).contains(v)&&(j=!j,R.push(C),U=Math.min(U,C.ymin),V=Math.max(V,C.ymax));if(j){var H=((U=Math.max(U,0))+(V=Math.min(V,p._length)))/2;for(E=0;E<R.length;E++)for(I=R[E].pts,L=1;L<I.length;L++)(z=I[L-1][1])>H!=(O=I[L][1])>=H&&(P=(D=I[L-1][0])+(I[L][0]-D)*(H-z)/(O-z),N=Math.min(N,P),B=Math.max(B,P));N=Math.max(N,0),B=Math.min(B,d._length);var q=s.defaultLine;return s.opacity(f.fillcolor)?q=f.fillcolor:s.opacity((f.line||{}).color)&&(q=f.line.color),n.extendFlat(t,{distance:c+10,x0:N,x1:B,y0:H,y1:H,color:q}),delete t.index,f.text&&!Array.isArray(f.text)?t.text=String(f.text):t.text=f.name,[t]}}}},{"../../components/color":613,"../../components/errorbars":644,"../../components/fx":655,"../../lib":738,"./fill_hover_text":1062,"./get_trace_color":1064}],1066:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc"),n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style").style,n.hoverPoints=t("./hover"),n.selectPoints=t("./select"),n.animatable=!0,n.moduleType="trace",n.name="scatter",n.basePlotModule=t("../../plots/cartesian"),n.categories=["cartesian","symbols","markerColorscale","errorBarsOK","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"./arrays_to_calcdata":1053,"./attributes":1054,"./calc":1055,"./clean_data":1057,"./colorbar":1058,"./defaults":1061,"./hover":1065,"./plot":1073,"./select":1074,"./style":1075,"./subtypes":1076}],1067:[function(t,e,r){"use strict";var n=t("../../components/colorscale/has_colorscale"),i=t("../../components/colorscale/defaults");e.exports=function(t,e,r,a,o,s){var l=(t.marker||{}).color;if(o("line.color",r),n(t,"line"))i(t,e,a,o,{prefix:"line.",cLetter:"c"});else{o("line.color",!Array.isArray(l)&&l||r)}o("line.width"),(s||{}).noDash||o("line.dash")}},{"../../components/colorscale/defaults":623,"../../components/colorscale/has_colorscale":627}],1068:[function(t,e,r){"use strict";var n=t("../../constants/numerical").BADNUM,i=t("../../lib"),a=i.segmentsIntersect,o=i.constrain,s=t("./constants");e.exports=function(t,e){function r(e){var r=z.c2p(t[e].x),i=O.c2p(t[e].y);return r!==n&&i!==n&&[r,i]}function l(t){var e=t[0]/z._length,r=t[1]/O._length;return(1+s.toleranceGrowth*Math.max(0,-e,e-1,-r,r-1))*j}function c(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}function u(t,e){for(var r=[],n=0,i=0;i<4;i++){var o=nt[i],s=a(t[0],t[1],e[0],e[1],o[0],o[1],o[2],o[3]);s&&(!n||Math.abs(s.x-r[0][0])>1||Math.abs(s.y-r[0][1])>1)&&(s=[s.x,s.y],n&&c(s,t)<c(r[0],t)?r.unshift(s):r.push(s),n++)}return r}function h(t){if(t[0]<$||t[0]>tt||t[1]<et||t[1]>rt)return[o(t[0],$,tt),o(t[1],et,rt)]}function f(t,e){return t[0]===e[0]&&(t[0]===$||t[0]===tt)||(t[1]===e[1]&&(t[1]===et||t[1]===rt)||void 0)}function d(t,e){var r=[],n=h(t),i=h(e);return n&&i&&f(n,i)?r:(n&&r.push(n),i&&r.push(i),r)}function p(t,e,r){return function(n,a){var o=h(n),s=h(a),l=[];if(o&&s&&f(o,s))return l;o&&l.push(o),s&&l.push(s);var c=2*i.constrain((n[t]+a[t])/2,e,r)-((o||n)[t]+(s||a)[t]);if(c){(o&&s?c>0==o[t]>s[t]?o:s:o||s)[t]+=c}return l}}function m(t){var e=t[0],r=t[1],n=e===H[q-1][0],i=r===H[q-1][1];if(!n||!i)if(q>1){var a=e===H[q-2][0],o=r===H[q-2][1];n&&(e===$||e===tt)&&a?o?q--:H[q-1]=t:i&&(r===et||r===rt)&&o?a?q--:H[q-1]=t:H[q++]=t}else H[q++]=t}function g(t){H[q-1][0]!==t[0]&&H[q-1][1]!==t[1]&&m([W,X]),m(t),Z=null,W=X=0}function v(t){if(G=t[0]<$?$:t[0]>tt?tt:0,Y=t[1]<et?et:t[1]>rt?rt:0,G||Y){if(q)if(Z){var e=K(Z,t);e.length>1&&(g(e[0]),H[q++]=e[1])}else J=K(H[q-1],t)[0],H[q++]=J;else H[q++]=[G||t[0],Y||t[1]];var r=H[q-1];G&&Y&&(r[0]!==G||r[1]!==Y)?(Z&&(W!==G&&X!==Y?m(W&&X?function(t,e){var r=e[0]-t[0],n=(e[1]-t[1])/r;return(t[1]*e[0]-e[1]*t[0])/r>0?[n>0?$:tt,rt]:[n>0?tt:$,et]}(Z,t):[W||G,X||Y]):W&&X&&m([W,X])),m([G,Y])):W-G&&X-Y&&m([G||W,Y||X]),Z=t,W=G,X=Y}else Z&&g(K(Z,t)[0]),H[q++]=t}var y,b,x,_,w,M,k,T,A,S,E,L,C,I,P,D,z=e.xaxis,O=e.yaxis,F=e.simplify,R=e.connectGaps,j=e.baseTolerance,N=e.shape,B="linear"===N,U=[],V=s.minTolerance,H=new Array(t.length),q=0;F||(j=V=-1);var G,Y,W,X,Z,J,K,Q=s.maxScreensAway,$=-z._length*Q,tt=z._length*(1+Q),et=-O._length*Q,rt=O._length*(1+Q),nt=[[$,et,tt,et],[tt,et,tt,rt],[tt,rt,$,rt],[$,rt,$,et]];for("linear"===N||"spline"===N?K=u:"hv"===N||"vh"===N?K=d:"hvh"===N?K=p(0,$,tt):"vhv"===N&&(K=p(1,et,rt)),y=0;y<t.length;y++)if(b=r(y)){for(q=0,Z=null,v(b),y++;y<t.length;y++){if(!(_=r(y))){if(R)continue;break}if(B){if(!((S=c(_,b))<l(_)*V)){for(T=[(_[0]-b[0])/S,(_[1]-b[1])/S],w=b,E=S,L=I=P=0,k=!1,x=_,y++;y<t.length;y++){if(!(M=r(y))){if(R)continue;break}if(A=[M[0]-b[0],M[1]-b[1]],D=A[0]*T[1]-A[1]*T[0],I=Math.min(I,D),(P=Math.max(P,D))-I>l(M))break;x=M,(C=A[0]*T[0]+A[1]*T[1])>E?(E=C,_=M,k=!1):C<L&&(L=C,w=M,k=!0)}if(k?(v(_),x!==w&&v(w)):(w!==b&&v(w),x!==_&&v(_)),v(x),y>=t.length||!M)break;v(M),b=M}}else v(_)}Z&&m([W||Z[0],X||Z[1]]),U.push(H.slice(0,q))}return U}},{"../../constants/numerical":717,"../../lib":738,"./constants":1060}],1069:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1070:[function(t,e,r){"use strict";e.exports=function(t,e,r){for(var n,i=null,a=0;a<r.length;++a)!0===(n=r[a][0].trace).visible?(n._nexttrace=null,-1!==["tonextx","tonexty","tonext"].indexOf(n.fill)&&(n._prevtrace=i,i&&(i._nexttrace=n)),i=n):n._prevtrace=n._nexttrace=null}},{}],1071:[function(t,e,r){"use strict";var n=t("fast-isnumeric");e.exports=function(t){var e=t.marker,r=e.sizeref||1,i=e.sizemin||0,a="area"===e.sizemode?function(t){return Math.sqrt(t/r)}:function(t){return t/r};return function(t){var e=a(t/2);return n(e)&&e>0?Math.max(e,i):0}}},{"fast-isnumeric":132}],1072:[function(t,e,r){"use strict";var n=t("../../components/color"),i=t("../../components/colorscale/has_colorscale"),a=t("../../components/colorscale/defaults"),o=t("./subtypes");e.exports=function(t,e,r,s,l,c){var u=o.isBubble(t),h=(t.line||{}).color;if(c=c||{},h&&(r=h),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",h&&!Array.isArray(h)&&e.marker.color!==h?h: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":613,"../../components/colorscale/defaults":623,"../../components/colorscale/has_colorscale":627,"./subtypes":1076}],1073:[function(t,e,r){"use strict";function n(t,e,r,n,u,f,d){function p(t){return _?t.transition():t}function m(t){return t.filter(function(t){return t.vis})}function g(t){return t.id}function v(){return!1}function y(e){var n,s=e[0].trace,c=i.select(this),u=l.hasMarkers(s),h=l.hasText(s),f=function(t){if(t.ids)return g}(s),d=v,y=v;u&&(d=s.marker.maxdisplayed||s._needsCull?m:a.identity),h&&(y=s.marker.maxdisplayed||s._needsCull?m:a.identity);var b=(n=c.selectAll("path.point").data(d,f)).enter().append("path").classed("point",!0);_&&b.call(o.pointStyle,s,t).call(o.translatePoints,w,M).style("opacity",0).transition().style("opacity",1);var x=u&&o.tryColorscale(s.marker,""),k=u&&o.tryColorscale(s.marker,"line");n.order(),n.each(function(e){var n=i.select(this),a=p(n);o.translatePoint(e,a,w,M)?(o.singlePointStyle(e,a,s,x,k,t),r.layerClipId&&o.hideOutsideRangePoint(e,a,w,M,s.xcalendar,s.ycalendar),s.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),_?n.exit().transition().style("opacity",0).remove():n.exit().remove(),(n=c.selectAll("g").data(y,f)).enter().append("g").classed("textpoint",!0).append("text"),n.order(),n.each(function(t){var e=i.select(this),n=p(e.select("text"));o.translatePoint(t,n,w,M)?r.layerClipId&&o.hideOutsideRangePoint(t,e,w,M,s.xcalendar,s.ycalendar):e.remove()}),n.selectAll("text").call(o.textPointStyle,s,t).each(function(t){var e=w.c2p(t.x),r=M.c2p(t.y);i.select(this).selectAll("tspan.line").each(function(){p(i.select(this)).attr({x:e,y:r})})}),n.exit().remove()}var b,x;!function(t,e,r,n,o){var s=r.xaxis,c=r.yaxis,u=i.extent(a.simpleMap(s.range,s.r2c)),h=i.extent(a.simpleMap(c.range,c.r2c)),f=n[0].trace;if(!l.hasMarkers(f))return;var d=f.marker.maxdisplayed;if(0===d)return;var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=h[0]&&t.y<=h[1]}),m=Math.ceil(p.length/d),g=0;o.forEach(function(t,r){var n=t[0].trace;l.hasMarkers(n)&&n.marker.maxdisplayed>0&&r<e&&g++});var v=Math.round(g*m/3+Math.floor(g/3)*m/7.1);n.forEach(function(t){delete t.vis}),p.forEach(function(t,e){0===Math.round((e+v)%m)&&(t.vis=!0)})}(0,e,r,n,u);var _=!!d&&d.duration>0,w=r.xaxis,M=r.yaxis,k=n[0].trace,T=k.line,A=i.select(f);if(A.call(s.plot,r,d),!0===k.visible){p(A).style("opacity",k.opacity);var S,E,L=k.fill.charAt(k.fill.length-1);"x"!==L&&"y"!==L&&(L=""),n[0].node3=A;var C="",I=[],P=k._prevtrace;P&&(C=P._prevRevpath||"",E=P._nextFill,I=P._polygons);var D,z,O,F,R,j,N,B,U,V="",H="",q=[],G=a.noop;if(S=k._ownFill,l.hasLines(k)||"none"!==k.fill){for(E&&E.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(T.shape)?(O=o.steps(T.shape),F=o.steps(T.shape.split("").reverse().join(""))):O=F="spline"===T.shape?function(t){var e=t[t.length-1];return t.length>1&&t[0][0]===e[0]&&t[0][1]===e[1]?o.smoothclosed(t.slice(1),T.smoothing):o.smoothopen(t,T.smoothing)}:function(t){return"M"+t.join("L")},R=function(t){return F(t.reverse())},q=c(n,{xaxis:w,yaxis:M,connectGaps:k.connectgaps,baseTolerance:Math.max(T.width||1,3)/4,shape:T.shape,simplify:T.simplify}),U=k._polygons=new Array(q.length),x=0;x<q.length;x++)k._polygons[x]=h(q[x]);q.length&&(j=q[0][0],B=(N=q[q.length-1])[N.length-1]),G=function(t){return function(e){if(D=O(e),z=R(e),V?L?(V+="L"+D.substr(1),H=z+"L"+H.substr(1)):(V+="Z"+D,H=z+"Z"+H):(V=D,H=z),l.hasLines(k)&&e.length>1){var r=i.select(this);if(r.datum(n),t)p(r.style("opacity",0).attr("d",D).call(o.lineGroupStyle)).style("opacity",1);else{var a=p(r);a.attr("d",D),o.singleLineStyle(n,a)}}}}}var Y=A.selectAll(".js-line").data(q);p(Y.exit()).style("opacity",0).remove(),Y.each(G(!1)),Y.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(o.lineGroupStyle).each(G(!0)),o.setClipUrl(Y,r.layerClipId),q.length&&(S?j&&B&&(L?("y"===L?j[1]=B[1]=M.c2p(0,!0):"x"===L&&(j[0]=B[0]=w.c2p(0,!0)),p(S).attr("d","M"+B+"L"+j+"L"+V.substr(1)).call(o.singleFillStyle)):p(S).attr("d",V+"Z").call(o.singleFillStyle)):"tonext"===k.fill.substr(0,6)&&V&&C&&("tonext"===k.fill?p(E).attr("d",V+"Z"+C+"Z").call(o.singleFillStyle):p(E).attr("d",V+"L"+C.substr(1)+"Z").call(o.singleFillStyle),k._polygons=k._polygons.concat(I)),k._prevRevpath=H,k._prevPolygons=U);var W=A.selectAll(".points");b=W.data([n]),W.each(y),b.enter().append("g").classed("points",!0).each(y),b.exit().remove(),b.each(function(t){var e=!1===t[0].trace.cliponaxis;o.setClipUrl(i.select(this),e?null:r.layerClipId)})}}var i=t("d3"),a=t("../../lib"),o=t("../../components/drawing"),s=t("../../components/errorbars"),l=t("./subtypes"),c=t("./line_points"),u=t("./link_traces"),h=t("../../lib/polygon").tester;e.exports=function(t,e,r,a,s){var l,c,h,f,d=e.plot.select("g.scatterlayer"),p=!a,m=!!a&&a.duration>0;for((h=d.selectAll("g.trace").data(r,function(t){return t[0].trace.uid})).enter().append("g").attr("class",function(t){return"trace scatter trace"+t[0].trace.uid}).style("stroke-miterlimit",2),u(t,e,r),function(t,e,r){var n;e.selectAll("g.trace").each(function(t){var e=i.select(this);if((n=t[0].trace)._nexttrace){if(n._nextFill=e.select(".js-fill.js-tonext"),!n._nextFill.size()){var a=":first-child";e.select(".js-fill.js-tozero").size()&&(a+=" + *"),n._nextFill=e.insert("path",a).attr("class","js-fill js-tonext")}}else e.selectAll(".js-fill.js-tonext").remove(),n._nextFill=null;n.fill&&("tozero"===n.fill.substr(0,6)||"toself"===n.fill||"to"===n.fill.substr(0,2)&&!n._prevtrace)?(n._ownFill=e.select(".js-fill.js-tozero"),n._ownFill.size()||(n._ownFill=e.insert("path",":first-child").attr("class","js-fill js-tozero"))):(e.selectAll(".js-fill.js-tozero").remove(),n._ownFill=null),e.selectAll(".js-fill").call(o.setClipUrl,r.layerClipId)})}(0,d,e),l=0,c={};l<r.length;l++)c[r[l][0].trace.uid]=l;if(d.selectAll("g.trace").sort(function(t,e){return c[t[0].trace.uid]>c[e[0].trace.uid]?1:-1}),m){s&&(f=s());i.transition().duration(a.duration).ease(a.easing).each("end",function(){f&&f()}).each("interrupt",function(){f&&f()}).each(function(){d.selectAll("g.trace").each(function(i,o){n(t,o,e,i,r,this,a)})})}else d.selectAll("g.trace").each(function(i,o){n(t,o,e,i,r,this,a)});p&&h.exit().remove(),d.selectAll("path:not([d])").remove()}},{"../../components/drawing":638,"../../components/errorbars":644,"../../lib":738,"../../lib/polygon":750,"./line_points":1068,"./link_traces":1070,"./subtypes":1076,d3:123}],1074:[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=[],h=s[0].trace;if(!n.hasMarkers(h)&&!n.hasText(h))return[];if(!1===e)for(r=0;r<s.length;r++)s[r].selected=0;else for(r=0;r<s.length;r++)i=s[r],a=l.c2p(i.x),o=c.c2p(i.y),e.contains([a,o])?(u.push({pointNumber:r,x:l.c2d(i.x),y:c.c2d(i.y)}),i.selected=1):i.selected=0;return u}},{"./subtypes":1076}],1075:[function(t,e,r){"use strict";function n(t,e,r){var n=t.selectAll("path.point"),i=t.selectAll("text");a.pointStyle(n,e,r),a.textPointStyle(i,e,r),a.selectedPointStyle(n,e),a.selectedTextStyle(i,e)}var i=t("d3"),a=t("../../components/drawing"),o=t("../../components/errorbars");e.exports={style:function(t,e){var r=e?e[0].node3:i.select(t).selectAll("g.trace.scatter");r.style("opacity",function(t){return t[0].trace.opacity}),r.selectAll("g.points").each(function(e){n(i.select(this),e.trace||e[0].trace,t)}),r.selectAll("g.trace path.js-line").call(a.lineGroupStyle),r.selectAll("g.trace path.js-fill").call(a.fillGroupStyle),r.call(o.style)},stylePoints:n}},{"../../components/drawing":638,"../../components/errorbars":644,d3:123}],1076:[function(t,e,r){"use strict";var n=t("../../lib");e.exports={hasLines:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("lines")},hasMarkers:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("markers")},hasText:function(t){return t.visible&&t.mode&&-1!==t.mode.indexOf("text")},isBubble:function(t){return n.isPlainObject(t.marker)&&Array.isArray(t.marker.size)}}},{"../../lib":738}],1077:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e,r,i,a){a=a||{},i("textposition"),n.coerceFont(i,"textfont",r.font),a.noSelect||(i("selected.textfont.color"),i("unselected.textfont.color"))}},{"../../lib":738}],1078:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i){var a,o=i("x"),s=i("y");if(n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],r),o)s?((a=Math.min(o.length,s.length))<o.length&&(e.x=o.slice(0,a)),a<s.length&&(e.y=s.slice(0,a))):(a=o.length,i("y0"),i("dy"));else{if(!s)return 0;a=e.y.length,i("x0"),i("dx")}return a}},{"../../registry":861}],1079:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),a=t("../../components/errorbars/attributes"),o=t("../../constants/gl3d_dashes"),s=t("../../constants/gl3d_markers"),l=t("../../lib/extend").extendFlat,c=t("../../plot_api/edit_types").overrideAll,u=n.line,h=n.marker,f=h.line,d=e.exports=c({x:n.x,y:n.y,z:{valType:"data_array"},text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),mode:l({},n.mode,{dflt:"lines+markers"}),surfaceaxis:{valType:"enumerated",values:[-1,0,1,2],dflt:-1},surfacecolor:{valType:"color"},projection:{x:{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}},y:{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}},z:{show:{valType:"boolean",dflt:!1},opacity:{valType:"number",min:0,max:1,dflt:1},scale:{valType:"number",min:0,max:10,dflt:2/3}}},connectgaps:n.connectgaps,line:l({width:u.width,dash:{valType:"enumerated",values:Object.keys(o),dflt:"solid"},showscale:{valType:"boolean",dflt:!1}},i("line")),marker:l({symbol:{valType:"enumerated",values:Object.keys(s),dflt:"circle",arrayOk:!0},size:l({},h.size,{dflt:8}),sizeref:h.sizeref,sizemin:h.sizemin,sizemode:h.sizemode,opacity:l({},h.opacity,{arrayOk:!1}),showscale:h.showscale,colorbar:h.colorbar,line:l({width:l({},f.width,{arrayOk:!1})},i("marker.line"))},i("marker")),textposition:l({},n.textposition,{dflt:"top center"}),textfont:n.textfont,error_x:a,error_y:a,error_z:a},"calc","nested");d.x.editType=d.y.editType=d.z.editType="calc+clearAxisTypes"},{"../../components/colorscale/color_attributes":621,"../../components/errorbars/attributes":640,"../../constants/gl3d_dashes":714,"../../constants/gl3d_markers":715,"../../lib/extend":727,"../../plot_api/edit_types":769,"../scatter/attributes":1054}],1080:[function(t,e,r){"use strict";var n=t("../scatter/arrays_to_calcdata"),i=t("../scatter/colorscale_calc");e.exports=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return n(r,e),i(e),r}},{"../scatter/arrays_to_calcdata":1053,"../scatter/colorscale_calc":1059}],1081:[function(t,e,r){"use strict";function n(t,e,r){if(!e||!e.visible)return null;for(var n=i(e),a=new Array(t.length),o=0;o<t.length;o++){var s=n(+t[o],o);a[o]=[-s[0]*r,s[1]*r]}return a}var i=t("../../components/errorbars/compute_error");e.exports=function(t,e){var r=[n(t.x,t.error_x,e[0]),n(t.y,t.error_y,e[1]),n(t.z,t.error_z,e[2])],i=function(t){for(var e=0;e<t.length;e++)if(t[e])return t[e].length;return 0}(r);if(0===i)return null;for(var a=new Array(i),o=0;o<i;o++){for(var s=[[0,0,0],[0,0,0]],l=0;l<3;l++)if(r[l])for(var c=0;c<2;c++)s[c][l]=r[l][o][c];a[o]=s}return a}},{"../../components/errorbars/compute_error":642}],1082:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.linePlot=null,this.scatterPlot=null,this.errorBars=null,this.textMarkers=null,this.delaunayMesh=null,this.color=null,this.mode="",this.dataPoints=[],this.axesBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.textLabels=null,this.data=null}function i(t,e){return e(4*t)}function a(t){return b[t]}function o(t,e,r,n,i){var a=null;if(Array.isArray(t)){a=[];for(var o=0;o<e;o++)void 0===t[o]?a[o]=n:a[o]=r(t[o],i)}else a=r(t,p.identity);return a}function s(t,e){var r,n,s,l,c,u,h=[],f=t.fullSceneLayout,d=t.dataScale,y=f.xaxis,b=f.yaxis,_=f.zaxis,w=e.marker,M=e.line,k=e.x||[],T=e.y||[],A=e.z||[],S=k.length,E=e.xcalendar,L=e.ycalendar,C=e.zcalendar;for(n=0;n<S;n++)s=y.d2l(k[n],0,E)*d[0],l=b.d2l(T[n],0,L)*d[1],c=_.d2l(A[n],0,C)*d[2],h[n]=[s,l,c];if(Array.isArray(e.text))u=e.text;else if(void 0!==e.text)for(u=new Array(S),n=0;n<S;n++)u[n]=e.text;if(r={position:h,mode:e.mode,text:u},"line"in e&&(r.lineColor=g(M,1,S),r.lineWidth=M.width,r.lineDashes=M.dash),"marker"in e){var I=v(e);r.scatterColor=g(w,1,S),r.scatterSize=o(w.size,S,i,20,I),r.scatterMarker=o(w.symbol,S,a,"\u25cf"),r.scatterLineWidth=w.line.width,r.scatterLineColor=g(w.line,1,S),r.scatterAngle=0}"textposition"in e&&(r.textOffset=function(t){var e=[0,0];return Array.isArray(t)?[0,-1]:(t.indexOf("bottom")>=0&&(e[1]+=1),t.indexOf("top")>=0&&(e[1]-=1),t.indexOf("left")>=0&&(e[0]-=1),t.indexOf("right")>=0&&(e[0]+=1),e)}(e.textposition),r.textColor=g(e.textfont,1,S),r.textSize=o(e.textfont.size,S,p.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var P=["x","y","z"];for(r.project=[!1,!1,!1],r.projectScale=[1,1,1],r.projectOpacity=[1,1,1],n=0;n<3;++n){var D=e.projection[P[n]];(r.project[n]=D.show)&&(r.projectOpacity[n]=D.opacity,r.projectScale[n]=D.scale)}r.errorBounds=x(e,d);var z=function(t){for(var e=[0,0,0],r=[[0,0,0],[0,0,0],[0,0,0]],n=[0,0,0],i=0;i<3;i++){var a=t[i];a&&!1!==a.copy_zstyle&&(a=t[2]),a&&(e[i]=a.width/2,r[i]=m(a.color),n=a.thickness)}return{capSize:e,color:r,lineWidth:n}}([e.error_x,e.error_y,e.error_z]);return r.errorColor=z.color,r.errorLineWidth=z.lineWidth,r.errorCapSize=z.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=m(e.surfacecolor),r}function l(t){if(Array.isArray(t)){var e=t[0];return Array.isArray(e)&&(t=e),"rgb("+t.slice(0,3).map(function(t){return Math.round(255*t)})+")"}return null}var c=t("gl-line3d"),u=t("gl-scatter3d"),h=t("gl-error3d"),f=t("gl-mesh3d"),d=t("delaunay-triangulate"),p=t("../../lib"),m=t("../../lib/str2rgbarray"),g=t("../../lib/gl_format_color"),v=t("../scatter/make_bubble_size_func"),y=t("../../constants/gl3d_dashes"),b=t("../../constants/gl3d_markers"),x=t("./calc_errors"),_=n.prototype;_.handlePick=function(t){if(t.object&&(t.object===this.linePlot||t.object===this.delaunayMesh||t.object===this.textMarkers||t.object===this.scatterPlot)){t.object.highlight&&t.object.highlight(null),this.scatterPlot&&(t.object=this.scatterPlot,this.scatterPlot.highlight(t.data)),this.textLabels?void 0!==this.textLabels[t.data.index]?t.textLabel=this.textLabels[t.data.index]:t.textLabel=this.textLabels:t.textLabel="";var e=t.index=t.data.index;return t.traceCoordinate=[this.data.x[e],this.data.y[e],this.data.z[e]],!0}},_.update=function(t){var e,r,n,i,a=this.scene.glplot.gl,o=y.solid;this.data=t;var p=s(this.scene,t);"mode"in p&&(this.mode=p.mode),"lineDashes"in p&&p.lineDashes in y&&(o=y[p.lineDashes]),this.color=l(p.scatterColor)||l(p.lineColor),this.dataPoints=p.position,e={gl:a,position:p.position,color:p.lineColor,lineWidth:p.lineWidth||1,dashes:o[0],dashScale:o[1],opacity:t.opacity,connectGaps:t.connectgaps},-1!==this.mode.indexOf("lines")?this.linePlot?this.linePlot.update(e):(this.linePlot=c(e),this.linePlot._trace=this,this.scene.glplot.add(this.linePlot)):this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose(),this.linePlot=null);var m=t.opacity;if(t.marker&&t.marker.opacity&&(m*=t.marker.opacity),r={gl:a,position:p.position,color:p.scatterColor,size:p.scatterSize,glyph:p.scatterMarker,opacity:m,orthographic:!0,lineWidth:p.scatterLineWidth,lineColor:p.scatterLineColor,project:p.project,projectScale:p.projectScale,projectOpacity:p.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=u(r),this.scatterPlot._trace=this,this.scatterPlot.highlightScale=1,this.scene.glplot.add(this.scatterPlot)):this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose(),this.scatterPlot=null),i={gl:a,position:p.position,glyph:p.text,color:p.textColor,size:p.textSize,angle:p.textAngle,alignment:p.textOffset,font:p.textFont,orthographic:!0,lineWidth:0,project:!1,opacity:t.opacity},this.textLabels=t.hovertext||t.text,-1!==this.mode.indexOf("text")?this.textMarkers?this.textMarkers.update(i):(this.textMarkers=u(i),this.textMarkers._trace=this,this.textMarkers.highlightScale=1,this.scene.glplot.add(this.textMarkers)):this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose(),this.textMarkers=null),n={gl:a,position:p.position,color:p.errorColor,error:p.errorBounds,lineWidth:p.errorLineWidth,capSize:p.errorCapSize,opacity:t.opacity},this.errorBars?p.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):p.errorBounds&&(this.errorBars=h(n),this.errorBars._trace=this,this.scene.glplot.add(this.errorBars)),p.delaunayAxis>=0){var g=function(t,e,r){var n,i=(r+1)%3,a=(r+2)%3,o=[],s=[];for(n=0;n<t.length;++n){var l=t[n];!isNaN(l[i])&&isFinite(l[i])&&!isNaN(l[a])&&isFinite(l[a])&&(o.push([l[i],l[a]]),s.push(n))}var c=d(o);for(n=0;n<c.length;++n)for(var u=c[n],h=0;h<u.length;++h)u[h]=s[u[h]];return{positions:t,cells:c,meshColor:e}}(p.position,p.delaunayColor,p.delaunayAxis);g.opacity=t.opacity,this.delaunayMesh?this.delaunayMesh.update(g):(g.gl=a,this.delaunayMesh=f(g),this.delaunayMesh._trace=this,this.scene.glplot.add(this.delaunayMesh))}else this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose(),this.delaunayMesh=null)},_.dispose=function(){this.linePlot&&(this.scene.glplot.remove(this.linePlot),this.linePlot.dispose()),this.scatterPlot&&(this.scene.glplot.remove(this.scatterPlot),this.scatterPlot.dispose()),this.errorBars&&(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose()),this.textMarkers&&(this.scene.glplot.remove(this.textMarkers),this.textMarkers.dispose()),this.delaunayMesh&&(this.scene.glplot.remove(this.delaunayMesh),this.delaunayMesh.dispose())},e.exports=function(t,e){var r=new n(t,e.uid);return r.update(e),r}},{"../../constants/gl3d_dashes":714,"../../constants/gl3d_markers":715,"../../lib":738,"../../lib/gl_format_color":734,"../../lib/str2rgbarray":760,"../scatter/make_bubble_size_func":1071,"./calc_errors":1081,"delaunay-triangulate":124,"gl-error3d":162,"gl-line3d":173,"gl-mesh3d":206,"gl-scatter3d":252}],1083:[function(t,e,r){"use strict";var n=t("../../registry"),i=t("../../lib"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/text_defaults"),c=t("../../components/errorbars/defaults"),u=t("./attributes");e.exports=function(t,e,r,h){function f(r,n){return i.coerce(t,e,u,r,n)}if(function(t,e,r,i){var a=0,o=r("x"),s=r("y"),l=r("z");return n.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],i),o&&s&&l&&((a=Math.min(o.length,s.length,l.length))<o.length&&(e.x=o.slice(0,a)),a<s.length&&(e.y=s.slice(0,a)),a<l.length&&(e.z=l.slice(0,a))),a}(t,e,f,h)){f("text"),f("hovertext"),f("mode"),a.hasLines(e)&&(f("connectgaps"),s(t,e,r,h,f)),a.hasMarkers(e)&&o(t,e,r,h,f,{noSelect:!0}),a.hasText(e)&&l(t,e,h,f,{noSelect:!0});var d=(e.line||{}).color,p=(e.marker||{}).color;f("surfaceaxis")>=0&&f("surfacecolor",d||p);for(var m=["x","y","z"],g=0;g<3;++g){var v="projection."+m[g];f(v+".show")&&(f(v+".opacity"),f(v+".scale"))}c(t,e,r,{axis:"z"}),c(t,e,r,{axis:"y",inherit:"z"}),c(t,e,r,{axis:"x",inherit:"z"})}else e.visible=!1}},{"../../components/errorbars/defaults":643,"../../lib":738,"../../registry":861,"../scatter/line_defaults":1067,"../scatter/marker_defaults":1072,"../scatter/subtypes":1076,"../scatter/text_defaults":1077,"./attributes":1079}],1084:[function(t,e,r){"use strict";var n={};n.plot=t("./convert"),n.attributes=t("./attributes"),n.markerSymbols=t("../../constants/gl3d_markers"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.moduleType="trace",n.name="scatter3d",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","symbols","markerColorscale","showLegend"],n.meta={},e.exports=n},{"../../constants/gl3d_markers":715,"../../plots/gl3d":826,"../scatter/colorbar":1058,"./attributes":1079,"./calc":1080,"./convert":1082,"./defaults":1083}],1085:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/colorbar/attributes"),s=t("../../lib/extend").extendFlat,l=n.marker,c=n.line,u=l.line;e.exports={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:s({},n.mode,{dflt:"markers"}),text:s({},n.text,{}),line:{color:c.color,width:c.width,dash:c.dash,shape:s({},c.shape,{values:["linear","spline"]}),smoothing:c.smoothing,editType:"calc"},connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","toself","tonext"]}),fillcolor:n.fillcolor,marker:s({symbol:l.symbol,opacity:l.opacity,maxdisplayed:l.maxdisplayed,size:l.size,sizeref:l.sizeref,sizemin:l.sizemin,sizemode:l.sizemode,line:s({width:u.width,editType:"calc"},a("marker".line)),gradient:l.gradient,editType:"calc"},a("marker"),{showscale:l.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:s({},i.hoverinfo,{flags:["a","b","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":614,"../../components/colorscale/color_attributes":621,"../../lib/extend":727,"../../plots/attributes":783,"../scatter/attributes":1054}],1086:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../scatter/subtypes"),o=t("../scatter/colorscale_calc"),s=t("../scatter/arrays_to_calcdata"),l=t("../scatter/calc_selection"),c=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=c(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var u;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var h,f,d=e.a.length,p=new Array(d),m=!1;for(u=0;u<d;u++)if(h=e.a[u],f=e.b[u],n(h)&&n(f)){var g=r.ab2xy(+h,+f,!0),v=r.isVisible(+h,+f);v||(m=!0),p[u]={x:g[0],y:g[1],a:h,b:f,vis:v}}else p[u]={x:!1,y:!1};e._needsCull=m,p[0].carpet=r,p[0].trace=e;var y,b;if(a.hasMarkers(e)&&(y=e.marker,b=y.size,Array.isArray(b))){var x={type:"linear"};i.setConvert(x),(b=x.makeCalcdata(e.marker,"size")).length>d&&b.splice(d,b.length-d)}return o(e),s(p,e),l(p,e),p}}},{"../../plots/cartesian/axes":785,"../carpet/lookup_carpetid":919,"../scatter/arrays_to_calcdata":1053,"../scatter/calc_selection":1056,"../scatter/colorscale_calc":1059,"../scatter/subtypes":1076,"fast-isnumeric":132}],1087:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}d("carpet"),e.xaxis="x",e.yaxis="y";var p,m=d("a"),g=d("b");if(p=Math.min(m.length,g.length)){m&&p<m.length&&(e.a=m.slice(0,p)),g&&p<g.length&&(e.b=g.slice(0,p)),d("text");d("mode",p<i.PTS_LINESONLY?"lines+markers":"lines"),a.hasLines(e)&&(s(t,e,r,f,d),l(t,e,d),d("connectgaps")),a.hasMarkers(e)&&o(t,e,r,f,d,{gradient:!0}),a.hasText(e)&&c(t,e,f,d);var v=[];(a.hasMarkers(e)||a.hasText(e))&&(d("marker.maxdisplayed"),v.push("points")),d("fill"),"none"!==e.fill&&(u(t,e,r,d),a.hasLines(e)||l(t,e,d)),"tonext"!==e.fill&&"toself"!==e.fill||v.push("fills"),d("hoveron",v.join("+")||"points"),n.coerceSelectionMarkerOpacity(e,d)}else e.visible=!1}},{"../../lib":738,"../scatter/constants":1060,"../scatter/fillcolor_defaults":1063,"../scatter/line_defaults":1067,"../scatter/line_shape_defaults":1069,"../scatter/marker_defaults":1072,"../scatter/subtypes":1076,"../scatter/text_defaults":1077,"./attributes":1085}],1088:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){var a=n[i];return t.a=a.a,t.b=a.b,t}},{}],1089:[function(t,e,r){"use strict";var n=t("../scatter/hover");e.exports=function(t,e,r,i){function a(t,e){var r;r=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,g.push(r+": "+e.toFixed(3)+t.labelsuffix)}var o=n(t,e,r,i);if(o&&!1!==o[0].index){var s=o[0];if(void 0===s.index){var l=1-s.y0/t.ya._length,c=t.xa._length,u=c*l/2,h=c-u;return s.x0=Math.max(Math.min(s.x0,h),u),s.x1=Math.max(Math.min(s.x1,h),u),o}var f=s.cd[s.index];s.a=f.a,s.b=f.b,s.xLabelVal=void 0,s.yLabelVal=void 0;var d=s.trace,p=d._carpet,m=(f.hi||d.hoverinfo).split("+"),g=[];-1!==m.indexOf("all")&&(m=["a","b"]),-1!==m.indexOf("a")&&a(p.aaxis,f.a),-1!==m.indexOf("b")&&a(p.baxis,f.b);var v=p.ab2ij([f.a,f.b]),y=Math.floor(v[0]),b=v[0]-y,x=Math.floor(v[1]),_=v[1]-x,w=p.evalxy([],y,x,b,_);return g.push("y: "+w[1].toFixed(3)),s.extraText=g.join("<br>"),o}}},{"../scatter/hover":1065}],1090:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("../scatter/select"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scattercarpet",n.basePlotModule=t("../../plots/cartesian"),n.categories=["carpet","symbols","markerColorscale","showLegend","carpetDependent"],n.meta={},e.exports=n},{"../../plots/cartesian":796,"../scatter/colorbar":1058,"../scatter/select":1074,"./attributes":1085,"./calc":1086,"./defaults":1087,"./event_data":1088,"./hover":1089,"./plot":1091,"./style":1092}],1091:[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){var o,s,l,c=r[0][0].carpet,u={xaxis:i.getFromId(t,c.xaxis||"x"),yaxis:i.getFromId(t,c.yaxis||"y"),plot:e.plot};for(n(t,u,r),o=0;o<r.length;o++)s=r[o][0].trace,l=u.plot.selectAll("g.trace"+s.uid+" .js-line"),a.setClipUrl(l,c._clipPathId)}},{"../../components/drawing":638,"../../plots/cartesian/axes":785,"../scatter/plot":1073}],1092:[function(t,e,r){"use strict";var n=t("../scatter/style").style;e.exports=function(t,e){if(!e)for(var r=t._fullLayout._modules,i=0;i<r.length;i++)if("scatter"===r[i].name)return;n(t,e)}},{"../scatter/style":1075}],1093:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/drawing/attributes").dash,s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll,c=n.marker,u=n.line,h=c.line;e.exports=l({lon:{valType:"data_array"},lat:{valType:"data_array"},locations:{valType:"data_array"},locationmode:{valType:"enumerated",values:["ISO-3","USA-states","country names"],dflt:"ISO-3"},mode:s({},n.mode,{dflt:"markers"}),text:s({},n.text,{}),hovertext:s({},n.hovertext,{}),textfont:n.textfont,textposition:n.textposition,line:{color:u.color,width:u.width,dash:o},connectgaps:n.connectgaps,marker:s({symbol:c.symbol,opacity:c.opacity,size:c.size,sizeref:c.sizeref,sizemin:c.sizemin,sizemode:c.sizemode,showscale:c.showscale,colorbar:c.colorbar,line:s({width:h.width},a("marker.line")),gradient:c.gradient},a("marker")),fill:{valType:"enumerated",values:["none","toself"],dflt:"none"},fillcolor:n.fillcolor,selected:n.selected,unselected:n.unselected,hoverinfo:s({},i.hoverinfo,{flags:["lon","lat","location","text","name"]})},"calc","nested")},{"../../components/colorscale/color_attributes":621,"../../components/drawing/attributes":637,"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/attributes":783,"../scatter/attributes":1054}],1094:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../constants/numerical").BADNUM,a=t("../scatter/colorscale_calc"),o=t("../scatter/arrays_to_calcdata"),s=t("../scatter/calc_selection"),l=t("../../lib")._;e.exports=function(t,e){for(var r=Array.isArray(e.locations),c=r?e.locations.length:e.lon.length,u=new Array(c),h=0;h<c;h++){var f=u[h]={};if(r){var d=e.locations[h];f.loc="string"==typeof d?d:null}else{var p=e.lon[h],m=e.lat[h];n(p)&&n(m)?f.lonlat=[+p,+m]:f.lonlat=[i,i]}}return o(u,e),a(e),s(u,e),c&&(u[0].t={labels:{lat:l(t,"lat:")+" ",lon:l(t,"lon:")+" "}}),u}},{"../../constants/numerical":717,"../../lib":738,"../scatter/arrays_to_calcdata":1053,"../scatter/calc_selection":1056,"../scatter/colorscale_calc":1059,"fast-isnumeric":132}],1095:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),o=t("../scatter/line_defaults"),s=t("../scatter/text_defaults"),l=t("../scatter/fillcolor_defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function h(r,i){return n.coerce(t,e,c,r,i)}!function(t,e,r){var n,i,a=0,o=r("locations");return o?(r("locationmode"),a=o.length):(n=r("lon")||[],i=r("lat")||[],(a=Math.min(n.length,i.length))<n.length&&(e.lon=n.slice(0,a)),a<i.length&&(e.lat=i.slice(0,a)),a)}(0,e,h)?e.visible=!1:(h("text"),h("hovertext"),h("mode"),i.hasLines(e)&&(o(t,e,r,u,h),h("connectgaps")),i.hasMarkers(e)&&a(t,e,r,u,h,{gradient:!0}),i.hasText(e)&&s(t,e,u,h),h("fill"),"none"!==e.fill&&l(t,e,r,h))}},{"../../lib":738,"../scatter/fillcolor_defaults":1063,"../scatter/line_defaults":1067,"../scatter/marker_defaults":1072,"../scatter/subtypes":1076,"../scatter/text_defaults":1077,"./attributes":1093}],1096:[function(t,e,r){"use strict";e.exports=function(t,e){return t.lon=e.lon,t.lat=e.lat,t.location=e.loc?e.loc:null,t}},{}],1097:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../../plots/cartesian/axes"),a=t("../../constants/numerical").BADNUM,o=t("../scatter/get_trace_color"),s=t("../scatter/fill_hover_text"),l=t("./attributes");e.exports=function(t,e,r){var c=t.cd,u=c[0].trace,h=t.xa,f=t.ya,d=t.subplot,p=d.projection.isLonLatOverEdges,m=d.project;if(n.getClosest(c,function(t){var n=t.lonlat;if(n[0]===a)return 1/0;if(p(n))return 1/0;var i=m(n),o=m([e,r]),s=Math.abs(i[0]-o[0]),l=Math.abs(i[1]-o[1]),c=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(s*s+l*l)-c,1-3/c)},t),!1!==t.index){var g=c[t.index],v=g.lonlat,y=[h.c2p(v),f.c2p(v)],b=g.mrc||1;return t.x0=y[0]-b,t.x1=y[0]+b,t.y0=y[1]-b,t.y1=y[1]+b,t.loc=g.loc,t.lon=v[0],t.lat=v[1],t.color=o(u,g),t.extraText=function(t,e,r,n){function a(t){return i.tickText(r,r.c2l(t),"hover").text+"\xb0"}var o=e.hi||t.hoverinfo,c="all"===o?l.hoverinfo.flags:o.split("+"),u=-1!==c.indexOf("location")&&Array.isArray(t.locations),h=-1!==c.indexOf("lon"),f=-1!==c.indexOf("lat"),d=-1!==c.indexOf("text"),p=[];return u?p.push(e.loc):h&&f?p.push("("+a(e.lonlat[0])+", "+a(e.lonlat[1])+")"):h?p.push(n.lon+a(e.lonlat[0])):f&&p.push(n.lat+a(e.lonlat[1])),d&&s(e,t,p),p.join("<br>")}(u,g,d.mockAxis,c[0].t.labels),[t]}}},{"../../components/fx":655,"../../constants/numerical":717,"../../plots/cartesian/axes":785,"../scatter/fill_hover_text":1062,"../scatter/get_trace_color":1064,"./attributes":1093}],1098:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scattergeo",n.basePlotModule=t("../../plots/geo"),n.categories=["geo","symbols","markerColorscale","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/geo":814,"../scatter/colorbar":1058,"./attributes":1093,"./calc":1094,"./defaults":1095,"./event_data":1096,"./hover":1097,"./plot":1099,"./select":1100,"./style":1101}],1099:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../lib"),a=t("../../constants/numerical").BADNUM,o=t("../../lib/topojson_utils").getTopojsonFeatures,s=t("../../lib/geo_location_utils").locationToFeature,l=t("../../lib/geojson_utils"),c=t("../scatter/subtypes"),u=t("./style");e.exports=function(t,e){function r(t,e){t.lonlat[0]===a&&n.select(e).remove()}for(var h=0;h<e.length;h++)!function(t,e){var r=t[0].trace;if(Array.isArray(r.locations))for(var n=o(r,e),i=r.locationmode,l=0;l<t.length;l++){var c=t[l],u=s(i,c.loc,n);c.lonlat=u?u.properties.ct:[a,a]}}(e[h],t.topojson);var f=t.layers.frontplot.select(".scatterlayer").selectAll("g.trace.scattergeo").data(e,function(t){return t[0].trace.uid});f.enter().append("g").attr("class","trace scattergeo"),f.exit().remove(),f.selectAll("*").remove(),f.each(function(e){var a=e[0].node3=n.select(this),o=e[0].trace;if(c.hasLines(o)||"none"!==o.fill){var s=l.calcTraceToLineCoords(e),h="none"!==o.fill?l.makePolygon(s):l.makeLine(s);a.selectAll("path.js-line").data([{geojson:h,trace:o}]).enter().append("path").classed("js-line",!0).style("stroke-miterlimit",2)}c.hasMarkers(o)&&a.selectAll("path.point").data(i.identity).enter().append("path").classed("point",!0).each(function(t){r(t,this)}),c.hasText(o)&&a.selectAll("g").data(i.identity).enter().append("g").append("text").each(function(t){r(t,this)}),u(t.graphDiv,e)})}},{"../../constants/numerical":717,"../../lib":738,"../../lib/geo_location_utils":730,"../../lib/geojson_utils":731,"../../lib/topojson_utils":764,"../scatter/subtypes":1076,"./style":1101,d3:123}],1100:[function(t,e,r){"use strict";var n=t("../scatter/subtypes");e.exports=function(t,e){var r,i,a,o,s,l=t.cd,c=t.xaxis,u=t.yaxis,h=[],f=l[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(s=0;s<l.length;s++)l[s].selected=0;else for(s=0;s<l.length;s++)i=(r=l[s]).lonlat,a=c.c2p(i),o=u.c2p(i),e.contains([a,o])?(h.push({pointNumber:s,lon:i[0],lat:i[1]}),r.selected=1):r.selected=0;return h}},{"../scatter/subtypes":1076}],1101:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/drawing"),a=t("../../components/color"),o=t("../scatter/style").stylePoints;e.exports=function(t,e){e&&function(t,e){var r=e[0].trace,s=e[0].node3;s.style("opacity",e[0].trace.opacity),o(s,r,t),s.selectAll("path.js-line").style("fill","none").each(function(t){var e=n.select(this),r=t.trace,o=r.line||{};e.call(a.stroke,o.color).call(i.dashLine,o.dash||"",o.width||0),"none"!==r.fill&&e.call(a.fill,r.fillcolor)})}(t,e)}},{"../../components/color":613,"../../components/drawing":638,"../scatter/style":1075,d3:123}],1102:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../components/colorscale/color_attributes"),a=t("../../constants/gl2d_dashes"),o=t("../../constants/gl2d_markers"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll,c=n.line,u=n.marker,h=u.line,f=e.exports=l({x:n.x,x0:n.x0,dx:n.dx,y:n.y,y0:n.y0,dy:n.dy,text:s({},n.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:c.color,width:c.width,dash:{valType:"enumerated",values:Object.keys(a),dflt:"solid"}},marker:s({},i("marker"),{symbol:{valType:"enumerated",values:Object.keys(o),dflt:"circle",arrayOk:!0},size:u.size,sizeref:u.sizeref,sizemin:u.sizemin,sizemode:u.sizemode,opacity:u.opacity,showscale:u.showscale,colorbar:u.colorbar,line:s({},i("marker.line"),{width:h.width})}),connectgaps:n.connectgaps,fill:s({},n.fill,{values:["none","tozeroy","tozerox"]}),fillcolor:n.fillcolor,error_y:n.error_y,error_x:n.error_x},"calc","nested");f.x.editType=f.y.editType=f.x0.editType=f.y0.editType="calc+clearAxisTypes"},{"../../components/colorscale/color_attributes":621,"../../constants/gl2d_dashes":712,"../../constants/gl2d_markers":713,"../../lib/extend":727,"../../plot_api/edit_types":769,"../scatter/attributes":1054}],1103:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../scatter/arrays_to_calcdata"),a=t("../scatter/colorscale_calc");e.exports=function(t,e){var r,o=t._fullLayout.dragmode;if("lasso"===o||"select"===o){var s,l=n.getFromId(t,e.xaxis||"x"),c=n.getFromId(t,e.yaxis||"y"),u=l.makeCalcdata(e,"x"),h=c.makeCalcdata(e,"y"),f=Math.min(u.length,h.length);for(r=new Array(f),s=0;s<f;s++)r[s]={x:u[s],y:h[s]}}else i(r=[{x:!1,y:!1,trace:e,t:{}}],e);return a(e),r}},{"../../plots/cartesian/axes":785,"../scatter/arrays_to_calcdata":1053,"../scatter/colorscale_calc":1059}],1104:[function(t,e,r){"use strict";function n(t,e){this.scene=t,this.uid=e,this.type="scattergl",this.pickXData=[],this.pickYData=[],this.xData=[],this.yData=[],this.textLabels=[],this.color="rgb(0, 0, 0)",this.name="",this.hoverinfo="all",this.connectgaps=!0,this.index=null,this.idToIndex=[],this.bounds=[0,0,0,0],this.isVisible=!1,this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1,this.line=this.initObject(d,{positions:new Float64Array(0),color:[0,0,0,1],width:1,fill:[!1,!1,!1,!1],fillColor:[[0,0,0,1],[0,0,0,1],[0,0,0,1],[0,0,0,1]],dashes:[1]},0),this.errorX=this.initObject(p,{positions:new Float64Array(0),errors:new Float64Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},1),this.errorY=this.initObject(p,{positions:new Float64Array(0),errors:new Float64Array(0),lineWidth:1,capSize:0,color:[0,0,0,1]},2);var r={positions:new Float64Array(0),sizes:[],colors:[],glyphs:[],borderWidths:[],borderColors:[],size:12,color:[0,0,0,1],borderSize:1,borderColor:[0,0,0,1],snapPoints:!0},n=g.extendFlat({},r,{snapPoints:!1});this.scatter=this.initObject(h,r,3),this.fancyScatter=this.initObject(f,r,4),this.selectScatter=this.initObject(h,n,5)}function i(t,e,r){return Array.isArray(e)||(e=[e]),a(t,e,r)}function a(t,e,r){for(var n=new Array(r),i=e[0],a=0;a<r;++a)n[a]=a>=e.length?t(i):t(e[a]);return n}function o(t,e,r){return l(D(t,r),P(e,r),r)}function s(t,e,r,n){var i=w(t,e,n);return i=Array.isArray(i[0])?i:a(g.identity,[i],n),l(i,P(r,n),n)}function l(t,e,r){for(var n=new Array(4*r),i=0;i<r;++i){for(var a=0;a<3;++a)n[4*i+a]=t[i][a];n[4*i+3]=t[i][3]*e[i]}return n}function c(t){return""===t.split("-open")[1]}function u(t,e,r,n,i){var a,o=i?E:1;for(a=0;a<3;a++)t[4*r+a]=e[4*n+a];t[4*r+a]=o*e[4*n+a]}var h=t("gl-scatter2d"),f=t("gl-scatter2d-sdf"),d=t("gl-line2d"),p=t("gl-error2d"),m=t("fast-isnumeric"),g=t("../../lib"),v=t("../../plots/cartesian/axes"),y=t("../../plots/cartesian/axis_autotype"),b=t("../../components/errorbars"),x=t("../../lib/str2rgbarray"),_=t("../../lib/typed_array_truncate"),w=t("../../lib/gl_format_color"),M=t("../scatter/subtypes"),k=t("../scatter/make_bubble_size_func"),T=t("../scatter/get_trace_color"),A=t("../../constants/gl2d_markers"),S=t("../../constants/gl2d_dashes"),E=t("../../constants/interactions").DESELECTDIM,L=["xaxis","yaxis"],C=[0,0,0,0],I=n.prototype;I.initObject=function(t,e,r){var n=this,i=n.scene.glplot,a=g.extendFlat({},e),o=null;return{options:e,update:function(){o||((o=t(i,e))._trace=n,o._index=r),o.update(e)},clear:function(){o&&o.update(a)},dispose:function(){o&&o.dispose()}}},I.handlePick=function(t){var e=t.pointId;(t.object!==this.line||this.connectgaps)&&(e=this.idToIndex[t.pointId]);var r=this.pickXData[e];return{trace:this,dataCoord:t.dataCoord,traceCoord:[m(r)||!g.isDateTime(r)?r:g.dateTime2ms(r),this.pickYData[e]],textLabel:Array.isArray(this.textLabels)?this.textLabels[e]:this.textLabels,color:Array.isArray(this.color)?this.color[e]:this.color,name:this.name,pointIndex:e,hoverinfo:this.hoverinfo}},I.isFancy=function(t){if("linear"!==this.scene.xaxis.type&&"date"!==this.scene.xaxis.type)return!0;if("linear"!==this.scene.yaxis.type)return!0;if(!t.x||!t.y)return!0;if(this.hasMarkers){var e=t.marker||{};if(Array.isArray(e.symbol)||"circle"!==e.symbol||Array.isArray(e.size)||Array.isArray(e.color)||Array.isArray(e.line.width)||Array.isArray(e.line.color)||Array.isArray(e.opacity))return!0}return!(!this.hasLines||this.connectgaps)||(!!this.hasErrorX||!!this.hasErrorY)};var P=i.bind(null,function(t){return+t}),D=i.bind(null,x),z=i.bind(null,function(t){return A[t]?t:"circle"});I.update=function(t,e){!0!==t.visible?(this.isVisible=!1,this.hasLines=!1,this.hasErrorX=!1,this.hasErrorY=!1,this.hasMarkers=!1):(this.isVisible=!0,this.hasLines=M.hasLines(t),this.hasErrorX=!0===t.error_x.visible,this.hasErrorY=!0===t.error_y.visible,this.hasMarkers=M.hasMarkers(t)),this.textLabels=t.text,this.name=t.name,this.hoverinfo=t.hoverinfo,this.bounds=[1/0,1/0,-1/0,-1/0],this.connectgaps=!!t.connectgaps,this.isVisible?this.isFancy(t)?this.updateFancy(t):this.updateFast(t):(this.line.clear(),this.errorX.clear(),this.errorY.clear(),this.scatter.clear(),this.fancyScatter.clear()),this.scene.glplot.objects.sort(function(t,e){return t._index-e._index}),this.index=t.index,this.color=T(t,{}),e&&e[0]&&!e[0]._glTrace&&(e[0]._glTrace=this)},I.updateFast=function(t){var e,r,n,i,a,o=this.xData=this.pickXData=t.x,s=this.yData=this.pickYData=t.y,l=o.length,c=new Array(l),u=new Float64Array(2*l),h=this.bounds,f=0,d=0,p=t.selection,v=t.xcalendar,b=function(t){for(var e,r=t.length,n=Math.max(1,(r-1)/Math.min(Math.max(r,1),1e3)),i=0;i<r;i+=n)if(e=t[Math.floor(i)],!(m(e)||e instanceof Date))return!1;return!0}(o),w=!b&&"date"===y(o,v);if(b||w)for(e=0;e<l;++e)i=o[e],a=s[e],m(a)&&(b||(i=g.dateTime2ms(i,v)),u[d++]=i,u[d++]=a,c[f++]=e,h[0]=Math.min(h[0],i),h[1]=Math.min(h[1],a),h[2]=Math.max(h[2],i),h[3]=Math.max(h[3],a));if(u=_(u,d),this.idToIndex=c,p&&p.length)for(r=new Float64Array(2*p.length),e=0,n=p.length;e<n;e++)r[2*e+0]=p[e].x,r[2*e+1]=p[e].y;this.updateLines(t,u),this.updateError("X",t),this.updateError("Y",t);var M;if(this.hasMarkers){var k,T,A;r?(this.scatter.options.positions=null,k=x(t.marker.color),T=x(t.marker.line.color),A=t.opacity*t.marker.opacity*E,k[3]*=A,this.scatter.options.color=k,T[3]*=A,this.scatter.options.borderColor=T,M=t.marker.size,this.scatter.options.size=M,this.scatter.options.borderSize=t.marker.line.width,this.scatter.update(),this.scatter.options.positions=u,this.selectScatter.options.positions=r,k=x(t.marker.color),T=x(t.marker.line.color),A=t.opacity*t.marker.opacity,k[3]*=A,this.selectScatter.options.color=k,T[3]*=A,this.selectScatter.options.borderColor=T,M=t.marker.size,this.selectScatter.options.size=M,this.selectScatter.options.borderSize=t.marker.line.width,this.selectScatter.update()):(this.scatter.options.positions=u,k=x(t.marker.color),T=x(t.marker.line.color),A=t.opacity*t.marker.opacity,k[3]*=A,this.scatter.options.color=k,T[3]*=A,this.scatter.options.borderColor=T,M=t.marker.size,this.scatter.options.size=M,this.scatter.options.borderSize=t.marker.line.width,this.scatter.update())}else this.scatter.clear();this.fancyScatter.clear(),this.expandAxesFast(h,M)},I.updateFancy=function(t){var e=this.scene,r=e.xaxis,n=e.yaxis,a=this.bounds,o=t.selection,l=this.pickXData=r.makeCalcdata(t,"x").slice(),h=this.pickYData=n.makeCalcdata(t,"y").slice();this.xData=l.slice(),this.yData=h.slice();var f,d,p,m,g,v,y,x=b.calcFromTrace(t,e.fullLayout),w=l.length,M=new Array(w),T=new Float64Array(2*w),S=new Float64Array(4*w),E=new Float64Array(4*w),L=0,I=0,D=0,O=0,F="log"===r.type?r.d2l:function(t){return t},R="log"===n.type?n.d2l:function(t){return t};for(f=0;f<w;++f)this.xData[f]=d=F(l[f]),this.yData[f]=p=R(h[f]),isNaN(d)||isNaN(p)||(M[L++]=f,T[I++]=d,T[I++]=p,m=S[D++]=d-x[f].xs||0,g=S[D++]=x[f].xh-d||0,S[D++]=0,S[D++]=0,E[O++]=0,E[O++]=0,v=E[O++]=p-x[f].ys||0,y=E[O++]=x[f].yh-p||0,a[0]=Math.min(a[0],d-m),a[1]=Math.min(a[1],p-v),a[2]=Math.max(a[2],d+g),a[3]=Math.max(a[3],p+y));T=_(T,I),this.idToIndex=M,this.updateLines(t,T),this.updateError("X",t,T,S),this.updateError("Y",t,T,E);var j,N;if(o&&o.length)for(N={},f=0;f<o.length;f++)N[o[f].pointNumber]=!0;if(this.hasMarkers){this.scatter.options.positions=T,this.scatter.options.sizes=new Array(L),this.scatter.options.glyphs=new Array(L),this.scatter.options.borderWidths=new Array(L),this.scatter.options.colors=new Array(4*L),this.scatter.options.borderColors=new Array(4*L);var B,U,V,H,q,G,Y,W,X,Z,J=k(t),K=t.marker,Q=K.opacity,$=t.opacity,tt=z(K.symbol,w),et=s(K,Q,$,w),rt=P(K.line.width,w),nt=s(K.line,Q,$,w);for(j=i(J,K.size,w),f=0;f<L;++f)V=tt[B=M[f]],H=A[V],q=c(V),G=N&&!N[B],Y=H.noBorder&&!q?nt:et,W=q?et:nt,U=j[B],X=rt[B],Z=H.noBorder||H.noFill?.1*U:0,this.scatter.options.sizes[f]=4*U,this.scatter.options.glyphs[f]=H.unicode,this.scatter.options.borderWidths[f]=.5*(X>Z?X-Z:0),!q||H.noBorder||H.noFill?u(this.scatter.options.colors,Y,f,B,G):u(this.scatter.options.colors,C,f,0),u(this.scatter.options.borderColors,W,f,B,G);N?(this.scatter.options.positions=null,this.fancyScatter.update(),this.scatter.options.positions=T):this.fancyScatter.update()}else this.fancyScatter.clear();this.scatter.clear(),this.expandAxesFancy(l,h,j)},I.updateLines=function(t,e){var r;if(this.hasLines){var n=e;if(!t.connectgaps){var i=0,a=this.xData,s=this.yData;for(n=new Float64Array(2*a.length),r=0;r<a.length;++r)n[i++]=a[r],n[i++]=s[r]}this.line.options.positions=n;var l=o(t.line.color,t.opacity,1),c=Math.round(.5*this.line.options.width),u=(S[t.line.dash]||[1]).slice();for(r=0;r<u.length;++r)u[r]*=c;switch(t.fill){case"tozeroy":this.line.options.fill=[!1,!0,!1,!1];break;case"tozerox":this.line.options.fill=[!0,!1,!1,!1];break;default:this.line.options.fill=[!1,!1,!1,!1]}var h=x(t.fillcolor);this.line.options.color=l,this.line.options.width=2*t.line.width,this.line.options.dashes=u,this.line.options.fillColor=[h,h,h,h],this.line.update()}else this.line.clear()},I.updateError=function(t,e,r,n){var i=this["error"+t],a=e["error_"+t.toLowerCase()];"x"===t.toLowerCase()&&a.copy_ystyle&&(a=e.error_y),this["hasError"+t]?(i.options.positions=r,i.options.errors=n,i.options.capSize=a.width,i.options.lineWidth=a.thickness/2,i.options.color=o(a.color,1,1),i.update()):i.clear()},I.expandAxesFast=function(t,e){for(var r,n,i,a=e||10,o=0;o<2;o++)(n=(r=this.scene[L[o]])._min)||(n=[]),n.push({val:t[o],pad:a}),(i=r._max)||(i=[]),i.push({val:t[o+2],pad:a})},I.expandAxesFancy=function(t,e,r){var n=this.scene,i={padded:!0,ppad:r};v.expand(n.xaxis,t,i),v.expand(n.yaxis,e,i)},I.dispose=function(){this.line.dispose(),this.errorX.dispose(),this.errorY.dispose(),this.scatter.dispose(),this.fancyScatter.dispose()},e.exports=function(t,e,r){var i=new n(t,e.uid);return i.update(e,r),i}},{"../../components/errorbars":644,"../../constants/gl2d_dashes":712,"../../constants/gl2d_markers":713,"../../constants/interactions":716,"../../lib":738,"../../lib/gl_format_color":734,"../../lib/str2rgbarray":760,"../../lib/typed_array_truncate":765,"../../plots/cartesian/axes":785,"../../plots/cartesian/axis_autotype":786,"../scatter/get_trace_color":1064,"../scatter/make_bubble_size_func":1071,"../scatter/subtypes":1076,"fast-isnumeric":132,"gl-error2d":160,"gl-line2d":171,"gl-scatter2d":249,"gl-scatter2d-sdf":244}],1105:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/xy_defaults"),s=t("../scatter/marker_defaults"),l=t("../scatter/line_defaults"),c=t("../scatter/fillcolor_defaults"),u=t("../../components/errorbars/defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p=o(t,e,f,d);p?(d("text"),d("mode",p<i.PTS_LINESONLY?"lines+markers":"lines"),a.hasLines(e)&&(d("connectgaps"),l(t,e,r,f,d)),a.hasMarkers(e)&&s(t,e,r,f,d,{noSelect:!0}),d("fill"),"none"!==e.fill&&c(t,e,r,d),u(t,e,r,{axis:"y"}),u(t,e,r,{axis:"x",inherit:"y"})):e.visible=!1}},{"../../components/errorbars/defaults":643,"../../lib":738,"../scatter/constants":1060,"../scatter/fillcolor_defaults":1063,"../scatter/line_defaults":1067,"../scatter/marker_defaults":1072,"../scatter/subtypes":1076,"../scatter/xy_defaults":1078,"./attributes":1102}],1106:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.hoverPoints=t("../scatter/hover"),n.calc=t("./calc"),n.plot=t("./convert"),n.selectPoints=t("./select"),n.moduleType="trace",n.name="scattergl",n.basePlotModule=t("../../plots/gl2d"),n.categories=["gl","gl2d","symbols","errorBarsOK","markerColorscale","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/gl2d":823,"../scatter/colorbar":1058,"../scatter/hover":1065,"./attributes":1102,"./calc":1103,"./convert":1104,"./defaults":1105,"./select":1107}],1107:[function(t,e,r){"use strict";var n=t("../scatter/subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,c=t.yaxis,u=[],h=s[0].trace,f=s[0]._glTrace;if(f){var d=f.scene;if(!n.hasMarkers(h)&&!n.hasText(h))return[];if(!1===e)for(r=0;r<s.length;r++)s[r].dim=0;else for(r=0;r<s.length;r++)i=s[r],a=l.c2p(i.x),o=c.c2p(i.y),e.contains([a,o])?(u.push({pointNumber:r,x:l.c2d(i.x),y:c.c2d(i.y)}),i.dim=0):i.dim=1;return h.selection=u,f.update(h,s),d.glplot.setDirty(),u}}},{"../scatter/subtypes":1076}],1108:[function(t,e,r){"use strict";var n=t("../scattergeo/attributes"),i=t("../scatter/attributes"),a=t("../../plots/mapbox/layout_attributes"),o=t("../../plots/attributes"),s=t("../../components/colorbar/attributes"),l=t("../../lib/extend").extendFlat,c=t("../../plot_api/edit_types").overrideAll,u=n.line,h=n.marker;e.exports=c({lon:n.lon,lat:n.lat,mode:l({},i.mode,{dflt:"markers"}),text:l({},i.text,{}),hovertext:l({},i.hovertext,{}),line:{color:u.color,width:u.width},connectgaps:i.connectgaps,marker:{symbol:{valType:"string",dflt:"circle",arrayOk:!0},opacity:h.opacity,size:h.size,sizeref:h.sizeref,sizemin:h.sizemin,sizemode:h.sizemode,color:h.color,colorscale:h.colorscale,cauto:h.cauto,cmax:h.cmax,cmin:h.cmin,autocolorscale:h.autocolorscale,reversescale:h.reversescale,showscale:h.showscale,colorbar:s},fill:n.fill,fillcolor:i.fillcolor,textfont:a.layers.symbol.textfont,textposition:a.layers.symbol.textposition,selected:{marker:{opacity:i.selected.marker.opacity}},unselected:{marker:{opacity:i.unselected.marker.opacity}},hoverinfo:l({},o.hoverinfo,{flags:["lon","lat","text","name"]})},"calc","nested")},{"../../components/colorbar/attributes":614,"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/attributes":783,"../../plots/mapbox/layout_attributes":842,"../scatter/attributes":1054,"../scattergeo/attributes":1093}],1109:[function(t,e,r){"use strict";function n(){return{geojson:h.makeBlank(),layout:{visibility:"none"},paint:{}}}function i(t){return Array.isArray(t)?function(t){return t}:t?function(){return t}:a}function a(){return""}function o(t,e){return t[0]-e[0]}function s(t){return t[0]===u}var l=t("fast-isnumeric"),c=t("../../lib"),u=t("../../constants/numerical").BADNUM,h=t("../../lib/geojson_utils"),f=t("../../components/colorscale"),d=t("../scatter/make_bubble_size_func"),p=t("../scatter/subtypes"),m=t("../../plots/mapbox/convert_text_opts"),g=t("../../constants/interactions").DESELECTDIM,v="circle-color",y="circle-radius",b="circle-opacity";e.exports=function(t){var e=t[0].trace,r=!0===e.visible,u="none"!==e.fill,x=p.hasLines(e),_=p.hasMarkers(e),w=p.hasText(e),M=_&&"circle"===e.marker.symbol,k=_&&"circle"!==e.marker.symbol,T=n(),A=n(),S=n(),E=n(),L={fill:T,line:A,circle:S,symbol:E};if(!r)return L;var C;if((u||x)&&(C=h.calcTraceToLineCoords(t)),u&&(T.geojson=h.makePolygon(C),T.layout.visibility="visible",c.extendFlat(T.paint,{"fill-color":e.fillcolor})),x&&(A.geojson=h.makeLine(C),A.layout.visibility="visible",c.extendFlat(A.paint,{"line-width":e.line.width,"line-color":e.line.color,"line-opacity":e.opacity})),M){var I={};I[v]={},I[y]={},I[b]={},S.geojson=function(t,e){function r(t,r,n,i){void 0===e[r][n]&&(e[r][n]=i),t[r]=e[r][n]}var n,i=t[0].trace,a=i.marker;f.hasColorscale(i,"marker")?n=f.makeColorScaleFunc(f.extractScale(a.colorscale,a.cmin,a.cmax)):Array.isArray(a.color)&&(n=c.identity);var o;p.isBubble(i)&&(o=d(i));var u;u=i.selectedpoints?function(t,e){return i.opacity*e*(t.selected?1:g)}:function(t,e){return i.opacity*e};var h;Array.isArray(a.opacity)?h=function(t){var e=l(t.mo)?+c.constrain(t.mo,0,1):0;return u(t,e)}:i.selectedpoints&&(h=function(t){return u(t,a.opacity)});for(var m=[],x=0;x<t.length;x++){var _=t[x],w=_.lonlat;if(!s(w)){var M={};if(n){var k=_.mcc=n(_.mc);r(M,v,k,x)}o&&r(M,y,o(_.ms),x),h&&r(M,b,h(_),x),m.push({type:"Feature",geometry:{type:"Point",coordinates:w},properties:M})}}return{type:"FeatureCollection",features:m}}(t,I),S.layout.visibility="visible",c.extendFlat(S.paint,{"circle-opacity":function(t,e){var r,n=t.marker;if(Array.isArray(n.opacity)||t.selectedpoints){for(var i=Object.keys(e[b]),a=[],s=0;s<i.length;s++){var l=i[s];a.push([e[b][l],+l])}r={property:b,stops:a.sort(o)}}else r=t.opacity*n.opacity;return r}(e,I),"circle-color":function(t,e){var r,n=t.marker;if(Array.isArray(n.color)){for(var i=Object.keys(e[v]),a=[],o=0;o<i.length;o++){var s=i[o];a.push([e[v][s],s])}r={property:v,stops:a}}else r=n.color;return r}(e,I),"circle-radius":function(t,e){var r,n=t.marker;if(Array.isArray(n.size)){for(var i=Object.keys(e[y]),a=[],s=0;s<i.length;s++){var l=i[s];a.push([e[y][l],+l])}r={property:y,stops:a.sort(o)}}else r=n.size/2;return r}(e,I)})}if((k||w)&&(E.geojson=function(t){for(var e=t[0].trace,r=(e.marker||{}).symbol,n=e.text,o="circle"!==r?i(r):a,l=p.hasText(e)?i(n):a,c=[],u=0;u<t.length;u++){var h=t[u];s(h.lonlat)||c.push({type:"Feature",geometry:{type:"Point",coordinates:h.lonlat},properties:{symbol:o(h.mx),text:l(h.tx)}})}return{type:"FeatureCollection",features:c}}(t),c.extendFlat(E.layout,{visibility:"visible","icon-image":"{symbol}-15","text-field":"{text}"}),k&&(c.extendFlat(E.layout,{"icon-size":e.marker.size/10}),c.extendFlat(E.paint,{"icon-opacity":e.opacity*e.marker.opacity,"icon-color":e.marker.color})),w)){var P=(e.marker||{}).size,D=m(e.textposition,P);c.extendFlat(E.layout,{"text-size":e.textfont.size,"text-anchor":D.anchor,"text-offset":D.offset}),c.extendFlat(E.paint,{"text-color":e.textfont.color,"text-opacity":e.opacity})}return L}},{"../../components/colorscale":628,"../../constants/interactions":716,"../../constants/numerical":717,"../../lib":738,"../../lib/geojson_utils":731,"../../plots/mapbox/convert_text_opts":839,"../scatter/make_bubble_size_func":1071,"../scatter/subtypes":1076,"fast-isnumeric":132}],1110:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/subtypes"),a=t("../scatter/marker_defaults"),o=t("../scatter/line_defaults"),s=t("../scatter/text_defaults"),l=t("../scatter/fillcolor_defaults"),c=t("./attributes");e.exports=function(t,e,r,u){function h(r,i){return n.coerce(t,e,c,r,i)}if(function(t,e,r){var n=r("lon")||[],i=r("lat")||[],a=Math.min(n.length,i.length);return a<n.length&&(e.lon=n.slice(0,a)),a<i.length&&(e.lat=i.slice(0,a)),a}(0,e,h)){if(h("text"),h("hovertext"),h("mode"),i.hasLines(e)&&(o(t,e,r,u,h,{noDash:!0}),h("connectgaps")),i.hasMarkers(e)){a(t,e,r,u,h,{noLine:!0,noSelect:!0});var f=e.marker;f.line={width:0},"circle"!==f.symbol&&(Array.isArray(f.size)&&(f.size=f.size[0]),Array.isArray(f.color)&&(f.color=f.color[0]))}i.hasText(e)&&s(t,e,u,h,{noSelect:!0}),h("fill"),"none"!==e.fill&&l(t,e,r,h),n.coerceSelectionMarkerOpacity(e,h)}else e.visible=!1}},{"../../lib":738,"../scatter/fillcolor_defaults":1063,"../scatter/line_defaults":1067,"../scatter/marker_defaults":1072,"../scatter/subtypes":1076,"../scatter/text_defaults":1077,"./attributes":1108}],1111:[function(t,e,r){"use strict";e.exports=function(t,e){return t.lon=e.lon,t.lat=e.lat,t}},{}],1112:[function(t,e,r){"use strict";var n=t("../../components/fx"),i=t("../scatter/get_trace_color"),a=t("../scatter/fill_hover_text"),o=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){var s=t.cd,l=s[0].trace,c=t.xa,u=t.ya,h=360*(e>=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),f=e-h;if(n.getClosest(s,function(t){var e=t.lonlat;if(e[0]===o)return 1/0;var n=Math.abs(c.c2p(e)-c.c2p([f,e[1]])),i=Math.abs(u.c2p(e)-u.c2p([e[0],r])),a=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(n*n+i*i)-a,1-3/a)},t),!1!==t.index){var d=s[t.index],p=d.lonlat,m=[p[0]+h,p[1]],g=c.c2p(m),v=u.c2p(m),y=d.mrc||1;return t.x0=g-y,t.x1=g+y,t.y0=v-y,t.y1=v+y,t.color=i(l,d),t.extraText=function(t,e,r){function n(t){return t+"\xb0"}var i=(e.hi||t.hoverinfo).split("+"),o=-1!==i.indexOf("all"),s=-1!==i.indexOf("lon"),l=-1!==i.indexOf("lat"),c=e.lonlat,u=[];return o||s&&l?u.push("("+n(c[0])+", "+n(c[1])+")"):s?u.push(r.lon+n(c[0])):l&&u.push(r.lat+n(c[1])),(o||-1!==i.indexOf("text"))&&a(e,t,u),u.join("<br>")}(l,d,s[0].t.labels),[t]}}},{"../../components/fx":655,"../../constants/numerical":717,"../scatter/fill_hover_text":1062,"../scatter/get_trace_color":1064}],1113:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("../scattergeo/calc"),n.plot=t("./plot"),n.hoverPoints=t("./hover"),n.eventData=t("./event_data"),n.selectPoints=t("./select"),n.style=function(t,e){if(e){e[0].trace._glTrace.update(e)}},n.moduleType="trace",n.name="scattermapbox",n.basePlotModule=t("../../plots/mapbox"),n.categories=["mapbox","gl","symbols","markerColorscale","showLegend","scatterlike"],n.meta={},e.exports=n},{"../../plots/mapbox":840,"../scatter/colorbar":1058,"../scattergeo/calc":1094,"./attributes":1108,"./defaults":1110,"./event_data":1111,"./hover":1112,"./plot":1114,"./select":1115}],1114:[function(t,e,r){"use strict";function n(t,e){this.mapbox=t,this.map=t.map,this.uid=e,this.idSourceFill=e+"-source-fill",this.idSourceLine=e+"-source-line",this.idSourceCircle=e+"-source-circle",this.idSourceSymbol=e+"-source-symbol",this.idLayerFill=e+"-layer-fill",this.idLayerLine=e+"-layer-line",this.idLayerCircle=e+"-layer-circle",this.idLayerSymbol=e+"-layer-symbol",this.mapbox.initSource(this.idSourceFill),this.mapbox.initSource(this.idSourceLine),this.mapbox.initSource(this.idSourceCircle),this.mapbox.initSource(this.idSourceSymbol),this.map.addLayer({id:this.idLayerFill,source:this.idSourceFill,type:"fill"}),this.map.addLayer({id:this.idLayerLine,source:this.idSourceLine,type:"line"}),this.map.addLayer({id:this.idLayerCircle,source:this.idSourceCircle,type:"circle"}),this.map.addLayer({id:this.idLayerSymbol,source:this.idSourceSymbol,type:"symbol"})}function i(t){return"visible"===t.layout.visibility}var a=t("./convert"),o=n.prototype;o.update=function(t){var e=this.mapbox,r=a(t);e.setOptions(this.idLayerFill,"setLayoutProperty",r.fill.layout),e.setOptions(this.idLayerLine,"setLayoutProperty",r.line.layout),e.setOptions(this.idLayerCircle,"setLayoutProperty",r.circle.layout),e.setOptions(this.idLayerSymbol,"setLayoutProperty",r.symbol.layout),i(r.fill)&&(e.setSourceData(this.idSourceFill,r.fill.geojson),e.setOptions(this.idLayerFill,"setPaintProperty",r.fill.paint)),i(r.line)&&(e.setSourceData(this.idSourceLine,r.line.geojson),e.setOptions(this.idLayerLine,"setPaintProperty",r.line.paint)),i(r.circle)&&(e.setSourceData(this.idSourceCircle,r.circle.geojson),e.setOptions(this.idLayerCircle,"setPaintProperty",r.circle.paint)),i(r.symbol)&&(e.setSourceData(this.idSourceSymbol,r.symbol.geojson),e.setOptions(this.idLayerSymbol,"setPaintProperty",r.symbol.paint)),t[0].trace._glTrace=this},o.dispose=function(){var t=this.map;t.removeLayer(this.idLayerFill),t.removeLayer(this.idLayerLine),t.removeLayer(this.idLayerCircle),t.removeLayer(this.idLayerSymbol),t.removeSource(this.idSourceFill),t.removeSource(this.idSourceLine),t.removeSource(this.idSourceCircle),t.removeSource(this.idSourceSymbol)},e.exports=function(t,e){var r=new n(t,e[0].trace.uid);return r.update(e),r}},{"./convert":1109}],1115:[function(t,e,r){"use strict";var n=t("../scatter/subtypes");e.exports=function(t,e){var r,i,a,o,s,l=t.cd,c=t.xaxis,u=t.yaxis,h=[],f=l[0].trace;if(!n.hasMarkers(f))return[];if(!1===e)for(s=0;s<l.length;s++)l[s].selected=0;else for(s=0;s<l.length;s++)i=(r=l[s]).lonlat,a=c.c2p(i),o=u.c2p(i),e.contains([a,o])?(h.push({pointNumber:s,lon:i[0],lat:i[1]}),r.selected=1):r.selected=0;return h}},{"../scatter/subtypes":1076}],1116:[function(t,e,r){"use strict";var n=t("../scatter/attributes"),i=t("../../plots/attributes"),a=t("../../components/colorscale/color_attributes"),o=t("../../components/colorbar/attributes"),s=t("../../components/drawing/attributes").dash,l=t("../../lib/extend").extendFlat,c=n.marker,u=n.line,h=c.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:l({},n.mode,{dflt:"markers"}),text:l({},n.text,{}),hovertext:l({},n.hovertext,{}),line:{color:u.color,width:u.width,dash:s,shape:l({},u.shape,{values:["linear","spline"]}),smoothing:u.smoothing,editType:"calc"},connectgaps:n.connectgaps,cliponaxis:n.cliponaxis,fill:l({},n.fill,{values:["none","toself","tonext"]}),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"},a("marker.line")),gradient:c.gradient,editType:"calc"},a("marker"),{showscale:c.showscale,colorbar:o}),textfont:n.textfont,textposition:n.textposition,selected:n.selected,unselected:n.unselected,hoverinfo:l({},i.hoverinfo,{flags:["a","b","c","text","name"]}),hoveron:n.hoveron}},{"../../components/colorbar/attributes":614,"../../components/colorscale/color_attributes":621,"../../components/drawing/attributes":637,"../../lib/extend":727,"../../plots/attributes":783,"../scatter/attributes":1054}],1117:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../plots/cartesian/axes"),a=t("../scatter/subtypes"),o=t("../scatter/colorscale_calc"),s=t("../scatter/arrays_to_calcdata"),l=t("../scatter/calc_selection"),c=["a","b","c"],u={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,h,f,d,p,m,g=t._fullLayout[e.subplot].sum,v=e.sum||g;for(r=0;r<c.length;r++)if(f=c[r],!e[f]){for(p=e[u[f][0]],m=e[u[f][1]],d=new Array(p.length),h=0;h<p.length;h++)d[h]=v-p[h]-m[h];e[f]=d}var y,b,x,_,w,M,k=e.a.length,T=new Array(k);for(r=0;r<k;r++)y=e.a[r],b=e.b[r],x=e.c[r],n(y)&&n(b)&&n(x)?(1!==(_=g/((y=+y)+(b=+b)+(x=+x)))&&(y*=_,b*=_,x*=_),M=y,w=x-b,T[r]={x:w,y:M,a:y,b:b,c:x}):T[r]={x:!1,y:!1};var A,S;if(a.hasMarkers(e)&&(A=e.marker,S=A.size,Array.isArray(S))){var E={type:"linear"};i.setConvert(E),(S=E.makeCalcdata(e.marker,"size")).length>k&&S.splice(k,S.length-k)}return o(e),s(T,e),l(T,e),T}},{"../../plots/cartesian/axes":785,"../scatter/arrays_to_calcdata":1053,"../scatter/calc_selection":1056,"../scatter/colorscale_calc":1059,"../scatter/subtypes":1076,"fast-isnumeric":132}],1118:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../scatter/constants"),a=t("../scatter/subtypes"),o=t("../scatter/marker_defaults"),s=t("../scatter/line_defaults"),l=t("../scatter/line_shape_defaults"),c=t("../scatter/text_defaults"),u=t("../scatter/fillcolor_defaults"),h=t("./attributes");e.exports=function(t,e,r,f){function d(r,i){return n.coerce(t,e,h,r,i)}var p,m=d("a"),g=d("b"),v=d("c");if(m?(p=m.length,g?(p=Math.min(p,g.length),v&&(p=Math.min(p,v.length))):p=v?Math.min(p,v.length):0):g&&v&&(p=Math.min(g.length,v.length)),p){m&&p<m.length&&(e.a=m.slice(0,p)),g&&p<g.length&&(e.b=g.slice(0,p)),v&&p<v.length&&(e.c=v.slice(0,p)),d("sum"),d("text"),d("hovertext");d("mode",p<i.PTS_LINESONLY?"lines+markers":"lines"),a.hasLines(e)&&(s(t,e,r,f,d),l(t,e,d),d("connectgaps")),a.hasMarkers(e)&&o(t,e,r,f,d,{gradient:!0}),a.hasText(e)&&c(t,e,f,d);var y=[];(a.hasMarkers(e)||a.hasText(e))&&(d("marker.maxdisplayed"),y.push("points")),d("fill"),"none"!==e.fill&&(u(t,e,r,d),a.hasLines(e)||l(t,e,d)),"tonext"!==e.fill&&"toself"!==e.fill||y.push("fills"),d("hoveron",y.join("+")||"points"),d("cliponaxis"),n.coerceSelectionMarkerOpacity(e,d)}else e.visible=!1}},{"../../lib":738,"../scatter/constants":1060,"../scatter/fillcolor_defaults":1063,"../scatter/line_defaults":1067,"../scatter/line_shape_defaults":1069,"../scatter/marker_defaults":1072,"../scatter/subtypes":1076,"../scatter/text_defaults":1077,"./attributes":1116}],1119:[function(t,e,r){"use strict";e.exports=function(t,e,r,n,i){if(e.xa&&(t.xaxis=e.xa),e.ya&&(t.yaxis=e.ya),n[i]){var a=n[i];t.a=a.a,t.b=a.b,t.c=a.c}else t.a=e.a,t.b=e.b,t.c=e.c;return t}},{}],1120:[function(t,e,r){"use strict";var n=t("../scatter/hover"),i=t("../../plots/cartesian/axes");e.exports=function(t,e,r,a){function o(t,e){v.push(t._hovertitle+": "+i.tickText(t,e,"hover").text)}var s=n(t,e,r,a);if(s&&!1!==s[0].index){var l=s[0];if(void 0===l.index){var c=1-l.y0/t.ya._length,u=t.xa._length,h=u*c/2,f=u-h;return l.x0=Math.max(Math.min(l.x0,f),h),l.x1=Math.max(Math.min(l.x1,f),h),s}var d=l.cd[l.index];l.a=d.a,l.b=d.b,l.c=d.c,l.xLabelVal=void 0,l.yLabelVal=void 0;var p=l.trace,m=p._ternary,g=(d.hi||p.hoverinfo).split("+"),v=[];return-1!==g.indexOf("all")&&(g=["a","b","c"]),-1!==g.indexOf("a")&&o(m.aaxis,d.a),-1!==g.indexOf("b")&&o(m.baxis,d.b),-1!==g.indexOf("c")&&o(m.caxis,d.c),l.extraText=v.join("<br>"),s}}},{"../../plots/cartesian/axes":785,"../scatter/hover":1065}],1121:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("../scatter/colorbar"),n.calc=t("./calc"),n.plot=t("./plot"),n.style=t("./style"),n.hoverPoints=t("./hover"),n.selectPoints=t("../scatter/select"),n.eventData=t("./event_data"),n.moduleType="trace",n.name="scatterternary",n.basePlotModule=t("../../plots/ternary"),n.categories=["ternary","symbols","markerColorscale","showLegend","scatter-like"],n.meta={},e.exports=n},{"../../plots/ternary":854,"../scatter/colorbar":1058,"../scatter/select":1074,"./attributes":1116,"./calc":1117,"./defaults":1118,"./event_data":1119,"./hover":1120,"./plot":1122,"./style":1123}],1122:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e){var r=t.plotContainer;r.select(".scatterlayer").selectAll("*").remove();for(var i={xaxis:t.xaxis,yaxis:t.yaxis,plot:r,layerClipId:t._hasClipOnAxisFalse?t.clipIdRelative:null},a=0;a<e.length;a++)e[a][0].trace._ternary=t;n(t.graphDiv,i,e)}},{"../scatter/plot":1073}],1123:[function(t,e,r){arguments[4][1092][0].apply(r,arguments)},{"../scatter/style":1075,dup:1092}],1124:[function(t,e,r){"use strict";function n(t){return{show:{valType:"boolean",dflt:!1},project:{x:{valType:"boolean",dflt:!1},y:{valType:"boolean",dflt:!1},z:{valType:"boolean",dflt:!1}},color:{valType:"color",dflt:i.defaultLine},usecolormap:{valType:"boolean",dflt:!1},width:{valType:"number",min:1,max:16,dflt:2},highlight:{valType:"boolean",dflt:!0},highlightcolor:{valType:"color",dflt:i.defaultLine},highlightwidth:{valType:"number",min:1,max:16,dflt:2}}}var i=t("../../components/color"),a=t("../../components/colorscale/attributes"),o=t("../../components/colorbar/attributes"),s=t("../../lib/extend").extendFlat,l=t("../../plot_api/edit_types").overrideAll,c=e.exports=l({z:{valType:"data_array"},x:{valType:"data_array"},y:{valType:"data_array"},text:{valType:"data_array"},surfacecolor:{valType:"data_array"},cauto:a.zauto,cmin:a.zmin,cmax:a.zmax,colorscale:a.colorscale,autocolorscale:s({},a.autocolorscale,{dflt:!1}),reversescale:a.reversescale,showscale:a.showscale,colorbar:o,contours:{x:n(),y:n(),z:n()},hidesurface:{valType:"boolean",dflt:!1},lightposition:{x:{valType:"number",min:-1e5,max:1e5,dflt:10},y:{valType:"number",min:-1e5,max:1e5,dflt:1e4},z:{valType:"number",min:-1e5,max:1e5,dflt:0}},lighting:{ambient:{valType:"number",min:0,max:1,dflt:.8},diffuse:{valType:"number",min:0,max:1,dflt:.8},specular:{valType:"number",min:0,max:2,dflt:.05},roughness:{valType:"number",min:0,max:1,dflt:.5},fresnel:{valType:"number",min:0,max:5,dflt:.2}},opacity:{valType:"number",min:0,max:1,dflt:1},_deprecated:{zauto:s({},a.zauto,{}),zmin:s({},a.zmin,{}),zmax:s({},a.zmax,{})}},"calc","nested");c.x.editType=c.y.editType=c.z.editType="calc+clearAxisTypes"},{"../../components/color":613,"../../components/colorbar/attributes":614,"../../components/colorscale/attributes":619,"../../lib/extend":727,"../../plot_api/edit_types":769}],1125:[function(t,e,r){"use strict";var n=t("../../components/colorscale/calc");e.exports=function(t,e){e.surfacecolor?n(e,e.surfacecolor,"","c"):n(e,e.z,"","c")}},{"../../components/colorscale/calc":620}],1126:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../../lib"),a=t("../../plots/plots"),o=t("../../components/colorscale"),s=t("../../components/colorbar/draw");e.exports=function(t,e){var r=e[0].trace,l="cb"+r.uid,c=r.cmin,u=r.cmax,h=r.surfacecolor||r.z;if(n(c)||(c=i.aggNums(Math.min,null,h)),n(u)||(u=i.aggNums(Math.max,null,h)),t._fullLayout._infolayer.selectAll("."+l).remove(),r.showscale){var f=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,c,u),{noNumericCheck:!0});f.fillcolor(d).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}else a.autoMargin(t,l)}},{"../../components/colorbar/draw":617,"../../components/colorscale":628,"../../lib":738,"../../plots/plots":846,"fast-isnumeric":132}],1127:[function(t,e,r){"use strict";function n(t,e,r){this.scene=t,this.uid=r,this.surface=e,this.data=null,this.showContour=[!1,!1,!1],this.dataScale=1}function i(t){var e=t.shape,r=[e[0]+2,e[1]+2],n=o(new Float32Array(r[0]*r[1]),r);return c.assign(n.lo(1,1).hi(e[0],e[1]),t),c.assign(n.lo(1).hi(e[0],1),t.hi(e[0],1)),c.assign(n.lo(1,r[1]-1).hi(e[0],1),t.lo(0,e[1]-1).hi(e[0],1)),c.assign(n.lo(0,1).hi(1,e[1]),t.hi(1)),c.assign(n.lo(r[0]-1,1).hi(1,e[1]),t.lo(e[0]-1)),n.set(0,0,t.get(0,0)),n.set(0,r[1]-1,t.get(0,e[1]-1)),n.set(r[0]-1,0,t.get(e[0]-1,0)),n.set(r[0]-1,r[1]-1,t.get(e[0]-1,e[1]-1)),n}var a=t("gl-surface3d"),o=t("ndarray"),s=t("ndarray-homography"),l=t("ndarray-fill"),c=t("ndarray-ops"),u=t("tinycolor2"),h=t("../../lib/str2rgbarray"),f=128,d=n.prototype;d.handlePick=function(t){if(t.object===this.surface){var e=t.index=[Math.min(0|Math.round(t.data.index[0]/this.dataScale-1),this.data.z[0].length-1),Math.min(0|Math.round(t.data.index[1]/this.dataScale-1),this.data.z.length-1)],r=[0,0,0];Array.isArray(this.data.x[0])?r[0]=this.data.x[e[1]][e[0]]:r[0]=this.data.x[e[0]],Array.isArray(this.data.y[0])?r[1]=this.data.y[e[1]][e[0]]:r[1]=this.data.y[e[1]],r[2]=this.data.z[e[1]][e[0]],t.traceCoordinate=r;var n=this.scene.fullSceneLayout;t.dataCoordinate=[n.xaxis.d2l(r[0],0,this.data.xcalendar)*this.scene.dataScale[0],n.yaxis.d2l(r[1],0,this.data.ycalendar)*this.scene.dataScale[1],n.zaxis.d2l(r[2],0,this.data.zcalendar)*this.scene.dataScale[2]];var i=this.data.text;return i&&i[e[1]]&&void 0!==i[e[1]][e[0]]?t.textLabel=i[e[1]][e[0]]:t.textLabel="",t.data.dataCoordinate=t.dataCoordinate.slice(),this.surface.highlight(t.data),this.scene.glplot.spikes.position=t.dataCoordinate,!0}},d.setContourLevels=function(){for(var t=[[],[],[]],e=!1,r=0;r<3;++r)this.showContour[r]&&(e=!0,t[r]=this.scene.contourLevels[r]);e&&this.surface.update({levels:t})},d.update=function(t){var e,r=this.scene,n=r.fullSceneLayout,a=this.surface,c=t.opacity,d=function(t,e){return void 0===e&&(e=1),t.map(function(t){var r=t[0],n=u(t[1]).toRgb();return{index:r,rgb:[n.r,n.g,n.b,e]}})}(t.colorscale,c),p=t.z,m=t.x,g=t.y,v=n.xaxis,y=n.yaxis,b=n.zaxis,x=r.dataScale,_=p[0].length,w=p.length,M=[o(new Float32Array(_*w),[_,w]),o(new Float32Array(_*w),[_,w]),o(new Float32Array(_*w),[_,w])],k=M[0],T=M[1],A=r.contourLevels;this.data=t;var S=t.xcalendar,E=t.ycalendar,L=t.zcalendar;l(M[2],function(t,e){return b.d2l(p[e][t],0,L)*x[2]}),Array.isArray(m[0])?l(k,function(t,e){return v.d2l(m[e][t],0,S)*x[0]}):l(k,function(t){return v.d2l(m[t],0,S)*x[0]}),Array.isArray(g[0])?l(T,function(t,e){return y.d2l(g[e][t],0,E)*x[1]}):l(T,function(t,e){return y.d2l(g[e],0,E)*x[1]});var C={colormap:d,levels:[[],[],[]],showContour:[!0,!0,!0],showSurface:!t.hidesurface,contourProject:[[!1,!1,!1],[!1,!1,!1],[!1,!1,!1]],contourWidth:[1,1,1],contourColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],contourTint:[1,1,1],dynamicColor:[[1,1,1,1],[1,1,1,1],[1,1,1,1]],dynamicWidth:[1,1,1],dynamicTint:[1,1,1],opacity:t.opacity};if(C.intensityBounds=[t.cmin,t.cmax],t.surfacecolor){var I=o(new Float32Array(_*w),[_,w]);l(I,function(e,r){return t.surfacecolor[r][e]}),M.push(I)}else C.intensityBounds[0]*=x[2],C.intensityBounds[1]*=x[2];this.dataScale=function(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(e<f){for(var r=f/e,n=[0|Math.floor(t[0].shape[0]*r+1),0|Math.floor(t[0].shape[1]*r+1)],a=n[0]*n[1],l=0;l<t.length;++l){var c=i(t[l]),u=o(new Float32Array(a),n);s(u,c,[r,0,0,0,r,0,0,0,1]),t[l]=u}return r}return 1}(M),t.surfacecolor&&(C.intensity=M.pop());var P=[!0,!0,!0],D=["x","y","z"];for(e=0;e<3;++e){var z=t.contours[D[e]];P[e]=z.highlight,C.showContour[e]=z.show||z.highlight,C.showContour[e]&&(C.contourProject[e]=[z.project.x,z.project.y,z.project.z],z.show?(this.showContour[e]=!0,C.levels[e]=A[e],a.highlightColor[e]=C.contourColor[e]=h(z.color),z.usecolormap?a.highlightTint[e]=C.contourTint[e]=0:a.highlightTint[e]=C.contourTint[e]=1,C.contourWidth[e]=z.width):this.showContour[e]=!1,z.highlight&&(C.dynamicColor[e]=h(z.highlightcolor),C.dynamicWidth[e]=z.highlightwidth))}(function(t){var e=t[0].rgb,r=t[t.length-1].rgb;return e[0]===r[0]&&e[1]===r[1]&&e[2]===r[2]&&e[3]===r[3]})(d)&&(C.vertexColor=!0),C.coords=M,a.update(C),a.visible=t.visible,a.enableDynamic=P,a.snapToData=!0,"lighting"in t&&(a.ambientLight=t.lighting.ambient,a.diffuseLight=t.lighting.diffuse,a.specularLight=t.lighting.specular,a.roughness=t.lighting.roughness,a.fresnel=t.lighting.fresnel),"lightposition"in t&&(a.lightPosition=[t.lightposition.x,t.lightposition.y,t.lightposition.z]),c&&c<1&&(a.supportsTransparency=!0)},d.dispose=function(){this.scene.glplot.remove(this.surface),this.surface.dispose()},e.exports=function(t,e){var r=t.glplot.gl,i=a({gl:r}),o=new n(t,i,e.uid);return i._trace=o,o.update(e),t.glplot.add(i),o}},{"../../lib/str2rgbarray":760,"gl-surface3d":267,ndarray:468,"ndarray-fill":458,"ndarray-homography":460,"ndarray-ops":462,tinycolor2:543}],1128:[function(t,e,r){"use strict";function n(t,e,r){e in t&&!(r in t)&&(t[r]=t[e])}var i=t("../../registry"),a=t("../../lib"),o=t("../../components/colorscale/defaults"),s=t("./attributes");e.exports=function(t,e,r,l){function c(r,n){return a.coerce(t,e,s,r,n)}var u,h,f=c("z");if(f){var d=f[0].length,p=f.length;c("x"),c("y");if(i.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y","z"],l),!Array.isArray(e.x))for(e.x=[],u=0;u<d;++u)e.x[u]=u;if(c("text"),!Array.isArray(e.y))for(e.y=[],u=0;u<p;++u)e.y[u]=u;["lighting.ambient","lighting.diffuse","lighting.specular","lighting.roughness","lighting.fresnel","lightposition.x","lightposition.y","lightposition.z","hidesurface","opacity"].forEach(function(t){c(t)});var m=c("surfacecolor");c("colorscale");var g=["x","y","z"];for(u=0;u<3;++u){var v="contours."+g[u],y=c(v+".show"),b=c(v+".highlight");if(y||b)for(h=0;h<3;++h)c(v+".project."+g[h]);y&&(c(v+".color"),c(v+".width"),c(v+".usecolormap")),b&&(c(v+".highlightcolor"),c(v+".highlightwidth"))}m||(n(t,"zmin","cmin"),n(t,"zmax","cmax"),n(t,"zauto","cauto")),o(t,e,l,c,{prefix:"",cLetter:"c"})}else e.visible=!1}},{"../../components/colorscale/defaults":623,"../../lib":738,"../../registry":861,"./attributes":1124}],1129:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.colorbar=t("./colorbar"),n.calc=t("./calc"),n.plot=t("./convert"),n.moduleType="trace",n.name="surface",n.basePlotModule=t("../../plots/gl3d"),n.categories=["gl3d","2dMap","noOpacity"],n.meta={},e.exports=n},{"../../plots/gl3d":826,"./attributes":1124,"./calc":1125,"./colorbar":1126,"./convert":1127,"./defaults":1128}],1130:[function(t,e,r){"use strict";var n=t("../../components/annotations/attributes"),i=t("../../lib/extend").extendFlat,a=t("../../plot_api/edit_types").overrideAll,o=t("../../plots/font_attributes");e.exports=a({domain:{x:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]},y:{valType:"info_array",items:[{valType:"number",min:0,max:1},{valType:"number",min:0,max:1}],dflt:[0,1]}},columnwidth:{valType:"number",arrayOk:!0,dflt:null},columnorder:{valType:"data_array"},header:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[]},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:28},align:i({},n.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:i({},o({arrayOk:!0}))},cells:{values:{valType:"data_array",dflt:[]},format:{valType:"data_array",dflt:[]},prefix:{valType:"string",arrayOk:!0,dflt:null},suffix:{valType:"string",arrayOk:!0,dflt:null},height:{valType:"number",dflt:20},align:i({},n.align,{arrayOk:!0}),line:{width:{valType:"number",arrayOk:!0,dflt:1},color:{valType:"color",arrayOk:!0,dflt:"grey"}},fill:{color:{valType:"color",arrayOk:!0,dflt:"white"}},font:i({},o({arrayOk:!0}))}},"calc","from-root")},{"../../components/annotations/attributes":596,"../../lib/extend":727,"../../plot_api/edit_types":769,"../../plots/font_attributes":810}],1131:[function(t,e,r){"use strict";var n=t("../../plots/get_data").getModuleCalcData,i=t("./plot");r.name="table",r.plot=function(t){var e=n(t.calcdata,"table");e.length&&i(t,e)},r.clean=function(t,e,r,n){var i=n._has&&n._has("table"),a=e._has&&e._has("table");i&&!a&&n._paperdiv.selectAll(".table").remove()}},{"../../plots/get_data":820,"./plot":1138}],1132:[function(t,e,r){"use strict";var n=t("../../lib/gup").wrap;e.exports=function(t,e){return n(e)}},{"../../lib/gup":735}],1133:[function(t,e,r){"use strict";e.exports={maxDimensionCount:60,overdrag:45,cellPad:8,latexCheck:/^\$.*\$$/,wrapSplitCharacter:" ",wrapSpacer:" ",lineBreaker:"<br>",uplift:5,goldenRatio:1.618,columnTitleOffset:28,columnExtentOffset:10,transitionEase:"cubic-out",transitionDuration:100,releaseTransitionEase:"cubic-out",releaseTransitionDuration:120,scrollbarWidth:8,scrollbarCaptureWidth:18,scrollbarOffset:5,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,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"}}},{}],1134:[function(t,e,r){"use strict";function n(t){return t.calcdata.columns.reduce(function(e,r){return r.xIndex<t.xIndex?e+r.columnWidth:e},0)}function i(t,e){return Object.keys(t).map(function(r){return s({},t[r],{auxiliaryBlocks:e})})}function a(t,e){for(var r,n={},i=0,a=0,o={firstRowIndex:null,lastRowIndex:null,rows:[]},s=0,l=0,c=0;c<t.length;c++)r=t[c],o.rows.push({rowIndex:c,rowHeight:r}),((a+=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}var o=t("./constants"),s=t("../../lib/extend").extendFlat,l=t("fast-isnumeric");e.exports=function(t,e){var r=e.header.values.map(function(t){return Array.isArray(t)?t:[t]}),c=e.cells.values,u=e.domain,h=Math.floor(t._fullLayout._size.w*(u.x[1]-u.x[0])),f=Math.floor(t._fullLayout._size.h*(u.y[1]-u.y[0])),d=r.length?r[0].map(function(){return e.header.height}):[],p=c.length?c[0].map(function(){return e.cells.height}):[],m=d.reduce(function(t,e){return t+e},0),g=a(p,f-m+o.uplift),v=i(a(d,m),[]),y=i(g,v),b={},x=e._fullInput.columnorder,_=r.map(function(t,r){var n=Array.isArray(e.columnwidth)?e.columnwidth[Math.min(r,e.columnwidth.length-1)]:e.columnwidth;return l(n)?Number(n):1}),w=_.reduce(function(t,e){return t+e},0);_=_.map(function(t){return t/w*h});var M={key:e.index,translateX:u.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-u.y[1]),size:t._fullLayout._size,width:h,height:f,columnOrder:x,groupHeight:f,rowBlocks:y,headerRowBlocks:v,scrollY:0,cells:e.cells,headerCells:s({},e.header,{values:r}),gdColumns:r.map(function(t){return t[0]}),gdColumnsOriginalOrder:r.map(function(t){return t[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:r.map(function(t,e){var r=b[t];b[t]=(r||0)+1;return{key:t+"__"+b[t],label:t,specIndex:e,xIndex:x[e],xScale:n,x:void 0,calcdata:void 0,columnWidth:_[e]}})};return M.columns.forEach(function(t){t.calcdata=M,t.x=n(t)}),M}},{"../../lib/extend":727,"./constants":1133,"fast-isnumeric":132}],1135:[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;return[r,e?r+e.rows.length:0]}(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":727}],1136:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes");e.exports=function(t,e,r,a){function o(r,a){return n.coerce(t,e,i,r,a)}o("domain.x"),o("domain.y"),o("columnwidth"),o("header.values"),o("header.format"),o("header.align"),o("header.prefix"),o("header.suffix"),o("header.height"),o("header.line.width"),o("header.line.color"),o("header.fill.color"),n.coerceFont(o,"header.font",n.extendFlat({},a.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<n;s++)o.push(s);e("columnorder",o)}(e,o),o("cells.values"),o("cells.format"),o("cells.align"),o("cells.prefix"),o("cells.suffix"),o("cells.height"),o("cells.line.width"),o("cells.line.color"),o("cells.fill.color"),n.coerceFont(o,"cells.font",n.extendFlat({},a.font))}},{"../../lib":738,"./attributes":1130}],1137:[function(t,e,r){"use strict";var n={};n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.calc=t("./calc"),n.plot=t("./plot"),n.moduleType="trace",n.name="table",n.basePlotModule=t("./base_plot"),n.categories=["noOpacity"],n.meta={},e.exports=n},{"./attributes":1130,"./base_plot":1131,"./calc":1132,"./defaults":1136,"./plot":1138}],1138:[function(t,e,r){"use strict";function n(t,e){return"clip"+t._fullLayout._uid+"_scrollAreaBottomClip_"+e.key}function i(t,e){return"clip"+t._fullLayout._uid+"_columnBoundaryClippath_"+e.calcdata.key+"_"+e.specIndex}function a(t){return[].concat.apply([],t.map(function(t){return t})).map(function(t){return t.__data__})}function o(t,e,r){var n=t.selectAll("."+T.cn.scrollbarKit).data(S.repeat,S.keyFun);n.enter().append("g").classed(T.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),n.each(function(t){var e=t.scrollbarState;e.totalHeight=function(t){var e=t.rowBlocks;return w(e,e.length-1)+(e.length?M(e[e.length-1],1/0):1)}(t),e.scrollableAreaHeight=t.groupHeight-p(t),e.currentlyVisibleHeight=Math.min(e.totalHeight,e.scrollableAreaHeight),e.ratio=e.currentlyVisibleHeight/e.totalHeight,e.barLength=Math.max(e.ratio*e.currentlyVisibleHeight,T.goldenRatio*T.scrollbarWidth),e.barWiggleRoom=e.currentlyVisibleHeight-e.barLength,e.wiggleRoom=Math.max(0,e.totalHeight-e.scrollableAreaHeight),e.topY=0===e.barWiggleRoom?0:t.scrollY/e.wiggleRoom*e.barWiggleRoom,e.bottomY=e.topY+e.barLength,e.dragMultiplier=e.wiggleRoom/e.barWiggleRoom}).attr("transform",function(t){return"translate("+(t.width+T.scrollbarWidth/2+T.scrollbarOffset)+" "+p(t)+")"});var i=n.selectAll("."+T.cn.scrollbar).data(S.repeat,S.keyFun);i.enter().append("g").classed(T.cn.scrollbar,!0);var a=i.selectAll("."+T.cn.scrollbarSlider).data(S.repeat,S.keyFun);a.enter().append("g").classed(T.cn.scrollbarSlider,!0),a.attr("transform",function(t){return"translate(0 "+(t.scrollbarState.topY||0)+")"});var o=a.selectAll("."+T.cn.scrollbarGlyph).data(S.repeat,S.keyFun);o.enter().append("line").classed(T.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",T.scrollbarWidth).attr("stroke-linecap","round").attr("y1",T.scrollbarWidth/2),o.attr("y2",function(t){return t.scrollbarState.barLength-T.scrollbarWidth/2}).attr("stroke-opacity",function(t){return t.columnDragInProgress||!t.scrollbarState.barWiggleRoom||r?0:.4}),o.transition().delay(0).duration(0),o.transition().delay(T.scrollbarHideDelay).duration(T.scrollbarHideDuration).attr("stroke-opacity",0);var s=i.selectAll("."+T.cn.scrollbarCaptureZone).data(S.repeat,S.keyFun);s.enter().append("line").classed(T.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",T.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(r){var n=A.event.y,i=this.getBoundingClientRect(),a=r.scrollbarState,o=n-i.top,s=A.scale.linear().domain([0,a.scrollableAreaHeight]).range([0,a.totalHeight]).clamp(!0);a.topY<=o&&o<=a.bottomY||g(e,t,null,s(o-a.barLength/2))(r)}).call(A.behavior.drag().origin(function(t){return A.event.stopPropagation(),t.scrollbarState.scrollbarScrollInProgress=!0,t}).on("drag",g(e,t)).on("dragend",function(){})),s.attr("y2",function(t){return t.scrollbarState.scrollableAreaHeight})}function s(t,e,r,n){var i=function(t){var e=t.selectAll("."+T.cn.columnCell).data(D.splitToCells,function(t){return t.keyWithinBlock});return e.enter().append("g").classed(T.cn.columnCell,!0),e.exit().remove(),e}(function(t){var e=t.selectAll("."+T.cn.columnCells).data(S.repeat,S.keyFun);return e.enter().append("g").classed(T.cn.columnCells,!0),e.exit().remove(),e}(r));!function(t){t.each(function(t,e){var r=t.calcdata.cells.font,n=t.column.specIndex,i={size:u(r.size,n,e),color:u(r.color,n,e),family:u(r.family,n,e)};t.rowNumber=t.key,t.align=u(t.calcdata.cells.align,n,e),t.cellBorderWidth=u(t.calcdata.cells.line.width,n,e),t.font=i})}(i);!function(t){t.attr("width",function(t){return t.column.columnWidth}).attr("stroke-width",function(t){return t.cellBorderWidth}).each(function(t){var e=A.select(this);z.stroke(e,u(t.calcdata.cells.line.color,t.column.specIndex,t.rowNumber)),z.fill(e,u(t.calcdata.cells.fill.color,t.column.specIndex,t.rowNumber))})}(function(t){var e=t.selectAll("."+T.cn.cellRect).data(S.repeat,function(t){return t.keyWithinBlock});return e.enter().append("rect").classed(T.cn.cellRect,!0),e}(i));var a=function(t){var e=t.selectAll("."+T.cn.cellText).data(S.repeat,function(t){return t.keyWithinBlock});return e.enter().append("text").classed(T.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){A.event.stopPropagation()}),e}(function(t){var e=t.selectAll("."+T.cn.cellTextHolder).data(S.repeat,function(t){return t.keyWithinBlock});return e.enter().append("g").classed(T.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),e}(i));!function(t){t.each(function(t){E.font(A.select(this),t.font)})}(a),l(a,e,n,t),_(i)}function l(t,e,r,n){t.text(function(t){var e=t.column.specIndex,r=t.rowNumber,n=t.value,i="string"==typeof n,a=i&&n.match(/<br>/i),o=!i||a;t.mayHaveMarkup=i&&n.match(/[<&>]/);var s=function(t){return"string"==typeof t&&t.match(T.latexCheck)}(n);t.latex=s;var l,h=s?"":u(t.calcdata.cells.prefix,e,r)||"",f=s?"":u(t.calcdata.cells.suffix,e,r)||"",d=s?null:u(t.calcdata.cells.format,e,r)||null,p=h+(d?A.format(d)(t.value):t.value)+f;t.wrappingNeeded=!t.wrapped&&!o&&!s&&(l=c(p)),t.cellHeightMayIncrease=a||s||t.mayHaveMarkup||(void 0===l?c(p):l),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex;var m;if(t.wrappingNeeded){var g=(" "===T.wrapSplitCharacter?p.replace(/<a href=/gi,"<a_href="):p).split(T.wrapSplitCharacter),v=" "===T.wrapSplitCharacter?g.map(function(t){return t.replace(/<a_href=/gi,"<a href=")}):g;t.fragments=v.map(function(t){return{text:t,width:null}}),t.fragments.push({fragment:T.wrapSpacer,width:null}),m=v.join(T.lineBreaker)+T.lineBreaker+T.wrapSpacer}else delete t.fragments,m=p;return m}).attr("dy",function(t){return t.needsConvertToTspans?0:"0.75em"}).each(function(t){var i=A.select(this),a=t.wrappingNeeded?y:b;t.needsConvertToTspans?L.convertToTspans(i,n,a(r,this,e,n,t)):A.select(this.parentNode).attr("transform",function(t){return"translate("+x(t)+" "+T.cellPad+")"}).attr("text-anchor",function(t){return{left:"start",center:"middle",right:"end"}[t.align]})})}function c(t){return-1!==t.indexOf(T.wrapSplitCharacter)}function u(t,e,r){if(Array.isArray(t)){var n=t[Math.min(e,t.length-1)];return Array.isArray(n)?n[Math.min(r,n.length-1)]:n}return t}function h(t,e,r){t.transition().ease(T.releaseTransitionEase).duration(T.releaseTransitionDuration).attr("transform","translate("+e.x+" "+r+")")}function f(t){return"cells"===t.type}function d(t){return"header"===t.type}function p(t){return(t.rowBlocks.length?t.rowBlocks[0].auxiliaryBlocks:[]).reduce(function(t,e){return t+M(e,1/0)},0)}function m(t,e,r){var n=a(e)[0];if(void 0!==n){var i=n.rowBlocks,s=n.calcdata,l=w(i,i.length),c=n.calcdata.groupHeight-p(n),u=s.scrollY=Math.max(0,Math.min(l-c,s.scrollY)),h=function(t,e,r){for(var n=[],i=0,a=0;a<t.length;a++){for(var o=t[a],s=o.rows,l=0,c=0;c<s.length;c++)l+=s[c].rowHeight;o.allRowsHeight=l,e<i+l&&e+r>i&&n.push(a),i+=l}return n}(i,u,c);1===h.length&&(h[0]===i.length-1?h.unshift(h[0]-1):h.push(h[0]+1)),h[0]%2&&h.reverse(),e.each(function(t,e){t.page=h[e],t.scrollY=u}),e.attr("transform",function(t){return"translate(0 "+(w(t.rowBlocks,t.page)-t.scrollY)+")"}),t&&(v(t,r,e,h,n.prevPages,n,0),v(t,r,e,h,n.prevPages,n,1),o(r,t))}}function g(t,e,r,n){return function(i){var a=i.calcdata?i.calcdata:i,o=e.filter(function(t){return a.key===t.key}),s=r||a.scrollbarState.dragMultiplier;a.scrollY=void 0===n?a.scrollY+s*A.event.dy:n;var l=o.selectAll("."+T.cn.yColumn).selectAll("."+T.cn.columnBlock).filter(f);m(t,l,o)}}function v(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]});s(t,e,a,r),i[o]=n[o]}))}function y(t,e,r){return function(){var n=A.select(e.parentNode);n.each(function(t){var e=t.fragments;n.selectAll("tspan.line").each(function(t,r){e[r].width=this.getComputedTextLength()});var r,i,a=e[e.length-1].width,o=e.slice(0,-1),s=[],l=0,c=t.column.columnWidth-2*T.cellPad;for(t.value="";o.length;)l+(i=(r=o.shift()).width+a)>c&&(t.value+=s.join(T.wrapSpacer)+T.lineBreaker,s=[],l=0),s.push(r.text),l+=i;l&&(t.value+=s.join(T.wrapSpacer)),t.wrapped=!0}),n.selectAll("tspan.line").remove(),l(n.select("."+T.cn.cellText),r,t),A.select(e.parentNode.parentNode).call(_)}}function b(t,e,r,n,i){return function(){if(!i.settledY){var a=A.select(e.parentNode),s=k(i),l=i.key-s.firstRowIndex,c=s.rows[l].rowHeight,u=i.cellHeightMayIncrease?e.parentNode.getBoundingClientRect().height+2*T.cellPad:c,h=Math.max(u,c);h-s.rows[l].rowHeight&&(s.rows[l].rowHeight=h,t.selectAll("."+T.cn.columnCell).call(_),m(null,t.filter(f),0),o(r,n,!0)),a.attr("transform",function(){var t=this.parentNode.getBoundingClientRect(),e=A.select(this.parentNode).select("."+T.cn.cellRect).node().getBoundingClientRect(),r=this.transform.baseVal.consolidate(),n=e.top-t.top+(r?r.matrix.f:T.cellPad);return"translate("+x(i,A.select(this.parentNode).select("."+T.cn.cellTextHolder).node().getBoundingClientRect().width)+" "+n+")"}),i.settledY=!0}}}function x(t,e){switch(t.align){case"left":return T.cellPad;case"right":return t.column.columnWidth-(e||0)-T.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return T.cellPad}}function _(t){t.attr("transform",function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,e){return t+M(e,1/0)},0);return"translate(0 "+(M(k(t),t.key)+e)+")"}).selectAll("."+T.cn.cellRect).attr("height",function(t){return function(t,e){return t.rows[e-t.firstRowIndex]}(k(t),t.key).rowHeight})}function w(t,e){for(var r=0,n=e-1;n>=0;n--)r+=function(t){var e=t.allRowsHeight;if(void 0!==e)return e;for(var r=0,n=0;n<t.rows.length;n++)r+=t.rows[n].rowHeight;return t.allRowsHeight=r,r}(t[n]);return r}function M(t,e){for(var r=0,n=0;n<t.rows.length&&t.rows[n].rowIndex<e;n++)r+=t.rows[n].rowHeight;return r}function k(t){return t.rowBlocks[t.page]}var T=t("./constants"),A=t("d3"),S=t("../../lib/gup"),E=t("../../components/drawing"),L=t("../../lib/svg_text_utils"),C=t("../../lib").raiseToTop,I=t("../../lib").cancelTransition,P=t("./data_preparation_helper"),D=t("./data_split_helpers"),z=t("../../components/color");e.exports=function(t,e){var r=t._fullLayout._paper.selectAll("."+T.cn.table).data(e.map(function(e){var r=S.unwrap(e).trace;return P(t,r)}),S.keyFun);r.exit().remove(),r.enter().append("g").classed(T.cn.table,!0).attr("overflow","visible").style("box-sizing","content-box").style("position","absolute").style("left",0).style("overflow","visible").style("shape-rendering","crispEdges").style("pointer-events","all"),r.attr("width",function(t){return t.width+t.size.l+t.size.r}).attr("height",function(t){return t.height+t.size.t+t.size.b}).attr("transform",function(t){return"translate("+t.translateX+","+t.translateY+")"});var l=r.selectAll("."+T.cn.tableControlView).data(S.repeat,S.keyFun);l.enter().append("g").classed(T.cn.tableControlView,!0).style("box-sizing","content-box").on("mousemove",function(e){l.filter(function(t){return e===t}).call(o,t)}).on("mousewheel",function(e){e.scrollbarState.wheeling||(e.scrollbarState.wheeling=!0,A.event.stopPropagation(),A.event.preventDefault(),g(t,l,null,e.scrollY+A.event.deltaY)(e),e.scrollbarState.wheeling=!1)}).call(o,t,!0),l.attr("transform",function(t){return"translate("+t.size.l+" "+t.size.t+")"});var c=l.selectAll("."+T.cn.scrollBackground).data(S.repeat,S.keyFun);c.enter().append("rect").classed(T.cn.scrollBackground,!0).attr("fill","none"),c.attr("width",function(t){return t.width}).attr("height",function(t){return t.height}),l.each(function(e){E.setClipUrl(A.select(this),n(t,e))});var u=l.selectAll("."+T.cn.yColumn).data(function(t){return t.columns},S.keyFun);u.enter().append("g").classed(T.cn.yColumn,!0),u.exit().remove(),u.attr("transform",function(t){return"translate("+t.x+" 0)"}).call(A.behavior.drag().origin(function(e){return h(A.select(this),e,-T.uplift),C(this),e.calcdata.columnDragInProgress=!0,o(l.filter(function(t){return e.calcdata.key===t.key}),t),e}).on("drag",function(t){var e=A.select(this),r=function(e){return(t===e?A.event.x:e.x)+e.columnWidth/2};t.x=Math.max(-T.overdrag,Math.min(t.calcdata.width+T.overdrag-t.columnWidth,A.event.x));a(u).filter(function(e){return e.calcdata.key===t.calcdata.key}).sort(function(t,e){return r(t)-r(e)}).forEach(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e)}),u.filter(function(e){return t!==e}).transition().ease(T.transitionEase).duration(T.transitionDuration).attr("transform",function(t){return"translate("+t.x+" 0)"}),e.call(I).attr("transform","translate("+t.x+" -"+T.uplift+" )")}).on("dragend",function(e){var r=A.select(this),n=e.calcdata;e.x=e.xScale(e),e.calcdata.columnDragInProgress=!1,h(r,e,0),function(t,e,r){var n=e.gdColumnsOriginalOrder;e.gdColumns.sort(function(t,e){return r[n.indexOf(t)]-r[n.indexOf(e)]}),e.columnorder=r,t.emit("plotly_restyle")}(t,n,n.columns.map(function(t){return t.xIndex}))})),u.each(function(e){E.setClipUrl(A.select(this),i(t,e))});var p=u.selectAll("."+T.cn.columnBlock).data(D.splitToPanels,S.keyFun);p.enter().append("g").classed(T.cn.columnBlock,!0).attr("id",function(t){return t.key}),p.style("cursor",function(t){return t.dragHandle?"ew-resize":t.calcdata.scrollbarState.barWiggleRoom?"ns-resize":"default"});var v=p.filter(d),y=p.filter(f);y.call(A.behavior.drag().origin(function(t){return A.event.stopPropagation(),t}).on("drag",g(t,l,-1)).on("dragend",function(){})),s(t,l,v,p),s(t,l,y,p);var b=l.selectAll("."+T.cn.scrollAreaClip).data(S.repeat,S.keyFun);b.enter().append("clipPath").classed(T.cn.scrollAreaClip,!0).attr("id",function(e){return n(t,e)});var x=b.selectAll("."+T.cn.scrollAreaClipRect).data(S.repeat,S.keyFun);x.enter().append("rect").classed(T.cn.scrollAreaClipRect,!0).attr("x",-T.overdrag).attr("y",-T.uplift).attr("fill","none"),x.attr("width",function(t){return t.width+2*T.overdrag}).attr("height",function(t){return t.height+T.uplift});u.selectAll("."+T.cn.columnBoundary).data(S.repeat,S.keyFun).enter().append("g").classed(T.cn.columnBoundary,!0);var _=u.selectAll("."+T.cn.columnBoundaryClippath).data(S.repeat,S.keyFun);_.enter().append("clipPath").classed(T.cn.columnBoundaryClippath,!0),_.attr("id",function(e){return i(t,e)});var w=_.selectAll("."+T.cn.columnBoundaryRect).data(S.repeat,S.keyFun);w.enter().append("rect").classed(T.cn.columnBoundaryRect,!0).attr("fill","none"),w.attr("width",function(t){return t.columnWidth}).attr("height",function(t){return t.calcdata.height+T.uplift}),m(null,y,l)}},{"../../components/color":613,"../../components/drawing":638,"../../lib":738,"../../lib/gup":735,"../../lib/svg_text_utils":761,"./constants":1133,"./data_preparation_helper":1134,"./data_split_helpers":1135,d3:123}],1139:[function(t,e,r){"use strict";var n=t("../box/attributes"),i=t("../../lib/extend").extendFlat;e.exports={y:n.y,x:n.x,x0:n.x0,y0:n.y0,name:n.name,orientation:i({},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:i({},n.boxpoints,{}),jitter:i({},n.jitter,{}),pointpos:i({},n.pointpos,{}),marker:n.marker,text:n.text,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:"plot"},selected:n.selected,unselected:n.unselected,hoveron:{valType:"flaglist",flags:["violins","points","kde"],dflt:"violins+points+kde",extras:["all"],editType:"style"}}},{"../../lib/extend":727,"../box/attributes":884}],1140:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("../box/calc"),o=t("./helpers"),s=t("../../constants/numerical").BADNUM;e.exports=function(t,e){var r=a(t,e);if(r[0].t.empty)return r;var l=t._fullLayout,c=i.getFromId(t,e["h"===e.orientation?"xaxis":"yaxis"]),u=l._violinScaleGroupStats,h=e.scalegroup,f=u[h];f||(f=u[h]={maxWidth:0,maxCount:0});for(var d=0;d<r.length;d++){var p=r[d],m=p.pts.map(o.extractVal),g=m.length,v=function(t,e,r){return 1.059*Math.min(e,r/1.349)*Math.pow(t.length,-.2)}(m,n.stdev(m,g-1,p.mean),p.q3-p.q1),y=p.bandwidth=e.bandwidth||v,b=p.span=function(t,e,r,n){function a(n){var i=c[n],a=r.d2c(i,0,t[e.valLetter+"calendar"]);return a===s?h[n]:a}var o,l=t.spanmode,c=t.span||[],u=[e.min,e.max],h=[e.min-2*n,e.max+2*n],f={type:"linear",range:o="soft"===l?h:"hard"===l?u:[a(0),a(1)]};return i.setConvert(f),f.cleanRange(),o}(e,p,c,y),x=b[1]-b[0],_=Math.ceil(x/(Math.min(v,y)/3)),w=x/_;if(!isFinite(w)||!isFinite(_))return n.error("Something went wrong with computing the violin span"),r[0].t.empty=!0,r;var M=o.makeKDE(p,e,m);p.density=new Array(_);for(var k=0,T=b[0];T<b[1]+w/2;k++,T+=w){var A=M(T);f.maxWidth=Math.max(f.maxWidth,A),p.density[k]={v:A,t:T}}i.expand(c,b,{padded:!0}),f.maxCount=Math.max(f.maxCount,m.length)}return r[0].t.labels.kde=n._(t,"kde:"),r}},{"../../constants/numerical":717,"../../lib":738,"../../plots/cartesian/axes":785,"../box/calc":885,"./helpers":1142}],1141:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color"),a=t("../box/defaults"),o=t("./attributes");e.exports=function(t,e,r,s){function l(r,i){return n.coerce(t,e,o,r,i)}function c(r,i){return n.coerce2(t,e,o,r,i)}if(a.handleSampleDefaults(t,e,l,s),!1!==e.visible){l("bandwidth"),l("scalegroup",e.name),l("scalemode"),l("side");var u,h=l("span");Array.isArray(h)&&(u="manual"),l("spanmode",u);var f=l("line.color",(t.marker||{}).color||r),d=l("line.width"),p=l("fillcolor",i.addOpacity(e.line.color,.5));a.handlePointsDefaults(t,e,l,{prefix:""});var m=c("box.width"),g=c("box.fillcolor",p),v=c("box.line.color",f),y=c("box.line.width",d);l("box.visible",Boolean(m||g||v||y))||delete e.box;var b=c("meanline.color",f),x=c("meanline.width",d);l("meanline.visible",Boolean(b||x))||delete e.meanline}}},{"../../components/color":613,"../../lib":738,"../box/defaults":886,"./attributes":1139}],1142:[function(t,e,r){"use strict";var n=t("../../lib"),i=function(t){return 1/Math.sqrt(2*Math.PI)*Math.exp(-.5*t*t)};r.makeKDE=function(t,e,r){var n=r.length,a=i,o=t.bandwidth,s=1/(n*o);return function(t){for(var e=0,i=0;i<n;i++)e+=a((t-r[i])/o);return s*e}},r.getPositionOnKdePath=function(t,e,r){var i,a;"h"===e.orientation?(i="y",a="x"):(i="x",a="y");var o=n.findPointOnPath(t.path,r,a,{pathLength:t.pathLength}),s=t.posCenterPx,l=o[i];return[l,"both"===e.side?2*s-l:s]},r.getKdeValue=function(t,e,n){var i=t.pts.map(r.extractVal);return r.makeKDE(t,e,i)(n)/t.posDensityScale},r.extractVal=function(t){return t.v}},{"../../lib":738}],1143:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../plots/cartesian/axes"),a=t("../box/hover"),o=t("./helpers");e.exports=function(t,e,r,s,l){var c,u,h=t.cd,f=h[0].trace,d=f.hoveron,p=-1!==d.indexOf("violins"),m=-1!==d.indexOf("kde"),g=[];if(p||m){var v=a.hoverOnBoxes(t,e,r,s);if(p&&(g=g.concat(v)),m&&v.length>0){var y,b,x,_,w,M=t.xa,k=t.ya;"h"===f.orientation?(w=e,y="y",x=k,b="x",_=M):(w=r,y="x",x=M,b="y",_=k);var T=h[t.index];if(w>=T.span[0]&&w<=T.span[1]){var A=n.extendFlat({},t),S=_.c2p(w,!0),E=o.getKdeValue(T,f,w),L=o.getPositionOnKdePath(T,f,S),C=x._offset,I=x._length;A[y+"0"]=L[0],A[y+"1"]=L[1],A[b+"0"]=A[b+"1"]=S,A[b+"Label"]=b+": "+i.hoverLabelText(_,w)+", "+h[0].t.labels.kde+" "+E.toFixed(3),g.push(A),(u={stroke:t.color})[y+"1"]=n.constrain(C+L[0],C,C+I),u[y+"2"]=n.constrain(C+L[1],C,C+I),u[b+"1"]=u[b+"2"]=_._offset+S}}}-1!==d.indexOf("points")&&(c=a.hoverOnPoints(t,e,r));var P=l.selectAll(".violinline-"+f.uid).data(u?[0]:[]);return P.enter().append("line").classed("violinline-"+f.uid,!0).attr("stroke-width",1.5),P.exit().remove(),P.attr(u),"closest"===s?c?[c]:g:c?(g.push(c),g):g}},{"../../lib":738,"../../plots/cartesian/axes":785,"../box/hover":887,"./helpers":1142}],1144:[function(t,e,r){"use strict";e.exports={attributes:t("./attributes"),layoutAttributes:t("./layout_attributes"),supplyDefaults:t("./defaults"),supplyLayoutDefaults:t("./layout_defaults"),calc:t("./calc"),setPositions:t("./set_positions"),plot:t("./plot"),style:t("./style"),hoverPoints:t("./hover"),selectPoints:t("../box/select"),moduleType:"trace",name:"violin",basePlotModule:t("../../plots/cartesian"),categories:["cartesian","symbols","oriented","box-violin","showLegend"],meta:{}}},{"../../plots/cartesian":796,"../box/select":892,"./attributes":1139,"./calc":1140,"./defaults":1141,"./hover":1143,"./layout_attributes":1145,"./layout_defaults":1146,"./plot":1147,"./set_positions":1148,"./style":1149}],1145:[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":738,"../box/layout_attributes":889}],1146:[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":738,"../box/layout_defaults":890,"./layout_attributes":1145}],1147:[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){function c(t){var e=s(t,{xaxis:h,yaxis:f,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0});return a.smoothopen(e[0],1)}var u=t._fullLayout,h=e.xaxis,f=e.yaxis;e.plot.select(".violinlayer").selectAll("g.trace.violins").data(r).enter().append("g").attr("class","trace violins").each(function(t){var r=t[0],a=r.t,s=r.trace,d=r.node3=n.select(this),p=u._numViolins,m="group"===u.violinmode&&p>1,g=a.bdPos=a.dPos*(1-u.violingap)*(1-u.violingroupgap)/(m?p:1),v=a.bPos=m?2*a.dPos*((a.num+.5)/p-.5)*(1-u.violingap):0;if(!0!==s.visible||a.empty)n.select(this).remove();else{var y=e[a.valLetter+"axis"],b=e[a.posLetter+"axis"],x="both"===s.side,_=x||"positive"===s.side,w=x||"negative"===s.side,M=s.box&&s.box.visible,k=s.meanline&&s.meanline.visible,T=u._violinScaleGroupStats[s.scalegroup];if(d.selectAll("path.violin").data(i.identity).enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin").each(function(t){var e,r=n.select(this),i=t.density,o=i.length,l=t.pos+v,u=b.c2p(l);switch(s.scalemode){case"width":e=T.maxWidth/g;break;case"count":e=T.maxWidth/g*(T.maxCount/t.pts.length)}var h,f,d,p,m,M,k;if(_){for(M=new Array(o),p=0;p<o;p++)(k=M[p]={})[a.posLetter]=l+i[p].v/e,k[a.valLetter]=i[p].t;h=c(M)}if(w){for(M=new Array(o),m=0,p=o-1;m<o;m++,p--)(k=M[m]={})[a.posLetter]=l-i[p].v/e,k[a.valLetter]=i[p].t;f=c(M)}if(x)d=h+"L"+f.substr(1)+"Z";else{var A=[u,y.c2p(i[0].t)],S=[u,y.c2p(i[o-1].t)];"h"===s.orientation&&(A.reverse(),S.reverse()),d=_?"M"+A+"L"+h.substr(1)+"L"+S:"M"+S+"L"+f.substr(1)+"L"+A}r.attr("d",d),t.posCenterPx=u,t.posDensityScale=e*g,t.path=r.node(),t.pathLength=t.path.getTotalLength()/(x?2:1)}),M){var A,S,E=s.box.width,L=s.box.line.width;x?(A=g*E,S=0):_?(A=[0,g*E/2],S=-L):(A=[g*E/2,0],S=L),s.whiskerwidth=0,o.plotBoxAndWhiskers(d,{pos:b,val:y},s,{bPos:v,bdPos:A,bPosPxOffset:S}),k&&o.plotBoxMean(d,{pos:b,val:y},s,{bPos:v,bdPos:A,bPosPxOffset:S})}else k&&d.selectAll("path.mean").data(i.identity).enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}).each(function(t){var e=y.c2p(t.mean,!0),r=l.getPositionOnKdePath(t,s,e);n.select(this).attr("d","h"===s.orientation?"M"+e+","+r[0]+"V"+r[1]:"M"+r[0]+","+e+"H"+r[1])});s.points&&o.plotPoints(d,{x:h,y:f},s,a)}})}},{"../../components/drawing":638,"../../lib":738,"../box/plot":891,"../scatter/line_points":1068,"./helpers":1142,d3:123}],1148:[function(t,e,r){"use strict";var n=t("../box/set_positions").setPositionOffset,i=["v","h"];e.exports=function(t,e){for(var r=t.calcdata,a=e.xaxis,o=e.yaxis,s=0;s<i.length;s++){for(var l=i[s],c="h"===l?o:a,u=[],h=0,f=0,d=0;d<r.length;d++){var p=r[d],m=p[0].t,g=p[0].trace;!0!==g.visible||"violin"!==g.type||m.empty||g.orientation!==l||g.xaxis!==a._id||g.yaxis!==o._id||(u.push(d),!1!==g.points&&(h=Math.max(h,g.jitter-g.pointpos-1),f=Math.max(f,g.jitter+g.pointpos-1)))}n("violin",t,u,c,[h,f])}}},{"../box/set_positions":893}],1149:[function(t,e,r){"use strict";var n=t("d3"),i=t("../../components/color"),a=t("../scatter/style").stylePoints;e.exports=function(t,e){var r=e?e[0].node3:n.select(t).selectAll("g.trace.violins");r.style("opacity",function(t){return t[0].trace.opacity}),r.each(function(e){var r=e[0].trace,o=n.select(this),s=r.box||{},l=s.line||{},c=r.meanline||{},u=c.width;o.selectAll("path.violin").style("stroke-width",r.line.width+"px").call(i.stroke,r.line.color).call(i.fill,r.fillcolor),o.selectAll("path.box").style("stroke-width",l.width+"px").call(i.stroke,l.color).call(i.fill,s.fillcolor),o.selectAll("path.mean").style({"stroke-width":u+"px","stroke-dasharray":2*u+"px,"+u+"px"}).call(i.stroke,c.color),a(o,r,t)})}},{"../../components/color":613,"../scatter/style":1075,d3:123}],1150:[function(t,e,r){"use strict";function n(t,e,r,n){if(n.enabled){for(var c=n.target,u=l.nestedProperty(e,c),f=u.get(),d=function(t,e){var r=t.func,n=e.d2c,s=e.c2d;switch(r){case"count":return i;case"first":return a;case"last":return o;case"sum":return function(t,e){for(var r=0,i=0;i<e.length;i++){var a=n(t[e[i]]);a!==h&&(r+=a)}return s(r)};case"avg":return function(t,e){for(var r=0,i=0,a=0;a<e.length;a++){var o=n(t[e[a]]);o!==h&&(r+=o,i++)}return i?s(r/i):h};case"min":return function(t,e){for(var r=1/0,i=0;i<e.length;i++){var a=n(t[e[i]]);a!==h&&(r=Math.min(r,a))}return r===1/0?h:s(r)};case"max":return function(t,e){for(var r=-1/0,i=0;i<e.length;i++){var a=n(t[e[i]]);a!==h&&(r=Math.max(r,a))}return r===-1/0?h:s(r)};case"median":return function(t,e){for(var r=[],i=0;i<e.length;i++){var a=n(t[e[i]]);a!==h&&r.push(a)}if(!r.length)return h;r.sort();var o=(r.length-1)/2;return s((r[Math.floor(o)]+r[Math.ceil(o)])/2)};case"mode":return function(t,e){for(var r={},i=0,a=h,o=0;o<e.length;o++){var l=n(t[e[o]]);if(l!==h){var c=r[l]=(r[l]||0)+1;c>i&&(i=c,a=l)}}return i?s(a):h};case"rms":return function(t,e){for(var r=0,i=0,a=0;a<e.length;a++){var o=n(t[e[a]]);o!==h&&(r+=o*o,i++)}return i?s(Math.sqrt(r/i)):h};case"stddev":return function(e,r){var i,a=0,o=0,s=1,l=h;for(i=0;i<r.length&&l===h;i++)l=n(e[r[i]]);if(l===h)return h;for(;i<r.length;i++){var c=n(e[r[i]]);if(c!==h){var u=c-l;a+=u,o+=u*u,s++}}var f="sample"===t.funcmode?s-1:s;return f?Math.sqrt((o-a*a/s)/f):0}}}(n,s.getDataConversions(t,e,c,f)),p=new Array(r.length),m=0;m<r.length;m++)p[m]=d(f,r[m]);u.set(p)}}function i(t,e){return e.length}function a(t,e){return t[e[0]]}function o(t,e){return t[e[e.length-1]]}var s=t("../plots/cartesian/axes"),l=t("../lib"),c=t("../plot_api/plot_schema"),u=t("./helpers").pointsAccessorFunction,h=t("../constants/numerical").BADNUM;r.moduleType="transform",r.name="aggregate";var f=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"],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"},d=f.aggregations;r.supplyDefaults=function(t,e){function r(e,r){return l.coerce(t,a,f,e,r)}function n(t,e){return l.coerce(p[i],h,d,t,e)}var i,a={};if(!r("enabled"))return a;var o=c.findArrayAttributes(e),s={};for(i=0;i<o.length;i++)s[o[i]]=1;var u=r("groups");if(!Array.isArray(u)){if(!s[u])return void(a.enabled=!1);s[u]=0}var h,p=t.aggregations||[],m=a.aggregations=new Array(p.length);for(i=0;i<p.length;i++){h={_index:i};var g=n("target"),v=n("func");n("enabled")&&g&&(s[g]||"count"===v&&void 0===s[g])?("stddev"===v&&n("funcmode"),s[g]=0,m[i]=h):m[i]={enabled:!1,_index:i}}for(i=0;i<o.length;i++)s[o[i]]&&m.push({target:o[i],func:d.func.dflt,enabled:!0,_index:-1});return a},r.calcTransform=function(t,e,r){if(r.enabled){var i=r.groups,a=l.getTargetArray(e,{target:i});if(a){var o,s,c,h,f={},d={},p=[],m=u(e.transforms,r);for(o=0;o<a.length;o++)void 0===(c=f[s=a[o]])?(f[s]=p.length,h=[o],p.push(h),d[f[s]]=m(o)):(p[c].push(o),d[f[s]]=(d[f[s]]||[]).concat(m(o)));r._indexToPoints=d;var g=r.aggregations;for(o=0;o<g.length;o++)n(t,e,p,g[o]);"string"==typeof i&&n(t,e,p,{target:i,func:"first",enabled:!0})}}}},{"../constants/numerical":717,"../lib":738,"../plot_api/plot_schema":774,"../plots/cartesian/axes":785,"./helpers":1153}],1151:[function(t,e,r){"use strict";var n=t("../lib"),i=t("../registry"),a=t("../plots/cartesian/axes"),o=t("./helpers").pointsAccessorFunction,s=["=","!=","<",">=",">","<="],l=["[]","()","[)","(]","][",")(","](",")["],c=["{}","}{"];r.moduleType="transform",r.name="filter",r.attributes={enabled:{valType:"boolean",dflt:!0,editType:"calc"},target:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x",editType:"calc"},operation:{valType:"enumerated",values:[].concat(s).concat(l).concat(c),dflt:"=",editType:"calc"},value:{valType:"any",dflt:0,editType:"calc"},preservegaps:{valType:"boolean",dflt:!1,editType:"calc"},editType:"calc"},r.supplyDefaults=function(t){function e(e,i){return n.coerce(t,a,r.attributes,e,i)}var a={};if(e("enabled")){e("preservegaps"),e("operation"),e("value"),e("target");var o=i.getComponentMethod("calendars","handleDefaults");o(t,a,"valuecalendar",null),o(t,a,"targetcalendar",null)}return a},r.calcTransform=function(t,e,r){function i(t,r){for(var i=0;i<p.length;i++){t(n.nestedProperty(e,p[i]),r)}}if(r.enabled){var u=n.getTargetArray(e,r);if(u){var h=r.target,f=u.length,d=r.targetcalendar,p=e._arrayAttrs;if("string"==typeof h){var m=n.nestedProperty(e,h+"calendar").get();m&&(d=m)}var g,v,y=function(t,e,r){function n(t){return-1!==t.indexOf(a)}var i,a=t.operation,o=t.value,u=Array.isArray(o),h=function(r){return e(r,0,t.valuecalendar)},f=function(t){return e(t,0,r)};switch(n(s)?i=h(u?o[0]:o):n(l)?i=u?[h(o[0]),h(o[1])]:[h(o),h(o)]:n(c)&&(i=u?o.map(h):[h(o)]),a){case"=":return function(t){return f(t)===i};case"!=":return function(t){return f(t)!==i};case"<":return function(t){return f(t)<i};case"<=":return function(t){return f(t)<=i};case">":return function(t){return f(t)>i};case">=":return function(t){return f(t)>=i};case"[]":return function(t){var e=f(t);return e>=i[0]&&e<=i[1]};case"()":return function(t){var e=f(t);return e>i[0]&&e<i[1]};case"[)":return function(t){var e=f(t);return e>=i[0]&&e<i[1]};case"(]":return function(t){var e=f(t);return e>i[0]&&e<=i[1]};case"][":return function(t){var e=f(t);return e<=i[0]||e>=i[1]};case")(":return function(t){var e=f(t);return e<i[0]||e>i[1]};case"](":return function(t){var e=f(t);return e<=i[0]||e>i[1]};case")[":return function(t){var e=f(t);return e<i[0]||e>=i[1]};case"{}":return function(t){return-1!==i.indexOf(f(t))};case"}{":return function(t){return-1===i.indexOf(f(t))}}}(r,a.getDataToCoordFunc(t,e,h,u),d),b={},x={},_=0;r.preservegaps?(g=function(t){b[t.astr]=n.extendDeep([],t.get()),t.set(new Array(f))},v=function(t,e){var r=b[t.astr][e];t.get()[e]=r}):(g=function(t){b[t.astr]=n.extendDeep([],t.get()),t.set([])},v=function(t,e){var r=b[t.astr][e];t.get().push(r)}),i(g);for(var w=o(e.transforms,r),M=0;M<f;M++){y(u[M])&&(i(v,M),x[_++]=w(M))}r._indexToPoints=x}}}},{"../lib":738,"../plots/cartesian/axes":785,"../registry":861,"./helpers":1153}],1152:[function(t,e,r){"use strict";var n=t("../lib"),i=t("../plot_api/plot_schema"),a=t("../plots/plots"),o=t("./helpers").pointsAccessorFunction;r.moduleType="transform",r.name="groupby",r.attributes={enabled:{valType:"boolean",dflt:!0,editType:"calc"},groups:{valType:"data_array",dflt:[],editType:"calc"},nameformat:{valType:"string",editType:"calc"},styles:{_isLinkedToArray:"style",target:{valType:"string",editType:"calc"},value:{valType:"any",dflt:{},editType:"calc"},editType:"calc"},editType:"calc"},r.supplyDefaults=function(t,e,i){function a(e,i){return n.coerce(t,s,r.attributes,e,i)}var o,s={};if(!a("enabled"))return s;a("groups"),a("nameformat",i._dataLength>1?"%{group} (%{trace})":"%{group}");var l=t.styles,c=s.styles=[];if(l)for(o=0;o<l.length;o++)c[o]={},n.coerce(l[o],c[o],r.attributes.styles,"target"),n.coerce(l[o],c[o],r.attributes.styles,"value");return s},r.transform=function(t,e){var r,s,l,c=[];for(s=0;s<t.length;s++)for(r=function(t,e){var r,s,l,c,u,h,f,d,p,m,g=e.transform,v=t.transforms[e.transformIndex].groups,y=o(t.transforms,g);if(!Array.isArray(v)||0===v.length)return[t];var b=n.filterUnique(v),x=new Array(b.length),_=v.length,w=i.findArrayAttributes(t),M=g.styles||[],k={};for(r=0;r<M.length;r++)k[M[r].target]=M[r].value;g.styles&&(m=n.keyedContainer(g,"styles","target","value.name"));var T={},A={};for(r=0;r<b.length;r++){T[h=b[r]]=r,A[h]=0,(f=x[r]=n.extendDeepNoArrays({},t))._group=h,f.transforms[e.transformIndex]._indexToPoints={};var S=null;for(m&&(S=m.get(h)),f.name=S||n.templateString(g.nameformat,{trace:t.name,group:h}),d=f.transforms,f.transforms=[],s=0;s<d.length;s++)f.transforms[s]=n.extendDeepNoArrays({},d[s]);for(s=0;s<w.length;s++)n.nestedProperty(f,w[s]).set([])}for(l=0;l<w.length;l++){for(c=w[l],s=0,p=[];s<b.length;s++)p[s]=n.nestedProperty(x[s],c).get();for(u=n.nestedProperty(t,c).get(),s=0;s<_;s++)p[T[v[s]]].push(u[s])}for(s=0;s<_;s++)(f=x[T[v[s]]]).transforms[e.transformIndex]._indexToPoints[A[v[s]]]=y(s),A[v[s]]++;for(r=0;r<b.length;r++)h=b[r],f=x[r],a.clearExpandedTraceDefaultColors(f),f=n.extendDeepNoArrays(f,k[h]||{});return x}(t[s],e),l=0;l<r.length;l++)c.push(r[l]);return c}},{"../lib":738,"../plot_api/plot_schema":774,"../plots/plots":846,"./helpers":1153}],1153:[function(t,e,r){"use strict";r.pointsAccessorFunction=function(t,e){for(var r,n,i=0;i<t.length&&(r=t[i])!==e;i++)r._indexToPoints&&!1!==r.enabled&&(n=r._indexToPoints);return n?function(t){return n[t]}:function(t){return[t]}}},{}],1154:[function(t,e,r){"use strict";var n=t("../lib"),i=t("../plots/cartesian/axes"),a=t("./helpers").pointsAccessorFunction;r.moduleType="transform",r.name="sort",r.attributes={enabled:{valType:"boolean",dflt:!0,editType:"calc"},target:{valType:"string",strict:!0,noBlank:!0,arrayOk:!0,dflt:"x",editType:"calc"},order:{valType:"enumerated",values:["ascending","descending"],dflt:"ascending",editType:"calc"},editType:"calc"},r.supplyDefaults=function(t){function e(e,a){return n.coerce(t,i,r.attributes,e,a)}var i={};return e("enabled")&&(e("target"),e("order")),i},r.calcTransform=function(t,e,r){if(r.enabled){var o=n.getTargetArray(e,r);if(o){var s,l,c=r.target,u=o.length,h=e._arrayAttrs,f=function(t,e,r){for(var n=e.length,i=new Array(n),a=e.slice().sort(function(t,e){switch(t.order){case"ascending":return function(t,r){return e(t)-e(r)};case"descending":return function(t,r){return e(r)-e(t)}}}(t,r)),o=0;o<n;o++)for(var s=e[o],l=0;l<n;l++)if(s===a[l]){i[l]=o,a[l]=null;break}return i}(r,o,i.getDataToCoordFunc(t,e,c,o)),d=a(e.transforms,r),p={};for(s=0;s<h.length;s++){var m=n.nestedProperty(e,h[s]),g=m.get(),v=new Array(u);for(l=0;l<u;l++)v[l]=g[f[l]];m.set(v)}for(l=0;l<u;l++)p[l]=d(f[l]);r._indexToPoints=p}}}},{"../lib":738,"../plots/cartesian/axes":785,"./helpers":1153}]},{},[20])(20)}); \ No newline at end of file
diff --git a/assets/site.css b/assets/site.css
index 6c54a11..ef3f476 100644
--- a/assets/site.css
+++ b/assets/site.css
@@ -6,7 +6,10 @@ body {
6 6
7body { 7body {
8 font-family: 'Times New Roman', Times, serif; 8 font-family: 'Times New Roman', Times, serif;
9 font-size: 1em; 9 font-size: 16px;
10 margin: 40px auto;
11 line-height: 1.6;
12 color: #000;
10} 13}
11 14
12article, 15article,
@@ -41,9 +44,44 @@ h6 {
41 font-size: 100%; 44 font-size: 100%;
42} 45}
43 46
47article img {
48 max-width: 100%;
49 display: block;
50 margin: 0 auto
51}
52
53time {
54 display: block;
55 font-size: 80%;
56 color: #444;
57}
58
59main ul {
60 padding: 0 20px;
61}
62
63}
64
65main ul div {
66 font-size: 115%;
67}
68
44.highlighter-rouge { 69.highlighter-rouge {
45 border: 1px solid #ddd; 70 border: 1px solid #ddd;
46 padding: 0 10px; 71 padding: 0 15px;
72 font-size: 80%;
73 border: 2px solid #f1f1f1;
74 border-radius: 2px
75}
76
77::selection {
78 background: #ff0;
79 color: #000
80}
81
82::-moz-selection {
83 background: #ff0;
84 color: #000
47} 85}
48 86
49@media only screen and (max-width:768px) { 87@media only screen and (max-width:768px) {
diff --git a/files/copy-benchmarks.tsv b/files/copy-benchmarks.tsv
new file mode 100644
index 0000000..c7a7af4
--- /dev/null
+++ b/files/copy-benchmarks.tsv
@@ -0,0 +1,101 @@
110KB 100KB 1MB 10MB
20.15 0.187 0.317 0.653
30.158 0.237 0.192 0.659
40.134 0.359 0.236 0.604
50.136 0.292 0.196 0.501
64.411 4.479 4.376 0.649
70.134 0.481 0.265 0.608
80.146 0.266 0.28 0.516
94.282 0.307 4.549 0.562
100.152 0.28 0.229 0.512
110.162 0.37 0.315 0.652
120.13 4.735 0.222 5.171
134.29 8.767 0.283 5.076
144.555 4.682 0.318 4.941
154.658 4.691 0.177 9.624
164.778 4.791 4.415 5.114
178.794 8.604 0.311 5.223
184.582 4.727 0.234 9.28
194.596 4.638 0.212 5.064
204.7 4.65 4.458 5.221
218.822 9.159 0.191 5.032
224.628 4.641 0.324 9.226
234.6 4.921 0.197 5.22
248.85 4.58 4.405 5.245
254.65 9.142 0.215 5.168
264.884 6.67 0.248 9.273
274.581 4.594 0.248 5.082
288.864 4.844 4.502 5.121
294.704 4.656 0.177 5.173
304.616 8.883 0.209 9.334
314.729 4.962 4.366 4.966
328.918 4.682 0.186 6.702
334.686 4.58 0.168 5.111
345.123 8.84 4.747 5.084
354.846 4.732 8.85 5.065
368.887 4.639 4.824 9.286
374.681 8.897 4.791 5.104
384.649 4.682 4.835 5.194
398.847 4.663 8.929 5.271
404.568 4.604 4.762 9.444
414.657 8.74 4.772 5.076
424.636 4.724 4.838 5.168
438.778 4.846 9.065 5.057
444.995 4.571 5.074 9.314
452.343 9.222 4.818 5.732
464.742 4.646 8.909 5.32
474.82 4.842 4.778 5.167
488.791 4.66 4.759 5.157
494.835 8.944 4.804 9.323
504.599 5.594 8.952 5.299
514.809 4.628 1.567 5.294
528.744 4.771 5.59 5.018
534.71 8.919 4.771 9.257
544.704 4.7 9.003 5.064
554.765 4.605 4.781 5.185
568.866 4.669 4.844 5.392
574.897 8.925 4.786 9.279
584.568 5.168 8.893 5.1
594.679 4.757 5.41 5.232
608.922 4.702 4.7 1.984
614.669 8.721 4.906 5.366
624.707 4.555 8.96 5.245
638.938 4.615 4.89 5.216
644.608 4.621 4.677 9.237
654.58 8.954 4.908 5.194
664.707 4.575 8.968 5.017
678.822 4.781 4.882 9.714
684.674 8.833 4.834 5.02
695.005 4.689 4.762 5.312
704.732 4.799 9.111 5.286
718.894 4.675 4.936 5.185
724.747 8.764 4.739 9.312
734.785 4.749 4.845 5.34
744.656 4.705 9.181 5.256
758.899 4.601 4.739 5.261
764.594 8.813 4.576 9.329
774.585 4.716 8.813 5.343
788.718 4.723 4.819 5.092
794.725 4.757 4.83 5.061
804.737 8.899 4.772 9.488
814.692 4.717 8.831 5.13
828.841 4.951 4.787 5.309
834.66 8.895 4.746 5.228
844.749 4.595 4.833 5.26
854.715 4.615 8.928 9.381
868.849 4.651 4.826 5.289
874.66 8.897 4.802 5.197
884.588 4.844 4.883 9.311
894.753 4.888 9.053 5.072
908.841 4.737 4.75 5.157
914.794 8.976 5.063 5.196
924.544 4.673 9.036 9.335
938.74 4.654 6.377 5.29
944.729 4.752 5.001 5.048
954.654 8.98 4.873 5.544
964.9 4.606 4.723 5.192
978.757 4.802 5.427 9.056
984.859 8.969 4.816 5.3
994.701 4.662 9.002 5.138
1004.943 4.813 4.894 5.15
1018.772 4.721 4.785 9.168
diff --git a/files/dev101-git-topics-1.png b/files/dev101-git-topics-1.png
new file mode 100644
index 0000000..bb09380
--- /dev/null
+++ b/files/dev101-git-topics-1.png
Binary files differ
diff --git a/files/dev101-git-topics-1.png.webp b/files/dev101-git-topics-1.png.webp
new file mode 100644
index 0000000..bfef8c7
--- /dev/null
+++ b/files/dev101-git-topics-1.png.webp
Binary files differ
diff --git a/files/dev101-git-topics-2.png b/files/dev101-git-topics-2.png
new file mode 100644
index 0000000..39a370a
--- /dev/null
+++ b/files/dev101-git-topics-2.png
Binary files differ
diff --git a/files/dev101-git-topics-2.png.webp b/files/dev101-git-topics-2.png.webp
new file mode 100644
index 0000000..d80d9a9
--- /dev/null
+++ b/files/dev101-git-topics-2.png.webp
Binary files differ
diff --git a/files/fuse-droplets.png b/files/fuse-droplets.png
new file mode 100644
index 0000000..d7ce243
--- /dev/null
+++ b/files/fuse-droplets.png
Binary files differ
diff --git a/files/fuse-droplets.png.webp b/files/fuse-droplets.png.webp
new file mode 100644
index 0000000..c1ae313
--- /dev/null
+++ b/files/fuse-droplets.png.webp
Binary files differ
diff --git a/files/fuse-spaces.png b/files/fuse-spaces.png
new file mode 100644
index 0000000..4dcc1c5
--- /dev/null
+++ b/files/fuse-spaces.png
Binary files differ
diff --git a/files/fuse-spaces.png.webp b/files/fuse-spaces.png.webp
new file mode 100644
index 0000000..9d630c8
--- /dev/null
+++ b/files/fuse-spaces.png.webp
Binary files differ
diff --git a/files/golang-profiling-cpu.pdf b/files/golang-profiling-cpu.pdf
new file mode 100644
index 0000000..15241cb
--- /dev/null
+++ b/files/golang-profiling-cpu.pdf
Binary files differ
diff --git a/files/golang-profiling-mem.pdf b/files/golang-profiling-mem.pdf
new file mode 100644
index 0000000..822e445
--- /dev/null
+++ b/files/golang-profiling-mem.pdf
Binary files differ
diff --git a/files/iot-app-output.png b/files/iot-app-output.png
new file mode 100644
index 0000000..1c80589
--- /dev/null
+++ b/files/iot-app-output.png
Binary files differ
diff --git a/files/iot-app-output.png.webp b/files/iot-app-output.png.webp
new file mode 100644
index 0000000..e95c2a9
--- /dev/null
+++ b/files/iot-app-output.png.webp
Binary files differ
diff --git a/files/iot-rest-example.png b/files/iot-rest-example.png
new file mode 100644
index 0000000..3ed86aa
--- /dev/null
+++ b/files/iot-rest-example.png
Binary files differ
diff --git a/files/iot-rest-example.png.webp b/files/iot-rest-example.png.webp
new file mode 100644
index 0000000..4aa6c0a
--- /dev/null
+++ b/files/iot-rest-example.png.webp
Binary files differ
diff --git a/files/iot-sqlite-db.png b/files/iot-sqlite-db.png
new file mode 100644
index 0000000..82e1e29
--- /dev/null
+++ b/files/iot-sqlite-db.png
Binary files differ
diff --git a/files/iot-sqlite-db.png.webp b/files/iot-sqlite-db.png.webp
new file mode 100644
index 0000000..bac0261
--- /dev/null
+++ b/files/iot-sqlite-db.png.webp
Binary files differ
diff --git a/files/kcachegrind.png b/files/kcachegrind.png
new file mode 100644
index 0000000..0dc48ab
--- /dev/null
+++ b/files/kcachegrind.png
Binary files differ
diff --git a/files/kcachegrind.png.webp b/files/kcachegrind.png.webp
new file mode 100644
index 0000000..cd47e22
--- /dev/null
+++ b/files/kcachegrind.png.webp
Binary files differ
diff --git a/files/profiling-viewer.png b/files/profiling-viewer.png
new file mode 100644
index 0000000..a450513
--- /dev/null
+++ b/files/profiling-viewer.png
Binary files differ
diff --git a/files/profiling-viewer.png.webp b/files/profiling-viewer.png.webp
new file mode 100644
index 0000000..96dc491
--- /dev/null
+++ b/files/profiling-viewer.png.webp
Binary files differ
diff --git a/files/simple-iot-application-overview.svg b/files/simple-iot-application-overview.svg
new file mode 100644
index 0000000..817666d
--- /dev/null
+++ b/files/simple-iot-application-overview.svg
@@ -0,0 +1,2 @@
1<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
2<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="623px" height="482px" version="1.1" content="&lt;mxfile userAgent=&quot;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36&quot; version=&quot;7.1.3&quot; editor=&quot;www.draw.io&quot; type=&quot;google&quot;&gt;&lt;diagram id=&quot;d1a10cf0-d877-4170-d86f-ec45460d7050&quot; name=&quot;Page-1&quot;&gt;7Vnbbts4EP0aPzYQdbP9mKTNFtjtokgWSPpIi7RNrCRqKfq2X79DiZREUU5sV267RREgoI6o4XDmkHNIT4L7bP+bwMX6Eyc0nfge2U+C9xPfn8Yz+K+AQw1Ecw2sBCM1hFrgif1LNehpdMMILa2OkvNUssIGE57nNJEWhoXgO7vbkqf2qAVeUQd4SnDqos+MyHWNziKvxT9StlqbkZGn32TYdNZAucaE7zpQ8GES3AvOZd3K9vc0VbEzcam/ezjytnFM0Fye8oFff7DF6UbP7T2WeIFLqv2TBzNpcLVQzeSQspxQMQnudmsm6VOBE4XvINWArWWWwhOC5oJvoCP5Y2GAUgr+dxMymOzdkufySY+hnd9SIen+6HxQEyVgF+UZleIAXfQHwVzPSDMrjHWgd22e4qiG1p0UzXQ3rJmxaiy3wYOGjt9wLAMnlhM/TqUKBDRWqmEANW0ruvE/G25evCsrwt9CBxQV+/alsfJMF8rVokhZgiXjuTELHtaW7dEAdjwgbNuHjnpp1p/xI3RdamyIgcFP9QmwAbdO8XRw2Dft9wguarrCg/c2t10qj8Fesy0ces8d9vpmL+nSt9lgvoa/4QB/eyGiOblV+yc85TynVRywkAZLUlyWLLEjBXMXhxcV1RsUzgzwpQLm8VQBeyZfdNhVu34XVV3JA1MOV+/cmFemPlPBYLJqR6q61V5T4uzhvTTAzPhGJNTaCWE6Kyo7C9pNVicZ0UAuDCZoCotzazsxlB89wmfOquXWcCGyuBD1t6jaef1Vd4vvG5r2DAU9Q/WUHUOQVHzodCtUh/IVhyObvJFnlR5o1BZbLjYxPYme0Vn0bKloMVSzdpies2japSe68VCXnsihZ2X6F0H/JwQN5+iqBI1RMItmOF7OEY0hPO9cxj4LKCoDhY2A6Cpqb08qVVBi5FA9uucpFy3Nl0DNHoRTtsrV+gCqVRpOFSyQEemtfpExQtQwgwVwhBrn9xVa6Na4cIC1/ggVzsnQ1MnQI8XktQSVP3+GIhT9OBmaORm6FWTDcj6QpE+/P4IQ8s6We+gSubdSBUZv6GOfYvzYLqVo4BSD/IEUxNdIwdzdxqoDyEIdpIGhIwc24Zmq21cJbPhDBdZcZ4ytuI/IkJeOrDYSp6u+b/yoq3Ac+X2ZbAlc2TK8yL+Xjukvtst1DOoZupbQ7p0SzeXF1XQMMkvvq6T3qFSd9ql6PXLOf5HzDHJG35yc/iWbKMHluilRr/LRlm0TP7ir/s6g3PfiTjwbTsXZ3EHxG4aOcOeC9CK8REmYYN+fYoo9OnCG6t1OLnFi305+pOmWKsHs3lI+8o3UN6vKyWM3lKNLeVHn9jwlb8uortzsK6QHnLFU5eYvllFYm96fdAf/H3mG82uIqGBq0SGYuyJqeqXzgcOP+Hr8wAX7dhRJ6fLnYUgQeG8yZD4OQ+Cx/bWs3nDanxyDD/8B&lt;/diagram&gt;&lt;/mxfile&gt;"><defs/><g transform="translate(0.5,0.5)"><path d="M 283 367 C 283 345.67 348 345.67 348 367 L 348 415 C 348 436.33 283 436.33 283 415 Z" fill="#ffffff" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 283 367 C 283 383 348 383 348 367" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(287.5,395.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="54" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 54px; white-space: nowrap; word-wrap: normal; font-weight: bold; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Database</div></div></foreignObject><text x="27" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica" font-weight="bold">Database</text></switch></g><rect x="211" y="211" width="200" height="100" fill="#ffffff" stroke="#000000" stroke-width="2" pointer-events="none"/><g transform="translate(252.5,234.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="115" height="51" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 115px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><b><font style="font-size: 15px">Web application</font></b><div><b><font size="4"><br /></font></b></div><div><b><br /></b></div></div></div></foreignObject><text x="58" y="32" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><path d="M 274.76 391 L 251 391 Q 241 391 241 381 L 241 308" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 280.76 391 L 272.76 395 L 274.76 391 L 272.76 387 Z" fill="#000000" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 348 391 L 372 391 Q 382 391 382 381 L 382 321.24" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 382 315.24 L 386 323.24 L 382 321.24 L 378 323.24 Z" fill="#000000" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><g transform="translate(177.5,327.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="50" height="26" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 50px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Write<div>datapoint</div></div></div></foreignObject><text x="25" y="19" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><g transform="translate(397.5,327.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="56" height="26" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Read<div>datapoints</div></div></div></foreignObject><text x="28" y="19" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica">[Not supported by viewer]</text></switch></g><rect x="151" y="51" width="120" height="60" rx="9" ry="9" fill="#ffffff" stroke="#000000" stroke-width="2" pointer-events="none"/><g transform="translate(182.5,67.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="55" height="26" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 55px; white-space: nowrap; word-wrap: normal; font-weight: bold; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Arduino<div>MKR1000</div></div></div></foreignObject><text x="28" y="19" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica" font-weight="bold">[Not supported by viewer]</text></switch></g><rect x="351" y="51" width="120" height="60" rx="9" ry="9" fill="#ffffff" stroke="#000000" stroke-width="2" pointer-events="none"/><g transform="translate(372.5,74.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="75" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: Helvetica; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 77px; white-space: nowrap; word-wrap: normal; font-weight: bold; text-align: center;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">Web browser</div></div></foreignObject><text x="38" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Helvetica" font-weight="bold">Web browser</text></switch></g><path d="M 254.57 205.86 L 218.81 177.25 Q 211 171 211 161 L 211 111" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 259.25 209.6 L 250.51 207.73 L 254.57 205.86 L 255.51 201.48 Z" fill="#000000" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 367.43 205.86 L 403.19 177.25 Q 411 171 411 161 L 411 119.24" fill="none" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 362.75 209.6 L 366.49 201.48 L 367.43 205.86 L 371.49 207.73 Z" fill="#000000" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 411 113.24 L 415 121.24 L 411 119.24 L 407 121.24 Z" fill="#000000" stroke="#000000" stroke-width="2" stroke-miterlimit="10" pointer-events="none"/><path d="M 571 171 L 51 171" fill="none" stroke="#b3b3b3" stroke-width="2" stroke-miterlimit="10" stroke-dasharray="6 6" pointer-events="none"/><g transform="translate(350.5,284.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="45" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: &quot;Times New Roman&quot;; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 46px; white-space: nowrap; word-wrap: normal; font-weight: bold; text-align: right;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font face="Helvetica">Route: /</font></div></div></foreignObject><text x="23" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Times New Roman" font-weight="bold">[Not supported by viewer]</text></switch></g><g transform="translate(222.5,284.5)"><switch><foreignObject style="overflow:visible;" pointer-events="all" width="62" height="12" requiredFeatures="http://www.w3.org/TR/SVG11/feature#Extensibility"><div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: &quot;Times New Roman&quot;; color: rgb(0, 0, 0); line-height: 1.2; vertical-align: top; width: 63px; white-space: nowrap; word-wrap: normal; font-weight: bold;"><div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;"><font face="Helvetica">Route: /api</font></div></div></foreignObject><text x="31" y="12" fill="#000000" text-anchor="middle" font-size="12px" font-family="Times New Roman" font-weight="bold">[Not supported by viewer]</text></switch></g></g></svg> \ No newline at end of file
diff --git a/files/simple-iot-application.zip b/files/simple-iot-application.zip
new file mode 100644
index 0000000..46d3205
--- /dev/null
+++ b/files/simple-iot-application.zip
Binary files differ
diff --git a/files/snakeviz.png b/files/snakeviz.png
new file mode 100644
index 0000000..5bab395
--- /dev/null
+++ b/files/snakeviz.png
Binary files differ
diff --git a/files/snakeviz.png.webp b/files/snakeviz.png.webp
new file mode 100644
index 0000000..1460871
--- /dev/null
+++ b/files/snakeviz.png.webp
Binary files differ
diff --git a/files/sqlite-benchmarks.tsv b/files/sqlite-benchmarks.tsv
new file mode 100644
index 0000000..daa2c21
--- /dev/null
+++ b/files/sqlite-benchmarks.tsv
@@ -0,0 +1,1001 @@
1DROPTABLE CREATETABLE INSERTMANY FETCHALL COMMIT
20.000732 0.000400 0.008133 0.000065 0.000166
30.000200 0.000214 0.003105 0.000043 0.000171
40.000246 0.000170 0.006594 0.000044 0.000101
50.000182 0.000166 0.003892 0.000043 0.000112
60.000248 0.000654 0.002308 0.000041 0.000090
70.000240 0.000184 0.002253 0.000053 0.000110
80.000698 0.000483 0.003737 0.000041 0.000165
90.000217 0.000179 0.002470 0.000049 0.000107
100.000243 0.000160 0.002668 0.000054 0.000340
110.000196 0.000169 0.002247 0.000040 0.000096
120.000191 0.000162 0.003522 0.000260 0.000102
130.000195 0.000188 0.002325 0.000041 0.000132
140.000194 0.000202 0.002291 0.000039 0.000091
150.000195 0.000196 0.004114 0.000042 0.000108
160.000204 0.000200 0.002971 0.000040 0.000106
170.000227 0.000159 0.002208 0.000039 0.000117
180.000207 0.000176 0.003558 0.000040 0.000124
190.000255 0.000179 0.002870 0.000040 0.000125
200.000209 0.000176 0.002248 0.000040 0.000176
210.000211 0.000174 0.002661 0.000039 0.000180
220.000208 0.000219 0.002321 0.000039 0.000151
230.000212 0.000178 0.002609 0.000040 0.000132
240.000205 0.000209 0.002666 0.000039 0.000126
250.000205 0.000176 0.002501 0.000041 0.000133
260.000243 0.000183 0.002220 0.000037 0.000117
270.000504 0.000173 0.002230 0.000121 0.000414
280.000270 0.000200 0.002325 0.000040 0.000154
290.000208 0.000176 0.002386 0.000038 0.000123
300.000229 0.000182 0.002245 0.000039 0.000127
310.000211 0.000176 0.002544 0.000039 0.000136
320.000204 0.000180 0.002133 0.000037 0.000129
330.000205 0.000178 0.002330 0.000048 0.000146
340.000210 0.000178 0.002242 0.000039 0.000109
350.000210 0.000259 0.002766 0.000039 0.000118
360.000317 0.000495 0.002237 0.000039 0.000195
370.000454 0.000246 0.002447 0.000040 0.000172
380.000936 0.000200 0.002305 0.000057 0.000173
390.000263 0.000178 0.002251 0.000038 0.000166
400.000240 0.000183 0.002169 0.000068 0.000176
410.000251 0.000189 0.002221 0.000038 0.000141
420.000268 0.000215 0.002322 0.000039 0.000226
430.000287 0.000223 0.002696 0.000045 0.000247
440.000362 0.000229 0.002551 0.000043 0.000133
450.000239 0.000200 0.002621 0.000045 0.000133
460.000634 0.000208 0.002619 0.000046 0.000138
470.000236 0.000205 0.002589 0.000046 0.000137
480.000262 0.000205 0.002607 0.000045 0.000142
490.000239 0.000198 0.002754 0.000044 0.000185
500.000238 0.000198 0.002593 0.000057 0.000160
510.000242 0.000221 0.003784 0.000122 0.000174
520.000242 0.000201 0.002625 0.000054 0.000148
530.000296 0.000225 0.002934 0.000044 0.000134
540.000239 0.000245 0.003428 0.000046 0.000158
550.000261 0.000251 0.002569 0.000046 0.000139
560.000260 0.000230 0.002603 0.000045 0.000145
570.000302 0.000212 0.002580 0.000045 0.000176
580.000794 0.000197 0.002856 0.000046 0.000141
590.000273 0.000209 0.003173 0.000045 0.000217
600.000240 0.000201 0.002844 0.000043 0.000167
610.000389 0.000175 0.004315 0.000055 0.000091
620.000275 0.000534 0.004991 0.000053 0.000092
630.000229 0.000215 0.004084 0.000045 0.000074
640.000172 0.000474 0.002611 0.000043 0.000069
650.000201 0.000174 0.002485 0.000043 0.000069
660.000173 0.000220 0.002541 0.000045 0.000068
670.000167 0.000161 0.002827 0.000043 0.000071
680.000168 0.000160 0.003512 0.000068 0.000075
690.000211 0.000167 0.002530 0.000044 0.000069
700.000193 0.000230 0.003664 0.000046 0.000074
710.000171 0.000161 0.002575 0.000076 0.000075
720.000169 0.000161 0.002595 0.000044 0.000076
730.000981 0.000174 0.002556 0.000045 0.000072
740.000168 0.000163 0.002568 0.000043 0.000072
750.000163 0.000158 0.002579 0.000043 0.000386
760.000168 0.000160 0.002579 0.000059 0.000088
770.000176 0.000163 0.002559 0.000044 0.000075
780.000167 0.000161 0.002558 0.000043 0.000075
790.000169 0.000161 0.002599 0.000043 0.000095
800.000174 0.000163 0.002633 0.000046 0.000076
810.000170 0.000165 0.002576 0.000858 0.000079
820.000169 0.000162 0.002611 0.000044 0.000075
830.000170 0.000199 0.002621 0.000043 0.000074
840.000170 0.000167 0.003611 0.000043 0.000073
850.000171 0.000159 0.002764 0.000046 0.000076
860.000171 0.000165 0.002639 0.000044 0.000073
870.000168 0.000162 0.003131 0.000046 0.000075
880.000170 0.000162 0.002858 0.000044 0.000074
890.000171 0.000164 0.002841 0.000043 0.000075
900.000167 0.000161 0.002971 0.000043 0.000074
910.000170 0.000226 0.002842 0.000044 0.000074
920.000171 0.000165 0.002822 0.000044 0.000075
930.000173 0.000160 0.002895 0.000045 0.000073
940.000167 0.000217 0.002697 0.000044 0.000076
950.000170 0.000197 0.002699 0.000044 0.000075
960.000171 0.000163 0.003230 0.000045 0.000097
970.000170 0.000164 0.003167 0.000046 0.000082
980.000172 0.000196 0.002559 0.000043 0.000075
990.000168 0.000165 0.003006 0.000045 0.000075
1000.000176 0.000160 0.002567 0.000043 0.000075
1010.000167 0.000163 0.002757 0.000045 0.000076
1020.000171 0.000162 0.002802 0.000045 0.000076
1030.000169 0.000162 0.003102 0.000043 0.000072
1040.000167 0.000162 0.002624 0.000043 0.000075
1050.000170 0.000161 0.002589 0.000043 0.000072
1060.000222 0.000253 0.002657 0.000045 0.000075
1070.000172 0.000162 0.002586 0.000044 0.000084
1080.000172 0.000165 0.002933 0.000044 0.000075
1090.000169 0.000192 0.002609 0.000044 0.000074
1100.000194 0.000162 0.003020 0.000045 0.000081
1110.000170 0.000164 0.002908 0.000045 0.000076
1120.000169 0.000163 0.002567 0.000042 0.000073
1130.000167 0.000159 0.003071 0.000042 0.000074
1140.000222 0.000163 0.003175 0.000043 0.000076
1150.000167 0.000160 0.002641 0.000046 0.000099
1160.000171 0.000168 0.002586 0.000057 0.000075
1170.000170 0.000168 0.003148 0.000046 0.000075
1180.000171 0.000159 0.002770 0.000041 0.000074
1190.000173 0.000158 0.002643 0.000055 0.000077
1200.000313 0.000174 0.002920 0.000045 0.000075
1210.000170 0.000163 0.002551 0.000044 0.000072
1220.000173 0.000161 0.002599 0.000045 0.000073
1230.000167 0.000160 0.003505 0.000046 0.000075
1240.000171 0.000161 0.002894 0.000045 0.000074
1250.000171 0.000166 0.002572 0.000042 0.000073
1260.000166 0.000160 0.004099 0.000044 0.000102
1270.000181 0.000160 0.002499 0.000046 0.000071
1280.000174 0.000175 0.002560 0.000043 0.000068
1290.000165 0.000168 0.003083 0.000044 0.000070
1300.000210 0.000163 0.002535 0.000040 0.000068
1310.000164 0.000177 0.002906 0.000044 0.000075
1320.000175 0.000227 0.002971 0.000043 0.000073
1330.000167 0.000175 0.003409 0.000046 0.000078
1340.000172 0.000166 0.002640 0.000046 0.000074
1350.000177 0.000164 0.002574 0.000046 0.000076
1360.000170 0.000163 0.002631 0.000046 0.000075
1370.000216 0.000168 0.002596 0.000046 0.000076
1380.000170 0.000163 0.002659 0.000045 0.000074
1390.000172 0.000162 0.002677 0.000046 0.000075
1400.000170 0.000159 0.002604 0.000044 0.000081
1410.000171 0.000161 0.003163 0.000046 0.000076
1420.000171 0.000162 0.002574 0.000313 0.000075
1430.000170 0.000186 0.002988 0.000046 0.000074
1440.000171 0.000162 0.002596 0.000043 0.000077
1450.000168 0.000160 0.002640 0.000055 0.000074
1460.000169 0.000161 0.002567 0.000043 0.000371
1470.000170 0.000162 0.002704 0.000057 0.000078
1480.000255 0.000185 0.002453 0.000293 0.000066
1490.000148 0.000143 0.002169 0.000037 0.000066
1500.000173 0.000141 0.002238 0.000039 0.000085
1510.000154 0.000174 0.002679 0.000041 0.000065
1520.000149 0.000144 0.002187 0.000037 0.000065
1530.000146 0.000140 0.002760 0.000039 0.000071
1540.000147 0.000151 0.002193 0.000039 0.000065
1550.000150 0.000172 0.002207 0.000039 0.000067
1560.000147 0.000141 0.002126 0.000037 0.000060
1570.000191 0.000141 0.002119 0.000036 0.000086
1580.000149 0.000144 0.002440 0.000039 0.000065
1590.000148 0.000143 0.003287 0.000041 0.000068
1600.000152 0.000149 0.002555 0.000040 0.000069
1610.000148 0.000141 0.002203 0.000038 0.000065
1620.000147 0.000139 0.002371 0.000052 0.000075
1630.000148 0.000143 0.002201 0.000037 0.000066
1640.000149 0.000140 0.002186 0.000038 0.000062
1650.000152 0.000154 0.002215 0.000038 0.000062
1660.000149 0.000144 0.002505 0.000039 0.000067
1670.000148 0.000140 0.002216 0.000038 0.000101
1680.000160 0.000144 0.002574 0.000039 0.000067
1690.000150 0.000144 0.002266 0.000040 0.000068
1700.000151 0.000142 0.003640 0.000040 0.000068
1710.000150 0.000142 0.002207 0.000038 0.000066
1720.000148 0.000140 0.002337 0.000041 0.000068
1730.000151 0.000144 0.002138 0.000038 0.000063
1740.000146 0.000178 0.002369 0.000039 0.000060
1750.000150 0.000141 0.002290 0.000039 0.000067
1760.000149 0.000143 0.002569 0.000050 0.000070
1770.000149 0.000143 0.002797 0.000040 0.000068
1780.000149 0.000143 0.002720 0.000039 0.000066
1790.000273 0.000154 0.002255 0.000039 0.000066
1800.000147 0.000141 0.002180 0.000037 0.000065
1810.000884 0.000142 0.002164 0.000036 0.000060
1820.000188 0.000143 0.002248 0.000039 0.000062
1830.000148 0.000142 0.002178 0.000038 0.000064
1840.000151 0.000140 0.002705 0.000038 0.000063
1850.000145 0.000144 0.002588 0.000039 0.000064
1860.000147 0.000142 0.002196 0.000037 0.000064
1870.000147 0.000139 0.002169 0.000035 0.000060
1880.000151 0.000894 0.002267 0.000039 0.000061
1890.000152 0.000145 0.002178 0.000038 0.000061
1900.000185 0.000142 0.002148 0.000036 0.000062
1910.000147 0.000141 0.002845 0.000040 0.000065
1920.000159 0.000178 0.002193 0.000039 0.000063
1930.000145 0.000141 0.002571 0.000039 0.000066
1940.000149 0.000141 0.003380 0.000038 0.000065
1950.000200 0.000149 0.002439 0.000039 0.000066
1960.000152 0.000140 0.002193 0.000037 0.000065
1970.000147 0.000139 0.002239 0.000037 0.000066
1980.000200 0.000143 0.002190 0.000039 0.000066
1990.000147 0.000139 0.002243 0.000038 0.000062
2000.000421 0.000144 0.002229 0.000038 0.000062
2010.000147 0.000149 0.002715 0.000038 0.000063
2020.000151 0.000176 0.002144 0.000036 0.000060
2030.000145 0.000138 0.002184 0.000038 0.000064
2040.000146 0.000207 0.002526 0.000040 0.000067
2050.000163 0.000142 0.002366 0.000038 0.000070
2060.000149 0.000143 0.002143 0.000038 0.000065
2070.000150 0.000142 0.002146 0.000035 0.000059
2080.000162 0.000147 0.002736 0.000038 0.000067
2090.000149 0.000146 0.002383 0.000040 0.000071
2100.000147 0.000139 0.002485 0.000038 0.000065
2110.000147 0.000143 0.002811 0.000039 0.000098
2120.000181 0.000142 0.002503 0.000039 0.000066
2130.000150 0.000143 0.002227 0.000039 0.000065
2140.000149 0.000143 0.002182 0.000036 0.000061
2150.000148 0.000387 0.002159 0.000036 0.000059
2160.000147 0.000173 0.002267 0.000039 0.000063
2170.000147 0.000143 0.002729 0.000039 0.000066
2180.000149 0.000142 0.002574 0.000040 0.000069
2190.000149 0.000143 0.002560 0.000040 0.000068
2200.000152 0.000141 0.002203 0.000038 0.000066
2210.000151 0.000139 0.002234 0.000038 0.000087
2220.000148 0.000140 0.002152 0.000036 0.000060
2230.000185 0.000140 0.002274 0.000039 0.000063
2240.000148 0.000144 0.002211 0.000038 0.000066
2250.000149 0.000141 0.002692 0.000039 0.000066
2260.000148 0.000145 0.002519 0.000039 0.000066
2270.000147 0.000143 0.002188 0.000038 0.000066
2280.000149 0.000171 0.002171 0.000038 0.000093
2290.000150 0.000182 0.002185 0.000038 0.000068
2300.000191 0.000154 0.002172 0.000037 0.000061
2310.000145 0.000140 0.002253 0.000043 0.000065
2320.000147 0.000139 0.002673 0.000038 0.000066
2330.000191 0.000144 0.002740 0.000038 0.000066
2340.000147 0.000142 0.002187 0.000038 0.000064
2350.000146 0.000181 0.002180 0.000038 0.000066
2360.000176 0.000142 0.002152 0.000039 0.000061
2370.000149 0.000142 0.002164 0.000037 0.000064
2380.000245 0.000150 0.002771 0.000055 0.000084
2390.000149 0.000145 0.003006 0.000040 0.000069
2400.000153 0.000144 0.002701 0.000040 0.000067
2410.000149 0.000144 0.002192 0.000038 0.000065
2420.000148 0.000143 0.002220 0.000038 0.000063
2430.000146 0.000140 0.002210 0.000038 0.000062
2440.000157 0.000144 0.002174 0.000038 0.000060
2450.000148 0.000171 0.002208 0.000039 0.000061
2460.000146 0.000141 0.002685 0.000039 0.000064
2470.000146 0.000139 0.002811 0.000038 0.000064
2480.000147 0.000140 0.002234 0.000037 0.000063
2490.000143 0.000143 0.002209 0.000040 0.000066
2500.000149 0.000144 0.002162 0.000037 0.000091
2510.000408 0.000141 0.002140 0.000036 0.000060
2520.000142 0.000149 0.002208 0.000132 0.000061
2530.000148 0.000142 0.002706 0.000040 0.000066
2540.000148 0.000142 0.002502 0.000039 0.000065
2550.000176 0.000144 0.002265 0.000039 0.000066
2560.000150 0.000142 0.002199 0.000039 0.000065
2570.000147 0.000154 0.002201 0.000040 0.000067
2580.000150 0.000142 0.002164 0.000036 0.000094
2590.000183 0.000177 0.002253 0.000039 0.000063
2600.000189 0.000143 0.002480 0.000039 0.000066
2610.000148 0.000141 0.002212 0.000037 0.000064
2620.000150 0.000137 0.002192 0.000037 0.000065
2630.000144 0.000140 0.002271 0.000039 0.000062
2640.000190 0.000171 0.002145 0.000037 0.000061
2650.000146 0.000141 0.005865 0.000099 0.000083
2660.000178 0.000165 0.002792 0.000040 0.000066
2670.000148 0.000233 0.002742 0.000039 0.000079
2680.000157 0.000151 0.002225 0.000039 0.000066
2690.000149 0.000142 0.002215 0.000039 0.000081
2700.000165 0.000141 0.002239 0.000039 0.000081
2710.000150 0.000154 0.002154 0.000036 0.000060
2720.000152 0.000151 0.002216 0.000039 0.000075
2730.000172 0.000141 0.004471 0.000060 0.000092
2740.000250 0.000210 0.002881 0.000040 0.000066
2750.000176 0.000152 0.002262 0.000038 0.000337
2760.000164 0.000154 0.002485 0.000039 0.000074
2770.000149 0.000180 0.002148 0.000039 0.000078
2780.000194 0.000145 0.002345 0.000044 0.000064
2790.000164 0.000201 0.002483 0.000040 0.000062
2800.000148 0.000140 0.002249 0.000038 0.000076
2810.000155 0.000144 0.002504 0.000039 0.000067
2820.000166 0.000150 0.002780 0.000040 0.000079
2830.000150 0.000142 0.002194 0.000038 0.000086
2840.000178 0.000153 0.002360 0.000039 0.000079
2850.000160 0.000154 0.002159 0.000036 0.000079
2860.000195 0.000445 0.002203 0.000038 0.000074
2870.000171 0.000161 0.002220 0.000038 0.000087
2880.000165 0.000151 0.002231 0.000038 0.000088
2890.000149 0.000141 0.003445 0.000040 0.000068
2900.000148 0.000143 0.002465 0.000039 0.000081
2910.000165 0.000150 0.002228 0.000038 0.000067
2920.000160 0.000142 0.003231 0.000039 0.000066
2930.000149 0.000141 0.002215 0.000038 0.000078
2940.000146 0.000152 0.002152 0.000038 0.000077
2950.000168 0.000140 0.002258 0.000040 0.000076
2960.000193 0.000142 0.002266 0.000039 0.000085
2970.000261 0.000164 0.002160 0.000037 0.000061
2980.000151 0.000419 0.002217 0.000037 0.000073
2990.000163 0.000148 0.002856 0.000038 0.000106
3000.000258 0.000204 0.002267 0.000040 0.000075
3010.000178 0.000159 0.002266 0.000038 0.000070
3020.000158 0.000149 0.002665 0.000039 0.000085
3030.000164 0.000154 0.002478 0.000039 0.000077
3040.000148 0.000140 0.002459 0.000038 0.000066
3050.000161 0.000142 0.002206 0.000038 0.000074
3060.000155 0.000151 0.002230 0.000039 0.000083
3070.000161 0.000142 0.002225 0.000037 0.000072
3080.000161 0.000187 0.002450 0.000038 0.000063
3090.000145 0.000155 0.002438 0.000039 0.000079
3100.000166 0.000138 0.002296 0.000039 0.000076
3110.000170 0.000156 0.002446 0.000038 0.000078
3120.000160 0.000159 0.002211 0.000038 0.000078
3130.000159 0.000142 0.002190 0.000036 0.000110
3140.000157 0.000150 0.002336 0.000039 0.000073
3150.000165 0.000182 0.002132 0.000038 0.000072
3160.000160 0.000140 0.002641 0.000066 0.000066
3170.000147 0.000153 0.002153 0.000039 0.000080
3180.000148 0.000156 0.002165 0.000037 0.000077
3190.000147 0.000151 0.002201 0.000038 0.000067
3200.000162 0.000143 0.002216 0.000040 0.000080
3210.000165 0.000148 0.002223 0.000055 0.000080
3220.000193 0.000143 0.002155 0.000037 0.000078
3230.000165 0.000143 0.003005 0.000040 0.000067
3240.000151 0.000145 0.002511 0.000039 0.000070
3250.000149 0.000173 0.002246 0.000039 0.000066
3260.000148 0.000143 0.002808 0.000040 0.000067
3270.000148 0.000142 0.002513 0.000038 0.000066
3280.000148 0.000143 0.002203 0.000037 0.000065
3290.000146 0.000138 0.002123 0.000038 0.000061
3300.000170 0.000149 0.002165 0.000036 0.000062
3310.000144 0.000145 0.002186 0.000037 0.000059
3320.000144 0.000139 0.002520 0.000037 0.000065
3330.000146 0.000139 0.002559 0.000038 0.000066
3340.000153 0.000142 0.002537 0.000038 0.000067
3350.000168 0.000144 0.002217 0.000048 0.000066
3360.000147 0.000141 0.002120 0.000037 0.000063
3370.000188 0.001725 0.002541 0.000040 0.000067
3380.000149 0.000143 0.002229 0.000038 0.000076
3390.000147 0.000143 0.002233 0.000037 0.000062
3400.000182 0.000142 0.002150 0.000037 0.000061
3410.000148 0.000140 0.002196 0.000037 0.000065
3420.000145 0.000140 0.002473 0.000037 0.000065
3430.000147 0.000139 0.002725 0.000040 0.000067
3440.000149 0.000142 0.002217 0.000039 0.000065
3450.000146 0.000140 0.002167 0.000037 0.000061
3460.000176 0.000144 0.002415 0.000039 0.000064
3470.000171 0.000144 0.002925 0.000040 0.000068
3480.000152 0.000167 0.002190 0.000039 0.000066
3490.000149 0.000142 0.002530 0.000039 0.000067
3500.000150 0.000142 0.003059 0.000040 0.000068
3510.000149 0.000142 0.002417 0.000038 0.000072
3520.000149 0.000143 0.002569 0.000038 0.000068
3530.000148 0.000141 0.002262 0.000040 0.000068
3540.000152 0.000144 0.002253 0.000038 0.000066
3550.000149 0.000142 0.002134 0.000037 0.000061
3560.000277 0.000427 0.002186 0.000036 0.000060
3570.000145 0.000139 0.002791 0.000039 0.000065
3580.000149 0.000144 0.002238 0.000039 0.000066
3590.000147 0.000144 0.002514 0.000039 0.000066
3600.000148 0.000143 0.002683 0.000038 0.000063
3610.000147 0.000139 0.002214 0.000037 0.000068
3620.000145 0.000139 0.002149 0.000036 0.000059
3630.000185 0.000139 0.002214 0.000037 0.000060
3640.000145 0.000140 0.003549 0.000039 0.000066
3650.000187 0.000142 0.002160 0.000037 0.000059
3660.000147 0.000158 0.002212 0.000038 0.000065
3670.000148 0.000140 0.002483 0.000039 0.000067
3680.000147 0.000142 0.003034 0.000039 0.000066
3690.000148 0.000142 0.002228 0.000039 0.000066
3700.000145 0.000151 0.002225 0.000040 0.000067
3710.000149 0.000142 0.002858 0.000048 0.000083
3720.000203 0.000185 0.004022 0.000049 0.000086
3730.000212 0.000188 0.005086 0.000056 0.000093
3740.000220 0.000203 0.004209 0.000051 0.000085
3750.000208 0.000247 0.009261 0.000098 0.000089
3760.000211 0.000262 0.002546 0.000041 0.000066
3770.000198 0.000150 0.002534 0.000039 0.000079
3780.000159 0.000143 0.002207 0.000038 0.000094
3790.000157 0.000143 0.002173 0.000038 0.000062
3800.000198 0.000505 0.002157 0.000039 0.000079
3810.000164 0.000143 0.002172 0.000038 0.000076
3820.000156 0.000148 0.002259 0.000039 0.000080
3830.000161 0.000142 0.002219 0.000039 0.000076
3840.000161 0.000143 0.002266 0.000039 0.000085
3850.000161 0.000141 0.002150 0.000036 0.000077
3860.000179 0.000140 0.002140 0.000036 0.000071
3870.000157 0.000151 0.002316 0.000040 0.000079
3880.000149 0.000143 0.002269 0.000039 0.000066
3890.000161 0.000142 0.002206 0.000040 0.000091
3900.000172 0.000143 0.002244 0.000039 0.000067
3910.000168 0.000142 0.002189 0.000039 0.000083
3920.000163 0.000188 0.002156 0.000037 0.000077
3930.000168 0.000143 0.002266 0.000039 0.000084
3940.000166 0.000147 0.002205 0.000325 0.000078
3950.000175 0.000140 0.002173 0.000037 0.000106
3960.000170 0.000153 0.002158 0.000036 0.000083
3970.000168 0.000147 0.002825 0.000039 0.000108
3980.000172 0.000151 0.002483 0.000038 0.000085
3990.000160 0.000143 0.002163 0.000038 0.000066
4000.000161 0.000154 0.002493 0.000039 0.000084
4010.000167 0.000153 0.002564 0.000040 0.000082
4020.000159 0.000151 0.002185 0.000046 0.000088
4030.000157 0.000156 0.002175 0.000039 0.000076
4040.000150 0.000144 0.002151 0.000038 0.000063
4050.000160 0.000140 0.002429 0.000038 0.000064
4060.000160 0.000154 0.002184 0.000048 0.000077
4070.000168 0.000142 0.002686 0.000040 0.000119
4080.000164 0.000152 0.002279 0.000039 0.000075
4090.000161 0.000143 0.002192 0.000068 0.000067
4100.000161 0.000154 0.002190 0.000040 0.000092
4110.000246 0.000146 0.003064 0.000038 0.000072
4120.000163 0.000158 0.002171 0.000037 0.000073
4130.000216 0.000144 0.002209 0.000039 0.000115
4140.000159 0.000141 0.003338 0.000039 0.000079
4150.000277 0.000158 0.002464 0.000039 0.000082
4160.000168 0.000150 0.002227 0.000037 0.000079
4170.000168 0.000146 0.002775 0.000038 0.000077
4180.000146 0.000147 0.002694 0.000042 0.000084
4190.000160 0.000145 0.002807 0.000039 0.000066
4200.000162 0.000177 0.002187 0.000063 0.000066
4210.000147 0.000141 0.002220 0.000038 0.000085
4220.000160 0.000142 0.002216 0.000037 0.000077
4230.000166 0.000159 0.002224 0.000039 0.000108
4240.000147 0.000141 0.002746 0.000039 0.000078
4250.000159 0.000141 0.002194 0.000037 0.000063
4260.000164 0.000143 0.002164 0.000039 0.000067
4270.000169 0.000152 0.002278 0.000074 0.000088
4280.000157 0.000157 0.002155 0.000068 0.000076
4290.000159 0.000140 0.002170 0.000035 0.000078
4300.000156 0.000141 0.002299 0.000040 0.000066
4310.000192 0.000160 0.002241 0.000039 0.000082
4320.000149 0.000143 0.002288 0.000039 0.000079
4330.000161 0.000142 0.002185 0.000049 0.000077
4340.000147 0.000149 0.002284 0.000039 0.000063
4350.000456 0.000144 0.002203 0.000046 0.000064
4360.000187 0.000144 0.002147 0.000037 0.000061
4370.000147 0.000140 0.002238 0.000040 0.000067
4380.000147 0.000140 0.003077 0.000041 0.000068
4390.000151 0.000142 0.002226 0.000038 0.000065
4400.000146 0.000142 0.002188 0.000039 0.000065
4410.000145 0.000141 0.002156 0.000036 0.000061
4420.000143 0.000172 0.002379 0.000037 0.000060
4430.000152 0.000231 0.002172 0.000038 0.000065
4440.000153 0.000142 0.002181 0.000039 0.000065
4450.000148 0.000142 0.002567 0.000039 0.000067
4460.000150 0.000142 0.002177 0.000038 0.000072
4470.000147 0.000146 0.002328 0.000038 0.000063
4480.000146 0.000150 0.002211 0.000038 0.000063
4490.000149 0.000143 0.002222 0.000040 0.000072
4500.000150 0.000144 0.002455 0.000039 0.000065
4510.000147 0.000144 0.002206 0.000039 0.000066
4520.000145 0.000141 0.002153 0.000055 0.000070
4530.000443 0.000144 0.002139 0.000036 0.000069
4540.000147 0.000182 0.002188 0.000037 0.000061
4550.000146 0.000138 0.002248 0.000038 0.000067
4560.000147 0.000142 0.002817 0.000039 0.000067
4570.000148 0.000144 0.002230 0.000038 0.000066
4580.000148 0.000142 0.002239 0.000039 0.000067
4590.000149 0.000142 0.002197 0.000038 0.000063
4600.000181 0.000674 0.002170 0.000038 0.000061
4610.000146 0.000195 0.002204 0.000037 0.000061
4620.000146 0.000141 0.002260 0.000039 0.000067
4630.000150 0.000142 0.002193 0.000045 0.000065
4640.000147 0.000140 0.002229 0.000036 0.000066
4650.000146 0.000137 0.002197 0.000037 0.000062
4660.000152 0.000159 0.002187 0.000036 0.000060
4670.000145 0.000139 0.002224 0.000037 0.000064
4680.000149 0.000144 0.002175 0.000038 0.000066
4690.000150 0.000143 0.002187 0.000038 0.000066
4700.000148 0.000141 0.002152 0.000036 0.000061
4710.000185 0.000141 0.002176 0.000036 0.000064
4720.000169 0.000145 0.002483 0.000038 0.000067
4730.000149 0.000141 0.002225 0.000036 0.000064
4740.000244 0.000149 0.002538 0.000038 0.000065
4750.000156 0.000143 0.002317 0.000039 0.000297
4760.000228 0.000172 0.002222 0.000039 0.000300
4770.000149 0.000145 0.002173 0.000040 0.000066
4780.000154 0.000145 0.002155 0.000038 0.000093
4790.000161 0.000145 0.002178 0.000039 0.000063
4800.000147 0.000170 0.002299 0.000039 0.000066
4810.000149 0.000142 0.003494 0.000040 0.000066
4820.000149 0.000178 0.002237 0.000038 0.000062
4830.000148 0.000143 0.002150 0.000037 0.000064
4840.000146 0.000139 0.002315 0.000038 0.000065
4850.000147 0.000141 0.002269 0.000039 0.000067
4860.000173 0.000145 0.002191 0.000037 0.000065
4870.000166 0.000144 0.002247 0.000038 0.000061
4880.000146 0.000140 0.002551 0.000038 0.000065
4890.000148 0.000175 0.002202 0.000037 0.000064
4900.000145 0.000141 0.002217 0.000038 0.000063
4910.000146 0.000138 0.002164 0.000132 0.000547
4920.000148 0.000144 0.008140 0.000160 0.000893
4930.000311 0.000221 0.004526 0.000058 0.000109
4940.000238 0.000225 0.003475 0.000044 0.000094
4950.000178 0.000177 0.002537 0.000041 0.000087
4960.000172 0.000161 0.002194 0.000048 0.000084
4970.000172 0.000163 0.002177 0.000040 0.000084
4980.001177 0.000156 0.002351 0.000041 0.000325
4990.000167 0.000163 0.002273 0.000040 0.000088
5000.000170 0.000151 0.002245 0.000040 0.000077
5010.000172 0.000896 0.002181 0.000038 0.000080
5020.000202 0.000164 0.002449 0.000038 0.000076
5030.000162 0.000161 0.002188 0.000037 0.000078
5040.000165 0.000154 0.002440 0.000074 0.000091
5050.000167 0.000149 0.002185 0.000039 0.000081
5060.000176 0.000154 0.002427 0.000040 0.000093
5070.000168 0.000154 0.002304 0.000038 0.000105
5080.000672 0.000160 0.002260 0.000038 0.000088
5090.000686 0.000159 0.002207 0.000038 0.000084
5100.000163 0.000154 0.002186 0.000037 0.000077
5110.000173 0.000153 0.002399 0.000038 0.000082
5120.000166 0.000157 0.002709 0.000039 0.000077
5130.000155 0.000149 0.002143 0.000038 0.000097
5140.000166 0.000154 0.003454 0.000051 0.000106
5150.000166 0.000160 0.002539 0.000039 0.000128
5160.000169 0.000149 0.002307 0.000039 0.000085
5170.000170 0.000158 0.002225 0.000040 0.000088
5180.000170 0.000180 0.002165 0.000036 0.000103
5190.000203 0.000160 0.002345 0.000039 0.000075
5200.000173 0.000191 0.002160 0.000038 0.000074
5210.000165 0.000156 0.002243 0.000039 0.000085
5220.000172 0.000154 0.002260 0.000040 0.000090
5230.000163 0.000164 0.002258 0.000040 0.000085
5240.000168 0.000143 0.002755 0.000039 0.000086
5250.000178 0.000155 0.002202 0.000039 0.000075
5260.000164 0.000153 0.002267 0.000038 0.000081
5270.000161 0.000154 0.002158 0.000036 0.000090
5280.000169 0.000158 0.002454 0.000037 0.000061
5290.000162 0.000154 0.002543 0.000038 0.000091
5300.000170 0.000154 0.002168 0.000037 0.000085
5310.000166 0.000151 0.002852 0.000038 0.000087
5320.000167 0.000165 0.002484 0.000039 0.000089
5330.000374 0.000197 0.002217 0.000038 0.000082
5340.000156 0.000150 0.002213 0.000038 0.000112
5350.000683 0.000155 0.002131 0.000038 0.000077
5360.000162 0.000164 0.002199 0.000038 0.000076
5370.000176 0.000154 0.002345 0.000038 0.000089
5380.000175 0.000150 0.002928 0.000039 0.000082
5390.000161 0.000140 0.002528 0.000039 0.000066
5400.000159 0.000151 0.002256 0.000039 0.000075
5410.000155 0.000156 0.002233 0.000040 0.000066
5420.000171 0.000156 0.002149 0.000066 0.000084
5430.000182 0.000154 0.002233 0.000037 0.000117
5440.000166 0.000160 0.002460 0.000037 0.000088
5450.000159 0.000165 0.002891 0.000043 0.000075
5460.000169 0.000143 0.002383 0.000038 0.000084
5470.000162 0.000149 0.002313 0.000039 0.000078
5480.000166 0.000161 0.003837 0.000041 0.000092
5490.000166 0.000144 0.002389 0.000038 0.000078
5500.000185 0.000153 0.002548 0.000040 0.000090
5510.000166 0.000152 0.002943 0.000037 0.000063
5520.000147 0.000140 0.002284 0.000038 0.000066
5530.000145 0.000141 0.002555 0.000038 0.000071
5540.000189 0.000143 0.002235 0.000038 0.000359
5550.000149 0.000140 0.002779 0.000053 0.000089
5560.000211 0.000206 0.002744 0.000040 0.000067
5570.000150 0.000144 0.002471 0.000039 0.000065
5580.000151 0.000140 0.002563 0.000040 0.000064
5590.000148 0.000138 0.002305 0.000039 0.000066
5600.000148 0.000141 0.002162 0.000036 0.000060
5610.000182 0.000145 0.002403 0.000042 0.000063
5620.000152 0.000141 0.002311 0.000039 0.000065
5630.000148 0.000180 0.002192 0.000038 0.000065
5640.000149 0.000141 0.002516 0.000039 0.000066
5650.000147 0.000142 0.002193 0.000040 0.000064
5660.000146 0.000138 0.002194 0.000036 0.000060
5670.000197 0.000142 0.002291 0.000038 0.000063
5680.000148 0.000142 0.002440 0.000039 0.000066
5690.000148 0.000143 0.002228 0.000039 0.000066
5700.000149 0.000140 0.002216 0.000038 0.000067
5710.000148 0.000145 0.002196 0.000038 0.000066
5720.000148 0.000141 0.002157 0.000036 0.000061
5730.000144 0.000175 0.002491 0.000039 0.000063
5740.000147 0.000141 0.002290 0.000039 0.000066
5750.000149 0.000143 0.002508 0.000039 0.000067
5760.000149 0.000142 0.002536 0.000039 0.000067
5770.000150 0.000141 0.003132 0.000046 0.000070
5780.000153 0.000145 0.002202 0.000039 0.000067
5790.000149 0.000143 0.002102 0.000037 0.000067
5800.000989 0.000142 0.002188 0.000063 0.000068
5810.000151 0.000142 0.002229 0.000038 0.000068
5820.001481 0.000141 0.002238 0.000039 0.000070
5830.000148 0.000142 0.002204 0.000037 0.000093
5840.000160 0.000141 0.002138 0.000038 0.000062
5850.000145 0.000141 0.002708 0.000039 0.000065
5860.000147 0.000142 0.002218 0.000039 0.000067
5870.000148 0.000140 0.002759 0.000038 0.000066
5880.000148 0.000139 0.003156 0.000037 0.000067
5890.000185 0.000141 0.002259 0.000040 0.000066
5900.000148 0.000142 0.002226 0.000047 0.000068
5910.000148 0.000142 0.002305 0.000040 0.000090
5920.001000 0.000155 0.002217 0.000064 0.000068
5930.000154 0.000144 0.002554 0.000038 0.000065
5940.000148 0.000141 0.002151 0.000038 0.000066
5950.000146 0.000181 0.003031 0.000039 0.000062
5960.000146 0.000180 0.002254 0.000039 0.000061
5970.000147 0.000143 0.002188 0.000039 0.000065
5980.000147 0.000140 0.002259 0.000039 0.000063
5990.000146 0.000141 0.002238 0.000038 0.000076
6000.000148 0.000141 0.002163 0.000038 0.000061
6010.000153 0.000143 0.002195 0.000043 0.000072
6020.000149 0.000177 0.003291 0.000039 0.000063
6030.000258 0.000153 0.002150 0.000039 0.000066
6040.000157 0.000144 0.002155 0.000037 0.000060
6050.000160 0.001194 0.002269 0.000040 0.000100
6060.000164 0.000151 0.002162 0.000038 0.000078
6070.000163 0.000424 0.002178 0.000036 0.000069
6080.001333 0.000389 0.002249 0.000039 0.000066
6090.000175 0.000142 0.002208 0.000037 0.000102
6100.000443 0.000156 0.002249 0.000040 0.000062
6110.000244 0.001562 0.003049 0.000041 0.000083
6120.000208 0.000183 0.002483 0.000040 0.000068
6130.000164 0.000156 0.002220 0.000040 0.000078
6140.000169 0.000142 0.002694 0.000040 0.000083
6150.000162 0.000152 0.002453 0.000038 0.000077
6160.000157 0.000189 0.002306 0.000040 0.000077
6170.000162 0.000151 0.002200 0.000039 0.000325
6180.000150 0.000142 0.002251 0.000039 0.000066
6190.000172 0.000157 0.002184 0.000039 0.000073
6200.000160 0.000150 0.002678 0.000038 0.000326
6210.000165 0.000151 0.002292 0.000038 0.000094
6220.000162 0.000156 0.002203 0.000037 0.000083
6230.000170 0.000141 0.002175 0.000037 0.000074
6240.000149 0.000166 0.002235 0.000039 0.000071
6250.000161 0.000143 0.002423 0.000036 0.000180
6260.000164 0.000152 0.003095 0.000039 0.000076
6270.000172 0.000153 0.002466 0.000039 0.000115
6280.000151 0.000153 0.002274 0.000039 0.000066
6290.000150 0.000142 0.003179 0.000040 0.000080
6300.000172 0.000159 0.002421 0.000039 0.000083
6310.000159 0.000142 0.002165 0.000037 0.000068
6320.000155 0.000150 0.002233 0.000041 0.000123
6330.000153 0.000158 0.002253 0.000039 0.000571
6340.000203 0.000145 0.002269 0.000041 0.000077
6350.000164 0.000158 0.002176 0.000038 0.000086
6360.000197 0.000144 0.002220 0.000041 0.000080
6370.000174 0.000403 0.002224 0.000039 0.000063
6380.000218 0.000144 0.002150 0.000036 0.000069
6390.000149 0.000141 0.002479 0.000040 0.000079
6400.000163 0.000145 0.002664 0.000039 0.000082
6410.000150 0.000152 0.002446 0.000040 0.000069
6420.000203 0.000154 0.002205 0.000043 0.000077
6430.000160 0.000143 0.002210 0.000039 0.000087
6440.000194 0.000145 0.002167 0.000038 0.000069
6450.000151 0.000154 0.002137 0.000036 0.000079
6460.000162 0.000140 0.002697 0.000037 0.000085
6470.000162 0.000143 0.002233 0.000039 0.000076
6480.000148 0.000144 0.002210 0.000039 0.000065
6490.000151 0.000152 0.003015 0.000041 0.000084
6500.000158 0.000156 0.002730 0.000039 0.000079
6510.000312 0.000165 0.002207 0.000038 0.000076
6520.000167 0.000139 0.002297 0.000040 0.000065
6530.000172 0.000154 0.002205 0.000037 0.000080
6540.000146 0.000149 0.002286 0.000039 0.000076
6550.000164 0.000151 0.002214 0.000038 0.000073
6560.000162 0.000169 0.003110 0.000038 0.000067
6570.000293 0.000144 0.002182 0.000038 0.000060
6580.000157 0.000153 0.003778 0.000049 0.000095
6590.001735 0.000210 0.004360 0.000050 0.000083
6600.000297 0.000198 0.002532 0.000039 0.000072
6610.000185 0.000163 0.002173 0.000039 0.000070
6620.000183 0.000142 0.002122 0.000038 0.000062
6630.000147 0.000145 0.002443 0.000039 0.000066
6640.000149 0.000144 0.002473 0.000040 0.000066
6650.000147 0.000139 0.002949 0.000038 0.000063
6660.000147 0.000139 0.002737 0.000039 0.000066
6670.000199 0.000142 0.002927 0.000038 0.000066
6680.000149 0.000141 0.002188 0.000038 0.000065
6690.000147 0.000144 0.002203 0.000038 0.000066
6700.000149 0.000141 0.002154 0.000037 0.000062
6710.000144 0.000137 0.003526 0.000037 0.000066
6720.000151 0.000153 0.002150 0.000036 0.000060
6730.000145 0.000138 0.002202 0.000037 0.000065
6740.000272 0.000187 0.002477 0.000038 0.000306
6750.000148 0.000141 0.002421 0.000038 0.000067
6760.000147 0.000141 0.002252 0.000039 0.000065
6770.000150 0.000140 0.002144 0.000037 0.000061
6780.000191 0.000144 0.002229 0.000038 0.000060
6790.000145 0.000145 0.002202 0.000038 0.000061
6800.000146 0.000142 0.002418 0.000038 0.000065
6810.000189 0.000171 0.002568 0.000040 0.000066
6820.000150 0.000141 0.002300 0.000039 0.000067
6830.000151 0.000141 0.002199 0.000038 0.000347
6840.000147 0.000140 0.002165 0.000035 0.000061
6850.000151 0.000646 0.002310 0.000040 0.000062
6860.000161 0.000410 0.002195 0.000038 0.000061
6870.000147 0.000141 0.002466 0.000039 0.000066
6880.000147 0.000141 0.003026 0.000038 0.000066
6890.000148 0.000142 0.002223 0.000038 0.000065
6900.000147 0.000142 0.002196 0.000038 0.000067
6910.000147 0.000141 0.002155 0.000044 0.000064
6920.000146 0.000140 0.002354 0.000039 0.000067
6930.000149 0.000143 0.002186 0.000037 0.000062
6940.000150 0.000144 0.002498 0.000040 0.000063
6950.000178 0.000212 0.002453 0.000039 0.000062
6960.000149 0.000177 0.002463 0.000038 0.000063
6970.000147 0.000142 0.002507 0.000038 0.000067
6980.000149 0.000142 0.002717 0.000038 0.000066
6990.000148 0.000141 0.002452 0.000037 0.000065
7000.000147 0.000140 0.002266 0.000039 0.000066
7010.000149 0.000141 0.002183 0.000037 0.000066
7020.000153 0.000142 0.002203 0.000039 0.000067
7030.000152 0.000419 0.002245 0.000040 0.000062
7040.000149 0.000181 0.002181 0.000038 0.000063
7050.000147 0.000142 0.002224 0.000039 0.000066
7060.000147 0.000142 0.002204 0.000038 0.000066
7070.000146 0.000141 0.002250 0.000038 0.000065
7080.000148 0.000141 0.002142 0.000038 0.000063
7090.000156 0.000139 0.002176 0.000036 0.000060
7100.000243 0.000148 0.002768 0.000039 0.000069
7110.000146 0.000204 0.002194 0.000037 0.000065
7120.000147 0.000143 0.003071 0.000039 0.000066
7130.000148 0.000144 0.003489 0.000042 0.000073
7140.000151 0.000151 0.002173 0.000039 0.000064
7150.000146 0.000140 0.003509 0.000038 0.000067
7160.000148 0.000142 0.002191 0.000038 0.000064
7170.000146 0.000139 0.002441 0.000039 0.000117
7180.000174 0.000141 0.002133 0.000038 0.000065
7190.000151 0.000142 0.002257 0.000039 0.000073
7200.000163 0.000147 0.002187 0.000038 0.000061
7210.000146 0.000222 0.002193 0.000038 0.000062
7220.000145 0.000143 0.002434 0.000037 0.000064
7230.000145 0.000139 0.002933 0.000041 0.000066
7240.000146 0.000140 0.002680 0.000037 0.000065
7250.000143 0.000139 0.002217 0.001029 0.000065
7260.000145 0.000139 0.002361 0.000039 0.000067
7270.000150 0.000143 0.002186 0.000068 0.000066
7280.000148 0.000142 0.002149 0.000037 0.000061
7290.000147 0.000181 0.002183 0.000037 0.000061
7300.000146 0.000455 0.002305 0.000038 0.000074
7310.000148 0.000143 0.002223 0.000038 0.000066
7320.000148 0.000141 0.002547 0.000038 0.000066
7330.000148 0.000143 0.002180 0.000038 0.000336
7340.000146 0.000141 0.002102 0.000037 0.000063
7350.000150 0.000145 0.002170 0.000037 0.000067
7360.000152 0.000138 0.002982 0.000038 0.000067
7370.000149 0.000143 0.002419 0.000037 0.000064
7380.000145 0.000195 0.002228 0.000040 0.000067
7390.000148 0.000143 0.002193 0.000038 0.000064
7400.000155 0.000141 0.002166 0.000067 0.000066
7410.000454 0.000176 0.002193 0.000038 0.000063
7420.000186 0.000142 0.002165 0.000035 0.000066
7430.000144 0.000138 0.002542 0.000038 0.000066
7440.000148 0.000143 0.002733 0.000039 0.000066
7450.000147 0.000141 0.002227 0.000038 0.000067
7460.000145 0.000142 0.002764 0.000037 0.000064
7470.000144 0.000138 0.002207 0.000037 0.000065
7480.000147 0.000185 0.002262 0.000038 0.000062
7490.000154 0.000160 0.002163 0.000038 0.000063
7500.000150 0.000145 0.002719 0.000038 0.000065
7510.000145 0.000139 0.002226 0.000037 0.000074
7520.000148 0.000140 0.002517 0.000038 0.000067
7530.000148 0.000142 0.003734 0.000039 0.000067
7540.000147 0.000143 0.002508 0.000039 0.000067
7550.000146 0.000143 0.002288 0.000038 0.000067
7560.000149 0.000143 0.002899 0.000039 0.000067
7570.000150 0.000145 0.002232 0.000037 0.000065
7580.000148 0.000142 0.002169 0.000039 0.000067
7590.000161 0.000141 0.002196 0.000036 0.000060
7600.000145 0.000137 0.002467 0.000040 0.000064
7610.000147 0.000141 0.002168 0.000037 0.000063
7620.000147 0.000139 0.002165 0.000037 0.000064
7630.000146 0.000138 0.002167 0.000036 0.000060
7640.000150 0.000141 0.002326 0.000039 0.000063
7650.000149 0.000179 0.002197 0.000039 0.000063
7660.000148 0.000142 0.002538 0.000039 0.000067
7670.000148 0.000148 0.002555 0.000039 0.000067
7680.000150 0.000144 0.002180 0.000038 0.000066
7690.000245 0.000152 0.002203 0.000038 0.000065
7700.000146 0.000142 0.002118 0.000036 0.000091
7710.000648 0.000141 0.002173 0.000035 0.000058
7720.000142 0.000149 0.002137 0.000037 0.000059
7730.000144 0.000138 0.002191 0.000037 0.000063
7740.000143 0.000137 0.002795 0.000039 0.000065
7750.000147 0.000256 0.002250 0.000038 0.000064
7760.000148 0.000142 0.002231 0.000040 0.000075
7770.000149 0.000143 0.002174 0.000038 0.000061
7780.000182 0.000708 0.002255 0.000038 0.000061
7790.000181 0.000170 0.002222 0.000038 0.000060
7800.000148 0.000141 0.002177 0.000038 0.000065
7810.000147 0.000141 0.002478 0.000039 0.000065
7820.000148 0.000141 0.002191 0.000039 0.000065
7830.000146 0.000139 0.002161 0.000067 0.000063
7840.000157 0.000138 0.002174 0.000036 0.000059
7850.000143 0.000165 0.002396 0.000040 0.000067
7860.000148 0.000141 0.002302 0.000044 0.000067
7870.000148 0.000142 0.002226 0.000043 0.000065
7880.000149 0.000142 0.002198 0.000038 0.000087
7890.000147 0.000143 0.002221 0.000039 0.000066
7900.000146 0.000142 0.002376 0.000065 0.000063
7910.000152 0.000154 0.002201 0.000038 0.000062
7920.000150 0.000142 0.002705 0.000039 0.000067
7930.000149 0.000142 0.002267 0.000039 0.000067
7940.000194 0.000149 0.002347 0.000039 0.000066
7950.000155 0.000141 0.002594 0.000038 0.000066
7960.000148 0.000141 0.002189 0.000038 0.000064
7970.000202 0.000142 0.002155 0.000039 0.000062
7980.000182 0.000146 0.002204 0.000037 0.000061
7990.000146 0.000139 0.002466 0.000037 0.000065
8000.000146 0.000140 0.002463 0.000036 0.000065
8010.000146 0.000139 0.002209 0.000037 0.000063
8020.000145 0.000138 0.002146 0.000036 0.000060
8030.000181 0.000142 0.003356 0.000038 0.000068
8040.000161 0.000142 0.002169 0.000038 0.000062
8050.000146 0.000175 0.002538 0.000039 0.000061
8060.000148 0.000141 0.002482 0.000039 0.000067
8070.000148 0.000144 0.002450 0.000040 0.000066
8080.000149 0.000143 0.002466 0.000043 0.000068
8090.000148 0.000144 0.003551 0.000038 0.000068
8100.000149 0.000142 0.002482 0.000039 0.000066
8110.000149 0.000142 0.002220 0.000039 0.000066
8120.000151 0.000140 0.002199 0.000038 0.000064
8130.000148 0.000184 0.002185 0.000038 0.000066
8140.000145 0.000140 0.002158 0.000036 0.000092
8150.000158 0.000140 0.002262 0.000038 0.000062
8160.000148 0.000143 0.002674 0.000039 0.000066
8170.000148 0.000140 0.002421 0.000039 0.000066
8180.000149 0.000149 0.002433 0.000038 0.000065
8190.000146 0.000172 0.002187 0.000038 0.000065
8200.000146 0.000140 0.002311 0.000039 0.000323
8210.000149 0.000142 0.002180 0.000038 0.000091
8220.000420 0.000143 0.002483 0.000038 0.000063
8230.000685 0.000145 0.002136 0.000035 0.000064
8240.000146 0.000145 0.002433 0.000038 0.000062
8250.000146 0.000139 0.002496 0.000039 0.000066
8260.000149 0.000139 0.003626 0.000041 0.000068
8270.000153 0.000147 0.002272 0.000042 0.000067
8280.000248 0.000155 0.002208 0.000038 0.000063
8290.000146 0.000138 0.002524 0.000038 0.000068
8300.000147 0.000140 0.002176 0.000210 0.000065
8310.000147 0.000140 0.002166 0.000036 0.000060
8320.000144 0.000146 0.002169 0.000036 0.000057
8330.000144 0.000138 0.002207 0.000037 0.000063
8340.000145 0.000138 0.002183 0.000037 0.000062
8350.000145 0.000137 0.002167 0.000036 0.000059
8360.000148 0.000453 0.002310 0.000038 0.000061
8370.000183 0.000855 0.002326 0.000037 0.000061
8380.000146 0.000175 0.002672 0.000036 0.000060
8390.000143 0.000140 0.002238 0.000039 0.000065
8400.000146 0.000139 0.002473 0.000037 0.000064
8410.000146 0.000139 0.002196 0.000039 0.000065
8420.000145 0.000139 0.002141 0.000036 0.000061
8430.000174 0.000397 0.002175 0.000036 0.000059
8440.000143 0.000139 0.002647 0.000037 0.000065
8450.000147 0.000138 0.002196 0.000037 0.000064
8460.000146 0.000138 0.002199 0.000037 0.000063
8470.000146 0.000138 0.002167 0.000036 0.000066
8480.000169 0.000141 0.002156 0.000036 0.000060
8490.000143 0.000139 0.002180 0.000037 0.000065
8500.000144 0.000136 0.002756 0.000039 0.000066
8510.000150 0.000141 0.002919 0.000039 0.000066
8520.000147 0.000140 0.002184 0.000036 0.000065
8530.000145 0.000138 0.002168 0.000036 0.000091
8540.000156 0.000139 0.002169 0.000036 0.000059
8550.000143 0.000139 0.002741 0.000038 0.000065
8560.000147 0.000140 0.002429 0.000037 0.000063
8570.000145 0.000139 0.002226 0.000037 0.000064
8580.000145 0.000139 0.003381 0.000040 0.000066
8590.000153 0.000141 0.002262 0.000038 0.000064
8600.000145 0.000140 0.002137 0.000036 0.000062
8610.000154 0.000650 0.002217 0.000038 0.000063
8620.000184 0.000143 0.002209 0.000038 0.000062
8630.000153 0.000142 0.002907 0.000039 0.000066
8640.000147 0.000142 0.002158 0.000038 0.000064
8650.000146 0.000140 0.002953 0.000039 0.000068
8660.000148 0.000143 0.002208 0.000039 0.000065
8670.000149 0.000139 0.002187 0.000036 0.000065
8680.000144 0.000139 0.002157 0.000036 0.000061
8690.000154 0.000926 0.002139 0.000036 0.000059
8700.000183 0.000140 0.002526 0.000038 0.000062
8710.000148 0.000142 0.002207 0.000038 0.000066
8720.000147 0.000139 0.002790 0.000039 0.000069
8730.000149 0.000144 0.002251 0.000038 0.000066
8740.000151 0.000140 0.002220 0.000039 0.000066
8750.000148 0.000142 0.002523 0.000038 0.000064
8760.000151 0.000138 0.002151 0.000037 0.000065
8770.000147 0.000140 0.002251 0.000037 0.000062
8780.000149 0.000139 0.002607 0.000037 0.000065
8790.000147 0.000141 0.003380 0.000037 0.000066
8800.000147 0.000139 0.002285 0.000069 0.000066
8810.000149 0.000142 0.002566 0.000038 0.000067
8820.000147 0.000142 0.002523 0.000038 0.000067
8830.000152 0.000143 0.002215 0.000038 0.000067
8840.000150 0.000144 0.002243 0.000038 0.000075
8850.000149 0.000141 0.002148 0.000036 0.000063
8860.000182 0.000144 0.002167 0.000036 0.000062
8870.000278 0.000155 0.002631 0.000036 0.000061
8880.000149 0.000139 0.003175 0.000040 0.000066
8890.000156 0.000140 0.002660 0.000038 0.000065
8900.000148 0.000141 0.006171 0.000067 0.000069
8910.000164 0.000142 0.002713 0.000038 0.000064
8920.000161 0.000150 0.002270 0.000038 0.000081
8930.000160 0.000283 0.002276 0.000038 0.000083
8940.000168 0.000150 0.002207 0.000037 0.000072
8950.000151 0.000669 0.002160 0.000038 0.000062
8960.000196 0.000156 0.002363 0.000036 0.000061
8970.000162 0.000141 0.002160 0.000037 0.000077
8980.000147 0.000141 0.002676 0.000038 0.000096
8990.000162 0.000143 0.002263 0.000037 0.000065
9000.000162 0.000141 0.002206 0.000036 0.000080
9010.000146 0.000139 0.002149 0.000036 0.000060
9020.000169 0.000884 0.002163 0.000036 0.000076
9030.000187 0.000140 0.002222 0.000036 0.000061
9040.000145 0.000140 0.002192 0.000037 0.000084
9050.000145 0.000138 0.002619 0.000039 0.000116
9060.000158 0.000149 0.002213 0.000038 0.000089
9070.000145 0.000183 0.002154 0.000038 0.000089
9080.000162 0.000142 0.002142 0.000037 0.000061
9090.000146 0.000178 0.002401 0.000038 0.000062
9100.000145 0.000150 0.002741 0.000037 0.000081
9110.000147 0.000139 0.002360 0.000040 0.000067
9120.000151 0.000153 0.002459 0.000039 0.000075
9130.000148 0.000155 0.002459 0.000037 0.000091
9140.000153 0.000152 0.002174 0.000036 0.000064
9150.000424 0.000149 0.002116 0.000036 0.000068
9160.000166 0.000168 0.002625 0.000038 0.000076
9170.000146 0.000141 0.002957 0.000038 0.000067
9180.000160 0.000142 0.002501 0.000039 0.000079
9190.000147 0.000143 0.002219 0.000038 0.000066
9200.000160 0.000143 0.002771 0.000040 0.000079
9210.000148 0.000150 0.002426 0.000037 0.000082
9220.000146 0.000138 0.002134 0.000036 0.000103
9230.000659 0.000143 0.002197 0.000036 0.000073
9240.000179 0.000153 0.002301 0.000038 0.000074
9250.000147 0.000142 0.002258 0.000038 0.000066
9260.000146 0.000141 0.002210 0.000038 0.000066
9270.000161 0.000141 0.002235 0.000038 0.000084
9280.000145 0.000138 0.002131 0.000036 0.000060
9290.000151 0.000211 0.002265 0.000038 0.000062
9300.000147 0.000142 0.002254 0.000038 0.000067
9310.000148 0.000143 0.002217 0.000038 0.000079
9320.000160 0.000155 0.002229 0.000038 0.000066
9330.000145 0.000142 0.002129 0.000038 0.000065
9340.000165 0.000140 0.002140 0.000036 0.000076
9350.000162 0.000142 0.002452 0.000039 0.000079
9360.000148 0.000143 0.002253 0.000059 0.000068
9370.000164 0.000142 0.003378 0.000039 0.000096
9380.000150 0.000194 0.002192 0.000039 0.000067
9390.000161 0.000152 0.002202 0.000037 0.000077
9400.000160 0.000141 0.002258 0.000039 0.000067
9410.000167 0.000143 0.002706 0.000039 0.000067
9420.000149 0.000155 0.002280 0.000037 0.000100
9430.000174 0.000144 0.002134 0.000037 0.000090
9440.001167 0.000154 0.002224 0.000038 0.000067
9450.000162 0.000155 0.002181 0.000035 0.000065
9460.000773 0.000153 0.002145 0.000036 0.000060
9470.000149 0.000161 0.002160 0.000036 0.000071
9480.000208 0.000144 0.002164 0.000035 0.000060
9490.000143 0.000138 0.002156 0.000036 0.000064
9500.000143 0.000138 0.002225 0.000055 0.000066
9510.000147 0.000141 0.002734 0.000038 0.000065
9520.000145 0.000147 0.002173 0.000037 0.000064
9530.000146 0.000139 0.002112 0.000037 0.000060
9540.000144 0.000137 0.002708 0.000038 0.000064
9550.000144 0.000139 0.002421 0.000037 0.000064
9560.000145 0.000140 0.002449 0.000037 0.000063
9570.000143 0.000138 0.002278 0.000038 0.000064
9580.000145 0.000140 0.002427 0.000040 0.000130
9590.000151 0.000142 0.002155 0.000036 0.000064
9600.000181 0.000139 0.002435 0.000036 0.000060
9610.000145 0.000138 0.003527 0.000038 0.000065
9620.000146 0.000178 0.002178 0.000036 0.000060
9630.000145 0.000138 0.002139 0.000037 0.000065
9640.000145 0.000137 0.003006 0.000037 0.000064
9650.000146 0.000139 0.002204 0.000037 0.000065
9660.000145 0.000139 0.002211 0.000038 0.000062
9670.000182 0.000140 0.002221 0.000036 0.000061
9680.000145 0.000139 0.003169 0.000038 0.000068
9690.000149 0.000174 0.002414 0.000038 0.000066
9700.000147 0.000142 0.002234 0.000038 0.000066
9710.000149 0.000143 0.002678 0.000038 0.000065
9720.000148 0.000141 0.002886 0.000038 0.000066
9730.000145 0.000140 0.002250 0.000038 0.000065
9740.000148 0.000139 0.002181 0.000035 0.000065
9750.000718 0.000142 0.002141 0.000035 0.000059
9760.000189 0.000140 0.002383 0.000036 0.000059
9770.000145 0.000139 0.002206 0.000039 0.000065
9780.000154 0.000186 0.002457 0.000038 0.000066
9790.000190 0.000141 0.002224 0.000038 0.000066
9800.000149 0.000141 0.002151 0.000037 0.000066
9810.000215 0.000143 0.002151 0.000035 0.000061
9820.000144 0.000138 0.002822 0.000039 0.000065
9830.000147 0.000139 0.002275 0.000038 0.000065
9840.000148 0.000141 0.002211 0.000036 0.000064
9850.000146 0.000138 0.002201 0.000037 0.000066
9860.000148 0.000140 0.002273 0.000038 0.000068
9870.000150 0.000144 0.002188 0.000037 0.000063
9880.000152 0.000151 0.002190 0.000037 0.000062
9890.000146 0.000142 0.003145 0.000039 0.000067
9900.000151 0.000139 0.002218 0.000037 0.000065
9910.000145 0.000138 0.002264 0.000037 0.000066
9920.000148 0.000142 0.003011 0.000039 0.000067
9930.000149 0.000141 0.002196 0.000038 0.000065
9940.000146 0.000141 0.002188 0.000036 0.000060
9950.000149 0.000140 0.002190 0.000035 0.000060
9960.000144 0.000137 0.002641 0.000038 0.000064
9970.000146 0.000138 0.002182 0.000043 0.000065
9980.000146 0.000141 0.002216 0.000036 0.000064
9990.000147 0.000139 0.002294 0.000039 0.000068
10000.000657 0.000145 0.002143 0.000037 0.000062
10010.000154 0.000415 0.002237 0.000040 0.000084