From cbc1779264b6f17daffb1f63f8d893180ea5439f Mon Sep 17 00:00:00 2001 From: cldougl Date: Mon, 12 Mar 2018 12:49:33 -0400 Subject: [PATCH] update plotlyjs for offline --- CHANGELOG.md | 15 +- plotly/graph_objs/graph_objs.py | 80 +-- plotly/package_data/default-schema.json | 799 +++++++++++++++++------- plotly/package_data/plotly.min.js | 4 +- 4 files changed, 621 insertions(+), 277 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7936b001d2..6468e910a43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,17 +2,20 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [2.5.0] - UNRELEASED +## [2.5.0] - 2018-03-12 ### Fixed - `import plotly.figure_factory` does not fail if `pandas` is not installed. See https://github.com/plotly/plotly.py/pull/958 ### Added - New parameter `fill_percent` to the `.insert` method for the dashboards API. You can now insert a box into the dashboard layout and specify what proportion of the original container box it will occupy. Run `help(plotly.dashboard_objs.Dashboard.insert)` for more information on `fill_percent`. ### Updated +- Updated `plotly.min.js` to version 1.35.2. + - New features include adding an `automargin` attribute to cartesian axes and a layout `grids` attribute for easy subplot generation. + - See [the plotly.js CHANGELOG](https://github.com/plotly/plotly.js/blob/master/CHANGELOG.md#1352----2018-03-09) for additional information regarding the updates. - `plotly.figure_factory.create_choropleth` has changed some of the default plotting options: - - 'offline_mode' param has been removed from call signature - - persistent selection api for the centroid points is automatically enabled. See https://plot.ly/python/reference/#scatter-selected and https://plot.ly/python/reference/#scatter-unselected for details - - FIPS values that appear on hover are 0-padded to ensure they are 5 digits - - for the county lines data `hover_info='none'` by default + - 'offline_mode' param has been removed from call signature. + - Persistent selection api for the centroid points is automatically enabled. See https://plot.ly/python/reference/#scatter-selected and https://plot.ly/python/reference/#scatter-unselected for details + - FIPS values that appear on hover are 0-padded to ensure they are 5 digits. + - `hover_info='none'` is now default for the county lines data. ## [2.4.1] - 2018-02-21 ### Fixed @@ -685,4 +688,4 @@ it does. ``` ### Fixed -- The height of the graph in `iplot` respects the figure's height in layout \ No newline at end of file +- The height of the graph in `iplot` respects the figure's height in layout diff --git a/plotly/graph_objs/graph_objs.py b/plotly/graph_objs/graph_objs.py index 9f0f6ebd08c..783de5530c1 100644 --- a/plotly/graph_objs/graph_objs.py +++ b/plotly/graph_objs/graph_objs.py @@ -873,15 +873,16 @@ class Bar(PlotlyDict): """ Valid attributes for 'bar' at path [] under parents (): - ['bardir', 'base', 'basesrc', 'constraintext', 'customdata', - 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', - 'hoverinfosrc', 'hoverlabel', 'hovertext', 'hovertextsrc', 'ids', - 'idssrc', 'insidetextfont', 'legendgroup', 'marker', 'name', 'offset', - 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'r', 'rsrc', - 'selected', 'selectedpoints', 'showlegend', 'stream', 't', 'text', - 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'tsrc', - 'type', 'uid', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', - 'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'ysrc'] + ['bardir', 'base', 'basesrc', 'cliponaxis', 'constraintext', + 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', + 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertext', 'hovertextsrc', + 'ids', 'idssrc', 'insidetextfont', 'legendgroup', 'marker', 'name', + 'offset', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', + 'r', 'rsrc', 'selected', 'selectedpoints', 'showlegend', 'stream', 't', + 'text', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', + 'tsrc', 'type', 'uid', 'unselected', 'visible', 'width', 'widthsrc', + 'x', 'x0', 'xaxis', 'xcalendar', 'xsrc', 'y', 'y0', 'yaxis', + 'ycalendar', 'ysrc'] Run `.help('attribute')` on any of the above. '' is the object at [] @@ -1132,9 +1133,8 @@ class ErrorY(PlotlyDict): Valid attributes for 'error_y' at path [] under parents (): ['array', 'arrayminus', 'arrayminussrc', 'arraysrc', 'color', - 'copy_ystyle', 'copy_zstyle', 'opacity', 'symmetric', 'thickness', - 'traceref', 'tracerefminus', 'type', 'value', 'valueminus', 'visible', - 'width'] + 'copy_zstyle', 'opacity', 'symmetric', 'thickness', 'traceref', + 'tracerefminus', 'type', 'value', 'valueminus', 'visible', 'width'] Run `.help('attribute')` on any of the above. '' is the object at [] @@ -1148,9 +1148,8 @@ class ErrorZ(PlotlyDict): Valid attributes for 'error_z' at path [] under parents (): ['array', 'arrayminus', 'arrayminussrc', 'arraysrc', 'color', - 'copy_ystyle', 'copy_zstyle', 'opacity', 'symmetric', 'thickness', - 'traceref', 'tracerefminus', 'type', 'value', 'valueminus', 'visible', - 'width'] + 'opacity', 'symmetric', 'thickness', 'traceref', 'tracerefminus', + 'type', 'value', 'valueminus', 'visible', 'width'] Run `.help('attribute')` on any of the above. '' is the object at [] @@ -1459,7 +1458,7 @@ class Layout(PlotlyDict): ['angularaxis', 'annotations', 'autosize', 'bargap', 'bargroupgap', 'barmode', 'barnorm', 'boxgap', 'boxgroupgap', 'boxmode', 'calendar', 'colorway', 'datarevision', 'direction', 'dragmode', 'font', 'geo', - 'height', 'hiddenlabels', 'hiddenlabelssrc', 'hidesources', + 'grid', 'height', 'hiddenlabels', 'hiddenlabelssrc', 'hidesources', 'hoverdistance', 'hoverlabel', 'hovermode', 'images', 'legend', 'mapbox', 'margin', 'orientation', 'paper_bgcolor', 'plot_bgcolor', 'polar', 'radialaxis', 'scene', 'separators', 'shapes', 'showlegend', @@ -1934,18 +1933,19 @@ class XAxis(PlotlyDict): """ Valid attributes for 'xaxis' at path [] under parents (): - ['anchor', 'autorange', 'autotick', 'backgroundcolor', 'calendar', - 'categoryarray', 'categoryarraysrc', 'categoryorder', 'color', - 'constrain', 'constraintoward', 'domain', 'dtick', 'exponentformat', - 'fixedrange', 'gridcolor', 'gridwidth', 'hoverformat', 'layer', - 'linecolor', 'linewidth', 'mirror', 'nticks', 'overlaying', 'position', - 'range', 'rangemode', 'rangeselector', 'rangeslider', 'scaleanchor', - 'scaleratio', 'separatethousands', 'showaxeslabels', 'showbackground', - 'showexponent', 'showgrid', 'showline', 'showspikes', 'showticklabels', - 'showtickprefix', 'showticksuffix', 'side', 'spikecolor', 'spikedash', - 'spikemode', 'spikesides', 'spikesnap', 'spikethickness', 'tick0', - 'tickangle', 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', - 'ticklen', 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext', + ['anchor', 'automargin', 'autorange', 'autotick', 'backgroundcolor', + 'calendar', 'categoryarray', 'categoryarraysrc', 'categoryorder', + 'color', 'constrain', 'constraintoward', 'domain', 'dtick', + 'exponentformat', 'fixedrange', 'gridcolor', 'gridwidth', + 'hoverformat', 'layer', 'linecolor', 'linewidth', 'mirror', 'nticks', + 'overlaying', 'position', 'range', 'rangemode', 'rangeselector', + 'rangeslider', 'scaleanchor', 'scaleratio', 'separatethousands', + 'showaxeslabels', 'showbackground', 'showexponent', 'showgrid', + 'showline', 'showspikes', 'showticklabels', 'showtickprefix', + 'showticksuffix', 'side', 'spikecolor', 'spikedash', 'spikemode', + 'spikesides', 'spikesnap', 'spikethickness', 'tick0', 'tickangle', + 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', 'ticklen', + 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext', 'ticktextsrc', 'tickvals', 'tickvalssrc', 'tickwidth', 'title', 'titlefont', 'type', 'visible', 'zeroline', 'zerolinecolor', 'zerolinewidth'] @@ -1974,18 +1974,18 @@ class YAxis(PlotlyDict): """ Valid attributes for 'yaxis' at path [] under parents (): - ['anchor', 'autorange', 'autotick', 'backgroundcolor', 'calendar', - 'categoryarray', 'categoryarraysrc', 'categoryorder', 'color', - 'constrain', 'constraintoward', 'domain', 'dtick', 'exponentformat', - 'fixedrange', 'gridcolor', 'gridwidth', 'hoverformat', 'layer', - 'linecolor', 'linewidth', 'mirror', 'nticks', 'overlaying', 'position', - 'range', 'rangemode', 'scaleanchor', 'scaleratio', 'separatethousands', - 'showaxeslabels', 'showbackground', 'showexponent', 'showgrid', - 'showline', 'showspikes', 'showticklabels', 'showtickprefix', - 'showticksuffix', 'side', 'spikecolor', 'spikedash', 'spikemode', - 'spikesides', 'spikesnap', 'spikethickness', 'tick0', 'tickangle', - 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', 'ticklen', - 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext', + ['anchor', 'automargin', 'autorange', 'autotick', 'backgroundcolor', + 'calendar', 'categoryarray', 'categoryarraysrc', 'categoryorder', + 'color', 'constrain', 'constraintoward', 'domain', 'dtick', + 'exponentformat', 'fixedrange', 'gridcolor', 'gridwidth', + 'hoverformat', 'layer', 'linecolor', 'linewidth', 'mirror', 'nticks', + 'overlaying', 'position', 'range', 'rangemode', 'scaleanchor', + 'scaleratio', 'separatethousands', 'showaxeslabels', 'showbackground', + 'showexponent', 'showgrid', 'showline', 'showspikes', 'showticklabels', + 'showtickprefix', 'showticksuffix', 'side', 'spikecolor', 'spikedash', + 'spikemode', 'spikesides', 'spikesnap', 'spikethickness', 'tick0', + 'tickangle', 'tickcolor', 'tickfont', 'tickformat', 'tickformatstops', + 'ticklen', 'tickmode', 'tickprefix', 'ticks', 'ticksuffix', 'ticktext', 'ticktextsrc', 'tickvals', 'tickvalssrc', 'tickwidth', 'title', 'titlefont', 'type', 'visible', 'zeroline', 'zerolinecolor', 'zerolinewidth'] diff --git a/plotly/package_data/default-schema.json b/plotly/package_data/default-schema.json index 6038074bc67..7ccf1965d20 100644 --- a/plotly/package_data/default-schema.json +++ b/plotly/package_data/default-schema.json @@ -101,7 +101,7 @@ "defs": { "editType": { "layout": { - "description": "layout attributes should include an `editType` string matching this flaglist. *calc* is the most extensive: a full `Plotly.plot` starting by clearing `gd.calcdata` to force it to be regenerated *calcIfAutorange* does a full `Plotly.plot`, but only clears and redoes `gd.calcdata` if there is at least one autoranged axis. *plot* calls `Plotly.plot` but without first clearing `gd.calcdata`. *legend* only redraws the legend. *ticks* only redraws axis ticks, labels, and gridlines. *layoutstyle* reapplies global and SVG cartesian axis styles. *modebar* just updates the modebar. *camera* just updates the camera settings for gl3d scenes. *arraydraw* allows component arrays to invoke the redraw routines just for the component(s) that changed.", + "description": "layout attributes should include an `editType` string matching this flaglist. *calc* is the most extensive: a full `Plotly.plot` starting by clearing `gd.calcdata` to force it to be regenerated *calcIfAutorange* does a full `Plotly.plot`, but only clears and redoes `gd.calcdata` if there is at least one autoranged axis. *plot* calls `Plotly.plot` but without first clearing `gd.calcdata`. *legend* only redraws the legend. *ticks* only redraws axis ticks, labels, and gridlines. *margins* recomputes ticklabel automargins. *layoutstyle* reapplies global and SVG cartesian axis styles. *modebar* just updates the modebar. *camera* just updates the camera settings for gl3d scenes. *arraydraw* allows component arrays to invoke the redraw routines just for the component(s) that changed.", "extras": [ "none" ], @@ -111,6 +111,7 @@ "plot", "legend", "ticks", + "margins", "layoutstyle", "modebar", "camera", @@ -194,7 +195,7 @@ "requiredOpts": [] }, "data_array": { - "description": "An {array} of data. The value MUST be an {array}, or we ignore it.", + "description": "An {array} of data. The value MUST be an {array}, or we ignore it. Note that typed arrays (e.g. Float32Array) are supported.", "otherOpts": [ "dflt" ], @@ -226,7 +227,8 @@ "description": "An {array} of plot information.", "otherOpts": [ "dflt", - "freeLength" + "freeLength", + "dimensions" ], "requiredOpts": [ "items" @@ -981,8 +983,24 @@ "valType": "number" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this geo subplot . Note that geo subplots are constrained by domain. In general, when `projection.scale` is set to 1. a map will fit either its x or y domain, but not both.", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "plot", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this geo subplot . Note that geo subplots are constrained by domain. In general, when `projection.scale` is set to 1. a map will fit either its x or y domain, but not both.", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this geo subplot (in plot fraction). Note that geo subplots are constrained by domain. In general, when `projection.scale` is set to 1. a map will fit either its x or y domain, but not both.", "dflt": [ @@ -1369,10 +1387,190 @@ "valType": "number" } }, + "grid": { + "columns": { + "description": "The number of columns in the grid. If you provide a 2D `subplots` array, the length of its longest row is used as the default. If you give an `xaxes` array, its length is used as the default. But it's also possible to have a different length, if you want to leave a row at the end for non-cartesian subplots.", + "editType": "plot", + "min": 1, + "role": "info", + "valType": "integer" + }, + "domain": { + "editType": "plot", + "role": "object", + "x": { + "description": "Sets the horizontal domain of this grid subplot (in plot fraction). The first and last cells end exactly at the domain edges, with no grout around the edges.", + "dflt": [ + 0, + 1 + ], + "editType": "plot", + "items": [ + { + "editType": "plot", + "max": 1, + "min": 0, + "valType": "number" + }, + { + "editType": "plot", + "max": 1, + "min": 0, + "valType": "number" + } + ], + "role": "info", + "valType": "info_array" + }, + "y": { + "description": "Sets the vertical domain of this grid subplot (in plot fraction). The first and last cells end exactly at the domain edges, with no grout around the edges.", + "dflt": [ + 0, + 1 + ], + "editType": "plot", + "items": [ + { + "editType": "plot", + "max": 1, + "min": 0, + "valType": "number" + }, + { + "editType": "plot", + "max": 1, + "min": 0, + "valType": "number" + } + ], + "role": "info", + "valType": "info_array" + } + }, + "editType": "plot", + "pattern": { + "description": "If no `subplots`, `xaxes`, or `yaxes` are given but we do have `rows` and `columns`, we can generate defaults using consecutive axis IDs, in two ways: *coupled* gives one x axis per column and one y axis per row. *independent* uses a new xy pair for each cell, left-to-right across each row then iterating rows according to `roworder`.", + "dflt": "coupled", + "editType": "plot", + "role": "info", + "valType": "enumerated", + "values": [ + "independent", + "coupled" + ] + }, + "role": "object", + "roworder": { + "description": "Is the first row the top or the bottom? Note that columns are always enumerated from left to right.", + "dflt": "top to bottom", + "editType": "plot", + "role": "info", + "valType": "enumerated", + "values": [ + "top to bottom", + "bottom to top" + ] + }, + "rows": { + "description": "The number of rows in the grid. If you provide a 2D `subplots` array or a `yaxes` array, its length is used as the default. But it's also possible to have a different length, if you want to leave a row at the end for non-cartesian subplots.", + "editType": "plot", + "min": 1, + "role": "info", + "valType": "integer" + }, + "subplots": { + "description": "Used for freeform grids, where some axes may be shared across subplots but others are not. Each entry should be a cartesian subplot id, like *xy* or *x3y2*, or ** to leave that cell empty. You may reuse x axes within the same column, and y axes within the same row. Non-cartesian subplots and traces that support `domain` can place themselves in this grid separately using the `gridcell` attribute.", + "dimensions": 2, + "editType": "plot", + "freeLength": true, + "items": { + "editType": "plot", + "valType": "enumerated", + "values": [ + "/^x([2-9]|[1-9][0-9]+)?y([2-9]|[1-9][0-9]+)?$/", + "" + ] + }, + "role": "info", + "valType": "info_array" + }, + "xaxes": { + "description": "Used with `yaxes` when the x and y axes are shared across columns and rows. Each entry should be an x axis id like *x*, *x2*, etc., or ** to not put an x axis in that column. Entries other than ** must be unique. Ignored if `subplots` is present. If missing but `yaxes` is present, will generate consecutive IDs.", + "editType": "plot", + "freeLength": true, + "items": { + "editType": "plot", + "valType": "enumerated", + "values": [ + "/^x([2-9]|[1-9][0-9]+)?$/", + "" + ] + }, + "role": "info", + "valType": "info_array" + }, + "xgap": { + "description": "Horizontal space between grid cells, expressed as a fraction of the total width available to one cell. Defaults to 0.1 for coupled-axes grids and 0.2 for independent grids.", + "editType": "plot", + "max": 1, + "min": 0, + "role": "info", + "valType": "number" + }, + "xside": { + "description": "Sets where the x axis labels and titles go. *bottom* means the very bottom of the grid. *bottom plot* is the lowest plot that each x axis is used in. *top* and *top plot* are similar.", + "dflt": "bottom plot", + "editType": "ticks", + "role": "info", + "valType": "enumerated", + "values": [ + "bottom", + "bottom plot", + "top plot", + "top" + ] + }, + "yaxes": { + "description": "Used with `yaxes` when the x and y axes are shared across columns and rows. Each entry should be an y axis id like *y*, *y2*, etc., or ** to not put a y axis in that row. Entries other than ** must be unique. Ignored if `subplots` is present. If missing but `xaxes` is present, will generate consecutive IDs.", + "editType": "plot", + "freeLength": true, + "items": { + "editType": "plot", + "valType": "enumerated", + "values": [ + "/^y([2-9]|[1-9][0-9]+)?$/", + "" + ] + }, + "role": "info", + "valType": "info_array" + }, + "ygap": { + "description": "Vertical space between grid cells, expressed as a fraction of the total height available to one cell. Defaults to 0.1 for coupled-axes grids and 0.3 for independent grids.", + "editType": "plot", + "max": 1, + "min": 0, + "role": "info", + "valType": "number" + }, + "yside": { + "description": "Sets where the y axis labels and titles go. *left* means the very left edge of the grid. *left plot* is the leftmost plot that each y axis is used in. *right* and *right plot* are similar.", + "dflt": "left plot", + "editType": "ticks", + "role": "info", + "valType": "enumerated", + "values": [ + "left", + "left plot", + "right plot", + "right" + ] + } + }, "height": { "description": "Sets the plot's height (in px).", "dflt": 450, - "editType": "none", + "editType": "plot", "min": 10, "role": "info", "valType": "number" @@ -1385,7 +1583,7 @@ "valType": "boolean" }, "hoverdistance": { - "description": "Sets the default distance (in pixels) to look for data to add hover labels (-1 means no cutoff, 0 means no looking for data)", + "description": "Sets the default distance (in pixels) to look for data to add hover labels (-1 means no cutoff, 0 means no looking for data). This is only a real distance for hovering on point-like objects, like scatter points. For area-like objects (bars, scatter fills, etc) hovering is on inside the area and off outside, but these objects will not supersede hover on point-like objects in case of conflict.", "dflt": 20, "editType": "none", "min": -1, @@ -1746,8 +1944,24 @@ "role": "object" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this mapbox subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "plot", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this mapbox subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this mapbox subplot (in plot fraction).", "dflt": [ @@ -2004,23 +2218,23 @@ "margin": { "autoexpand": { "dflt": true, - "editType": "calc", + "editType": "plot", "role": "info", "valType": "boolean" }, "b": { "description": "Sets the bottom margin (in px).", "dflt": 80, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" }, - "editType": "calc", + "editType": "plot", "l": { "description": "Sets the left margin (in px).", "dflt": 80, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" @@ -2028,7 +2242,7 @@ "pad": { "description": "Sets the amount of padding (in px) between the plotting area and the axis lines", "dflt": 0, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" @@ -2036,7 +2250,7 @@ "r": { "description": "Sets the right margin (in px).", "dflt": 80, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" @@ -2045,7 +2259,7 @@ "t": { "description": "Sets the top margin (in px).", "dflt": 100, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" @@ -2481,8 +2695,24 @@ "valType": "color" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this polar subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "plot", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this polar subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this polar subplot (in plot fraction).", "dflt": [ @@ -2492,11 +2722,13 @@ "editType": "plot", "items": [ { + "editType": "plot", "max": 1, "min": 0, "valType": "number" }, { + "editType": "plot", "max": 1, "min": 0, "valType": "number" @@ -2514,11 +2746,13 @@ "editType": "plot", "items": [ { + "editType": "plot", "max": 1, "min": 0, "valType": "number" }, { + "editType": "plot", "max": 1, "min": 0, "valType": "number" @@ -2689,20 +2923,20 @@ }, "range": { "description": "Sets the range of this axis. If the axis `type` is *log*, then you must take the log of your desired range (e.g. to set the range from 1 to 100, set the range from 0 to 2). If the axis `type` is *date*, it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis `type` is *category*, it should be numbers, using the scale where each category is assigned a serial number from zero in the order it appears.", - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "autorange": false }, "items": [ { - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "^autorange": false }, "valType": "any" }, { - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "^autorange": false }, @@ -3624,8 +3858,24 @@ } }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this scene subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "plot", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this scene subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this scene subplot (in plot fraction).", "dflt": [ @@ -3635,11 +3885,13 @@ "editType": "plot", "items": [ { + "editType": "plot", "max": 1, "min": 0, "valType": "number" }, { + "editType": "plot", "max": 1, "min": 0, "valType": "number" @@ -3657,11 +3909,13 @@ "editType": "plot", "items": [ { + "editType": "plot", "max": 1, "min": 0, "valType": "number" }, { + "editType": "plot", "max": 1, "min": 0, "valType": "number" @@ -5869,7 +6123,7 @@ "role": "object" }, "spikedistance": { - "description": "Sets the default distance (in pixels) to look for data to draw spikelines to (-1 means no cutoff, 0 means no looking for data).", + "description": "Sets the default distance (in pixels) to look for data to draw spikelines to (-1 means no cutoff, 0 means no looking for data). As with hoverdistance, distance does not apply to area-like objects. In addition, some objects can be hovered on but will not generate spikelines, such as scatter fills.", "dflt": 20, "editType": "none", "min": -1, @@ -6963,8 +7217,24 @@ } }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this ternary subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "plot", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this ternary subplot .", + "dflt": 0, + "editType": "plot", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this ternary subplot (in plot fraction).", "dflt": [ @@ -7295,7 +7565,7 @@ "width": { "description": "Sets the plot's width (in px).", "dflt": 700, - "editType": "none", + "editType": "plot", "min": 10, "role": "info", "valType": "number" @@ -7304,7 +7574,7 @@ "_deprecated": { "autotick": { "description": "Obsolete. Set `tickmode` to *auto* for old `autotick` *true* behavior. Set `tickmode` to *linear* for `autotick` *false*.", - "editType": "ticks", + "editType": "ticks+margins", "role": "info", "valType": "boolean" } @@ -7312,7 +7582,7 @@ "_isSubplotObj": true, "anchor": { "description": "If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to the corresponding opposite-letter axis. If set to *free*, this axis' position is determined by `position`.", - "editType": "plot", + "editType": "plot+margins", "role": "info", "valType": "enumerated", "values": [ @@ -7321,6 +7591,13 @@ "/^y([2-9]|[1-9][0-9]+)?$/" ] }, + "automargin": { + "description": "Determines whether long tick labels automatically grow the figure margins.", + "dflt": false, + "editType": "ticks+margins", + "role": "style", + "valType": "boolean" + }, "autorange": { "description": "Determines whether or not the range of this axis is computed in relation to the input data. See `rangemode` for more info. If `range` is provided, then `autorange` is set to *false*.", "dflt": true, @@ -7394,7 +7671,7 @@ "constrain": { "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines how that happens: by increasing the *range* (default), or by decreasing the *domain*.", "dflt": "range", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -7404,7 +7681,7 @@ }, "constraintoward": { "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines which direction we push the originally specified plot area. Options are *left*, *center* (default), and *right* for x axes, and *top*, *middle* (default), and *bottom* for y axes.", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -7422,16 +7699,16 @@ 0, 1 ], - "editType": "calc", + "editType": "plot+margins", "items": [ { - "editType": "calc", + "editType": "plot+margins", "max": 1, "min": 0, "valType": "number" }, { - "editType": "calc", + "editType": "plot+margins", "max": 1, "min": 0, "valType": "number" @@ -7442,7 +7719,7 @@ }, "dtick": { "description": "Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *M* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*", - "editType": "ticks", + "editType": "ticks+margins", "impliedEdits": { "tickmode": "linear" }, @@ -7453,7 +7730,7 @@ "exponentformat": { "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B.", "dflt": "B", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -7537,14 +7814,14 @@ "nticks": { "description": "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.", "dflt": 0, - "editType": "ticks", + "editType": "ticks+margins", "min": 0, "role": "style", "valType": "integer" }, "overlaying": { "description": "If set a same-letter axis id, this axis is overlaid on top of the corresponding same-letter axis. If *false*, this axis does not overlay any same-letter axes.", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -7556,7 +7833,7 @@ "position": { "description": "Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to *free*.", "dflt": 0, - "editType": "plot", + "editType": "plot+margins", "max": 1, "min": 0, "role": "style", @@ -7564,20 +7841,20 @@ }, "range": { "description": "Sets the range of this axis. If the axis `type` is *log*, then you must take the log of your desired range (e.g. to set the range from 1 to 100, set the range from 0 to 2). If the axis `type` is *date*, it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis `type` is *category*, it should be numbers, using the scale where each category is assigned a serial number from zero in the order it appears.", - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "autorange": false }, "items": [ { - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "^autorange": false }, "valType": "any" }, { - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "^autorange": false }, @@ -7590,7 +7867,7 @@ "rangemode": { "description": "If *normal*, the range is computed in relation to the extrema of the input data. If *tozero*`, the range extends to 0, regardless of the input data If *nonnegative*, the range is non-negative, regardless of the input data.", "dflt": "normal", - "editType": "calc", + "editType": "plot", "role": "style", "valType": "enumerated", "values": [ @@ -7766,21 +8043,21 @@ "bgcolor": { "description": "Sets the background color of the range slider.", "dflt": "#fff", - "editType": "calc", + "editType": "plot", "role": "style", "valType": "color" }, "bordercolor": { "description": "Sets the border color of the range slider.", "dflt": "#444", - "editType": "calc", + "editType": "plot", "role": "style", "valType": "color" }, "borderwidth": { "description": "Sets the border color of the range slider.", "dflt": 0, - "editType": "calc", + "editType": "plot", "min": 0, "role": "style", "valType": "integer" @@ -7815,7 +8092,7 @@ "thickness": { "description": "The height of the range slider as a fraction of the total plot area height.", "dflt": 0.15, - "editType": "calc", + "editType": "plot", "max": 1, "min": 0, "role": "style", @@ -7827,12 +8104,45 @@ "editType": "calc", "role": "info", "valType": "boolean" + }, + "yaxis": { + "_isSubplotObj": true, + "editType": "calc", + "range": { + "description": "Sets the range of this axis for the rangeslider.", + "editType": "plot", + "items": [ + { + "editType": "plot", + "valType": "any" + }, + { + "editType": "plot", + "valType": "any" + } + ], + "role": "style", + "valType": "info_array" + }, + "rangemode": { + "description": "Determines whether or not the range of this axis in the rangeslider use the same value than in the main plot when zooming in/out. If *auto*, the autorange will be used. If *fixed*, the `range` is used. If *match*, the current range of the corresponding y-axis on the main subplot is used.", + "dflt": "match", + "editType": "calc", + "role": "style", + "valType": "enumerated", + "values": [ + "auto", + "fixed", + "match" + ] + }, + "role": "object" } }, "role": "object", "scaleanchor": { "description": "If set to another axis id (e.g. `x2`, `y`), the range of this axis changes together with the range of the corresponding axis such that the scale of pixels per unit is in a constant ratio. Both axes are still zoomable, but when you zoom one, the other will zoom the same amount, keeping a fixed midpoint. `constrain` and `constraintoward` determine how we enforce the constraint. You can chain these, ie `yaxis: {scaleanchor: *x*}, xaxis2: {scaleanchor: *y*}` but you can only link axes of the same `type`. The linked axis can have the opposite letter (to constrain the aspect ratio) or the same letter (to match scales across subplots). Loops (`yaxis: {scaleanchor: *x*}, xaxis: {scaleanchor: *y*}` or longer) are redundant and the last constraint encountered will be ignored to avoid possible inconsistent constraints via `scaleratio`.", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -7843,7 +8153,7 @@ "scaleratio": { "description": "If this axis is linked to another by `scaleanchor`, this determines the pixel to unit scale ratio. For example, if this value is 10, then every unit on this axis spans 10 times the number of pixels as a unit on the linked axis. Use this for example to create an elevation profile where the vertical scale is exaggerated a fixed amount with respect to the horizontal.", "dflt": 1, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" @@ -7851,14 +8161,14 @@ "separatethousands": { "description": "If \"true\", even 4-digit integers are separated", "dflt": false, - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "boolean" }, "showexponent": { "description": "If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.", "dflt": "all", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -7891,14 +8201,14 @@ "showticklabels": { "description": "Determines whether or not the tick labels are drawn.", "dflt": true, - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "boolean" }, "showtickprefix": { "description": "If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.", "dflt": "all", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -7911,7 +8221,7 @@ "showticksuffix": { "description": "Same as `showtickprefix` but for tick suffixes.", "dflt": "all", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -7923,7 +8233,7 @@ }, "side": { "description": "Determines whether a x (y) axis is positioned at the *bottom* (*left*) or *top* (*right*) of the plotting area.", - "editType": "plot", + "editType": "plot+margins", "role": "info", "valType": "enumerated", "values": [ @@ -7987,7 +8297,7 @@ }, "tick0": { "description": "Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is *log*, then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L* (see `dtick` for more info). If the axis `type` is *date*, it should be a date string, like date data. If the axis `type` is *category*, it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears.", - "editType": "ticks", + "editType": "ticks+margins", "impliedEdits": { "tickmode": "linear" }, @@ -7997,7 +8307,7 @@ "tickangle": { "description": "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.", "dflt": "auto", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "angle" }, @@ -8010,15 +8320,15 @@ }, "tickfont": { "color": { - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "color" }, "description": "Sets the tick font.", - "editType": "ticks", + "editType": "ticks+margins", "family": { "description": "HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The plotly service (at https://plot.ly or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.", - "editType": "ticks", + "editType": "ticks+margins", "noBlank": true, "role": "style", "strict": true, @@ -8026,7 +8336,7 @@ }, "role": "object", "size": { - "editType": "ticks", + "editType": "ticks+margins", "min": 1, "role": "style", "valType": "number" @@ -8035,7 +8345,7 @@ "tickformat": { "description": "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/blob/master/README.md#locale_format And for dates see: https://github.com/d3/d3-time-format/blob/master/README.md#locale_format We add one item to d3's date formatter: *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" }, @@ -8044,26 +8354,26 @@ "tickformatstop": { "dtickrange": { "description": "range [*min*, *max*], where *min*, *max* - dtick values which describe some zoom level, it is possible to omit *min* or *max* value by passing *null*", - "editType": "ticks", + "editType": "ticks+margins", "items": [ { - "editType": "ticks", + "editType": "ticks+margins", "valType": "any" }, { - "editType": "ticks", + "editType": "ticks+margins", "valType": "any" } ], "role": "info", "valType": "info_array" }, - "editType": "ticks", + "editType": "ticks+margins", "role": "object", "value": { "description": "string - dtickformat for described zoom level, the same as *tickformat*", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" } @@ -8081,7 +8391,7 @@ }, "tickmode": { "description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).", - "editType": "ticks", + "editType": "ticks+margins", "impliedEdits": {}, "role": "info", "valType": "enumerated", @@ -8094,13 +8404,13 @@ "tickprefix": { "description": "Sets a tick label prefix.", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" }, "ticks": { "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -8112,13 +8422,13 @@ "ticksuffix": { "description": "Sets a tick label suffix.", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" }, "ticktext": { "description": "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.", - "editType": "ticks", + "editType": "ticks+margins", "role": "data", "valType": "data_array" }, @@ -8130,7 +8440,7 @@ }, "tickvals": { "description": "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.", - "editType": "ticks", + "editType": "ticks+margins", "role": "data", "valType": "data_array" }, @@ -8150,21 +8460,21 @@ }, "title": { "description": "Sets the title of this axis.", - "editType": "ticks", + "editType": "ticks+margins", "role": "info", "valType": "string" }, "titlefont": { "color": { - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "color" }, "description": "Sets this axis' title font.", - "editType": "ticks", + "editType": "ticks+margins", "family": { "description": "HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The plotly service (at https://plot.ly or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.", - "editType": "ticks", + "editType": "ticks+margins", "noBlank": true, "role": "style", "strict": true, @@ -8172,7 +8482,7 @@ }, "role": "object", "size": { - "editType": "ticks", + "editType": "ticks+margins", "min": 1, "role": "style", "valType": "number" @@ -8223,7 +8533,7 @@ "_deprecated": { "autotick": { "description": "Obsolete. Set `tickmode` to *auto* for old `autotick` *true* behavior. Set `tickmode` to *linear* for `autotick` *false*.", - "editType": "ticks", + "editType": "ticks+margins", "role": "info", "valType": "boolean" } @@ -8231,7 +8541,7 @@ "_isSubplotObj": true, "anchor": { "description": "If set to an opposite-letter axis id (e.g. `x2`, `y`), this axis is bound to the corresponding opposite-letter axis. If set to *free*, this axis' position is determined by `position`.", - "editType": "plot", + "editType": "plot+margins", "role": "info", "valType": "enumerated", "values": [ @@ -8240,6 +8550,13 @@ "/^y([2-9]|[1-9][0-9]+)?$/" ] }, + "automargin": { + "description": "Determines whether long tick labels automatically grow the figure margins.", + "dflt": false, + "editType": "ticks+margins", + "role": "style", + "valType": "boolean" + }, "autorange": { "description": "Determines whether or not the range of this axis is computed in relation to the input data. See `rangemode` for more info. If `range` is provided, then `autorange` is set to *false*.", "dflt": true, @@ -8313,7 +8630,7 @@ "constrain": { "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines how that happens: by increasing the *range* (default), or by decreasing the *domain*.", "dflt": "range", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -8323,7 +8640,7 @@ }, "constraintoward": { "description": "If this axis needs to be compressed (either due to its own `scaleanchor` and `scaleratio` or those of the other axis), determines which direction we push the originally specified plot area. Options are *left*, *center* (default), and *right* for x axes, and *top*, *middle* (default), and *bottom* for y axes.", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -8341,16 +8658,16 @@ 0, 1 ], - "editType": "calc", + "editType": "plot+margins", "items": [ { - "editType": "calc", + "editType": "plot+margins", "max": 1, "min": 0, "valType": "number" }, { - "editType": "calc", + "editType": "plot+margins", "max": 1, "min": 0, "valType": "number" @@ -8361,7 +8678,7 @@ }, "dtick": { "description": "Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *M* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*", - "editType": "ticks", + "editType": "ticks+margins", "impliedEdits": { "tickmode": "linear" }, @@ -8372,7 +8689,7 @@ "exponentformat": { "description": "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B.", "dflt": "B", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -8456,14 +8773,14 @@ "nticks": { "description": "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.", "dflt": 0, - "editType": "ticks", + "editType": "ticks+margins", "min": 0, "role": "style", "valType": "integer" }, "overlaying": { "description": "If set a same-letter axis id, this axis is overlaid on top of the corresponding same-letter axis. If *false*, this axis does not overlay any same-letter axes.", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -8475,7 +8792,7 @@ "position": { "description": "Sets the position of this axis in the plotting space (in normalized coordinates). Only has an effect if `anchor` is set to *free*.", "dflt": 0, - "editType": "plot", + "editType": "plot+margins", "max": 1, "min": 0, "role": "style", @@ -8483,20 +8800,20 @@ }, "range": { "description": "Sets the range of this axis. If the axis `type` is *log*, then you must take the log of your desired range (e.g. to set the range from 1 to 100, set the range from 0 to 2). If the axis `type` is *date*, it should be date strings, like date data, though Date objects and unix milliseconds will be accepted and converted to strings. If the axis `type` is *category*, it should be numbers, using the scale where each category is assigned a serial number from zero in the order it appears.", - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "autorange": false }, "items": [ { - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "^autorange": false }, "valType": "any" }, { - "editType": "plot", + "editType": "plot+margins", "impliedEdits": { "^autorange": false }, @@ -8509,7 +8826,7 @@ "rangemode": { "description": "If *normal*, the range is computed in relation to the extrema of the input data. If *tozero*`, the range extends to 0, regardless of the input data If *nonnegative*, the range is non-negative, regardless of the input data.", "dflt": "normal", - "editType": "calc", + "editType": "plot", "role": "style", "valType": "enumerated", "values": [ @@ -8521,7 +8838,7 @@ "role": "object", "scaleanchor": { "description": "If set to another axis id (e.g. `x2`, `y`), the range of this axis changes together with the range of the corresponding axis such that the scale of pixels per unit is in a constant ratio. Both axes are still zoomable, but when you zoom one, the other will zoom the same amount, keeping a fixed midpoint. `constrain` and `constraintoward` determine how we enforce the constraint. You can chain these, ie `yaxis: {scaleanchor: *x*}, xaxis2: {scaleanchor: *y*}` but you can only link axes of the same `type`. The linked axis can have the opposite letter (to constrain the aspect ratio) or the same letter (to match scales across subplots). Loops (`yaxis: {scaleanchor: *x*}, xaxis: {scaleanchor: *y*}` or longer) are redundant and the last constraint encountered will be ignored to avoid possible inconsistent constraints via `scaleratio`.", - "editType": "calc", + "editType": "plot", "role": "info", "valType": "enumerated", "values": [ @@ -8532,7 +8849,7 @@ "scaleratio": { "description": "If this axis is linked to another by `scaleanchor`, this determines the pixel to unit scale ratio. For example, if this value is 10, then every unit on this axis spans 10 times the number of pixels as a unit on the linked axis. Use this for example to create an elevation profile where the vertical scale is exaggerated a fixed amount with respect to the horizontal.", "dflt": 1, - "editType": "calc", + "editType": "plot", "min": 0, "role": "info", "valType": "number" @@ -8540,14 +8857,14 @@ "separatethousands": { "description": "If \"true\", even 4-digit integers are separated", "dflt": false, - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "boolean" }, "showexponent": { "description": "If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.", "dflt": "all", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -8580,14 +8897,14 @@ "showticklabels": { "description": "Determines whether or not the tick labels are drawn.", "dflt": true, - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "boolean" }, "showtickprefix": { "description": "If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.", "dflt": "all", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -8600,7 +8917,7 @@ "showticksuffix": { "description": "Same as `showtickprefix` but for tick suffixes.", "dflt": "all", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -8612,7 +8929,7 @@ }, "side": { "description": "Determines whether a x (y) axis is positioned at the *bottom* (*left*) or *top* (*right*) of the plotting area.", - "editType": "plot", + "editType": "plot+margins", "role": "info", "valType": "enumerated", "values": [ @@ -8676,7 +8993,7 @@ }, "tick0": { "description": "Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is *log*, then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L* (see `dtick` for more info). If the axis `type` is *date*, it should be a date string, like date data. If the axis `type` is *category*, it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears.", - "editType": "ticks", + "editType": "ticks+margins", "impliedEdits": { "tickmode": "linear" }, @@ -8686,7 +9003,7 @@ "tickangle": { "description": "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.", "dflt": "auto", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "angle" }, @@ -8699,15 +9016,15 @@ }, "tickfont": { "color": { - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "color" }, "description": "Sets the tick font.", - "editType": "ticks", + "editType": "ticks+margins", "family": { "description": "HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The plotly service (at https://plot.ly or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.", - "editType": "ticks", + "editType": "ticks+margins", "noBlank": true, "role": "style", "strict": true, @@ -8715,7 +9032,7 @@ }, "role": "object", "size": { - "editType": "ticks", + "editType": "ticks+margins", "min": 1, "role": "style", "valType": "number" @@ -8724,7 +9041,7 @@ "tickformat": { "description": "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/blob/master/README.md#locale_format And for dates see: https://github.com/d3/d3-time-format/blob/master/README.md#locale_format We add one item to d3's date formatter: *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" }, @@ -8733,26 +9050,26 @@ "tickformatstop": { "dtickrange": { "description": "range [*min*, *max*], where *min*, *max* - dtick values which describe some zoom level, it is possible to omit *min* or *max* value by passing *null*", - "editType": "ticks", + "editType": "ticks+margins", "items": [ { - "editType": "ticks", + "editType": "ticks+margins", "valType": "any" }, { - "editType": "ticks", + "editType": "ticks+margins", "valType": "any" } ], "role": "info", "valType": "info_array" }, - "editType": "ticks", + "editType": "ticks+margins", "role": "object", "value": { "description": "string - dtickformat for described zoom level, the same as *tickformat*", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" } @@ -8770,7 +9087,7 @@ }, "tickmode": { "description": "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).", - "editType": "ticks", + "editType": "ticks+margins", "impliedEdits": {}, "role": "info", "valType": "enumerated", @@ -8783,13 +9100,13 @@ "tickprefix": { "description": "Sets a tick label prefix.", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" }, "ticks": { "description": "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "enumerated", "values": [ @@ -8801,13 +9118,13 @@ "ticksuffix": { "description": "Sets a tick label suffix.", "dflt": "", - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "string" }, "ticktext": { "description": "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.", - "editType": "ticks", + "editType": "ticks+margins", "role": "data", "valType": "data_array" }, @@ -8819,7 +9136,7 @@ }, "tickvals": { "description": "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.", - "editType": "ticks", + "editType": "ticks+margins", "role": "data", "valType": "data_array" }, @@ -8839,21 +9156,21 @@ }, "title": { "description": "Sets the title of this axis.", - "editType": "ticks", + "editType": "ticks+margins", "role": "info", "valType": "string" }, "titlefont": { "color": { - "editType": "ticks", + "editType": "ticks+margins", "role": "style", "valType": "color" }, "description": "Sets this axis' title font.", - "editType": "ticks", + "editType": "ticks+margins", "family": { "description": "HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The plotly service (at https://plot.ly or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.", - "editType": "ticks", + "editType": "ticks+margins", "noBlank": true, "role": "style", "strict": true, @@ -8861,7 +9178,7 @@ }, "role": "object", "size": { - "editType": "ticks", + "editType": "ticks+margins", "min": 1, "role": "style", "valType": "number" @@ -9041,7 +9358,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -9529,6 +9846,13 @@ "role": "info", "valType": "string" }, + "cliponaxis": { + "description": "Determines whether the text nodes are clipped about the subplot axes. To show the text nodes above axis lines and tick labels, make sure to set `xaxis.layer` and `yaxis.layer` to *below traces*.", + "dflt": true, + "editType": "plot", + "role": "info", + "valType": "boolean" + }, "constraintext": { "description": "Constrain the size of text inside or outside a bar to be no larger than the bar itself.", "dflt": "both", @@ -9612,11 +9936,6 @@ "role": "style", "valType": "boolean" }, - "copy_zstyle": { - "editType": "style", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -9728,16 +10047,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "plot", - "role": "style", - "valType": "boolean" - }, - "copy_zstyle": { - "editType": "style", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -9940,7 +10249,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -11249,7 +11558,7 @@ "valType": "flaglist" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -12175,7 +12484,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -13661,7 +13970,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -14372,7 +14681,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -15392,7 +15701,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -16568,7 +16877,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -17399,7 +17708,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -18327,7 +18636,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -18695,11 +19004,6 @@ "role": "style", "valType": "boolean" }, - "copy_zstyle": { - "editType": "style", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -18811,16 +19115,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "plot", - "role": "style", - "valType": "boolean" - }, - "copy_zstyle": { - "editType": "style", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -19037,7 +19331,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -20663,7 +20957,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -21804,7 +22098,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -22883,7 +23177,7 @@ "valType": "data_array" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -23479,7 +23773,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -23839,7 +24133,6 @@ }, "values": { "description": "Dimension values. `values[n]` represents the value of the `n`th point in the dataset, therefore the `values` vector for all dimensions must be the same (longer vectors will be truncated). Each value must be a finite number.", - "dflt": [], "editType": "calc", "role": "data", "valType": "data_array" @@ -23862,8 +24155,24 @@ "role": "object" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this parcoords trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "calc", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this parcoords trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this parcoords trace (in plot fraction).", "dflt": [ @@ -23873,11 +24182,13 @@ "editType": "calc", "items": [ { + "editType": "calc", "max": 1, "min": 0, "valType": "number" }, { + "editType": "calc", "max": 1, "min": 0, "valType": "number" @@ -23895,11 +24206,13 @@ "editType": "calc", "items": [ { + "editType": "calc", "max": 1, "min": 0, "valType": "number" }, { + "editType": "calc", "max": 1, "min": 0, "valType": "number" @@ -24025,7 +24338,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -24795,8 +25108,24 @@ "valType": "number" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this pie trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "calc", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this pie trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this pie trace (in plot fraction).", "dflt": [ @@ -24806,11 +25135,13 @@ "editType": "calc", "items": [ { + "editType": "calc", "max": 1, "min": 0, "valType": "number" }, { + "editType": "calc", "max": 1, "min": 0, "valType": "number" @@ -24828,11 +25159,13 @@ "editType": "calc", "items": [ { + "editType": "calc", "max": 1, "min": 0, "valType": "number" }, { + "editType": "calc", "max": 1, "min": 0, "valType": "number" @@ -24981,7 +25314,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -25453,7 +25786,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -25737,8 +26070,24 @@ "valType": "string" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this sankey trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "calc", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this sankey trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this sankey trace (in plot fraction).", "dflt": [ @@ -25904,7 +26253,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -26315,11 +26664,6 @@ "role": "style", "valType": "boolean" }, - "copy_zstyle": { - "editType": "style", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -26431,16 +26775,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "plot", - "role": "style", - "valType": "boolean" - }, - "copy_zstyle": { - "editType": "style", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -26675,7 +27009,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -28180,11 +28514,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, "copy_zstyle": { "editType": "calc", "role": "style", @@ -28301,11 +28630,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, "copy_zstyle": { "editType": "calc", "role": "style", @@ -28422,16 +28746,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, - "copy_zstyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -28634,7 +28948,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -30002,7 +30316,7 @@ "valType": "flaglist" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -31501,7 +31815,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -32910,11 +33224,6 @@ "role": "style", "valType": "boolean" }, - "copy_zstyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -33026,16 +33335,6 @@ "role": "style", "valType": "color" }, - "copy_ystyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, - "copy_zstyle": { - "editType": "calc", - "role": "style", - "valType": "boolean" - }, "editType": "calc", "role": "object", "symmetric": { @@ -33256,7 +33555,7 @@ "valType": "flaglist" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -34679,7 +34978,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -35346,6 +35645,12 @@ "selected": { "editType": "calc", "marker": { + "color": { + "description": "Sets the marker color of selected points.", + "editType": "calc", + "role": "style", + "valType": "color" + }, "editType": "calc", "opacity": { "description": "Sets the marker opacity of selected points.", @@ -35355,7 +35660,14 @@ "role": "style", "valType": "number" }, - "role": "object" + "role": "object", + "size": { + "description": "Sets the marker size of selected points.", + "editType": "calc", + "min": 0, + "role": "style", + "valType": "number" + } }, "role": "object" }, @@ -35468,6 +35780,12 @@ "unselected": { "editType": "calc", "marker": { + "color": { + "description": "Sets the marker color of unselected points, applied only when a selection exists.", + "editType": "calc", + "role": "style", + "valType": "color" + }, "editType": "calc", "opacity": { "description": "Sets the marker opacity of unselected points, applied only when a selection exists.", @@ -35477,7 +35795,14 @@ "role": "style", "valType": "number" }, - "role": "object" + "role": "object", + "size": { + "description": "Sets the marker size of unselected points, applied only when a selection exists.", + "editType": "calc", + "min": 0, + "role": "style", + "valType": "number" + } }, "role": "object" }, @@ -35685,7 +36010,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -37206,7 +37531,7 @@ "valType": "flaglist" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -38645,7 +38970,7 @@ "valType": "string" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -40860,7 +41185,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -41407,8 +41732,24 @@ "valType": "string" }, "domain": { + "column": { + "description": "If there is a layout grid, use the domain for this column in the grid for this table trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "editType": "calc", "role": "object", + "row": { + "description": "If there is a layout grid, use the domain for this row in the grid for this table trace .", + "dflt": 0, + "editType": "calc", + "min": 0, + "role": "info", + "valType": "integer" + }, "x": { "description": "Sets the horizontal domain of this table trace (in plot fraction).", "dflt": [ @@ -41752,7 +42093,7 @@ "role": "object" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" @@ -42044,7 +42385,7 @@ "valType": "flaglist" }, "ids": { - "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation.", + "description": "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.", "editType": "calc", "role": "data", "valType": "data_array" diff --git a/plotly/package_data/plotly.min.js b/plotly/package_data/plotly.min.js index ea2f217fb6e..2b1ff746d68 100644 --- a/plotly/package_data/plotly.min.js +++ b/plotly/package_data/plotly.min.js @@ -1,7 +1,7 @@ /** -* plotly.js v1.33.1 +* plotly.js v1.35.2 * Copyright 2012-2018, Plotly, Inc. * All rights reserved. * Licensed under the MIT license */ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Plotly=t()}}(function(){return function t(e,r,n){function i(o,s){if(!r[o]){if(!e[o]){var l="function"==typeof require&&require;if(!s&&l)return l(o,!0);if(a)return a(o,!0);var 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;oMath.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,f*(Math.exp(s)-1))}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset")},{"3d-view":40,"mouse-change":443,"mouse-event-offset":444,"mouse-wheel":446,"right-now":509}],40:[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(),f=a(),h=o();return u.setDistanceLimits(l[0],l[1]),u.lookAt(0,e,r,s),f.setDistanceLimits(l[0],l[1]),f.lookAt(0,e,r,s),h.setDistanceLimits(l[0],l[1]),h.lookAt(0,e,r,s),new n({turntable:u,orbit:f,matrix:h},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;n0&&(e.y+=r),a=e.y+e.dy+u;if((r=a-u-f[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(h).map(function(t){return t.values});!function(){var t=e.min(a,function(t){return(f[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}h.forEach(function(r){r.sourceLinks.sort(e),r.targetLinks.sort(t)}),h.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,f=[1,1],h=[],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?(h=t,l):h},l.links=function(t){return arguments.length?(d=t,l):d},l.size=function(t){return arguments.length?(f=t,l):f},l.layout=function(r){return h.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=h[t.source]),"number"==typeof n&&(n=t.target=h[t.target]),t.originalIndex=e,r.sourceLinks.push(t),n.targetLinks.push(t)}),h.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,f=u+t.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+u+" "+i+","+u+"L"+i+","+f+"C"+s+","+f+" "+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":120,"d3-collection":121,"d3-interpolate":125}],42:[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":165,"gl-vao":259,"weak-map":573}],43:[function(t,e,r){e.exports=function(t){var e=0,r=0,n=0,i=0;return t.map(function(t){var a=(t=t.slice())[0],o=a.toUpperCase();if(a!=o)switch(t[0]=o,a){case"a":t[6]+=n,t[7]+=i;break;case"v":t[1]+=i;break;case"h":t[1]+=n;break;default:for(var s=1;si&&(i=t[o]),t[o]>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}()},{}],51:[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=0;s--)if(l[s]!==c[s])return!1;for(s=l.length-1;s>=0;s--)if(o=l[s],!h(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){h(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,x=Array.prototype.slice,b="foo"===function(){}.name,_=e.exports=f,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=f,_.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){h(t,e,!1)||u(t,e,r,"deepEqual",_.deepEqual)},_.deepStrictEqual=function(t,e,r){h(t,e,!0)||u(t,e,r,"deepStrictEqual",_.deepStrictEqual)},_.notDeepEqual=function(t,e,r){h(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/":563}],52:[function(t,e,r){e.exports=function(t){return atob(t)}},{}],53:[function(t,e,r){"use strict";function n(t){for(var e=0,r=0;r0?r=r.ushln(f):f<0&&(u=u.ushln(-f)),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":56,"./is-rat":58,"./lib/is-bn":62,"./lib/num-to-bn":63,"./lib/rationalize":64,"./lib/str-to-bn":65}],58:[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":62}],59:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return t.cmp(new n(0))}},{"bn.js":73}],60:[function(t,e,r){"use strict";var n=t("./bn-sign");e.exports=function(t){var e=t.length,r=t.words,i=0;if(1===e)i=r[0];else if(2===e)i=r[0]+67108864*r[1];else for(var a=0;a20?52:r+32}},{"bit-twiddle":71,"double-bits":131}],62:[function(t,e,r){"use strict";t("bn.js");e.exports=function(t){return t&&"object"==typeof t&&Boolean(t.words)}},{"bn.js":73}],63:[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":73,"double-bits":131}],64:[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":59,"./num-to-bn":63}],65:[function(t,e,r){"use strict";var n=t("bn.js");e.exports=function(t){return new n(t)}},{"bn.js":73}],66:[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":64}],67:[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":59}],68:[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":64}],69:[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+(h=n(l.ushln(u).divRound(r)))*Math.pow(2,-u))}var f=r.bitLength()-l.bitLength()+53,h=n(l.ushln(f).divRound(r));return f<1023?c*h*Math.pow(2,-f):(h*=Math.pow(2,-1023),c*h*Math.pow(2,1023-f))}},{"./lib/bn-to-num":60,"./lib/ctz":61}],70:[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)}},{}],71:[function(t,e,r){"use strict";"use restrict";function n(t){var e=32;return(t&=-t)&&e--,65535&t&&(e-=16),16711935&t&&(e-=8),252645135&t&&(e-=4),858993459&t&&(e-=2),1431655765&t&&(e-=1),e}r.INT_BITS=32,r.INT_MAX=2147483647,r.INT_MIN=-1<<31,r.sign=function(t){return(t>0)-(t<0)},r.abs=function(t){var e=t>>31;return(t^e)-e},r.min=function(t,e){return e^(t^e)&-(t65535)<<4,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<>>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}},{}],72:[function(t,e,r){"use strict";function n(t,e,r,n,a,o,s){for(var l=0;l=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=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>>26,f=67108863&l,h=Math.min(c,e.length-1),d=Math.max(0,c-t.length+1);d<=h;d++){var p=c-d|0;u+=(o=(i=0|t.words[p])*(a=0|e.words[d])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r.strip()}function c(t,e,r){return(new u).mulp(t,e,r)}function u(t,e){this.x=t,this.y=e}function f(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 h(){f.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function d(){f.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function p(){f.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function m(){f.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=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===r)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},a.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},a.prototype._parseBase=function(t,e,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=e)n++;n--,i=i/e|0;for(var a=t.length-r,o=a%n,l=Math.min(a,a-o)+r,c=0,u=r;u1&&0===this.words[this.length-1];)this.length--;return this._normSign()},a.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},a.prototype.inspect=function(){return(this.red?""};var x=["","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"],b=[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>>24-i&16777215)||o!==this.length-1?x[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=b[t],u=_[t];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var h=f.modn(u).toString(t);r=(f=f.idivn(u)).isZero()?h+r:x[c-h.length]+h+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=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},a.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},a.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},a.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},a.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},a.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},a.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},a.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},a.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},a.prototype.inotn=function(t){n("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),r=t%26;this._expand(e),r>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},a.prototype.notn=function(t){return this.clone().inotn(t)},a.prototype.setn=function(t,e){n("number"==typeof t&&t>=0);var r=t/26|0,i=t%26;return this._expand(r+1),this.words[r]=e?this.words[r]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},a.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r=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>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,d=0|o[1],p=8191&d,m=d>>>13,g=0|o[2],v=8191&g,y=g>>>13,x=0|o[3],b=8191&x,_=x>>>13,w=0|o[4],M=8191&w,k=w>>>13,A=0|o[5],T=8191&A,S=A>>>13,E=0|o[6],L=8191&E,C=E>>>13,z=0|o[7],D=8191&z,I=z>>>13,P=0|o[8],O=8191&P,F=P>>>13,R=0|o[9],N=8191&R,j=R>>>13,B=0|s[0],U=8191&B,V=B>>>13,q=0|s[1],H=8191&q,G=q>>>13,Y=0|s[2],W=8191&Y,X=Y>>>13,Z=0|s[3],J=8191&Z,K=Z>>>13,Q=0|s[4],$=8191&Q,tt=Q>>>13,et=0|s[5],rt=8191&et,nt=et>>>13,it=0|s[6],at=8191&it,ot=it>>>13,st=0|s[7],lt=8191&st,ct=st>>>13,ut=0|s[8],ft=8191&ut,ht=ut>>>13,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(f,U))|0)+((8191&(i=(i=Math.imul(f,V))+Math.imul(h,U)|0))<<13)|0;c=((a=Math.imul(h,V))+(i>>>13)|0)+(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(f,H)|0)|0)+((8191&(i=(i=i+Math.imul(f,G)|0)+Math.imul(h,H)|0))<<13)|0;c=((a=a+Math.imul(h,G)|0)+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(v,U),i=(i=Math.imul(v,V))+Math.imul(y,U)|0,a=Math.imul(y,V),n=n+Math.imul(p,H)|0,i=(i=i+Math.imul(p,G)|0)+Math.imul(m,H)|0,a=a+Math.imul(m,G)|0;var yt=(c+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,X)|0)+Math.imul(h,W)|0))<<13)|0;c=((a=a+Math.imul(h,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,U),i=(i=Math.imul(b,V))+Math.imul(_,U)|0,a=Math.imul(_,V),n=n+Math.imul(v,H)|0,i=(i=i+Math.imul(v,G)|0)+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(m,W)|0,a=a+Math.imul(m,X)|0;var xt=(c+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,J)|0))<<13)|0;c=((a=a+Math.imul(h,K)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(M,U),i=(i=Math.imul(M,V))+Math.imul(k,U)|0,a=Math.imul(k,V),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,X)|0)+Math.imul(y,W)|0,a=a+Math.imul(y,X)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(m,J)|0,a=a+Math.imul(m,K)|0;var bt=(c+(n=n+Math.imul(f,$)|0)|0)+((8191&(i=(i=i+Math.imul(f,tt)|0)+Math.imul(h,$)|0))<<13)|0;c=((a=a+Math.imul(h,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(T,U),i=(i=Math.imul(T,V))+Math.imul(S,U)|0,a=Math.imul(S,V),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(k,H)|0,a=a+Math.imul(k,G)|0,n=n+Math.imul(b,W)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,W)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(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(f,rt)|0)|0)+((8191&(i=(i=i+Math.imul(f,nt)|0)+Math.imul(h,rt)|0))<<13)|0;c=((a=a+Math.imul(h,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(L,U),i=(i=Math.imul(L,V))+Math.imul(C,U)|0,a=Math.imul(C,V),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(S,H)|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(b,J)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(v,$)|0,i=(i=i+Math.imul(v,tt)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(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(f,at)|0)|0)+((8191&(i=(i=i+Math.imul(f,ot)|0)+Math.imul(h,at)|0))<<13)|0;c=((a=a+Math.imul(h,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(D,U),i=(i=Math.imul(D,V))+Math.imul(I,U)|0,a=Math.imul(I,V),n=n+Math.imul(L,H)|0,i=(i=i+Math.imul(L,G)|0)+Math.imul(C,H)|0,a=a+Math.imul(C,G)|0,n=n+Math.imul(T,W)|0,i=(i=i+Math.imul(T,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(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(v,rt)|0,i=(i=i+Math.imul(v,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(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(f,lt)|0)|0)+((8191&(i=(i=i+Math.imul(f,ct)|0)+Math.imul(h,lt)|0))<<13)|0;c=((a=a+Math.imul(h,ct)|0)+(i>>>13)|0)+(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(D,H)|0,i=(i=i+Math.imul(D,G)|0)+Math.imul(I,H)|0,a=a+Math.imul(I,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(T,J)|0,i=(i=i+Math.imul(T,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(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(v,at)|0,i=(i=i+Math.imul(v,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(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(f,ft)|0)|0)+((8191&(i=(i=i+Math.imul(f,ht)|0)+Math.imul(h,ft)|0))<<13)|0;c=((a=a+Math.imul(h,ht)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(N,U),i=(i=Math.imul(N,V))+Math.imul(j,U)|0,a=Math.imul(j,V),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(F,H)|0,a=a+Math.imul(F,G)|0,n=n+Math.imul(D,W)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(I,W)|0,a=a+Math.imul(I,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(T,$)|0,i=(i=i+Math.imul(T,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(b,at)|0,i=(i=i+Math.imul(b,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(v,lt)|0,i=(i=i+Math.imul(v,ct)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ct)|0,n=n+Math.imul(p,ft)|0,i=(i=i+Math.imul(p,ht)|0)+Math.imul(m,ft)|0,a=a+Math.imul(m,ht)|0;var At=(c+(n=n+Math.imul(f,pt)|0)|0)+((8191&(i=(i=i+Math.imul(f,mt)|0)+Math.imul(h,pt)|0))<<13)|0;c=((a=a+Math.imul(h,mt)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(N,H),i=(i=Math.imul(N,G))+Math.imul(j,H)|0,a=Math.imul(j,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(D,J)|0,i=(i=i+Math.imul(D,K)|0)+Math.imul(I,J)|0,a=a+Math.imul(I,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(T,rt)|0,i=(i=i+Math.imul(T,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(b,lt)|0,i=(i=i+Math.imul(b,ct)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ct)|0,n=n+Math.imul(v,ft)|0,i=(i=i+Math.imul(v,ht)|0)+Math.imul(y,ft)|0,a=a+Math.imul(y,ht)|0;var Tt=(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)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(N,W),i=(i=Math.imul(N,X))+Math.imul(j,W)|0,a=Math.imul(j,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(D,$)|0,i=(i=i+Math.imul(D,tt)|0)+Math.imul(I,$)|0,a=a+Math.imul(I,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(T,at)|0,i=(i=i+Math.imul(T,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(b,ft)|0,i=(i=i+Math.imul(b,ht)|0)+Math.imul(_,ft)|0,a=a+Math.imul(_,ht)|0;var St=(c+(n=n+Math.imul(v,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(N,J),i=(i=Math.imul(N,K))+Math.imul(j,J)|0,a=Math.imul(j,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(D,rt)|0,i=(i=i+Math.imul(D,nt)|0)+Math.imul(I,rt)|0,a=a+Math.imul(I,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(T,lt)|0,i=(i=i+Math.imul(T,ct)|0)+Math.imul(S,lt)|0,a=a+Math.imul(S,ct)|0,n=n+Math.imul(M,ft)|0,i=(i=i+Math.imul(M,ht)|0)+Math.imul(k,ft)|0,a=a+Math.imul(k,ht)|0;var Et=(c+(n=n+Math.imul(b,pt)|0)|0)+((8191&(i=(i=i+Math.imul(b,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(N,$),i=(i=Math.imul(N,tt))+Math.imul(j,$)|0,a=Math.imul(j,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(D,at)|0,i=(i=i+Math.imul(D,ot)|0)+Math.imul(I,at)|0,a=a+Math.imul(I,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(T,ft)|0,i=(i=i+Math.imul(T,ht)|0)+Math.imul(S,ft)|0,a=a+Math.imul(S,ht)|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(N,rt),i=(i=Math.imul(N,nt))+Math.imul(j,rt)|0,a=Math.imul(j,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(D,lt)|0,i=(i=i+Math.imul(D,ct)|0)+Math.imul(I,lt)|0,a=a+Math.imul(I,ct)|0,n=n+Math.imul(L,ft)|0,i=(i=i+Math.imul(L,ht)|0)+Math.imul(C,ft)|0,a=a+Math.imul(C,ht)|0;var Ct=(c+(n=n+Math.imul(T,pt)|0)|0)+((8191&(i=(i=i+Math.imul(T,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(N,at),i=(i=Math.imul(N,ot))+Math.imul(j,at)|0,a=Math.imul(j,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(D,ft)|0,i=(i=i+Math.imul(D,ht)|0)+Math.imul(I,ft)|0,a=a+Math.imul(I,ht)|0;var zt=(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)+(zt>>>26)|0,zt&=67108863,n=Math.imul(N,lt),i=(i=Math.imul(N,ct))+Math.imul(j,lt)|0,a=Math.imul(j,ct),n=n+Math.imul(O,ft)|0,i=(i=i+Math.imul(O,ht)|0)+Math.imul(F,ft)|0,a=a+Math.imul(F,ht)|0;var Dt=(c+(n=n+Math.imul(D,pt)|0)|0)+((8191&(i=(i=i+Math.imul(D,mt)|0)+Math.imul(I,pt)|0))<<13)|0;c=((a=a+Math.imul(I,mt)|0)+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,n=Math.imul(N,ft),i=(i=Math.imul(N,ht))+Math.imul(j,ft)|0,a=Math.imul(j,ht);var It=(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)+(It>>>26)|0,It&=67108863;var Pt=(c+(n=Math.imul(N,pt))|0)+((8191&(i=(i=Math.imul(N,mt))+Math.imul(j,pt)|0))<<13)|0;return c=((a=Math.imul(j,mt))+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l[0]=gt,l[1]=vt,l[2]=yt,l[3]=xt,l[4]=bt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=kt,l[9]=At,l[10]=Tt,l[11]=St,l[12]=Et,l[13]=Lt,l[14]=Ct,l[15]=zt,l[16]=Dt,l[17]=It,l[18]=Pt,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>>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>=1;return n},u.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,r[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[r]=67108863&a}return 0!==e&&(this.words[r]=e,this.length++),this},a.prototype.muln=function(t){return this.clone().imuln(t)},a.prototype.sqr=function(){return this.mul(this)},a.prototype.isqr=function(){return this.imul(this.clone())},a.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new a(1);for(var r=this,n=0;n=0);var e,r=t%26,i=(t-r)/26,a=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(e=0;e>>26-r}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0);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<o)for(this.length-=o,c=0;c=0&&(0!==u||c>=i);c--){var f=0|this.words[c];this.words[c]=u<<26-a|f>>>a,u=f&s}return l&&0!==u&&(l.words[l.length++]=u),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},a.prototype.ishrn=function(t,e,r){return n(0===this.negative),this.iushrn(t,e,r)},a.prototype.shln=function(t){return this.clone().ishln(t)},a.prototype.ushln=function(t){return this.clone().iushln(t)},a.prototype.shrn=function(t){return this.clone().ishrn(t)},a.prototype.ushrn=function(t){return this.clone().iushrn(t)},a.prototype.testn=function(t){n("number"==typeof t&&t>=0);var e=t%26,r=(t-e)/26,i=1<=0);var e=t%26,r=(t-e)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==e&&r++,this.length=Math.min(r,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},a.prototype.isubn=function(t){if(n("number"==typeof t),n(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+r]=67108863&o}for(;i>26,this.words[i+r]=67108863&o;if(0===s)return this.strip();for(n(-1===s),s=0,i=0;i>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=0;f--){var h=67108864*(0|n.words[i.length+f])+(0|n.words[i.length+f-1]);for(h=Math.min(h/o|0,67108863),n._ishlnsubmul(i,h,f);0!==n.negative;)h--,n.negative=0,n._ishlnsubmul(i,1,f),n.isZero()||(n.negative^=1);s&&(s.words[f]=h)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},a.prototype.divmod=function(t,e,r){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(),f=e.clone();!e.isZero();){for(var h=0,d=1;0==(e.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(e.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(f)),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(f)),s.iushrn(1),l.iushrn(1);e.cmp(r)>=0?(e.isub(r),i.isub(s),o.isub(l)):(r.isub(e),s.isub(i),l.isub(o))}return{a:s,b:l,gcd:r.iushln(c)}},a.prototype._invmp=function(t){n(0===t.negative),n(!t.isZero());var e=this,r=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var i=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,f=1;0==(r.words[0]&f)&&u<26;++u,f<<=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 h;return(h=0===e.cmpn(1)?i:o).cmpn(0)<0&&h.iadd(t),h},a.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=e.cmp(r);if(i<0){var a=e;e=r,r=a}else if(0===i||0===r.cmpn(1))break;e.isub(r)}return r.iushln(n)},a.prototype.invm=function(t){return this.egcd(t).a.umod(t)},a.prototype.isEven=function(){return 0==(1&this.words[0])},a.prototype.isOdd=function(){return 1==(1&this.words[0])},a.prototype.andln=function(t){return this.words[0]&t},a.prototype.bincn=function(t){n("number"==typeof t);var e=t%26,r=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},a.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},a.prototype.cmpn=function(t){var e=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:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},a.prototype.gtn=function(t){return 1===this.cmpn(t)},a.prototype.gt=function(t){return 1===this.cmp(t)},a.prototype.gten=function(t){return this.cmpn(t)>=0},a.prototype.gte=function(t){return this.cmp(t)>=0},a.prototype.ltn=function(t){return-1===this.cmpn(t)},a.prototype.lt=function(t){return-1===this.cmp(t)},a.prototype.lten=function(t){return this.cmpn(t)<=0},a.prototype.lte=function(t){return this.cmp(t)<=0},a.prototype.eqn=function(t){return 0===this.cmpn(t)},a.prototype.eq=function(t){return 0===this.cmp(t)},a.red=function(t){return new 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};f.prototype._tmp=function(){var t=new a(null);return t.words=new Array(Math.ceil(this.n/13)),t},f.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},f.prototype.split=function(t,e){t.iushrn(this.n,0,e)},f.prototype.imulK=function(t){return t.imul(this.k)},i(h,f),h.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},h.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},a._prime=function(t){if(M[t])return M[t];var e;if("k256"===t)e=new h;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 f=this.pow(u,i),h=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=0;n--){for(var c=e.words[n],u=l-1;u>=0;u--){var f=c>>u&1;i!==r[0]&&(i=this.sqr(i)),0!==f||0!==o?(o<<=1,o|=f,(4===++s||0===n&&0===u)&&(i=this.mul(i,r[o]),s=0,o=0)):s=0}l=26}return i},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)},{}],74:[function(t,e,r){"use strict";e.exports=function(t){var e,r,n,i=t.length,a=0;for(e=0;e>>1;if(!(s<=0)){var f,h=l.mallocDouble(2*s*a),d=l.mallocInt32(a);if((a=i(t,s,h,d))>0){if(1===s&&n)c.init(a),f=c.sweepComplete(s,r,0,a,h,d,0,a,h,d);else{var p=l.mallocDouble(2*s*o),m=l.mallocInt32(o);(o=i(e,s,p,m))>0&&(c.init(a+o),f=1===s?c.sweepBipartite(s,r,0,a,h,d,0,o,p,m):u(s,r,n,a,h,d,o,p,m),l.free(p),l.free(m))}l.free(h),l.free(d)}return f}}}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":77,"./lib/sweep":81,"typedarray-pool":554}],76:[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="+f+"["+a+"+"+d+"],x1="+f+"["+a+"+"+d+"+"+i+"],xi="+h+"[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,b,":",M):s.push(M,b,":",w),r?s.push("if(y1"+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",f="rb",h="ri",d="rp",p="bs",m="be",g="bb",v="bi",y="bp",x="rv",b="Q",_=[i,a,o,c,u,f,h,p,m,g,v];r.partial=n(!1),r.full=n(!0)},{}],77:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l){var c=M*t;A[c]=e,A[c+1]=r,A[c+2]=n,A[c+3]=i,A[c+4]=a,A[c+5]=o;var u=k*t;T[u]=s,T[u+1]=l}function i(t,e,r,n,i,a,o,s,l,c,u){var f=2*t,h=l*f,d=c[h+e];t:for(var p=i,m=i*f;p0;){var P=(D-=1)*M,O=A[P],F=A[P+1],R=A[P+2],N=A[P+3],j=A[P+4],B=A[P+5],U=D*k,V=T[U],q=T[U+1],H=1&B,G=!!(16&B),Y=d,W=S,X=L,Z=C;if(H&&(Y=L,W=C,X=d,Z=S),!(2&B&&(R=x(t,O,F,R,Y,W,q),F>=R)||4&B&&(F=b(t,O,F,R,Y,W,V))>=R)){var J=R-F,K=j-N;if(G){if(t*J*(J+K)=p0)&&!(p1>=hi)",["p0","p1"]),y=d("lo===p0",["p0"]),x=d("lor&&i[f+e]>c;--u,f-=o){for(var h=f,d=f+o,p=0;p>>1,h=2*t,d=f,p=s[h*f+e];c=x?(d=y,p=x):v>=_?(d=g,p=v):(d=b,p=_):x>=_?(d=y,p=x):_>=v?(d=g,p=v):(d=b,p=_);for(var w=h*(u-1),M=h*d,k=0;k=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"},{}],80:[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(cr[e+1])}function c(t,e,r,n){var i=n[t*=2];return i>1,g=m-h,v=m+h,y=d,x=g,b=m,_=v,w=p,M=t+1,k=e-1,A=0;l(y,x,r)&&(A=y,y=x,x=A),l(_,w,r)&&(A=_,_=w,w=A),l(y,b,r)&&(A=y,y=b,b=A),l(x,b,r)&&(A=x,x=b,b=A),l(y,_,r)&&(A=y,y=_,_=A),l(b,_,r)&&(A=b,b=_,_=A),l(x,w,r)&&(A=x,x=w,w=A),l(x,b,r)&&(A=x,x=b,b=A),l(_,w,r)&&(A=_,_=w,w=A);for(var T=r[2*x],S=r[2*x+1],E=r[2*_],L=r[2*_+1],C=2*y,z=2*b,D=2*w,I=2*d,P=2*m,O=2*p,F=0;F<2;++F){var R=r[C+F],N=r[z+F],j=r[D+F];r[I+F]=R,r[P+F]=N,r[O+F]=j}a(g,t,r),a(v,e,r);for(var B=M;B<=k;++B)if(c(B,T,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,T,S,r)?(o(B,M,k,r),++M,--k):(i(B,k,r),--k);break}if(--k>>1;s(m,S);var E=0,L=0;for(M=0;M=l)n(f,h,L--,C=C-l|0);else if(C>=0)n(c,u,E--,C);else if(C<=-l){C=-C-l|0;for(var z=0;z>>1;s(m,E);var L=0,C=0,z=0;for(k=0;k>1==m[2*k+3]>>1&&(I=2,k+=1),D<0){for(var P=-(D>>1)-1,O=0;O>1)-1,0===I?n(c,u,L--,P):1===I?n(f,h,C--,P):2===I&&n(d,p,z--,P)}},scanBipartite:function(t,e,r,a,o,f,h,d,p,g,v,y){var x=0,b=2*t,_=e,w=e+t,M=1,k=1;a?k=l:M=l;for(var A=o;A>>1;s(m,L);var C=0;for(A=0;A=l?(D=!a,T-=l):(D=!!a,T-=1),D)i(c,u,C++,T);else{var I=y[T],P=b*T,O=v[P+e+1],F=v[P+e+1+t];t:for(var R=0;R>>1;s(m,M);var k=0;for(x=0;x=l)c[k++]=b-l;else{var T=d[b-=1],S=g*b,E=h[S+e+1],L=h[S+e+1+t];t:for(var C=0;C=0;--C)if(c[C]===b){for(P=C+1;PP)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=P)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P.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 f(t,e,r){var n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if(r>>>=0,e>>>=0,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;a2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,z(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;cs&&(r=s-l),c=r;c>=0;c--){for(var f=!0,h=0;hi&&(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>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;i239?4:a>223?3:a>191?2:1;if(i+s<=r){var l,c,u,f;switch(s){case 1:a<128&&(o=a);break;case 2:128==(192&(l=t[i+1]))&&(f=(31&a)<<6|63&l)>127&&(o=f);break;case 3:l=t[i+1],c=t[i+2],128==(192&l)&&128==(192&c)&&(f=(15&a)<<12|(63&l)<<6|63&c)>2047&&(f<55296||f>57343)&&(o=f);break;case 4:l=t[i+1],c=t[i+2],u=t[i+3],128==(192&l)&&128==(192&c)&&128==(192&u)&&(f=(15&a)<<18|(63&l)<<12|(63&c)<<6|63&u)>65535&&f<1114112&&(o=f)}}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(;nr)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||et.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 A(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,4),I.write(t,e,r,n,23,4),r+4}function T(t,e,r,n,i){return e=+e,r>>>=0,i||k(t,0,r,8),I.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;o55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function E(t){return D.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=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 z(t){return t!=t}var D=t("base64-js"),I=t("ieee754");r.Buffer=i,r.SlowBuffer=function(t){return+t!=t&&(t=0),i.alloc(+t)},r.INSPECT_MAX_BYTES=50;var P=2147483647;r.kMaxLength=P,(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);a0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(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),f=0;f>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var a=!1;;)switch(n){case"hex":return m(this,t,e,r);case"utf8":case"utf-8":return 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 x(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(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>>=0,e>>>=0,r||w(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=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=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),I.read(this,t,!0,23,4)},i.prototype.readFloatBE=function(t,e){return t>>>=0,e||w(t,4,this.length),I.read(this,t,!1,23,4)},i.prototype.readDoubleLE=function(t,e){return t>>>=0,e||w(t,8,this.length),I.read(this,t,!0,52,8)},i.prototype.readDoubleBE=function(t,e){return t>>>=0,e||w(t,8,this.length),I.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>>=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>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 A(this,t,e,!0,r)},i.prototype.writeFloatBE=function(t,e,r){return A(this,t,e,!1,r)},i.prototype.writeDoubleLE=function(t,e,r){return T(this,t,e,!0,r)},i.prototype.writeDoubleBE=function(t,e,r){return T(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=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=0;--i)t[i+e]=this[i+r];else if(a<1e3)for(i=0;i>>=0,r=void 0===r?this.length:r>>>0,t||(t=0);var o;if("number"==typeof t)for(o=e;o0)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;o0?u-4:u;var f=0;for(e=0,r=0;e>16&255,c[f++]=a>>8&255,c[f++]=255&a;return 2===o?(a=s[t.charCodeAt(e)]<<2|s[t.charCodeAt(e+1)]>>4,c[f++]=255&a):1===o&&(a=s[t.charCodeAt(e)]<<10|s[t.charCodeAt(e+1)]<<4|s[t.charCodeAt(e+2)]>>2,c[f++]=a>>8&255,c[f++]=255&a),c},r.fromByteArray=function(t){for(var e,r=t.length,n=r%3,i="",s=[],l=0,c=r-n;lc?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,f=c.length;u0;){for(var d=r.pop(),p=(u=-1,f=-1,l=o[s=r.pop()],1);p=0||(e.flip(s,d),n(t,e,r,u,s,f),n(t,e,r,s,f,u),n(t,e,r,f,d,u),n(t,e,r,d,u,f))}}},{"binary-search-bounds":89,"robust-in-sphere":513}],86:[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;o0||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=h[3*d+p];m>=0&&0===c[m]&&(f[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;i1&&h(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&&h(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]v[0]&&l.push(new i(v,g,m,f),new i(g,v,p,f))}l.sort(a);for(var y=l[0].a[0]-(1+Math.abs(l[0].a[0]))*Math.pow(2,-52),x=[new n([y,1],[y,0],-1,[],[],[],[])],b=[],_=(f=0,l.length);f<_;++f){var w=l[f],M=w.type;M===d?s(b,x,t,w.a,w.idx):M===m?c(x,0,w):u(x,0,w)}return b}},{"binary-search-bounds":89,"robust-orientation":515}],88:[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=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>>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)}},{}],90:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1,r=1;rr?r:t:te?e:t}},{}],94:[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;re[2]?1:0)}function l(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--a){var x=e[o=(S=n[a])[0]],b=x[0],_=x[1],w=t[b],M=t[_];if((w[0]-M[0]||w[1]-M[1])<0){var k=b;b=_,_=k}x[0]=b;var A,T=x[1]=S[1];for(i&&(A=x[2]);a>0&&n[a-1][0]===o;){var S,E=(S=n[--a])[1];i?e.push([T,E,A]):e.push([T,E]),T=E}i?e.push([T,_,A]):e.push([T,_])}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>>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:93}],98:[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]}},{}],99:[function(t,e,r){"use strict";var n=t("color-rgba"),i=t("clamp"),a=t("dtype");e.exports=function(t,e){"float"!==e&&e||(e="array"),"uint"===e&&(e="uint8"),"uint_clamped"===e&&(e="uint8_clamped");var r=a(e),o=new r(4);if(t instanceof r)return Array.isArray(t)?t.slice():(o.set(t),o);var s="uint8"!==e&&"uint8_clamped"!==e;return t instanceof Uint8Array||t instanceof Uint8ClampedArray?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=null!=t[3]?t[3]:255,s&&(o[0]/=255,o[1]/=255,o[2]/=255,o[3]/=255),o):(t.length&&"string"!=typeof t||((t=n(t))[0]/=255,t[1]/=255,t[2]/=255),s?(o[0]=t[0],o[1]=t[1],o[2]=t[2],o[3]=null!=t[3]?t[3]:1):(o[0]=i(Math.round(255*t[0]),0,255),o[1]=i(Math.round(255*t[1]),0,255),o[2]=i(Math.round(255*t[2]),0,255),o[3]=null==t[3]?255:i(Math.floor(255*t[3]),0,255)),o)}},{clamp:93,"color-rgba":101,dtype:133}],100:[function(t,e,r){(function(r){"use strict";var n=t("color-name"),i=t("is-plain-obj"),a=t("defined");e.exports=function(t){var e,s,l=[],c=1;if("string"==typeof t)if(n[t])l=n[t].slice(),s="rgb";else if("transparent"===t)c=0,s="rgb",l=[0,0,0];else if(/^#[A-Fa-f0-9]+$/.test(t)){var u=t.slice(1);c=1,(h=u.length)<=4?(l=[parseInt(u[0]+u[0],16),parseInt(u[1]+u[1],16),parseInt(u[2]+u[2],16)],4===h&&(c=parseInt(u[3]+u[3],16)/255)):(l=[parseInt(u[0]+u[1],16),parseInt(u[2]+u[3],16),parseInt(u[4]+u[5],16)],8===h&&(c=parseInt(u[6]+u[7],16)/255)),l[0]||(l[0]=0),l[1]||(l[1]=0),l[2]||(l[2]=0),s="rgb"}else if(e=/^((?:rgb|hs[lvb]|hwb|cmyk?|xy[zy]|gray|lab|lchu?v?|[ly]uv|lms)a?)\s*\(([^\)]*)\)/.exec(t)){var f=e[1];s=u=f.replace(/a$/,"");var h="cmyk"===u?4:"gray"===u?1:3;l=e[2].trim().split(/\s*,\s*/).map(function(t,e){if(/%$/.test(t))return e===h?parseFloat(t)/100:"rgb"===u?255*parseFloat(t)/100:parseFloat(t);if("h"===u[e]){if(/deg$/.test(t))return parseFloat(t);if(void 0!==o[t])return o[t]}return parseFloat(t)}),f===u&&l.push(1),c=void 0===l[h]?1:l[h],l=l.slice(0,h)}else t.length>10&&/[0-9](?:\s|\/)/.test(t)&&(l=t.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),s=t.match(/([a-z])/gi).join("").toLowerCase());else if("number"==typeof t)s="rgb",l=[t>>>16,(65280&t)>>>8,255&t];else if(i(t)){var d=a(t.r,t.red,t.R,null);null!==d?(s="rgb",l=[d,a(t.g,t.green,t.G),a(t.b,t.blue,t.B)]):(s="hsl",l=[a(t.h,t.hue,t.H),a(t.s,t.saturation,t.S),a(t.l,t.lightness,t.L,t.b,t.brightness)]),c=a(t.a,t.alpha,t.opacity,1),null!=t.opacity&&(c/=100)}else(Array.isArray(t)||r.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(t))&&(l=[t[0],t[1],t[2]],s="rgb",c=4===t.length?t[3]:1);return{space:s,values:l,alpha:c}};var o={red:0,orange:60,yellow:120,green:180,blue:240,purple:300}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"color-name":98,defined:129,"is-plain-obj":286}],101:[function(t,e,r){"use strict";var n=t("color-parse"),i=t("color-space/hsl"),a=t("clamp");e.exports=function(t){var e;if("string"!=typeof t)throw Error("Argument should be a string");var r=n(t);return r.space?(e=Array(3),e[0]=a(r.values[0],0,255),e[1]=a(r.values[1],0,255),e[2]=a(r.values[2],0,255),"h"===r.space[0]&&(e=i.rgb(e)),e.push(a(r.alpha,0,1)),e):[]}},{clamp:93,"color-parse":100,"color-space/hsl":102}],102:[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":103}],103:[function(t,e,r){"use strict";e.exports={name:"rgb",min:[0,0,0],max:[255,255,255],channel:["red","green","blue"],alias:["RGB"]}},{}],104:[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]}]}},{}],105:[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,f,h,d,p,m,g,v,y,x=[],b=[],_=[],w=[];if(a.isPlainObject(t)||(t={}),p=t.nshades||72,d=t.format||"hex",(h=t.colormap)||(h="jet"),"string"==typeof h){if(h=h.toLowerCase(),!s[h])throw Error(h+" not a supported colorscale");f=o(s[h])}else{if(!Array.isArray(h))throw Error("unsupported colormap option",h);f=o(h)}if(f.length>p)throw new Error(h+" map requires nshades to be at least size "+f.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=f.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=0&&r[3]<=1||(r[3]=g[0]+(g[1]-g[0])*v);for(y=0;y=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 f=i(t,e,r);return f>0?s>0&&i(t,e,o)>0?1:-1:f<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":515,"robust-product":516,"robust-sum":520,signum:522,"two-sum":553}],107:[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],f=t[1],h=t[2],d=t[3],p=e[0],m=e[1],g=e[2],v=e[3];return u+f+h+d-(p+m+g+v)||i(u,f,h,d)-i(p,m,g,v,p)||i(u+f,u+h,u+d,f+h,f+d,h+d)-i(p+m,p+g,p+v,m+g,m+v,g+v)||i(u+f+h,u+f+d,u+h+d,f+h+d)-i(p+m+g,p+m+v,p+g+v,m+g+v);default:for(var y=t.slice().sort(n),x=e.slice().sort(n),b=0;bt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]}},{}],111:[function(t,e,r){"use strict";e.exports=function(t){var e=n(t),r=e.length;if(r<=2)return[];for(var i=new Array(r),a=e[r-1],o=0;o=e[l]&&(s+=1);a[o]=s}}return t}(n(a,!0),r)}};var n=t("incremental-convex-hull"),i=t("affine-hull")},{"affine-hull":45,"incremental-convex-hull":278}],113:[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"}},{}],114:[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 n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function o(t){return i("%"===t[t.length-1]?parseFloat(t)/100: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),f=e.substr(i+1,l-(i+1)).split(","),h=1;switch(u){case"rgba":if(4!==f.length)return null;h=o(f.pop());case"rgb":return 3!==f.length?null:[a(f[0]),a(f[1]),a(f[2]),h];case"hsla":if(4!==f.length)return null;h=o(f.pop());case"hsl":if(3!==f.length)return null;var d=(parseFloat(f[0])%360+360)%360/360,p=o(f[1]),m=o(f[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)),h];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){}},{}],115:[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,f=s*(3-2*i),h=s*o;if(t.length){a||(a=new Array(t.length));for(var d=t.length-1;d>=0;--d)a[d]=c*t[d]+u*e[d]+f*r[d]+h*n[d];return a}return c*t+u*e+f*r+h*n},e.exports.derivative=function(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,c=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var u=t.length-1;u>=0;--u)a[u]=o*t[u]+s*e[u]+l*r[u]+c*n[u];return a}return o*t+s*e+l*r[u]+c*n}},{}],116:[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;i0)throw new Error("cwise: pre() block may not reference array args");if(i0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===a)e.scalarArgs.push(i),e.shimArgs.push("scalar"+i);else if("index"===a){if(e.indexArgs.push(i),i0)throw new Error("cwise: pre() block may not reference array index");if(i0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===a){if(e.shapeArgs.push(i),ir.length)throw new Error("cwise: Too many arguments in pre() block");if(e.body.args.length>r.length)throw new Error("cwise: Too many arguments in body() block");if(e.post.args.length>r.length)throw new Error("cwise: Too many arguments in post() block");return e.debug=!!t.printCode||!!t.debug,e.funcName=t.funcName||"cwise",e.blockSize=t.blockSize||64,n(e)}},{"./lib/thunk.js":118}],117:[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,f=0;for(n=0;n=0;--n)u=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",f,"]-=s",f].join("")),l.push(["++index[",u,"]"].join(""))),l.push("}")}return l.join("\n")}function i(t,e,r){for(var n=t.body,i=[],a=[],o=0;o0&&y.push("shape=SS.slice(0)"),t.indexArgs.length>0){var x=new Array(r);for(l=0;l3&&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;e0,c=[],u=0;u0;){"].join("")),c.push(["if(j",u,"<",s,"){"].join("")),c.push(["s",e[u],"=j",u].join("")),c.push(["j",u,"=0"].join("")),c.push(["}else{s",e[u],"=",s].join("")),c.push(["j",u,"-=",s,"}"].join("")),l&&c.push(["index[",e[u],"]=j",u].join(""));for(u=0;u3&&v.push(i(t.post,t,s)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+v.join("\n")+"\n----------");var A=[t.funcName||"unnamed","_cwise_loop_",o[0].join("s"),"m",k,function(t){for(var e=new Array(t.length),r=!0,n=0;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(s)].join("");return new Function(["function ",A,"(",g.join(","),"){",v.join("\n"),"} return ",A].join(""))()}},{uniq:556}],118:[function(t,e,r){"use strict";var n=t("./compile.js");e.exports=function(t){var e=["'use strict'","var CACHED={}"],r=[],i=t.funcName+"_cwise_thunk";e.push(["return function ",i,"(",t.shimArgs.join(","),"){"].join(""));for(var a=[],o=[],s=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],l=[],c=[],u=0;u0&&(l.push("array"+t.arrayArgs[0]+".shape.length===array"+f+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),c.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+f+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same dimensionality!')"),e.push("for(var shapeIndex=array"+t.arrayArgs[0]+".shape.length-"+Math.abs(t.arrayBlockIndices[0])+"; shapeIndex--\x3e0;) {"),e.push("if (!("+c.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;u=0?(a>=b?10:a>=_?5:a>=w?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=b?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>=b?i*=10:a>=_?i*=5:a>=w&&(i*=2),ee?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>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}},s=o(a),l=s.right,c=s.left,u=function(t){return null===t?NaN:+t},f=function(t,e){var r,n,i=t.length,a=0,o=-1,s=0,l=0;if(null==e)for(;++o1)return l/(a-1)},h=function(t,e){var r=f(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=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i=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)}},A=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},T=function(t){if(!(a=t.length))return[];for(var e=-1,r=A(t,i),n=new Array(r);++et?1:e>=t?0:NaN},t.deviation=h,t.extent=d,t.histogram=function(){function t(t){var a,o,s=t.length,c=new Array(s);for(a=0;ah;)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]:f,m.x1=a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=A,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);n0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++l=u.length)return null!=l?l(e):null!=s?e.sort(s):e;for(var o,c,f,h=-1,d=e.length,p=u[n++],m=r(),g=i();++hu.length)return t;var n,i=f[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=[],f=[];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 f[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})})},{}],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(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=z.exec(t))?new l(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=D.exec(t))?a(e[1],e[2],e[3],e[4]):(e=I.exec(t))?a(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=P.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 f(t,e,r,n)}function u(t,e,i,a){return 1===arguments.length?function(t){if(t instanceof f)return new f(t.h,t.s,t.l,t.opacity);if(t instanceof r||(t=n(t)),!t)return new f;if(t instanceof f)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*(i0&&u<1?0:l,new f(l,c,u,t.opacity)}(t):new f(t,e,i,null==a?1:a)}function f(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function h(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=x(t.r),n=x(t.g),i=x(t.b),a=g((.4124564*r+.3575761*n+.1804375*i)/j),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/H+V}function v(t){return t>q?t*t*t:H*(t-V)}function y(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function x(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function b(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)*N;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)*N-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},A="\\s*([+-]?\\d+)\\s*",T="\\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\\("+[A,A,A]+"\\)$"),z=new RegExp("^rgb\\("+[S,S,S]+"\\)$"),D=new RegExp("^rgba\\("+[A,A,A,T]+"\\)$"),I=new RegExp("^rgba\\("+[S,S,S,T]+"\\)$"),P=new RegExp("^hsl\\("+[T,S,S]+"\\)$"),O=new RegExp("^hsla\\("+[T,S,S,T]+"\\)$"),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(f,u,e(r,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new f(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new f(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(h(t>=240?t-240:t+120,i,n),h(t,i,n),h(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,N=180/Math.PI,j=.95047,B=1,U=1.08883,V=4/29,q=6/29,H=3*q*q,G=q*q*q;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=j*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(_,b,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=b,t.cubehelix=w,Object.defineProperty(t,"__esModule",{value:!0})})},{}],123:[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=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(;++o0)for(var r,n,i=new Array(r),a=0;ad+s||np+s||if.index){var l=d-a.x-a.vx,u=p-a.y-a.vy,v=l*l+u*u;vt.r&&(t.r=t[e].r)}function i(){if(s){var e,r,n=s.length;for(l=new Array(n),e=0;e=m)){(t.data!==o||t.next)&&(0===i&&(i=h(),u+=i*i),0===a&&(a=h(),u+=a*a),u1?(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;c1?(y.on(t,e),l):y.on(t)}}},t.forceX=function(t){function e(t){for(var e,r=0,o=n.length;r180||r<-180?r-360*Math.round(r/360):r):x(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):x(isNaN(e)?r:e)}}function o(t,e){var r=e-t;return r?n(t,r):x(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;n180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:A(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:A(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:A(t,r)},{i:s-2,x:A(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=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=ia&&(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:A(r,n)})),a=E.lastIndex;return a=(a=(m+v)/2))?m=a:v=a,(u=r>=(o=(g+y)/2))?g=o:y=o,i=d,!(d=d[f=u<<1|c]))return i[f]=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[f]=p:t._root=p,t;do{i=i?i[f]=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((f=u<<1|c)==(h=(l>=o)<<1|s>=a));return i[h]=d,i[f]=p,t}function r(t,e,r){var i=new n(null==e?function(t){return t[0]}:e,null==r?function(t){return t[1]}:r,NaN,NaN,NaN,NaN);return null==t?i:i.addAll(t)}function n(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 i(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var a=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i},o=r.prototype=n.prototype;o.copy=function(){var t,e,r=new n(this._x,this._y,this._x0,this._y0,this._x1,this._y1),a=this._root;if(!a)return r;if(!a.length)return r._root=i(a),r;for(t=[{source:a,target:r._root=new Array(4)}];a=t.pop();)for(var o=0;o<4;++o)(e=a.source[o])&&(e.length?t.push({source:e,target:a.target[o]=new Array(4)}):a.target[o]=i(e));return r},o.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)},o.addAll=function(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),c=1/0,u=1/0,f=-1/0,h=-1/0;for(n=0;nf&&(f=i),ah&&(h=a));for(ft||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},o.data=function(){var t=[];return this.visit(function(e){if(!e.length)do{t.push(e.data)}while(e=e.next)}),t},o.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]]},o.find=function(t,e,r){var n,i,o,s,l,c,u,f=this._x0,h=this._y0,d=this._x1,p=this._y1,m=[],g=this._root;for(g&&m.push(new a(g,f,h,d,p)),null==r?r=1/0:(f=t-r,h=e-r,d=t+r,p=e+r,r*=r);c=m.pop();)if(!(!(g=c.node)||(i=c.x0)>d||(o=c.y0)>p||(s=c.x1)=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 x=t-+this._x.call(null,g.data),b=e-+this._y.call(null,g.data),_=x*x+b*b;if(_=(s=(p+g)/2))?p=s:g=s,(u=o>=(l=(m+v)/2))?m=l:v=l,e=d,!(d=d[f=u<<1|c]))return this;if(!d.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(r=e,h=f)}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[f]=i:delete e[f],(d=e[0]||e[1]||e[2]||e[3])&&d===(e[3]||e[2]||e[1]||e[0])&&!d.length&&(r?r[h]=d:this._root=d),this):(this._root=i,this)},o.removeAll=function(t){for(var e=0,r=t.length;e=0&&r._call.call(null,t),r=r._next;--f}function o(){g=(m=y.now())+v,f=h=0;try{a()}finally{f=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(!f){h&&(h=clearTimeout(h));var e=t-g;e>24?(t<1/0&&(h=setTimeout(o,e)),d&&(d=clearInterval(d))):(d||(m=g,d=setInterval(s,p)),f=1,x(o))}}var c,u,f=0,h=0,d=0,p=1e3,m=0,g=0,v=0,y="object"==typeof performance&&performance.now?performance:Date,x="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})})},{}],128:[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 te?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>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}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+="")===oa||t[0]===sa?sa+t:t}function f(t){return(t+="")[0]===sa?t.slice(1):t}function h(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(f(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 x(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var r=0,n=la.length;r0&&(t=t.slice(0,a));var s=ya.get(t);return s&&(t=s,o=G),a?e?function(){var a=o(e,Ki(arguments));n.call(this),this.addEventListener(t,this[i]=a,a.$=r),a._=e}:n:e?b:function(){var e,r=new RegExp("^__on([^.]+)"+Zi.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 H(t,e){return function(r){var n=Zi.event;Zi.event=r,e[0]=this.__data__;try{t.apply(this,e)}finally{Zi.event=n}}}function G(t,e){var r=H(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-"+ ++ba,i="click"+n,a=Zi.select(r(e)).on("touchmove"+n,M).on("dragstart"+n,M).on("selectstart"+n,M);if(null==xa&&(xa=!("onselectstart"in e)&&x(e.style,"userSelect")),xa){var o=t(e).style,s=o[xa];o[xa]="none"}return function(t){if(a.on(n,null),xa&&(o[xa]=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(_a<0){var a=r(t);if(a.scrollX||a.scrollY){var o=(n=Zi.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();_a=!(o.f||o.e),n.remove()}}return _a?(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 Zi.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?ka:Math.acos(t)}function Q(t){return t>1?Sa:t<-1?-Sa: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 ht(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):t instanceof ot?lt(t.l,t.a,t.b):lt((t=yt((t=Zi.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*=Ea)*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=ht(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)*Ra,n=ct(n)*Na,a=ct(a)*ja,new ht(ft(3.2404542*i-1.5371385*n-.4985314*a),ft(-.969266*i+1.8760108*n+.041556*a),ft(.0556434*i-.2040259*n+1.0572252*a))}function lt(t,e,r){return t>0?new it(Math.atan2(r,e)*La,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 ft(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ht(t,e,r){return this instanceof ht?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ht?new ht(t.r,t.g,t.b):gt(""+t,ht,nt):new ht(t,e,r)}function dt(t){return new ht(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(bt(i[0]),bt(i[1]),bt(i[2]))}return(a=Va.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+(e0&&l<1?0:n),new rt(n,i,l)}function yt(t,e,r){var n=ut((.4124564*(t=xt(t))+.3575761*(e=xt(e))+.1804375*(r=xt(r)))/Ra),i=ut((.2126729*t+.7151522*e+.072175*r)/Na);return ot(116*i-16,500*(n-i),200*(i-ut((.0193339*t+.119192*e+.9503041*r)/ja)))}function xt(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function bt(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=Zi.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=Zi.event;Zi.event=t;try{o.progress.call(a,l)}finally{Zi.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(Ki(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},Zi.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 Ha?Ha.n=i:qa=i,Ha=i,Ga||(Ya=clearTimeout(Ya),Ga=1,Wa(At)),i}function At(){var t=Tt(),e=St()-t;e>24?(isFinite(e)&&(clearTimeout(Ya),Ya=setTimeout(At,e)),Ga=0):(Ga=1,Wa(At))}function Tt(){for(var t=Date.now(),e=qa;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function St(){for(var t,e=qa,r=1/0;e;)e.c?(e.t1?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-r1)for(;o68?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){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Vt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function qt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function Ht(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function Gt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function Yt(t,e,r){eo.lastIndex=0;var n=eo.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function Wt(t,e,r){eo.lastIndex=0;var n=eo.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=aa(e)/60|0,i=aa(e)%60;return r+Dt(n,"0",2)+Dt(i,"0",2)}function Zt(t,e,r){ro.lastIndex=0;var n=ro.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function Jt(t){for(var e=t.length,r=-1;++r=0?1:-1,s=o*r,l=Math.cos(e),c=Math.sin(e),u=a*c,f=i*l+u*Math.cos(s),h=u*o*Math.sin(s);lo.add(Math.atan2(h,f)),n=t,i=l,a=c}var e,r,n,i,a;co.point=function(o,s){co.point=t,n=(e=o)*Ea,i=Math.cos(s=(r=s)*Ea/2+ka/4),a=Math.sin(s)},co.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 aa(t[0]-e[0])=0;--s)i.point((f=u[s])[0],f[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 xe(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n0){for(_||(a.polygonStart(),_=!0),a.lineStart();++o1&&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=f,y.lineEnd=h,d=[],p=[]},polygonEnd:function(){y.point=o,y.lineStart=l,y.lineEnd=c,d=Zi.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;lo.reset();for(var s=0,l=e.length;s=0?1:-1,M=w*_,k=M>ka,A=p*x;if(lo.add(Math.atan2(A*w*Math.sin(M),m*b+A*Math.cos(M))),a+=k?_+w*Aa:_,k^h>=r^v>=r){var T=ae(ne(f),ne(t));le(T);var S=ae(i,T);le(S);var E=(k^_>=0?-1:1)*Q(S[2]);(n>E||n===E&&(T[0]||T[1]))&&(o+=k^_>=0?1:-1)}if(!g++)break;h=v,p=x,m=b,f=t}}return(a<-wa||a1}function Me(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:b,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]-Sa-wa:Sa-t[1])-((e=e.x)[0]<0?e[1]-Sa-wa:Sa-e[1])}function Ae(t,e,r,n){return function(i){var a,o=i.a,s=i.b,l=o.x,c=o.y,u=0,f=1,h=s.x-l,d=s.y-c;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a0){if(a>f)return;a>u&&(u=a)}if(a=r-l,h||!(a<0)){if(a/=h,h<0){if(a>f)return;a>u&&(u=a)}else if(h>0){if(a0)){if(a/=d,d<0){if(a0){if(a>f)return;a>u&&(u=a)}if(a=n-c,d||!(a<0)){if(a/=d,d<0){if(a>f)return;a>u&&(u=a)}else if(d>0){if(a0&&(i.a={x:l+u*h,y:c+u*d}),f<1&&(i.b={x:l+f*h,y:c+f*d}),i}}}}}}function Te(t,e,r,n){function i(n,i){return aa(n[0]-t)0?0:3:aa(n[0]-r)0?2:1:aa(n[1]-e)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,f=0;if(null==a||(u=i(a,l))!==(f=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)!==f);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 f(t,e){var r=c(t=Math.max(-ko,Math.min(ko,t)),e=Math.max(-ko,Math.min(ko,e)));if(d&&p.push([t,e]),_)m=t,g=e,v=r,_=!1,r&&(s.lineStart(),s.point(t,e));else if(r&&b)s.point(t,e);else{var n={a:{x:y,y:x},b:{x:t,y:e}};A(n)?(b||(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,x=e,b=r}var h,d,p,m,g,v,y,x,b,_,w,M=s,k=Me(),A=Ae(t,e,r,n),T={point:u,lineStart:function(){T.point=f,d&&d.push(p=[]),_=!0,b=!1,y=x=NaN},lineEnd:function(){h&&(f(m,g),v&&b&&k.rejoin(),h.push(k.buffer())),T.point=u,b&&s.lineEnd()},polygonStart:function(){s=k,h=[],d=[],w=!0},polygonEnd:function(){s=M,h=Zi.merge(h);var e=function(t){for(var e=0,r=d.length,n=t[1],i=0;in&&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=h.length;(r||i)&&(s.polygonStart(),r&&(s.lineStart(),l(null,null,1,s),s.lineEnd()),i&&ye(h,a,e,l,s),s.polygonEnd()),h=d=p=null}};return T}}function Se(t){var e=0,r=ka/3,n=je(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*ka/180,r=t[1]*ka/180):[e/ka*180,r/ka*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){To+=i*t-n*e,n=t,i=e}var e,r,n,i;zo.point=function(a,o){zo.point=t,e=n=a,r=i=o},zo.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 ze(t,e){ho+=t,po+=e,++mo}function De(){function t(t,n){var i=t-e,a=n-r,o=Math.sqrt(i*i+a*a);go+=o*(e+t)/2,vo+=o*(r+n)/2,yo+=o,ze(e=t,r=n)}var e,r;Io.point=function(n,i){Io.point=t,ze(e=n,r=i)}}function Ie(){Io.point=ze}function Pe(){function t(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);go+=o*(n+t)/2,vo+=o*(i+e)/2,yo+=o,xo+=(o=i*t-n*e)*(n+t),bo+=o*(i+e),_o+=3*o,ze(n=t,i=e)}var e,r,n,i;Io.point=function(a,o){Io.point=t,ze(e=n=a,r=i=o)},Io.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(){x=NaN,k.point=o,e.lineStart()}function o(n,i){var o=ne([n,i]),s=t(n,i);r(x,b,y,_,w,M,x=s[0],b=s[1],y=n,_=o[0],w=o[1],M=o[2],a,e),e.point(x,b)}function s(){k.point=n,e.lineEnd()}function l(){i(),k.point=c,k.lineEnd=u}function c(t,e){o(f=t,h=e),d=x,p=b,m=_,g=w,v=M,k.point=o}function u(){r(x,b,y,_,w,M,d,p,f,m,g,v,a,e),k.lineEnd=s,s()}var f,h,d,p,m,g,v,y,x,b,_,w,M,k={point:n,lineStart:i,lineEnd:s,polygonStart:function(){e.polygonStart(),k.lineStart=l},polygonEnd:function(){e.polygonEnd(),k.lineStart=i}};return k}: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,f,h,d,p,m,g,v){var y=u-e,x=f-a,b=y*y+x*x;if(b>4*n&&g--){var _=s+d,w=l+p,M=c+m,k=Math.sqrt(_*_+w*w+M*M),A=Math.asin(M/=k),T=aa(aa(M)-1)n||aa((y*C+x*z)/b-.5)>.3||s*d+l*p+c*m0&&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 Ne(t){return je(function(){return t})()}function je(t){function e(t){return t=o(t[0]*Ea,t[1]*Ea),[t[0]*f+s,l-t[1]*f]}function r(){o=ge(a=qe(g,v,x),i);var t=i(p,m);return s=h-t[0]*f,l=d+t[1]*f,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]*f+s,l-t[1]*f]}),f=150,h=480,d=250,p=0,m=0,g=0,v=0,x=0,b=Mo,_=y,w=null,M=null;return e.stream=function(t){return c&&(c.valid=!1),c=Be(b(a,u(_(t)))),c.valid=!0,c},e.clipAngle=function(t){return arguments.length?(b=null==t?(w=t,Mo):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,f=ae(n,a),h=se(n,c);oe(h,se(a,u));var d=f,p=ie(h,d),m=ie(d,d),g=p*p-m*(ie(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),y=se(d,(-p-v)/m);if(oe(y,h),y=ce(y),!r)return y;var x,b=t[0],_=e[0],w=t[1],M=e[1];_0^y[1]<(aa(y[0]-b)ka^(b<=y[0]&&y[0]<=_)){var T=se(d,(-p+v)/m);return oe(T,h),[y,ce(T)]}}}function n(e,r){var n=a?t:ka-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=aa(i)>wa;return _e(e,function(t){var i,s,l,c,u;return{lineStart:function(){c=l=!1,u=1},point:function(f,h){var d,p=[f,h],m=e(f,h),g=a?m?0:n(f,h):m?n(f+(f<0?ka:-ka),h):0;if(!i&&(c=l=m)&&t.lineStart(),m!==l&&(d=r(i,p),(ue(i,d)||ue(p,d))&&(p[0]+=wa,p[1]+=wa,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*Ea),a?[0,-t]:[-ka,t-ka])}((w=+t)*Ea),n()):w},e.clipExtent=function(t){return arguments.length?(M=t,_=t?Te(t[0][0],t[0][1],t[1][0],t[1][1]):y,n()):M},e.scale=function(t){return arguments.length?(f=+t,r()):f},e.translate=function(t){return arguments.length?(h=+t[0],d=+t[1],r()):[h,d]},e.center=function(t){return arguments.length?(p=t[0]%360*Ea,m=t[1]%360*Ea,r()):[p*La,m*La]},e.rotate=function(t){return arguments.length?(g=t[0]%360*Ea,v=t[1]%360*Ea,x=t.length>2?t[2]%360*Ea:0,r()):[g*La,v*La,x*La]},Zi.rebind(e,u,"precision"),function(){return i=t.apply(this,arguments),e.invert=i.invert&&function(t){return(t=o.invert((t[0]-s)/f,(l-t[1])/f))&&[t[0]*La,t[1]*La]},r()}}function Be(t){return Re(t,function(e,r){t.point(e*Ea,r*Ea)})}function Ue(t,e){return[t,e]}function Ve(t,e){return[t>ka?t-Aa:t<-ka?t+Aa:t,e]}function qe(t,e,r){return t?e||r?ge(Ge(t),Ye(e,r)):Ge(t):e||r?Ye(e,r):Ve}function He(t){return function(e,r){return e+=t,[e>ka?e-Aa:e<-ka?e+Aa:e,r]}}function Ge(t){var e=He(t);return e.invert=He(-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?ia)&&(i+=o*Aa)):(i=t+o*Aa,a=t-.5*l);for(var c,u=i;o>0?u>a:u0?e<-Sa+wa&&(e=-Sa+wa):e>Sa-wa&&(e=Sa-wa);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(ka/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))-Sa]},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 aa(i)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,f=n[1]-c,h=(s*(l-c)-f*(i-a))/(f*o-s*u);return[i+h*o,l+h*u]}function fr(t){var e=t[0],r=t[t.length-1];return!(e[0]-r[0]||e[1]-r[1])}function hr(t){var e=Wo.pop()||new function(){Sr(this),this.edge=this.site=this.circle=null};return e.site=t,e}function dr(t){_r(t),Ho.remove(t),Wo.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&&aa(r-l.circle.x)wa)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))>wa)){n>-wa?(e=s.P,r=s):i>-wa?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=hr(t);if(Ho.insert(e,l),e||r){if(e===r)return _r(e),r=hr(e.site),Ho.insert(l,r),l.edge=r.edge=Mr(e.site,l.site),br(e),void br(r);if(r){_r(e),_r(r);var c=e.site,u=c.x,f=c.y,h=t.x-u,d=t.y-f,p=r.site,m=p.x-u,g=p.y-f,v=2*(h*g-d*m),y=h*h+d*d,x=m*m+g*g,b={x:(g*y-d*x)/v+u,y:(h*x-m*y)/v+f};kr(r.edge,c,p,b),l.edge=Mr(c,t,null,b),r.edge=Mr(t,p,null,b),br(e),br(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,f=1/a-1/c,h=u/c;return f?(-h+Math.sqrt(h*h-2*f*(u*u/(-2*c)-l+c/2+i-a/2)))/f+n:(n+s)/2}function vr(t){this.site=t,this.edges=[]}function yr(t){for(var e,r,n,i,a,o,s,l,c,u,f=t[0][0],h=t[1][0],d=t[0][1],p=t[1][1],m=qo,g=m.length;g--;)if((a=m[g])&&a.prepare())for(l=(s=a.edges).length,o=0;owa||aa(i-r)>wa)&&(s.splice(o,0,new Ar(function(t,e,r){var n=new wr(t,null);return n.a=e,n.b=r,Vo.push(n),n}(a.site,u,aa(n-f)wa?{x:f,y:aa(e-f)wa?{x:aa(r-p)wa?{x:h,y:aa(e-h)wa?{x:aa(r-d)=-Ma)){var h=l*l+c*c,d=u*u+g*g,p=(g*h-c*d)/f,m=(l*d-u*h)/f,g=m+s,v=Xo.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,x=Yo._;x;)if(v.y=s)return;if(h>p){if(a){if(a.y>=c)return}else a={x:g,y:l};r={x:g,y:c}}else{if(a){if(a.y1)if(h>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=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xa&&(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:Nr(r,n)})),a=Ko.lastIndex;return a=0&&!(r=Zi.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;r180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(tn(r)+"rotate(",null,")")-2,x:Nr(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:Nr(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:Nr(t[0],e[0])},{i:i-2,x:Nr(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=0;)r.push(i[n])}function hn(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;++oi&&(n=r,i=e);return n}function Mn(t){return t.reduce(kn,0)}function kn(t,e){return t+e[1]}function An(t,e){return Tn(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Tn(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 Sn(t){return[Zi.min(t),Zi.max(t)]}function En(t,e){return t.value-e.value}function Ln(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Cn(t,e){t._pack_next=e,e._pack_prev=t}function zn(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 Dn(t){function e(t){u=Math.min(t.x-t.r,u),f=Math.max(t.x+t.r,f),h=Math.min(t.y-t.r,h),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,f=-1/0,h=1/0,d=-1/0;if(r.forEach(In),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(Fn(n,i,a=r[2]),e(a),Ln(n,a),n._pack_prev=a,Ln(a,i),i=n._pack_next,o=3;o2?function(t,e,r,n){var i=[],a=[],o=0,s=Math.min(t.length,e.length)-1;for(t[s]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=Yn(n.map(i),r?Math:fs);return t.domain(e),n=e.map(a),o},o.ticks=function(){var t=Hn(n),o=[],s=t[0],l=t[1],c=Math.floor(i(s)),u=Math.ceil(i(l)),f=e%1?2:e;if(isFinite(u-c)){if(r){for(;c0;h--)o.push(a(c)*h);for(c=0;o[c]l;u--);o=o.slice(c,u)}return o},o.tickFormat=function(t,r){if(!arguments.length)return us;arguments.length<2?r=us:"function"!=typeof r&&(r=Zi.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*e0?s[r-1]:t[0],r0?0:1}function gi(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,c=-s*a,u=t[0]+l,f=t[1]+c,h=e[0]+l,d=e[1]+c,p=(u+h)/2,m=(f+d)/2,g=h-u,v=d-f,y=g*g+v*v,x=r-n,b=u*d-h*f,_=(v<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*v-g*_)/y,M=(-b*g-v*_)/y,k=(b*v+g*_)/y,A=(-b*g+v*_)/y,T=w-p,S=M-m,E=k-p,L=A-m;return T*T+S*S>E*E+L*L&&(w=k,M=A),[[w-l,M-c],[w*r/x,M*r/x]]}function vi(t){function e(e){function o(){c.push("M",a(t(u),s))}for(var l,c=[],u=[],f=-1,h=e.length,d=_t(r),p=_t(n);++f1?t.join("L"):t+"Z"}function xi(t){return t.join("L")+"Z"}function bi(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var c=2;c9&&(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 Li(t){for(var e,r,n,i=-1,a=t.length;++i0;)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,f,h,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 Vi(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate("+(isFinite(n)?n:r(t))+",0)"})}function qi(t,e,r){t.attr("transform",function(t){var n=e(t);return"translate(0,"+(isFinite(n)?n:r(t))+")"})}function Hi(t){return t.toISOString()}function Gi(t,e,r){function n(e){return t(e)}function i(t,r){var n=(t[1]-t[0])/r,i=Zi.bisect(Fs,n);return i==Fs.length?[e.year,Kn(t.map(function(t){return t/31536e6}),r)[2]]:i?e[n/Fs[i-1]1?{floor:function(e){for(;r(e=t.floor(e));)e=Yi(e-1);return e},ceil:function(e){for(;r(e=t.ceil(e));)e=Yi(+e+1);return e}}:t))},n.ticks=function(t,e){var r=Hn(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],Yi(+r[1]+1),e<1?1:e)},n.tickFormat=function(){return r},n.copy=function(){return Gi(t.copy(),e,r)},Zn(n,t)}function Yi(t){return new Date(t)}function Wi(t){return JSON.parse(t.responseText)}function Xi(t){var e=Qi.createRange();return e.selectNode(Qi.body),e.createContextualFragment(t.responseText)}var Zi={version:"3.5.17"},Ji=[].slice,Ki=function(t){return Ji.call(t)},Qi=this.document;if(Qi)try{Ki(Qi.documentElement.childNodes)[0].nodeType}catch(t){Ki=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}),Qi)try{Qi.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var $i=this.Element.prototype,ta=$i.setAttribute,ea=$i.setAttributeNS,ra=this.CSSStyleDeclaration.prototype,na=ra.setProperty;$i.setAttribute=function(t,e){ta.call(this,t,e+"")},$i.setAttributeNS=function(t,e,r){ea.call(this,t,e,r+"")},ra.setProperty=function(t,e,r){na.call(this,t,e+"",r)}}Zi.ascending=n,Zi.descending=function(t,e){return et?1:e>=t?0:NaN},Zi.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},Zi.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},Zi.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return l/(u-1)},Zi.deviation=function(){var t=Zi.variance.apply(this,arguments);return t?Math.sqrt(t):t};var ia=o(n);Zi.bisectLeft=ia.left,Zi.bisect=Zi.bisectRight=ia.right,Zi.bisector=function(t){return o(1===t.length?function(e,r){return n(t(e),r)}:t)},Zi.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},Zi.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},Zi.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var aa=Math.abs;Zi.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}(aa(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)=a.length)return n?n.call(i,o):r?o.sort(r):o;for(var l,u,f,h,d=-1,p=o.length,m=a[s++],g=new c;++d=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(Zi.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},Zi.set=function(t){var e=new v;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},Zi.event=null,Zi.requote=function(t){return t.replace(ca,"\\$&")};var ca=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,ua={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]},fa=function(t,e){return e.querySelector(t)},ha=function(t,e){return e.querySelectorAll(t)},da=function(t,e){var r=t.matches||t[x(t,"matchesSelector")];return(da=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(fa=function(t,e){return Sizzle(t,e)[0]||null},ha=Sizzle,da=Sizzle.matchesSelector),Zi.selection=function(){return Zi.select(Qi.documentElement)};var pa=Zi.selection.prototype=[];pa.select=function(t){var e,r,n,i,a=[];t=S(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),ga.hasOwnProperty(r)?{space:ga[r],local:t}:t}},pa.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node();return(t=Zi.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))},pa.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=D(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},pa.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=e&&(e=i+1);!(o=s[e])&&++e0&&(e=e.transition().duration(E)),e.call(t.event)}function o(){b&&b.domain(x.range().map(function(t){return(t-k.x)/k.k}).map(x.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=P.of(t,arguments),a=0,o=Zi.select(r(t)).on(z,function(){a=1,i(Zi.mouse(t),u),l(n)}).on(D,function(){o.on(z,null).on(D,null),f(a),c(n)}),u=e(Zi.mouse(t)),f=Y(t);Ts.call(t),s(n)}function f(){function t(){var t=Zi.touches(p);return d=k.k,t.forEach(function(t){t.identifier in g&&(g[t.identifier]=e(t))}),t}function r(){var e=Zi.event.target;Zi.select(e).on(b,o).on(_,h),w.push(e);for(var r=Zi.event.changedTouches,n=0,i=r.length;n1){c=s[0];var u=s[1],f=c[0]-u[0],d=c[1]-u[1];v=f*f+d*d}}function o(){var t,e,r,a,o=Zi.touches(p);Ts.call(p);for(var s=0,c=o.length;s=c)return o;if(i)return i=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++8?function(t){return t/r}:function(t){return t*r},symbol:t}});Zi.formatPrefix=function(t,e){var r=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=Zi.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)))),Xa[8+r/3]};var Za=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,Ja=Zi.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=Zi.round(t,Et(t,e))).toFixed(Math.max(0,Math.min(20,Et(t*(1+1e-15),e))))}}),Ka=Zi.time={},Qa=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(){$a.setUTCDate.apply(this._,arguments)},setDay:function(){$a.setUTCDay.apply(this._,arguments)},setFullYear:function(){$a.setUTCFullYear.apply(this._,arguments)},setHours:function(){$a.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){$a.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){$a.setUTCMinutes.apply(this._,arguments)},setMonth:function(){$a.setUTCMonth.apply(this._,arguments)},setSeconds:function(){$a.setUTCSeconds.apply(this._,arguments)},setTime:function(){$a.setTime.apply(this._,arguments)}};var $a=Date.prototype;Ka.year=Ct(function(t){return(t=Ka.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),Ka.years=Ka.year.range,Ka.years.utc=Ka.year.utc.range,Ka.day=Ct(function(t){var e=new Qa(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}),Ka.days=Ka.day.range,Ka.days.utc=Ka.day.utc.range,Ka.dayOfYear=function(t){var e=Ka.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=Ka[t]=Ct(function(t){return(t=Ka.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=Ka.year(t).getDay();return Math.floor((Ka.dayOfYear(t)+(r+e)%7)/7)-(r!==e)});Ka[t+"s"]=r.range,Ka[t+"s"].utc=r.utc.range,Ka[t+"OfYear"]=function(t){var r=Ka.year(t).getDay();return Math.floor((Ka.dayOfYear(t)+(r+e)%7)/7)}}),Ka.week=Ka.sunday,Ka.weeks=Ka.sunday.range,Ka.weeks.utc=Ka.sunday.utc.range,Ka.weekOfYear=Ka.sundayOfYear;var to={"-":"",_:" ",0:"0"},eo=/^\s*\d+/,ro=/^%/;Zi.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=Za.exec(t),n=r[1]||" ",o=r[2]||">",s=r[3]||"-",l=r[4]||"",c=r[5],u=+r[6],f=r[7],h=r[8],d=r[9],p=1,m="",g="",v=!1,y=!0;switch(h&&(h=+h.substring(1)),(c||"0"===n&&"="===o)&&(c=n="0",o="="),d){case"n":f=!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,h=0;break;case"s":p=-1,d="r"}"$"===l&&(m=i[0],g=i[1]),"r"!=d||h||(d="g"),null!=h&&("g"==d?h=Math.max(1,Math.min(21,h)):"e"!=d&&"f"!=d||(h=Math.max(0,Math.min(20,h)))),d=Ja.get(d)||function(t){return t+""};var x=c&&f;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=Zi.formatPrefix(t,h);t=l.scale(t),r=l.symbol+g}else t*=p;var b,_,w=(t=d(t,h)).lastIndexOf(".");if(w<0){var M=y?t.lastIndexOf("e"):-1;M<0?(b=t,_=""):(b=t.substring(0,M),_=t.substring(M))}else b=t.substring(0,w),_=e+t.substring(w+1);!c&&f&&(b=a(b,1/0));var k=m.length+b.length+_.length+(x?0:i.length),A=k"===o?A+i+t:"^"===o?A.substring(0,k>>=1)+i+t+A.substring(k):i+(x?t:A+t))+r}}}(t),timeFormat:function(t){function e(t){function e(e){for(var r,i,a,o=[],s=-1,l=0;++s=c)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=_[o in to?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(Qa=Lt);return e._=t,n(e)}finally{Qa=Date}}var n=e(t);return r.parse=function(t){try{Qa=Lt;var e=n.parse(t);return e&&e._}finally{Qa=Date}},r.toString=n.toString,r}).multi=Jt;var f=Zi.map(),h=It(s),d=Pt(s),p=It(l),m=Pt(l),g=It(c),v=Pt(c),y=It(u),x=Pt(u);o.forEach(function(t,e){f.set(t.toLowerCase(),e)});var b={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 Dt(t.getDate(),e,2)},e:function(t,e){return Dt(t.getDate(),e,2)},H:function(t,e){return Dt(t.getHours(),e,2)},I:function(t,e){return Dt(t.getHours()%12||12,e,2)},j:function(t,e){return Dt(1+Ka.dayOfYear(t),e,3)},L:function(t,e){return Dt(t.getMilliseconds(),e,3)},m:function(t,e){return Dt(t.getMonth()+1,e,2)},M:function(t,e){return Dt(t.getMinutes(),e,2)},p:function(t){return o[+(t.getHours()>=12)]},S:function(t,e){return Dt(t.getSeconds(),e,2)},U:function(t,e){return Dt(Ka.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Dt(Ka.mondayOfYear(t),e,2)},x:e(i),X:e(a),y:function(t,e){return Dt(t.getFullYear()%100,e,2)},Y:function(t,e){return Dt(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){h.lastIndex=0;var n=h.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=x.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.m=v.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,n){return r(t,b.c.toString(),e,n)},d:Vt,e:Vt,H:Ht,I:Ht,j:qt,L:Wt,m:Ut,M:Gt,p:function(t,e,r){var n=f.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,b.x.toString(),e,n)},X:function(t,e,n){return r(t,b.X.toString(),e,n)},y:jt,Y:Nt,Z:Bt,"%":Zt};return e}(t)}};var no=Zi.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"]});Zi.format=no.numberFormat,Zi.geo={},Kt.prototype={s:0,t:0,add:function(t){Qt(t,this.t,io),Qt(io.s,this.s,this),this.s?this.t+=io.t:this.s=io.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var io=new Kt;Zi.geo.stream=function(t,e){t&&ao.hasOwnProperty(t.type)?ao[t.type](t,e):$t(t,e)};var ao={Feature:function(t,e){$t(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++nd&&(d=e)}function e(e,r){var n=ne([e*Ea,r*Ea]);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]*La*l,m=aa(o)>180;if(m^(l*pd&&(d=g)}else if(c=(c+360)%360-180,m^(l*pd&&(d=r);m?es(u,h)&&(h=e):s(e,h)>s(u,h)&&(u=e):h>=u?(eh&&(h=e)):e>p?s(u,e)>s(u,h)&&(h=e):s(e,h)>s(u,h)&&(u=e)}else t(e,r);v=n,p=e}function r(){_.point=e}function n(){b[0]=u,b[1]=h,_.point=t,v=null}function i(t,r){if(v){var n=t-p;y+=aa(n)>180?n+(n>0?360:-360):n}else m=t,g=r;co.point(t,r),e(t,r)}function a(){co.lineStart()}function o(){i(m,g),co.lineEnd(),aa(y)>wa&&(u=-(h=180)),b[0]=u,b[1]=h,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]:twa?d=90:y<-wa&&(f=-90),b[0]=u,b[1]=h}};return function(t){d=h=-(u=f=1/0),x=[],Zi.geo.stream(t,_);if(i=x.length){x.sort(l);for(var e=1,r=[p=x[0]];es(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],h=p[1])}return x=b=null,u===1/0||f===1/0?[[NaN,NaN],[NaN,NaN]]:[[u,f],[h,d]]}}(),Zi.geo.centroid=function(t){uo=fo=ho=po=mo=go=vo=yo=xo=bo=_o=0,Zi.geo.stream(t,wo);var e=xo,r=bo,n=_o,i=e*e+r*r+n*n;return i0?ka:-ka,l=aa(a-r);aa(l-ka)0?Sa:-Sa),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=ka&&(aa(r-i)wa?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*Sa,n.point(-ka,i),n.point(0,i),n.point(ka,i),n.point(ka,0),n.point(ka,-i),n.point(0,-i),n.point(-ka,-i),n.point(-ka,0),n.point(-ka,i);else if(aa(t[0]-e[0])>wa){var a=t[0]=.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],f=+e[1];return r=a.translate(e).clipExtent([[u-.455*c,f-.238*c],[u+.455*c,f+.238*c]]).stream(l).point,n=o.translate([u-.307*c,f+.201*c]).clipExtent([[u-.425*c+wa,f+.12*c+wa],[u-.214*c-wa,f+.234*c-wa]]).stream(l).point,i=s.translate([u-.205*c,f+.212*c]).clipExtent([[u-.214*c+wa,f+.166*c+wa],[u-.115*c-wa,f+.234*c-wa]]).stream(l).point,t},t.scale(1070)};var Ao,To,So,Eo,Lo,Co,zo={point:b,lineStart:b,lineEnd:b,polygonStart:function(){To=0,zo.lineStart=Le},polygonEnd:function(){zo.lineStart=zo.lineEnd=zo.point=b,Ao+=aa(To/2)}},Do={point:function(t,e){tLo&&(Lo=t),eCo&&(Co=e)},lineStart:b,lineEnd:b,polygonStart:b,polygonEnd:b},Io={point:ze,lineStart:De,lineEnd:Ie,polygonStart:function(){Io.lineStart=Pe},polygonEnd:function(){Io.point=ze,Io.lineStart=De,Io.lineEnd=Ie}};Zi.geo.path=function(){function t(t){return t&&("function"==typeof s&&a.pointRadius(+s.apply(this,arguments)),o&&o.valid||(o=i(a)),Zi.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 Ao=0,Zi.geo.stream(t,i(zo)),Ao},t.centroid=function(t){return ho=po=mo=go=vo=yo=xo=bo=_o=0,Zi.geo.stream(t,i(Io)),_o?[xo/_o,bo/_o]:yo?[go/yo,vo/yo]:mo?[ho/mo,po/mo]:[NaN,NaN]},t.bounds=function(t){return Lo=Co=-(So=Eo=1/0),Zi.geo.stream(t,i(Do)),[[So,Eo],[Lo,Co]]},t.projection=function(t){return arguments.length?(i=(r=t)?t.stream||function(t){var e=Oe(function(e,r){return t([e*La,r*La])});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,Aa)}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:b};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(Zi.geo.albersUsa()).context(null)},Zi.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()}},Zi.geo.projection=Ne,Zi.geo.projectionMutator=je,(Zi.geo.equirectangular=function(){return Ne(Ue)}).raw=Ue.invert=Ue,Zi.geo.rotation=function(t){function e(e){return e=t(e[0]*Ea,e[1]*Ea),e[0]*=La,e[1]*=La,e}return t=qe(t[0]%360*Ea,t[1]*Ea,t.length>2?t[2]*Ea:0),e.invert=function(e){return e=t.invert(e[0]*Ea,e[1]*Ea),e[0]*=La,e[1]*=La,e},e},Ve.invert=Ue,Zi.geo.circle=function(){function t(){var t="function"==typeof n?n.apply(this,arguments):n,e=qe(-t[0]*Ea,-t[1]*Ea,0).invert,i=[];return r(null,null,1,{point:function(t,r){i.push(t=e(t,r)),t[0]*=La,t[1]*=La}}),{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)*Ea,i*Ea),t):e},t.precision=function(n){return arguments.length?(r=We(e*Ea,(i=+n)*Ea),t):i},t.angle(90)},Zi.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ea,i=t[1]*Ea,a=e[1]*Ea,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),c=Math.cos(i),u=Math.sin(a),f=Math.cos(a);return Math.atan2(Math.sqrt((r=f*o)*r+(r=c*u-l*f*s)*r),l*u+c*f*s)},Zi.geo.graticule=function(){function t(){return{type:"MultiLineString",coordinates:e()}}function e(){return Zi.range(Math.ceil(a/g)*g,i,g).map(h).concat(Zi.range(Math.ceil(c/v)*v,l,v).map(d)).concat(Zi.range(Math.ceil(n/p)*p,r,p).filter(function(t){return aa(t%g)>wa}).map(u)).concat(Zi.range(Math.ceil(s/m)*m,o,m).filter(function(t){return aa(t%v)>wa}).map(f))}var r,n,i,a,o,s,l,c,u,f,h,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:[h(a).concat(d(l).slice(1),h(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),f=Je(n,r,y),h=Ze(c,l,90),d=Je(a,i,y),t):y},t.majorExtent([[-180,-90+wa],[180,90-wa]]).minorExtent([[-180,-80-wa],[180,80+wa]])},Zi.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 Zi.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},Zi.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),f=o*Math.sin(r),h=2*Math.asin(Math.sqrt(tt(n-e)+i*o*tt(r-t))),d=1/Math.sin(h),p=h?function(t){var e=Math.sin(t*=h)*d,r=Math.sin(h-t)*d,n=r*l+e*u,i=r*c+e*f,o=r*a+e*s;return[Math.atan2(i,n)*La,Math.atan2(o,Math.sqrt(n*n+i*i))*La]}:function(){return[t*La,e*La]};return p.distance=h,p}(t[0]*Ea,t[1]*Ea,e[0]*Ea,e[1]*Ea)},Zi.geo.length=function(t){return Po=0,Zi.geo.stream(t,Oo),Po};var Po,Oo={sphere:b,point:b,lineStart:function(){function t(t,i){var a=Math.sin(i*=Ea),o=Math.cos(i),s=aa((t*=Ea)-e),l=Math.cos(s);Po+=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;Oo.point=function(i,a){e=i*Ea,r=Math.sin(a*=Ea),n=Math.cos(a),Oo.point=t},Oo.lineEnd=function(){Oo.point=Oo.lineEnd=b}},lineEnd:b,polygonStart:b,polygonEnd:b},Fo=$e(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(Zi.geo.azimuthalEqualArea=function(){return Ne(Fo)}).raw=Fo;var Ro=$e(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},y);(Zi.geo.azimuthalEquidistant=function(){return Ne(Ro)}).raw=Ro,(Zi.geo.conicConformal=function(){return Se(tr)}).raw=tr,(Zi.geo.conicEquidistant=function(){return Se(er)}).raw=er;var No=$e(function(t){return 1/t},Math.atan);(Zi.geo.gnomonic=function(){return Ne(No)}).raw=No,rr.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Sa]},(Zi.geo.mercator=function(){return nr(rr)}).raw=rr;var jo=$e(function(){return 1},Math.asin);(Zi.geo.orthographic=function(){return Ne(jo)}).raw=jo;var Bo=$e(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});(Zi.geo.stereographic=function(){return Ne(Bo)}).raw=Bo,ir.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Sa]},(Zi.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,Zi.geom={},Zi.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=0;--e)d.push(t[s[c[e]][2]]);for(e=+f;e=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)/wa)*wa,y:Math.round(o(t,e)/wa)*wa,i:e}})}var n=ar,i=or,a=n,o=i,s=Zo;return t?e(t):(e.links=function(t){return zr(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 zr(r(t)).cells.forEach(function(r,n){for(var i,a=r.site,o=r.edges.sort(xr),s=-1,l=o.length,c=o[l-1].edge,u=c.l===a?c.r:c.l;++s=c,h=n>=u,d=h<<1|f;t.leaf=!1,t=t.nodes[d]||(t.nodes[d]={leaf:!0,nodes:[],point:null,x:null,y:null}),f?i=c:s=c,h?o=u:l=u,a(t,e,r,n,i,o,s,l)}var u,f,h,d,p,m,g,v,y,x=_t(s),b=_t(l);if(null!=e)m=e,g=r,v=n,y=i;else if(v=y=-(m=g=1/0),f=[],h=[],p=t.length,o)for(d=0;dv&&(v=u.x),u.y>y&&(y=u.y),f.push(u.x),h.push(u.y);else for(d=0;dv&&(v=_),w>y&&(y=w),f.push(_),h.push(w)}var M=v-m,k=y-g;M>k?y=g+M:v=m+k;var A={leaf:!0,nodes:[],point:null,x:null,y:null};if(A.add=function(t){a(A,t,+x(t,++d),+b(t,d),m,g,v,y)},A.visit=function(t){Or(t,A,m,g,v,y)},A.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(c,u,f,h,d){if(!(u>a||f>o||h=_)<<1|e>=b,M=w+4;w=0?t.slice(0,e):t,n=e>=0?t.slice(e+1):"in";return r=$o.get(r)||Qo,n=ts.get(n)||y,function(t){return function(e){return e<=0?0:e>=1?1:t(e)}}(n(r.apply(null,Ji.call(arguments,1))))},Zi.interpolateHcl=function(t,e){t=Zi.hcl(t),e=Zi.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)+""}},Zi.interpolateHsl=function(t,e){t=Zi.hsl(t),e=Zi.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)+""}},Zi.interpolateLab=function(t,e){t=Zi.lab(t),e=Zi.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)+""}},Zi.interpolateRound=Jr,Zi.transform=function(t){var e=Qi.createElementNS(Zi.ns.prefix.svg,"g");return(Zi.transform=function(t){if(null!=t){e.setAttribute("transform",t);var r=e.transform.baseVal.consolidate()}return new Kr(r?r.matrix:es)})(t)},Kr.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var es={a:1,b:0,c:0,d:1,e:0,f:0};Zi.interpolateTransform=en,Zi.layout={},Zi.layout.bundle=function(){return function(t){for(var e=[],r=-1,n=t.length;++r0?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=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 hn(i,function(t){var r,i;e&&(r=t.children)&&r.sort(e),n&&(i=t.parent)&&(i.value+=t.value)}),s}var e=mn,r=dn,n=pn;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&&(fn(e,function(t){t.children&&(t.value=0)}),hn(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},Zi.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;++cs&&(s=n),o.push(n)}for(r=0;r0)for(a=-1;++a=u[0]&&s<=u[1]&&((o=l[Zi.bisect(f,s,1,d)-1]).y+=p,o.push(t[a]));return l}var e=!0,r=Number,n=Sn,i=An;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 Tn(t,e)}:_t(e),t):i},t.frequency=function(r){return arguments.length?(e=!!r,t):e},t},Zi.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,hn(s,function(t){t.r=+u(t.value)}),hn(s,Dn),n){var f=n*(e?1:Math.max(2*s.r/l,2*s.r/c))/2;hn(s,function(t){t.r+=f}),hn(s,Dn),hn(s,function(t){t.r-=f})}return On(s,l/2,c/2,e?1:1/Math.max(2*s.r/l,2*s.r/c)),o}var e,r=Zi.layout.hierarchy().sort(En),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},un(t,r)},Zi.layout.tree=function(){function t(t,l){var c=i.call(this,t,l),u=c[0],f=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;od.x&&(d=t),t.depth>p.depth&&(p=t)});var m=a(h,d)/2-h.x,g=o[0]/(d.x+a(d,h)/2+m),v=o[1]/(p.depth||1);fn(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,f=s.m,h=l.m;s=jn(s),i=Nn(i),s&&i;)l=Nn(l),(o=jn(o)).a=t,(n=s.z+f-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),f+=s.m,c+=i.m,h+=l.m,u+=o.m;s&&!jn(o)&&(o.t=s,o.m+=f-u),i&&!Nn(l)&&(l.t=i,l.m+=c-h,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=Zi.layout.hierarchy().sort(null).value(null),a=Rn,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},un(t,i)},Zi.layout.cluster=function(){function t(t,a){var o,s=e.call(this,t,a),l=s[0],c=0;hn(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+Zi.max(t,function(t){return t.y})}(e)):(t.x=o?c+=r(t,o):0,t.y=0,o=t)});var u=Bn(l),f=Un(l),h=u.x-r(u,f)/2,d=f.x+r(f,u)/2;return hn(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-h)/(d-h)*n[0],t.y=(1-(l.y?t.y/l.y:1))*n[1]}),s}var e=Zi.layout.hierarchy().sort(null).value(null),r=Rn,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},un(t,e)},Zi.layout.treemap=function(){function t(t,e){for(var r,n,i=-1,a=t.length;++i0;)c.push(a=f[s-1]),c.area+=a.area,"squarify"!==h||(o=function(t,e){var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;for(;++oi&&(i=r));return n*=n,e*=e,n?Math.max(e*i*d/n,n/(e*a*d)):1/0}(c,m))<=p?(f.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);++ar.dx)&&(u=r.dx);++a1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var t=Zi.random.normal.apply(Zi,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=Zi.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,r=0;rf?0:1;if(c=Ta)return e(c,d)+(t?e(t,1-d):"")+"Z";var p,m,g,v,y,x,b,_,w,M,k,A,T=0,S=0,E=[];if((v=(+l.apply(this,arguments)||0)/2)&&(g=a===gs?Math.sqrt(t*t+c*c):+a.apply(this,arguments),d||(S*=-1),c&&(S=Q(g/c*Math.sin(v))),t&&(T=Q(g/t*Math.sin(v)))),c){y=c*Math.cos(u+S),x=c*Math.sin(u+S),b=c*Math.cos(f-S),_=c*Math.sin(f-S);var L=Math.abs(f-u-2*S)<=ka?0:1;if(S&&mi(y,x,b,_)===d^L){var C=(u+f)/2;y=c*Math.cos(C),x=c*Math.sin(C),b=_=null}}else y=x=0;if(t){w=t*Math.cos(f-T),M=t*Math.sin(f-T),k=t*Math.cos(u+T),A=t*Math.sin(u+T);var z=Math.abs(u-f+2*T)<=ka?0:1;if(T&&mi(w,M,k,A)===1-d^z){var D=(u+f)/2;w=t*Math.cos(D),M=t*Math.sin(D),k=A=null}}else w=M=0;if(h>wa&&(p=Math.min(Math.abs(c-t)/2,+i.apply(this,arguments)))>.001){m=t1&&i.push("H",n[0]),i.join("")},"step-before":bi,"step-after":_i,basis:ki,"basis-open":function(t){if(t.length<4)return yi(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(Ai(bs,a)+","+Ai(bs,o)),--n;++nka)+",1 "+e}function n(t,e,r,n){return"Q 0,0 "+n}var i=Ke,a=Qe,o=zi,s=hi,l=di;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},Zi.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=Di;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},Zi.svg.diagonal.radial=function(){var t=Zi.svg.diagonal(),e=Di,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]-Sa;return[r*Math.cos(n),r*Math.sin(n)]}}(e=t)):e},t},Zi.svg.symbol=function(){function t(t,n){return(_s.get(e.call(this,t,n))||Oi)(r.call(this,t,n))}var e=Pi,r=Ii;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 _s=Zi.map({circle:Oi,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*Ms)),r=e*Ms;return"M0,"+-e+"L"+r+",0 0,"+e+" "+-r+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/ws),r=e*ws/2;return"M0,"+r+"L"+e+","+-r+" "+-e+","+-r+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/ws),r=e*ws/2;return"M0,"+-r+"L"+e+","+r+" "+-e+","+r+"Z"}});Zi.svg.symbolTypes=_s.keys();var ws=Math.sqrt(3),Ms=Math.tan(30*Ea);pa.transition=function(t){for(var e,r,n=ks||++Es,i=Bi(t),a=[],o=As||{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;++srect,.s>rect").attr("width",f[1]-f[0])}function i(t){t.select(".extent").attr("y",h[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",h[1]-h[0])}function a(){function a(){var t=Zi.mouse(x),r=!1;y&&(t[0]+=y[0],t[1]+=y[1]),S||(Zi.event.altKey?(v||(v=[(f[0]+f[1])/2,(h[0]+h[1])/2]),L[0]=f[+(t[0]=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)h=(b=_[u])[0],b[0]=b[1],b[1]=h;return _}},{"incremental-convex-hull":278,uniq:556}],131:[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 f=new t(8);e.exports=function(t){return f.writeDoubleLE(t,0,!0),[f.readUInt32LE(0,!0),f.readUInt32LE(4,!0)]};function h(t,e){return f.writeUInt32LE(t,0,!0),f.writeUInt32LE(e,4,!0),f.readDoubleLE(0,!0)}e.exports.pack=h;function d(t){return f.writeDoubleLE(t,0,!0),f.readUInt32LE(0,!0)}e.exports.lo=d;function p(t){return f.writeDoubleLE(t,0,!0),f.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:82}],132:[function(t,e,r){var n=t("abs-svg-path"),i=t("normalize-svg-path"),a={M:"moveTo",C:"bezierCurveTo"};e.exports=function(t,e){t.beginPath(),i(n(e)).forEach(function(e){var r=e[0],n=e.slice(1);t[a[r]].apply(t,n)}),t.closePath()}},{"abs-svg-path":43,"normalize-svg-path":460}],133:[function(t,e,r){e.exports=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}}},{}],134:[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;a0)return function(t,e){var r,n;for(r=new Array(t),n=0;n=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.x&&n.x>=f&&c(ar.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){h=g=t[0],m=v=t[1];for(var _=r;_g&&(g=y),x>v&&(v=x);b=Math.max(g-h,v-m)}return o(u,f,r,h,m,b),f}function i(t,e,r,n,i){var a,o;if(i===y(t,e,r,n)>0)for(a=e;a=e;a-=n)o=m(a,t[a],t[a+1],o);return o&&f(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||!f(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;e0||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,x=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.xa.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,f,e,r,n),m=l(h,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,x=y.next;else if((t=y)===x){m?1===m?o(t=function(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!f(i,a)&&h(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&&h(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 f(t,e){return t.x===e.x&&t.y===e.y}function h(t,e,r,n){return!!(f(t,e)&&f(r,n)||f(t,n)&&f(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;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],136:[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;i0&&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)}},{}],139:[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]]]}},{}],140:[function(t,e,r){"use strict";e.exports=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&function(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}(r))return!1}else if("number"!==e)return!1;return t-t<1}},{}],141:[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?f.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 f.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 te?1:0}e.exports=function(t){return new Function("f","var p = (f && f.properties || {}); return "+n(t))};var f=["Unknown","Point","LineString","Polygon"]},{}],142:[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=r-1){h=l.length-1;var p=t-e[r-1];for(d=0;d=r-1)for(var u=a.length-1,f=(e[r-1],0);f=0;--r)if(t[--e])return!1;return!0},l.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--f)i.push(n(l[f-1],c[f-1],arguments[f])),a.push(0)}},l.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/s:0;this._time.push(t);for(var h=r;h>0;--h){var d=n(c[h-1],u[h-1],arguments[h]);i.push(d),a.push((d-i[o++])*f)}}},l.set=function(t){var e=this.dimension;if(!(t0;--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,f=u>1e-6?1/u:0;this._time.push(t);for(var h=r;h>0;--h){var d=arguments[h];i.push(n(l[h-1],c[h-1],i[o++]+d)),a.push(d*f)}}},l.idle=function(t){var e=this.lastT();if(!(t=0;--f)i.push(n(l[f],c[f],i[o]+u*a[o])),a.push(0),o+=1}}},{"binary-search-bounds":70,"cubic-hermite":115}],143:[function(t,e,r){var n=t("dtype");e.exports=function(t,e,r){if(!t)throw new TypeError("must specify data as first parameter");if(r=0|+(r||0),Array.isArray(t)&&Array.isArray(t[0])){var i=t[0].length,a=t.length*i;e&&"string"!=typeof e||(e=new(n(e||"float32"))(a+r));var o=e.length-r;if(a!==o)throw new Error("source length "+a+" ("+i+"x"+t.length+") does not match destination length "+o);for(var s=0,l=r;s0&&(a=n(i.key,i.value)))return a}if(s>0&&i.right)return u(t,e,r,n,i.right)}function f(t,e){this.tree=t,this._stack=e}function h(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 te?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 f=l.length-2;f>=0;--f){i=l[f];c[f]<=0?l[f]=new n(i._color,i.key,i.value,l[f+1],i.right,i._count+1):l[f]=new n(i._color,i.key,i.value,i.left,l[f+1],i._count+1)}for(f=l.length-1;f>1;--f){var h=l[f-1];i=l[f];if(h._color===p||i._color===p)break;var m=l[f-2];if(m.left===h)if(h.left===i){if(!(g=m.right)||g._color!==d){if(m._color=d,m.left=h.right,h._color=p,h.right=m,l[f-2]=h,l[f-1]=i,o(m),o(h),f>=3){(v=l[f-3]).left===m?v.left=h:v.right=h}break}h._color=p,m.right=a(p,g),m._color=d,f-=1}else{if(!(g=m.right)||g._color!==d){if(h.right=i.left,m._color=d,m.left=i.right,i._color=p,i.left=h,i.right=m,l[f-2]=i,l[f-1]=h,o(m),o(h),o(i),f>=3){(v=l[f-3]).left===m?v.left=i:v.right=i}break}h._color=p,m.right=a(p,g),m._color=d,f-=1}else if(h.right===i){if(!(g=m.left)||g._color!==d){if(m._color=d,m.right=h.left,h._color=p,h.left=m,l[f-2]=h,l[f-1]=i,o(m),o(h),f>=3){(v=l[f-3]).right===m?v.right=h:v.left=h}break}h._color=p,m.left=a(p,g),m._color=d,f-=1}else{var g;if(!(g=m.left)||g._color!==d){if(h.left=i.right,m._color=d,m.right=i.left,i._color=p,i.right=h,i.left=m,l[f-2]=i,l[f-1]=h,o(m),o(h),o(i),f>=3){var v;(v=l[f-3]).right===m?v.right=i:v.left=i}break}h._color=p,m.left=a(p,g),m._color=d,f-=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 f(this,t)}}),Object.defineProperty(m,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new f(this,t)}}),m.at=function(t){if(t<0)return new f(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new f(this,[])},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 f(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 f(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 f(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 f(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 f(this,n);r=i<=0?r.left:r.right}return new f(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=f.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 f(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 f=e[e.length-2];f.left===r?f.left=null:f.right===r&&(f.right=null),e.pop();for(l=0;l=0;--l){if(e=t[l],0===l)return void(e._color=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+11&&((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+10)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}})},{}],145:[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},{}],146:[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;r2){for(var r,n,i=0;i=0}(t)===e?t:t.reverse()}var s=t("geojson-area");e.exports=n},{"geojson-area":146}],148:[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&&d<=a)u.push(p);else if(!(h>a||d=e&&s<=r&&i.push(o)}return i}(m,r,a,o):function(t,e,r,i,a,o){for(var s=[],l=0;lr?(b.push(a(c,p,e),a(c,p,r)),o||(b=n(s,b,g,v,y))):d>=e&&b.push(a(c,p,e)):h>r?dr&&(b.push(a(c,p,r)),o||(b=n(s,b,g,v,y))));c=m[x-1],(h=c[i])>=e&&h<=r&&b.push(c),f=b[b.length-1],o&&f&&(b[0][0]!==f[0]||b[0][1]!==f[1])&&b.push(b[0]),n(s,b,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":150}],149:[function(t,e,r){"use strict";function n(t,e,r){if(null!==e.geometry){var o,l,c,u,f=e.geometry,h=f.type,d=f.coordinates,p=e.properties,m=e.id;if("Point"===h)t.push(s(p,1,[a(d)],m));else if("MultiPoint"===h)t.push(s(p,1,i(d),m));else if("LineString"===h)t.push(s(p,2,[i(d,r)],m));else if("MultiLineString"===h||"Polygon"===h){for(c=[],o=0;o1?1:n,[r,n,0]}e.exports=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i1)return!1;var a=i.geometry[0].length;if(5!==a)return!1;for(var o=0;o1&&console.time("creation"),x=this.tiles[y]=h(t,v,r,n,b,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,x.numFeatures,x.numPoints,x.numSimplified),console.timeEnd("creation"));var _="z"+e;this.stats[_]=(this.stats[_]||0)+1,this.total++}if(x.source=t,l){if(e===p.maxZoom||e===l)continue;var w=1<1&&console.time("clipping");var M,k,A,T,S,E,L=.5*p.buffer/p.extent,C=.5-L,z=.5+L,D=1+L;M=k=A=T=null,S=u(t,v,r-L,r+z,0,a,x.min[0],x.max[0]),E=u(t,v,r+C,r+D,0,a,x.min[0],x.max[0]),S&&(M=u(S,v,n-L,n+z,1,o,x.min[1],x.max[1]),k=u(S,v,n+C,n+D,1,o,x.min[1],x.max[1])),E&&(A=u(E,v,n-L,n+z,1,o,x.min[1],x.max[1]),T=u(E,v,n+C,n+D,1,o,x.min[1],x.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(A||[],e+1,2*r+1,2*n),d.push(T||[],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<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var f,h=t,d=e,p=r;!f&&h>0;)h--,d=Math.floor(d/2),p=Math.floor(p/2),f=this.tiles[i(h,d,p)];if(!f||!f.source)return null;if(o>1&&console.log("found parent tile z%d-%d-%d",h,d,p),s(f,a,n.buffer))return c.tile(f,a);o>1&&console.time("drilling down");var m=this.splitTile(f.source,h,d,p,t,e,r);if(o>1&&console.timeEnd("drilling down"),null!==m){var g=1<1?(n=a,i=o):f>0&&(n+=c*f,i+=u*f)}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())}}},{}],153:[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;sf)&&(h.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;io.max[0]&&(o.max[0]=c[0]),c[1]>o.max[1]&&(o.max[1]=c[1])}return o}},{}],154:[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;r0?(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"),f=t("./lib/ticks.js"),h=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 h=t.bounds,d=0;d<2;++d)for(var p=0;p<3;++p)h[d][p]!==this.bounds[d][p]&&(u=!0),this.bounds[d][p]=h[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=f.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});f.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:h,view:h,projection:h};d.isOpaque=function(){return!0},d.isTransparent=function(){return!1},d.drawTransparent=function(t){};var v=[0,0,0],y=[0,0,0],x=[0,0,0];d.draw=function(t){t=t||g;for(var e=this.gl,r=t.model||h,i=t.view||h,a=t.projection||h,s=this.bounds,l=u(r,i,a,s),c=l.cubeEdges,f=l.axis,d=i[12],b=i[13],_=i[14],w=i[15],M=this.pixelRatio*(a[3]*d+a[7]*b+a[11]*_+a[15]*w)/e.drawingBufferHeight,k=0;k<3;++k)this.lastCubeProps.cubeEdges[k]=c[k],this.lastCubeProps.axis[k]=f[k];var A=p;for(k=0;k<3;++k)o(p[k],k,this.bounds,c,f);e=this.gl;var T=m;for(k=0;k<3;++k)this.backgroundEnable[k]?T[k]=f[k]:T[k]=0;this._background.draw(r,i,a,s,T,this.backgroundColor),this._lines.bind(r,i,a,this);for(k=0;k<3;++k){var S=[0,0,0];f[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,A[k].primalOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio),this.lineMirror[k]&&this._lines.drawAxisLine(k,this.bounds,A[k].mirrorOffset,this.lineColor[k],this.lineWidth[k]*this.pixelRatio);var z=n(v,A[k].primalMinor),D=n(y,A[k].mirrorMinor),I=this.lineTickLength;for(E=0;E<3;++E){var P=M/r[5*E];z[E]*=I[E]*P,D[E]*=I[E]*P}this.lineTickEnable[k]&&this._lines.drawAxisTicks(k,A[k].primalOffset,z,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio),this.lineTickMirror[k]&&this._lines.drawAxisTicks(k,A[k].mirrorOffset,D,this.lineTickColor[k],this.lineTickWidth[k]*this.pixelRatio)}this._text.bind(r,i,a,this.pixelRatio);for(k=0;k<3;++k){var O=A[k].primalMinor,F=n(x,A[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":158,"./lib/cube.js":159,"./lib/lines.js":160,"./lib/text.js":162,"./lib/ticks.js":163}],158:[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,f=[0,0,0],h=[0,0,0],d=-1;d<=1;d+=2){r.push(s,s+2,s+1,s+1,s+2,s+3),f[l]=d,h[l]=d;for(var p=-1;p<=1;p+=2){f[c]=p;for(var m=-1;m<=1;m+=2)f[u]=m,e.push(f[0],f[1],f[2],h[0],h[1],h[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),x=a(t,[{buffer:v,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:v,type:t.FLOAT,size:3,offset:12,stride:24}],y),b=o(t);return b.attributes.position.location=0,b.attributes.normal.location=1,new n(t,v,x,b)};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":161,"gl-buffer":165,"gl-vao":259}],159:[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;eS&&(_|=1<S&&(_|=1<f[y][1]&&(O=y));var F=-1;for(y=0;y<3;++y)(N=O^1<f[R][0]&&(R=N))}var j=m;j[0]=j[1]=j[2]=0,j[a.log2(F^O)]=O&F,j[a.log2(O^R)]=O&R;var B=7^R;B===_||B===P?(B=7^F,j[a.log2(R^B)]=B&R):j[a.log2(F^B)]=B&F;var U=g,V=_;for(k=0;k<3;++k)U[k]=V&1< 0.0) {\n vec3 nPosition = mix(bounds[0], bounds[1], 0.5 * (position + 1.0));\n gl_Position = projection * view * model * vec4(nPosition, 1.0);\n } else {\n gl_Position = vec4(0,0,0,0);\n }\n colorChannel = abs(normal);\n}","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":243}],162:[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),f=a(t,[{buffer:u,size:3}]),h=s(t);h.attributes.position.location=0;var d=new n(t,h,u,f);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,f=[0,0];u.bind=function(t,e,r,n){this.vao.bind(),this.shader.bind();var i=this.shader.uniforms;i.model=t,i.view=e,i.projection=r,i.pixelScale=n,f[0]=this.gl.drawingBufferWidth,f[1]=this.gl.drawingBufferHeight,this.shader.uniforms.resolution=f},u.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,f=a.cells,h=0,d=f.length;h=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],f=[0,0,0],h=[0,0,0],d=0;d<3;++d){f[d]=s.length/3|0,a(.5*(t[0][d]+t[1][d]),e[d],r),h[d]=(s.length/3|0)-f[d],l[d]=s.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,c=o%a;o<0?(l=0|-Math.ceil(l),c=0|-c):(l=0|Math.floor(l),c|=0);var u=""+l;if(o<0&&(u="-"+u),i){for(var f=""+c;f.length=t[0][i];--o)a.push({x:o*e[i],text:n(e[i],o)});r.push(a)}return r},r.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;nr)throw new Error("gl-buffer: If resizing buffer, must not specify offset");return t.bufferSubData(e,a,i),r}function a(t,e){for(var r=o.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=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=e<0?i(this.gl,this.type,this.length,this.usage,n,e):i(this.gl,this.type,this.length,this.usage,n.subarray(0,t.size),e),o.free(n)}}else if(Array.isArray(t)){var f;f=this.type===this.gl.ELEMENT_ARRAY_BUFFER?a(t,"uint16"):a(t,"float32"),this.length=e<0?i(this.gl,this.type,this.length,this.usage,f,e):i(this.gl,this.type,this.length,this.usage,f.subarray(0,t.length),e),o.free(f)}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:458,"ndarray-ops":452,"typedarray-pool":554}],166:[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"}},{}],167:[function(t,e,r){var n=t("./1.0/numbers");e.exports=function(t){return n[t]}},{"./1.0/numbers":166}],168:[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=f[n],a=0;a=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 f=0;f<3;++f)e.lineWidth(this.lineWidth[f]),r.capSize=this.capSize[f]*u,this.lineCount[f]&&e.drawArrays(e.LINES,this.lineOffset[f],this.lineCount[f]);this.vao.unbind()};var f=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;u0){var m;(m=f.slice())[c]+=d[1][c],o.push(f[0],f[1],f[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":170,"gl-buffer":165,"gl-vao":259}],169:[function(t,e,r){e.exports=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n1&&h.drawBuffersWEBGL(m[f]);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 x=r.checkFramebufferStatus(r.FRAMEBUFFER);if(x!==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;vs||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;ca||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 f,h,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>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+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,h=this.bounds,d=h[0]=r[0],p=h[1]=n[0],m=1/((h[2]=r[r.length-1])-d),g=1/((h[3]=n[n.length-1])-p),v=e[0],y=e[1];this.shape=[v,y];var x=(v-1)*(y-1)*(f.length>>>1);this.numVertices=x;for(var b=o.mallocUint8(4*x),_=o.mallocFloat32(2*x),w=o.mallocUint8(2*x),M=o.mallocUint32(x),k=0,A=0;A 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":243}],177:[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=h(new Array(1024),[256,1,4]),f=0;f<1024;++f)u.data[f]=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"),f=t("binary-search-bounds"),h=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;e0){for(var x=0;x<24;++x)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 b,_;Array.isArray(o[0])?(b=o[e-1],_=o[e]):b=_=o,3===b.length&&(b=[b[0],b[1],b[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,b[0],b[1],b[2],b[3]);p+=2,g=!1}l.push(v[0],v[1],v[2],y[0],y[1],y[2],M,w,b[0],b[1],b[2],b[3],v[0],v[1],v[2],y[0],y[1],y[2],M,-w,b[0],b[1],b[2],b[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;e0?(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,f=i*l,h=i*c,d=i*u,p=a*c,m=a*u,g=o*u,v=s*l,y=s*c,x=s*u,b=n[0],_=n[1],w=n[2];return t[0]=(1-(p+g))*b,t[1]=(h+x)*b,t[2]=(d-y)*b,t[3]=0,t[4]=(h-x)*_,t[5]=(1-(f+g))*_,t[6]=(m+v)*_,t[7]=0,t[8]=(d+y)*w,t[9]=(m-v)*w,t[10]=(1-(f+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,f=s+s,h=a*c,d=a*u,p=a*f,m=o*u,g=o*f,v=s*f,y=l*c,x=l*u,b=l*f,_=n[0],w=n[1],M=n[2],k=i[0],A=i[1],T=i[2];return t[0]=(1-(m+v))*_,t[1]=(d+b)*_,t[2]=(p-x)*_,t[3]=0,t[4]=(d-b)*w,t[5]=(1-(h+v))*w,t[6]=(g+y)*w,t[7]=0,t[8]=(p+x)*M,t[9]=(g-y)*M,t[10]=(1-(h+m))*M,t[11]=0,t[12]=r[0]+k-(t[0]*k+t[4]*A+t[8]*T),t[13]=r[1]+A-(t[1]*k+t[5]*A+t[9]*T),t[14]=r[2]+T-(t[2]*k+t[6]*A+t[10]*T),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,f=n*s,h=i*o,d=i*s,p=i*l,m=a*o,g=a*s,v=a*l;return t[0]=1-f-p,t[1]=u+v,t[2]=h-g,t[3]=0,t[4]=u-v,t[5]=1-c-p,t[6]=d+m,t[7]=0,t[8]=h+g,t[9]=d-m,t[10]=1-c-f,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,f,h,d,p,m,g=e[0],v=e[1],y=e[2],x=a[0],b=a[1],_=a[2],w=r[0],M=r[1],k=r[2];return Math.abs(g-w).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],f=e[2],h=e[3],d=r[0],p=r[1],m=r[2],g=r[3];return(a=c*d+u*p+f*m+h*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*f+l*m,t[3]=s*h+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":199,"./mat3.js":202,"./vec3.js":206,"./vec4.js":207}],205:[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;s0&&(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,f=3*l*o,h=l*a;return t[0]=e[0]*c+r[0]*u+n[0]*f+i[0]*h,t[1]=e[1]*c+r[1]*u+n[1]*f+i[1]*h,t[2]=e[2]*c+r[2]*u+n[2]*f+i[2]*h,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,f=c*i+l*n-o*a,h=c*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=u*c+d*-o+f*-l-h*-s,t[1]=f*c+d*-s+h*-o-u*-l,t[2]=h*c+d*-l+u*-s-f*-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;s1?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":199}],207:[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,f=c*i+l*n-o*a,h=c*a+o*i-s*n,d=-o*n-s*i-l*a;return t[0]=u*c+d*-o+f*-l-h*-s,t[1]=f*c+d*-s+h*-o-u*-l,t[2]=h*c+d*-l+u*-s-f*-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;s1.0001)return null;g+=m[u]}return Math.abs(g-1)>.001?null:[f,function(t,e){for(var r=[0,0,0],n=0;n 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}",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"}]}},{}],210:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u,f,h,d,p,m,g,v,y,x,b,_,w,k,A,T,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=h,this.triangleUVs=f,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=x,this.pointColors=_,this.pointUVs=w,this.pointSizes=k,this.pointIds=b,this.pointVAO=A,this.pointCount=0,this.contourLineWidth=1,this.contourPositions=T,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"),f=t("ndarray"),h=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,x=m.pointShader,b=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;l0){(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;al[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[A]-l[k]))),y[n]&&M&&(e[1^n]-=T*d*x[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[n],a.uniforms.angle=_[n],c.drawArrays(c.TRIANGLES,w,M)),e[1^n]=T*u[2+(1^n)]-1,p[n+2]&&(e[1^n]+=T*d*m[n+2],kl[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[A]-l[k]))),y[n+2]&&M&&(e[1^n]+=T*d*x[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=b[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],f=a[c+2]-u,h=.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*f/d*m/v,t[c]=2*(u-h)/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)],f=[-1/0],h=l[a];for(e=0;er)for(t=r;te)for(t=e;t=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;w[x]=S}var E=new Array(r.length);f(),d._relink=f,d.types={uniforms:s(r),attributes:s(n)},d.attributes=o(p,d,b,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":218,"./lib/create-attributes":219,"./lib/create-uniforms":220,"./lib/reflect":221,"./lib/runtime-reflect":222,"./lib/shader-cache":223}],218:[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},{}],219:[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=0){if((p=h.charCodeAt(h.length-1)-48)<2||p>4)throw new o("","Invalid data type for attribute "+f+": "+h);i(t,e,d[0],n,p,s,f)}else{if(!(h.indexOf("mat")>=0))throw new o("","Unknown data type for attribute "+f+": "+h);var p;if((p=h.charCodeAt(h.length-1)-48)<2||p>4)throw new o("","Invalid data type for attribute "+f+": "+h);a(t,e,d,n,p,s,f)}}}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":218}],220:[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;n4)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;a4)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 h(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1){s[0]in a||(a[s[0]]=[]),a=a[s[0]];for(var l=1;l1)for(var l=0;l=0){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],h[p]):o.drawLine(e[0],m,e[2],m,d[p],h[p])}}for(p=0;p=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},f.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},f.removeObject=function(t){for(var e=this.objects,r=0;r0){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(!x&&U.autoResize){var t=b.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!==b.width||i!==b.height){b.width=n,b.height=i;var a=b.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=z.length,e=P.length,r=0;r0&&0===I[e-1];)I.pop(),P.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();j.view=U.camera.matrix,O=O||t,F=F||t,E.pixelRatio=U.pixelRatio,C.pixelRatio=U.pixelRatio;var r=z.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;oM.distance)continue;for(var c=0;c>>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>>1;for(r=0;r=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 f=a.getParameter(a.BLEND),h=a.getParameter(a.DITHER);return f&&!this.blend&&a.disable(a.BLEND),h&&a.disable(a.DITHER),a.drawArrays(a.POINTS,0,this.pointCount),f&&!this.blend&&a.enable(a.BLEND),h&&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+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":227,"gl-buffer":165,"gl-shader":228,"typedarray-pool":554}],236:[function(t,e,r){e.exports=function(t,e,r,n){var i,a,o,s,l,c=e[0],u=e[1],f=e[2],h=e[3],d=r[0],p=r[1],m=r[2],g=r[3];return(a=c*d+u*p+f*m+h*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*f+l*m,t[3]=s*h+l*g,t}},{}],237:[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;lMath.abs(F[1])){var R=O;O=F,F=R,R=I,I=P,P=R;var N=z;z=D,D=N}O[0]<0&&(I[z]=-1),F[1]>0&&(P[D]=-1);var j=0,B=0;for(C=0;C<4;++C)j+=Math.pow(d[4*z+C],2),B+=Math.pow(d[4*D+C],2);I[z]/=Math.sqrt(j),P[D]/=Math.sqrt(B),h.axes[0]=I,h.axes[1]=P,h.fragClipBounds[0]=l(A,S[0],E,-1e8),h.fragClipBounds[1]=l(A,S[1],E,1e8),e.vao.draw(f.TRIANGLES,e.vertexCount),e.lineWidth>0&&(f.lineWidth(e.lineWidth),e.vao.draw(f.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,x[0]=2/o.drawingBufferWidth,x[1]=2/o.drawingBufferHeight,s.screenSize=x,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 f=t("gl-buffer"),h=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=f(e),u=f(e),d=f(e),p=f(e),g=new a(e,r,n,i,c,u,d,p,h(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 x=[0,0],b=[0,0,0],_=[0,0,0],w=[0,0,0,1],M=[0,0,0,1],k=v.slice(),A=[0,0,0],T=[[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,f=t.angle,h=t.lineColor,p=0,m=0,v=0,y=n.length;t:for(var x=0;x0&&(C[0]=-a[0]*(1+k[0][0]));var q=w.cells,H=w.positions;for(_=0;_0){var v=r*u;o.drawBox(f-v,h-v,d+v,h+v,a),o.drawBox(f-v,p-v,d+v,p+v,a),o.drawBox(f-v,h-v,f+v,p+v,a),o.drawBox(d-v,h-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":240,"gl-buffer":165,"gl-shader":243}],242:[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_fthis.buffer.length){a.free(this.buffer);for(var n=this.buffer=a.mallocUint8(s(r*e*4)),i=0;i=0){for(var k=0|M.type.charAt(M.type.length-1),A=new Array(k),T=0;T=0;)S+=1;_[w]=S}var E=new Array(r.length);f(),d._relink=f,d.types={uniforms:s(r),attributes:s(n)},d.attributes=o(p,d,x,_),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":244,"./lib/create-attributes":245,"./lib/create-uniforms":246,"./lib/reflect":247,"./lib/runtime-reflect":248,"./lib/shader-cache":249}],244:[function(t,e,r){arguments[4][218][0].apply(r,arguments)},{dup:218}],245:[function(t,e,r){arguments[4][219][0].apply(r,arguments)},{"./GLError":244,dup:219}],246:[function(t,e,r){arguments[4][220][0].apply(r,arguments)},{"./GLError":244,"./reflect":247,dup:220}],247:[function(t,e,r){arguments[4][221][0].apply(r,arguments)},{dup:221}],248:[function(t,e,r){arguments[4][222][0].apply(r,arguments)},{dup:222}],249:[function(t,e,r){arguments[4][223][0].apply(r,arguments)},{"./GLError":244,dup:223,"gl-format-compiler-error":172,"weakmap-shim":576}],250:[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)}},{}],251:[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":243}],252:[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 f=new n(t,l,c,u);return f.update(e),f};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],f=[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 h=c,d=u,p=0;p<3;++p)i&&i[p]<0?(h[p]=this.bounds[0][p],d[p]=this.bounds[1][p]):(h[p]=this.bounds[1][p],d[p]=this.bounds[0][p]);f[0]=e.drawingBufferWidth,f[1]=e.drawingBufferHeight,n.uniforms.model=a,n.uniforms.view=o,n.uniforms.projection=l,n.uniforms.coordinates=[this.position,h,d],n.uniforms.colors=this.colors,n.uniforms.screenShape=f;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":251,"gl-buffer":165,"gl-vao":259}],253:[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":243}],254:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u,f,h,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=f,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=h,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],b(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=j,n.vertexColor=this.vertexColor;var l=N;for(b(l,n.view,n.model),b(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 f=i(n,this);if(f.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=f.projections[a],this._shader.uniforms.clipBounds=f.clipBounds[a],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(f.showContour&&!e){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var d=this._contourVAO;for(d.bind(),a=0;a<3;++a)for(h.uniforms.permutation=D[a],r.lineWidth(this.contourWidth[a]),s=0;s=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},P.pickSlots=1,P.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},N=C.slice(),j=[1,0,0,0,1,0,0,0,1];P.draw=function(t){return a.call(this,t,!1)},P.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]};P.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=j;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=D[o],n=0;n>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var c=r.position;c[0]=c[1]=c[2]=0;for(var u=0;u<2;++u)for(var f=u?a:1-a,h=0;h<2;++h)for(var d=i+u,p=s+h,m=f*(h?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]Math.abs(b-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},P.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 f=l[a];for(w=0;w<2;++w)if(f.shape[w]!==i[w])throw new Error("gl-surface: coords have incorrect shape");o(this._field[a],f)}}else if(t.ticks){var h=t.ticks;if(!Array.isArray(h)||2!==h.length)throw new Error("gl-surface: invalid ticks");for(a=0;a<2;++a){var d=h[a];if((Array.isArray(d)||d.length)&&(d=y(d)),d.shape[0]!==i[a])throw new Error("gl-surface: invalid tick length");var b=y(d.data,i);b.stride[a]=d.stride[0],b.stride[1^a]=0,o(this._field[a],b)}}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;w0){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;ai||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"),f=t("typedarray-pool");e.exports=function(t){if(arguments.length<=1)throw new Error("gl-texture2d: Missing arguments for texture2d constructor");if(h||function(t){h=[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()),h=0;"float32"===r?h=t.FLOAT:"float64"===r?(h=t.FLOAT,l=!1,r="float32"):"uint8"===r?h=t.UNSIGNED_BYTE:(h=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}}h!==t.FLOAT||t.getExtension("OES_texture_float")||(h=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=f.malloc(v,r);var x=c(g,n,y,0);"float32"!==r&&"float64"!==r||h!==t.UNSIGNED_BYTE?u.assign(x,e):m(x,e),p=g.subarray(0,v)}var b=s(t);return t.texImage2D(t.TEXTURE_2D,0,d,n[0],n[1],0,d,h,p),l||f.free(g),new a(t,b,n[0],n[1],d,h)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")};var h=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&&h.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&&h.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 h=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"===h?p=t.FLOAT:"float64"===h?(p=t.FLOAT,v=!1,h="float32"):"uint8"===h?p=t.UNSIGNED_BYTE:(p=t.UNSIGNED_BYTE,v=!1,h="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,x=s.indexOf(n)<0;if(x&&s.push(n),p===a&&v)0===l.offset&&l.data.length===y?x?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):x?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 b;b=a===t.FLOAT?f.mallocFloat32(y):f.mallocUint8(y);var _=c(b,d,[d[2],d[2]*d[0],1]);p===t.FLOAT&&a===t.UNSIGNED_BYTE?m(_,l):u.assign(_,l),x?t.texImage2D(t.TEXTURE_2D,n,i,d[0],d[1],0,i,a,b.subarray(0,y)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,d[0],d[1],i,a,b.subarray(0,y)),a===t.FLOAT?f.freeFloat32(b):f.freeUint8(b)}}(a,e,r,i,this.format,this.type,this._mipLevels,t)}}},{ndarray:458,"ndarray-ops":452,"typedarray-pool":554}],256:[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;i0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a),t}},{}],265:[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}},{}],266:[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)},{}],267:[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-1?y:j.indexOf(t)>-1?v:g,e(z.join("")),C=l,E}return z.push(A),T=A,E+1}();break;case x:E=/[^\s]/g.test(A)?(e(z.join("")),C=l,E):(z.push(A),T=A,E+1);break;case l:z=z.length?[]:z,E="/"===T&&"*"===A?(O=L+E-1,C=u,T=A,E+1):"/"===T&&"/"===A?(O=L+E-1,C=f,T=A,E+1):"#"===A?(C=h,O=L+E,E):/\s/.test(A)?(C=x,O=L+E,E):(F=/\d/.test(A),R=/[^\w_]/.test(A),O=L+E,C=F?p:R?d:c,E)}if(r!==E)switch(N[r]){case"\n":P=0,++I;break;default:++P}}return L+=E,N=N.slice(E),D}function M(){return"\r"!==A&&"\n"!==A||"\\"===T?(z.push(A),T=A,E+1):(e(z.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,(z=z.slice(n.length)).length}}var A,T,S,E=0,L=0,C=l,z=[],D=[],I=1,P=0,O=0,F=!1,R=!1,N="",j=a,B=n;return"300 es"===(t=t||{}).version&&(j=s,B=o),function(t){return D=[],null!==t?r(t.replace?t.replace(/\r\n/g,"\n"):t):(z.length&&e(z.join("")),C=b,e("(eof)"),D)}};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,f=1,h=2,d=3,p=4,m=5,g=6,v=7,y=8,x=9,b=10,_=11,w=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"]},{"./lib/builtins":270,"./lib/builtins-300es":269,"./lib/literals":272,"./lib/literals-300es":271,"./lib/operators":273}],269:[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":270}],270:[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"]},{}],271:[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":272}],272:[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"]},{}],273:[function(t,e,r){e.exports=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"]},{}],274:[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":268}],275:[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=c[h+0]&&n>=c[h+1]?(o[f]=!0,a.push(l[f])):o[f]=!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),f=s;f<=c;f++)for(var h=l;h<=u;h++){var d=this.d*h+f;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>1,u=-7,f=r?i-1:0,h=r?-1:1,d=t[e+f];for(f+=h,a=d&(1<<-u)-1,d>>=-u,u+=s;u>0;a=256*a+t[e+f],f+=h,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=n;u>0;o=256*o+t[e+f],f+=h,u-=8);if(0===a)a=1-c;else{if(a===l)return o?NaN:1/0*(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<>1,h=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+f>=1?h/l:h*Math.pow(2,1-f))*l>=2&&(o++,l/=2),o+f>=u?(s=0,o=u):o+f>=1?(s=(e*l-1)*Math.pow(2,i),o+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;t[r+d]=255&s,d+=p,s/=256,i-=8);for(o=o<0;t[r+d]=255&o,d+=p,o/=256,c-=8);t[r+d-p]|=128*m}},{}],278:[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 f=new n(c,new Array(i+1),!1),h=f.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);h[u]=v,d[u]=v}for(d[i+1]=f,u=0;u<=i;++u){p=h[u].vertices;var y=h[u].adjacent;for(m=0;m<=i;++m){var x=p[m];if(x<0)y[m]=f;else for(var b=0;b<=i;++b)h[b].vertices.indexOf(x)<0&&(y[m]=h[b])}}var _=new o(i,a,d),w=!!e;for(u=i+1;u0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var c=s[l];if(c.boundary&&!(c.lastVisited<=-n)){for(var u=c.vertices,f=0;f<=r;++f){var h=u[f];i[f]=h<0?e:a[h]}var 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 f=c[u];if(!(f.lastVisited>=r)){var h=a[u];a[u]=t;var d=this.orient();if(a[u]=h,d<0){s=f;continue t}f.boundary?f.lastVisited=-r:f.lastVisited=r}}return}return s},u.addPeaks=function(t,e){var r=this.vertices.length-1,o=this.dimension,s=this.vertices,l=this.tuple,c=this.interior,u=this.simplices,f=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,c.push(e);for(var h=[];f.length>0;){var d=(e=f.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 x=0,b=0;b<=o;++b)y[b]<0?(x=b,l[b]=t):l[b]=s[y[b]];if(this.orient()>0){y[x]=r,v.boundary=!1,c.push(v),f.push(v),v.lastVisited=r;continue}v.lastVisited=-r}var _=v.adjacent,w=d.slice(),M=p.slice(),k=new n(w,M,!0);u.push(k);var A=_.indexOf(e);if(!(A<0)){_[A]=k,M[m]=v,w[g]=-1,M[g]=e,p[g]=k,k.flip();for(b=0;b<=o;++b){var T=w[b];if(!(T<0||T===r)){for(var S=new Array(o-1),E=0,L=0;L<=o;++L){var C=w[L];C<0||L===b||(S[E++]=C)}h.push(new i(S,k,b))}}}}}}h.sort(a);for(g=0;g+1=0?o[l++]=s[u]:c=1&u;if(c===(1&t)){var f=o[0];o[0]=o[1],o[1]=f}e.push(o)}}return e}},{"robust-orientation":515,"simplicial-complex":526}],279:[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=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function u(t,e){for(var r=0;r>1],a=[],o=[],s=[];for(r=0;r3*(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,h),n=g.ge(this.rightPoints,t,d);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},x.remove=function(t){var e=this.count-this.leftPoints;if(t[1]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,h);athis.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)},x.queryInterval=function(t,e,r){if(tthis.mid&&this.right){var n;if(n=this.right.queryInterval(t,e,r))return n}return ethis.mid?c(this.rightPoints,t,r):u(this.leftPoints,r)};var b=m.prototype;b.insert=function(t){this.root?this.root.insert(t):this.root=new n(t[0],null,null,[t],[t])},b.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==v}return!1},b.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},b.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(b,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(b,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}})},{"binary-search-bounds":70}],280:[function(t,e,r){"use strict";e.exports=function(t,e){e=e||new Array(t.length);for(var r=0;r4))}},{}],288:[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=r&&s<=i&&l>=n&&l<=a&&u.push(t[p]);else{var m=Math.floor((d+h)/2);s=e[2*m],l=e[2*m+1],s>=r&&s<=i&&l>=n&&l<=a&&u.push(t[m]);var g=(f+1)%2;(0===f?r<=s:n<=l)&&(c.push(d),c.push(m-1),c.push(g)),(0===f?i>=s:a>=l)&&(c.push(m+1),c.push(h),c.push(g))}}return u}},{}],290:[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),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1);i(t,e,r,Math.max(n,Math.floor(r-c*f/l+h)),Math.min(o,Math.floor(r+(l-c)*f/l+h)),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);pd;)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},{}],291:[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(),f=s.pop(),h=s.pop();if(f-h<=o)for(var d=h;d<=f;d++)n(e[2*d],e[2*d+1],r,i)<=c&&l.push(t[d]);else{var p=Math.floor((h+f)/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(h),s.push(p-1),s.push(v)),(0===u?r+a>=m:i+a>=g)&&(s.push(p+1),s.push(f),s.push(v))}}return l}},{}],292:[function(t,e,r){"use strict";function n(t,e){if(!(this instanceof n))return new n(t,e);this.nodeSize=e||64,this.coords=t.slice();var r=Math.floor(t.length/2);this.ids=Array(r);for(var i=0;in;){if(i-n>600){var l=i-n+1,c=r-n+1,u=Math.log(l),f=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*f*(l-f)/l)*(c-l/2<0?-1:1);o(t,e,r,Math.max(n,Math.floor(r-c*f/l+h)),Math.min(i,Math.floor(r+(l-c)*f/l+h)),a)}var d=e[2*r+a],p=n,m=i;for(s(t,e,n,r),e[2*i+a]>d&&s(t,e,n,i);pd;)m--}e[2*n+a]===d?s(t,e,n,m):s(t,e,++m,i),m<=r&&(n=m+1),r<=m&&(i=m-1)}}function s(t,e,r,n){l(t,r,n),l(e,2*r,2*n),l(e,2*r+1,2*n+1)}function l(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=n,n.prototype.range=function(t,e,r,n){for(var i,a,o=this.ids,s=this.coords,l=this.nodeSize,c=[0,o.length-1,0],u=[];c.length;){var f=c.pop(),h=c.pop(),d=c.pop();if(h-d<=l)for(var p=d;p<=h;p++)i=s[2*p],a=s[2*p+1],i>=t&&i<=r&&a>=e&&a<=n&&u.push(o[p]);else{var m=Math.floor((d+h)/2);i=s[2*m],a=s[2*m+1],i>=t&&i<=r&&a>=e&&a<=n&&u.push(o[m]);var g=(f+1)%2;(0===f?t<=i:e<=a)&&(c.push(d),c.push(m-1),c.push(g)),(0===f?r>=i:n>=a)&&(c.push(m+1),c.push(h),c.push(g))}}return u},n.prototype.within=function(t,e,r){for(var n=this.ids,a=this.coords,o=this.nodeSize,s=[0,n.length-1,0],l=[],c=r*r;s.length;){var u=s.pop(),f=s.pop(),h=s.pop();if(f-h<=o)for(var d=h;d<=f;d++)i(a[2*d],a[2*d+1],t,e)<=c&&l.push(n[d]);else{var p=Math.floor((h+f)/2),m=a[2*p],g=a[2*p+1];i(m,g,t,e)<=c&&l.push(n[p]);var v=(u+1)%2;(0===u?t-r<=m:e-r<=g)&&(s.push(h),s.push(p-1),s.push(v)),(0===u?t+r>=m:e+r>=g)&&(s.push(p+1),s.push(f),s.push(v))}}return l}},{}],293:[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],f=c||void 0!==t.property,h=c||!f,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||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 -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:468}],295:[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:563}],296:[function(t,e,r){"use strict";e.exports=function(t){for(var e=1;e7)return[new n(u,l,"constants have been deprecated as of v8")];if(!(l in h.constants))return[new n(u,l,'constant "%s" not found',l)];e=a({},e,{value:h.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?f[c.type]:c}))}},{"../error/validation_error":295,"../util/extend":296,"../util/get_type":297,"./validate_array":300,"./validate_boolean":301,"./validate_color":302,"./validate_constants":303,"./validate_enum":304,"./validate_filter":305,"./validate_function":306,"./validate_layer":308,"./validate_number":310,"./validate_object":311,"./validate_source":313,"./validate_string":314}],300:[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.length7)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":295,"../util/get_type":297}],304:[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":295,"../util/unbundle_jsonlint":298}],305:[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 f=2;f=8&&(f&&!t.valueSpec["property-function"]?d.push(new n(t.key,t.value,"property functions not supported")):h&&!t.valueSpec["zoom-function"]&&d.push(new n(t.key,t.value,"zoom functions not supported"))),d}},{"../error/validation_error":295,"../util/get_type":297,"./validate":299,"./validate_array":300,"./validate_number":310,"./validate_object":311}],307:[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":295,"./validate_string":314}],308:[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,f=t.style,h=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;ma.maximum?[new i(e,r,"%s is greater than the maximum value %s",r,a.maximum)]:[]}},{"../error/validation_error":295,"../util/get_type":297}],311:[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=[],f=i(r);if("object"!==f)return[new n(e,r,"object expected, %s found",f)];for(var h in r){var d=h.split(".")[0],p=o&&(o[d]||o["*"]),m=s[d]||s["*"];p||m?u=u.concat((m||a)({key:(e?e+".":e)+h,value:r[h],valueSpec:p,style:l,styleSpec:c,object:r,objectKey:h})):""!==e&&1!==e.split(".").length&&u.push(new n(e,r[h],'unknown property "%s"',h))}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":295,"../util/get_type":297,"./validate":299}],312:[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":295,"./validate":299}],313:[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":295,"../util/unbundle_jsonlint":298,"./validate_enum":304,"./validate_object":311}],314:[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":295,"../util/get_type":297}],315:[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":316,"./validate/validate":299,"./validate/validate_constants":303,"./validate/validate_filter":305,"./validate/validate_glyphs_url":307,"./validate/validate_layer":308,"./validate/validate_layout_property":309,"./validate/validate_paint_property":312,"./validate/validate_source":313}],316:[function(t,e,r){e.exports=t("./v8.min.json")},{"./v8.min.json":317}],317:[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"}}}},{}],318:[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}},{}],319:[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":433}],320:[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;a1?p.name+b:p.name]=m[b]*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":431,"../util/util":433,"./array_group":319,"./bucket/circle_bucket":321,"./bucket/fill_bucket":322,"./bucket/line_bucket":323,"./bucket/symbol_bucket":324,"./buffer_group":326,assert:51,"feature-filter":141}],321:[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=s||u<0||u>=s)){var f=this.prepareArrayGroup("circle",4),h=f.layoutVertexArray,d=this.addCircleVertex(h,c,u,-1,-1);this.addCircleVertex(h,c,u,1,-1),this.addCircleVertex(h,c,u,1,1),this.addCircleVertex(h,c,u,-1,1),f.elementArray.emplaceBack(d,d+1,d+2),f.elementArray.emplaceBack(d,d+3,d+2)}}this.populatePaintArrays("circle",e,t.properties,n,i)}},{"../../util/util":433,"../bucket":320,"../load_geometry":328}],322:[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;a0&&a.push(i.length/2);for(var u=0;u=1&&n.elementArray2.emplaceBack(h-1,h),i.push(f.x),i.push(f.y)}}for(var d=s(i,a),p=0;p>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;r2&&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],f=c.equals(u);if(this.prepareArrayGroup("line",10*a),2!==a||!f){this.distance=0;var h,d,p,m,g,v,y,x=r,b=f?"butt":r,_=!0;this.e1=this.e2=this.e3=-1,f&&(h=t[a-2],g=c.sub(h)._unit()._perp());for(var w=0;w0){var S=h.dist(d);if(S>2*o){var E=h.sub(h.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?x:b;if(L&&"round"===C&&(An&&(C="bevel"),"bevel"===C&&(A>2&&(C="flipbevel"),A100)M=g.clone();else{var z=m.x*g.y-m.y*g.x>0?-1:1,D=A*m.add(g).mag()/m.sub(g).mag();M._perp()._mult(D*z)}this.addCurrentVertex(h,this.distance,M,0,0,!1),this.addCurrentVertex(h,this.distance,M.mult(-1),0,0,!1)}else if("bevel"===C||"fakeround"===C){var I=m.x*g.y-m.y*g.x>0,P=-Math.sqrt(A*A-1);if(I?(y=0,v=P):(v=0,y=P),_||this.addCurrentVertex(h,this.distance,m,v,y,!1),"fakeround"===C){for(var O,F=Math.floor(8*(.5-(k-.5))),R=0;R=0;N--)O=m.mult((N+1)/(F+1))._add(g)._unit(),this.addPieSliceVertex(h,this.distance,O,I)}p&&this.addCurrentVertex(h,this.distance,g,-v,-y,!1)}else"butt"===C?(_||this.addCurrentVertex(h,this.distance,m,0,0,!1),p&&this.addCurrentVertex(h,this.distance,g,0,0,!1)):"square"===C?(_||(this.addCurrentVertex(h,this.distance,m,1,1,!1),this.e1=this.e2=-1),p&&this.addCurrentVertex(h,this.distance,g,-1,-1,!1)):"round"===C&&(_||(this.addCurrentVertex(h,this.distance,m,0,0,!1),this.addCurrentVertex(h,this.distance,m,1,1,!0),this.e1=this.e2=-1),p&&(this.addCurrentVertex(h,this.distance,g,-1,-1,!0),this.addCurrentVertex(h,this.distance,g,0,0,!1)));if(T&&w2*o){var B=h.add(p.sub(h)._mult(o/j)._round());this.distance+=B.dist(h),this.addCurrentVertex(B,this.distance,g.mult(1),0,0,!1),h=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,f=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&&f.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&&f.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":433,"../bucket":320,"../load_geometry":328}],324:[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"),f=t("../../symbol/shaping"),h=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=f.shapeText,x=f.shapeIcon,b=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 f="right"===a["text-justify"]?1:"left"===a["text-justify"]?0:.5,h=24*a["text-line-height"],p="line"!==a["symbol-placement"]?24*a["text-max-width"]:0,v=24*a["text-letter-spacing"],b=[24*a["text-offset"][0],24*a["text-offset"][1]],_=this.fontstack=a["text-font"].join(","),M=[],k=0;kw||L.y<0||L.y>w);if(!d||C){var z=C||b;this.addSymbolInstance(L,T,e,r,this.layer,z,this.symbolInstancesArray.length,this.collisionBoxArray,n.index,this.sourceLayerIndex,this.index,c,m,y,f,g,x,{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])3*Math.PI/2))){var g=p.tl,v=p.tr,y=p.bl,x=p.br,b=p.tex,_=p.anchorPoint,w=Math.max(f+Math.log(p.minScale)/Math.LN2,h),M=Math.min(f+Math.log(p.maxScale)/Math.LN2,25);if(!(M<=w)){w===h&&(w=0);var k=Math.round(p.glyphAngle/(2*Math.PI)*256),A=i(u,_.x,_.y,g.x,g.y,b.x,b.y,w,M,h,k);i(u,_.x,_.y,v.x,v.y,b.x+b.w,b.y,w,M,h,k),i(u,_.x,_.y,y.x,y.y,b.x,b.y+b.h,w,M,h,k),i(u,_.x,_.y,x.x,x.y,b.x+b.w,b.y+b.h,w,M,h,k),c.emplaceBack(A,A+1,A+2),c.emplaceBack(A+1,A+2,A+3)}}}},n.prototype.updateIcons=function(t){this.recalculateStyleLayers();var e=this.layer.layout["icon-image"];if(e)for(var r=0;rn.MAX_QUADS&&m.warnOnce("Too many symbols being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),A>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(I,P,O,F,k,A,T,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":382,"../../symbol/clip_line":384,"../../symbol/collision_feature":386,"../../symbol/get_anchors":388,"../../symbol/mergelines":391,"../../symbol/quads":392,"../../symbol/resolve_text":393,"../../symbol/shaping":394,"../../util/token":432,"../../util/util":433,"../bucket":320,"../load_geometry":328,"point-geometry":477}],325:[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;r0?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;or.max||h.yr.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return l}},{"../util/util":433,"./bucket":320,assert:51}],329:[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}}},{}],330:[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":433}],331:[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":330}],332:[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,f=t("gl-matrix"),h=f.vec4,d=f.mat4,p=f.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(et.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];h.transformMat4(e,e,this.pixelMatrixInverse),h.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,f=e[2]/n,d=r[2]/i,p=f===d?0:(0-f)/(d-f),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 h.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]))-te&&(l=e-d)}if(this.lngRange){var p=this.x,m=c.x/2;p-mn&&(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":320,"../source/tile_coord":360,"../util/interpolate":427,"../util/util":433,"./coordinate":329,"./lng_lat":330,"gl-matrix":198,"point-geometry":477}],333:[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,f,h,d=[];for(a=0,o=t.length;a>16,_>>16),s.uniform2f(o.u_pixel_coord_lower,65535&b,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":354,"./create_uniform_pragmas":335}],337:[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>16,h>>16),s.uniform2f(o.u_pixel_coord_lower,65535&f,65535&h),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;s0?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,f=o.source&&o.source.findLoadedParent(n,0,{}),h=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),f=!!e&&Math.abs(e.coord.z-u)>Math.abs(t.coord.z-u);!e||f?(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 h=r.paint["raster-opacity"];return a[0]*=h,a[1]*=h,a}(o,f,r,t.transform);a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,o.texture),a.activeTexture(a.TEXTURE1),f?(a.bindTexture(a.TEXTURE_2D,f.texture),c=Math.pow(2,f.coord.z-o.coord.z),u=[o.coord.x*c%1,o.coord.y*c%1]):(a.bindTexture(a.TEXTURE_2D,o.texture),h[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,h[0]),a.uniform1f(l.u_opacity1,h[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":431,"../util/util":433}],343:[function(t,e,r){"use strict";function n(t,e,r,n,a,s,l,c,u,f,h,d,p,m,g){for(var v=0;vthis.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))}},{}],345:[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;o0?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":320,"../data/buffer":325,"../source/pixels_to_tile_units":354,"../source/source_cache":358,"../util/browser":417,"../util/struct_array":431,"../util/util":433,"./create_uniform_pragmas":335,"./draw_background":336,"./draw_circle":337,"./draw_debug":339,"./draw_fill":340,"./draw_line":341,"./draw_raster":342,"./draw_symbol":343,"./frame_history":344,"./painter/use_program":347,"./vertex_array_object":348,"gl-matrix":198}],347:[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(),f=o[t],h="#define MAPBOX_GL_JS;\n",d=0;dthis.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":320,"../util/evented":425,"../util/util":433,"resolve-url":508}],350:[function(t,e,r){"use strict";function n(t,e,r){r&&(this.loadGeoJSON=r),f.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"),f=t("./vector_tile_worker_source");e.exports=n,n.prototype=i.inherit(f,{_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":416,"../util/util":433,"./geojson_wrapper":351,"./vector_tile_worker_source":362,"geojson-rewind":147,"geojson-vt":151,supercluster:538,"vt-pbf":570}],351:[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;ee)){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={},f=(new Date).getTime();this._coveredTiles={};var d=this.used?t.coveringTiles(this._source):[];for(r=0;rf-(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 x=h.keysDifference(this._tiles,u);for(r=0;rthis.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=0&&v[1].y>=0){for(var y=[],x=0;x=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<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.dx0,f=e.dx<0,h=a;hu.dy&&(l=c,c=u,u=l),c.dy>f.dy&&(l=c,c=f,f=l),u.dy>f.dy&&(l=u,u=f,f=l),c.dy&&a(f,c,n,o,s),u.dy&&a(f,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<0;a--)i+=(e&(n=1<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;othis.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":425,"../util/mapbox":430,"../util/util":433,"./load_tilejson":353}],362:[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":416,"./worker_tile":365,pbf:470,"vector-tile":564}],363:[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,f=t("../render/draw_raster").RasterBoundsArray,h=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 f;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 h(e.serialize(),f.serialize(),h.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":320,"../data/buffer":325,"../geo/lng_lat":330,"../render/draw_raster":342,"../render/vertex_array_object":348,"../util/ajax":416,"../util/evented":425,"../util/util":433,"./tile_coord":360,"point-geometry":477}],364:[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=0;e--)x(E,P[e]);b()}}function x(t,e){if(e.populateArrays(A,N,R),"symbol"!==e.type)for(var r=0;r=w.maxzoom||w.layout&&"none"===w.layout.visibility||t.layers&&!t.layers[w.sourceLayer]||((k=u.create({layer:w,index:z++,childLayers:e[D],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 I=[],P=this.symbolBuckets=[],O=[];T.bucketLayerIDs={};for(var F in L)0!==(k=L[F]).features.length&&(T.bucketLayerIDs[k.index]=k.childLayers.map(s),I.push(k),"symbol"===k.type?P.push(k):O.push(k));var R={},N={},j=0;if(P.length>0){for(_=P.length-1;_>=0;_--)P[_].updateIcons(R),P[_].updateFont(N);for(var B in N)N[B]=Object.keys(N[B]).map(Number);R=Object.keys(R),r.send("get glyphs",{uid:this.uid,stacks:N},function(t,e){N=e,y(t)}),R.length?r.send("get icons",{icons:R},function(t,e){R=e,y(t)}):y()}for(_=O.length-1;_>=0;_--)x(0,O[_]);if(0===P.length)return b()},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(),f=s.filter(i);return{result:{buckets:f.map(a),collisionTile:u.data},transferables:o(f).concat(u.transferables)}}},{"../data/bucket":320,"../data/feature_index":327,"../symbol/collision_box":385,"../symbol/collision_tile":387,"../symbol/symbol_instances":396,"../symbol/symbol_quads":397,"../util/dictionary_coder":423,"../util/util":433}],366:[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})}},{}],367:[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;i1!==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":416,"../util/browser":417,"../util/evented":425,"../util/mapbox":430}],368:[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":433,"./style_function":371,csscolorparser:114}],369:[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?f.getJSON(h(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"),f=t("../util/ajax"),h=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"),x=t("../source/source_cache"),b=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;rMath.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=0&&this._handleErrors(g.source,"sources."+t,e)?this:(e=new x(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;is.lastIntegerZoom?(n=c+(1-c)*u,f*=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),f/=2),void 0===i||void 0===a?void 0:{from:i,fromScale:f,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.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-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],c=0;sn;)c-=l.shift().angleDelta;if(c>i)return!1;o++,s+=f.dist(h)}return!0}},{}],384:[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=i&&h.x>=i||(f.x>=i?f=new n(i,f.y+(h.y-f.y)*((i-f.x)/(h.x-f.x)))._round():h.x>=i&&(h=new n(i,f.y+(h.y-f.y)*((i-f.x)/(h.x-f.x)))._round()),f.y>=a&&h.y>=a||(f.y>=a?f=new n(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round():h.y>=a&&(h=new n(f.x+(h.x-f.x)*((a-f.y)/(h.y-f.y)),a)._round()),l&&f.equals(l[l.length-1])||(l=[f],o.push(l)),l.push(h)))))}return o}},{"point-geometry":477}],385:[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":431,"../util/util":433,"point-geometry":477}],386:[function(t,e,r){"use strict";function n(t,e,r,n,i,a,o,s,l,c,u){var f=o.top*s-l,h=o.bottom*s+l,d=o.left*s-l,p=o.right*s+l;if(this.boxStartIndex=t.length,c){var m=h-f,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,f,p,h,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),f=-a/2,h=this.boxes,d=r,p=n+1,m=f;do{if(--p<0)return h;m-=e[p].dist(d),d=e[p]}while(m>-i/2);for(var g=e[p].dist(e[p+1]),v=0;v=e.length)return h;g=e[p].dist(e[p+1])}var x=y-m,b=e[p],_=e[p+1].sub(b)._unit()._mult(x)._add(b)._round(),w=i/2/Math.max(Math.abs(y-f)-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 h}},{}],387:[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=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),A=new i(c.x1,c.y2).matMult(w),T=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,A.x,T.x),_.y1=Math.min(M.y,k.x,A.x,T.x),_.x2=Math.max(M.x,k.x,A.x,T.x),_.y2=Math.max(M.y,k.x,A.x,T.x),_.maxScale=c.maxScale}else _=c;for(var S=0;S=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),f=this.tempCollisionBox;f.anchorX=u.x,f.anchorY=u.y,f.x1=0,f.y1=0,f.x2=r-t,f.y2=n-e,f.maxScale=a,a=f.maxScale;for(var h=[u.x+f.x1/a,u.y+f.y1/a*this.yStretch,u.x+f.x2/a,u.y+f.y2/a*this.yStretch],d=this.grid.query(h[0],h[1],h[2],h[3]),p=this.ignoredGrid.query(h[0],h[1],h[2],h[3]),m=0;m=a&&(o[y][x]=!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 f=Math.min(Math.max(s,l),Math.max(c,u)),h=i.maxScale,d=r.maxScale;return f>h&&(f=h),f>d&&(f=d),f>t&&f>=i.placementScale&&(t=f),t},n.prototype.insertCollisionFeature=function(t,e,r){for(var n=r?this.ignoredGrid:this.grid,i=this.collisionBoxArray,a=t.boxStartIndex;a=0&&A=0&&T=0&&v+d<=p){var S=new a(A,T,M,x)._round();s&&!o(t,S,c,s,l)||y.push(S)}}g+=w}return f||y.length||u||(y=n(t,g/2,r,s,l,c,u,!0,h)),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,f=Math.max(i?i.right-i.left:0,a?a.right-a.left:0),h=0===t[0].x||t[0].x===c||0===t[0].y||t[0].y===c;return e-f*s=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;n65535)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;an&&null!==f){var x=g[f+1].x;m=Math.max(x,m);for(var b=f+1;b<=v;b++)g[b].y+=r,g[b].x-=x;if(c){var _=f;a[g[f].codePoint]&&_--,i(g,e,d,_,c)}d=f+1,f=null,h+=x,p++}o[y.codePoint]&&(f=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;u1?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;r1||(f?(clearTimeout(f),f=null,o("dblclick",e)):f=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":419,"./handler/box_zoom":404,"./handler/dblclick_zoom":405,"./handler/drag_pan":406,"./handler/drag_rotate":407,"./handler/keyboard":408,"./handler/scroll_zoom":409,"./handler/touch_zoom_rotate":410,"point-geometry":477}],399:[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())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-f),x=c.point,b="center"in t?c.project(p).sub(u.div(y)):x,_=c.worldSize,w=t.curve,M=Math.max(c.width,c.height),k=M/y,A=b.sub(x).mag();if("minZoom"in t){var T=n.clamp(Math.min(t.minZoom,f,m),c.minZoom,c.maxZoom),S=M/c.zoomScale(T-f);w=Math.sqrt(S/A*2)}var E=w*w,L=r(0),C=function(t){return s(L)/s(L+w*t)},z=function(t){return M*((s(L)*function(t){return a(t)/s(t)}(L+w*t)-a(L))/E)/A},D=(r(1)-L)/w;if(Math.abs(A)<1e-6){if(Math.abs(M-k)<1e-6)return this.easeTo(t);var I=k=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":419,"../../util/util":433,"./control":401}],401:[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":425,"../../util/util":433}],402:[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":417,"../../util/dom":419,"../../util/util":433,"./control":401}],403:[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":419,"../../util/util":433,"./control":401}],404:[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":331,"../../util/dom":419,"../../util/util":433}],405:[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)}}},{}],406:[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,f=l.mult(-u/2);this._map.panBy(f,{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":419,"../../util/util":433}],407:[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)180&&(d=180);var p=d/180;c+=f*d*(p/2),Math.abs(e._normalizeBearing(c,0))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":419,"../../util/util":433,"point-geometry":477}],408:[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))}}}}},{}],409:[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":417,"../../util/dom":419,"../../util/util":433}],410:[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 f=.15*l/c;Math.abs(f)>2.5&&(f=f>0?2.5:-2.5);var h=1e3*Math.abs(f/(12*.15)),d=a+f*h/2e3;d<0&&(d=0),r.easeTo({zoom:d,duration:h,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":419,"../../util/util":433}],411:[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":433}],412:[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"),f=t("../style/animation_loop"),h=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"),x=t("point-geometry"),b=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 f,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 b(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=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 x(0,0)),this.transform.pointLocation(this.transform.size));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new x(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new x(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()=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(x.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 x||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=[x.convert([0,0]),x.convert([this.transform.width,this.transform.height])]);var e;if(t instanceof x||"number"==typeof t[0]){e=[x.convert(t)]}else{var r=[x.convert(t[0]),x.convert(t[1])];e=[r[0],new x(r[1].x,r[0].y),r[1],new x(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 h(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":330,"../geo/lng_lat_bounds":331,"../geo/transform":332,"../render/painter":346,"../style/animation_loop":366,"../style/style":369,"../util/browser":417,"../util/canvas":418,"../util/dom":419,"../util/evented":425,"../util/util":433,"./bind_handlers":398,"./camera":399,"./control/attribution":400,"./hash":411,"point-geometry":477}],413:[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":330,"../util/dom":419,"point-geometry":477}],414:[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="×",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.ythis._map.transform.height-n?["bottom"]:[],t.xthis._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":330,"../util/dom":419,"../util/evented":425,"../util/util":433}],415:[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:"",id:String(i),error:t?String(t):null,data:e},r)}var r,n=t.data,i=n.id;if(""===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)}},{}],416:[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=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":318}],418:[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":433,"mapbox-gl-supported":318}],419:[function(t,e,r){"use strict";function n(t){for(var e=0;e1)for(var u=0;u=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(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])1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}(t,e[i-1],e[i])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;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}e.exports={multiPolygonIntersectsBufferedMultiPoint:function(t,e,r){for(var n=0;n=3)for(var u=0;u1){if(n(t,e))return!0;for(var i=0;ithis.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}},{}],430:[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":417,"./config":422,"./util":433,url:559}],431:[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 f[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(h[d])return h[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 f),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;othis.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=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=0)return!0;return!1};var o={};r.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)}},{"../geo/coordinate":329,unitbezier:557}],434:[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}}},{}],435:[function(t,e,r){e.exports={_args:[["mapbox-gl@0.22.1","/Users/alex/plotly/plotly.js"]],_from:"mapbox-gl@0.22.1",_id:"mapbox-gl@0.22.1",_inBundle:!1,_integrity:"sha1-kqllVH1MLyTCLLxIfu2khpTLYno=",_location:"/mapbox-gl",_phantomChildren:{},_requested:{type:"version",registry:!0,raw:"mapbox-gl@0.22.1",name:"mapbox-gl",escapedName:"mapbox-gl",rawSpec:"0.22.1",saveSpec:null,fetchSpec:"0.22.1"},_requiredBy:["/"],_resolved:"https://registry.npmjs.org/mapbox-gl/-/mapbox-gl-0.22.1.tgz",_spec:"0.22.1",_where:"/Users/alex/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"},engines:{node:">=4.0.0"},homepage:"https://github.com/mapbox/mapbox-gl-js#readme",license:"BSD-3-Clause",main:"js/mapbox-gl.js",name:"mapbox-gl",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"}},{}],436:[function(t,e,r){"use strict";function n(t,e,r){for(var n=new Array(t),i=0;ip[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":438,"gl-mat4/clone":180,"gl-mat4/create":181,"gl-mat4/determinant":182,"gl-mat4/invert":186,"gl-mat4/transpose":196,"gl-vec3/cross":260,"gl-vec3/dot":261,"gl-vec3/length":262,"gl-vec3/normalize":264}],438:[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}},{}],439:[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(),f=n(),h=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,f.translate,f.scale,f.skew,f.perspective,f.quaternion);return!(!i||!d||(a(h.translate,u.translate,f.translate,n),a(h.skew,u.skew,f.skew,n),a(h.scale,u.scale,f.scale,n),a(h.perspective,u.perspective,f.perspective,n),c(h.quaternion,u.quaternion,f.quaternion,n),o(t,h.translate,h.scale,h.skew,h.perspective,h.quaternion),0))}},{"gl-mat4/determinant":182,"gl-vec3/lerp":263,"mat4-decompose":437,"mat4-recompose":440,"quat-slerp":490}],440:[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":181,"gl-mat4/fromRotationTranslation":184,"gl-mat4/identity":185,"gl-mat4/multiply":188,"gl-mat4/scale":194,"gl-mat4/translate":195}],441:[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"),f=t("gl-mat4/translate"),h=(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],f=(l=16*r,this.prevMatrix),d=!0;for(c=0;c<16;++c)f[c]=s[l++];var p=this.nextMatrix;for(c=0;c<16;++c)p[c]=s[l++],d=d&&f[c]===p[c];if(u<1e-6||d)for(c=0;c<16;++c)n[c]=f[c];else a(n,f,p,(t-e[r])/u)}var m=this.computedUp;m[0]=n[1],m[1]=n[5],m[2]=n[9],h(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 x=this.computedCenter,b=Math.exp(this.computedRadius[0]);for(c=0;c<3;++c)x[c]=v[c]-n[2+4*c]*b}},p.idle=function(t){if(!(t1&&n(t[o[u-2]],t[o[u-1]],c)<=0;)u-=1,o.pop();for(o.push(l),u=s.length;u>1&&n(t[s[u-2]],t[s[u-1]],c)>=0;)u-=1,s.pop();s.push(l)}r=new Array(s.length+o.length-2);for(var f=0,h=(i=0,o.length);i0;--d)r[f++]=s[d];return r};var n=t("robust-orientation")[3]},{"robust-orientation":515}],443:[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!==h||a!==d||o!==p||r(i))&&(h=0|t,d=a||0,p=o||0,e&&e(h,d,p,m))}function a(t){i(0,t)}function o(){(h||d||p||m.shift||m.alt||m.meta||m.control)&&(d=p=0,h=0,m.shift=m.alt=m.control=m.meta=!1,e&&e(0,0,0,m))}function s(t){r(t)&&e&&e(h,d,p,m)}function l(t){0===n.buttons(t)?i(0,t):i(h,t)}function c(t){i(h|n.buttons(t),t)}function u(t){i(h&~n.buttons(t),t)}function f(){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 h=0,d=0,p=0,m={shift:!1,alt:!1,control:!1,meta:!1},g=!1;f();var v={element:t};return Object.defineProperties(v,{enabled:{get:function(){return g},set:function(e){e?f():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 h},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":445}],444:[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}},{}],445:[function(t,e,r){"use strict";function n(t){return t.target||t.srcElement||window}r.buttons=function(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){if(2===(e=t.which))return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<0;k=k-1&m)b.push(_+"["+A+"+"+g(k)+"]");for(b.push(v(0)),k=0;k=0;--e)L(e,0);var r=[];for(e=0;e0){",h(S[t]),"=1;"),D(t-1,e|1<0&&q.push(s(j,S[B-1])+"*"+o(S[B-1])),R.push(d(j,S[B])+"=("+q.join("-")+")|0")}for(j=0;j=0;--j)H.push(o(S[j]));R.push(k+"=("+H.join("*")+")|0",w+"=mallocUint32("+k+")",_+"=mallocUint32("+k+")",A+"=0"),R.push(p(0)+"=0");for(B=1;B<1< 0"),"function"!=typeof t.vertex&&e("Must specify vertex creation function"),"function"!=typeof t.cell&&e("Must specify cell creation function"),"function"!=typeof t.phase&&e("Must specify phase function");for(var a=t.getters||[],o=new Array(n),s=0;s=0?o[s]=!0:o[s]=!1;return x(t.vertex,t.cell,t.phase,i,r,o)};var _="V",w="P",M="N",k="Q",A="X",T="T"},{"typedarray-pool":554}],448:[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":119}],449:[function(t,e,r){"use strict";function n(t){if(t in o)return o[t];for(var e=[],r=0;r=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=0||e.indexOf(-(l+1))>=0||a.push("&&s[",l,"]>2");for(a.push("){grad",r,"(src.pick(",s.join(),")",c),l=0;l=0||e.indexOf(-(l+1))>=0||a.push(",dst.pick(",s.join(),",",l,")",c);a.push(");")}for(l=0;l1){dst.set(",s.join(),",",u,",0.5*(src.get(",h.join(),")-src.get(",d.join(),")))}else{dst.set(",s.join(),",",u,",0)};"):a.push("if(s[",u,"]>1){diff(",f,",src.pick(",h.join(),")",c,",src.pick(",d.join(),")",c,");}else{zero(",f,");};");break;case"mirror":0===r?a.push("dst.set(",s.join(),",",u,",0);"):a.push("zero(",f,");");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(",f,",src.pick(",p.join(),")",c,",src.pick(",m.join(),")",c,");}else{zero(",f,");};");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<>",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;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),r.norm1=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_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":116}],453:[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":454,ndarray:458}],454:[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":116}],455:[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;r0?s.push(["d",d,"=s",d,"-d",f,"*n",f].join("")):s.push(["d",d,"=s",d].join("")),f=d);var p;0!=(p=t.length-1-l)&&(h>0?s.push(["e",p,"=s",p,"-e",h,"*n",h,",f",p,"=",c[p],"-f",h,"*n",h].join("")):s.push(["e",p,"=s",p,",f",p,"=",c[p]].join("")),h=p)}r.push("var "+s.join(","));var 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 f=[],h=1;h1){for(o.push("dptr=0;sptr=ptr"),h=t.length-1;h>=0;--h)0!==(d=t[h])&&o.push(["for(i",d,"=0;i",d,"b){break __l}"].join("")),h=t.length-1;h>=1;--h)o.push("sptr+=e"+h,"dptr+=f"+h,"}");for(o.push("dptr=cptr;sptr=cptr-s0"),h=t.length-1;h>=0;--h)0!==(d=t[h])&&o.push(["for(i",d,"=0;i",d,"=0;--h)0!==(d=t[h])&&o.push(["for(i",d,"=0;i",d,"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=0;--i)0!==(o=t[i])&&_.push(["for(i",o,"=0;i",o,"1)for(i=0;i1?_.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;o1)for(o=0;o=1;--o)n&&_.push("pivot_ptr+=f"+o),r.length>1?_.push("ptr_shift+=e"+o):_.push("ptr0+=e"+o),_.push("}")}function f(){t.length>1&&k&&_.push("free(pivot1)","free(pivot2)")}function h(e,r){var n="el"+e,i="el"+r;if(t.length>1){var o="__l"+ ++A;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"+ ++A;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 x(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 b(e,r,n){t.length>1?(_.push(["__l",++A,":while(true){"].join("")),c([e],!0,["if(",s("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",A,"}"].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),A=0;_.push(["function ",w,"(",M.join(","),"){"].join(""));var T=["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;E1?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(--greatindex5){"),b("less",1,"++less"),b("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(--great1&&k?new Function("insertionSort","malloc","free",_.join("\n"))(r,k[0],k[1]):new Function("insertionSort",_.join("\n"))(r)}(t,e,v))}},{"typedarray-pool":554}],456:[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":455}],457:[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":119,"ndarray-linear-interpolate":451}],458:[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;tMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&a.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):a.push("ORDER})")),a.push("proto.set=function "+r+"_set("+l.join(",")+",v){"),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=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=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>>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":131}],460:[function(t,e,r){function n(t,e,r,n){return["C",t,e,r,n,r,n]}function i(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}function a(t,e,r,n,i,s,u,f,h,d){if(d)M=d[0],k=d[1],_=d[2],w=d[3];else{var p=o(t,e,-i);t=p.x,e=p.y;var m=(t-(f=(p=o(f,h,-i)).x))/2,g=(e-(h=p.y))/2,v=m*m/(r*r)+g*g/(n*n);v>1&&(r*=v=Math.sqrt(v),n*=v);var y=r*r,x=n*n,b=(s==u?-1:1)*Math.sqrt(Math.abs((y*x-y*g*g-x*m*m)/(y*g*g+x*m*m)));b==1/0&&(b=1);var _=b*r*g/n+(t+f)/2,w=b*-n*m/r+(e+h)/2,M=Math.asin(((e-w)/n).toFixed(9)),k=Math.asin(((h-w)/n).toFixed(9));M=t<_?l-M:M,k=f<_?l-k:k,M<0&&(M=2*l+M),k<0&&(k=2*l+k),u&&M>k&&(M-=2*l),!u&&k>M&&(k-=2*l)}if(Math.abs(k-M)>c){var A=k,T=f,S=h;k=M+c*(u&&k>M?1:-1);var E=a(f=_+r*Math.cos(k),h=w+n*Math.sin(k),r,n,i,0,u,T,S,[k,A,_,w])}var L=Math.tan((k-M)/4),C=4/3*r*L,z=4/3*n*L,D=[2*t-(t+C*Math.sin(M)),2*e-(e-z*Math.cos(M)),f+C*Math.sin(k),h-z*Math.cos(k),f,h];if(d)return D;E&&(D=D.concat(E));for(var I=0;I7&&(r.push(v.splice(0,7)),v.unshift("C"));break;case"S":var x=d,b=p;"C"!=e&&"S"!=e||(x+=x-o,b+=b-l),v=["C",x,b,v[1],v[2],v[3],v[4]];break;case"T":"Q"==e||"T"==e?(f=2*d-f,h=2*p-h):(f=d,h=p),v=i(d,p,f,h,v[1],v[2]);break;case"Q":f=v[1],h=v[2],v=i(d,p,v[1],v[2],v[3],v[4]);break;case"L":v=n(d,p,v[1],v[2]);break;case"H":v=n(d,p,v[1],p);break;case"V":v=n(d,p,d,v[1]);break;case"Z":v=n(d,p,c,u)}e=y,d=v[v.length-2],p=v[v.length-1],v.length>4?(o=v[v.length-4],l=v[v.length-3]):(o=d,l=p),r.push(v)}return r}},{}],461:[function(t,e,r){r.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa){var b=i[c],_=1/Math.sqrt(g*y);for(x=0;x<3;++x){var w=(x+1)%3,M=(x+2)%3;b[x]+=_*(v[w]*m[M]-v[M]*m[w])}}}for(o=0;oa)for(_=1/Math.sqrt(k),x=0;x<3;++x)b[x]*=_;else for(x=0;x<3;++x)b[x]=0}return i},r.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(d):0;for(c=0;c<3;++c)h[c]*=d;i[o]=h}return i}},{}],462:[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;l0){var f=Math.sqrt(u+1);t[0]=.5*(o-l)/f,t[1]=.5*(s-n)/f,t[2]=.5*(r-a)/f,t[3]=.5*f}else{var h=Math.max(e,a,c);f=Math.sqrt(2*h-u+1),e>=h?(t[0]=.5*f,t[1]=.5*(i+r)/f,t[2]=.5*(s+n)/f,t[3]=.5*(o-l)/f):a>=h?(t[0]=.5*(r+i)/f,t[1]=.5*f,t[2]=.5*(l+o)/f,t[3]=.5*(s-n)/f):(t[0]=.5*(n+s)/f,t[1]=.5*(o+l)/f,t[2]=.5*f,t[3]=.5*(r-i)/f)}return t}},{}],464:[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"),f=t("./lib/quatFromFrame"),h=o.prototype;h.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},h.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;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,f=0;f<3;++f)u+=r[l+4*f]*i[f];r[12+l]=-u}},h.getMatrix=function(t,e){this.recalcMatrix(t);var r=this.computedMatrix;if(e){for(var n=0;n<16;++n)e[n]=r[n];return e}return r},h.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},h.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},h.pan=function(t,e,r,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],f=a[4],h=a[8],d=u*o+f*s+h*l,p=n(u-=o*d,f-=s*d,h-=l*d);u/=p,f/=p,h/=p;var m=a[2],g=a[6],v=a[10],y=m*o+g*s+v*l,x=m*u+g*f+v*h,b=n(m-=y*o+x*u,g-=y*s+x*f,v-=y*l+x*h);m/=b,g/=b,v/=b;var _=u*e+o*r,w=f*e+s*r,M=h*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))},h.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],f=o[5],h=o[9],d=o[2],p=o[6],m=o[10],g=e*s+r*u,v=e*l+r*f,y=e*c+r*h,x=-(p*y-m*v),b=-(m*g-d*y),_=-(d*v-p*g),w=Math.sqrt(Math.max(0,1-Math.pow(x,2)-Math.pow(b,2)-Math.pow(_,2))),M=i(x,b,_,w);M>1e-6?(x/=M,b/=M,_/=M,w/=M):(x=b=_=0,w=1);var k=this.computedRotation,A=k[0],T=k[1],S=k[2],E=k[3],L=A*w+E*x+T*_-S*b,C=T*w+E*b+S*x-A*_,z=S*w+E*_+A*b-T*x,D=E*w-A*x-T*b-S*_;if(a){x=d,b=p,_=m;var I=Math.sin(a)/n(x,b,_);x*=I,b*=I,_*=I,D=D*(w=Math.cos(e))-(L=L*w+D*x+C*_-z*b)*x-(C=C*w+D*b+z*x-L*_)*b-(z=z*w+D*_+L*b-C*x)*_}var P=i(L,C,z,D);P>1e-6?(L/=P,C/=P,z/=P,D/=P):(L=C=z=0,D=1),this.rotation.set(t,L,C,z,D)},h.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;f(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])},h.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},h.setMatrix=function(t,e){var r=this.computedRotation;f(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)},h.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},h.setDistanceLimits=function(t,e){t=t>0?Math.log(t):-1/0,e=e>0?Math.log(e):1/0,e=Math.max(e,t),this.radius.bounds[0][0]=t,this.radius.bounds[1][0]=e},h.getDistanceLimits=function(t){var e=this.radius.bounds;return t?(t[0]=Math.exp(e[0][0]),t[1]=Math.exp(e[1][0]),t):[Math.exp(e[0][0]),Math.exp(e[1][0])]},h.toJSON=function(){return this.recalcMatrix(this.lastT()),{center:this.computedCenter.slice(),rotation:this.computedRotation.slice(),distance:Math.log(this.computedRadius[0]),zoomMin:this.radius.bounds[0][0],zoomMax:this.radius.bounds[1][0]}},h.fromJSON=function(t){var e=this.lastT(),r=t.center;r&&this.center.set(e,r[0],r[1],r[2]);var n=t.rotation;n&&this.rotation.set(e,n[0],n[1],n[2],n[3]);var i=t.distance;i&&i>0&&this.radius.set(e,Math.log(i)),this.setDistanceLimits(t.zoomMin,t.zoomMax)}},{"./lib/quatFromFrame":463,"filtered-vector":142,"gl-mat4/fromQuat":183,"gl-mat4/invert":186,"gl-mat4/lookAt":187}],465:[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":507}],466:[function(t,e,r){e.exports=function(t){var e=[];return t.replace(i,function(t,r,i){var o=r.toLowerCase();for(i=function(t){var e=t.match(a);return e?e.map(Number):[]}(i),"m"==o&&i.length>2&&(e.push([r].concat(i.splice(0,2))),o="l",r="m"==r?"l":"L");;){if(i.length==n[o])return i.unshift(r),e.push(i);if(i.length=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=-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=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;l55295&&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>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(e127;);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;e268435455?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=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,f,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,h,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":469}],471:[function(t,e,r){"use strict";e.exports=function(t){var e=t.length;if(e0;--o)a=l[o],r=s[o],s[o]=s[a],s[a]=r,l[o]=l[r],l[r]=a,c=(c+r)*o;return n.freeUint32(l),n.freeUint32(s),c},r.unrank=function(t,e,r){switch(t){case 0:return r||[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}var n,i,a,o=1;for((r=r||new Array(t))[0]=0,a=1;a0;--a)e=e-(n=e/o|0)*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r}},{"invert-permutation":280,"typedarray-pool":554}],473:[function(t,e,r){"use strict";function n(t){return i[t]?i[t]:("string"==typeof t&&(t=i[t]=t.split(/\s*,\s*|\s+/)),t)}e.exports=function(t,e,r){var i,a,o={};if("string"==typeof e&&(e=n(e)),Array.isArray(e)){var s={};for(a=0;a0){o=c[u][i][0],l=u;break}s=o[1^l];for(var f=0;f<2;++f)for(var h=c[f][i],d=0;d0&&(o=p,s=m,l=f)}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],f=t,h=s[1],d=i(u,f,!0);if(n(e[u],e[f],e[h],e[d])<0)break;s.push(t),l=i(u,f)}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;u0;){c[0][u].length;var m=a(u,d);o(0,m)?p.push.apply(p,m):(p.length>0&&h.push(p),p=m)}p.length>0&&h.push(p)}return h};var n=t("compare-angle")},{"compare-angle":106}],475:[function(t,e,r){"use strict";e.exports=function(t,e){for(var r=n(t,e.length),i=new Array(e.length),a=new Array(e.length),o=[],s=0;s0;){i[d=o.pop()]=!1;var c=r[d];for(s=0;s0})).length,g=new Array(m),v=new Array(m);for(d=0;d0;){var N=O.pop(),j=E[N];c(j,function(t,e){return t-e});var B,U=j.length,V=F[N];for(0===V&&(B=[H=p[N]]),d=0;d=0)&&(F[q]=1^V,O.push(q),0===V)){var H;r(H=p[q])||(H.reverse(),B.push(H))}}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":475,"edges-to-adjacency-list":136,"planar-dual":474,"point-in-big-polygon":478,"robust-sum":520,"two-product":552,uniq:556}],477:[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}},{}],478:[function(t,e,r){function n(){return!0}function i(t){for(var e={},r=0;r0&&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]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":70,"interval-tree-1d":279,"robust-orientation":515,"slab-decomposition":532}],479:[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"),f=!1,h=o();i={buildLog:function(t){return!0===t?f=a():!1===t&&(f=!1),!1!==f&&f.list},epsilon:function(t){return h.epsilon(t)},segments:function(t){var e=s(!0,h,f);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:s(!1,h,f).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:c.union(t.combined,f),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:c.intersect(t.combined,f),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:c.difference(t.combined,f),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:c.differenceRev(t.combined,f),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:c.xor(t.combined,f),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:l(t.segments,h,f),inverted:t.inverted}},polygonFromGeoJSON:function(t){return u.toPolygon(i,t)},polygonToGeoJSON:function(t){return u.fromPolygon(i,h,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":480,"./lib/epsilon":481,"./lib/geojson":482,"./lib/intersecter":483,"./lib/segment-chainer":485,"./lib/segment-selector":486}],480:[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")}}}},{}],481:[function(t,e,r){e.exports=function(t){"number"!=typeof t&&(t=1e-10);var e={epsilon:function(e){return"number"==typeof e&&(t=e),t},pointAboveOrOnLine:function(e,r,n){var i=r[0],a=r[1],o=n[0],s=n[1],l=e[0];return(o-i)*(e[1]-a)-(s-a)*(l-i)>=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-i>t&&(a-c)*(i-u)/(o-u)+c-n>t&&(s=!s),a=c,o=u}return s}};return e}},{}],482:[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;i0})}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 f=e.linesIntersect(o,s,c,u);if(!1===f){if(!e.pointsCollinear(o,s,c))return!1;if(e.pointsSame(o,u)||e.pointsSame(s,c))return!1;var h=e.pointsSame(o,c),d=e.pointsSame(s,u);if(h&&d)return n;var p=!h&&e.pointBetween(o,c,u),m=!d&&e.pointBetween(s,c,u);if(h)return m?l(n,s):l(t,u),n;p&&(d||(m?l(n,s):l(t,u)),l(n,o))}else 0===f.alongA&&(-1===f.alongB?l(t,c):0===f.alongB?l(t,f.pt):1===f.alongB&&l(t,u)),0===f.alongB&&(-1===f.alongA?l(n,o):0===f.alongA?l(n,f.pt):1===f.alongA&&l(n,s));return!1}for(var c=n.create(),f=[];!u.isEmpty();){var h=u.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var d=o(h),p=d.before?d.before.ev:null,m=d.after?d.after.ev:null;r&&r.tempStatus(h.seg,!!p&&p.seg,!!m&&m.seg);var g=function(){if(p){var t=s(h,p);if(t)return t}return!!m&&s(h,m)}();if(g&&(t?(v=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(g.seg.myFill.above=!g.seg.myFill.above):g.seg.otherFill=h.seg.myFill,r&&r.segmentUpdate(g.seg),h.other.remove(),h.remove()),u.getHead()!==h){r&&r.rewind(h.seg);continue}if(t){var v;v=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=m?m.seg.myFill.above:i,h.seg.myFill.above=v?!h.seg.myFill.below:h.seg.myFill.below}else if(null===h.seg.otherFill){var y;y=m?h.primary===m.primary?m.seg.otherFill.above:m.seg.myFill.above:h.primary?a:i,h.seg.otherFill={above:y,below:y}}r&&r.status(h.seg,!!p&&p.seg,!!m&&m.seg),h.other.status=d.insert(n.node({ev:h}))}else{var x=h.status;if(null===x)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(c.exists(x.prev)&&c.exists(x.next)&&s(x.prev.ev,x.next.ev),r&&r.statusRemove(x.ev.seg),x.remove(),!h.primary){var b=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=b}f.push(h.seg)}u.getHead().remove()}return r&&r.done(),f}var u=n.create();return t?{addRegion:function(t){for(var r,n=t[t.length-1],a=0;a=c?(b=1,y=c+2*h+p):y=h*(b=-h/c)+p):(b=0,d>=0?(_=0,y=p):-d>=f?(_=1,y=f+2*d+p):y=d*(_=-d/f)+p);else if(_<0)_=0,h>=0?(b=0,y=p):-h>=c?(b=1,y=c+2*h+p):y=h*(b=-h/c)+p;else{var w=1/x;y=(b*=w)*(c*b+u*(_*=w)+2*h)+_*(u*b+f*_+2*d)+p}else{var M,k,A,T;b<0?(k=f+d)>(M=u+h)?(A=k-M)>=(T=c-2*u+f)?(b=1,_=0,y=c+2*h+p):y=(b=A/T)*(c*b+u*(_=1-b)+2*h)+_*(u*b+f*_+2*d)+p:(b=0,k<=0?(_=1,y=f+2*d+p):d>=0?(_=0,y=p):y=d*(_=-d/f)+p):_<0?(k=c+h)>(M=u+d)?(A=k-M)>=(T=c-2*u+f)?(_=1,b=0,y=f+2*d+p):y=(b=1-(_=A/T))*(c*b+u*_+2*h)+_*(u*b+f*_+2*d)+p:(_=0,k<=0?(b=1,y=c+2*h+p):h>=0?(b=0,y=p):y=h*(b=-h/c)+p):(A=f+d-u-h)<=0?(b=0,_=1,y=f+2*d+p):A>=(T=c-2*u+f)?(b=1,_=0,y=c+2*h+p):y=(b=A/T)*(c*b+u*(_=1-b)+2*h)+_*(u*b+f*_+2*d)+p}var S=1-b-_;for(l=0;l1)for(var r=1;r1&&(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=55296&&e<=56319&&i65535&&(e+=P((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=P(t)}).join("")}function c(t){return t-48<10?t-22:t-65<26?t-65:t-97<26?t-97:b}function u(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function f(t,e,r){var n=0;for(t=r?I(t/k):t>>1,t+=I(t/e);t>D*w>>1;n+=b)t=I(t/D);return I(n+(D+1)*t/(t+M))}function h(t){var e,r,n,a,o,s,u,h,d,p,m=[],g=t.length,v=0,y=T,M=A;for((r=t.lastIndexOf(S))<0&&(r=0),n=0;n=128&&i("not-basic"),m.push(t.charCodeAt(n));for(a=r>0?r+1:0;a=g&&i("invalid-input"),((h=c(t.charCodeAt(a++)))>=b||h>I((x-v)/s))&&i("overflow"),v+=h*s,d=u<=M?_:u>=M+w?w:u-M,!(hI(x/(p=b-d))&&i("overflow"),s*=p;M=f(v-o,e=m.length+1,0==o),I(v/e)>x-y&&i("overflow"),y+=I(v/e),v%=e,m.splice(v++,0,y)}return l(m)}function d(t){var e,r,n,a,o,l,c,h,d,p,m,g,v,y,M,k=[];for(g=(t=s(t)).length,e=T,r=0,o=A,l=0;l=e&&mI((x-r)/(v=n+1))&&i("overflow"),r+=(c-e)*v,e=c,l=0;lx&&i("overflow"),m==e){for(h=r,d=b;p=d<=o?_:d>=o+w?w:d-o,!(h= 0x80 (not a basic code point)","invalid-input":"Invalid input"},D=b-_,I=Math.floor,P=String.fromCharCode;if(v={version:"1.4.1",ucs2:{decode:s,encode:l},decode:h,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)?h(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:{})},{}],490:[function(t,e,r){e.exports=t("gl-quat/slerp")},{"gl-quat/slerp":236}],491:[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=0?(f=m.substr(0,g),h=m.substr(g+1)):(f=m,h=""),d=decodeURIComponent(f),p=decodeURIComponent(h),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)}},{}],492:[function(t,e,r){"use strict";function n(t,e){if(t.map)return t.map(e);for(var r=[],n=0;ne?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),f=.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+f)),Math.min(a,Math.floor(e+(s-l)*u/s+f)),o)}var h=t[e],d=r,p=a;for(i(t,r,e),o(t[a],h)>0&&i(t,r,a);d0;)p--}0===o(t[r],h)?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},{}],495:[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;a0){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":90,"compare-cell":107,"compare-oriented-cell":108}],500:[function(t,e,r){"use strict";var n=t("array-bounds"),i=t("color-normalize"),a=t("update-diff"),o=t("pick-by-alias"),s=t("object-assign"),l=t("flatten-vertex-data"),c=t("to-float32"),u=c.float32,f=c.fract32;e.exports=function(t,e){function r(t){t?p(t):null===t&&m(),c()}function c(e){if("number"==typeof e)return d(e);e&&!Array.isArray(e)&&(e=[e]),t._refresh(),k.forEach(function(t,r){t&&(e&&(e[r]?t.draw=!0:t.draw=!1),t.draw?d(r):t.draw=!0)})}function d(t){"number"==typeof t&&(t=k[t]),null!=t&&t&&t.count&&t.color&&t.opacity&&t.positions&&t.positions.length>1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],g(t),t.after&&t.after(t))}function p(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(k=t.map(function(t,c){var u=k[c];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=o(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),u||(k[c]=u={id:c,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=s({},M,t)),a(u,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=l(t),r+=t.length,t},positions:function(t,r){return t=l(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=n(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var a=0;a2&&(t._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&x(e),e.thickness&&e.color&&(e.scaleRatio=[e.scale[0]*e.viewport.width,e.scale[1]*e.viewport.height],e.scaleRatio[0]>L||e.scaleRatio[1]>L?y(e):"rect"===e.join||!e.join&&(e.thickness<=2||e.positions.length>=C)?y(e):v(e),e.after&&e.after(e)))}function m(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0;if(S=t.map(function(t,r){var s=S[r];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=l(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color stroke colors stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow",after:"after callback done pass"}),s||(S[r]=s={id:r,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,offset:0,dashLength:0,hole:!0},t=o({},T,t)),c(s,t,[{thickness:parseFloat,opacity:parseFloat,miterLimit:parseFloat,overlay:Boolean,join:function(t){return t},after:function(t){return t},hole:function(t){return t||[]},positions:function(t,r,n){t=u(t,"float64");var i=Math.floor(t.length/2),o=a(t,2);return r.range||n.range||(n.range=o),r.count=i,r.bounds=o,e+=i,t},fill:function(t){return t?i(t,"uint8"):null},dashes:function(t,e,r){var n,i=e.dashLength;if(!t||t.length<2)i=1,n=new Uint8Array([255,255,255,255,255,255,255,255]);else{i=0;for(var a=0;a=4&&e.positions[0]===e.positions[e.positions.length-2]&&e.positions[1]===e.positions[e.positions.length-1]},positions:function(t,e,r){if(e.fill&&t.length){for(var n=[],i={},a=0,o=0,s=0,l=e.count;o 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord + translate) * scale;\n\tvec2 aBotPosition = (aBotCoord + translate) * scale;\n\n\tvec2 bTopPosition = (bTopCoord + translate) * scale;\n\tvec2 bBotPosition = (bBotCoord + translate) * scale;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = (aCoord + translate) * scaleRatio + viewport.xy;\n\tendCoord = (bCoord + translate) * scaleRatio + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = (startCutoff + translate.xyxy) * scaleRatio.xyxy;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = (endCutoff + translate.xyxy) * scaleRatio.xyxy;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = (startCutoff + translate.xyxy) * scaleRatio.xyxy;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = (endCutoff + translate.xyxy) * scaleRatio.xyxy;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:s(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform vec2 dashShape;\nuniform float dashLength, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t * dashLength * 2. / dashShape.x, (id + .5) / dashShape.y)).r;\n\n\tgl_FragColor = fragColor * dash;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:_,divisor:0,stride:8,offset:0},lineTop:{buffer:_,divisor:0,stride:8,offset:4},aColor:{buffer:b,stride:4,offset:function(t,e){return 4*e.offset},divisor:1},bColor:{buffer:b,stride:4,offset:function(t,e){return 4*e.offset+4},divisor:1},prevCoord:{buffer:w,stride:8,offset:function(t,e){return 8*e.offset},divisor:1},aCoord:{buffer:w,stride:8,offset:function(t,e){return 8+8*e.offset},divisor:1},bCoord:{buffer:w,stride:8,offset:function(t,e){return 16+8*e.offset},divisor:1},nextCoord:{buffer:w,stride:8,offset:function(t,e){return 24+8*e.offset},divisor:1}}},z)),y=t(o({vert:s(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;\nattribute vec4 color;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, scaleFract, translate, translateFract, scaleRatio;\nuniform float thickness, pixelRatio, id;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nconst float MAX_LINES = 256.;\n\nvec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {\n return (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n}\n\nvoid main() {\n\t// vec2 scaleRatio = scale * viewport.zw;\n\tvec2 normalWidth = thickness / scaleRatio;\n\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineOffset = lineTop * 2. - 1.;\n\tfloat depth = (MAX_LINES - 1. - id) / (MAX_LINES);\n\n\tvec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);\n\ttangent = normalize(diff * scaleRatio);\n\tvec2 normal = vec2(-tangent.y, tangent.x);\n\n\tvec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart\n\t\t+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd\n\n\t\t+ thickness * normal * .5 * lineOffset / viewport.zw;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]),frag:s(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform vec2 dashShape;\nuniform float dashLength, pixelRatio, thickness, opacity, id;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvoid main() {\n\tfloat alpha = 1.;\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t * dashLength * 2. / dashShape.x, (id + .5) / dashShape.y)).r;\n\n\tgl_FragColor = fragColor * dash;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:_,divisor:0,stride:8,offset:0},lineTop:{buffer:_,divisor:0,stride:8,offset:4},aCoord:{buffer:w,stride:8,offset:function(t,e){return 8+8*e.offset},divisor:1},bCoord:{buffer:w,stride:8,offset:function(t,e){return 16+8*e.offset},divisor:1},aCoordFract:{buffer:M,stride:8,offset:function(t,e){return 8+8*e.offset},divisor:1},bCoordFract:{buffer:M,stride:8,offset:function(t,e){return 16+8*e.offset},divisor:1},color:{buffer:b,stride:4,offset:function(t,e){return 4*e.offset},divisor:1}}},z)),x=t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:s(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract, scaleRatio;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]),frag:s(["precision highp float;\n#define GLSLIFY 1\n\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= opacity;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:w,stride:8,offset:function(t,e){return 8+8*e.offset}},positionFract:{buffer:M,stride:8,offset:function(t,e){return 8+8*e.offset}}},blend:z.blend,depth:{enable:!1},scissor:z.scissor,stencil:z.stencil,viewport:z.viewport}),o(r,{update:m,draw:d,destroy:g,regl:t,gl:A,canvas:A.canvas,lines:S}),r}},{"array-bounds":48,"array-normalize":49,"color-normalize":99,earcut:135,"flatten-vertex-data":143,glslify:502,"object-assign":462,"pick-by-alias":473,"update-diff":558}],502:[function(t,e,r){arguments[4][169][0].apply(r,arguments)},{dup:169}],503:[function(t,e,r){"use strict";var n=t("color-normalize"),i=t("array-bounds"),a=t("color-id"),o=t("snap-points-2d"),s=t("object-assign"),l=t("glslify"),c=t("binary-search-bounds"),u=t("pick-by-alias"),f=t("update-diff"),h=t("flatten-vertex-data"),d=t("is-iexplorer"),p=t("to-float32"),m=p.float32,g=p.fract32;e.exports=function(t,e){function r(t){t?x(t):null===t&&M(),p()}function p(t){if("number"==typeof t)return v(t);Array.isArray(t)?t.forEach(function(t,e){if(null!=t)return t.length?v(t,e):v(t)}):O.forEach(function(t,e){t&&v(e)})}function v(e,r){"number"==typeof e&&(e=O[e]);var n;if(Array.isArray(e)&&(n=e,e=O[r]),e&&e.count&&e.opacity){var i;if(n){i=Array(e.count);for(var a=0;a1)){var g=m.offset,v=m.count+g,y=c.ge(f,i[0],g,v-1),x=c.lt(f,i[2],y,v-1)+1;if(!(x<=y))if(r){var b=n(t.data.subarray(y,x),r);l.push(s({},e,{elements:b,marker:F[h],offset:0,count:b.length}))}else l.push(s({},e,{elements:t.elements,marker:F[h],offset:y,count:x-y}))}}return l}function x(e){if(e){null!=e.length?"number"==typeof e[0]&&(e=[{positions:e}]):Array.isArray(e)||(e=[e]);var r=0,n=0,a=0;O=e.map(function(e,l){var c=O[l];return e?("function"==typeof e?e={after:e}:"number"==typeof e[0]&&(e={positions:e}),e=u(e,{positions:"positions data points",snap:"snap cluster",size:"sizes size radius",borderSize:"borderSizes borderSize stroke-width strokeWidth outline",color:"colors color fill fill-color fillColor",borderColor:"borderColors borderColor stroke stroke-color strokeColor",palette:"palette swatch",marker:"markers marker shape",range:"range dataBox",viewport:"viewport viewBox",opacity:"opacity alpha"}),c||(O[l]=c={id:l,scale:null,translate:null,scaleFract:null,translateFract:null,markerIds:[]},e=s({},P,e)),!e.positions||"marker"in e||(e.marker=c.marker,delete c.marker),f(c,e,[{snap:!0,size:function(t){return n+=t.length?1:0,t},borderSize:function(t){return n+=t.length?1:0,t},opacity:parseFloat,color:function(t){return t=w(t),a++,t},borderColor:function(t){return t=w(t),a++,t},positions:function(t,e,n){t=h(t,"float64");var a=e.count=Math.floor(t.length/2),o=e.bounds=a?i(t,2):null;return n.range||e.range||(delete e.range,n.range=o),e.offset=r,r+=a,n.marker||e.marker||(delete e.marker,n.marker=null),t}},{marker:function(t,e,r){if(e.markerIds.length=0,t&&"number"!=typeof t[0])for(var n=0,i=t.length;ni)){c.snap=!0;var h=c.x=Array(u),d=c.w=Array(u),p=void 0;if(n.length>1){p=Array(2*u);for(var m=0;m=0)return r;var n;if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)n=e;else{n=new Uint8Array(e.length);for(var i=0,a=e.length;i 1.0) {\n discard;\n }\n\n float centerFraction = fragBorderSize == 0. ? 2. : fragSize / (fragSize + fragBorderSize + 1.25);\n\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, 1.);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}\n"]),vert:l(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\nattribute float size, borderSize;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\n\nconst float paletteSize = 4096., maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth, fragBorderSize, fragSize;\n\nvoid main() {\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n fragBorderSize = borderSize;\n fragSize = size;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t+ (position + translate) * scaleFract\n\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = borderSize == 0. ? 2. : 1. - 2. * borderSize / (size + borderSize);\n fragWidth = 1. / gl_PointSize;\n}\n"]),uniforms:{color:function(t,e){var r=e.color.length?e.color[0]:e.color;return D.slice(4*r,4*r+4).map(function(t){return t/255})},borderColor:function(t,e){var r=e.borderColor.length?e.borderColor[0]:e.borderColor;return D.slice(4*r,4*r+4).map(function(t){return t/255})},pixelRatio:t.context("pixelRatio"),palette:C,scale:t.prop("scale"),scaleFract:t.prop("scaleFract"),translate:t.prop("translate"),translateFract:t.prop("translateFract"),opacity:t.prop("opacity"),marker:t.prop("marker")},attributes:{position:S,positionFract:E,size:B.attributes.size,borderSize:B.attributes.borderSize}}));else{var U=s({},B);U.frag=l(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragWidth, fragBorderColorLevel, fragColorLevel;\n\nuniform sampler2D marker;\nuniform float pixelRatio, opacity;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float dist = texture2D(marker, gl_PointCoord).r, delta = fragWidth;\n\n //max-distance alpha\n if (dist < 0.003) discard;\n\n //null-border case\n if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {\n float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);\n gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a);\n return;\n }\n\n float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);\n float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);\n\n vec4 color = fragBorderColor;\n color.a *= borderColorAmt;\n color = mix(color, fragColor, colorAmt);\n color.a *= opacity;\n\n gl_FragColor = color;\n}\n"]),U.vert=l(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\nattribute float size, borderSize;\nattribute float colorId, borderColorId;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\n\nconst float paletteSize = 4096., maxSize = 100.;\nconst float borderLevel = .5;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragPointSize, fragBorderRadius,\n\t\tfragWidth, fragBorderColorLevel, fragColorLevel;\n\nvoid main() {\n vec4 color = texture2D(palette, vec2((colorId + .5) / paletteSize, 0));\n vec4 borderColor = texture2D(palette, vec2((borderColorId + .5) / paletteSize, 0));\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = 2. * size * pixelRatio;\n fragPointSize = size * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragColor = color;\n fragBorderColor = borderColor;\n fragWidth = 1. / gl_PointSize;\n\n fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);\n fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);\n}\n"]),k=t(U);var V=s({},B);V.frag=l(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor, fragBorderColor;\n\nuniform float opacity;\nvarying float fragBorderRadius, fragWidth;\n\nvoid main() {\n\tfloat radius, alpha = 1.0, delta = fragWidth;\n\n\tradius = length(2.0 * gl_PointCoord.xy - 1.0);\n\n\tif(radius > 1.0 + delta) {\n\t\tdiscard;\n\t\treturn;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),V.vert=l(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\nattribute float size, borderSize;\nattribute float colorId, borderColorId;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\n\nconst float paletteSize = 4096., maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nvoid main() {\n vec4 color = texture2D(palette, vec2((colorId + .5) / paletteSize, 0));\n vec4 borderColor = texture2D(palette, vec2((borderColorId + .5) / paletteSize, 0));\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t+ (position + translate) * scaleFract\n\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = borderSize == 0. ? 2. : 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),A=t(V)}return s(r,{update:x,draw:p,destroy:M,regl:t,gl:z,canvas:z.canvas,groups:O,markers:R}),r}},{"array-bounds":48,"binary-search-bounds":504,"color-id":97,"color-normalize":99,"flatten-vertex-data":143,glslify:505,"is-iexplorer":284,"object-assign":462,"pick-by-alias":473,"snap-points-2d":534,"to-float32":547,"update-diff":558}],504:[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)}},{}],505:[function(t,e,r){arguments[4][169][0].apply(r,arguments)},{dup:169}],506:[function(t,e,r){!function(t,n){"object"==typeof r&&void 0!==e?e.exports=n():t.createREGL=n()}(this,function(){function t(t,e){this.id=j++,this.type=t,this.data=e}function e(t){if(0===t.length)return[];var r=t.charAt(0),n=t.charAt(t.length-1);if(1>>=e,r=(255>>=r,e|=r,r=(15>>=r,e|=r,r=(3>>r>>1}function c(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=G[l(t)>>2]).length?e.pop():new ArrayBuffer(t)}function u(t){G[l(t.byteLength)>>2].push(t)}function f(t,e,r,n,i,a){for(var o=0;o>>31<<15,i=(a<<1>>>24)-127,a=a>>13&1023;e[r]=-24>i?n:-14>i?n+(a+1024>>-14-i):15>=i,r.height>>=i,d(r,n[i]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function L(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&F(this)}}),s.profile&&(a.getTotalTextureSize=function(){var t=0;return Object.keys(ft).forEach(function(e){t+=ft[e].stats.size}),t}),{create2D:function(e,r){function n(t,e){var r=i.texInfo;C.call(r);var a=E();return"number"==typeof t?"number"==typeof e?A(a,0|t,0|e):A(a,0|t,0|t):t?(z(r,t),T(a,t)):A(a,1,1),r.genMipmaps&&(a.mipmask=(a.width<<1)-1),i.mipmask=a.mipmask,c(i,a),i.internalformat=a.internalformat,n.width=a.width,n.height=a.height,P(i),S(a,3553),D(r,3553),O(),L(a),s.profile&&(i.stats.size=M(i.internalformat,i.type,a.width,a.height,r.genMipmaps,!1)),n.format=$[i.internalformat],n.type=tt[i.type],n.mag=et[r.magFilter],n.min=rt[r.minFilter],n.wrapS=ot[r.wrapS],n.wrapT=ot[r.wrapT],n}var i=new I(3553);return ft[i.id]=i,a.textureCount++,n(e,r),n.subimage=function(t,e,r,a){e|=0,r|=0,a|=0;var o=m();return c(o,i),o.width=0,o.height=0,d(o,t),o.width=o.width||(i.width>>a)-e,o.height=o.height||(i.height>>a)-r,P(i),p(o,3553,e,r,a),O(),k(o),n},n.resize=function(e,r){var a=0|e,o=0|r||a;if(a===i.width&&o===i.height)return n;n.width=i.width=a,n.height=i.height=o,P(i);for(var l=0;i.mipmask>>l;++l)t.texImage2D(3553,l,i.format,a>>l,o>>l,0,i.format,i.type,null);return O(),s.profile&&(i.stats.size=M(i.internalformat,i.type,a,o,!1,!1)),n},n._reglType="texture2d",n._texture=i,s.profile&&(n.stats=i.stats),n.destroy=function(){i.decRef()},n},createCube:function(e,r,n,i,o,l){function f(t,e,r,n,i,a){var o,l=h.texInfo;for(C.call(l),o=0;6>o;++o)g[o]=E();if("number"!=typeof t&&t){if("object"==typeof t)if(e)T(g[0],t),T(g[1],e),T(g[2],r),T(g[3],n),T(g[4],i),T(g[5],a);else if(z(l,t),u(h,t),"faces"in t)for(t=t.faces,o=0;6>o;++o)c(g[o],h),T(g[o],t[o]);else for(o=0;6>o;++o)T(g[o],t)}else for(t=0|t||1,o=0;6>o;++o)A(g[o],t,t);for(c(h,g[0]),h.mipmask=l.genMipmaps?(g[0].width<<1)-1:g[0].mipmask,h.internalformat=g[0].internalformat,f.width=g[0].width,f.height=g[0].height,P(h),o=0;6>o;++o)S(g[o],34069+o);for(D(l,34067),O(),s.profile&&(h.stats.size=M(h.internalformat,h.type,f.width,f.height,l.genMipmaps,!0)),f.format=$[h.internalformat],f.type=tt[h.type],f.mag=et[l.magFilter],f.min=rt[l.minFilter],f.wrapS=ot[l.wrapS],f.wrapT=ot[l.wrapT],o=0;6>o;++o)L(g[o]);return f}var h=new I(34067);ft[h.id]=h,a.cubeCount++;var g=Array(6);return f(e,r,n,i,o,l),f.subimage=function(t,e,r,n,i){r|=0,n|=0,i|=0;var a=m();return c(a,h),a.width=0,a.height=0,d(a,e),a.width=a.width||(h.width>>i)-r,a.height=a.height||(h.height>>i)-n,P(h),p(a,34069+t,r,n,i),O(),k(a),f},f.resize=function(e){if((e|=0)!==h.width){f.width=h.width=e,f.height=h.height=e,P(h);for(var r=0;6>r;++r)for(var n=0;h.mipmask>>n;++n)t.texImage2D(34069+r,n,h.format,e>>n,e>>n,0,h.format,h.type,null);return O(),s.profile&&(h.stats.size=M(h.internalformat,h.type,f.width,f.height,!1,!0)),f}},f._reglType="textureCube",f._texture=h,s.profile&&(f.stats=h.stats),f.destroy=function(){h.decRef()},f},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);D(e.texInfo,e.target)})}}}function A(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function T(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;rt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return f.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);H(l).forEach(e),l={},H(c).forEach(e),c={},f.forEach(function(e){t.deleteProgram(e.program)}),f.length=0,u={},r.shaderCount=0},program:function(t,e,i){var a=u[e];a||(a=u[e]={});var o=a[t];return o||(o=new function(t,e){this.id=h++,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),a[t]=o,f.push(o)),o},restore:function(){l={},c={};for(var t=0;t="+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",o,"(",i,".buffer)){",u,"=",s,".createStream(",34962,",",i,".buffer);","}else{",u,"=",s,".getBuffer(",i,".buffer);","}",f,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",u,".dtype;",l.normalized,"=!!",i,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",s,".destroyStream(",u,");","}"),l})}),o}(r),u.context=function(t){var e=t.static,r=t.dynamic,n={};return Object.keys(e).forEach(function(t){var r=e[t];n[t]=P(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]=O(e,function(t,r){return t.invoke(r,e)})}),n}(o),u}function w(t,e,r){var n=t.shared.context,i=t.scope();Object.keys(r).forEach(function(a){e.save(n,"."+a),i(n,".",a,"=",r[a].append(t,e),";")}),e(i)}function M(t,e,r,n){var i,a=(s=t.shared).gl,o=s.framebuffer;J&&(i=e.def(s.extensions,".webgl_draw_buffers"));var s=(l=t.constants).drawBuffer,l=l.backBuffer;t=r?r.append(t,e):e.def(o,".next"),n||e("if(",t,"!==",o,".cur){"),e("if(",t,"){",a,".bindFramebuffer(",36160,",",t,".framebuffer);"),J&&e(i,".drawBuffersWEBGL(",s,"[",t,".colorAttachments.length]);"),e("}else{",a,".bindFramebuffer(",36160,",null);"),J&&e(i,".drawBuffersWEBGL(",l,");"),e("}",o,".cur=",t,";"),n||e("}")}function k(t,e,r){var n=t.shared,i=n.gl,a=t.current,o=t.next,l=n.current,c=n.next,u=t.cond(l,".dirty");$.forEach(function(e){if(!((e=g(e))in r.state)){var n,f;if(e in o){n=o[e],f=a[e];var h=s(K[e].length,function(t){return u.def(n,"[",t,"]")});u(t.cond(h.map(function(t,e){return t+"!=="+f+"["+e+"]"}).join("||")).then(i,".",rt[e],"(",h,");",h.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";"))}else n=u.def(c,".",e),h=t.cond(n,"!==",l,".",e),u(h),e in et?h(t.cond(n).then(i,".enable(",et[e],");").else(i,".disable(",et[e],");"),l,".",e,"=",n,";"):h(i,".",rt[e],"(",n,");",l,".",e,"=",n,";")}}),0===Object.keys(r.state).length&&u(l,".dirty=false;"),e(u)}function A(t,e,r,n){var i=t.shared,a=t.current,o=i.current,s=i.gl;z(Object.keys(r)).forEach(function(i){var l=r[i];if(!n||n(l)){var c=l.append(t,e);if(et[i]){var u=et[i];I(l)?c?e(s,".enable(",u,");"):e(s,".disable(",u,");"):e(t.cond(c).then(s,".enable(",u,");").else(s,".disable(",u,");")),e(o,".",i,"=",c,";")}else if(v(c)){var f=a[i];e(s,".",rt[i],"(",c,");",c.map(function(t,e){return f+"["+e+"]="+t}).join(";"),";")}else e(s,".",rt[i],"(",c,");",o,".",i,"=",c,";")}})}function T(t,e){X&&(t.instancing=e.def(t.shared.extensions,".angle_instanced_arrays"))}function S(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(h,".count+=",i,";"):t(h,".count++;"),p&&(n?(u=e.def(),t(u,"=",m,".getNumPendingQueries();")):t(m,".beginQuery(",h,");"))}function s(t){t(h,".cpuTime+=",a(),"-",c,";"),p&&(n?t(m,".pushScopeStats(",u,",",m,".getNumPendingQueries(),",h,");"):t(m,".endQuery();"))}function l(t){var r=e.def(d,".profile");e(d,".profile=",t,";"),e.exit(d,".profile=",r,";")}var c,u,f=t.shared,h=t.stats,d=f.current,m=f.timer;if(r=r.profile){if(I(r))return void(r.enable?(o(e),s(e.exit),l("true")):l("false"));l(r=r.append(t,e))}else r=e.def(d,".profile");o(f=t.block()),e("if(",r,"){",f,"}"),s(t=t.block()),e.exit("if(",r,"){",t,"}")}function F(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(yt))return;var c=t.scopeAttrib(s);o={},Object.keys(new Y).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;r=i.size?e.def(i.size,"||",n):n,e("if(",u,".type!==",a,"||",u,".size!==",r,"||",d.map(function(t){return u+"."+t+"!=="+i[t]}).join("||"),"){",l,".bindBuffer(",34962,",",f,".buffer);",l,".vertexAttribPointer(",[c,r,a,i.normalized,i.stride,i.offset],");",u,".type=",a,";",u,".size=",r,";",d.map(function(t){return u+"."+t+"="+i[t]+";"}).join(""),"}"),X&&(a=i.divisor,e("if(",u,".divisor!==",a,"){",t.instancing,".vertexAttribDivisorANGLE(",[c,a],");",u,".divisor=",a,";}"))}function s(){e("if(",u,".buffer){",l,".disableVertexAttribArray(",c,");","}if(",ht.map(function(t,e){return u+"."+t+"!=="+h[e]}).join("||"),"){",l,".vertexAttrib4f(",c,",",h,");",ht.map(function(t,e){return u+"."+t+"="+h[e]+";"}).join(""),"}")}var l=a.gl,c=e.def(r,".location"),u=e.def(a.attributes,"[",c,"]");r=i.state;var f=i.buffer,h=[i.x,i.y,i.z,i.w],d=["buffer","normalized","offset","stride"];1===r?o():2===r?s():(e("if(",r,"===",1,"){"),o(),e("}else{"),s(),e("}"))}(t.link(n),function(t){switch(t){case 35664:case 35667:case 35671:return 2;case 35665:case 35668:case 35672:return 3;case 35666:case 35669:case 35673:return 4;default:return 1}}(n.info.type),o)})}function R(t,r,n,i,a){for(var o,l=t.shared,c=l.gl,u=0;u>1)",m],");")}function e(){r(g,".drawArraysInstancedANGLE(",[h,d,p,m],");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(l+".drawElements("+[h,p,v,d+"<<(("+v+"-5121)>>1)"]+");")}function e(){r(l+".drawArrays("+[h,d,p]+");")}f?y?t():(r("if(",f,"){"),t(),r("}else{"),e(),r("}")):e()}var s=t.shared,l=s.gl,c=s.draw,u=n.draw,f=function(){var i=u.elements,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(c,".","elements"),i&&a("if("+i+")"+l+".bindBuffer(34963,"+i+".buffer.buffer);"),i}(),h=i("primitive"),d=i("offset"),p=function(){var i=u.count,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(c,".","count"),i}();if("number"==typeof p){if(0===p)return}else r("if(",p,"){"),r.exit("}");var m,g;X&&(m=i("instances"),g=t.instancing);var v=f+".type",y=u.elements&&I(u.elements);X&&("number"!=typeof m||0<=m)?"string"==typeof m?(r("if(",m,">0){"),a(),r("}else if(",m,"<0){"),o(),r("}")):a():o()}function U(t,e,r,n,i){return e=b(),i=e.proc("body",i),X&&(e.instancing=i.def(e.shared.extensions,".angle_instanced_arrays")),t(e,i,r,n),e.compile().body}function V(t,e,r,n){T(t,e),F(t,e,r,n.attributes,function(){return!0}),R(t,e,r,n.uniforms,function(){return!0}),j(t,e,e,r)}function q(t,e,r,n){function i(){return!0}t.batchId="a1",T(t,e),F(t,e,r,n.attributes,i),R(t,e,r,n.uniforms,i),j(t,e,e,r)}function H(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}T(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var c=t.scope(),u=t.scope();e(c.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",u,"}",c.exit),r.needsContext&&w(t,u,r.context),r.needsFramebuffer&&M(t,u,r.framebuffer),A(t,u,r.state,i),r.profile&&i(r.profile)&&S(t,u,r,!1,!0),n?(F(t,c,r,n.attributes,a),F(t,u,r,n.attributes,i),R(t,c,r,n.uniforms,a),R(t,u,r,n.uniforms,i),j(t,c,u,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,u),l=u.def(n,".id"),c=u.def(e,"[",l,"]"),u(t.shared.gl,".useProgram(",n,".program);","if(!",c,"){",c,"=",e,"[",l,"]=",t.link(function(e){return U(q,t,r,e,2)}),"(",n,");}",c,".call(this,a0[",s,"],",s,");"))}function G(t,e,r){function n(t,e){o.forEach(function(r){var n=i[r];B.isDynamic(n)&&(n=t.invoke(e,n),e(u,".",r,"=",n,";"))})}var i=e.static[r];if(i&&function(t){if("object"==typeof t&&!v(t)){for(var e=Object.keys(t),r=0;r":516,notequal:517,"!=":517,"!==":517,gequal:518,">=":518,always:519},gt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},vt={cw:2304,ccw:2305},yt=new D(!1,!1,!1,function(){});return function(t){function e(){if(0===it.length)E&&E.update(),lt=null;else{lt=U.next(e),h();for(var t=it.length-1;0<=t;--t){var r=it[t];r&&r(D,null,0)}y.flush(),E&&E.update()}}function r(){!lt&&0=it.length&&n()}var r=R(it,t);it[r]=e}}}function f(){var t=rt.viewport,e=rt.scissor_box;t[0]=t[1]=e[0]=e[1]=0,D.viewportWidth=D.framebufferWidth=D.drawingBufferWidth=t[2]=e[2]=y.drawingBufferWidth,D.viewportHeight=D.framebufferHeight=D.drawingBufferHeight=t[3]=e[3]=y.drawingBufferHeight}function h(){D.tick+=1,D.time=v(),f(),et.procs.poll()}function g(){f(),et.procs.refresh(),E&&E.update()}function v(){return(V()-L)/1e3}if(!(t=a(t)))return null;var y=t.gl,x=y.getContextAttributes();y.isContextLost();var b=function(t,e){function r(e){e=e.toLowerCase();var r;try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},i=0;i(i=l)&&(i=n.buffer.byteLength,5123===f?i>>=1:5125===f&&(i>>=2)),n.vertCount=i,i=s,0>s&&(i=4,1===(s=n.buffer.dimension)&&(i=0),2===s&&(i=1),3===s&&(i=4)),n.primType=i}function s(t){n.elementsCount--,delete l[t.id],t.buffer.destroy(),t.buffer=null}var l={},c=0,u={uint8:5121,uint16:5123};e.oes_element_index_uint&&(u.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var f=[];return{create:function(t,e){function l(t){if(t)if("number"==typeof t)c(t),f.primType=4,f.vertCount=0|t,f.type=5121;else{var e=null,r=35044,n=-1,i=-1,s=0,h=0;Array.isArray(t)||q(t)||o(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=J[t.usage]),"primitive"in t&&(n=tt[t.primitive]),"count"in t&&(i=0|t.count),"type"in t&&(h=u[t.type]),"length"in t?s=0|t.length:(s=i,5123===h||5122===h?s*=2:5125!==h&&5124!==h||(s*=4))),a(f,e,r,n,i,s,h)}else c(),f.primType=4,f.vertCount=0,f.type=5121;return l}var c=r.create(null,34963,!0),f=new i(c._buffer);return n.elementsCount++,l(t),l._reglType="elements",l._elements=f,l.subdata=function(t,e){return c.subdata(t,e),l},l.destroy=function(){s(f)},l},createStream:function(t){var e=f.pop();return e||(e=new i(r.create(null,34963,!0,!1)._buffer)),a(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){f.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){H(l).forEach(s)}}}(y,M,P,w),j=(C=function(t,e,r,n,i){for(t=r.maxAttributes,e=Array(t),r=0;r=--this.refCount&&o(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(u).forEach(function(e){t+=u[e].stats.size}),t}),{create:function(e,r){function o(e,r){var n=0,a=0,u=32854;if("object"==typeof e&&e?("shape"in e?(a=e.shape,n=0|a[0],a=0|a[1]):("radius"in e&&(n=a=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(a=0|e.height)),"format"in e&&(u=s[e.format])):"number"==typeof e?(n=0|e,a="number"==typeof r?0|r:n):e||(n=a=1),n!==c.width||a!==c.height||u!==c.format)return o.width=c.width=n,o.height=c.height=a,c.format=u,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,u,n,a),i.profile&&(c.stats.size=ct[c.format]*c.width*c.height),o.format=l[c.format],o}var c=new a(t.createRenderbuffer());return u[c.id]=c,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,a=0|r||n;return n===c.width&&a===c.height?o:(o.width=c.width=n,o.height=c.height=a,t.bindRenderbuffer(36161,c.renderbuffer),t.renderbufferStorage(36161,c.format,n,a),i.profile&&(c.stats.size=ct[c.format]*c.width*c.height),o)},o._reglType="renderbuffer",o._renderbuffer=c,i.profile&&(o.stats=c.stats),o.destroy=function(){c.decRef()},o},clear:function(){H(u).forEach(o)},restore:function(){H(u).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)}),t.bindRenderbuffer(36161,null)}}}(y,M,0,w,t),X=function(t,e,r,n,i,a){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function c(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function u(t){var e=3553,r=null,n=null,i=t;return"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=i._reglType)?r=i:"textureCube"===t?r=i:"renderbuffer"===t&&(n=i,e=36161),new o(e,r,n)}function f(t,e,r,a,s){return r?(t=n.create2D({width:t,height:e,format:a,type:s}),t._texture.refCount=0,new o(3553,t,null)):(t=i.create({width:t,height:e,format:a}),t._renderbuffer.refCount=0,new o(36161,null,t))}function h(t){return t&&(t.texture||t.renderbuffer)}function d(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r))}function p(){this.id=M++,k[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function m(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function g(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,a.framebufferCount--,delete k[e.id]}function v(e){var n;t.bindFramebuffer(36160,e.framebuffer);var i=e.colorAttachments;for(n=0;ni;++i){for(c=0;ct;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach(function(t){t.destroy()})}})},clear:function(){H(k).forEach(g)},restore:function(){H(k).forEach(function(e){e.framebuffer=t.createFramebuffer(),v(e)})}})}(y,M,I,G,W,w),et=F(y,_,M,I,P,O,0,X,{},C,j,{elements:null,primitive:4,count:-1,offset:0,instances:-1},D,E,t),rt=(_=S(y,X,et.procs.poll,D),et.next),nt=y.canvas,it=[],at=[],ot=[],st=[t.onDestroy],lt=null;nt&&(nt.addEventListener("webglcontextlost",i,!1),nt.addEventListener("webglcontextrestored",s,!1));var ht=X.setFBO=l({framebuffer:B.define.call(null,1,"framebuffer")});return g(),x=N(l,{clear:function(t){if("framebuffer"in t)if(t.framebuffer&&"framebufferCube"===t.framebuffer_reglType)for(var e=0;6>e;++e)ht(N({framebuffer:t.framebuffer.faces[e]},t),c);else ht(t,c);else c(0,t)},prop:B.define.bind(null,1),context:B.define.bind(null,2),this:B.define.bind(null,3),draw:l({}),buffer:function(t){return P.create(t,34962,!1,!1)},elements:function(t){return O.create(t,!1)},texture:G.create2D,cube:G.createCube,renderbuffer:W.create,framebuffer:X.create,framebufferCube:X.createCube,attributes:x,frame:u,on:function(t,e){var r;switch(t){case"frame":return u(e);case"lost":r=at;break;case"restore":r=ot;break;case"destroy":r=st}return r.push(e),{cancel:function(){for(var t=0;t=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)}},{}],508:[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=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>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>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;r0&&r.push(","),r.push("[");for(var o=0;o0&&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>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;r0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o: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],f=e[2]-n[2],h=r[2]-n[2],d=a*c,m=o*l,g=o*s,v=i*c,y=i*l,x=a*s,b=u*(d-m)+f*(g-v)+h*(y-x),_=7.771561172376103e-16*((Math.abs(d)+Math.abs(m))*Math.abs(u)+(Math.abs(g)+Math.abs(v))*Math.abs(f)+(Math.abs(y)+Math.abs(x))*Math.abs(h));return b>_||-b>_?b:p(t,e,r,n)}];!function(){for(;m.length<=h;)m.push(s(m.length));for(var t=[],r=["slow"],n=0;n<=h;++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<=h;++n)i.push("case ",n,":return o",n,"(",t.slice(0,n).join(),");");i.push("}var s=new Array(arguments.length);for(var i=0;i0&&o>0||a<0&&o<0)return!1;var s=n(r,t,e),l=n(i,t,e);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],f=Math.min(c,u);if(Math.max(c,u)=n?(i=h,(c+=1)=n?(i=h,(c+=1)0){for(var s=0,l=0,c=0;cn.h||t>n.free||ru)&&(f=2*Math.max(t,u)),(ll)&&(c=2*Math.max(r,l)),this.resize(f,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;rthis.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})},{}],522:[function(t,e,r){"use strict";e.exports=function(t){return t<0?-1:t>0?1:0}},{}],523:[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":74,"reduce-simplicial-complex":499}],524:[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;n0&&c.push(","),c.push("[");for(var n=0;n0&&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>1,v=E[2*m+1];","if(v===b){return m}","if(b1;--o){o>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=t.length||0!==n(t[g],o)););}return r}function c(t,e){if(e<0)return[];for(var r=[],n=(1<>>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>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(n0;){var r=l(t);if(!(r>=0&&e0){var t=A[0];return o(0,S-1),S-=1,c(0),t}return-1}function h(t,e){var r=A[t];return x[r]===e?t:(x[r]=-1/0,u(t),f(),x[r]=e,S+=1,u(S-1))}function d(t){if(!b[t]){b[t]=!0;var e=v[t],r=y[t];v[r]>=0&&(v[r]=e),y[e]>=0&&(y[e]=r),T[e]>=0&&h(T[e],a(e)),T[r]>=0&&h(T[r],a(r))}}function p(t,e){if(t[e]<0)return e;var r=e,n=e;do{var i=t[n];if(!b[n]||i<0||i===n)break;if(n=i,i=t[n],!b[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),x=new Array(m),b=new Array(m),_=0;_>1;_>=0;--_)c(_);for(;;){var E=f();if(E<0||x[E]>r)break;d(E)}var L=[];for(_=0;_=0&&r>=0&&e!==r){var n=T[e],i=T[r];n!==i&&C.push([n,i])}}),i.unique(i.normalize(C)),{positions:L,edges:C}};var n=t("robust-orientation"),i=t("simplicial-complex")},{"robust-orientation":515,"simplicial-complex":528}],531:[function(t,e,r){"use strict";function n(t,e){var r,n;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 ol?a-l:o-l}r=e[1],n=e[0]}var c,u;t[0][1]e[1][0]))return n(e,t);r=e[1],a=e[0]}var o,s;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":515}],532:[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]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;a0){var s=a(this.slabs[e-1],t);s&&(o?f(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 h=l.ge(c,t[1],i);if(h=c.length)return n;d=c[h]}}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":531,"binary-search-bounds":70,"functional-red-black-tree":144,"robust-orientation":515}],533:[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],f=a[o],h=o;h>t;){var d=r[h-1],p=n[2*(h-1)];if((d-s||l-p)>=0)break;r[h]=d,n[2*h]=p,n[2*h+1]=n[2*h-1],i[h]=i[h-1],a[h]=a[h-1],h-=1}r[h]=s,n[2*h]=l,n[2*h+1]=c,i[h]=u,a[h]=f}}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],f=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]=f}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,h,d,p){var m=(e-t+1)/6|0,g=t+m,v=e-m,y=t+e>>1,x=y-m,b=y+m,_=g,w=x,M=y,k=b,A=v,T=t+1,S=e-1,E=0;l(_,w,r,h,d)&&(E=_,_=w,w=E),l(k,A,r,h,d)&&(E=k,k=A,A=E),l(_,M,r,h,d)&&(E=_,_=M,M=E),l(w,M,r,h,d)&&(E=w,w=M,M=E),l(_,k,r,h,d)&&(E=_,_=k,k=E),l(M,k,r,h,d)&&(E=M,M=k,k=E),l(w,A,r,h,d)&&(E=w,w=A,A=E),l(w,M,r,h,d)&&(E=w,w=M,M=E),l(k,A,r,h,d)&&(E=k,k=A,A=E);var L=r[w],C=h[2*w],z=h[2*w+1],D=d[w],I=p[w],P=r[k],O=h[2*k],F=h[2*k+1],R=d[k],N=p[k],j=_,B=M,U=A,V=g,q=y,H=v,G=r[j],Y=r[B],W=r[U];r[V]=G,r[q]=Y,r[H]=W;for(var X=0;X<2;++X){var Z=h[2*j+X],J=h[2*B+X],K=h[2*U+X];h[2*V+X]=Z,h[2*q+X]=J,h[2*H+X]=K}var Q=d[j],$=d[B],tt=d[U];d[V]=Q,d[q]=$,d[H]=tt;var et=p[j],rt=p[B],nt=p[U];p[V]=et,p[q]=rt,p[H]=nt,a(x,t,r,h,d,p),a(b,e,r,h,d,p);for(var it=T;it<=S;++it)if(c(it,L,C,0,D,r,h,d))it!==T&&i(it,T,r,h,d,p),++T;else if(!c(it,P,O,0,R,r,h,d))for(;;){if(c(S,P,O,0,R,r,h,d)){c(S,L,C,0,D,r,h,d)?(o(it,T,S,r,h,d,p),++T,--S):(i(it,S,r,h,d,p),--S);break}if(--S=Math.max(.9*d,32)){var _=c+s>>>1;l(g,v,f,h,_,u+1),h=_}l(g,v,f,h,y,u+1),h=y}}}var c=t.length>>>1;if(c<1)return[];e||(e=Array(c)),r||(r=Array(c)),s||(s=[]);for(var u=0;u=s[2]||s[1]>=s[3]){var f=o(t,2);f[0]===f[2]&&(f[2]+=1),f[1]===f[3]&&(f[3]+=1),s[0]=f[0],s[1]=f[1],s[2]=f[2],s[3]=f[3]}var h=s[0],d=s[1],p=s[2],m=s[3],g=1/(p-h),v=1/(m-d),y=Math.max(p-h,m-d),x=new Int32Array(c),b=0;l(h,d,y,0,c,0),a(x,t,e,r,c);var _=[],w=0,M=c;for(b=c-1;b>=0;--b){t[2*b]=(t[2*b]-h)*g,t[2*b+1]=(t[2*b+1]-d)*v;var k=x[b];k!==w&&(_.push(new i(y*Math.pow(.5,k),b+1,M-(b+1))),M=b+1,w=k)}return _.push(new i(y*Math.pow(.5,k+1),0,M)),_}},{"./lib/sort":533,"array-bounds":48}],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;l0||o>0&&u<0){var f=i(s,u,l,o);r.push(f),a.push(f.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;l0||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;l0||a>0&&c<0)&&r.push(i(o,c,s,a)),c<=0&&r.push(s.slice()),a=c}return r}},{"robust-dot-product":512,"robust-sum":520}],536:[function(t,e,r){!function(t){function e(){var t=arguments[0],r=e.cache;return r[t]&&r.hasOwnProperty(t)||(r[t]=e.parse(t)),e.format.call(null,r[t],arguments)}function n(t){return Object.prototype.toString.call(t).slice(8,-1).toLowerCase()}var i={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};e.format=function(t,r){var a,o,s,l,c,u,f,h=1,d=t.length,p="",m=[],g=!0,v="";for(o=0;o=0),l[8]){case"b":a=a.toString(2);break;case"c":a=String.fromCharCode(a);break;case"d":case"i":a=parseInt(a,10);break;case"j":a=JSON.stringify(a,null,l[6]?parseInt(l[6]):0);break;case"e":a=l[7]?a.toExponential(l[7]):a.toExponential();break;case"f":a=l[7]?parseFloat(a).toFixed(l[7]):parseFloat(a);break;case"g":a=l[7]?parseFloat(a).toPrecision(l[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=String(a))&&l[7]?a.substring(0,l[7]):a;break;case"u":a>>>=0;break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase()}i.json.test(l[8])?m[m.length]=a:(!i.number.test(l[8])||g&&!l[3]?v="":(v=g?"+":"-",a=a.toString().replace(i.sign,"")),u=l[4]?"0"===l[4]?"0":l[4].charAt(1):" ",f=l[6]-(v+a).length,c=l[6]&&f>0?function(t,e){return Array(e+1).join(t)}(u,f):"",m[m.length]=l[5]?v+a+c:"0"===u?v+c+a:c+v+a)}return m.join("")},e.cache={},e.parse=function(t){for(var e=t,r=[],n=[],a=0;e;){if(null!==(r=i.text.exec(e)))n[n.length]=r[0];else if(null!==(r=i.modulo.exec(e)))n[n.length]="%";else{if(null===(r=i.placeholder.exec(e)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){a|=1;var o=[],s=r[2],l=[];if(null===(l=i.key.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(o[o.length]=l[1];""!==(s=s.substring(l[0].length));)if(null!==(l=i.key_access.exec(s)))o[o.length]=l[1];else{if(null===(l=i.index_access.exec(s)))throw new SyntaxError("[sprintf] failed to parse named argument key");o[o.length]=l[1]}r[2]=o}else a|=2;if(3===a)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");n[n.length]=r}e=e.substring(r[0].length)}return n};var a=function(t,r,n){return(n=(r||[]).slice(0)).splice(0,0,t),e.apply(null,n)};void 0!==r?(r.sprintf=e,r.vsprintf=a):(t.sprintf=e,t.vsprintf=a)}("undefined"==typeof window?this:window)},{}],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]=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 x=r[p];if(a[x]=!1,g.push(x),v.push(l[x]),y+=l[x].length,s[x]=f.length,x===e){r.length=p;break}}f.push(g);var b=new Array(y);for(p=0;p=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 f(t){return t.y}var h=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]=h(n,u,f,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]=h(n,u,f,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 c)|0 },"),"generic"===e&&a.push("getters:[0],");for(var s=[],l=[],c=0;c>>7){"),c=0;c<1<<(1<128&&c%128==0){f.length>0&&h.push("}}");var d="vExtra"+f.length;a.push("case ",c>>>7,":",d,"(m&0x7f,",l.join(),");break;"),h=["function ",d,"(m,",l.join(),"){switch(m){"],f.push(h)}h.push("case ",127&c,":");for(var p=new Array(r),m=new Array(r),g=new Array(r),v=new Array(r),y=0,x=0;xx)&&!(c&1<<_)!=!(c&1<0&&(A="+"+g[b]+"*c");var T=p[b].length/y*.5,S=.5+v[b]/y*.5;k.push("d"+b+"-"+S+"-"+T+"*("+p[b].join("+")+A+")/("+m[b].join("+")+")")}h.push("a.push([",k.join(),"]);","break;")}a.push("}},"),f.length>0&&h.push("}}");var E=[];for(c=0;c<1<1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)};r.default=function(t){var e=t.px,r=t.py,l=t.cx,c=t.cy,u=t.rx,f=t.ry,h=t.xAxisRotation,d=void 0===h?0:h,p=t.largeArcFlag,m=void 0===p?0:p,g=t.sweepFlag,v=void 0===g?0:g,y=[];if(0===u||0===f)return[];var x=Math.sin(d*i/360),b=Math.cos(d*i/360),_=b*(e-l)/2+x*(r-c)/2,w=-x*(e-l)/2+b*(r-c)/2;if(0===_&&0===w)return[];u=Math.abs(u),f=Math.abs(f);var M=Math.pow(_,2)/Math.pow(u,2)+Math.pow(w,2)/Math.pow(f,2);M>1&&(u*=Math.sqrt(M),f*=Math.sqrt(M));var k=function(t,e,r,n,a,o,l,c,u,f,h,d){var p=Math.pow(a,2),m=Math.pow(o,2),g=Math.pow(h,2),v=Math.pow(d,2),y=p*m-p*v-m*g;y<0&&(y=0),y/=p*v+m*g;var x=(y=Math.sqrt(y)*(l===c?-1:1))*a/o*d,b=y*-o/a*h,_=f*x-u*b+(t+r)/2,w=u*x+f*b+(e+n)/2,M=(h-x)/a,k=(d-b)/o,A=(-h-x)/a,T=(-d-b)/o,S=s(1,0,M,k),E=s(M,k,A,T);return 0===c&&E>0&&(E-=i),1===c&&E<0&&(E+=i),[_,w,S,E]}(e,r,l,c,u,f,m,v,x,b,_,w),A=n(k,4),T=A[0],S=A[1],E=A[2],L=A[3],C=Math.max(Math.ceil(Math.abs(L)/(i/4)),1);L/=C;for(var z=0;ze[2]&&(e[2]=c[u+0]),c[u+1]>e[3]&&(e[3]=c[u+1]);return e}},{"abs-svg-path":43,assert:51,"is-svg-path":287,"normalize-svg-path":543,"parse-svg-path":466}],543:[function(t,e,r){"use strict";function n(t,e,r,n){return["C",t,e,r,n,r,n]}function i(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}e.exports=function(t){for(var e,r=[],o=0,s=0,l=0,c=0,u=null,f=null,h=0,d=0,p=0,m=t.length;p4?(o=g[g.length-4],s=g[g.length-3]):(o=h,s=d),r.push(g)}return r};var a=t("svg-arc-to-cubic-bezier")},{"svg-arc-to-cubic-bezier":541}],544:[function(t,e,r){(function(r){"use strict";var n=t("svg-path-bounds"),i=t("parse-svg-path"),a=t("draw-svg-path"),o=t("is-svg-path"),s=t("bitmap-sdf"),l=document.createElement("canvas"),c=l.getContext("2d");e.exports=function(t,e){if(!o(t))throw Error("Argument should be valid svg path string");e||(e={});var u,f;e.shape?(u=e.shape[0],f=e.shape[1]):(u=l.width=e.w||e.width||200,f=l.height=e.h||e.height||200);var h=Math.min(u,f),d=e.stroke||0,p=e.viewbox||e.viewBox||n(t),m=[u/(p[2]-p[0]),f/(p[3]-p[1])],g=Math.min(m[0]||0,m[1]||0)/2;if(c.fillStyle="black",c.fillRect(0,0,u,f),c.fillStyle="white",d&&("number"!=typeof d&&(d=1),c.strokeStyle=d>0?"white":"black",c.lineWidth=Math.abs(d)),c.translate(.5*u,.5*f),c.scale(g,g),r.Path2D){var v=new Path2D(t);c.fill(v),d&&c.stroke(v)}else{var y=i(t);a(c,y),c.fill(),d&&c.stroke()}return c.setTransform(1,0,0,1,0,0),s(c,{cutoff:null!=e.cutoff?e.cutoff:.5,radius:null!=e.radius?e.radius:.5*h})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"bitmap-sdf":72,"draw-svg-path":132,"is-svg-path":287,"parse-svg-path":466,"svg-path-bounds":542}],545:[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;o0&&(f+=.02);var d=new Float32Array(u),p=0,m=-.5*f;for(h=0;h1&&(r-=1),r<1/6?t+6*(e-t)*r:r<.5?e:r<2/3?t+(e-t)*(2/3-r)*6:t}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=b(n),{ok:s,format:e.format||l,r:I(255,P(r.r,0)),g:I(255,P(r.g,0)),b:I(255,P(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=D(100*this._a)/100,this._format=n.format||i.format,this._gradientType=n.gradientType,this._r<1&&(this._r=D(this._r)),this._g<1&&(this._g=D(this._g)),this._b<1&&(this._b=D(this._b)),this._ok=i.ok,this._tc_id=z++}function n(t,e,r){t=_(t,255),e=_(e,255),r=_(r,255);var n,i,a=P(t,e,r),o=I(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>1)+720)%360;--e;)i.h=(i.h+a)%360,o.push(r(i));return o}function x(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 b(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=I(r,P(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 I(1,P(0,t))}function M(t){return parseInt(t,16)}function k(t){return 1==t.length?"0"+t:""+t}function A(t){return t<=1&&(t=100*t+"%"),t}function T(e){return t.round(255*parseFloat(e)).toString(16)}function S(t){return M(t)/255}function E(t){return!!N.CSS_UNIT.exec(t)}var L=/^\s+/,C=/\s+$/,z=0,D=t.round,I=t.min,P=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=b(t),this._roundA=D(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=D(360*t.h),r=D(100*t.s),n=D(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=D(360*t.h),r=D(100*t.s),i=D(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(D(t).toString(16)),k(D(e).toString(16)),k(D(r).toString(16)),k(T(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:D(this._r),g:D(this._g),b:D(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+D(this._r)+", "+D(this._g)+", "+D(this._b)+")":"rgba("+D(this._r)+", "+D(this._g)+", "+D(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:D(100*_(this._r,255))+"%",g:D(100*_(this._g,255))+"%",b:D(100*_(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+D(100*_(this._r,255))+"%, "+D(100*_(this._g,255))+"%, "+D(100*_(this._b,255))+"%)":"rgba("+D(100*_(this._r,255))+"%, "+D(100*_(this._g,255))+"%, "+D(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(f,arguments)},darken:function(){return this._applyModification(h,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(x,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]:A(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;uc&&(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),N=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)},{}],547:[function(t,e,r){"use strict";function n(t){if(t instanceof Float32Array)return t;if("number"==typeof t)return new Float32Array([t])[0];var e=new Float32Array(t);return e.set(t),e}e.exports=n,e.exports.float32=e.exports.float=n,e.exports.fract32=e.exports.fract=function(t){if("number"==typeof t)return n(t-n(t));for(var e=n(t),r=0,i=e.length;r1)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);i1)for(var i,s,l=1,u=a(n[0]);lu&&(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]f&&(f=l[0]),l[1]h&&(h=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,f=-c,h=-c;t.arcs.forEach(function(t){for(var e=-1,r=t.length;++ef&&(f=l[0]),l[1]h&&(h=l[1])});for(a in t.objects)r(t.objects[a]);n=t.bbox=[c,u,f,h]}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>>1;t[i]=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,f=t[0],h=f[0]=Math.round((f[0]-o)/l),d=f[1]=Math.round((f[1]-c)/u);iMath.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 f(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),f(r,r),i=[].slice.call(i,0,3),f(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):f(i,i),s=n(p[0],p[1],p[2]);var m=h(r,p)/s,g=h(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"),f=t("gl-vec3/normalize"),h=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 h=this.computedToward;u(h,e,r),f(h,h);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),x=Math.sin(m),b=this.computedCenter,_=g*y,w=v*y,M=x,k=-g*x,A=-v*x,T=y,S=this.computedEye,E=this.computedMatrix;for(o=0;o<3;++o){var L=_*r[o]+w*h[o]+M*e[o];E[4*o+1]=k*r[o]+A*h[o]+T*e[o],E[4*o+2]=L,E[4*o+3]=0}var C=E[1],z=E[5],D=E[9],I=E[2],P=E[6],O=E[10],F=z*O-D*P,R=D*I-C*O,N=C*P-z*I,j=n(F,R,N);F/=j,R/=j,N/=j,E[0]=F,E[4]=R,E[8]=N;for(o=0;o<3;++o)S[o]=b[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],f=a[4],h=a[8],d=u*o+f*s+h*l,p=n(u-=o*d,f-=s*d,h-=l*d),m=(u/=p)*e+o*r,g=(f/=p)*e+s*r,v=(h/=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],f=e[o+8];if(a){var h=Math.abs(c),d=Math.abs(u),p=Math.abs(f),m=Math.max(h,d,p);h===m?(c=c<0?-1:1,u=f=0):p===m?(f=f<0?-1:1,c=u=0):(u=u<0?-1:1,c=f=0)}else{var g=n(c,u,f);c/=g,u/=g,f/=g}var v=e[s],y=e[s+4],x=e[s+8],b=v*c+y*u+x*f,_=n(v-=c*b,y-=u*b,x-=f*b),w=u*(x/=_)-f*(y/=_),M=f*(v/=_)-c*x,k=c*y-u*v,A=n(w,M,k);w/=A,M/=A,k/=A,this.center.jump(t,H,G,Y),this.radius.idle(t),this.up.jump(t,c,u,f),this.right.jump(t,v,y,x);var T,S;if(2===o){var E=e[1],L=e[5],C=e[9],z=E*v+L*y+C*x,D=E*w+L*M+C*k;T=F<0?-Math.PI/2:Math.PI/2,S=Math.atan2(D,z)}else{var I=e[2],P=e[6],O=e[10],F=I*c+P*u+O*f,R=I*v+P*y+O*x,N=I*w+P*M+O*k;T=Math.asin(i(F)),S=Math.atan2(N,R)}this.angle.jump(t,S,T),this.recalcMatrix(t);var j=e[2],B=e[6],U=e[10],V=this.computedMatrix;l(V,e);var q=V[15],H=V[12]/q,G=V[13]/q,Y=V[14]/q,W=Math.exp(this.computedRadius[0]);this.center.jump(t,H-j*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],f=e[1]-r[1],h=e[2]-r[2],d=n(u,f,h);if(!(d<1e-6)){u/=d,f/=d,h/=d;var p=this.computedRight,m=p[0],g=p[1],v=p[2],y=o*m+s*g+l*v,x=n(m-=y*o,g-=y*s,v-=y*l);if(!(x<.01&&(m=s*h-l*f,g=l*u-o*h,v=o*f-s*u,(x=n(m,g,v))<1e-6))){m/=x,g/=x,v/=x,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 b=s*v-l*g,_=l*m-o*v,w=o*g-s*m,M=n(b,_,w),k=o*u+s*f+l*h,A=m*u+g*f+v*h,T=(b/=M)*u+(_/=M)*f+(w/=M)*h,S=Math.asin(i(k)),E=Math.atan2(T,A),L=this.angle._state,C=L[L.length-1],z=L[L.length-2];C%=2*Math.PI;var D=Math.abs(C+2*Math.PI-E),I=Math.abs(C-E),P=Math.abs(C-2*Math.PI-E);D0?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 f(t){return new Int32Array(a(4*t),0,t)}function h(t){return new Float32Array(a(4*t),0,t)}function d(t){return new Float64Array(a(8*t),0,t)}function p(t){return x?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 x="undefined"!=typeof Uint8ClampedArray,b=e.__TYPEDARRAY_POOL;b.UINT8C||(b.UINT8C=y([32,0])),b.BUFFER||(b.BUFFER=y([32,0]));var _=b.DATA,w=b.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 f(t);case"float":case"float32":return h(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=f,r.mallocFloat32=r.mallocFloat=h,r.mallocFloat64=r.mallocDouble=d,r.mallocUint8Clamped=p,r.mallocDataView=m,r.mallocBuffer=g,r.clearCache=function(){for(var t=0;t<32;++t)b.UINT8[t].length=0,b.UINT16[t].length=0,b.UINT32[t].length=0,b.INT8[t].length=0,b.INT16[t].length=0,b.INT32[t].length=0,b.FLOAT[t].length=0,b.DOUBLE[t].length=0,b.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":71,buffer:82,dup:134}],555:[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;en)return n;for(;ra?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],558:[function(t,e,r){"use strict";e.exports=function(t,e,r){Array.isArray(r)||(r=[].slice.call(arguments,2));for(var n=0,i=r.length;n",'"',"`"," ","\r","\n","\t"]),f=["'"].concat(u),h=["%","/","?",";","#"].concat(f),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},x=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&&n127?I+="x":I+=D[P];if(!I.match(p)){var F=C.slice(0,A),R=C.slice(A+1),N=D.match(m);N&&(F.push(N[1]),R.unshift(N[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 j=this.port?":"+this.port:"",B=this.hostname||"";this.host=B+j,this.href+=this.host,L&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==u[0]&&(u="/"+u))}if(!g[w])for(A=0,z=f.length;A0)&&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 A=M.slice(-1)[0],T=(r.host||t.host||M.length>1)&&("."===A||".."===A)||""===A,S=0,E=M.length;E>=0;E--)"."===(A=M[E])?M.splice(E,1):".."===A?(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(""),T&&"/"!==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":560,punycode:489,querystring:493}],560:[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}}},{}],561:[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}},{}],562:[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}},{}],563:[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]),f(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&&b(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(f(e))return t.stylize(""+e,"boolean");if(h(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)),x(e)&&(o.indexOf("message")>=0||o.indexOf("description")>=0))return l(e);if(0===o.length){if(b(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(x(e))return l(e)}var w="",k=!1,A=["{","}"];if(u(e)&&(k=!0,A=["[","]"]),b(e)){w=" [Function"+(e.name?": "+e.name:"")+"]"}if(g(e)&&(w=" "+RegExp.prototype.toString.call(e)),y(e)&&(w=" "+Date.prototype.toUTCString.call(e)),x(e)&&(w=" "+l(e)),0===o.length&&(!k||0==e.length))return A[0]+w+A[1];if(n<0)return g(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special");t.seen.push(e);var T;return T=k?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o=0&&n++,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]}(T,w,A)}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=h(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 f(t){return"boolean"==typeof t}function h(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 x(t){return v(t)&&("[object Error]"===_(t)||t instanceof Error)}function b(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=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>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>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),ac&&(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>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":566}],568:[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":569}],569:[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;l8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height>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":571,"./vector-tile-pb":572,pbf:470}],571:[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=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))})}})};b.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 b||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 b),n.set(t,e)),this}:function(t,e){if(l)try{r.set(t,e)}catch(r){n||(n=new b),n.set___(t,e)}else r.set(t,e);return this},Object.create(b.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=b.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=b)}}()},{}],574:[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":575}],575:[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}},{}],576:[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":574}],577:[function(t,e,r){var n=t("get-canvas-context");e.exports=function(t){return n("webgl",t)}},{"get-canvas-context":156}],578:[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;c2111)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>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=h[a-h[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 f=this.toJD(t,e,r)-n.toJD();return 1+Math.floor(f/7)},monthsInYear:function(t){return this.leapYear(t)?13:12},daysInMonth:function(t,e){t.year&&(e=t.month(),t=t.year()),t=this._validateYear(t);var r=f[t-f[0]];if(e>(r>>13?12:11))throw 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=f[o.year-f[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>9&4095,v=m>>5&15,y=31&m,x=new Date(g,v-1,y+l);return a.year=x.getFullYear(),a.month=1+x.getMonth(),a.day=x.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=h[i.year-h[0]],s=i.year<<9|i.month<<5|i.day;a.year=s>=o?i.year:i.year-1;var l,c=(o=h[a.year-h[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=f[a.year-f[0]];for(g=0;g<13;g++){var y=v&1<<12-g?30:29;if(l>13;return!x||g=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":595,"object-assign":462}],584:[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":595,"object-assign":462}],585:[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=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),a.calendars.hebrew=n},{"../main":595,"object-assign":462}],586:[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":595,"object-assign":462}],587:[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":595,"object-assign":462}],588:[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;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,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":595,"object-assign":462}],589:[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=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":595,"object-assign":462}],590:[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;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,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),f=t-this.toJD(l,u,1)+1;return this.newDate(l,u,f)}}),a.calendars.persian=n,a.calendars.jalali=n},{"../main":595,"object-assign":462}],592:[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":595,"object-assign":462}],593:[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":595,"object-assign":462}],594:[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;or)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;ne);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":595,"object-assign":462}],595:[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(;oe-1+t.minMonth;)a++,o-=e,e=t.monthsInYear(a)}(this),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o))));var s=[a,this.fromMonthOfYear(a,o),i];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var i={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],a=r<0?-1:1;e=this._add(t,r*i[0]+a*i[1],i[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,c.local.invalidDate||c.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),i="m"===r?e:t.month(),a="d"===r?e:t.day();return"y"!==r&&"m"!==r||(a=Math.min(a,this.daysInMonth(n,i))),t.date(n,i,a)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var i=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),c=i-(l>2.5?4716:4715);return c<=0&&c--,this.newDate(c,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,c.local.invalidDate||c.regionalOptions[""].invalidDate),i=new Date(n.year(),n.month()-1,n.day());return i.setHours(0),i.setMinutes(0),i.setSeconds(0),i.setMilliseconds(0),i.setHours(i.getHours()>12?i.getHours()+2:0),i},fromJSDate:function(t){return this.newDate(t.getFullYear(),t.getMonth()+1,t.getDate())}});var c=e.exports=new n;c.cdate=i,c.baseCalendar=o,c.calendars.gregorian=s},{"object-assign":462}],596:[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;x+n1}),u=function(t,e,r,n){var i=""+e;if(c(t,n))for(;i.length1},x=function(t,r){var n=y(t,r),a=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],o=new RegExp("^-?\\d{1,"+a+"}"),s=e.substring(A).match(o);if(!s)throw(i.local.missingNumberAt||i.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=s[0].length,parseInt(s[0],10)},b=this,_=function(){if("function"==typeof l){y("m");var t=l.call(b,e.substring(A));return A+=t.length,t}return x("m")},w=function(t,r,n,a){for(var o=y(t,a)?n:r,s=0;s-1){d=1,p=m;for(var E=this.daysInMonth(h,d);p>E;E=this.daysInMonth(h,d))d++,p-=E}return f>-1?this.fromJD(f):this.newDate(h,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":595,"object-assign":462}],597:[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":116}],598:[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":597}],599:[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),f=c("clicktoshow");if(!u&&!f)return e;a(t,e,r,c);for(var h=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),h){var x="a"+v,b=i.coerceRef(t,e,m,x,"pixel");"pixel"!==b&&b!==y&&(b=e[x]="pixel");var _="pixel"===b?p[g]:.4;i.coercePosition(e,m,c,b,x,_)}c(v+"anchor"),c(v+"shift")}if(n.noneOrAll(t,e,["x","y"]),h&&n.noneOrAll(t,e,["ax","ay"]),f){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":743,"../../plots/cartesian/axes":789,"./attributes":601,"./common_defaults":604}],600:[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}]},{}],601:[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":794,"../../plots/font_attributes":816,"./arrow_paths":600}],602:[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":743,"../../plots/cartesian/axes":789,"./draw":607}],603:[function(t,e,r){"use strict";function n(t,e){var r,n,a,o,s,l,c,u=t._fullLayout.annotations,f=[],h=[],d=[],p=(e||[]).length;for(r=0;r0||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;r2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}var a=N.selectAll("a");if(1===a.size()&&a.text()===N.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(P.node())}var c=C.select(".annotation-text-math-group"),h=!c.empty(),v=f.bBox((h?c:N).node()),y=v.width,L=v.height,D=e.width||y,R=e.height||L,j=Math.round(D+2*I),B=Math.round(R+2*I);e._w=D,e._h=R;for(var U=!1,V=["x","y"],q=0;q1)&&(K===J?((ot=Q.r2fraction(e["a"+Z]))<0||ot>1)&&(U=!0):U=!0,U))continue;H=Q._offset+Q.r2p(e[Z]),W=.5}else"x"===Z?(Y=e[Z],H=_.l+_.w*Y):(Y=1-e[Z],H=_.t+_.h*Y),W=e.showarrow?.5:Y;if(e.showarrow){at.head=H;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=H+st,G=X+st),at.text=at.tail+X;var lt=b["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=H+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 ft=0,ht=0;if("left"!==e.align&&(ft=(D-y)*("center"===e.align?.5:1)),"top"!==e.valign&&(ht=(R-L)*("middle"===e.valign?.5:1)),h)c.select("svg").attr({x:I+ft-1,y:I+ht}).call(f.setClipUrl,O?M:null);else{var dt=I+ht-v.top,pt=I+ft-v.left;N.call(d.positionText,pt,dt).call(f.setClipUrl,O?M:null)}F.select("rect").call(f.setRect,I,I,D,R),P.call(f.setRect,z/2,z/2,j-z,B-z),C.call(f.setTranslate,Math.round(k.x.text-j/2),Math.round(k.y.text-B/2)),S.attr({transform:"rotate("+A+","+k.x.text+","+k.y.text+")"});var mt=function(r,a){T.selectAll(".annotation-arrow-g").remove();var c=k.x.head,h=k.y.head,d=k.x.tail+r,p=k.y.tail+a,v=k.x.text+r,y=k.y.text+a,b=l.rotationXYMatrix(A,v,y),M=l.apply2DTransform(b),E=l.apply2DTransform2(b),L=+P.attr("width"),z=+P.attr("height"),D=v-.5*L,I=D+L,O=y-.5*z,F=O+z,R=[[D,O,D,F],[D,F,I,F],[I,F,I,O],[I,O,D,O]].map(E);if(!R.reduce(function(t,e){return t^!!l.segmentsIntersect(c,h,c+1e6,h+1e6,e[0],e[1],e[2],e[3])},!1)){R.forEach(function(t){var e=l.segmentsIntersect(d,p,c,h,t[0],t[1],t[2],t[3]);e&&(d=e.x,p=e.y)});var N=e.arrowwidth,j=e.arrowcolor,B=e.arrowside,U=T.append("g").style({opacity:u.opacity(j)}).classed("annotation-arrow-g",!0),V=U.append("path").attr("d","M"+d+","+p+"L"+c+","+h).style("stroke-width",N+"px").call(u.stroke,u.rgb(j));if(g(V,B,e),w.annotationPosition&&V.node().parentNode&&!n){var q=c,H=h;if(e.standoff){var G=Math.sqrt(Math.pow(c-d,2)+Math.pow(h-p,2));q+=e.standoff*(d-c)/G,H+=e.standoff*(p-h)/G}var Y,W,X,Z=U.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(d-q)+","+(p-H),transform:"translate("+q+","+H+")"}).style("stroke-width",N+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=f.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(f.setTranslate,a,o),Y[x+".x"]=i?i.p2r(i.r2p(e.x)+t):e.x+t/_.w,Y[x+".y"]=s?s.p2r(s.r2p(e.y)+r):e.y-r/_.h,e.axref===e.xref&&(Y[x+".ax"]=i.p2r(i.r2p(e.ax)+t)),e.ayref===e.yref&&(Y[x+".ay"]=s.p2r(s.r2p(e.ay)+r)),U.attr("transform","translate("+t+","+r+")"),S.attr({transform:"rotate("+A+","+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[x+".ax"]=i.p2r(i.r2p(e.ax)+t):gt[x+".ax"]=e.ax+t,e.ayref===e.yref?gt[x+".ay"]=s.p2r(s.r2p(e.ay)+r):gt[x+".ay"]=e.ay+r,mt(t,r);else{if(n)return;if(i)gt[x+".x"]=e.x+t/i._m;else{var o=e._xsize/_.w,l=e.x+(e._xshift-e.xshift)/_.w-o/2;gt[x+".x"]=m.align(l+t/_.w,o,0,1,e.xanchor)}if(s)gt[x+".y"]=e.y+r/s._m;else{var c=e._ysize/_.h,u=e.y-(e._yshift+e.yshift)/_.h-c/2;gt[x+".y"]=m.align(u-r/_.h,c,0,1,e.yanchor)}i&&s||(a=m.getCursor(i?.5:gt[x+".x"],s?.5:gt[x+".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,x,b=t._fullLayout,_=t._fullLayout._size,w=t._context.edits;n?(y="annotation-"+n,x=n+".annotations["+r+"]"):(y="annotation",x="annotations["+r+"]"),b._infolayer.selectAll("."+y+'[data-index="'+r+'"]').remove();var M="clip"+b._uid+"_ann"+r;if(e._input&&!1!==e.visible){var k={x:{},y:{}},A=+e.textangle||0,T=b._infolayer.append("g").classed(y,!0).attr("data-index",String(r)).style("opacity",e.opacity),S=T.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();h.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:b._hoverlayer.node(),outerContainer:b._paper.node(),gd:t})}).on("mouseout",function(){h.loneUnhover(b._hoverlayer.node())});var z=e.borderwidth,D=e.borderpad,I=z+D,P=C.append("rect").attr("class","bg").style("stroke-width",z+"px").call(u.stroke,e.bordercolor).call(u.fill,e.bgcolor),O=e.width||e.height,F=b._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,N=C.append("text").classed("annotation-text",!0).text(e.text);w.annotationText?N.call(d.makeEditable,{delegate:C,gd:t}).call(c).on("edit",function(r){e.text=r,this.call(c);var n={};n[x+".text"]=e.text,i&&i.autorange&&(n[i._name+".autorange"]=!0),s&&s.autorange&&(n[s._name+".autorange"]=!0),o.relayout(t,n)}):N.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"),f=t("../drawing"),h=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=0,y=e.indexOf("end")>=0,x=d.backoff*m+r.standoff,b=p.backoff*g+r.startstandoff;if("line"===h.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,_),f=u+Math.PI,x&&b&&x+b>Math.sqrt(_*_+w*w))return void o();if(x){if(x*x>_*_+w*w)return void o();var M=x*Math.cos(u),k=x*Math.sin(u);c.x+=M,c.y+=k,t.attr({x2:c.x,y2:c.y})}if(b){if(b*b>_*_+w*w)return void o();var A=b*Math.cos(u),T=b*Math.sin(u);l.x-=A,l.y-=T,t.attr({x1:l.x,y1:l.y})}}else if("path"===h.nodeName){var S=h.getTotalLength(),E="";if(S1){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":841,"../annotations/draw":607}],614:[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=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;e0?E>=O:E<=O));L++)E>R&&E0?E>=O:E<=O));L++)E>C[0]&&E1){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=T._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,ft=S.l+(k.x+Y)*S.w,ht=et.titlefont.size;ut="top"===k.titleside?(1-(K+G-X))*S.h+S.t+3+.75*ht:(1-(K+X))*S.h+S.t-3-.25*ht,A(et._id+"title",{attributes:{x:ft,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 f=st.select(".cbfills").selectAll("rect.cbfill").data(D);f.enter().append("rect").classed(w.cbfill,!0).style("stroke","none"),f.exit().remove(),f.each(function(t,e){var r=[0===e?C[0]:(D[e]+D[e-1])/2,e===D.length-1?C[1]:(D[e]+D[e+1])/2].map(et.c2p).map(Math.round);e!==D.length-1&&(r[1]+=r[1]>r[0]?1:-1);var a=P(t).replace("e-",""),o=i(a).toHexString();n.select(this).attr({x:Z,width:Math.max(V,2),y:n.min(r),height:Math.max(n.max(r)-n.min(r),2),fill:o})});var h=st.select(".cblines").selectAll("path.cbline").data(k.line.color&&k.line.width?z:[]);return h.enter().append("path").classed(w.cbline,!0),h.exit().remove(),h.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,I(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));A("h"+et._id+"title",{avoid:{selection:n.select(t).selectAll("g."+et._id+"tick"),side:k.titleside,offsetLeft:S.l,offsetTop:0,maxShift:T.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((j=lt.select("text")).node()&&!j.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"),h(st)},moveFn:function(t,e){st.attr("transform",pt+" translate("+t+","+e+")"),mt=c.align(J+t/S.w,q,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);h(st,r)},doneFn:function(){h(st),void 0!==mt&&void 0!==gt&&a.restyle(t,{"colorbar.x":mt,"colorbar.y":gt},M().index)}})}return dt}T._infolayer.selectAll("g."+e).remove()}function M(){var r,n,i=e.substr(2);for(r=0;r=0?i.Reds:i.Blues,l.colorscale=m,s.reversescale&&(m=a(m)),s.colorscale=m)}},{"../../lib":743,"./flip_scale":630,"./scales":637}],626:[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":732,"./attributes":624,"./scales.js":637}],627:[function(t,e,r){"use strict";var n=t("./scales");e.exports=n.RdBu},{"./scales":637}],628:[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 f=u.prefix,h=u.cLetter,d=f.slice(0,f.length-1),p=f?i.nestedProperty(t,d).get()||{}:t,m=f?i.nestedProperty(e,d).get()||{}:e,g=p[h+"min"],v=p[h+"max"],y=p.colorscale;c(f+h+"auto",!(n(g)&&n(v)&&g=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n}},{}],631:[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":627,"./is_valid_scale_array":635,"./scales":637}],632:[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;l4/3-s?o:s}},{}],639:[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":743}],640:[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"),f=e.exports={};f.align=t("./align"),f.getCursor=t("./cursor");var h=t("./unhover");f.unhover=h.wrapped,f.unhoverRaw=h.raw;var d=l.eventListenerOptionsSupported();f.init=function(t){function e(e){_._dragged=!1,_._dragging=!0;var s=i(e);return h=s[0],p=s[1],x=e.target,y=e,b=e.buttons&&2===e.buttons||e.ctrlKey,(m=(new Date).getTime())-_._mouseDownTimeM&&(w=Math.max(w-1,1)),_._dragged)t.doneFn&&t.doneFn(e);else if(t.clickFn&&t.clickFn(w,y),!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)}x.dispatchEvent(n)}return function(t){t._dragging=!1,t._replotPending&&s.plot(t)}(_),_._dragged=!1,l.pauseEvent(e)}_._dragged=!1}var h,p,m,g,v,y,x,b,_=t.gd,w=1,M=u.DBLCLICKDELAY,k=t.element;_._mouseDownTime||(_._mouseDownTime=0),k.style.pointerEvents="all",k.onmousedown=e,d?(k._ontouchstart&&k.removeEventListener("touchstart",k._ontouchstart),k._ontouchstart=e,k.addEventListener("touchstart",e,{passive:!1})):k.ontouchstart=e;var A=t.clampFn||function(t,e,r){return Math.abs(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,f=.75*r+S[a]*s+(S[a]-1)*c*r/2;t.attr("text-anchor",o),i.attr("transform","translate("+u+","+f+")")}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),f=(u*u*i-c*c*o)*n,h=(u*u*a-c*c*s)*n,d=3*u*(c+u),p=3*c*(c+u);return[[l.round(e[0]+(d&&f/d),2),l.round(e[1]+(d&&h/d),2)],[l.round(e[0]-(p&&f/p),2),l.round(e[1]-(p&&h/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"),f=t("../../registry"),h=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,x=t("../../traces/scatter/subtypes"),b=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(h.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||"";h.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(h.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(h.fill,e)},_.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(e){var r=l.select(this);try{r.call(h.fill,e[0].trace.fillcolor)}catch(e){p.error(e,t),r.remove()}})};var w=t("./symbol_defs");_.symbolNames=[],_.symbolFuncs=[],_.symbolNeedLines={},_.symbolNoDot={},_.symbolNoFill={},_.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"]),e.noFill&&(_.symbolNoFill[e.n]=!0)});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 A={x1:1,x2:0,y1:0,y2:0},T={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(A):"vertical"===n&&t.attr(T),t.attr("id",r);var e=u(i),o=u(a);t.append("stop").attr({offset:"0%","stop-color":h.tinyRGB(o),"stop-opacity":o.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":h.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(f.traceIs(r,"symbols")){var c=b(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===o.size?3:x.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)?h.defaultLine:s.color,Array.isArray(o.color)&&(u=h.defaultLine,m=!0),u="mc"in t?t.mcc=i(t.mc):o.color||"rgba(0,0,0,0)"),t.om)e.call(h.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(h.fill,u);p&&e.call(h.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&&h.fill(r,e)});var x=o.size,b=s.size,w=void 0!==x,M=void 0!==b;f.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?x/2:i:M?b/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,f=a(t,e),d=(r.textfont||{}).color,p=(n.textfont||{}).color;t.selected?d&&(o=d):p?o=p:d||(o=h.addOpacity(c,y)),o&&h.fill(s,o),i(s,u,f,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=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 z=/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(z);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":716,"../../constants/interactions":720,"../../constants/xmlns_namespaces":723,"../../lib":743,"../../lib/svg_text_utils":766,"../../registry":873,"../../traces/scatter/make_bubble_size_func":1083,"../../traces/scatter/subtypes":1088,"../color":618,"../colorscale":633,"./symbol_defs":644,d3:128,"fast-isnumeric":140,tinycolor2:546}],644:[function(t,e,r){"use strict";var n=t("d3");e.exports={circle:{n:0,f:function(t){var e=n.round(t,2);return"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"}},square:{n:1,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"}},diamond:{n:2,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"Z"}},cross:{n:3,f:function(t){var e=n.round(.4*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H"+e+"V"+r+"H-"+e+"V"+e+"H-"+r+"V-"+e+"H-"+e+"V-"+r+"H"+e+"V-"+e+"H"+r+"Z"}},x:{n:4,f:function(t){var e=n.round(.8*t/Math.sqrt(2),2),r="l"+e+","+e,i="l"+e+",-"+e,a="l-"+e+",-"+e,o="l-"+e+","+e;return"M0,"+e+r+i+a+i+a+o+a+o+r+o+r+"Z"}},"triangle-up":{n:5,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+","+n.round(t/2,2)+"H"+e+"L0,-"+n.round(t,2)+"Z"}},"triangle-down":{n:6,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+e+",-"+n.round(t/2,2)+"H"+e+"L0,"+n.round(t,2)+"Z"}},"triangle-left":{n:7,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M"+n.round(t/2,2)+",-"+e+"V"+e+"L-"+n.round(t,2)+",0Z"}},"triangle-right":{n:8,f:function(t){var e=n.round(2*t/Math.sqrt(3),2);return"M-"+n.round(t/2,2)+",-"+e+"V"+e+"L"+n.round(t,2)+",0Z"}},"triangle-ne":{n:9,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+r+",-"+e+"H"+e+"V"+r+"Z"}},"triangle-se":{n:10,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+e+",-"+r+"V"+e+"H-"+r+"Z"}},"triangle-sw":{n:11,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M"+r+","+e+"H-"+e+"V-"+r+"Z"}},"triangle-nw":{n:12,f:function(t){var e=n.round(.6*t,2),r=n.round(1.2*t,2);return"M-"+e+","+r+"V-"+e+"H"+r+"Z"}},pentagon:{n:13,f:function(t){var e=n.round(.951*t,2),r=n.round(.588*t,2),i=n.round(-t,2),a=n.round(-.309*t,2);return"M"+e+","+a+"L"+r+","+n.round(.809*t,2)+"H-"+r+"L-"+e+","+a+"L0,"+i+"Z"}},hexagon:{n:14,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M"+i+",-"+r+"V"+r+"L0,"+e+"L-"+i+","+r+"V-"+r+"L0,-"+e+"Z"}},hexagon2:{n:15,f:function(t){var e=n.round(t,2),r=n.round(t/2,2),i=n.round(t*Math.sqrt(3)/2,2);return"M-"+r+","+i+"H"+r+"L"+e+",0L"+r+",-"+i+"H-"+r+"L-"+e+",0Z"}},octagon:{n:16,f:function(t){var e=n.round(.924*t,2),r=n.round(.383*t,2);return"M-"+r+",-"+e+"H"+r+"L"+e+",-"+r+"V"+r+"L"+r+","+e+"H-"+r+"L-"+e+","+r+"V-"+r+"Z"}},star:{n:17,f:function(t){var e=1.4*t,r=n.round(.225*e,2),i=n.round(.951*e,2),a=n.round(.363*e,2),o=n.round(.588*e,2),s=n.round(-e,2),l=n.round(-.309*e,2),c=n.round(.118*e,2),u=n.round(.809*e,2);return"M"+r+","+l+"H"+i+"L"+a+","+c+"L"+o+","+u+"L0,"+n.round(.382*e,2)+"L-"+o+","+u+"L-"+a+","+c+"L-"+i+","+l+"H-"+r+"L0,"+s+"Z"}},hexagram:{n:18,f:function(t){var e=n.round(.66*t,2),r=n.round(.38*t,2),i=n.round(.76*t,2);return"M-"+i+",0l-"+r+",-"+e+"h"+i+"l"+r+",-"+e+"l"+r+","+e+"h"+i+"l-"+r+","+e+"l"+r+","+e+"h-"+i+"l-"+r+","+e+"l-"+r+",-"+e+"h-"+i+"Z"}},"star-triangle-up":{n:19,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M-"+e+","+r+o+e+","+r+o+"0,-"+i+o+"-"+e+","+r+"Z"}},"star-triangle-down":{n:20,f:function(t){var e=n.round(t*Math.sqrt(3)*.8,2),r=n.round(.8*t,2),i=n.round(1.6*t,2),a=n.round(4*t,2),o="A "+a+","+a+" 0 0 1 ";return"M"+e+",-"+r+o+"-"+e+",-"+r+o+"0,"+i+o+e+",-"+r+"Z"}},"star-square":{n:21,f:function(t){var e=n.round(1.1*t,2),r=n.round(2*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",-"+e+i+"-"+e+","+e+i+e+","+e+i+e+",-"+e+i+"-"+e+",-"+e+"Z"}},"star-diamond":{n:22,f:function(t){var e=n.round(1.4*t,2),r=n.round(1.9*t,2),i="A "+r+","+r+" 0 0 1 ";return"M-"+e+",0"+i+"0,"+e+i+e+",0"+i+"0,-"+e+i+"-"+e+",0Z"}},"diamond-tall":{n:23,f:function(t){var e=n.round(.7*t,2),r=n.round(1.4*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},"diamond-wide":{n:24,f:function(t){var e=n.round(1.4*t,2),r=n.round(.7*t,2);return"M0,"+r+"L"+e+",0L0,-"+r+"L-"+e+",0Z"}},hourglass:{n:25,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"H-"+e+"L"+e+",-"+e+"H-"+e+"Z"},noDot:!0},bowtie:{n:26,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"V-"+e+"L-"+e+","+e+"V-"+e+"Z"},noDot:!0},"circle-cross":{n:27,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"circle-x":{n:28,f:function(t){var e=n.round(t,2),r=n.round(t/Math.sqrt(2),2);return"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r+"M"+e+",0A"+e+","+e+" 0 1,1 0,-"+e+"A"+e+","+e+" 0 0,1 "+e+",0Z"},needLine:!0,noDot:!0},"square-cross":{n:29,f:function(t){var e=n.round(t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"square-x":{n:30,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e+"M"+e+","+e+"H-"+e+"V-"+e+"H"+e+"Z"},needLine:!0,noDot:!0},"diamond-cross":{n:31,f:function(t){var e=n.round(1.3*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM0,-"+e+"V"+e+"M-"+e+",0H"+e},needLine:!0,noDot:!0},"diamond-x":{n:32,f:function(t){var e=n.round(1.3*t,2),r=n.round(.65*t,2);return"M"+e+",0L0,"+e+"L-"+e+",0L0,-"+e+"ZM-"+r+",-"+r+"L"+r+","+r+"M-"+r+","+r+"L"+r+",-"+r},needLine:!0,noDot:!0},"cross-thin":{n:33,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e},needLine:!0,noDot:!0,noFill:!0},"x-thin":{n:34,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e+"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0,noFill:!0},asterisk:{n:35,f:function(t){var e=n.round(1.2*t,2),r=n.round(.85*t,2);return"M0,"+e+"V-"+e+"M"+e+",0H-"+e+"M"+r+","+r+"L-"+r+",-"+r+"M"+r+",-"+r+"L-"+r+","+r},needLine:!0,noDot:!0,noFill:!0},hash:{n:36,f:function(t){var e=n.round(t/2,2),r=n.round(t,2);return"M"+e+","+r+"V-"+r+"m-"+r+",0V"+r+"M"+r+","+e+"H-"+r+"m0,-"+r+"H"+r},needLine:!0,noFill:!0},"y-up":{n:37,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+","+i+"L0,0M"+e+","+i+"L0,0M0,-"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-down":{n:38,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+e+",-"+i+"L0,0M"+e+",-"+i+"L0,0M0,"+r+"L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-left":{n:39,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M"+i+","+e+"L0,0M"+i+",-"+e+"L0,0M-"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"y-right":{n:40,f:function(t){var e=n.round(1.2*t,2),r=n.round(1.6*t,2),i=n.round(.8*t,2);return"M-"+i+","+e+"L0,0M-"+i+",-"+e+"L0,0M"+r+",0L0,0"},needLine:!0,noDot:!0,noFill:!0},"line-ew":{n:41,f:function(t){var e=n.round(1.4*t,2);return"M"+e+",0H-"+e},needLine:!0,noDot:!0,noFill:!0},"line-ns":{n:42,f:function(t){var e=n.round(1.4*t,2);return"M0,"+e+"V-"+e},needLine:!0,noDot:!0,noFill:!0},"line-ne":{n:43,f:function(t){var e=n.round(t,2);return"M"+e+",-"+e+"L-"+e+","+e},needLine:!0,noDot:!0,noFill:!0},"line-nw":{n:44,f:function(t){var e=n.round(t,2);return"M"+e+","+e+"L-"+e+",-"+e},needLine:!0,noDot:!0,noFill:!0}}},{d3:128}],645:[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"}}}},{}],646:[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;u0;t.each(function(t){var f,h=t[0].trace,d=h.error_x||{},p=h.error_y||{};h.ids&&(f=function(t){return t.id});var m=o.hasMarkers(h)&&h.marker.maxdisplayed>0;p.visible||d.visible||(t=[]);var g=n.select(this).selectAll("g.errorbar").data(t,f);if(g.exit().remove(),t.length){d.visible||g.selectAll("path.xerror").remove(),p.visible||g.selectAll("path.yerror").remove(),g.style("opacity",1);var v=g.enter().append("g").classed("errorbar",!0);u&&v.style("opacity",0).transition().duration(r.duration).style("opacity",1),a.setClipUrl(g,e.layerClipId),g.each(function(t){var e=n.select(this),a=function(t,e,r){var n={x:e.c2p(t.x),y:r.c2p(t.y)};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,l,c);if(!m||t.vis){var o;if(p.visible&&i(a.x)&&i(a.yh)&&i(a.ys)){var f=p.width;o="M"+(a.x-f)+","+a.yh+"h"+2*f+"m-"+f+",0V"+a.ys,a.noYS||(o+="m-"+f+",0h"+2*f);var h=e.select("path.yerror");(s=!h.size())?h=e.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0):u&&(h=h.transition().duration(r.duration).ease(r.easing)),h.attr("d",o)}if(d.visible&&i(a.y)&&i(a.xh)&&i(a.xs)){var g=(d.copy_ystyle?p:d).width;o="M"+a.xh+","+(a.y-g)+"v"+2*g+"m0,-"+g+"H"+a.xs,a.noXS||(o+="m0,-"+g+"v"+2*g);var v=e.select("path.xerror");(s=!v.size())?v=e.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0):u&&(v=v.transition().duration(r.duration).ease(r.easing)),v.attr("d",o)}}})}})}},{"../../traces/scatter/subtypes":1088,"../drawing":643,d3:128,"fast-isnumeric":140}],651:[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":618,d3:128}],652:[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":816}],653:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../registry");e.exports=function(t){function e(t){return function(e){return n.coerceHoverinfo({hoverinfo:e},{_module:t._module},a)}}for(var r=t.calcdata,a=t._fullLayout,o=0;o=0&&r.indextt.width||$<0||$>tt.height)return v.unhoverRaw(t,e);e.pointerX=e.offsetX,e.pointerY=e.offsetY}if(P="xval"in e?b.flat(m,e.xval):b.p2c(S,Q),O="yval"in e?b.flat(m,e.yval):b.p2c(E,$),!c(P[0])||!c(O[0]))return f.warn("Fx.hover failed",e,t),v.unhoverRaw(t,e)}var et=1/0;for(R=0;RY&&(Z.splice(0,Y),et=Z[0].distance),_._has("cartesian")&&0!==X&&0===Z.length){G.distance=X,G.index=!1;var ot=j._module.hoverPoints(G,q,H,"closest",_._hoverlayer);if(ot){var st,lt=ot.filter(function(t){return t.xa.showspikes});if(lt.length){var ct=lt[0];c(ct.x0)&&c(ct.y0)&&(st=d(ct),(!K.vLinePoint||K.vLinePoint.distance>st.distance)&&(K.vLinePoint=st))}var ut=ot.filter(function(t){return t.ya.showspikes});if(ut.length){var ft=ut[0];c(ft.x0)&&c(ft.y0)&&(st=d(ft),(!K.hLinePoint||K.hLinePoint.distance>st.distance)&&(K.hLinePoint=st))}}}}var ht={fullLayout:_,container:_._hoverlayer,outerContainer:_._paperdiv,event:e},dt=t._spikepoints,pt={vLinePoint:K.vLinePoint,hLinePoint:K.hLinePoint};if(t._spikepoints=pt,_._has("cartesian")&&0!==X&&0!==Z.length){var mt=u(Z.filter(function(t){return t.ya.showspikes}),X);K.hLinePoint=d(mt);var gt=u(Z.filter(function(t){return t.xa.showspikes}),X);K.vLinePoint=d(gt)}if(0===Z.length){var vt=v.unhoverRaw(t,e);return!_._has("cartesian")||null===K.hLinePoint&&null===K.vLinePoint||s(dt)&&o(K,ht),vt}_._has("cartesian")&&s(dt)&&o(K,ht),Z.sort(function(t,e){return t.distance-e.distance});var yt=t._hoverdata,xt=[];for(F=0;F1,wt=i(Z,{hovermode:I,rotateLabels:_t,bgColor:g.combine(_.plot_bgcolor||g.background,_.paper_bgcolor),container:_._hoverlayer,outerContainer:_._paperdiv,commonLabelOpts:_.hoverlabel,hoverdistance:_.hoverdistance},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;se.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=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,f=0,h=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)?k: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&&f<=t.length;){for(f++,i=!0,s=0;s.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),h.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++}h.forEach(n)}for(s=h.length-1;s>=0;s--){var v=h[s];for(l=v.length-1;l>=0;l--){var y=v[l],x=t[y.i];x.offset=y.dp,x.del=y.del}}}(Z,_t?"xa":"ya",_),a(wt,_t),e.target&&e.target.tagName){var Mt=x.getComponentMethod("annotations","hasClickToShow")(t,xt);p(l.select(e.target),Mt?"pointer":"")}e.target&&!n&&function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}(t,0,yt)&&(yt&&t.emit("plotly_unhover",{event:e,points:yt}),t.emit("plotly_hover",{event:e,points:t._hoverdata,xaxes:S,yaxes:E,xvals:P,yvals:O}))}function i(t,e,r){var n,i,a=e.hovermode,o=e.rotateLabels,s=e.bgColor,c=e.container,u=e.outerContainer,f=e.commonLabelOpts||{},h=e.fontFamily||_.HOVERFONT,p=e.fontSize||_.HOVERFONTSIZE,v=t[0],y=v.xa,x=v.ya,b="y"===a?"yLabel":"xLabel",M=v[b],k=(String(M)||"").split(" ")[0],A=u.node().getBoundingClientRect(),T=A.top,L=A.width,C=A.height,z=v.distance<=e.hoverdistance&&("x"===a||"y"===a);for(n=0;n-1&&n.length>v&&(n=v>3?n.substr(0,v-3)+"...":n.substr(0,v))}void 0!==t.extraText&&(i+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(i+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(i+="y: "+t.yLabel+"
"),i+=(i?"z: ":"")+t.zLabel):z&&t[a+"Label"]===M?i=t[("x"===a?"y":"x")+"Label"]||"":void 0===t.xLabel?void 0!==t.yLabel&&(i=t.yLabel):i=void 0===t.yLabel?t.xLabel:"("+t.xLabel+", "+t.yLabel+")",t.text&&!Array.isArray(t.text)&&(i+=(i?"
":"")+t.text),""===i&&(""===n&&e.remove(),i=n);var y=e.select("text.nums").call(m.font,t.fontFamily||h,t.fontSize||p,t.fontColor||f).text(i).attr("data-notex",1).call(d.positionText,0,0).call(d.convertToTspans,r),x=e.select("text.name"),b=0;n&&n!==i?(x.call(m.font,t.fontFamily||h,t.fontSize||p,u).text(n).attr("data-notex",1).call(d.positionText,0,0).call(d.convertToTspans,r),b=x.node().getBoundingClientRect().width+2*E):(x.remove(),e.select("rect").remove()),e.select("path").style({fill:u,stroke:f});var _,k,A=y.node().getBoundingClientRect(),D=t.xa._offset+(t.x0+t.x1)/2,I=t.ya._offset+(t.y0+t.y1)/2,P=Math.abs(t.x1-t.x0),O=Math.abs(t.y1-t.y0),F=A.width+S+E+b;t.ty0=T-A.top,t.bx=A.width+2*E,t.by=A.height+2*E,t.anchor="start",t.txwidth=A.width,t.tx2width=b,t.offset=0,o?(t.pos=D,_=I+O/2+F<=C,k=I-O/2-F>=0,"top"!==t.idealAlign&&_||!k?_?(I+=O/2,t.anchor="start"):t.anchor="middle":(I-=O/2,t.anchor="end")):(t.pos=I,_=D+P/2+F<=L,k=D-P/2-F>=0,"left"!==t.idealAlign&&_||!k?_?(D+=P/2,t.anchor="start"):t.anchor="middle":(D-=P/2,t.anchor="end")),y.attr("text-anchor",t.anchor),b&&x.attr("text-anchor",t.anchor),e.attr("transform","translate("+D+","+I+")"+(o?"rotate("+w+")":""))}),P}function a(t,e){t.each(function(t){var r=l.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*(S+E),s=o+a*(t.txwidth+E),c=0,u=t.offset;"middle"===t.anchor&&(o-=t.tx2width/2,s-=t.tx2width/2),e&&(u*=-T,c=t.offset*A),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*S+c)+","+(S+u)+"v"+(t.by/2-S)+"h"+n*t.bx+"v-"+t.by+"H"+(n*S+c)+"V"+(u-S)+"Z"),i.call(d.positionText,o+c,u+t.ty0-t.by/2+E),t.tx2width&&(r.select("text.name").call(d.positionText,s+a*E+c,u+t.ty0-t.by/2+E),r.select("rect").call(m.setRect,s+(a-1)*t.tx2width/2+c,u-t.by/2-1,t.tx2width,t.by+2))}})}function o(t,e){var r,n,i=e.container,a=e.fullLayout,o=e.event,s=!!t.hLinePoint,l=!!t.vLinePoint;if(i.selectAll(".spikeline").remove(),l||s){var c=g.combine(a.plot_bgcolor,a.paper_bgcolor);if(s){var f,h,d=t.hLinePoint;r=d&&d.xa;"cursor"===(n=d&&d.ya).spikesnap?(f=o.pointerX,h=o.pointerY):(f=r._offset+(d.x0+d.x1)/2,h=n._offset+(d.y0+d.y1)/2);var p,v,y=u.readability(d.color,c)<1.5?g.contrast(c):d.color,x=n.spikemode,b=n.spikethickness,_=n.spikecolor||y,w=n._boundingBox,M=(w.left+w.right)/2=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}},{}],670:[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":816,"../color/attributes":617}],671:[function(t,e,r){"use strict";e.exports={scrollBarWidth:4,scrollBarHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4}},{}],672:[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,f,h,d=t.legend||{},p=e.legend={},m=0,g="normal",v=0;v1)){if(l("bgcolor",e.paper_bgcolor),l("bordercolor"),l("borderwidth"),i.coerceFont(l,"font",e.font),l("orientation"),"h"===p.orientation){var x=t.xaxis;x&&x.rangeslider&&x.rangeslider.visible?(c=0,f="left",u=1.1,h="bottom"):(c=0,f="left",u=-.1,h="top")}l("traceorder",g),s.isGrouped(e.legend)&&l("tracegroupgap"),l("x",c),l("xanchor",f),l("y",u),l("yanchor",h),i.noneOrAll(d,p,["x","y"])}}},{"../../lib":743,"../../plots/layout_attributes":843,"../../registry":873,"./attributes":670,"./helpers":676}],673:[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*x;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),f=c.node();n=s*u,i=f?d.bBox(f).width:0;var h=s*(.3+(1-u)/2);m.positionText(c,40,h)}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=f.traceIs(a,"pie"),s=a.index,u=o?n.label:a.name,h=t.selectAll("text.legendtext").data([0]);h.enter().append("text").classed("legendtext",!0),h.attr("text-anchor","start").classed("user-select-none",!0).call(d.font,i.legend.font).text(u),e._context.edits.legendText&&!o?h.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(f.hasTransform(o,"groupby")){var h=f.getTransformIndices(o,"groupby"),d=h[h.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)}):h.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._legendMouseDownTimek&&(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(),f=0,h=u.length;fa+_-M,r.each(function(t){var e=t[0],r=g?40+t[0].width:x;a+b+M+r>n.width-(n.margin.r+n.margin.l)&&(b=0,v+=y,i.height=i.height+y,y=0),d.setTranslate(this,a+b,5+a+e.height/2+v),i.width+=M+r,i.height=Math.max(i.height,e.height),b+=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"),f=t("../../registry"),h=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"),x=t("../../constants/alignment").LINE_SPACING,b=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,N,t,v.scrollBarWidth,v.scrollBarHeight),T.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,x=r.showlegend&&b(t.calcdata,y),w=r.hiddenlabels||[];if(!r.showlegend||!x.length)return r._infolayer.selectAll(".legend").remove(),r._topdefs.select("#"+m).remove(),void u.autoMargin(t,"legend");var A=r._infolayer.selectAll("g.legend").data([0]);A.enter().append("g").attr({class:"legend","pointer-events":"all"});var T=r._topdefs.selectAll("#"+m).data([0]);T.enter().append("clipPath").attr("id",m).append("rect");var S=A.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=A.selectAll("g.scrollbox").data([0]);E.enter().append("g").attr("class","scrollbox");var L=A.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(x);C.enter().append("g").attr("class","groups"),C.exit().remove();var z=C.selectAll("g.traces").data(c.identity);z.enter().append("g").attr("class","traces"),z.exit().remove(),z.call(_,t).style("opacity",function(t){var e=t[0].trace;return f.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 D=0!==A.enter().size();D&&(a(t,C,z),o(t));var I=r.width,P=r.height;a(t,C,z),y.height>P?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 N=y.width,j=O.w;N>j?(F=O.l,N=j):(F+N>I&&(F=I-N),F<0&&(F=0),N=Math.min(I-F,y.width));var B=y.height,U=O.h;B>U?(R=O.t,B=U):(R+B>P&&(R=P-B),R<0&&(R=0),B=Math.min(P-R,y.height)),d.setTranslate(A,F,R);var V,q,H=B-v.scrollBarHeight-2*v.scrollBarMargin,G=y.height-B;if(y.height<=B||t._context.staticPlot)S.attr({width:N-y.borderwidth,height:B-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),d.setTranslate(E,0,0),T.select("rect").attr({width:N-2*y.borderwidth,height:B-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth}),E.call(d.setClipUrl,m);else{V=v.scrollBarMargin,q=E.attr("data-scroll")||0,S.attr({width:N-2*y.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-y.borderwidth,x:y.borderwidth/2,y:y.borderwidth/2}),T.select("rect").attr({width:N-2*y.borderwidth+v.scrollBarWidth+v.scrollBarMargin,height:B-2*y.borderwidth,x:y.borderwidth,y:y.borderwidth-q}),E.call(d.setClipUrl,m),D&&e(V,q),A.on("wheel",null),A.on("wheel",function(){q=c.constrain(E.attr("data-scroll")-s.event.deltaY/H*G,-G,0),e(V=v.scrollBarMargin-q/G*H,q),0!==q&&q!==-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+H),q=-(V-v.scrollBarMargin)/H*G,e(V,q)});L.call(Y),E.call(Y)}if(t._context.edits.legendPosition){var W,X,Z,J;A.classed("cursor-move",!0),h.init({element:A.node(),gd:t,prepFn:function(){var t=d.getTranslate(A);Z=t.x,J=t.y},moveFn:function(t,e){var r=Z+t,n=J+e;d.setTranslate(A,r,n),W=h.align(r,0,O.l,O.l+O.w,y.xanchor),X=h.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?A._clickTimeout=setTimeout(function(){g(i,t,e)},k):2===e&&(A._clickTimeout&&clearTimeout(A._clickTimeout),g(i,t,e)))}})}}}},{"../../constants/alignment":716,"../../constants/interactions":720,"../../lib":743,"../../lib/svg_text_utils":766,"../../plotly":784,"../../plots/plots":852,"../../registry":873,"../color":618,"../dragelement":640,"../drawing":643,"./anchor_utils":669,"./constants":671,"./get_legend_data":674,"./handle_click":675,"./helpers":676,"./style":678,d3:128}],674:[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"+f;l.push(n),s[n]=[[r]],f++}}var a,o,s={},l=[],c=!1,u={},f=0;for(a=0;ar[1])return r[1]}return i}function i(t){return t[0]}var s,c,u=t[0],f=u.trace,h=l.hasMarkers(f),d=l.hasText(f),p=l.hasLines(f);if(h||d||p){var m={},g={};h&&(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(f,g)}var v=n.select(this).select("g.legendpoints"),y=v.selectAll("path.scatterpts").data(h?s:[]);y.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),y.exit().remove(),y.call(o.pointStyle,c,e),h&&(s[0].mrc=3);var x=v.selectAll("g.pointtext").data(d?s:[]);x.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),x.exit().remove(),x.selectAll("text").call(o.textPointStyle,c,e)})}},{"../../lib":743,"../../registry":873,"../../traces/pie/style_one":1052,"../../traces/scatter/subtypes":1088,"../color":618,"../drawing":643,d3:128}],679:[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=h.list(t,null,!0),f="on";if("zoom"===a){var d,p="in"===o?.5:2,m=(1+p)/2,g=(1-p)/2;for(n=0;n1)return n(["resetViews","toggleHover"]),i(x,r);h&&(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;r0)){var d=function(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,a=0;ad&&(d=f)));return d>=h?[h,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;sV&&n>q&&!t.shiftKey?f.getCursor(i/r,1-a/n):"move";h(e,o),U=o.split("-")[0]}var c,u,d,m,g,v,y,x,b,_,w,M,k,A,T,S,E,L,C,z,D,I,P,O,F,R,N,j,B,U,V=10,q=10,H={element:e.node(),gd:t,prepFn:function(o){O=l.getFromId(t,r.xref),F=l.getFromId(t,r.yref),R=p.getDataToPixel(t,O),N=p.getDataToPixel(t,F,!0),j=p.getPixelToData(t,O),B=p.getPixelToData(t,F,!0);var f="shapes["+n+"]";"path"===r.type?(I=r.path,P=f+".path"):(u=R(r.x0),d=N(r.y0),m=R(r.x1),g=N(r.y1),v=f+".x0",y=f+".y0",x=f+".x1",b=f+".y1");uq&&(c[A]=r[L]=B(u),c[T]=r[C]=B(f)),d-h>V&&(c[S]=r[z]=j(h),c[E]=r[D]=j(d))}e.attr("d",i(t,r))}},doneFn:function(){h(e),o.relayout(t,c)}},G=H.element.getBoundingClientRect();f.init(H),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),f=t._fullLayout._size;if(c?(r=p.shapePositionToRange(c),n=function(t){return c._offset+c.r2p(r(t,!0))}):n=function(t){return f.l+f.w*t},u?(i=p.shapePositionToRange(u),a=function(t){return u._offset+u.r2p(i(t,!0))}):a=function(t){return f.t+f.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 h=n(e.x0),m=n(e.x1),g=a(e.y0),v=a(e.y1);if("line"===o)return"M"+h+","+g+"L"+m+","+v;if("rect"===o)return"M"+h+","+g+"H"+m+"V"+v+"H"+h+"Z";var y=(h+m)/2,x=(g+v)/2,b=Math.abs(y-h),_=Math.abs(x-g),w="A"+b+","+_,M=y+b+","+x;return"M"+M+w+" 0 1,1 "+(y+","+(x-_))+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"),f=t("../dragelement"),h=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;r0)){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":743,"../../plots/array_container_defaults":786,"./attributes":704,"./constants":705}],707:[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(b.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(x.stroke,r.bordercolor).call(x.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(b.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),b.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(h,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(x.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(x.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),e.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function f(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(x.fill,e.tickcolor),b.setTranslate(i,d(e,r/(e.steps.length-1))-.5*e.tickwidth,(n?M.tickOffset:M.minorTickOffset)+e.currentValueTotalHeight)})}function h(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(x.fill,r.bgcolor).attr("opacity",0),b.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(x.stroke,e.bordercolor).call(x.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),b.setTranslate(r,M.railInset,.5*(e.inputAreaWidth-M.railWidth)+e.currentValueTotalHeight)}var v=t("d3"),y=t("../../plots/plots"),x=t("../color"),b=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;i0?[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.steps.length&&(r.active=0),e.call(i,r).call(g,r).call(s,r).call(f,r).call(m,t,r).call(a,t,r),b.setTranslate(e,r.lx+r.pad.l,r.ly+r.pad.t),e.call(h,r,r.active/(r.steps.length-1),!1),e.call(i,r)}(t,v.select(this),e)}})}}},{"../../constants/alignment":716,"../../lib/svg_text_utils":766,"../../plots/plots":852,"../color":618,"../drawing":643,"../legend/anchor_utils":669,"./constants":705,d3:128}],708:[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":704,"./constants":705,"./defaults":706,"./draw":707}],709:[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"),f=t("../../constants/interactions"),h=/ [XY][0-9]* /;(e.exports={}).draw=function(t,e,r){function d(t){s.syncOrAsync([p,m],t)}function p(e){var r;return M?(r="",M.rotate&&(r+="rotate("+[M.rotate,w.x,w.y]+")"),M.offset&&(r+="translate(0, "+M.offset+")")):r=null,e.attr("transform",r),e.style({"font-family":S,"font-size":n.round(E,2)+"px",fill:c.rgb(L),opacity:C*c.opacity(L),"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&&D){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()),f={left:0,top:0,right:A.width,bottom:A.height},h=_.maxShift||(f[_.side]-u[_.side])*("left"===_.side||"top"===_.side?-1:1);if(h<0)r=h;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(h,r)}if(r>0||h<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,x=r.placeholder,b=r.traceIndex,_=r.avoid||{},w=r.attributes,M=r.transform,k=r.containerGroup,A=t._fullLayout,T=v.titlefont||{},S=T.family,E=T.size,L=T.color,C=1,z=!1,D=(v.title||"").trim();"title"===y?g="titleText":-1!==y.indexOf("axis")?g="axisTitleText":y.indexOf(!0)&&(g="colorbarTitleText");var I=t._context.edits[g];""===D?C=0:D.replace(h," % ")===x.replace(h," % ")&&(C=.2,z=!0,I||(D=""));var P=D||I;k||(k=A._infolayer.selectAll(".g-"+e).data([0])).enter().append("g").classed("g-"+e,!0);var O=k.selectAll("text").data(P?[0]:[]);return O.enter().append("text"),O.text(D).attr("class",e),O.exit().remove(),P?(O.call(d),I&&(D?O.on(".opacity",null):(C=0,z=!0,O.text(x).on("mouseover.opacity",function(){n.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){n.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})),O.call(u.makeEditable,{gd:t}).on("edit",function(e){void 0!==b?a.restyle(t,y,e,b):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)})),O.classed("js-placeholder",z),k):k}},{"../../constants/interactions":720,"../../lib":743,"../../lib/svg_text_utils":766,"../../plotly":784,"../../plots/plots":852,"../color":618,"../drawing":643,d3:128,"fast-isnumeric":140}],710:[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":732,"../../plot_api/edit_types":773,"../../plots/font_attributes":816,"../../plots/pad_attributes":851,"../color/attributes":617}],711:[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"}}},{}],712:[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;c0)&&(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":743,"../../plots/array_container_defaults":786,"./attributes":710,"./constants":711}],713:[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,f={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,f,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(x.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(h)}),o.on("mouseout",function(){o.call(d,a)}),x.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,x=0,b=-1!==["up","down"].indexOf(i.direction);"dropdown"===i.type&&(b?x=i.headerHeight+M.gapButtonHeader:y=i.headerWidth+M.gapButtonHeader),"dropdown"===i.type&&"up"===i.direction&&(x=-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+x+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(h)}),u.on("mouseout",function(){u.call(d,i),c.call(f,i)})}),c.call(f,i),b?(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,f=i.active;if(u)for(s=0,l=0;l0?[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;nw,A=n.barLength+2*n.barPad,T=n.barWidth+2*n.barPad,S=p,E=g+v;E+T>c&&(E=c-T);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:A,height:T}),this._hbarXMin=S+A/2,this._hbarTranslateMax=w-A):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var C=v>M,z=n.barWidth+2*n.barPad,D=n.barLength+2*n.barPad,I=p+m,P=g;I+z>l&&(I=l-z);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:I,y:P,width:z,height:D}),this._vbarYMin=P+D/2,this._vbarTranslateMax=M-D):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var F=this.id,R=u-.5,N=C?f+z+.5:f+.5,j=h-.5,B=k?d+T+.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(j),width:Math.ceil(N)-Math.floor(R),height:Math.ceil(B)-Math.floor(j)}),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 q=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(q),C&&this.vbar.on(".drag",null).call(q)}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":743,"../color":618,"../drawing":643,d3:128}],716:[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"}}},{}],717:[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]}},{}],718:[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]}},{}],719:[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"}},{}],720:[function(t,e,r){"use strict";e.exports={SHOW_PLACEHOLDER:100,HIDE_PLACEHOLDER:1e3,DBLCLICKDELAY:300,DESELECTDIM:.2}},{}],721:[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"}},{}],722:[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"}}},{}],723:[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}},{}],724:[function(t,e,r){"use strict";var n=t("./plotly");r.version="1.33.1",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":609,"./components/annotations3d":614,"./components/fx":660,"./components/images":668,"./components/legend":677,"./components/rangeselector":689,"./components/rangeslider":695,"./components/shapes":702,"./components/sliders":708,"./components/updatemenus":714,"./fonts/mathjax_config":725,"./lib/queue":757,"./locale-en":771,"./locale-en-us":770,"./plot_api/plot_schema":778,"./plot_api/register":779,"./plot_api/set_plot_config":780,"./plot_api/to_image":782,"./plot_api/validate":783,"./plotly":784,"./snapshot":878,"./snapshot/download":875,"./traces/scatter":1078,d3:128,"es6-promise":137}],725:[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},{}],726:[function(t,e,r){"use strict";var n=Math.PI;r.deg2rad=function(t){return t/180*n},r.rad2deg=function(t){return t/n*180},r.wrap360=function(t){var e=t%360;return e<0?e+360:e},r.wrap180=function(t){return Math.abs(t)>180&&(t-=360*Math.round(t/360)),t}},{}],727:[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":721,"fast-isnumeric":140}],728:[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,u=t("./angles").wrap180;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;ni.max?e.set(r):e.set(+t)}},integer:{coerceFunction:function(t,e,r,i){t%1||!n(t)||void 0!==i.min&&ti.max?e.set(r):e.set(+t)}},string:{coerceFunction:function(t,e,r,n){if("string"!=typeof t){var i="number"==typeof t;!0!==n.strict&&i?e.set(String(t)):e.set(r)}else n.noBlank&&!t?e.set(r):e.set(t)}},color:{coerceFunction:function(t,e,r){i(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every(function(t){return i(t).isValid()})?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(o(t,r))}},angle:{coerceFunction:function(t,e,r){"auto"===t?e.set("auto"):n(t)?e.set(u(+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;a0&&(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"),f=t("./mod"),h=t("../constants/numerical"),d=h.BADNUM,p=h.ONEDAY,m=h.ONEHOUR,g=h.ONEMIN,v=h.ONESEC,y=h.EPOCHJD,x=t("../registry"),b=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?x.getComponentMethod("calendars","CANONICAL_SUNDAY")[t]:x.getComponentMethod("calendars","CANONICAL_TICK")[t]:e?"2000-01-02":"2000-01-01"},r.dfltRange=function(t){return n(t)?x.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,A;r.dateTime2ms=function(t,e){if(r.isJSDate(t))return(t=Number(t)-t.getTimezoneOffset()*g)>=k&&t<=A?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),f=Number(s[7]||0),h=Number(s[9]||0),b=Number(s[11]||0);if(i){if(2===l.length)return d;l=Number(l);var T;try{var S=x.getComponentMethod("calendars","getCal")(e);if(o){var E="i"===c.charAt(c.length-1);c=parseInt(c,10),T=S.newDate(l,S.toMonthIndex(l,c,E),u)}else T=S.newDate(l,Number(c),u)}catch(t){return d}return T?(T.toJD()-y)*p+f*m+h*g+b*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,f,h));return L.setUTCFullYear(l),L.getUTCMonth()!==c?d:L.getUTCDate()!==u?d:L.getTime()+b*v},k=r.MIN_MS=r.dateTime2ms("-9999"),A=r.MAX_MS=r.dateTime2ms("9999-12-31 23:59:59.9999"),r.isDateTime=function(t,e){return r.dateTime2ms(t,e)!==d};var T=90*p,S=3*m,E=5*g;r.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=k&&t<=A))return d;e||(e=0);var i,o,s,l,c,u,h=Math.floor(10*f(t+.05,1)),_=Math.round(t-h/10);if(n(r)){var w=Math.floor(_/p)+y,M=Math.floor(f(t,p));try{i=x.getComponentMethod("calendars","getCal")(r).fromJD(w).formatDate("yyyy-mm-dd")}catch(t){i=b("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=k+p&&t<=A-p))return d;var e=Math.floor(10*f(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=x.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,f=x.getComponentMethod("calendars","getCal")(a).fromJD(u);"y"===r?c=s(f):"m"===r?c=function(t){return t.formatDate("M yyyy")}(f):"d"===r?(l=s(f),c=function(t){return t.formatDate("M d")}(f)):(l=function(t){return t.formatDate("M d, yyyy")}(f),c=o(t,r))}catch(t){return"Invalid"}else{var h=new Date(Math.floor(t+.05));"y"===r?c=i("%Y")(h):"m"===r?c=i("%b %Y")(h):"d"===r?(l=i("%Y")(h),c=i("%b %-d")(h)):(l=i("%b %-d, %Y")(h),c=o(t,r))}return c+(l?"\n"+l:"")};var z=3*p;r.incrementMonth=function(t,e,r){r=n(r)&&r;var i=f(t,p);if(t=Math.round(t-i),r)try{var a=Math.round(t/p)+y,o=x.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+z);return l.setUTCMonth(l.getUTCMonth()+e)+i-z},r.findExactDates=function(t,e){for(var r,i,a=0,o=0,s=0,l=0,u=n(e)&&x.getComponentMethod("calendars","getCal")(e),f=0;f0&&(r.push(i),i=[])}return i.length>0&&r.push(i),r},r.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},r.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r1||m<0||m>1?null:{x:t+l*m,y:e+f*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,f=a-e,h=l-o,d=c-s,p=u*u+f*f,m=h*h+d*d,g=Math.min(i(u,f,p,o-t,s-e),i(u,f,p,l-t,c-e),i(h,d,m,t-o,e-s),i(h,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)),f=t.getPointAtLength(a(r,e)),h={x:(4*f.x+i.x+c.x)/6,y:(4*f.y+i.y+c.y)/6,theta:u};return o[r]=h,h},r.clearLocationCache=function(){s=null},r.getVisibleSegment=function(t,e,r){function n(e){var r=t.getPointAtLength(e);0===e?i=r:e===f&&(a=r);var n=r.xs?r.x-s:0,u=r.yc?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,f=t.getTotalLength(),h=f,d=n(u);d;){if((u+=d+r)>h)return;d=n(u)}for(d=n(h);d;){if(h-=d+r,u>h)return;d=n(h)}return{min:u,max:h,len:h-u,total:f,isClosed:0===u&&h===f&&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,f=0,h=0,d=s;f0?d=i:h=i,f++}return a}},{"./mod":750}],738:[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}},{}],739:[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:f}var o=t("fast-isnumeric"),s=t("color-normalize"),l=t("../components/colorscale"),c=t("../components/color/attributes").defaultLine,u=s(c),f=1;e.exports=function(t,e,r){var o,c,h,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,h=v?function(t,e){return void 0===t[e]?f:a(t[e])}:a,g||v)for(var x=0;x=0;){var n=t.indexOf(";",r);if(n/g,"")}(function(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n")}(t))))}},{"../constants/string_mappings":722,"superscript-text":539}],742:[function(t,e,r){"use strict";e.exports=function(t){return t}},{}],743:[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 f=t("./search");l.findBin=f.findBin,l.sorterAsc=f.sorterAsc,l.sorterDes=f.sorterDes,l.distinctVals=f.distinctVals,l.roundUp=f.roundUp;var h=t("./stats");l.aggNums=h.aggNums,l.len=h.len,l.mean=h.mean,l.variance=h.variance,l.stdev=h.stdev,l.interp=h.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("./angles");l.deg2rad=p.deg2rad,l.rad2deg=p.rad2deg,l.wrap360=p.wrap360,l.wrap180=p.wrap180;var m=t("./geometry2d");l.segmentsIntersect=m.segmentsIntersect,l.segmentDistance=m.segmentDistance,l.getTextLocation=m.getTextLocation,l.clearLocationCache=m.clearLocationCache,l.getVisibleSegment=m.getVisibleSegment,l.findPointOnPath=m.findPointOnPath;var g=t("./extend");l.extendFlat=g.extendFlat,l.extendDeep=g.extendDeep,l.extendDeepAll=g.extendDeepAll,l.extendDeepNoArrays=g.extendDeepNoArrays;var v=t("./loggers");l.log=v.log,l.warn=v.warn,l.error=v.error;var y=t("./regex");l.counterRegex=y.counter;var x=t("./throttle");l.throttle=x.throttle,l.throttleDone=x.done,l.clearThrottle=x.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;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},l.bBoxIntersect=function(t,e,r){return r=r||0,t.left<=e.right+r&&e.left<=t.right+r&&t.top<=e.bottom+r&&e.top<=t.bottom+r},l.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||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=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=0&&t%1==0}function a(e){return void 0!==e&&e1?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 w=/%{([^\s%{}]*)}/g,M=/^\w*$/;l.templateString=function(t,e){var r={};return t.replace(w,function(t,n){return M.test(n)?e[n]||"":(r[n]=r[n]||l.nestedProperty(e,n).get,r[n]()||"")})};l.subplotSort=function(t,e){for(var r=Math.min(t.length,e.length)+1,n=0,i=0,a=0;a=48&&o<=57,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},l.eventListenerOptionsSupported=function(){var t=!1;try{var e=Object.defineProperty({},"passive",{get:function(){t=!0}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(e){t=!1}return t}},{"../constants/numerical":721,"./angles":726,"./clean_number":727,"./coerce":728,"./dates":729,"./ensure_array":730,"./extend":732,"./filter_unique":733,"./filter_visible":734,"./geometry2d":737,"./get_graph_div":738,"./identity":742,"./is_array":744,"./is_plain_object":745,"./keyed_container":746,"./localize":747,"./loggers":748,"./matrix":749,"./mod":750,"./nested_property":751,"./noop":752,"./notifier":753,"./push_unique":756,"./regex":758,"./relative_attr":759,"./relink_private":760,"./search":761,"./stats":764,"./throttle":767,"./to_log_range":768,d3:128,"fast-isnumeric":140}],744:[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)}},{}],745:[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}},{}],746:[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;o2)return l[e]=2|l[e],f.set(t,null);if(u){for(o=e;o1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=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)):f[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"),f=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/g),s=0;so||a===i||al||e&&c(t))}:function(t,e){var a=t[0],c=t[1];if(a===i||ao||c===i||cl)return!1;var u,f,h,d,p,m=r.length,g=r[0][0],v=r[0][1],y=0;for(u=1;uMath.max(f,g)||c>Math.max(h,v)))if(cu||Math.abs(n(o,h))>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;c1){r(t.pop())}return{addPt:r,raw:t,filtered:n}}},{"../constants/numerical":721,"./matrix":749}],756:[function(t,e,r){"use strict";e.exports=function(t,e){if(e instanceof RegExp){var r,n=e.toString();for(r=0;ri.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--))},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=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r1?(e[l-1]-e[0])/(l-1):1;for(o=u>=0?r?function(t,e){return t=e}:function(t,e){return t>e},t+=1e-9*u*(r?-1:1)*(u>=0?1:-1);s90&&i.log("Long binary search..."),s-1},r.sorterAsc=function(t,e){return t-e},r.sorterDes=function(t,e){return e-t},r.distinctVals=function(t){var e=t.slice();e.sort(r.sorterAsc);for(var n=e.length-1,i=e[n]-e[0]||1,a=i/(n||1)/1e4,o=[e[0]],s=0;se[s]+a&&(i=Math.min(i,e[s+1]-e[s]),o.push(e[s+1]));return{vals:o,minDiff:i}},r.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,c=r?Math.ceil:Math.floor;it.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":140}],765:[function(t,e,r){"use strict";var n=t("color-normalize");e.exports=function(t){return t?n(t):[0,0,0,1]}},{"color-normalize":99}],766:[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*h+"em"}),t.appendChild(e),s=e;var r=d;if(d=[{node:e}],r.length>1)for(var i=1;i doesnt match end tag <"+t+">. Pretending it did match.",e),s=d[d.length-1].node}else c.log("Ignoring unexpected end tag .",e)}e=function(t){return function(t,e){if(!t)return"";for(var r=0;r|>|>)/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"},x="\u200b",b=["http:","https:","mailto:","",void 0,":"],_=new RegExp("]*)?/?>","g"),w=Object.keys(f.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:f.entityToUnicode[t]}}),M=/(\r\n?|\n)/g,k=/(<[^<>]*>)/,A=/<(\/?)([^ >]*)(\s+(.*))?>/i,T=//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,z=/(^|;)\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":716,"../constants/string_mappings":722,"../constants/xmlns_namespaces":723,"../lib":743,d3:128}],767:[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].tso.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)}},{}],768:[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":140}],769:[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":818,"topojson-client":549}],770:[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"}}},{}],771:[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:["$",""]}}},{}],772:[function(t,e,r){"use strict";var n=t("../registry");e.exports=function(t){for(var e,r,i=n.layoutArrayContainers,a=n.layoutArrayRegexes,o=t.split("[")[0],s=0;s0)return t.substr(0,e)}var s=t("fast-isnumeric"),l=t("gl-mat4/fromQuat"),c=t("../registry"),u=t("../lib"),f=t("../plots/plots"),h=t("../plots/cartesian/axis_ids"),d=h.cleanId,p=h.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=(f.subplotsRegistry.cartesian||{}).attrRegex,o=(f.subplotsRegistry.gl3d||{}).attrRegex,s=Object.keys(t);for(e=0;e3?(T.x=1.02,T.xanchor="left"):T.x<-2&&(T.x=-.02,T.xanchor="right"),T.y>3?(T.y=1.02,T.yanchor="bottom"):T.y<-2&&(T.y=-.02,T.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;s1&&o.warn("Full array edits are incompatible with other edits",f);var y=r[""][""];if(u(y))e.set(null);else{if(!Array.isArray(y))return o.warn("Unrecognized full array edit value",f,y),!0;e.set(y)}return!m&&(h(g,v),d(t),!0)}var x,b,_,w,M,k,A,T=Object.keys(r).map(Number).sort(s),S=e.get(),E=S||[],L=n(v,f).get(),C=[],z=-1,D=E.length;for(x=0;xE.length-(A?0:1))o.warn("index out of range",f,_);else if(void 0!==k)M.length>1&&o.warn("Insertion & removal are incompatible with edits to the same index.",f,_),u(k)?C.push(_):A?("add"===k&&(k={}),E.splice(_,0,k),L&&L.splice(_,0,{})):o.warn("Unrecognized full object edit value",f,_,k),-1===z&&(z=_);else for(b=0;b=0;x--)E.splice(C[x],1),L&&L.splice(C[x],1);if(E.length?S||e.set(E):e.set(null),m)return!1;if(h(g,v),p!==a){var I;if(-1===z)I=T;else{for(D=Math.max(E.length,D),I=[],x=0;x=z);x++)I.push(_);for(x=z;x=t.data.length||i<-t.data.length)throw new Error(r+" must be valid indices for gd.data.");if(e.indexOf(i,n+1)>-1||i>=0&&e.indexOf(-t.data.length+i)>-1||i<0&&e.indexOf(t.data.length+i)>-1)throw new Error("each index in "+r+" must be unique.")}}function 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,f=function(t,e,r,n){var i,o,s,l,c,u=v.isPlainObject(n),f=[];Array.isArray(r)||(r=[r]),r=a(r,t.data.length-1);for(var h in e)for(var d=0;d=0&&uY.range[0]?[1,2]:[2,1]);else{var Z=Y.range[0],J=Y.range[1];W?(Z<=0&&J<=0&&r(j+".autorange",!0),Z<=0?Z=J/1e6:J<=0&&(J=Z/1e6),r(j+".range[0]",Math.log(Z)/Math.LN10),r(j+".range[1]",Math.log(J)/Math.LN10)):(r(j+".range[0]",Math.pow(10,Z)),r(j+".range[1]",Math.pow(10,J)))}else r(j+".autorange",!0);Array.isArray(u._subplots.polar)&&u._subplots.polar.length&&u[E.parts[0]]&&"radialaxis"===E.parts[1]&&delete u[E.parts[0]]._subplot.viewInitial["radialaxis.range"],b.getComponentMethod("annotations","convertCoords")(t,U,L,r),b.getComponentMethod("images","convertCoords")(t,U,L,r)}else r(j+".autorange",!0),r(j+".range",null);v.nestedProperty(u,j+"._inputRange").set(null)}else if(F.match(P.AX_NAME_PATTERN)){var K=v.nestedProperty(u,S).get(),Q=(L||{}).type;Q&&"-"!==Q||(Q="linear"),b.getComponentMethod("annotations","convertCoords")(t,K,Q,r),b.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=q||{editType:"calc"},it=-1!==nt.editType.indexOf("calcIfAutorange");""===o?(it?M.calc=!0:I.update(M,nt),it=!1):""===tt&&(rt=L,C.isAddVal(L)?A[S]=null:C.isRemoveVal(L)?(A[S]=et,rt=et):v.warn("unrecognized full object value",e)),it&&(n(rt,"x")||n(rt,"y"))?M.calc=!0:I.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(j+".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)&&q?I.update(M,q):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(x in T)for(o=0;o=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;so._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,z.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 f(t){return Array.isArray(s)?p>=s.length?t.transitionOpts=s[p]:t.transitionOpts=s[0]:t.transitionOpts=s,p++,t}var h,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:f(v.extendFlat({},e))});else if(g||-1!==["string","number"].indexOf(typeof e))for(h=0;h0&&__)&&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,f=[];for(i=e.length-1;i>=0;i--)if(v.isPlainObject(e[i])){var h=(c[e[i].name]||{}).name,d=e[i].name;h&&d&&"number"==typeof d&&c[h]&&(n++,v.warn('addFrames: overwriting frame "'+c[h].name+'" with a frame whose name of type "number" also equates to "'+h+'". 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.")),f.push({frame:w.supplyFrameDefaults(e[i]),index:r&&void 0!==r[i]&&null!==r[i]?r[i]:u+i})}f.sort(function(t,e){return t.index>e.index?-1:t.index=0;i--){if("number"==typeof(a=f[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=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 x&&x.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":618,"../components/drawing":643,"../components/errorbars":649,"../constants/xmlns_namespaces":723,"../lib":743,"../lib/events":731,"../lib/queue":757,"../lib/svg_text_utils":766,"../plotly":784,"../plots/cartesian/axis_ids":792,"../plots/cartesian/constants":794,"../plots/cartesian/constraints":796,"../plots/cartesian/graph_interact":798,"../plots/plots":852,"../plots/polar/legacy":860,"../registry":873,"./edit_types":773,"./helpers":774,"./manage_arrays":775,"./plot_schema":778,"./subroutines":781,d3:128,"fast-isnumeric":140,"has-hover":276}],777:[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:{}}},{}],778:[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=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={};x(r,h);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=x({},e.layoutAttributes);i[b]=!0,n.set(i)}function l(t,e,r){var n=u.nestedProperty(t,r);n.set(x(n.get()||{},e))}var c=t("../registry"),u=t("../lib"),f=t("../plots/attributes"),h=t("../plots/layout_attributes"),d=t("../plots/frame_attributes"),p=t("../plots/animation_attributes"),m=t("../plots/polar/legacy/area_attributes"),g=t("../plots/polar/legacy/axis_attributes"),v=t("./edit_types"),y=u.extendFlat,x=u.extendDeepAll,b="_isSubplotObj",_="_isLinkedToArray",w=[b,_,"_arrayAttrRegexps","_deprecated"];r.IS_SUBPLOT_OBJ=b,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,x(n,f),x(n,e.attributes),r.attributes&&x(n,r.attributes),n.type=t;var i={meta:e.meta||{},attributes:o(n)};if(e.layoutAttributes){var a={};x(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=x({},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(f,e),t._module&&t._module.attributes&&r.crawl(t._module.attributes,e),t.transforms)for(var a=t.transforms,o=0;o=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||f.type.dflt]||{})._module),!u)return!1;if(r=u.attributes,!(a=r&&r[o])){var h=u.basePlotModule;h&&h.attributes&&(a=h.attributes[o])}a||(a=f[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=t[1]||i[1]<=t[0])&&a[0]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)}),b.each(function(t){function r(t){return"M"+k+","+t+"H"+A}function o(t){return"M"+y._offset+","+t+"h"+y._length}function s(t){return"M"+t+","+z+"V"+C}function c(t){return"M"+t+","+x._offset+"v"+x._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,x=v.yaxis;v.bg&&m&&v.bg.call(h.setRect,y._offset-u,x._offset-u,y._length+2*u,x._length+2*u).call(f.fill,l.plot_bgcolor).style("stroke-width",0),v.clipId="clip"+l._uid+t+"plot";var b=l._clips.selectAll("#"+v.clipId).data([0]);b.enter().append("clipPath").attr({class:"plotclip",id:v.clipId}).append("rect"),b.selectAll("rect").attr({width:y._length,height:x._length}),h.setTranslate(v.plot,y._offset,x._offset);var _,w;for(v._hasClipOnAxisFalse?(_=null,w=v.clipId):(_=v.clipId,w=null),h.setClipUrl(v.plot,_),i=0;i1&&d.push(a("object","layout"))),l.supplyDefaults(p);for(var m=p._fullData,g=r.length,v=0;v10||"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>=E&&i<=16||e>=S)t._tickround="M";else if(e>=L&&i<=19||e>=E)t._tickround="S";else{var a=t.l2r(r+e).replace(/^-/,"").length;t._tickround=Math.max(i,a)-20}}else if(m(e)||"L"===e.charAt(0)){var o=t.range.map(t.r2d||Number);m(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])),l=Math.floor(Math.log(s)/Math.LN10+.01);Math.abs(l)>3&&(c(t.exponentformat)&&!u(l)?t._tickexponent=3*Math.round((l-1)/3):t._tickexponent=l)}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,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=f(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}function r(t,n){return e(n,0)?t:r(n,t%n)}var n=function(t){var r=1;for(;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),i=t*n,a=Math.abs(r(i,n));return[Math.round(i/a),Math.round(n/a)]}(a);if(o[1]>=100)e.text=f(v.deg2rad(e.x),t,i,n);else{var s=e.x<0;1===o[1]?1===o[0]?e.text="\u03c0":e.text=o[0]+"\u03c0":e.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(e.text=C+e.text)}}}}function c(t){return"SI"===t||"B"===t}function u(t){return t>14||t<-15}function f(t,e,r,n){var i=t<0,a=e._tickround,s=r||e.exponentformat||"B",l=e._tickexponent,f=I.getTickFormat(e),h=e.separatethousands;if(n){var d={exponentformat:e.exponentformat,dtick:"none"===e.showexponent?e.dtick:m(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,l=d._tickexponent,e.hoverformat&&(f=e.hoverformat)}if(f)return e._numFormat(f)(t).replace(/-/g,C);var p=Math.pow(10,-a)/2;if("none"===s&&(l=0),(t=Math.abs(t))"+x+"":"B"===s&&9===l?t+="B":c(s)&&(t+=H[l/3+5])}return i?C+t:t}function h(t,e){for(var r=0;r2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},I.getAutoRange=function(t){var e,r=[],n=t._min[0].val,i=t._max[0].val;for(e=1;e0&&u>0&&f/u>h&&(l=o,c=s,h=f/u);if(n===i){var m=n-1,g=n+1;r="tozero"===t.rangemode?n<0?[m,0]:[0,g]:"nonnegative"===t.rangemode?[Math.max(0,m),Math.max(0,g)]:[m,g]}else h&&("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-h*l.pad<0&&(l={val:0,pad:0}),c.val<0&&(c={val:1,pad:0})),h=(c.val-l.val)/(t._length-l.pad-c.pad)),r=[l.val-h*l.pad,c.val+h*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(),v.simpleMap(r,t.l2r||Number)},I.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=I.getAutoRange(t),t._r=t.range.slice(),t._rl=v.simpleMap(t._r,t.r2l);var r=t._input;r.range=t.range.slice(),r.autorange=t.autorange}},I.saveRangeInitial=function(t,e){for(var r=I.list(t,"",!0),n=!1,i=0;i=h?d=!1:s.val>=c&&s.pad<=h&&(t._min.splice(o,1),o--);d&&t._min.push({val:c,pad:b&&0===c?0:h})}if(n(u)){for(d=!0,o=0;o=u&&s.pad>=f?d=!1:s.val<=u&&s.pad<=f&&(t._max.splice(o,1),o--);d&&t._max.push({val:u,pad:b&&0===u?0:f})}}}if((t.autorange||!!v.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,f,h,d,p,g,y=e.length,x=r.padded?.05*t._length:0,b=r.tozero&&("linear"===t.type||"-"===t.type);x&&"domain"===t.constrain&&t._inputDomain&&(x*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0]));var _=n((t._m>0?r.ppadplus:r.ppadminus)||r.ppad||0),w=n((t._m>0?r.ppadminus:r.ppadplus)||r.ppad||0),k=n(r.vpadplus||r.vpad),A=n(r.vpadminus||r.vpad);for(a=0;a<6;a++)i(a);for(a=y-1;a>5;a--)i(a)}},I.autoBin=function(t,e,r,n,i){var a=v.aggNums(Math.min,null,t),o=v.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=v.distinctVals(t),c=Math.pow(10,Math.floor(Math.log(l.minDiff)/Math.LN10)),u=c*v.roundUp(l.minDiff/c,[.9,1.9,4.9,9.9],!0);s=Math.max(u,2*v.stdev(t)/Math.pow(t.length,n?.25:.4)),m(s)||(s=1)}var f;f="log"===e.type?{type:"linear",range:[a,o]}:{type:e.type,range:v.simpleMap([a,o],e.c2r,0,i),calendar:i},I.setConvert(f),I.autoTicks(f,s);var h,d,p=I.tickIncrement(I.tickFirst(f),f.dtick,"reverse",i);if("number"==typeof f.dtick)h=(p=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.3*f||a(n)||a(i))){var h=r.dtick/2;t+=t+h.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=I.tickIncrement(t,"M6","reverse")+1.5*T:a.exactMonths>.8?t=I.tickIncrement(t,"M1","reverse")+15.5*T:t-=T/2;var s=I.tickIncrement(t,r);if(s<=n)return s}return t}(p,t,f.dtick,a,i)),h=p,d=0;h<=o;)h=I.tickIncrement(h,f.dtick,!1,i),d++;return{start:e.c2r(p,0,i),end:e.c2r(h,0,i),size:f.dtick,_count:d}},I.calcTicks=function(t){var e=v.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=v.constrain(t._length/r,4,9)+1),"radialaxis"===t._name&&(n*=2)),"array"===t.tickmode&&(n*=100),I.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=v.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),f=Math.max(l,c),h=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;ru&&e=l:f<=l)&&!(a.length>u||f===c);f=I.tickIncrement(f,t.dtick,i,t.calendar))c=f,a.push(f);"angular"===t._id&&360===Math.abs(e[1]-e[0])&&a.pop(),t._tmax=a[a.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var h=new Array(a.length),d=0;dk?(e/=k,n=r(10),t.dtick="M"+12*a(e,n,R)):i>A?(e/=A,t.dtick="M"+a(e,1,N)):i>T?(t.dtick=a(e,T,B),t.tick0=v.dateTick0(t.calendar,!0)):i>S?t.dtick=a(e,S,N):i>E?t.dtick=a(e,E,j):i>L?t.dtick=a(e,L,j):(n=r(10),t.dtick=a(e,n,R))}else if("log"===t.type){t.tick0=0;var o=v.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var s=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/s,n=r(10),t.dtick="L"+a(e,n,R)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):"angular"===t._id?(t.tick0=0,n=1,t.dtick=a(e,n,q)):(t.tick0=0,n=r(10),t.dtick=a(e,n,R));if(0===t.dtick&&(t.dtick=1),!m(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},I.tickIncrement=function(t,e,r,n){var i=r?-1:1;if(m(e))return t+i*e;var a=e.charAt(0),o=i*Number(e.substr(1));if("M"===a)return v.incrementMonth(t,o,n);if("L"===a)return Math.log(Math.pow(10,t)+o)/Math.LN10;if("D"===a){var s="D2"===e?V:U,l=t+.01*i,c=v.roundUp(v.mod(l,1),s,r);return Math.floor(l)+Math.log(p.round(Math.pow(10,c),1))/Math.LN10}throw"unrecognized dtick "+String(e)},I.tickFirst=function(t){var e=t.r2l||Number,r=v.simpleMap(t.range,e),n=r[1]"+o,t._prevDateHead=o)),e.text=s}(t,o,r,d):"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=f(Math.pow(10,o),t,i,n);else if(m(a)||"D"===a.charAt(0)&&v.mod(o+.01,1)<.1){var l=Math.round(o);-1!==["e","E","power"].indexOf(t.exponentformat)||c(t.exponentformat)&&u(l)?(e.text=0===l?1:1===l?"10":l>1?"10"+l+"":"10"+C+-l+"",e.fontSize*=1.25):(e.text=f(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,v.mod(o,1)))),e.fontSize*=.75}if("D1"===t.dtick){var h=String(e.text).charAt(0);"0"!==h&&"1"!==h||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(o<0?.5:.25)))}}(t,o,0,d,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):"angular"===t._id?l(t,o,r,d,i):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide"),e.text=f(e.x,t,i,n)}(t,o,0,d,i),t.tickprefix&&!n(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!n(t.showticksuffix)&&(o.text+=t.ticksuffix),o},I.hoverLabelText=function(t,e,r){if(r!==z&&r!==e)return I.hoverLabelText(t,e)+" - "+I.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=I.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":C+i:i};var H=["f","p","n","\u03bc","m","","k","M","G","T"];I.getTickFormat=function(t){function e(t){return"string"!=typeof t?t:Number(t.replace("M",""))*A}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;a1&&e1)for(n=1;n2*o}(t,e)?"date":function(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,o=0,s=0;s2*n}(t)?"category":function(t){if(!t)return!1;for(var e=0;en?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)}},{"../../registry":873,"./constants":794}],793:[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")}}},{}],794:[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":743}],795:[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;oo*v)||_)for(r=0;rz&&IL&&(L=I);f/=(L-E)/(2*C),E=l.l2r(E),L=l.l2r(L),l.range=l._input.range=A.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function c(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:k.background,stroke:k.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function u(t){t.selectAll(".select-outline").remove()}function f(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"),h(t,e,i,a)}function h(t,e,r,n){r||(t.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function d(t){y.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function p(t){j&&t.data&&t._context.showTips&&(w.notifier(w._(t,"Double-click to zoom back out"),"long"),j=!1)}function m(t){return"lasso"===t||"select"===t}function g(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,R)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function v(t,e){if(N){var r=void 0!==t.onwheel?"wheel":"mousewheel";t._onwheel&&t.removeEventListener(r,t._onwheel),t._onwheel=e,t.addEventListener(r,e,{passive:!1})}else void 0!==t.onwheel?t.onwheel=e:void 0!==t.onmousewheel&&(t.onmousewheel=e)}var y=t("d3"),x=t("tinycolor2"),b=t("../../plotly"),_=t("../../registry"),w=t("../../lib"),M=t("../../lib/svg_text_utils"),k=t("../../components/color"),A=t("../../components/drawing"),T=t("../../components/fx"),S=t("../../lib/setcursor"),E=t("../../components/dragelement"),L=t("../../constants/alignment").FROM_TL,C=t("../plots"),z=t("./axes").doTicks,D=t("./axis_ids").getFromId,I=t("./select"),P=t("./scale_zoom"),O=t("./constants"),F=O.MINDRAG,R=O.MINZOOM,N=w.eventListenerOptionsSupported(),j=!0;e.exports={makeDragBox:function(t,e,r,n,h,k,S,N){function j(){X=[e.xaxis],Z=[e.yaxis];var r=X[0],n=Z[0];Q=r._length,$=n._length;var i=ot._axisConstraintGroups,o=[r._id],s=[n._id];W=[e].concat(S&&N?e.overlays:[]);for(var l=1;lR||s>R?(xt="xy",o/Q>s/$?(s=o*$/Q,pt>a?mt.t=pt-s:mt.b=pt+s):(o=s*Q/$,dt>i?mt.l=dt-o:mt.r=dt+o),_t.attr("d",g(mt))):n():!et||s10||n.scrollWidth-n.clientWidth>10)){clearTimeout(kt);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=Tt.draglayer.select(".nsewdrag").node().getBoundingClientRect(),l=(e.clientX-s.left)/s.width,c=(s.bottom-e.clientY)/s.height;if(N||nt){for(N||(l=.5),a=0;a=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(j(),"ew"===tt||"ns"===et)return tt&&s(X,e),et&&s(Z,r),Y([tt?-e:0,et?-r:0,Q,$]),void H(et,tt);if(nt&&tt&&et){var i="w"===tt==("n"===et)?1:-1,a=(e/Q+i*r/$)/2;e=a*Q,r=i*a*$}"w"===tt?e=n(X,0,e):"e"===tt?e=n(X,1,-e):tt||(e=0),"n"===et?r=n(Z,1,r):"s"===et?r=n(Z,0,-r):et||(r=0);var o="w"===tt?e:0,l="n"===et?r:0;if(nt){var c;if(!tt&&1===et.length){for(c=0;c rect").call(A.setTranslate,s,l).call(A.setScale,a,o);var T=m.plot.selectAll(".scatterlayer .trace, .boxlayer .trace, .violinlayer .trace");m.plot.call(A.setTranslate,M,k).call(A.setScale,1/a,1/o),T.selectAll(".point").call(A.setPointGroupScale,a,o),T.selectAll(".textpoint").call(A.setTextPointsScale,a,o),T.call(A.hideOutsideRangePoints,m)}}}var W,X,Z,J,K,Q,$,tt,et,rt,nt,it,at,ot=t._fullLayout,st=t._fullLayout._zoomlayer,lt=S+N==="nsew",ct=1===(S+N).length;j();var ut=i(e,S+N+"drag",rt,r,n,h,k),ft=!et&&!tt;if(ft&&!lt)return ut.onmousedown=null,ut.style.pointerEvents="none",ut;var ht={element:ut,gd:t,plotinfo:e,prepFn:function(e,r,n){var i=t._fullLayout.dragmode;ft||(lt?e.shiftKey?"pan"===i?i="zoom":m(i)||(i="pan"):e.ctrlKey&&(i="pan"):i="pan"),ht.minDrag="lasso"===i?1:void 0,m(i)?(ht.xaxes=X,ht.yaxes=Z,I(e,r,n,ht,i)):ft?u(st):"zoom"===i?(ht.moveFn=B,ht.doneFn=U,ht.minDrag=1,function(e,r,n){var i=ut.getBoundingClientRect();dt=r-i.left,pt=n-i.top,mt={l:dt,r:dt,w:0,t:pt,b:pt,h:0},gt=t._hmpixcount?t._hmlumcount/t._hmpixcount:x(t._fullLayout.plot_bgcolor).getLuminance(),yt=!1,xt="xy",bt=l(st,gt,J,K,vt="M0,0H"+Q+"V"+$+"H0V0"),_t=c(st,J,K),u(st)}(0,r,n)):"pan"===i&&(ht.moveFn=q,ht.doneFn=G,u(st))},clickFn:function(r,n){if(d(t),2!==r||ct||function(){if(!t._transitioningWithDuration){var e,r,n,i=t._context.doubleClick,a=(tt?X:[]).concat(et?Z:[]),o={};if("reset+autosize"===i)for(i="autosize",r=0;ru[1]-.01&&(e.domain=[0,1]),i.noneOrAll(t.domain,e.domain,[0,1])}return r("layer"),e}},{"../../lib":743,"fast-isnumeric":140}],806:[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":716}],807:[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;n0)return Math.log(e)/Math.LN10;if(e<=0&&r&&t.range&&2===t.range.length){var n=t.range[0],i=t.range[1];return.5*(n+i-3*M*Math.abs(n-i))}return d}function f(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 x(e){if(t._categoriesMap){var r=t._categoriesMap[e];if(void 0!==r)return r}if(a(e))return+e}function b(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=b,t.p2l=_,t.c2p="log"===t.type?function(t,e){return b(r(t,e))}:b,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=f,t.c2d=t.c2r=t.l2d=t.l2r=g,t.d2p=t.r2p=function(e,r,n){return t.l2p(f(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=x,t.r2c=function(e){var r=x(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=u,t.r2l=x,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return 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,r){r||(r={}),e||(e="range");var n,i,s=o.nestedProperty(t,e).get();if(i="date"===t.type?o.dfltRange(t.calendar):"y"===w?p.DFLTRANGEY:r.dfltRange||p.DFLTRANGEX,i=i.slice(),s&&2===s.length)for("date"===t.type&&(s[0]=o.cleanDate(s[0],d,t.calendar),s[1]=o.cleanDate(s[1],d,t.calendar)),n=0;n<2;n++)if("date"===t.type){if(!o.isDateTime(s[n],t.calendar)){t[e]=i;break}if(t.r2l(s[0])===t.r2l(s[1])){var l=o.constrain(t.r2l(s[0]),o.MIN_MS+1e3,o.MAX_MS-1e3);s[0]=t.l2r(l-1e3),s[1]=t.l2r(l+1e3);break}}else{if(!a(s[n])){if(!a(s[1-n])){t[e]=i;break}s[n]=s[1-n]*(n?10:.1)}if(s[n]<-h?s[n]=-h:s[n]>h&&(s[n]=h),s[0]===s[1]){var c=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=c,s[1]+=c}}else o.nestedProperty(t,e).set(i)},t.setScale=function(r){var n=e._size;if(t._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=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":721,"../../lib":743,"./axis_ids":792,"./constants":794,d3:128,"fast-isnumeric":140}],809:[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",o.tickSuffixDflt)&&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;c0?Number(u):c;else if("string"!=typeof u)e.dtick=c;else{var f=u.charAt(0),h=u.substr(1);((h=n(h)?Number(h):0)<=0||!("date"===o&&"M"===f&&h===Math.round(h)||"log"===o&&"L"===f||"log"===o&&"D"===f&&(1===h||2===h)))&&(e.dtick=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":721,"../../lib":743,"fast-isnumeric":140}],812:[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 f(e,r){var n,i,l,c=m[e.xaxis._id],u=m[e.yaxis._id],f=[];if(c){i=(n=t._fullLayout[c.axisName])._r,l=c.to,f[0]=(i[0]*(1-r)+r*l[0]-i[0])/(i[1]-i[0])*e.xaxis._length;var h=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],f[2]=e.xaxis._length*(1-r+r*p/h)}else f[0]=0,f[2]=e.xaxis._length;if(u){i=(n=t._fullLayout[u.axisName])._r,l=u.to,f[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],f[3]=e.yaxis._length*(1-r+r*v/g)}else f[1]=0,f[3]=e.yaxis._length;!function(e,r){function n(e,r,n){for(i=0;i rect").call(o.setTranslate,k,A).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 h(){b=Date.now();for(var e=Math.min(1,(b-x)/r.duration),n=w(e),a=0;ar.duration?(!function(){for(var e={},r=0;r0?".":"")+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"],f=0;fn*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 f=[[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])]],h=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]]]}}(h.range,d.range);u.fitExtent(f,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 x=this.graphDiv,b=["projection.rotation","center","lonaxis.range","lataxis.range"],_="Invalid geo settings, relayout'ing to default view.",w={},M=0;M0&&w<0&&(w+=360);var M,k=(_+w)/2;if(!c){var A=u?o.projRotate:[k,0,0];M=r("projection.rotation.lon",A[0]),r("projection.rotation.lat",A[1]),r("projection.rotation.roll",A[2]),r("showcoastlines",!u)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean")&&r("oceancolor")}var T,S;if(c?(T=-96.6,S=38.7):(T=u?k:M,S=(b[0]+b[1])/2),r("center.lon",T),r("center.lat",S),f){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":865,"../constants":818,"./layout_attributes":823}],823:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../../domain_attributes"),a=t("../constants"),o=t("../../../plot_api/edit_types").overrideAll,s={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=o({domain:i({name:"geo"},{}),resolution:{valType:"enumerated",values:[110,50],dflt:110,coerceNumber:!0},scope:{valType:"enumerated",values:Object.keys(a.scopeDefaults),dflt:"world"},projection:{type:{valType:"enumerated",values:Object.keys(a.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:a.landColor},showocean:{valType:"boolean",dflt:!1},oceancolor:{valType:"color",dflt:a.waterColor},showlakes:{valType:"boolean",dflt:!1},lakecolor:{valType:"color",dflt:a.waterColor},showrivers:{valType:"boolean",dflt:!1},rivercolor:{valType:"color",dflt:a.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:s,lataxis:s},"plot","from-root")},{"../../../components/color/attributes":617,"../../../plot_api/edit_types":773,"../../domain_attributes":815,"../constants":818}],824:[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?T: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(T*(4+T))*t*(1+Math.cos(e)),2*Math.sqrt(T/(4+T))*Math.sin(e)]}function s(t,e){function r(r,n){var i=D(r/e,n);return i[0]*=t,i}return arguments.length<2&&(e=t),1===e?D:e===1/0?l:(r.invert=function(r,n){var i=D.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*T)*Math.sqrt(T*T/3-e*e),e]}function u(t,e){return[t,1.25*Math.log(Math.tan(T/4+.4*e))]}function f(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 h(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)/T),i=Math.floor(n),a=n-i,o=(r=P[i])[0],s=r[1],l=(r=P[++i])[0],c=r[1],u=(r=P[Math.min(19,++i)])[0],f=r[1];return[t*(l+a*(u-o)/2+a*a*(u-2*l+o)/2),(e>0?S:-S)*(c+a*(f-s)/2+a*a*(f-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=[],x=[],b={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&&(x.push(y),y=[])},result:function(){var t=x.length?x.length<2?{type:"LineString",coordinates:x[0]}:{type:"MultiLineString",coordinates:x}:null;return x=[],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);x.push(y),y=[]}},polygonEnd:n,result:function(){if(!x.length)return null;var t=[],e=[];return x.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];++rn^d>n&&r<(h-c)*(n-u)/(d-u)+c&&(i=!i)}return i}(t[0],r))return t.push(e),!0})||t.push([e])}),x=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},M={Point:b,MultiPoint:b,LineString:_,MultiLineString:_,Polygon:w,MultiPolygon:w,Sphere:w},k=1e-6,A=k*k,T=Math.PI,S=T/2,E=(Math.sqrt(T),T/180),L=180/T,C=t.geo.projection,z=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;oi[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=0;--r){var f;o=180*(f=a[1][r])[0][0]/T,s=180*f[0][1]/T,l=180*f[1][1]/T,c=180*f[2][0]/T,u=180*f[2][1]/T,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]*T/180,t[0][1]*T/180],[t[1][0]*T/180,t[1][1]*T/180],[t[2][0]*T/180,t[2][1]*T/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]/T,180*t[0][1]/T],[180*t[1][0]/T,180*t[1][1]/T],[180*t[2][0]/T,180*t[2][1]/T]]})})},o},o.invert=function(t,e){var r=.5*e*Math.sqrt((4+T)/T),n=i(r),a=Math.cos(n);return[t/(2/Math.sqrt(T*(4+T))*(1+a)),i((n+r*(a+2))/(2+S))]},(t.geo.eckert4=function(){return C(o)}).raw=o;var D=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=z(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*T*t/Math.sqrt(T*T/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*T]},(t.geo.miller=function(){return C(u)}).raw=u,f(T);var I=function(t,e,r){function n(r,n){return[t*r*Math.cos(n=a(n)),e*Math.sin(n)]}var a=f(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,T);(t.geo.mollweide=function(){return C(I)}).raw=I,h.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(h)}).raw=h;var P=[[.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]];P.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=P[a][1],s=P[a+1][1],l=P[Math.min(19,a+2)][1],c=l-o,u=l-2*s+o,f=2*(Math.abs(r)-s)/c,h=u/c,d=f*(1-h*f*(1-2*h*f));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=P[a][1],s=P[a+1][1],l=P[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)>A&&--m>0);break}}while(--a>=0);var g=P[a][0],v=P[a+1][0],y=P[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>T*T+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),f=Math.cos(n),h=Math.sin(2*n),d=u*u,p=f*f,m=l*l,g=1-p*c*c,v=g?a(f*c)*Math.sqrt(o=1/g):o=0,y=2*v*f*l-t,x=v*u-e,b=o*(p*m+v*f*c*d),_=o*(.5*s*h-2*v*u*l),w=.25*o*(h*l-v*u*p*s),M=o*(d*c+v*m*f),A=_*w-M*b;if(!A)break;var S=(x*_-y*M)/A,E=(y*w-x*b)/A;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,f=s*s,h=Math.sin(r),d=Math.cos(r/2),p=Math.sin(r/2),m=p*p,g=1-f*d*d,v=g?a(s*d)*Math.sqrt(o=1/g):o=0,y=.5*(2*v*s*p+r/S)-t,x=.5*(v*l+n)-e,b=.5*o*(f*m+v*s*d*u)+.5/S,_=o*(h*c/4-v*l*p),w=.125*o*(c*p-v*l*f*h),M=.5*o*(u*d+v*m*s)+.5,A=_*w-M*b,T=(x*_-y*M)/A,E=(y*w-x*b)/A;r-=T,n-=E}while((Math.abs(T)>k||Math.abs(E)>k)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return C(g)}).raw=g}},{}],825:[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,f,h,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(f=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(f)&&(p=r(f),h=[c[0]+(p[0]-u[0]),s[1],s[2]],e.rotate(h),c=h):u=r(o=f),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(;++em?(a=(h>0?90:-90)-p,i=0):(a=Math.asin(h/m)*g-p,i=Math.sqrt(m*m-h*h));var v=180-a-2*p,y=(Math.atan2(d,u)-Math.atan2(l,i))*g,x=(Math.atan2(d,u)-Math.atan2(l,-i))*g,b=c(r[0],r[1],a,y),_=c(r[0],r[1],v,x);return b<=_?[a,y,r[2]]:[v,x,r[2]]}(v,a,n);isFinite(x[0])&&isFinite(x[1])&&isFinite(x[2])||(x=n),e.rotate(x),n=x}}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),x.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 f(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 h(t,e){for(var r=0,n=0,i=t.length;nMath.abs(u)?(c.boxEnd[1]=c.boxStart[1]+Math.abs(s)*_*(u>=0?1:-1),c.boxEnd[1]f[3]&&(c.boxEnd[1]=f[3],c.boxEnd[0]=c.boxStart[0]+(f[3]-c.boxStart[1])/Math.abs(_))):(c.boxEnd[0]=c.boxStart[0]+Math.abs(u)/_*(s>=0?1:-1),c.boxEnd[0]f[2]&&(c.boxEnd[0]=f[2],c.boxEnd[1]=c.boxStart[1]+(f[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)h[p+2]&&(h[p]=-1,h[p+2]=1),(d=this[b[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;rMath.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,f*(Math.exp(o)-1))}}},!0),p};var n=t("right-now"),i=t("3d-view"),a=t("mouse-change"),o=t("mouse-wheel"),s=t("mouse-event-offset")},{"3d-view":40,"mouse-change":443,"mouse-event-offset":444,"mouse-wheel":446,"right-now":509}],832:[function(t,e,r){"use strict";var n=t("../../plot_api/edit_types").overrideAll,i=t("../../components/fx/layout_attributes"),a=t("./scene"),o=t("../get_data").getSubplotData,s=t("../../lib"),l=t("../../constants/xmlns_namespaces");r.name="gl3d",r.attr="scene",r.idRoot="scene",r.idRegex=r.attrRegex=s.counterRegex("scene"),r.attributes=t("./layout/attributes"),r.layoutAttributes=t("./layout/layout_attributes"),r.baseLayoutAttrOverrides=n({hoverlabel:i.hoverlabel},"plot","nested"),r.supplyLayoutDefaults=t("./layout/defaults"),r.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=e._subplots.gl3d,i=0;i1;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":618,"../../../lib":743,"../../../registry":873,"../../subplot_defaults":865,"./axis_defaults":835,"./layout_attributes":838}],838:[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("../../domain_attributes"),o=t("../../../lib/extend").extendFlat,s=t("../../../lib").counterRegex;e.exports={_arrayAttrRegexps:[s("scene",".annotations",!0)],bgcolor:{valType:"color",dflt:"rgba(0,0,0,0)",editType:"plot"},camera:{up:o(n(0,0,1),{}),center:o(n(0,0,0),{}),eye:o(n(1.25,1.25,1.25),{}),editType:"camera"},domain:a({name:"scene",editType:"plot"}),aspectmode:{valType:"enumerated",values:["auto","cube","data","manual"],dflt:"auto",editType:"plot",impliedEdits:{"aspectratio.x":void 0,"aspectratio.y":void 0,"aspectratio.z":void 0}},aspectratio:{x:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},y:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},z:{valType:"number",min:0,editType:"plot",impliedEdits:{"^aspectmode":"manual"}},editType:"plot",impliedEdits:{aspectmode:"manual"}},xaxis: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":743,"../../../lib/extend":732,"../../domain_attributes":815,"./axis_attributes":834}],839:[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":765}],840:[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 f=l[o[u]];if(f._length=(r[u].hi-r[u].lo)*r[u].pixelsPerDataUnit/t.dataScale[u],Math.abs(f._length)===1/0)c[u]=[];else{f.range[0]=r[u].lo/t.dataScale[u],f.range[1]=r[u].hi/t.dataScale[u],f._m=1/(t.dataScale[u]*r[u].pixelsPerDataUnit),f.range[0]===f.range[1]&&(f.range[0]-=1,f.range[1]+=1);var h=f.tickmode;if("auto"===f.tickmode){f.tickmode="linear";var d=f.nticks||i.constrain(f._length/40,4,9);n.autoTicks(f,Math.abs(f.range[1]-f.range[0])/d)}for(var p=n.calcTicks(f),m=0;mh[1][s]?d[s]=1:h[1][s]===h[0][s]?d[s]=1:d[s]=1/(h[1][s]-h[0][s]);for(this.dataScale=d,this.convertAnnotations(this),a=0;am[1][a])m[0][a]=-1,m[1][a]=1;else{var T=m[1][a]-m[0][a];m[0][a]-=T/32,m[1][a]+=T/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 z=u.aspectratio;C=[z.x,z.y,z.z]}u.aspectratio.x=f.aspectratio.x=C[0],u.aspectratio.y=f.aspectratio.y=C[1],u.aspectratio.z=f.aspectratio.z=C[2],this.glplot.aspect=C;var D=u.domain||null,I=e._size||null;if(D&&I){var P=this.container.style;P.position="absolute",P.left=I.l+D.x[0]*I.w+"px",P.top=I.t+(1-D.y[1])*I.h+"px",P.width=I.w*(D.x[1]-D.x[0])+"px",P.height=I.h*(D.y[1]-D.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;a0}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":743,"./convert_text_opts":845}],848:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("../../components/color").defaultLine,a=t("../domain_attributes"),o=t("../font_attributes"),s=t("../../traces/scatter/attributes").textposition,l=t("../../plot_api/edit_types").overrideAll,c=o({});c.family.dflt="Open Sans Regular, Arial Unicode MS Regular",e.exports=l({_arrayAttrRegexps:[n.counterRegex("mapbox",".layers",!0)],domain:a({name:"mapbox"}),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:c,textposition:n.extendFlat({},s,{arrayOk:!1})}}},"plot","from-root")},{"../../components/color":618,"../../lib":743,"../../plot_api/edit_types":773,"../../traces/scatter/attributes":1066,"../domain_attributes":815,"../font_attributes":816}],849:[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=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=[],h=t.data||[];t._transitionData||p.createTransitionData(t),n._dfltTitle={plot:f(t,"Click to enter Plot title"),x:f(t,"Click to enter X axis title"),y:f(t,"Click to enter Y axis title"),colorbar:f(t,"Click to enter Colorscale title"),annotation:f(t,"new text")},n._traceWord=f(t,"trace");var d=function(t){function e(t){for(var e=!0,r=0;r=0)return!0}return!1},p.cleanPlot=function(t,e,r,n){var i,a,o=n._basePlotModules||[];for(i=0;i0){var c=function(t){var e,r={left:0,right:0,bottom:0,top:0};if(t)for(e in t)t.hasOwnProperty(e)&&(r.left+=t[e].left||0,r.right+=t[e].right||0,r.bottom+=t[e].bottom||0,r.top+=t[e].top||0);return r}(t._boundingBoxMargins),f=c.left+c.right,h=c.bottom+c.top,d=1-2*s,m=r._container&&r._container.node?r._container.node().getBoundingClientRect():{width:r.width,height:r.height};n=Math.round(d*(m.width-f)),i=Math.round(d*(m.height-h))}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;n1,b=!e.height&&Math.abs(r.height-i)>1;(b||x)&&(x&&(r.width=n),b&&(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.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 f in u){var h=u[f].l||{},d=u[f].b||{},p=h.val,m=h.size,g=d.val,v=d.size;for(var y in u){if(a(m)&&u[y].r){var x=u[y].r.val,b=u[y].r.size;if(x>p){var _=(m*x+(b-e.width)*p)/(x-p),w=(b*(1-p)+(m-e.width)*(1-x))/(x-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 A=(v*M+(k-e.height)*g)/(M-g),T=(k*(1-g)+(v-e.height)*(1-M))/(M-g);A>=0&&T>=0&&A+T>c+l&&(c=A,l=T)}}}}}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;r0&&(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,f=0,p=t._fullLayout._basePlotModules,m=!1;if(r)for(l=0;l=0;o--)if(_[o].enabled){r._indexToPoints=_[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,n){var i,a=e.traceHash,o={};for(i=0;i=0?h.angularAxis.domain:n.extent(M),E=Math.abs(M[1]-M[0]);A&&!k&&(E=0);var L=S.slice();T&&k&&(L[1]+=E);var C=h.angularAxis.ticksCount||4;C>8&&(C=C/(C/8)+C%8),h.angularAxis.ticksStep&&(C=(L[1]-L[0])/C);var z=h.angularAxis.ticksStep||(L[1]-L[0])/(C*(h.minorTicks+1));w&&(z=Math.max(Math.round(z),1)),L[2]||(L[2]=z);var D=n.range.apply(this,L);if(D=D.map(function(t,e){return parseFloat(t.toPrecision(12))}),s=n.scale.linear().domain(L.slice(0,2)).range("clockwise"===h.direction?[0,360]:[360,0]),u.layout.angularAxis.domain=s.domain(),u.layout.angularAxis.endPadding=T?E:0,void 0===(t=n.select(this).select("svg.chart-root"))||t.empty()){var I=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),P=this.appendChild(this.ownerDocument.importNode(I.documentElement,!0));t=n.select(P)}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:h.tickColor},N={"font-size":h.font.size,"font-family":h.font.family,fill:h.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+h.font.outlineColor}).join(",")};if(h.showLegend){O=t.select(".legend-group").attr({transform:"translate("+[x,h.margin.top]+")"}).style({display:"block"});var j=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:j,reverseOrder:h.legend.reverseOrder})})();var B=O.node().getBBox();x=Math.min(h.width-B.width-h.margin.left-h.margin.right,h.height-h.margin.top-h.margin.bottom)/2,x=Math.max(10,x),_=[h.margin.left+x,h.margin.top+x],r.range([0,x]),u.layout.radialAxis.domain=r.domain(),O.attr("transform","translate("+[_[0]+x,_[1]-x]+")")}else O=t.select(".legend-group").style({display:"none"});t.attr({width:h.width,height:h.height}).style({opacity:h.opacity}),F.attr("transform","translate("+_+")").style({cursor:"crosshair"});var U=[(h.width-(h.margin.left+h.margin.right+2*x+(B?B.width:0)))/2,(h.height-(h.margin.top+h.margin.bottom+2*x))/2];if(U[0]=Math.max(0,U[0]),U[1]=Math.max(0,U[1]),t.select(".outer-group").attr("transform","translate("+U+")"),h.title){var V=t.select("g.title-group text").style(N).text(h.title),q=V.node().getBBox();V.attr({x:_[0]-q.width/2,y:_[1]-x-20})}var H=t.select(".radial.axis-group");if(h.radialAxis.gridLinesVisible){var G=H.selectAll("circle.grid-circle").data(r.ticks(5));G.enter().append("circle").attr({class:"grid-circle"}).style(R),G.attr("r",r),G.exit().remove()}H.select("circle.outside-circle").attr({r:x}).style(R);var Y=t.select("circle.background-circle").attr({r:x}).style({fill:h.backgroundColor,stroke:h.stroke});if(h.radialAxis.visible){var W=n.svg.axis().scale(r).ticks(5).tickSize(5);H.call(W).attr({transform:"rotate("+h.radialAxis.orientation+")"}),H.selectAll(".domain").style(R),H.selectAll("g>text").text(function(t,e){return this.textContent+h.radialAxis.ticksSuffix}).style(N).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===h.radialAxis.tickOrientation?"rotate("+-h.radialAxis.orientation+") translate("+[0,N["font-size"]]+")":"translate("+[0,N["font-size"]]+")"}}),H.selectAll("g>line").style({stroke:"black"})}var X=t.select(".angular.axis-group").selectAll("g.angular-tick").data(D),Z=X.enter().append("g").classed("angular-tick",!0);X.attr({transform:function(t,e){return"rotate("+c(t)+")"}}).style({display:h.angularAxis.visible?"block":"none"}),X.exit().remove(),Z.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(h.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(h.minorTicks+1)==0)}).style(R),Z.selectAll(".minor").style({stroke:h.minorTickColor}),X.select("line.grid-line").attr({x1:h.tickLength?x-h.tickLength:0,x2:x}).style({display:h.angularAxis.gridLinesVisible?"block":"none"}),Z.append("text").classed("axis-text",!0).style(N);var J=X.select("text.axis-text").attr({x:x+h.labelOffset,dy:a+"em",transform:function(t,e){var r=c(t),n=x+h.labelOffset,i=h.angularAxis.tickOrientation;return"horizontal"==i?"rotate("+-r+" "+n+" 0)":"radial"==i?r<270&&r>90?"rotate(180 "+n+" 0)":null:"rotate("+(r<=180&&r>0?-90:90)+" "+n+" 0)"}}).style({"text-anchor":"middle",display:h.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(h.minorTicks+1)!=0?"":w?w[t]+h.angularAxis.ticksSuffix:t+h.angularAxis.ticksSuffix}).style(N);h.angularAxis.rewriteTicks&&J.text(function(t,e){return e%(h.minorTicks+1)!=0?"":h.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("+[x+K,h.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=h.orientation,n.direction=h.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:-x,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-h.orientation)%360;rt=s.invert(n);var i=o.util.convertToCartesian(x+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,h.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,f=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),d=[f.left+f.width/2-U[0]-h.left,f.top+f.height/2-U[1]-h.top];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")&<.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},h.config=function(t){if(!arguments.length)return l;var e=o.util.cloneJson(t);return e.data.forEach(function(t,e){l.data[e]||(l.data[e]={}),i(l.data[e],o.Axis.defaultConfig().data[0]),i(l.data[e],t)}),i(l.layout,o.Axis.defaultConfig().layout),i(l.layout,e.layout),this},h.getLiveConfig=function(){return u},h.getinputConfig=function(){return c},h.radialScale=function(t){return r},h.angularScale=function(t){return s},h.svg=function(){return t},n.rebind(h,f,"on"),h},o.Axis.defaultConfig=function(t,e){return{data:[{t:[1,2,3,4],r:[10,11,12,13],name:"Line1",geometry:"LinePlot",color:null,strokeDash:"solid",strokeColor:null,strokeSize:"1",visibleInLegend:!0,opacity:1}],layout:{defaultColorRange:n.scale.category10().range(),title:null,height:450,width:500,margin:{top:40,right:40,bottom:40,left:40},font:{size:12,color:"gray",outlineColor:"white",family:"Tahoma, sans-serif"},direction:"clockwise",orientation:0,labelOffset:10,radialAxis:{domain:null,orientation:-45,ticksSuffix:"",visible:!0,gridLinesVisible:!0,tickOrientation:"horizontal",rewriteTicks:null},angularAxis:{domain:[0,360],ticksSuffix:"",visible:!0,gridLinesVisible:!0,labelsVisible:!0,tickOrientation:"horizontal",rewriteTicks:null,ticksCount:null,ticksStep:null},minorTicks:0,tickLength:null,tickColor:"silver",minorTickColor:"#eee",backgroundColor:"none",needsEndSpacing:null,showLegend:!0,legend:{reverseOrder:!1},opacity:1}}},o.util={},o.DATAEXTENT="dataExtent",o.AREA="AreaChart",o.LINE="LinePlot",o.DOT="DotPlot",o.BAR="BarChart",o.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},o.util._extend=function(t,e){for(var r in t)e[r]=t[r]},o.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},o.util.dataFromEquation2=function(t,e){var r=e||6;return n.range(0,360+r,r).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},o.util.dataFromEquation=function(t,e,r){var i=e||6,a=[],o=[];n.range(0,360+i,i).forEach(function(e,r){var n=e*Math.PI/180,i=t(n);a.push(e),o.push(i)});var s={t:a,r:o};return r&&(s.name=r),s},o.util.ensureArray=function(t,e){if(void 0===t)return null;var r=[].concat(t);return n.range(e).map(function(t,e){return r[e]||r[0]})},o.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=o.util.ensureArray(t[e],r)}),t},o.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},o.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},o.util.sumArrays=function(t,e){return n.zip(t,e).map(function(t,e){return n.sum(t)})},o.util.arrayLast=function(t){return t[t.length-1]},o.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},o.util.flattenArray=function(t){for(var e=[];!o.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},o.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},o.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},o.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},o.util.getMousePos=function(t){var e=n.mouse(t.node()),r=e[0],i=e[1],a={};return a.x=r,a.y=i,a.pos=e,a.angle=180*(Math.atan2(i,r)+Math.PI)/Math.PI,a.radius=Math.sqrt(r*r+i*i),a},o.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var l=n.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d: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 f=t.angularScale.range(),h=Math.abs(f[1]-f[0])/o[0].length*Math.PI/180,d=n.svg.arc().startAngle(function(t){return-h/2}).endAngle(function(t){return h/2}).innerRadius(function(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,f=u?r.height:c*o.length,h=s.classed("legend-group",!0).selectAll("svg").data([0]),d=h.enter().append("svg").attr({width:300,height:f+c,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});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,f]);if(u){var v=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(l);v.enter().append("stop"),v.attr({offset:function(t,e){return e/(l.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var y=h.select(".legend-marks").selectAll("path.legend-mark").data(o);y.enter().append("path").classed("legend-mark",!0),y.attr({transform:function(t,e){return"translate("+[c/2,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 x=n.svg.axis().scale(g).orient("right"),b=h.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:c,c/2]+")"}).call(x);return b.selectAll(".domain").style({fill:"none",stroke:"none"}),b.selectAll("line").style({fill:"none",stroke:u?r.textColor:"none"}),b.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",f=i||"";e.style({fill:u,"font-size":a.fontSize+"px"}).text(f);var h=a.padding,d=e.node().getBBox(),p={fill:a.color,stroke:s,"stroke-width":"2px"},m=d.width+2*h+l,g=d.height+2*h;return r.attr({d:"M"+[[l,-g/2],[l,-g/4],[a.hasTick?0:l,0],[l,g/4],[l,g/2],[m,g/2],[m,-g/2]].join("L")+"Z"}).style(p),t.attr({transform:"translate("+[l,-g/2+2*h]+")"}),t.style({display:"block"}),c},c.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),c},c.hide=function(){if(t)return t.style({display:"none"}),c},c.show=function(){if(t)return t.style({display:"block"}),c},c.config=function(t){return i(a,t),c},c},o.tooltipPanel.uid=1,o.adapter={},o.adapter.plotly=function(){var t={};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":716,"../../../lib":743,d3:128}],862:[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&&(f=i),n.select(n.select(f).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(f),t.data=r.data,t.layout=r.layout,c.fillLayout(t),r}var r,i,a,u,f,h=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){h.add({undo:function(){r&&t(r)},redo:function(){t(e)}})}(e,i),i=o.util.cloneJson(e)},e.undo=function(){h.undo()},e.redo=function(){h.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":618,"../../../lib":743,"./micropolar":861,"./undo_manager":863,d3:128}],863:[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 n0?1:-1}function d(t){return h(Math.cos(t))}function p(t){return h(Math.sin(t))}var m=t("d3"),g=t("tinycolor2"),v=t("../../plotly"),y=t("../../registry"),x=t("../../lib"),b=t("../../components/color"),_=t("../../components/drawing"),w=t("../plots"),M=t("../cartesian/axes"),k=t("../../components/dragelement"),A=t("../cartesian/dragbox"),T=t("../../components/fx"),S=t("../../components/titles"),E=t("../cartesian/select"),L=t("../../lib/setcursor"),C=t("../../constants/alignment").MID_SHIFT,z=x._,D=x.deg2rad,I=x.rad2deg,P=x.wrap360,O=x.wrap180,F=t("./helpers").setConvertAngular,R=t("./constants"),N=n.prototype;e.exports=function(t,e){return new n(t,e)},N.plot=function(t,e){var r=e[this.id];this._hasClipOnAxisFalse=!1;for(var n=0;n=90||s>90&&l>=450?1:u<=0&&h<=0?0:Math.max(u,h),e=s<=180&&l>=180||s>180&&l>=540?-1:c>=0&&f>=0?0:Math.min(c,f),r=s<=270&&l>=270||s>270&&l>=630?-1:u>=0&&h>=0?0:Math.min(u,h),n=l>=360?1:c<=0&&f<=0?0:Math.max(c,f),[e,r,n,i]}(g),y=v[2]-v[0],x=v[3]-v[1],w=m/p,k=Math.abs(x/y);w>k?(l=p,d=(m-(c=p*k))/i.h/2,f=[a[0],a[1]],h=[o[0]+d,o[1]-d]):(c=m,d=(p-(l=m/k))/i.w/2,f=[a[0]+d,a[1]-d],h=[o[0],o[1]]),r.xLength2=l,r.yLength2=c,r.xDomain2=f,r.yDomain2=h;var A=r.xOffset2=i.l+i.w*f[0],T=r.yOffset2=i.t+i.h*(1-h[1]),S=r.radius=l/y,E=r.cx=A-S*v[0],L=r.cy=T+S*v[3],C=r.cxx=E-A,z=r.cyy=L-T;r.updateRadialAxis(t,e),r.updateRadialAxisTitle(t,e),r.updateAngularAxis(t,e);var I=r.radialAxis.range,O=I[1]-I[0],F=r.xaxis={type:"linear",_id:"x",range:[v[0]*O,v[2]*O],domain:f};M.setConvert(F,t),F.setScale();var R=r.yaxis={type:"linear",_id:"y",range:[v[1]*O,v[3]*O],domain:h};M.setConvert(R,t),R.setScale(),F.isPtWithinRange=function(t){return r.isPtWithinSector(t)},R.isPtWithinRange=function(){return!0},n.frontplot.attr("transform",u(A,T)).call(_.setClipUrl,r._hasClipOnAxisFalse?null:r.clipIds.circle),n.bgcircle.attr({d:s(S,g),transform:u(E,L)}).call(b.fill,e.bgcolor),r.clipPaths.circle.select("path").attr("d",s(S,g)).attr("transform",u(C,z)),r.framework.selectAll(".crisp").classed("crisp",0)},N.updateRadialAxis=function(t,e){var r=this.gd,n=this.layers,s=this.radius,l=this.cx,h=this.cy,d=t._size,p=e.radialaxis,m=e.sector,g=P(m[0]);this.fillViewInitialKey("radialaxis.angle",p.angle);var v=this.radialAxis=x.extendFlat({},p,{_axislayer:n["radial-axis"],_gridlayer:n["radial-grid"],_id:"x",_pos:0,side:{counterclockwise:"top",clockwise:"bottom"}[p.side],domain:[0,s/d.w],anchor:"free",position:0,_counteraxis:!0});i(v,p,t),M.doAutoRange(v),p.range=v.range.slice(),p._input.range=v.range.slice(),this.fillViewInitialKey("radialaxis.range",v.range.slice()),"auto"===v.tickangle&&g>90&&g<=270&&(v.tickangle=180),v._transfn=function(t){return"translate("+v.l2p(t.x)+",0)"},v._gridpath=function(t){return o(v.r2p(t.x),m)};var y=a(p);this.radialTickLayout!==y&&(n["radial-axis"].selectAll(".xtick").remove(),this.radialTickLayout=y),M.doTicks(r,v,!0),c(n["radial-axis"],p.showticklabels||p.ticks,{transform:u(l,h)+f(-p.angle)}),c(n["radial-grid"],p.showgrid,{transform:u(l,h)}).selectAll("path").attr("transform",null),c(n["radial-line"].select("line"),p.showline,{x1:0,y1:0,x2:s,y2:0,transform:u(l,h)+f(-p.angle)}).attr("stroke-width",p.linewidth).call(b.stroke,p.linecolor)},N.updateRadialAxisTitle=function(t,e,r){var n=this.gd,i=this.radius,a=this.cx,o=this.cy,s=e.radialaxis,l=this.id+"title",c=void 0!==r?r:s.angle,u=D(c),f=Math.cos(u),h=Math.sin(u),d=0;if(s.title){var p=_.bBox(this.layers["radial-axis"].node()).height,m=s.titlefont.size;d="counterclockwise"===s.side?-p-.4*m:p+.8*m}this.layers["radial-axis-title"]=S.draw(n,l,{propContainer:s,propName:this.id+".radialaxis.title",placeholder:z(n,"Click to enter radial axis title"),attributes:{x:a+i/2*f+d*h,y:o-i/2*h+d*f,"text-anchor":"middle"},transform:{rotate:-c}})},N.updateAngularAxis=function(t,e){function r(t){return T.c2rad(t.x,"degrees")}function n(t){return[v*Math.cos(t),v*Math.sin(t)]}var o=this,h=o.gd,g=o.layers,v=o.radius,y=o.cx,_=o.cy,w=e.angularaxis,k=e.sector,A=k.map(D);o.fillViewInitialKey("angularaxis.rotation",w.rotation);var T=o.angularAxis=x.extendFlat({},w,{_axislayer:g["angular-axis"],_gridlayer:g["angular-grid"],_id:"angular",_pos:0,side:"right",domain:[0,Math.PI],anchor:"free",position:0,_counteraxis:!0});"linear"===T.type?(T.autorange=!1,l(k)?T.range=k.slice():T.range=A.map(T.unTransformRad).map(I),"radians"===T.thetaunit&&(T.tick0=I(T.tick0),T.dtick=I(T.dtick))):"category"===T.type&&(T._tickFilter=function(t){return o.isPtWithinSector({r:o.radialAxis.range[1],rad:T.c2rad(t.x)})}),i(T,w,t),M.doAutoRange(T),T._transfn=function(t){var e=r(t),i=n(e),a=u(y+i[0],_-i[1]),o=m.select(this);return o&&o.node()&&o.classed("ticks")&&(a+=f(-I(e))),a},T._gridpath=function(t){var e=n(r(t));return"M0,0L"+-e[0]+","+e[1]};var S="outside"!==w.ticks?.7:.5;T._labelx=function(t){var e=r(t),n=T._labelStandoff,i=T._pad;return(0===p(e)?0:Math.cos(e)*(n+i+S*t.fontSize))+d(e)*(t.dx+n+i)},T._labely=function(t){var e=r(t),n=T._labelStandoff,i=T._labelShift,a=T._pad;return t.dy+t.fontSize*C-i+-Math.sin(e)*(n+a+S*t.fontSize)},T._labelanchor=function(t,e){var n=r(e);return 0===p(n)?d(n)>0?"start":"end":"middle"};var E=a(w);o.angularTickLayout!==E&&(g["angular-axis"].selectAll(".angulartick").remove(),o.angularTickLayout=E),M.doTicks(h,T,!0),c(g["angular-line"].select("path"),w.showline,{d:s(v,k),transform:u(y,_)}).attr("stroke-width",w.linewidth).call(b.stroke,w.linecolor)},N.updateFx=function(t,e){this.gd._context.staticPlot||(this.updateAngularDrag(t,e),this.updateRadialDrag(t,e),this.updateMainDrag(t,e))},N.updateMainDrag=function(t,e){function r(t,e){var r=t-w,n=e-M;return Math.sqrt(r*r+n*n)}function n(t,e){return Math.atan2(M-e,t-w)}function i(t,e){return[t*Math.cos(e),t*Math.sin(-e)]}function a(t,e){var r=R.cornerLen,n=R.cornerHalfWidth;if(0===t)return s(2*n,S);var a=r/t/2,o=e-a,l=e+a,c=Math.max(0,Math.min(t,x)),u=c-n,f=c+n;return"M"+i(u,o)+"A"+[u,u]+" 0,0,0 "+i(u,l)+"L"+i(f,l)+"A"+[f,f]+" 0,0,1 "+i(f,o)+"Z"}function o(t,e){var i=C+t,o=z+e,l=r(C,z),c=Math.min(r(i,o),x),u=n(C,z),f=n(i,o);lp?(l0!=n>g[0])return;P=h.range[1]=n,M.doTicks(a,i.radialAxis,!0),o["radial-grid"].attr("transform",u(l,c)).selectAll("path").attr("transform",null);var f=P-g[0],d=i.sectorBBox;i.xaxis.range=[d[0]*f,d[2]*f],i.yaxis.range=[d[1]*f,d[3]*f],i.xaxis.setScale(),i.yaxis.setScale();for(var m in i.traceHash){var v=i.traceHash[m],_=x.filterVisible(v),w=v[0][0].trace._module,k=a._fullLayout[i.id];if(w.plot(a,i,_,k),!y.traceIs(m,"gl"))for(var A=0;A<_.length;A++)w.style(a,_[A])}})}}function n(){null!==z?v.relayout(a,i.id+".radialaxis.angle",z):null!==P&&v.relayout(a,i.id+".radialaxis.range[1]",P)}var i=this,a=i.gd,o=i.layers,s=i.radius,l=i.cx,c=i.cy,h=i.radialAxis,d=e.radialaxis,p=D(d.angle),g=h.range.slice(),b=g[1]-g[0],_=R.radialDragBoxSize,w=_/2;if(d.visible){var T=A.makeRectDragger(o,"radialdrag","crosshair",-w,-w,_,_),S={element:T,gd:a},E=l+(s+w)*Math.cos(p),L=c-(s+w)*Math.sin(p);m.select(T).attr("transform",u(E,L));var C,z,P;S.prepFn=function(){C=null,z=null,P=null,S.moveFn=r,S.doneFn=n,A.clearSelect(t._zoomlayer)},S.clampFn=function(t,e){return Math.sqrt(t*t+e*e)o&&(o+=360);var s,c,u=P(I(t.rad)),f=u+360;return n[1]>=n[0]?(s=n[0],c=n[1]):(s=n[1],c=n[0]),i>=s&&i<=c&&(l(e)||u>=a&&u<=o||f>=a&&f<=o)},N.fillViewInitialKey=function(t,e){t in this.viewInitial||(this.viewInitial[t]=e)}},{"../../components/color":618,"../../components/dragelement":640,"../../components/drawing":643,"../../components/fx":660,"../../components/titles":709,"../../constants/alignment":716,"../../lib":743,"../../lib/setcursor":762,"../../plotly":784,"../../registry":873,"../cartesian/axes":789,"../cartesian/dragbox":797,"../cartesian/select":807,"../plots":852,"./constants":853,"./helpers":854,d3:128,tinycolor2:546}],865:[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,f=i.partition||"x",h=e._subplots[l],d=h.length,p=0;p=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":618,"../../subplot_defaults":865,"./axis_defaults":869,"./layout_attributes":871}],871:[function(t,e,r){"use strict";var n=t("../../../components/color/attributes"),i=t("../../domain_attributes"),a=t("./axis_attributes"),o=t("../../../plot_api/edit_types").overrideAll;e.exports=o({domain:i({name:"ternary"}),bgcolor:{valType:"color",dflt:n.background},sum:{valType:"number",dflt:1,min:0},aaxis:a,baxis:a,caxis:a},"plot","from-root")},{"../../../components/color/attributes":617,"../../../plot_api/edit_types":773,"../../domain_attributes":815,"./axis_attributes":868}],872:[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"),f=t("../../components/drawing"),h=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"),x=t("../cartesian/select"),b=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;iw*x?i=(a=x)*w:a=(i=y)/w,o=g*i/y,s=v*a/x,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=b,l.xaxis={type:"linear",range:[_+2*k-b,b-_-2*M],domain:[p-o/2,p+o/2],_id:"x"},h(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:[_,b-M-k],domain:[m-s/2,m+s/2],_id:"y"},h(l.yaxis,l.graphDiv._fullLayout),l.yaxis.setScale(),l.yaxis.isPtWithinRange=function(){return!0};var A=l.yaxis.domain[0],T=l.aaxis=d({},t.aaxis,{visible:!0,range:[_,b-M-k],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[A,A+s*w],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2});h(T,l.graphDiv._fullLayout),T.setScale();var S=l.baxis=d({},t.baxis,{visible:!0,range:[b-_-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});h(S,l.graphDiv._fullLayout),S.setScale(),T._counteraxis=S;var E=l.caxis=d({},t.caxis,{visible:!0,range:[b-_-M,k],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[A,A+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});h(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 z="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",z),l.clipDefRelative.select("path").attr("transform",null);var D="translate("+(r-S._offset)+","+(n+a)+")";l.layers.baxis.attr("transform",D),l.layers.bgrid.attr("transform",D);var I="translate("+(r+i/2)+","+n+")rotate(30)translate(0,-"+T._offset+")";l.layers.aaxis.attr("transform",I),l.layers.agrid.attr("transform",I);var P="translate("+(r+i/2)+","+n+")rotate(-30)translate(0,-"+E._offset+")";l.layers.caxis.attr("transform",P),l.layers.cgrid.attr("transform",P),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1),l.layers.aline.select("path").attr("d",T.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(u.stroke,T.linecolor||"#000").style("stroke-width",(T.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(),f.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));this.layers["a-title"]=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;this.layers["b-title"]=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"}}),this.layers["c-title"]=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=b.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",A="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",T="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,f=(1-s/2-l)*O.w,h=(u+f)/2,d=f-u,p=(1-s)*O.h,g=p-d/w;d.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),P.transition().style("opacity",1).duration(200),D=!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 h(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(f.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(){N.selectAll(".select-outline").remove()}var m,y,_,M,L,C,z,D,I,P,O=this,F=O.layers.plotbg.select("path").node(),R=O.graphDiv,N=R._fullLayout._zoomlayer,j={element:F,gd:R,plotinfo:{xaxis:O.xaxis,yaxis:O.yaxis},subplot:O.id,prepFn:function(t,e,r){j.xaxes=[O.xaxis],j.yaxes=[O.yaxis];var i=R._fullLayout.dragmode;t.shiftKey&&(i="pan"===i?"zoom":"pan"),j.minDrag="lasso"===i?1:void 0,"zoom"===i?(j.moveFn=n,j.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(),z="M0,"+O.h+"L"+O.w/2+", 0L"+O.w+","+O.h+"Z",D=!1,I=N.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",z),P=N.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?(j.moveFn=h,j.doneFn=d,_={a:O.aaxis.range[0],b:O.baxis.range[1],c:O.caxis.range[1]},L=_,p()):"select"!==i&&"lasso"!==i||x(t,e,r,j,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(j)}},{"../../components/color":618,"../../components/dragelement":640,"../../components/drawing":643,"../../components/fx":660,"../../components/titles":709,"../../lib":743,"../../lib/extend":732,"../../plotly":784,"../cartesian/axes":789,"../cartesian/constants":794,"../cartesian/select":807,"../cartesian/set_convert":808,"../plots":852,d3:128,tinycolor2:546}],873:[function(t,e,r){"use strict";function n(t){if(t.layoutAttributes){var e=t.layoutAttributes._arrayAttrRegexps;if(e)for(var n=0;n-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)),f=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 h=Object.keys(u);for(r=0;r")?"":e.html(t).text()});return e.remove(),r}(w),w=function(t){return t.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")}(w),w=w.replace(u,"'"),i.isIE()&&(w=(w=(w=w.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),w}},{"../components/color":618,"../components/drawing":643,"../constants/xmlns_namespaces":723,"../lib":743,d3:128}],882:[function(t,e,r){"use strict";var n=t("../../lib").mergeArray;e.exports=function(t,e){for(var r=0;r0&&E>0&&(S<=F&&E<=R||S<=R&&E<=F||("h"===M?F>=S*(R/E):R>=E*(F/S)))?m="inside":(m="outside",A.remove(),A=null)}else m="inside";if(!A&&(A=d(e,k,"outside"===m?z:C),T=p.bBox(A.node()),S=T.width,E=T.height,S<=0||E<=0))A.remove();else{var N;N="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 f,h,d,p,m=(a.left+a.right)/2,g=(a.top+a.bottom)/2;f=u*a.width,h=u*a.height,"h"===o?er?(d=(t+e)/2,p=n+l+h/2):(d=(t+e)/2,p=n-l-h/2);return i(m,g,d,p,u,!1)}(l,c,u,f,T,M,"both"===g.constraintext||"outside"===g.constraintext):function(t,e,r,n,a,o,s){var l,c,u,f,h,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*(h=w),y-=2*h):h=0;var x,b;d<=v&&p<=y?(x=!1,b=1):d<=y&&p<=v?(x=!0,b=1):dr?(u=(t+e)/2,f=n-h-c/2):(u=(t+e)/2,f=n+h+c/2);return i(m,g,u,f,b,x)}(l,c,u,f,T,M,"both"===g.constraintext||"inside"===g.constraintext),A.attr("transform",N)}}}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&&ei;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.01?f:function(t,e){return Math.abs(t-e)>=2?f(t):t>e?Math.ceil(t):Math.floor(t)};g=A(g,m=A(m,g)),y=A(y,v=A(v,y))}var T=l.select(this);T.append("path").style("vector-effect","non-scaling-stroke").attr("d","M"+m+","+v+"V"+y+"H"+g+"V"+v+"Z"),n(t,T,e,s,m,g,v,y)}else l.select(this).remove()})}),s.call(m.plot,e)}},{"../../components/color":618,"../../components/drawing":643,"../../components/errorbars":649,"../../lib":743,"../../lib/svg_text_utils":766,"./attributes":883,d3:128,"fast-isnumeric":140,tinycolor2:546}],891:[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;ru+s||!p(l))&&(h=!0,c(f,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,f=[l,u],h=!1,g=0;g1||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":643,"../../components/errorbars":649,d3:128}],895:[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":618,"../../components/colorscale/defaults":628,"../../components/colorscale/has_colorscale":632}],896:[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":617,"../../lib/extend":732,"../scatter/attributes":1066}],897:[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,f,h,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",f=m,h="y"):(c=m,u="y",f=p,h="x");var y=c.makeCalcdata(e,u),x=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,h,f,y,d[v]),b=o.distinctVals(x),_=b.vals,w=b.minDiff/2,M=function(t,e){for(var r=t.length,n=new Array(r+1),i=0;i=0&&E0){var C=T[r].sort(n),z=C.map(i),D=z.length,I={pos:_[r],pts:C};I.min=z[0],I.max=z[D-1],I.mean=o.mean(z,D),I.sd=o.stdev(z,D,I.mean),I.q1=o.interp(z,.25),I.med=o.interp(z,.5),I.q3=o.interp(z,.75),I.lf=Math.min(I.q1,z[Math.min(o.findBin(2.5*I.q1-1.5*I.q3,z,!0)+1,D-1)]),I.uf=Math.max(I.q3,z[Math.max(o.findBin(2.5*I.q3-1.5*I.q1,z),0)]),I.lo=4*I.q1-3*I.q3,I.uo=4*I.q3-3*I.q1,g.push(I)}return function(t,e){if(Array.isArray(e.selectedpoints))for(var r=0;r0?(g[0].t={num:d[v],dPos:w,posLetter:h,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:")}},e._fullInput&&"candlestick"===e._fullInput.type&&delete g[0].t.labels,d[v]++,g):[{t:{empty:!0}}]}},{"../../lib":743,"../../plots/cartesian/axes":789,"fast-isnumeric":140}],898:[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":618,"../../lib":743,"../../registry":873,"./attributes":896}],899:[function(t,e,r){"use strict";function n(t,e,r,n){var i,c,u,f,h,d,p,m,g,v=t.cd,y=t.xa,x=t.ya,b=v[0].trace,_=v[0].t,w="violin"===b.type,M=[],k="closest"!==n||w?_.bdPos:2.5*_.bdPos,A=function(t){return t.pos+_.bPos-d};w&&"both"!==b.side?("positive"===b.side&&(g=function(t){var e=A(t);return s.inbox(e,e+k)}),"negative"===b.side&&(g=function(t){var e=A(t);return s.inbox(e-k,e)})):g=function(t){var e=A(t);return s.inbox(e-k,e+k)};var T;T=w?function(t){return s.inbox(t.span[0]-h,t.span[1]-h)}:function(t){return s.inbox(t.min-h,t.max-h)},"h"===b.orientation?(h=e,d=r,p=T,m=g,i="y",u=x,c="x",f=y):(h=r,d=e,p=g,m=T,i="x",u=y,c="y",f=x);var S=s.getDistanceFunction(n,p,m);if(s.getClosest(v,S,t),!1===t.index)return[];var E=v[t.index],L=b.line.color,C=(b.marker||{}).color;l.opacity(L)&&b.line.width?t.color=L:l.opacity(C)&&b.boxpoints?t.color=C:t.color=b.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 z={},D=["med","min","q1","q3","max"];(b.boxmean||(b.meanline||{}).visible)&&D.push("mean"),(b.boxpoints||b.points)&&D.push("lf","uf");for(var I=0;It.uf}),o=Math.max((t.max-t.min)/10,t.q3-t.q1),c=1e-9*o,u=o*h,m=[],g=0;if(r.jitter){if(0===o)for(g=1,m=new Array(a.length),e=0;et.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,f=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)+f,n=o.c2p(t.pos+u-i,!0)+f,l=o.c2p(t.pos+u+a,!0)+f,h=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"+h+","+n+"V"+l+("sd"===r.boxmean?"m0,0L"+d+","+e+"L"+h+","+n+"L"+p+","+e+"Z":"")):s.select(this).attr("d","M"+n+","+h+"H"+l+("sd"===r.boxmean?"m0,0L"+e+","+d+"L"+n+","+h+"L"+e+","+p+"Z":""))})}var s=t("d3"),l=t("../../lib"),c=t("../../components/drawing"),u=2e9,f=5,h=.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,f=e.node3=s.select(this),h=n._numBoxes,d="group"===n.boxmode&&h>1,p=r.dPos*(1-n.boxgap)*(1-n.boxgroupgap)/(d?h:1),m=d?2*r.dPos*((r.num+.5)/h-.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(f,{pos:v,val:y},u,r),u.boxpoints&&a(f,{x:l,y:c},u,r),u.boxmean&&o(f,{pos:v,val:y},u,r)}})},plotBoxAndWhiskers:i,plotPoints:a,plotBoxMean:o}},{"../../components/drawing":643,"../../lib":743,d3:128}],904:[function(t,e,r){"use strict";e.exports=function(t,e){var r,n,i=t.cd,a=t.xaxis,o=t.yaxis,s=[];if(!1===e)for(r=0;r=10)return null;for(var r=1/0,i=-1/0,a=t.length,o=0;o0?Math.floor:Math.ceil,z=E>0?Math.ceil:Math.floor,D=E>0?Math.min:Math.max,I=E>0?Math.max:Math.min,P=C(T+L),O=z(S-L),F=[[u=A(T)]];for(i=P;i*E=0;i--)a[u-i]=t[f][i],o[u-i]=e[f][i];for(s.push({x:a,y:o,bicubic:l}),i=f,a=[],o=[];i>=0;i--)a[f-i]=t[i][0],o[f-i]=e[i][0];return s.push({x:a,y:o,bicubic:c}),s}},{}],919:[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,f,h,d,p,g,v=[],y=[],x={};if("b"===r)for(i=t.b2j(e),o=Math.floor(Math.max(0,Math.min(P-2,i))),s=i-o,x.length=P,x.crossLength=I,x.xy=function(e){return t.evalxy([],e,i)},x.dxy=function(e,r){return t.dxydi([],e,o,r,s)},n=0;n0&&(h=t.dxydi([],n-1,o,0,s),v.push(l[0]+h[0]/3),y.push(l[1]+h[1]/3),d=t.dxydi([],n-1,o,1,s),v.push(f[0]-d[0]/3),y.push(f[1]-d[1]/3)),v.push(f[0]),y.push(f[1]),l=f;else for(n=t.a2i(e),c=Math.floor(Math.max(0,Math.min(I-2,n))),u=n-c,x.length=I,x.crossLength=P,x.xy=function(e){return t.evalxy([],n,e)},x.dxy=function(e,r){return t.dxydj([],c,e,u,r)},i=0;i0&&(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(f[0]-g[0]/3),y.push(f[1]-g[1]/3)),v.push(f[0]),y.push(f[1]),l=f;return x.axisLetter=r,x.axis=M,x.crossAxis=E,x.value=e,x.constvar=a,x.index=m,x.x=v,x.y=y,x.smoothing=E.smoothing,x}function s(e){var n,i,o,s,l,c=[],u=[],f={};if(f.length=w.length,f.crossLength=S.length,"b"===r)for(o=Math.max(0,Math.min(P-2,e)),l=Math.min(1,Math.max(0,e-o)),f.xy=function(r){return t.evalxy([],r,e)},f.dxy=function(e,r){return t.dxydi([],e,o,r,l)},n=0;nw.length-1||k.push(i(s(c),{color:M.gridcolor,width:M.gridwidth}));for(m=d;mw.length-1||y<0||y>w.length-1))for(x=w[u],b=w[y],l=0;lw[w.length-1]||A.push(i(o(v),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&T.push(i(s(0),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&T.push(i(s(w.length-1),{color:M.endlinecolor,width:M.endlinewidth}))}else{for(f=5e-15,d=(h=[Math.floor((w[w.length-1]-M.tick0)/M.dtick*(1+f)),Math.ceil((w[0]-M.tick0)/M.dtick/(1+f))].sort(function(t,e){return t-e}))[0],p=h[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;mw[w.length-1]||A.push(i(o(v),{color:M.minorgridcolor,width:M.minorgridwidth}));M.startline&&T.push(i(o(w[0]),{color:M.startlinecolor,width:M.startlinewidth})),M.endline&&T.push(i(o(w[w.length-1]),{color:M.endlinecolor,width:M.endlinewidth}))}}},{"../../lib/extend":732,"../../plots/cartesian/axes":789}],920:[function(t,e,r){"use strict";var n=t("../../plots/cartesian/axes"),i=t("../../lib/extend").extendFlat;e.exports=function(t,e){var r,a,o,s=e._labels=[],l=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t[n]=t[n].slice(0,e.length)):t[n]=[],i=0;i90&&(d-=180,l=-l),{angle:d,flip:l,p:t.c2p(n,e,r),offsetMultplier:c}}},{}],936:[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,d=e.yaxis,m=l.aaxis,g=l.baxis,v=t._fullLayout,y=e.plot.selectAll(".carpetlayer"),x=v._clips,b=n(y,"g","carpet"+l.uid).classed("trace",!0),_=n(b,"g","minorlayer"),w=n(b,"g","majorlayer"),M=n(b,"g","boundarylayer"),k=n(b,"g","labellayer");b.style("opacity",l.opacity),a(c,d,w,m,"a",m._gridlines),a(c,d,w,g,"b",g._gridlines),a(c,d,_,m,"a",m._minorgridlines),a(c,d,_,g,"b",g._minorgridlines),a(c,d,M,m,"a-boundary",m._boundarylines),a(c,d,M,g,"b-boundary",g._boundarylines);!function(t,e,r,n,i,a,o,l){var c,u,f,d;c=.5*(r.a[0]+r.a[r.a.length-1]),u=r.b[0],f=r.ab2xy(c,u,!0),d=r.dxyda_rough(c,u),void 0===o.angle&&p.extendFlat(o,h(r,i,a,f,r.dxydb_rough(c,u)));s(t,e,r,n,f,d,r.aaxis,i,a,o,"a-title"),c=r.a[0],u=.5*(r.b[0]+r.b[r.b.length-1]),f=r.ab2xy(c,u,!0),d=r.dxydb_rough(c,u),void 0===l.angle&&p.extendFlat(l,h(r,i,a,f,r.dxyda_rough(c,u)));s(t,e,r,n,f,d,r.baxis,i,a,l,"b-title")}(t,k,l,i,c,d,o(t,c,d,l,i,k,m._labels,"a-label"),o(t,c,d,l,i,k,g._labels,"b-label")),function(t,e,r,i,a){var o,s,l,c,h=r.select("#"+t._clipPathId);h.size()||(h=r.append("clipPath").classed("carpetclip",!0));var d=n(h,"path","carpetboundary"),p=e.clipsegments,m=[];for(c=0;c0?"start":"end","data-notex":1}).call(c.font,i.font).text(i.text).call(d.convertToTspans,t),g=c.bBox(this);m.attr("transform","translate("+o.p[0]+","+o.p[1]+") rotate("+o.angle+")translate("+i.axis.labelpadding*u+","+.3*g.height+")"),f=Math.max(f,g.width+i.axis.labelpadding)}),u.exit().remove(),p.maxExtent=f,p}function s(t,e,r,n,i,a,o,s,u,f,p){var m=[];o.title&&m.push(o.title);var y=e.selectAll("text."+p).data(m),x=f.maxExtent;y.enter().append("text").classed(p,!0),y.each(function(){var e=h(r,s,u,i,a);-1===["start","both"].indexOf(o.showticklabels)&&(x=0);var n=o.titlefont.size;x+=n+o.titleoffset;var p=(f.angle+(f.flip<0?180:0)-e.angle+450)%360,m=p>90&&p<270,y=l.select(this);y.text(o.title||"").call(d.convertToTspans,t),m&&(x=(-d.lineCount(y)+v)*g*n-x),y.attr("transform","translate("+e.p[0]+","+e.p[1]+") rotate("+e.angle+") translate(0,"+x+")").classed("user-select-none",!0).attr("text-anchor","middle").call(c.font,o.titlefont)}),y.exit().remove()}var l=t("d3"),c=t("../../components/drawing"),u=t("./map_1d_array"),f=t("./makepath"),h=t("./orient_text"),d=t("../../lib/svg_text_utils"),p=t("../../lib"),m=t("../../constants/alignment");e.exports=function(t,e,r){for(var n=0;nd&&tm&&ep||eg},f.c2p=function(t){return t},h.c2p=function(t){return t},t.setScale=function(){var e=t.x,r=t.y,n=a(t.xctrl,t.yctrl,e,r,f.smoothing,h.smoothing);t.xctrl=n[0],t.yctrl=n[1],t.evalxy=o([t.xctrl,t.yctrl],c,u,f.smoothing,h.smoothing),t.dxydi=s([t.xctrl,t.yctrl],f.smoothing,h.smoothing),t.dxydj=l([t.xctrl,t.yctrl],f.smoothing,h.smoothing)},t.i2a=function(t){var r=Math.max(0,Math.floor(t[0]),c-2),n=t[0]-r;return(1-n)*e[r]+n*e[r+1]},t.j2b=function(t){var e=Math.max(0,Math.floor(t[1]),c-2),n=t[1]-e;return(1-n)*r[e]+n*r[e+1]},t.ij2ab=function(e){return[t.i2a(e[0]),t.j2b(e[1])]},t.a2i=function(t){var r=Math.max(0,Math.min(i(t,e),c-2)),n=e[r],a=e[r+1];return Math.max(0,Math.min(c-1,r+(t-n)/(a-n)))},t.b2j=function(t){var e=Math.max(0,Math.min(i(t,r),u-2)),n=r[e],a=r[e+1];return Math.max(0,Math.min(u-1,e+(t-n)/(a-n)))},t.ab2ij=function(e){return[t.a2i(e[0]),t.b2j(e[1])]},t.i2c=function(e,r){return t.evalxy([],e,r)},t.ab2xy=function(n,i,a){if(!a&&(ne[c-1]|ir[u-1]))return[!1,!1];var o=t.a2i(n),s=t.b2j(i),l=t.evalxy([],o,s);if(a){var f,h,d,p,m=0,g=0,v=[];ne[c-1]?(f=c-2,h=1,m=(n-e[c-1])/(e[c-1]-e[c-2])):h=o-(f=Math.max(0,Math.min(c-2,Math.floor(o)))),ir[u-1]?(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,f,d,h,p),l[0]+=v[0]*m,l[1]+=v[1]*m),g&&(t.dxydj(v,f,d,h,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":761,"./compute_control_points":923,"./constants":924,"./create_i_derivative_evaluator":925,"./create_j_derivative_evaluator":926,"./create_spline_evaluator":927}],938:[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),e0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r0&&o0&&a1e-5);return n.log("Smoother converged to",k,"after",A,"iterations"),t}},{"../../lib":743}],939:[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":981,"./has_columns":929}],940:[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":619,"../../components/colorscale/attributes":624,"../../lib/extend":732,"../../plots/attributes":787,"../scattergeo/attributes":1104}],941:[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;cl&&(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":628,"../../lib":743,"./attributes":940}],943:[function(t,e,r){"use strict";e.exports=function(t,e){return t.location=e.location,t.z=e.z,t}},{}],944:[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,f=u[0].trace,h=t.subplot;for(s=0;s")}(t,f,o,h.mockAxis),[t]}},{"../../plots/cartesian/axes":789,"../scatter/fill_hover_text":1074,"./attributes":940}],945:[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":820,"../heatmap/colorbar":980,"./attributes":940,"./calc":941,"./defaults":942,"./event_data":943,"./hover":944,"./plot":946,"./select":947,"./style":948}],946:[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;a0&&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;ar?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;ns.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,f=e._input.contours;if(c>u&&(s.start=f.start=u,u=s.end=f.end=c,c=s.start),!(s.size>0)){var h;h=c===u?1:n(c,u,e.ncontours).dtick,f.size=s.size=h}}return r}},{"../../lib":743,"../../plots/cartesian/axes":789,"../heatmap/calc":978}],951:[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,f=c.size||1,h=c.coloring,d=a(r,{isColorbar:!0});"heatmap"===h&&l.filllevels({start:r.zmin,end:r.zmax,size:(r.zmax-r.zmin)/254}),l.fillcolor("fill"===h||"heatmap"===h?d:"").line({color:"lines"===h?d:u.color,width:!1!==c.showlines?u.width:0,dash:u.dash}).levels({start:c.start,end:o(c),size:f}).options(r.colorbar)()}else n.autoMargin(t,s)}},{"../../components/colorbar/draw":622,"../../plots/plots":852,"./end_plus":955,"./make_color_map":959}],952:[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}}},{}],953:[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":743,"./attributes":949}],954:[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":743,"../heatmap/has_columns":984,"../heatmap/xyz_defaults":993,"./attributes":949,"./contours_defaults":953,"./style_defaults":963}],955:[function(t,e,r){"use strict";e.exports=function(t){return t.end+t.size/1e6}},{}],956:[function(t,e,r){"use strict";function n(t,e,r,n){return Math.abs(t[0]-e[0])20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==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,x=t.z[0].length;for(f=0;f<1e4;f++){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 b=m[0]&&(e[0]<0||e[0]>x-2)||m[1]&&(e[1]<0||e[1]>y-2);if(d===h&&m.join(",")===v||r&&b)break;p=t.crossings[d]}1e4===f&&s.log("Infinite loop in contour?");var _,w,M,k,A,T,S,E,L,C,z,D=n(g[0],g[g.length-1],a,c),I=0,P=.2*t.smoothing,O=[],F=0;for(f=1;f=F;f--)if((_=O[f])=F&&_+O[w]E&&L--,t.edgepaths[L]=z.concat(g,C));break}j||(t.edgepaths[E]=g.concat(C))}for(E=0;Et?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":952}],961:[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,x=e.yaxis,b=t._fullLayout,_="contour"+v,w=function(t,e,r){for(var n=t.size,i=[],a=p(t),s=t.start;s1e3){o.warn("Too many contours, clipping at 1000",t);break}return i}(g,e,n[0]);if(!0!==l.visible)return b._paper.selectAll("."+_+",.hm"+v).remove(),void b._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),f(t,e,[n])):(b._paper.selectAll(".hm"+v).remove(),b._infolayer.selectAll("g.rangeslider-container").selectAll(".hm"+v).remove()),h(w),d(w);var M=y.c2p(c[0],!0),k=y.c2p(c[c.length-1],!0),A=x.c2p(u[0],!0),T=x.c2p(u[u.length-1],!0),S=[[M,T],[k,T],[k,A],[M,A]],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 f=!1!==l.showlines,h=l.showlabels,d=f&&h,p=r.createLines(u,f||h,e),g=r.createLineClip(u,d,n._fullLayout._clips,i.trace.uid),v=t.selectAll("g.contourlabels").data(h?[0]:[]);if(v.exit().remove(),v.enter().append("g").classed("contourlabels",!0),h){var y=[c],x=[];o.clearLocationCache();var b=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 A=Math.sqrt(w*w+M*M),T=m.LABELDISTANCE*A/Math.max(1,e.length/m.LABELINCREASE);p.each(function(t){var e=r.calcTextOpts(t.level,b,_,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/T),m.LABELMAX),i=0;i=0&&(c=x,f=h):Math.abs(l[1]-c[1])<.01?Math.abs(l[1]-x[1])<.01&&(x[0]-l[0])*(c[0]-x[0])>=0&&(c=x,f=h):o.log("endpt to newendpt is not vert. or horz.",l,c,x)}if(l=c,f>=0)break;m+="L"+c}if(f===t.edgepaths.length){o.log("unclosed perimeter path");break}g=f,(y=-1===v.indexOf(g))&&(g=v[0],m+="Z")}for(g=0;gn.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(f)+Math.cos(c)*a);if(h<1||d<1)return 1/0;var p=g.EDGECOST*(1/(h-1)+1/(d-1));p+=g.ANGLECOST*c*c;for(var m=s-u,v=l-f,y=s+u,x=l+f,b=0;b2*g.MAXCOST)break;d&&(s/=2),l=(a=c-s/2)+1.5*s}if(h<=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),f=i*u,h=a*c,d=i*c,p=-a*u,m=[[o-f-h,s-d-p],[o+f-h,s+d-p],[o+f+h,s+d+p],[o-f+h,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;cx.end&&(x.start=x.end=(x.start+x.end)/2),e._input.contours=a({},x)}else{var _=x.start,w=x.end,M=e._input.contours;if(_>w&&(x.start=M.start=w,w=x.end=M.end=_,_=x.start),!(x.size>0)){var k;k=_===w?1:n(_,w,e.ncontours).dtick,M.size=x.size=k}}return y}}},{"../../components/colorscale/calc":625,"../../lib":743,"../../plots/cartesian/axes":789,"../carpet/lookup_carpetid":931,"../heatmap/clean_2d_array":979,"../heatmap/convert_column_xyz":981,"../heatmap/find_empties":983,"../heatmap/has_columns":984,"../heatmap/interp2d":987,"../heatmap/make_bound_array":988,"../heatmap/max_row_length":989,"./defaults":971}],966:[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,f=1/0;for(i=0;i":case">=":n.contours.value>u&&(t[0].prefixBoundary=!0);break;case"<":case"<=":n.contours.valueu&&(t[0].prefixBoundary=!0);break;case"][":case")(":a=Math.min.apply(null,n.contours.value),o=Math.max.apply(null,n.contours.value),au&&(t[0].prefixBoundary=!0)}}},{}],967:[function(t,e,r){"use strict";e.exports={INEQUALITY_OPS:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"]}},{}],968:[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":967,"fast-isnumeric":140}],969:[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":968,"fast-isnumeric":140}],970:[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=":case">":if(1!==t.length)return void n.warn("Contour data invalid for the specified inequality operation.");for(i=t[0],r=0;r1e3){n.warn("Too many contours, clipping at 1000",t);break}return a}},{"../../lib":743}],973:[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":800,"../contour/colorbar":951,"../contour/style":962,"./attributes":964,"./calc":965,"./defaults":971,"./plot":976}],974:[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 f(t){return Math.abs(t[1]-r[0][1])=0&&(y=L,b=_):Math.abs(v[1]-y[1])=0&&(y=L,b=_):a.log("endpt to newendpt is not vert. or horz.",v,y,L)}if(b>=0)break;M+=m(v,y),v=y}if(b===e.edgepaths.length){a.log("unclosed perimeter path");break}g=b,(A=-1===k.indexOf(g))&&(g=k[0],M+=m(v,y)+"Z",v=null)}for(g=0;g=0;U--)N=k.clipsegments[U],j=l([],N.x,L.c2p),B=l([],N.y,C.c2p),j.reverse(),B.reverse(),q.push(c(j,B,N.bicubic));var H="M"+q.join("L")+"Z";!function(t,e,r,n,i,a){var o,s,u,f,h=t.selectAll("g.contourbg").data([0]);h.enter().append("g").classed("contourbg",!0);var d=h.selectAll("path").data("fill"!==a||i?[]:[0]);d.enter().append("path"),d.exit().remove();var p=[];for(f=0;fx&&(n.max=x);n.len=n.max-n.min}(this,r,t,n,h,e.height),!(n.len<(e.width+e.height)*m.LABELMIN)))for(var s=Math.min(Math.ceil(n.len/D),m.LABELMAX),l=0;lz){r("x scale is not linear");break}}if(y.length&&"fast"===L){var D=(y[y.length-1]-y[0])/(y.length-1),I=Math.abs(D/100);for(w=0;wI){r("y scale is not linear");break}}}var P=u(_),O="scaled"===e.xtype?"":m,F=p(e,O,g,v,P,k),R="scaled"===e.ytype?"":y,N=p(e,R,x,b,_.length,A);E||(a.expand(k,F),a.expand(A,N));var j={x:F,y:N,z:_,text:e.text};if(O&&O.length===F.length-1&&(j.xCenter=O),R&&R.length===N.length-1&&(j.yCenter=R),S&&(j.xRanges=M.xRanges,j.yRanges=M.yRanges,j.pts=M.pts),s(e,_,"","z"),T&&e.contours&&"heatmap"===e.contours.coloring){var B={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};j.xfill=p(B,O,g,v,P,k),j.yfill=p(B,R,x,b,_.length,A)}return[j]}},{"../../components/colorscale/calc":625,"../../lib":743,"../../plots/cartesian/axes":789,"../../registry":873,"../histogram2d/calc":1010,"./clean_2d_array":979,"./convert_column_xyz":981,"./find_empties":983,"./has_columns":984,"./interp2d":987,"./make_bound_array":988,"./max_row_length":989}],979:[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=0;o--)(s=((f[[(r=(a=h[o])[0])-1,i=a[1]]]||m)[2]+(f[[r+1,i]]||m)[2]+(f[[r,i-1]]||m)[2]+(f[[r,i+1]]||m)[2])/20)&&(l[a]=[r,i,s],h.splice(o,1),c=!0);if(!c)throw"findEmpties iterated with no new neighbors";for(a in l)f[a]=l[a],u.push(l[a])}return u.sort(function(t,e){return e[2]-t[2]})}},{"./max_row_length":989}],984:[function(t,e,r){"use strict";e.exports=function(t){return!Array.isArray(t.z[0])}},{}],985:[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=b[0].length||d<0||d>b.length)return}else{if(n.inbox(e-y[0],e-y[y.length-1])>o||n.inbox(r-x[0],r-x[x.length-1])>o)return;if(c){var E;for(T=[2*y[0]-y[1]],E=1;Em&&(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.01;o++)l=i(t,e,n(l));return l>.01&&a.log("interp2d didn't converge quickly",l),t}},{"../../lib":743}],988:[function(t,e,r){"use strict";var n=t("../../registry");e.exports=function(t,e,r,i,a,o){var s,l,c,u=[],f=n.traceIs(t,"contour"),h=n.traceIs(t,"histogram"),d=n.traceIs(t,"gl2d");if(Array.isArray(e)&&e.length>1&&!h&&"category"!==o.type){var p=e.length;if(!(p<=a))return f?e.slice(0,a):e.slice(0,a+1);if(f||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;c0;)w=v.c2p(E[T]),T--;for(w<_&&(M=w,w=_,_=M,F=!0),T=0;void 0===k&&T0;)A=y.c2p(L[T]),T--;if(A0&&(n=!0);for(var s=0;sa){var o=a-r[t];return r[t]=a,o}}return 0},max:function(t,e,r,i){var a=i[e];if(n(a)){if(a=Number(a),!n(r[t]))return r[t]=a,a;if(r[t]c){var l=a(e,i,o),u=a(r,i,o),f=t===s?0:1;return l[f]!==u[f]}return Math.floor(r/t)-Math.floor(e/t)>.1}(h,t,e,l,r,n))break;u=h}return u}function i(t,e){return e&&t>h?t>c?t>1.1*s?s:t>1.1*l?l:c:t>u?u:t>f?f:h: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,f=o.ONEMIN,h=o.ONESEC,d=t("../../plots/cartesian/axes").tickIncrement;e.exports=function(t,e,r,i,a){var o,l,u=-1.1*e,f=-.1*e,h=t-f,p=r[0],m=r[1],g=Math.min(n(p+f,p+h,i,a),n(m+f,m+h,i,a)),v=Math.min(n(p+u,p+f,i,a),n(m+u,m+f,i,a));if(g>v&&vc){var y=o===s?1:6,x=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(cp.size/1.9?p.size:p.size/Math.ceil(p.size/b);var T=p.start+(p.size-b)/2;_=T-b*Math.ceil((T-_)/b)}for(f=0;f=0&&w=0;a--)i(a);else if("increasing"===e){for(a=1;a=0;a--)t[a]+=t[a+1];"exclude"===r&&(t.push(0),t.shift())}}(a,x.direction,x.currentbin);var Z=Math.min(i.length,a.length),J=[],K=0,Q=Z-1;for(r=0;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};x.enabled||($.pts=z[r],q?$.p0=$.p1=z[r].length?A[z[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":721,"../../lib":743,"../../plots/cartesian/axes":789,"../bar/arrays_to_calcdata":882,"./average":998,"./bin_functions":1e3,"./bin_label_vals":1001,"./clean_bins":1003,"./norm_functions":1008,"fast-isnumeric":140}],1003:[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 f="date"===a?o:1,h=c.size;if(n(h))c.size=h>0?Number(h):f;else if("string"!=typeof h)c.size=f;else{var d=h.charAt(0),p=h.substr(1);((p=n(p)?Number(p):0)<=0||"date"!==a||"M"!==d||p!==Math.round(p))&&(c.size=f)}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":721,"../../lib":743,"fast-isnumeric":140}],1004:[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 f(r,n){return i.coerce(t,e,c,r,n)}var h=f("x"),d=f("y");f("cumulative.enabled")&&(f("cumulative.direction"),f("cumulative.currentbin")),f("text");var p=f("orientation",d&&!h?"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"]&&f("histfunc");o(t,e,f,"h"===p?["y"]:["x"]),s(t,e,f,r,u),l(t,e,a.defaultLine,{axis:"y"}),l(t,e,a.defaultLine,{axis:"x",inherit:"y"}),i.coerceSelectionMarkerOpacity(e,f)}else e.visible=!1}},{"../../components/color":618,"../../components/errorbars/defaults":648,"../../lib":743,"../../registry":873,"../bar/style_defaults":895,"./attributes":997,"./bin_defaults":999}],1005:[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;sA&&g.splice(A,g.length-A),y.length>A&&y.splice(A,y.length-A),n(e,"x",g,m,_,M,x),n(e,"y",y,v,w,k,b);var T=[],S=[],E=[],L="string"==typeof e.xbins.size,C="string"==typeof e.ybins.size,z=[],D=[],I=L?z:e.xbins,P=C?D:e.ybins,O=0,F=[],R=[],N=e.histnorm,j=e.histfunc,B=-1!==N.indexOf("density"),U="max"===j||"min"===j?null:0,V=c.count,q=u[N],H=!1,G=[],Y=[],W="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";W&&"count"!==j&&(H="avg"===j,V=c[j]);var X=e.xbins,Z=_(X.start),J=_(X.end)+(Z-l.tickIncrement(Z,X.size,!1,x))/1e6;for(r=Z;r=0&&d=0&&p0)o=c(t.alphahull,h);else{var d=["x","y","z"].indexOf(t.delaunayaxis);o=l(h.map(function(t){return[t[(d+1)%3],t[(d+2)%3]]}))}var p={positions:h,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:f(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=f(t.color)),this.mesh.update(p)},h.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":765,"alpha-shape":47,"convex-hull":109,"delaunay-triangulate":130,"gl-mesh3d":210,tinycolor2:546}],1022:[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"]),f=c(["i","j","k"]);if(u){f&&f.forEach(function(t){for(var e=0;ei?r=!0:e1)){var f=a.simpleMap(u.x,e.d2c,0,r.xcalendar),h=a.distinctVals(f).minDiff;o=Math.min(o,h)}}for(o===1/0&&(o=1),c=0;c");S.push(o,o,o,o,o,o,null)},R=0;Rs&&(n.log("parcoords traces support up to "+s+" dimensions at the moment"),c.splice(s)),l=0;l0)&&(r("label"),r("tickvals"),r("ticktext"),r("tickformat"),r("range"),r("constraintrange"),f=Math.min(f,o.values.length)),o._index=l,u.push(o));if(isFinite(f))for(l=0;lf&&(o.values=o.values.slice(0,f));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 f={family:l.font.family,size:Math.round(l.font.size*(10/12)),color:l.font.color};n.coerceFont(c,"labelfont",f),n.coerceFont(c,"tickfont",f),n.coerceFont(c,"rangefont",f)}},{"../../components/colorscale/defaults":628,"../../components/colorscale/has_colorscale":632,"../../lib":743,"./attributes":1031,"./constants":1035}],1037:[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":1031,"./base_plot":1032,"./calc":1033,"./colorbar":1034,"./defaults":1036,"./plot":1040}],1038:[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=h*c*i,o.count=h*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>>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=f-4?o(s,f-2-l):.5);return i}(E,S,T,C),O=s(E,P),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?z:1)))}),N=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")}),j=[0,1],B=[];return{setColorDomain:function(t){j[0]=t[0],j[1]=t[1]},render:function(t,e,a){var o,s,l,c=1/0,f=-1/0;for(o=0;of&&(f=t[o].dim2.canvasX,l=o),t[o].dim1.canvasXi)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,x=a.rangefont,b=h.extendDeep({},c,{color:s.map(o({values:s,range:[c.cmin,c.cmax]})),blockLineCount:f.blockLineCount,canvasOverdrag:f.overdrag*f.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=_,A=w;return{key:r,colCount:p.filter(n).length,dimensions:p,tickDistance:f.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:b,labelFont:g,tickFont:y,rangeFont:x,layoutWidth:m,layoutHeight:t.height,domain:u,translateX:u.x[0]*m,translateY:t.height-u.y[1]*t.height,pad:M,canvasWidth:k*f.canvasPixelRatio+2*b.canvasOverdrag,canvasHeight:A*f.canvasPixelRatio,width:k,height:A,canvasPixelRatio:f.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=f.verticalPadding/(r*s),u=1-2*c,h=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:f.scatter||e.scatter,xIndex:n,crossfilterDimensionIndex:n,visibleIndex:e._index,height:r,values:e.values,paddedUnitValues:e.values.map(a).map(h),xScale:l,x:l(n),canvasX:l(n)*s,unitScale:function(t,e){return d.scale.linear().range([t-e,e])}(r,f.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,f.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(f.cn.axisExtentText,!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var u=t("./lines"),f=t("./constants"),h=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 x(t,e){return(f.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=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,f={x:a,y:s,clientX:e.clientX,clientY:e.clientY,dataIndex:t.model.key,curveNumber:u};u!==L&&(c?o.hover(f):o.unhover&&o.unhover(f),L=u)}}),S.style("opacity",function(t){return t.pick?.01:1}),e.style("background","rgba(255, 255, 255, 0)");var C=e.selectAll("."+f.cn.parcoords).data(T,m);C.exit().remove(),C.enter().append("g").classed(f.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("#"+f.id.filterBarPattern).data(g,m);r.enter().append("pattern").attr("id",f.id.filterBarPattern).attr("patternUnits","userSpaceOnUse"),r.attr("x",-f.bar.width).attr("width",f.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",f.bar.width).attr("x",f.bar.width/2).attr("fill",f.bar.fillcolor).attr("fill-opacity",f.bar.fillopacity).attr("stroke",f.bar.strokecolor).attr("stroke-opacity",f.bar.strokeopacity).attr("stroke-width",f.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 z=C.selectAll("."+f.cn.parcoordsControlView).data(g,m);z.enter().append("g").classed(f.cn.parcoordsControlView,!0).style("box-sizing","content-box"),z.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var D=z.selectAll("."+f.cn.yAxis).data(function(t){return t.dimensions},m);D.enter().append("g").classed(f.cn.yAxis,!0).each(function(t){E.dimensions.push(t)}),z.each(function(t){x(D,t)}),S.filter(function(t){return!!t.viewModel}).each(function(t){t.lineLayer=u(this,t,f.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)}),D.attr("transform",function(t){return"translate("+t.xScale(t.xIndex)+", 0)"}),D.call(d.behavior.drag().origin(function(t){return t}).on("drag",function(t){var e=t.parent;A=!1,k||(t.x=Math.max(-f.overdrag,Math.min(t.model.width+f.overdrag,d.event.x)),t.canvasX=t.x*t.model.canvasPixelRatio,D.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}),x(D,e),D.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)"),D.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,x(D,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),A=!0,o&&o.axesMoved&&o.axesMoved(e.key,e.dimensions.map(function(t){return t.crossfilterDimensionIndex})))})),D.exit().remove();var I=D.selectAll("."+f.cn.axisOverlays).data(g,m);I.enter().append("g").classed(f.cn.axisOverlays,!0),I.selectAll("."+f.cn.axis).remove();var P=I.selectAll("."+f.cn.axis).data(g,m);P.enter().append("g").classed(f.cn.axis,!0),P.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(P.selectAll("text"),t.model.tickFont)}),P.selectAll(".domain, .tick>line").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),P.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=I.selectAll("."+f.cn.axisHeading).data(g,m);O.enter().append("g").classed(f.cn.axisHeading,!0);var F=O.selectAll("."+f.cn.axisTitle).data(g,m);F.enter().append("text").classed(f.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),F.attr("transform","translate(0,"+-f.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){p.font(F,t.model.labelFont)});var R=I.selectAll("."+f.cn.axisExtent).data(g,m);R.enter().append("g").classed(f.cn.axisExtent,!0);var N=R.selectAll("."+f.cn.axisExtentTop).data(g,m);N.enter().append("g").classed(f.cn.axisExtentTop,!0),N.attr("transform","translate(0,"+-f.axisExtentOffset+")");var j=N.selectAll("."+f.cn.axisExtentTopText).data(g,m);j.enter().append("text").classed(f.cn.axisExtentTopText,!0).call(c),j.text(function(t){return b(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){p.font(j,t.model.rangeFont)});var B=R.selectAll("."+f.cn.axisExtentBottom).data(g,m);B.enter().append("g").classed(f.cn.axisExtentBottom,!0),B.attr("transform",function(t){return"translate(0,"+(t.model.height+f.axisExtentOffset)+")"});var U=B.selectAll("."+f.cn.axisExtentBottomText).data(g,m);U.enter().append("text").classed(f.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(c),U.text(function(t){return b(t)(t.domainScale.domain()[0])}).each(function(t){p.font(U,t.model.rangeFont)});var V=I.selectAll("."+f.cn.axisBrush).data(g,m),q=V.enter().append("g").classed(f.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))}),q.selectAll("rect").attr("x",-f.bar.capturewidth/2).attr("width",f.bar.capturewidth),q.selectAll("rect.extent").attr("fill","url(#"+f.id.filterBarPattern+")").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),q.selectAll(".resize rect").attr("height",f.bar.handleheight).attr("opacity",0).style("visibility","visible"),q.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",f.bar.handleoverlap-f.bar.handleheight),q.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",f.bar.handleoverlap);var H=!1,G=!1;return E}},{"../../components/drawing":643,"../../lib":743,"../../lib/gup":740,"./constants":1035,"./lines":1038,d3:128}],1040:[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={},f=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:f.w,height:f.h,margin:{t:f.t,r:f.r,b:f.b,l:f.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":1039,regl:506}],1041:[function(t,e,r){"use strict";var n=t("../../components/color/attributes"),i=t("../../plots/font_attributes"),a=t("../../plots/attributes"),o=t("../../plots/domain_attributes"),s=t("../../lib/extend").extendFlat,l=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:s({},a.hoverinfo,{flags:["label","text","value","percent","name"]}),textposition:{valType:"enumerated",values:["inside","outside","auto","none"],dflt:"auto",arrayOk:!0,editType:"calc"},textfont:s({},l,{}),insidetextfont:s({},l,{}),outsidetextfont:s({},l,{}),domain:o({name:"pie",trace:!0,editType:"calc"}),hole:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},sort:{valType:"boolean",dflt:!0,editType:"calc"},direction:{valType:"enumerated",values:["clockwise","counterclockwise"],dflt:"counterclockwise",editType:"calc"},rotation:{valType:"number",min:-360,max:360,dflt:0,editType:"calc"},pull:{valType:"number",min:0,max:1,dflt:0,arrayOk:!0,editType:"calc"}}},{"../../components/color/attributes":617,"../../lib/extend":732,"../../plots/attributes":787,"../../plots/domain_attributes":815,"../../plots/font_attributes":816}],1042:[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")}}return y};var l},{"../../components/color":618,"./helpers":1046,"fast-isnumeric":140,tinycolor2:546}],1044:[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 f=o("text"),h=o("textinfo",Array.isArray(f)?"text+percent":"percent");if(o("hovertext"),h&&"none"!==h){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":743,"./attributes":1041}],1045:[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":657}],1046:[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;r0?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"),f=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,f=[];for(i=0;il&&(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===f.indexOf(s.scalegroup)&&f.push(s.scalegroup)}for(a=0;aa.vTotal/2?1:0)}(e),h.each(function(){var h=a.select(this).selectAll("g.slice").data(e);h.enter().append("g").classed("slice",!0),h.exit().remove();var m=[[[],[]],[[],[]]],g=!1;h.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 h=d.cx,v=d.cy,y=a.select(this),x=y.selectAll("path.surface").data([e]),b=!1,_=!1;if(x.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=h+e.pxmid[0]*(1-c),g=v+e.pxmid[1]*(1-c),y=r.separators,x=[];if(-1!==l.indexOf("label")&&x.push(e.label),-1!==l.indexOf("text")){var w=u.castOption(s.hovertext||s.text,e.pts);w&&x.push(w)}-1!==l.indexOf("value")&&x.push(u.formatPieValue(e.v,y)),-1!==l.indexOf("percent")&&x.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:x.join("
"),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}),b=!0}t.emit("plotly_hover",{points:[f(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:[f(e,i)],event:a.event}),_=!1),b&&(o.loneUnhover(n._hoverlayer.node()),b=!1)}).on("click",function(){var r=t._fullLayout,n=t._fullData[p.index];t._dragging||!1===r.hovermode||(t._hoverdata=[f(e,n)],o.click(t,a.event))}),p.pull){var w=+u.castOption(p.pull,e.pts)||0;w>0&&(h+=w*e.pxmid[0],v+=w*e.pxmid[1])}e.cxFinal=h,e.cyFinal=v;var M=p.hole;if(e.v===d.vTotal){var k="M"+(h+e.px0[0])+","+(v+e.px0[1])+s(e.px0,e.pxmid,!0,1)+s(e.pxmid,e.px0,!0,1)+"Z";M?x.attr("d","M"+(h+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):x.attr("d",k)}else{var A=s(e.px0,e.px1,!0,1);if(M){var T=1-M;x.attr("d","M"+(h+M*e.px1[0])+","+(v+M*e.px1[1])+s(e.px1,e.px0,!1,M)+"l"+T*e.px0[0]+","+T*e.px0[1]+A+"Z")}else x.attr("d","M"+h+","+v+"l"+e.px0[0]+","+e.px0[1]+A+"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)),f=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),s/(Math.sqrt(a*a+s/2)+a)),h={scale:2*f/t.height,rCenter:Math.cos(f/r.r)-f*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>h.scale?g:h;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=h+e.pxmid[0]*o.rCenter+(o.x||0),f=v+e.pxmid[1]*o.rCenter+(o.y||0);o.outside&&(e.yLabelMin=f-s.height/2,e.yLabelMid=f,e.yLabelMax=f+s.height/2,e.labelExtraX=0,e.labelExtraY=0,g=!0),r.attr("transform","translate("+u+","+f+")"+(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*h>0&&(t.labelExtraY=y),Array.isArray(e.pull))for(i=0;i=(u.castOption(e.pull,a.pts)||0)||((t.pxmid[1]-a.pxmid[1])*h>0?(y=a.cyFinal+c(a.px0[1],a.px1[1])-p-t.labelExtraY)*h>0&&(t.labelExtraY+=y):(g+t.labelExtraY-v)*h>0&&(n=3*f*Math.abs(i-m.indexOf(t)),(s=a.cxFinal+l(a.px0[0],a.px1[0])+n-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*f>0&&(t.labelExtraX+=s)))}var a,o,s,l,c,f,h,d,p,m,g,v,y;for(o=0;o<2;o++)for(s=o?r:n,c=o?Math.max:Math.min,h=o?1:-1,a=0;a<2;a++){for(l=a?Math.max:Math.min,f=a?1:-1,(d=t[o][a]).sort(s),p=t[1-o][a],m=p.concat(d),v=[],g=0;gMath.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(){h.selectAll("tspan").each(function(){var t=a.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)}},{"../../components/color":618,"../../components/drawing":643,"../../components/fx":660,"../../lib/svg_text_utils":766,"./event_data":1045,"./helpers":1046,d3:128}],1051:[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":1052,d3:128}],1052:[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":618,"./helpers":1046}],1053:[function(t,e,r){"use strict";var n=t("../scatter/attributes");e.exports={x:n.x,y:n.y,xy:{valType:"data_array",editType:"calc"},indices:{valType:"data_array",editType:"calc"},xbounds:{valType:"data_array",editType:"calc"},ybounds:{valType:"data_array",editType:"calc"},text:n.text,marker:{color:{valType:"color",arrayOk:!1,editType:"calc"},opacity:{valType:"number",min:0,max:1,dflt:1,arrayOk:!1,editType:"calc"},blend:{valType:"boolean",dflt:null,editType:"calc"},sizemin:{valType:"number",min:.1,max:2,dflt:.5,editType:"calc"},sizemax:{valType:"number",min:.1,dflt:20,editType:"calc"},border:{color:{valType:"color",arrayOk:!1,editType:"calc"},arearatio:{valType:"number",min:0,max:1,dflt:0,editType:"calc"},editType:"calc"},editType:"calc"}}},{"../scatter/attributes":1066}],1054:[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,f=t.xbounds&&t.ybounds,h=t.indices,d=this.bounds;if(u){if(n=u,e=u.length>>>1,f)d[0]=t.xbounds[0],d[2]=t.xbounds[1],d[1]=t.ybounds[0],d[3]=t.ybounds[1];else for(s=0;sd[2]&&(d[2]=i),od[3]&&(d[3]=o);if(h)r=h;else for(r=new Int32Array(e),s=0;sd[2]&&(d[2]=i),od[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,x=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=y,this.pointcloudOptions.sizeMax=x,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(d,x/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":765,"../scatter/get_trace_color":1076,"gl-pointcloud2d":235}],1055:[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":743,"./attributes":1053}],1056:[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":829,"../scatter3d/calc":1092,"./attributes":1053,"./convert":1054,"./defaults":1055}],1057:[function(t,e,r){"use strict";var n=t("../../plots/font_attributes"),i=t("../../plots/attributes"),a=t("../../components/color/attributes"),o=t("../../components/fx/attributes"),s=t("../../plots/domain_attributes"),l=t("../../lib/extend").extendFlat,c=t("../../plot_api/edit_types").overrideAll;e.exports=c({hoverinfo:l({},i.hoverinfo,{flags:["label","text","value","percent","name"]}),hoverlabel:o.hoverlabel,domain:s({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:n({}),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":617,"../../components/fx/attributes":652,"../../lib/extend":732,"../../plot_api/edit_types":773,"../../plots/attributes":787,"../../plots/domain_attributes":815,"../../plots/font_attributes":816}],1058:[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":661,"../../plot_api/edit_types":773,"../../plots/get_data":826,"./plot":1063}],1059:[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;a1})}(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":743,"../../lib/gup":740,"strongly-connected-components":537}],1060:[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"}}},{}],1061:[function(t,e,r){"use strict";var n=t("../../lib"),i=t("./attributes"),a=t("../../components/color"),o=t("tinycolor2");e.exports=function(t,e,r,s){function l(r,a){return n.coerce(t,e,i,r,a)}l("node.label"),l("node.pad"),l("node.thickness"),l("node.line.color"),l("node.line.width");var c=s.colorway;l("node.color",e.node.label.map(function(t,e){return a.addOpacity(function(t){return c[t%c.length]}(e),.8)})),l("link.label"),l("link.source"),l("link.target"),l("link.value"),l("link.line.color"),l("link.line.width"),l("link.color",e.link.value.map(function(){return o(s.paper_bgcolor).getLuminance()<.333?"rgba(255, 255, 255, 0.6)":"rgba(0, 0, 0, 0.2)"})),l("domain.x"),l("domain.y"),l("orientation"),l("valueformat"),l("valuesuffix"),l("arrangement"),n.coerceFont(l,"textfont",n.extendFlat({},s.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":618,"../../lib":743,"./attributes":1057,tinycolor2:546}],1062:[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":1057,"./base_plot":1058,"./calc":1059,"./defaults":1061,"./plot":1063}],1063:[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("."+x.sankeyLink).filter(s(e)).call(f.bind(0,e,r,!1))}function u(t,e,r){e&&r&&i(r,e).selectAll("."+x.sankeyLink).filter(s(e)).call(h.bind(0,e,r,!1))}function f(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",.4),a&&i(e,t).selectAll("."+x.sankeyLink).filter(function(t){return t.link.label===a}).style("fill-opacity",.4),r&&i(e,t).selectAll("."+x.sankeyNode).filter(l(t)).call(c)}function h(t,e,r,n){var a=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha}),a&&i(e,t).selectAll("."+x.sankeyLink).filter(function(t){return t.link.label===a}).style("fill-opacity",function(t){return t.tinyColorAlpha}),r&&i(e,t).selectAll(x.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"),x=t("./constants").cn,b=y._;e.exports=function(t,e){var r=t._fullLayout,i=r._paper,s=r._size,l=b(t,"source:")+" ",y=b(t,"target:")+" ",_=b(t,"incoming flow count:")+" ",w=b(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(f.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(),f=u.left+u.width/2,h=u.top+u.height/2,m=g.loneHover({x:f-c.left,y:h-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("
"),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"),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":618,"../../components/fx":660,"../../lib":743,"./constants":1060,"./render":1064,d3:128}],1064:[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;e1||t.linkLineWidth>0}function h(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 x(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 b(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;i0&&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"),A=t("../../components/drawing"),T=t("@plotly/d3-sankey").sankey,S=t("d3-force"),E=t("../../lib"),L=t("../../lib/gup").keyFun,C=t("../../lib/gup").repeat,z=t("../../lib/gup").unwrap;e.exports=function(t,e,r,n){var i=t.selectAll("."+_.cn.sankey).data(e.filter(function(t){return z(t).trace.visible}).map(function(t,e,r){for(var n,i=z(e).trace,o=i.domain,s=i.node,l=i.link,c=i.arrangement,u="h"===i.orientation,f=i.node.pad,h=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,x=i.textfont,b=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}}),A=T().size(u?[b,w]:[w,b]).nodeWidth(h).nodePadding(f).nodes(M).links(k).layout(_.sankeyIterations),S=A.nodes(),L=0;L5?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":618,"../../components/drawing":643,"../../lib":743,"../../lib/gup":740,"./constants":1060,"@plotly/d3-sankey":41,d3:128,"d3-force":124,tinycolor2:546}],1065:[function(t,e,r){"use strict";var n=t("../../lib");e.exports=function(t,e){for(var r=0;re&&l.splice(e,l.length-e),l.map(r)}return r(n.size)}}var i=t("fast-isnumeric"),a=t("../../plots/cartesian/axes"),o=t("../../constants/numerical").BADNUM,s=t("./subtypes"),l=t("./colorscale_calc"),c=t("./arrays_to_calcdata"),u=t("./calc_selection");e.exports={calc:function(t,e){var r=a.getFromId(t,e.xaxis||"x"),f=a.getFromId(t,e.yaxis||"y"),h=r.makeCalcdata(e,"x"),d=f.makeCalcdata(e,"y"),p=Math.min(h.length,d.length);r._minDtick=0,f._minDtick=0,h.length>p&&h.splice(p,h.length-p),d.length>p&&d.splice(p,d.length-p);var m={padded:!0},g={padded:!0},v=n(e,p);v&&(m.ppad=g.ppad=v),!("tozerox"===e.fill||"tonextx"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?e.error_y.visible||-1===["tonexty","tozeroy"].indexOf(e.fill)&&(s.hasMarkers(e)||s.hasText(e))||(m.padded=!1,m.ppad=0):m.tozero=!0,!("tozeroy"===e.fill||"tonexty"===e.fill&&t.firstscatter)||h[0]===h[p-1]&&d[0]===d[p-1]?-1!==["tonextx","tozerox"].indexOf(e.fill)&&(g.padded=!1):g.tozero=!0,a.expand(r,h,m),a.expand(f,d,g);for(var y=new Array(p),x=0;x=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}}},{}],1070:[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,f=l.cmin,h=l.cmax;n(f)||(f=i.aggNums(Math.min,null,u)),n(h)||(h=i.aggNums(Math.max,null,u));var d=e[0].t.cb=s(t,c),p=o.makeColorScaleFunc(o.extractScale(l.colorscale,f,h),{noNumericCheck:!0});d.fillcolor(p).filllevels({start:f,end:h,size:(h-f)/254}).options(l.colorbar)()}else a.autoMargin(t,c)}},{"../../components/colorbar/draw":622,"../../components/colorscale":633,"../../lib":743,"../../plots/plots":852,"fast-isnumeric":140}],1071:[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":625,"../../components/colorscale/has_colorscale":632,"./subtypes":1088}],1072:[function(t,e,r){"use strict";e.exports={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20}},{}],1073:[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"),f=t("./text_defaults"),h=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=gH!=(F=z[L][1])>=H&&(I=z[L-1][0],P=z[L][0],F-O&&(D=I+(P-I)*(H-O)/(F-O),B=Math.min(B,D),U=Math.max(U,D)));B=Math.max(B,0),U=Math.min(U,d._length);var G=s.defaultLine;return s.opacity(h.fillcolor)?G=h.fillcolor:s.opacity((h.line||{}).color)&&(G=h.line.color),n.extendFlat(t,{distance:c+10,x0:B,x1:U,y0:H,y1:H,color:G}),delete t.index,h.text&&!Array.isArray(h.text)?t.text=String(h.text):t.text=h.name,[t]}}}},{"../../components/color":618,"../../components/errorbars":649,"../../components/fx":660,"../../lib":743,"./fill_hover_text":1074,"./get_trace_color":1076}],1078:[function(t,e,r){"use strict";var n={},i=t("./subtypes");n.hasLines=i.hasLines,n.hasMarkers=i.hasMarkers,n.hasText=i.hasText,n.isBubble=i.isBubble,n.attributes=t("./attributes"),n.supplyDefaults=t("./defaults"),n.cleanData=t("./clean_data"),n.calc=t("./calc").calc,n.arraysToCalcdata=t("./arrays_to_calcdata"),n.plot=t("./plot"),n.colorbar=t("./colorbar"),n.style=t("./style").style,n.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":800,"./arrays_to_calcdata":1065,"./attributes":1066,"./calc":1067,"./clean_data":1069,"./colorbar":1070,"./defaults":1073,"./hover":1077,"./plot":1085,"./select":1086,"./style":1087,"./subtypes":1088}],1079:[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":628,"../../components/colorscale/has_colorscale":632}],1080:[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=t[e],i=P.c2p(r.x),a=O.c2p(r.y);return i===n||a===n?r.intoCenter||!1:[i,a]}function l(t){var e=t[0]/P._length,r=t[1]/O._length;return(1+s.toleranceGrowth*Math.max(0,-e,e-1,-r,r-1))*N}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)tt||t[1]rt)return[o(t[0],$,tt),o(t[1],et,rt)]}function h(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=f(t),i=f(e);return n&&i&&h(n,i)?r:(n&&r.push(n),i&&r.push(i),r)}function p(t,e,r){return function(n,a){var o=f(n),s=f(a),l=[];if(o&&s&&h(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===q[H-1][0],i=r===q[H-1][1];if(!n||!i)if(H>1){var a=e===q[H-2][0],o=r===q[H-2][1];n&&(e===$||e===tt)&&a?o?H--:q[H-1]=t:i&&(r===et||r===rt)&&o?a?H--:q[H-1]=t:q[H++]=t}else q[H++]=t}function g(t){q[H-1][0]!==t[0]&&q[H-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]rt?rt:0,G||Y){if(H)if(Z){var e=K(Z,t);e.length>1&&(g(e[0]),q[H++]=e[1])}else J=K(q[H-1],t)[0],q[H++]=J;else q[H++]=[G||t[0],Y||t[1]];var r=q[H-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]),q[H++]=t}var y,x,b,_,w,M,k,A,T,S,E,L,C,z,D,I,P=e.xaxis,O=e.yaxis,F=e.simplify,R=e.connectGaps,N=e.baseTolerance,j=e.shape,B="linear"===j,U=[],V=s.minTolerance,q=new Array(t.length),H=0;F||(N=V=-1);var G,Y,W,X,Z,J,K,Q=s.maxScreensAway,$=-P._length*Q,tt=P._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"===j||"spline"===j?K=u:"hv"===j||"vh"===j?K=d:"hvh"===j?K=p(0,$,tt):"vhv"===j&&(K=p(1,et,rt)),y=0;yl(M))break;b=M,(C=T[0]*A[0]+T[1]*A[1])>E?(E=C,_=M,k=!1):C=t.length||!M)break;v(M),x=M}}else v(_)}Z&&m([W||Z[0],X||Z[1]]),U.push(q.slice(0,H))}return U}},{"../../constants/numerical":721,"../../lib":743,"./constants":1072}],1081:[function(t,e,r){"use strict";e.exports=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")}},{}],1082:[function(t,e,r){"use strict";e.exports=function(t,e,r){var n,i,a=null;for(i=0;i0?Math.max(e,i):0}}},{"fast-isnumeric":140}],1084:[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),f=(t.line||{}).color;if(c=c||{},f&&(r=f),l("marker.symbol"),l("marker.opacity",u?.7:1),l("marker.size"),l("marker.color",r),i(t,"marker")&&a(t,e,s,l,{prefix:"marker.",cLetter:"c"}),c.noSelect||(l("selected.marker.color"),l("unselected.marker.color"),l("selected.marker.size"),l("unselected.marker.size")),c.noLine||(l("marker.line.color",f&&!Array.isArray(f)&&e.marker.color!==f?f:u?n.background:n.defaultLine),i(t,"marker.line")&&a(t,e,s,l,{prefix:"marker.line.",cLetter:"c"}),l("marker.line.width",u?1:0)),u&&(l("marker.sizeref"),l("marker.sizemin"),l("marker.sizemode")),c.gradient){"none"!==l("marker.gradient.type")&&l("marker.gradient.color")}}},{"../../components/color":618,"../../components/colorscale/defaults":628,"../../components/colorscale/has_colorscale":632,"./subtypes":1088}],1085:[function(t,e,r){"use strict";function n(t,e,r,n,u,h,d){function p(t){return w?t.transition():t}function m(t){p(t).attr("d","M0,0Z")}function g(t){return t.filter(function(t){return t.vis})}function v(t){return t.id}function y(){return!1}function x(e){var n,s,c=e[0].trace,u=i.select(this),f=l.hasMarkers(c),h=l.hasText(c),d=function(t){if(t.ids)return v}(c),m=y,x=y;f&&(m=c.marker.maxdisplayed||c._needsCull?g:a.identity),h&&(x=c.marker.maxdisplayed||c._needsCull?g:a.identity);var b=(n=u.selectAll("path.point").data(m,d)).enter().append("path").classed("point",!0);w&&b.call(o.pointStyle,c,t).call(o.translatePoints,M,k).style("opacity",0).transition().style("opacity",1);var _=f&&o.tryColorscale(c.marker,""),A=f&&o.tryColorscale(c.marker,"line");n.order(),n.each(function(e){var n=i.select(this),a=p(n);(s=o.translatePoint(e,a,M,k))?(o.singlePointStyle(e,a,c,_,A,t),r.layerClipId&&o.hideOutsideRangePoint(e,a,M,k,c.xcalendar,c.ycalendar),c.customdata&&n.classed("plotly-customdata",null!==e.data&&void 0!==e.data)):a.remove()}),w?n.exit().transition().style("opacity",0).remove():n.exit().remove(),(n=u.selectAll("g").data(x,d)).enter().append("g").classed("textpoint",!0).append("text"),n.order(),n.each(function(t){var e=i.select(this),n=p(e.select("text"));(s=o.translatePoint(t,n,M,k))?r.layerClipId&&o.hideOutsideRangePoint(t,e,M,k,c.xcalendar,c.ycalendar):e.remove()}),n.selectAll("text").call(o.textPointStyle,c,t).each(function(t){var e=M.c2p(t.x),r=k.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,_;!function(t,e,r,n,o){var s=r.xaxis,c=r.yaxis,u=i.extent(a.simpleMap(s.range,s.r2c)),f=i.extent(a.simpleMap(c.range,c.r2c)),h=n[0].trace;if(!l.hasMarkers(h))return;var d=h.marker.maxdisplayed;if(0===d)return;var p=n.filter(function(t){return t.x>=u[0]&&t.x<=u[1]&&t.y>=f[0]&&t.y<=f[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&&r0,M=r.xaxis,k=r.yaxis,A=n[0].trace,T=A.line,S=i.select(h);if(S.call(s.plot,r,d),!0===A.visible){p(S).style("opacity",A.opacity);var E,L,C=A.fill.charAt(A.fill.length-1);"x"!==C&&"y"!==C&&(C=""),n[0].node3=S;var z="",D=[],I=A._prevtrace;I&&(z=I._prevRevpath||"",L=I._nextFill,D=I._polygons);var P,O,F,R,N,j,B,U,V,q="",H="",G=[],Y=a.noop;if(E=A._ownFill,l.hasLines(A)||"none"!==A.fill){for(L&&L.datum(n),-1!==["hv","vh","hvh","vhv"].indexOf(T.shape)?(F=o.steps(T.shape),R=o.steps(T.shape.split("").reverse().join(""))):F=R="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")},N=function(t){return R(t.reverse())},G=c(n,{xaxis:M,yaxis:k,connectGaps:A.connectgaps,baseTolerance:Math.max(T.width||1,3)/4,shape:T.shape,simplify:T.simplify}),V=A._polygons=new Array(G.length),_=0;_1){var r=i.select(this);if(r.datum(n),t)p(r.style("opacity",0).attr("d",P).call(o.lineGroupStyle)).style("opacity",1);else{var a=p(r);a.attr("d",P),o.singleLineStyle(n,a)}}}}}var W=S.selectAll(".js-line").data(G);p(W.exit()).style("opacity",0).remove(),W.each(Y(!1)),W.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(o.lineGroupStyle).each(Y(!0)),o.setClipUrl(W,r.layerClipId),G.length?(E?j&&U&&(C?("y"===C?j[1]=U[1]=k.c2p(0,!0):"x"===C&&(j[0]=U[0]=M.c2p(0,!0)),p(E).attr("d","M"+U+"L"+j+"L"+q.substr(1)).call(o.singleFillStyle)):p(E).attr("d",q+"Z").call(o.singleFillStyle)):L&&("tonext"===A.fill.substr(0,6)&&q&&z?("tonext"===A.fill?p(L).attr("d",q+"Z"+z+"Z").call(o.singleFillStyle):p(L).attr("d",q+"L"+z.substr(1)+"Z").call(o.singleFillStyle),A._polygons=A._polygons.concat(D)):(m(L),A._polygons=null)),A._prevRevpath=H,A._prevPolygons=V):(E?m(E):L&&m(L),A._polygons=A._prevRevpath=A._prevPolygons=null);var X=S.selectAll(".points");b=X.data([n]),X.each(x),b.enter().append("g").classed("points",!0).each(x),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"),f=t("../../lib/polygon").tester;e.exports=function(t,e,r,a,s){var l,c,f,h,d=e.plot.select("g.scatterlayer"),p=!a,m=!!a&&a.duration>0;for((f=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={};lc[e[0].trace.uid]?1:-1}),m){s&&(h=s());i.transition().duration(a.duration).ease(a.easing).each("end",function(){h&&h()}).each("interrupt",function(){h&&h()}).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&&f.exit().remove(),d.selectAll("path:not([d])").remove()}},{"../../components/drawing":643,"../../components/errorbars":649,"../../lib":743,"../../lib/polygon":755,"./line_points":1080,"./link_traces":1082,"./subtypes":1088,d3:128}],1086:[function(t,e,r){"use strict";var n=t("./subtypes");e.exports=function(t,e){var r,i,a,o,s=t.cd,l=t.xaxis,c=t.yaxis,u=[],f=s[0].trace;if(!n.hasMarkers(f)&&!n.hasText(f))return[];if(!1===e)for(r=0;r=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 D=["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 I=e.projection[D[n]];(r.project[n]=I.show)&&(r.projectOpacity[n]=I.opacity,r.projectScale[n]=I.scale)}r.errorBounds=b(e,d);var P=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=P.color,r.errorLineWidth=P.lineWidth,r.errorCapSize=P.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"),f=t("gl-error3d"),h=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"),x=t("../../constants/gl3d_markers"),b=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=f(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=0&&h("surfacecolor",d||p);for(var m=["x","y","z"],g=0;g<3;++g){var v="projection."+m[g];h(v+".show")&&(h(v+".opacity"),h(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":648,"../../lib":743,"../../registry":873,"../scatter/line_defaults":1079,"../scatter/marker_defaults":1084,"../scatter/subtypes":1088,"../scatter/text_defaults":1089,"./attributes":1091}],1096:[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":719,"../../plots/gl3d":832,"../scatter/colorbar":1070,"./attributes":1091,"./calc":1092,"./convert":1094,"./defaults":1095}],1097:[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":619,"../../components/colorscale/color_attributes":626,"../../lib/extend":732,"../../plots/attributes":787,"../scatter/attributes":1066}],1098:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc"),a=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=t("../carpet/lookup_carpetid");e.exports=function(t,e){var r=e.carpetTrace=l(t,e);if(r&&r.visible&&"legendonly"!==r.visible){var c;e.xaxis=r.xaxis,e.yaxis=r.yaxis;var u,f,h=e.a.length,d=new Array(h),p=!1;for(c=0;c0?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,f=c-u;return s.x0=Math.max(Math.min(s.x0,f),u),s.x1=Math.max(Math.min(s.x1,f),u),o}var h=s.cd[s.index];s.a=h.a,s.b=h.b,s.xLabelVal=void 0,s.yLabelVal=void 0;var d=s.trace,p=d._carpet,m=(h.hi||d.hoverinfo).split("+"),g=[];-1!==m.indexOf("all")&&(m=["a","b"]),-1!==m.indexOf("a")&&a(p.aaxis,h.a),-1!==m.indexOf("b")&&a(p.baxis,h.b);var v=p.ab2ij([h.a,h.b]),y=Math.floor(v[0]),x=v[0]-y,b=Math.floor(v[1]),_=v[1]-b,w=p.evalxy([],y,b,x,_);return g.push("y: "+w[1].toFixed(3)),s.extraText=g.join("
"),o}}},{"../scatter/hover":1077}],1102:[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("../scatter/style").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":800,"../scatter/colorbar":1070,"../scatter/select":1086,"../scatter/style":1087,"./attributes":1097,"./calc":1098,"./defaults":1099,"./event_data":1100,"./hover":1101,"./plot":1103}],1103:[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")}(u,g,d.mockAxis,c[0].t.labels),[t]}}},{"../../components/fx":660,"../../constants/numerical":721,"../../plots/cartesian/axes":789,"../scatter/fill_hover_text":1074,"../scatter/get_trace_color":1076,"./attributes":1104}],1109:[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":820,"../scatter/colorbar":1070,"./attributes":1104,"./calc":1105,"./defaults":1106,"./event_data":1107,"./hover":1108,"./plot":1110,"./select":1111,"./style":1112}],1110:[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,r){function f(t,e){t.lonlat[0]===a&&n.select(e).remove()}for(var h=0;h1,f=r.error_x&&!0===r.error_x.visible,h=r.error_y&&!0===r.error_y.visible,p=f||h,m=d.hasMarkers(r),x=!!r.fill&&"none"!==r.fill);var E,L,C,z,D,I,O,F,R=p?l.calcFromTrace(r,b):null;if(f){(C={}).positions=n;var N=new Float64Array(4*_);if("log"===T.type)for(o=0;o<_;++o)N[k++]=n[2*o]-T.d2l(R[o].xs)||0,N[k++]=T.d2l(R[o].xh)-n[2*o]||0,N[k++]=0,N[k++]=0;else for(o=0;o<_;++o)N[k++]=n[2*o]-R[o].xs||0,N[k++]=R[o].xh-n[2*o]||0,N[k++]=0,N[k++]=0;r.error_x.copy_ystyle&&(r.error_x=r.error_y),C.errors=N,C.capSize=2*r.error_x.width,C.lineWidth=r.error_x.thickness,C.color=r.error_x.color}if(h){(z={}).positions=n;var j=new Float64Array(4*_);if("log"===S.type)for(o=0;o<_;++o)j[A++]=0,j[A++]=0,j[A++]=n[2*o+1]-S.d2l(R[o].ys)||0,j[A++]=S.d2l(R[o].yh)-n[2*o+1]||0;else for(o=0;o<_;++o)j[A++]=0,j[A++]=0,j[A++]=n[2*o+1]-R[o].ys||0,j[A++]=R[o].yh-n[2*o+1]||0;z.errors=j,z.capSize=2*r.error_y.width,z.lineWidth=r.error_y.thickness,z.color=r.error_y.color}if(s){(E={}).thickness=r.line.width,E.color=r.line.color,E.opacity=r.opacity,E.overlay=!0;var B=(v[r.line.dash]||[1]).slice();for(o=0;oP?"rect":m?"rect":"round",U&&r.connectgaps){var V=F[0],q=F[1];for(o=0;os&&(A[0]=s),A[1]l&&(T[0]=l),T[1]=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),h=e-f;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([h,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]+f,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("
")}(l,d,s[0].t.labels),[t]}}},{"../../components/fx":660,"../../constants/numerical":721,"../scatter/fill_hover_text":1074,"../scatter/get_trace_color":1076}],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("../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":846,"../scatter/colorbar":1070,"../scattergeo/calc":1105,"./attributes":1116,"./defaults":1118,"./event_data":1119,"./hover":1120,"./plot":1122,"./select":1123}],1122:[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":1117}],1123:[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,f=[],h=l[0].trace;if(!n.hasMarkers(h))return[];if(!1===e)for(s=0;s")}var i=t("../scatter/hover"),a=t("../../plots/cartesian/axes"),o=t("../../lib");e.exports={hoverPoints:function(t,e,r,a){var o=i(t,e,r,a);if(o&&!1!==o[0].index){var s=o[0];if(void 0===s.index)return o;var l=t.subplot,c=s.cd[s.index],u=s.trace;if(l.isPtWithinSector(c))return s.xLabelVal=void 0,s.yLabelVal=void 0,s.extraText=n(c,u,l),o}},makeHoverPointText:n}},{"../../lib":743,"../../plots/cartesian/axes":789,"../scatter/hover":1077}],1128:[function(t,e,r){"use strict";e.exports={moduleType:"trace",name:"scatterpolar",basePlotModule:t("../../plots/polar"),categories:["polar","symbols","markerColorscale","showLegend","scatter-like"],attributes:t("./attributes"),supplyDefaults:t("./defaults"),calc:t("./calc"),plot:t("./plot"),style:t("../scatter/style").style,hoverPoints:t("./hover").hoverPoints,selectPoints:t("../scatter/select"),meta:{}}},{"../../plots/polar":855,"../scatter/select":1086,"../scatter/style":1087,"./attributes":1124,"./calc":1125,"./defaults":1126,"./hover":1127,"./plot":1129}],1129:[function(t,e,r){"use strict";var n=t("../scatter/plot"),i=t("../../constants/numerical").BADNUM;e.exports=function(t,e,r){var a,o,s,l={xaxis:e.xaxis,yaxis:e.yaxis,plot:e.framework,layerClipId:e._hasClipOnAxisFalse?e.clipIds.circle:null},c=e.radialAxis,u=c.range;for(s=u[0]>u[1]?function(t){return t<=0}:function(t){return t>=0},a=0;a=0?(g=o.c2r(m)-l[0],y=d(v),E[p]=S[2*p]=g*Math.cos(y),L[p]=S[2*p+1]=g*Math.sin(y)):E[p]=L[p]=S[2*p]=S[2*p+1]=NaN;var C=a.sceneOptions(t,e,b,S);C.fill&&!u.fill2d&&(u.fill2d=!0),C.marker&&!u.scatter2d&&(u.scatter2d=!0),C.line&&!u.line2d&&(u.line2d=!0),!C.errorX&&!C.errorY||u.error2d||(u.error2d=!0),c.hasMarkers(b)&&(C.selected.positions=C.unselected.positions=C.marker.positions),u.lineOptions.push(C.line),u.errorXOptions.push(C.errorX),u.errorYOptions.push(C.errorY),u.fillOptions.push(C.fill),u.markerOptions.push(C.marker),u.selectedOptions.push(C.selected),u.unselectedOptions.push(C.unselected),u.count=r.length,_.scene=u,_.index=h,_.x=E,_.y=L,_.rawx=E,_.rawy=L,_.r=w,_.theta=M,_.positions=S,_.count=T,_.tree=n(S,512)}}),a.plot(t,e,r)},hoverPoints:function(t,e,r,n){var i=t.cd[0].t,o=i.r,s=i.theta,c=a.hoverPoints(t,e,r,n);if(c&&!1!==c[0].index){var u=c[0];if(void 0===u.index)return c;var f=t.subplot,h=f.angularAxis,d=u.cd[u.index],p=u.trace;if(d.r=o[u.index],d.theta=s[u.index],d.rad=h.c2rad(d.theta,p.thetaunit),f.isPtWithinSector(d))return u.xLabelVal=void 0,u.yLabelVal=void 0,u.extraText=l(d,p,f),c}},style:a.style,selectPoints:a.selectPoints,meta:{}}},{"../../plots/cartesian/axes":789,"../../plots/polar":855,"../scatter/colorscale_calc":1071,"../scatter/subtypes":1088,"../scattergl":1115,"../scatterpolar/hover":1127,"./attributes":1130,"./defaults":1131,"fast-isnumeric":140,kdgrass:292}],1133:[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,f=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:f.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":619,"../../components/colorscale/color_attributes":626,"../../components/drawing/attributes":642,"../../lib/extend":732,"../../plots/attributes":787,"../scatter/attributes":1066}],1134:[function(t,e,r){"use strict";var n=t("fast-isnumeric"),i=t("../scatter/colorscale_calc"),a=t("../scatter/arrays_to_calcdata"),o=t("../scatter/calc_selection"),s=t("../scatter/calc").calcMarkerSize,l=["a","b","c"],c={a:["b","c"],b:["a","c"],c:["a","b"]};e.exports=function(t,e){var r,u,f,h,d,p,m=t._fullLayout[e.subplot].sum,g=e.sum||m;for(r=0;r"),s}}},{"../../plots/cartesian/axes":789,"../scatter/hover":1077}],1138:[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("../scatter/style").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":866,"../scatter/colorbar":1070,"../scatter/select":1086,"../scatter/style":1087,"./attributes":1133,"./calc":1134,"./defaults":1135,"./event_data":1136,"./hover":1137,"./plot":1139}],1139:[function(t,e,r){"use strict";var n=t("../scatter/plot");e.exports=function(t,e,r){var i=e.plotContainer;i.select(".scatterlayer").selectAll("*").remove();var a={xaxis:e.xaxis,yaxis:e.yaxis,plot:i,layerClipId:e._hasClipOnAxisFalse?e.clipIdRelative:null};n(t,a,r)}},{"../scatter/plot":1085}],1140:[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":618,"../../components/colorbar/attributes":619,"../../components/colorscale/attributes":624,"../../lib/extend":732,"../../plot_api/edit_types":773}],1141:[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":625}],1142:[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,f=r.surfacecolor||r.z;if(n(c)||(c=i.aggNums(Math.min,null,f)),n(u)||(u=i.aggNums(Math.max,null,f)),t._fullLayout._infolayer.selectAll("."+l).remove(),r.showscale){var h=e[0].t.cb=s(t,l),d=o.makeColorScaleFunc(o.extractScale(r.colorscale,c,u),{noNumericCheck:!0});h.fillcolor(d).filllevels({start:c,end:u,size:(u-c)/254}).options(r.colorbar)()}else a.autoMargin(t,l)}},{"../../components/colorbar/draw":622,"../../components/colorscale":633,"../../lib":743,"../../plots/plots":852,"fast-isnumeric":140}],1143:[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"),f=t("../../lib/str2rgbarray"),h=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,x=n.zaxis,b=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],A=M[1],T=r.contourLevels;this.data=t;var S=t.xcalendar,E=t.ycalendar,L=t.zcalendar;l(M[2],function(t,e){return x.d2l(p[e][t],0,L)*b[2]}),Array.isArray(m[0])?l(k,function(t,e){return v.d2l(m[e][t],0,S)*b[0]}):l(k,function(t){return v.d2l(m[t],0,S)*b[0]}),Array.isArray(g[0])?l(A,function(t,e){return y.d2l(g[e][t],0,E)*b[1]}):l(A,function(t,e){return y.d2l(g[e],0,E)*b[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 z=o(new Float32Array(_*w),[_,w]);l(z,function(e,r){return t.surfacecolor[r][e]}),M.push(z)}else C.intensityBounds[0]*=b[2],C.intensityBounds[1]*=b[2];this.dataScale=function(t){var e=Math.max(t[0].shape[0],t[0].shape[1]);if(e",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"}}},{}],1150:[function(t,e,r){"use strict";function n(t){return t.calcdata.columns.reduce(function(e,r){return r.xIndex=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,f=Math.floor(t._fullLayout._size.w*(u.x[1]-u.x[0])),h=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,h-m+o.uplift),v=i(a(d,m),[]),y=i(g,v),x={},b=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*f});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:f,height:h,columnOrder:b,groupHeight:h,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=x[t];x[t]=(r||0)+1;return{key:t+"__"+x[t],label:t,specIndex:e,xIndex:b[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":732,"./constants":1149,"fast-isnumeric":140}],1151:[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":732}],1152:[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/i),o=!i||a;t.mayHaveMarkup=i&&n.match(/[<&>]/);var s=function(t){return"string"==typeof t&&t.match(M.latexCheck)}(n);t.latex=s;var l,f=s?"":u(t.calcdata.cells.prefix,e,r)||"",h=s?"":u(t.calcdata.cells.suffix,e,r)||"",d=s?null:u(t.calcdata.cells.format,e,r)||null,p=f+(d?k.format(d)(t.value):t.value)+h;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=(" "===M.wrapSplitCharacter?p.replace(/c&&(t.value+=s.join(M.wrapSpacer)+M.lineBreaker,s=[],l=0),s.push(r.text),l+=i;l&&(t.value+=s.join(M.wrapSpacer)),t.wrapped=!0}),n.selectAll("tspan.line").remove(),l(n.select("."+M.cn.cellText),r,t),k.select(e.parentNode.parentNode).call(x)}}:function(t,e,r,n,i){return function(){if(!i.settledY){var a=k.select(e.parentNode),s=w(i),l=i.key-s.firstRowIndex,c=s.rows[l].rowHeight,u=i.cellHeightMayIncrease?e.parentNode.getBoundingClientRect().height+2*M.cellPad:c,f=Math.max(u,c),d=f-s.rows[l].rowHeight;d&&(s.rows[l].rowHeight=f,t.selectAll("."+M.cn.columnCell).call(x),m(null,t.filter(h),0),o(r,n,!0)),a.attr("transform",function(){var t=this.parentNode,e=t.getBoundingClientRect(),r=k.select(this.parentNode).select("."+M.cn.cellRect).node().getBoundingClientRect(),n=this.transform.baseVal.consolidate(),a=r.top-e.top+(n?n.matrix.f:M.cellPad);return"translate("+y(i,k.select(this.parentNode).select("."+M.cn.cellTextHolder).node().getBoundingClientRect().width)+" "+a+")"}),i.settledY=!0}}};t.needsConvertToTspans?S.convertToTspans(i,n,a(r,this,e,n,t)):k.select(this.parentNode).attr("transform",function(t){return"translate("+y(t)+" "+M.cellPad+")"}).attr("text-anchor",function(t){return{left:"start",center:"middle",right:"end"}[t.align]})})}function c(t){return-1!==t.indexOf(M.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 f(t,e,r){t.transition().ease(M.releaseTransitionEase).duration(M.releaseTransitionDuration).attr("transform","translate("+e.x+" "+r+")")}function h(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+_(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=b(i,i.length),c=n.calcdata.groupHeight-p(n),u=s.scrollY=Math.max(0,Math.min(l-c,s.scrollY)),f=function(t,e,r){for(var n=[],i=0,a=0;ai&&n.push(a),i+=l}return n}(i,u,c);1===f.length&&(f[0]===i.length-1?f.unshift(f[0]-1):f.push(f[0]+1)),f[0]%2&&f.reverse(),e.each(function(t,e){t.page=f[e],t.scrollY=u}),e.attr("transform",function(t){return"translate(0 "+(b(t.rowBlocks,t.page)-t.scrollY)+")"}),t&&(v(t,r,e,f,n.prevPages,n,0),v(t,r,e,f,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*k.event.dy:n;var l=o.selectAll("."+M.cn.yColumn).selectAll("."+M.cn.columnBlock).filter(h);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){switch(t.align){case"left":return M.cellPad;case"right":return t.column.columnWidth-(e||0)-M.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return M.cellPad}}function x(t){t.attr("transform",function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,e){return t+_(e,1/0)},0);return"translate(0 "+(_(w(t),t.key)+e)+")"}).selectAll("."+M.cn.cellRect).attr("height",function(t){return function(t,e){return t.rows[e-t.firstRowIndex]}(w(t),t.key).rowHeight})}function b(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;n0){var y,x,b,_,w,M=t.xa,k=t.ya;"h"===h.orientation?(w=e,y="y",b=k,x="x",_=M):(w=r,y="x",b=M,x="y",_=k);var A=f[t.index];if(w>=A.span[0]&&w<=A.span[1]){var T=n.extendFlat({},t),S=_.c2p(w,!0),E=o.getKdeValue(A,h,w),L=o.getPositionOnKdePath(A,h,S),C=b._offset,z=b._length;T[y+"0"]=L[0],T[y+"1"]=L[1],T[x+"0"]=T[x+"1"]=S,T[x+"Label"]=x+": "+i.hoverLabelText(_,w)+", "+f[0].t.labels.kde+" "+E.toFixed(3),g.push(T),(u={stroke:t.color})[y+"1"]=n.constrain(C+L[0],C,C+z),u[y+"2"]=n.constrain(C+L[1],C,C+z),u[x+"1"]=u[x+"2"]=_._offset+S}}}-1!==d.indexOf("points")&&(c=a.hoverOnPoints(t,e,r));var D=l.selectAll(".violinline-"+h.uid).data(u?[0]:[]);return D.enter().append("line").classed("violinline-"+h.uid,!0).attr("stroke-width",1.5),D.exit().remove(),D.attr(u),"closest"===s?c?[c]:g:c?(g.push(c),g):g}},{"../../lib":743,"../../plots/cartesian/axes":789,"../box/hover":899,"./helpers":1158}],1160:[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":800,"../box/select":904,"./attributes":1155,"./calc":1156,"./defaults":1157,"./hover":1159,"./layout_attributes":1161,"./layout_defaults":1162,"./plot":1163,"./set_positions":1164,"./style":1165}],1161:[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":743,"../box/layout_attributes":901}],1162:[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":743,"../box/layout_defaults":902,"./layout_attributes":1161}],1163:[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:f,yaxis:h,connectGaps:!0,baseTolerance:.75,shape:"spline",simplify:!0});return a.smoothopen(e[0],1)}var u=t._fullLayout,f=e.xaxis,h=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"],x=e[a.posLetter+"axis"],b="both"===s.side,_=b||"positive"===s.side,w=b||"negative"===s.side,M=s.box&&s.box.visible,k=s.meanline&&s.meanline.visible,A=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=x.c2p(l);switch(s.scalemode){case"width":e=A.maxWidth/g;break;case"count":e=A.maxWidth/g*(A.maxCount/t.pts.length)}var f,h,d,p,m,M,k;if(_){for(M=new Array(o),p=0;pi&&(i=c,a=l)}}return i?s(a):f};case"rms":return function(t,e){for(var r=0,i=0,a=0;a=",">","<="],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":return function(t){return h(t)>i};case">=":return function(t){return h(t)>=i};case"[]":return function(t){var e=h(t);return e>=i[0]&&e<=i[1]};case"()":return function(t){var e=h(t);return e>i[0]&&e=i[0]&&ei[0]&&e<=i[1]};case"][":return function(t){var e=h(t);return e<=i[0]||e>=i[1]};case")(":return function(t){var e=h(t);return ei[1]};case"](":return function(t){var e=h(t);return e<=i[0]||e>i[1]};case")[":return function(t){var e=h(t);return e=i[1]};case"{}":return function(t){return-1!==i.indexOf(h(t))};case"}{":return function(t){return-1===i.indexOf(h(t))}}}(r,a.getDataToCoordFunc(t,e,f,u),d),x={},b={},_=0;r.preservegaps?(g=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set(new Array(h))},v=function(t,e){var r=x[t.astr][e];t.get()[e]=r}):(g=function(t){x[t.astr]=n.extendDeep([],t.get()),t.set([])},v=function(t,e){var r=x[t.astr][e];t.get().push(r)}),i(g);for(var w=o(e.transforms,r),M=0;M1?"%{group} (%{trace})":"%{group}");var l=t.styles,c=s.styles=[];if(l)for(o=0;oe?1:t>=e?0:NaN}function p(t){return null===t?NaN:+t}function d(t){return!isNaN(t)}function g(t){return{left:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(arguments.length<3&&(n=0),arguments.length<4&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}}t.ascending=f,t.descending=function(t,e){return et?1:e>=t?0:NaN},t.min=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++in&&(r=n)}else{for(;++i=n){r=n;break}for(;++in&&(r=n)}return r},t.max=function(t,e){var r,n,i=-1,a=t.length;if(1===arguments.length){for(;++i=n){r=n;break}for(;++ir&&(r=n)}else{for(;++i=n){r=n;break}for(;++ir&&(r=n)}return r},t.extent=function(t,e){var r,n,i,a=-1,o=t.length;if(1===arguments.length){for(;++a=n){r=i=n;break}for(;++an&&(r=n),i=n){r=i=n;break}for(;++an&&(r=n),i1)return o/(l-1)},t.deviation=function(){var e=t.variance.apply(this,arguments);return e?Math.sqrt(e):e};var v=g(f);function m(t){return t.length}t.bisectLeft=v.left,t.bisect=t.bisectRight=v.right,t.bisector=function(t){return g(1===t.length?function(e,r){return f(t(e),r)}:t)},t.shuffle=function(t,e,r){(a=arguments.length)<3&&(r=t.length,a<2&&(e=0));for(var n,i,a=r-e;a;)i=Math.random()*a--|0,n=t[a+e],t[a+e]=t[i+e],t[i+e]=n;return t},t.permute=function(t,e){for(var r=e.length,n=new Array(r);r--;)n[r]=t[e[r]];return n},t.pairs=function(t){for(var e=0,r=t.length-1,n=t[0],i=new Array(r<0?0:r);e=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r};var y=Math.abs;function x(t,e){for(var r in e)Object.defineProperty(t.prototype,r,{value:e[r],enumerable:!1})}function b(){this._=Object.create(null)}t.range=function(t,e,r){if(arguments.length<3&&(r=1,arguments.length<2&&(e=t,t=0)),(e-t)/r==1/0)throw new Error("infinite range");var n,i=[],a=function(t){var e=1;for(;t*e%1;)e*=10;return e}(y(r)),o=-1;if(t*=a,e*=a,(r*=a)<0)for(;(n=t+r*++o)>e;)i.push(n/a);else for(;(n=t+r*++o)=i.length)return r?r.call(n,a):e?a.sort(e):a;for(var l,u,c,h,f=-1,p=a.length,d=i[s++],g=new b;++f=i.length)return e;var n=[],o=a[r++];return e.forEach(function(e,i){n.push({key:e,values:t(i,r)})}),o?n.sort(function(t,e){return o(t.key,e.key)}):n}(o(t.map,e,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return a[i.length-1]=t,n},n.sortValues=function(t){return e=t,n},n.rollup=function(t){return r=t,n},n},t.set=function(t){var e=new L;if(t)for(var r=0,n=t.length;r=0&&(n=t.slice(r+1),t=t.slice(0,r)),t)return arguments.length<2?this[t].on(n):this[t].on(n,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(n,null);return this}},t.event=null,t.requote=function(t){return t.replace(V,"\\$&")};var V=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,U={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var r in e)t[r]=e[r]};function q(t){return U(t,Y),t}var H=function(t,e){return e.querySelector(t)},G=function(t,e){return e.querySelectorAll(t)},W=function(t,e){var r=t.matches||t[I(t,"matchesSelector")];return(W=function(t,e){return r.call(t,e)})(t,e)};"function"==typeof Sizzle&&(H=function(t,e){return Sizzle(t,e)[0]||null},G=Sizzle,W=Sizzle.matchesSelector),t.selection=function(){return t.select(i.documentElement)};var Y=t.selection.prototype=[];function X(t){return"function"==typeof t?t:function(){return H(t,this)}}function Z(t){return"function"==typeof t?t:function(){return G(t,this)}}Y.select=function(t){var e,r,n,i,a=[];t=X(t);for(var o=-1,s=this.length;++o=0&&"xmlns"!==(r=t.slice(0,e))&&(t=t.slice(e+1)),K.hasOwnProperty(r)?{space:K[r],local:t}:t}},Y.attr=function(e,r){if(arguments.length<2){if("string"==typeof e){var n=this.node();return(e=t.ns.qualify(e)).local?n.getAttributeNS(e.space,e.local):n.getAttribute(e)}for(r in e)this.each(Q(r,e[r]));return this}return this.each(Q(e,r))},Y.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var r=this.node(),n=(t=et(t)).length,i=-1;if(e=r.classList){for(;++i=0;)(r=n[i])&&(a&&a!==r.nextSibling&&a.parentNode.insertBefore(r,a),a=r);return this},Y.sort=function(t){t=function(t){arguments.length||(t=f);return function(e,r){return e&&r?t(e.__data__,r.__data__):!e-!r}}.apply(this,arguments);for(var e=-1,r=this.length;++e0&&(e=e.slice(0,o));var l=dt.get(e);function u(){var t=this[a];t&&(this.removeEventListener(e,t,t.$),delete this[a])}return l&&(e=l,s=vt),o?r?function(){var t=s(r,n(arguments));u.call(this),this.addEventListener(e,this[a]=t,t.$=i),t._=r}:u:r?O:function(){var r,n=new RegExp("^__on([^.]+)"+t.requote(e)+"$");for(var i in this)if(r=i.match(n)){var a=this[i];this.removeEventListener(r[1],a,a.$),delete this[i]}}}t.selection.enter=ht,t.selection.enter.prototype=ft,ft.append=Y.append,ft.empty=Y.empty,ft.node=Y.node,ft.call=Y.call,ft.size=Y.size,ft.select=function(t){for(var e,r,n,i,a,o=[],s=-1,l=this.length;++s=n&&(n=e+1);!(o=s[n])&&++n0?1:t<0?-1:0}function Pt(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}function It(t){return t>1?0:t<-1?kt:Math.acos(t)}function Dt(t){return t>1?Et:t<-1?-Et:Math.asin(t)}function Ot(t){return((t=Math.exp(t))+1/t)/2}function Rt(t){return(t=Math.sin(t/2))*t}var Ft=Math.SQRT2;t.interpolateZoom=function(t,e){var r,n,i=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-i,h=l-a,f=c*c+h*h;if(f0&&(e=e.transition().duration(g)),e.call(w.event)}function S(){u&&u.domain(l.range().map(function(t){return(t-f.x)/f.k}).map(l.invert)),h&&h.domain(c.range().map(function(t){return(t-f.y)/f.k}).map(c.invert))}function E(t){v++||t({type:"zoomstart"})}function C(t){S(),t({type:"zoom",scale:f.k,translate:[f.x,f.y]})}function L(t){--v||(t({type:"zoomend"}),r=null)}function z(){var e=this,r=_.of(e,arguments),n=0,i=t.select(o(e)).on(y,function(){n=1,k(t.mouse(e),a),C(r)}).on(x,function(){i.on(y,null).on(x,null),s(n),L(r)}),a=M(t.mouse(e)),s=xt(e);ss.call(e),E(r)}function P(){var e,r=this,n=_.of(r,arguments),i={},a=0,o=".zoom-"+t.event.changedTouches[0].identifier,l="touchmove"+o,u="touchend"+o,c=[],h=t.select(r),p=xt(r);function d(){var n=t.touches(r);return e=f.k,n.forEach(function(t){t.identifier in i&&(i[t.identifier]=M(t))}),n}function g(){var e=t.event.target;t.select(e).on(l,v).on(u,y),c.push(e);for(var n=t.event.changedTouches,o=0,h=n.length;o1){m=p[0];var x=p[1],b=m[0]-x[0],_=m[1]-x[1];a=b*b+_*_}}function v(){var o,l,u,c,h=t.touches(r);ss.call(r);for(var f=0,p=h.length;f360?t-=360:t<0&&(t+=360),t<60?n+(i-n)*t/60:t<180?i:t<240?n+(i-n)*(240-t)/60:n}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,n=2*(r=r<0?0:r>1?1:r)-(i=r<=.5?r*(1+e):r+e-r*e),new ae(a(t+120),a(t),a(t-120))}function Gt(e,r,n){return this instanceof Gt?(this.h=+e,this.c=+r,void(this.l=+n)):arguments.length<2?e instanceof Gt?new Gt(e.h,e.c,e.l):ee(e instanceof Xt?e.l:(e=fe((e=t.rgb(e)).r,e.g,e.b)).l,e.a,e.b):new Gt(e,r,n)}qt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,this.l/t)},qt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,t*this.l)},qt.rgb=function(){return Ht(this.h,this.s,this.l)},t.hcl=Gt;var Wt=Gt.prototype=new Vt;function Yt(t,e,r){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Xt(r,Math.cos(t*=Ct)*e,Math.sin(t)*e)}function Xt(t,e,r){return this instanceof Xt?(this.l=+t,this.a=+e,void(this.b=+r)):arguments.length<2?t instanceof Xt?new Xt(t.l,t.a,t.b):t instanceof Gt?Yt(t.h,t.c,t.l):fe((t=ae(t)).r,t.g,t.b):new Xt(t,e,r)}Wt.brighter=function(t){return new Gt(this.h,this.c,Math.min(100,this.l+Zt*(arguments.length?t:1)))},Wt.darker=function(t){return new Gt(this.h,this.c,Math.max(0,this.l-Zt*(arguments.length?t:1)))},Wt.rgb=function(){return Yt(this.h,this.c,this.l).rgb()},t.lab=Xt;var Zt=18,Jt=.95047,Kt=1,Qt=1.08883,$t=Xt.prototype=new Vt;function te(t,e,r){var n=(t+16)/116,i=n+e/500,a=n-r/200;return new ae(ie(3.2404542*(i=re(i)*Jt)-1.5371385*(n=re(n)*Kt)-.4985314*(a=re(a)*Qt)),ie(-.969266*i+1.8760108*n+.041556*a),ie(.0556434*i-.2040259*n+1.0572252*a))}function ee(t,e,r){return t>0?new Gt(Math.atan2(r,e)*Lt,Math.sqrt(e*e+r*r),t):new Gt(NaN,NaN,t)}function re(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function ne(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function ie(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function ae(t,e,r){return this instanceof ae?(this.r=~~t,this.g=~~e,void(this.b=~~r)):arguments.length<2?t instanceof ae?new ae(t.r,t.g,t.b):ce(""+t,ae,Ht):new ae(t,e,r)}function oe(t){return new ae(t>>16,t>>8&255,255&t)}function se(t){return oe(t)+""}$t.brighter=function(t){return new Xt(Math.min(100,this.l+Zt*(arguments.length?t:1)),this.a,this.b)},$t.darker=function(t){return new Xt(Math.max(0,this.l-Zt*(arguments.length?t:1)),this.a,this.b)},$t.rgb=function(){return te(this.l,this.a,this.b)},t.rgb=ae;var le=ae.prototype=new Vt;function ue(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function ce(t,e,r){var n,i,a,o=0,s=0,l=0;if(n=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(i=n[2].split(","),n[1]){case"hsl":return r(parseFloat(i[0]),parseFloat(i[1])/100,parseFloat(i[2])/100);case"rgb":return e(de(i[0]),de(i[1]),de(i[2]))}return(a=ge.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function he(t,e,r){var n,i,a=Math.min(t/=255,e/=255,r/=255),o=Math.max(t,e,r),s=o-a,l=(o+a)/2;return s?(i=l<.5?s/(o+a):s/(2-o-a),n=t==o?(e-r)/s+(e0&&l<1?0:n),new Ut(n,i,l)}function fe(t,e,r){var n=ne((.4124564*(t=pe(t))+.3575761*(e=pe(e))+.1804375*(r=pe(r)))/Jt),i=ne((.2126729*t+.7151522*e+.072175*r)/Kt);return Xt(116*i-16,500*(n-i),200*(i-ne((.0193339*t+.119192*e+.9503041*r)/Qt)))}function pe(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function de(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}le.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,r=this.g,n=this.b,i=30;return e||r||n?(e&&e=200&&e<300||304===e){try{t=i.call(o,u)}catch(t){return void s.error.call(o,t)}s.load.call(o,t)}else s.error.call(o,u)}return!this.XDomainRequest||"withCredentials"in u||!/^(http(s)?:)?\/\//.test(e)||(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=h:u.onreadystatechange=function(){u.readyState>3&&h()},u.onprogress=function(e){var r=t.event;t.event=e;try{s.progress.call(o,u)}finally{t.event=r}},o.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",o)},o.mimeType=function(t){return arguments.length?(r=null==t?null:t+"",o):r},o.responseType=function(t){return arguments.length?(c=t,o):c},o.response=function(t){return i=t,o},["get","post"].forEach(function(t){o[t]=function(){return o.send.apply(o,[t].concat(n(arguments)))}}),o.send=function(t,n,i){if(2===arguments.length&&"function"==typeof n&&(i=n,n=null),u.open(t,e,!0),null==r||"accept"in l||(l.accept=r+",*/*"),u.setRequestHeader)for(var a in l)u.setRequestHeader(a,l[a]);return null!=r&&u.overrideMimeType&&u.overrideMimeType(r),null!=c&&(u.responseType=c),null!=i&&o.on("error",i).on("load",function(t){i(null,t)}),s.beforesend.call(o,u),u.send(null==n?null:n),o},o.abort=function(){return u.abort(),o},t.rebind(o,s,"on"),null==a?o:o.get(function(t){return 1===t.length?function(e,r){t(null==e?r:null)}:t}(a))}ge.forEach(function(t,e){ge.set(t,oe(e))}),t.functor=ve,t.xhr=me(z),t.dsv=function(t,e){var r=new RegExp('["'+t+"\n]"),n=t.charCodeAt(0);function i(t,r,n){arguments.length<3&&(n=r,r=null);var i=ye(t,e,null==r?a:o(r),n);return i.row=function(t){return arguments.length?i.response(null==(r=t)?a:o(t)):r},i}function a(t){return i.parse(t.responseText)}function o(t){return function(e){return i.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return r.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return i.parse=function(t,e){var r;return i.parseRows(t,function(t,n){if(r)return r(t,n-1);var i=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");r=e?function(t,r){return e(i(t),r)}:i})},i.parseRows=function(t,e){var r,i,a={},o={},s=[],l=t.length,u=0,c=0;function h(){if(u>=l)return o;if(i)return i=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var r=e;r++24?(isFinite(e)&&(clearTimeout(we),we=setTimeout(ke,e)),_e=0):(_e=1,Me(ke))}function Te(){for(var t=Date.now(),e=xe;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Se(){for(var t,e=xe,r=1/0;e;)e.c?(e.t8?function(t){return t/r}:function(t){return t*r},symbol:t}});t.formatPrefix=function(e,r){var n=0;return(e=+e)&&(e<0&&(e*=-1),r&&(e=t.round(e,Ee(e,r))),n=1+Math.floor(1e-12+Math.log(e)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Ce[8+n/3]};var Le=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,ze=t.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(e,r){return(e=t.round(e,Ee(e,r))).toFixed(Math.max(0,Math.min(20,Ee(e*(1+1e-15),r))))}});function Pe(t){return t+""}var Ie=t.time={},De=Date;function Oe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Oe.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Re.setUTCDate.apply(this._,arguments)},setDay:function(){Re.setUTCDay.apply(this._,arguments)},setFullYear:function(){Re.setUTCFullYear.apply(this._,arguments)},setHours:function(){Re.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Re.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Re.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Re.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Re.setUTCSeconds.apply(this._,arguments)},setTime:function(){Re.setTime.apply(this._,arguments)}};var Re=Date.prototype;function Fe(t,e,r){function n(e){var r=t(e),n=a(r,1);return e-r1)for(;o68?1900:2e3),r+i[0].length):-1}function Je(t,e,r){return/^[+-]\d{4}$/.test(e=e.slice(r,r+5))?(t.Z=-e,r+5):-1}function Ke(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.m=n[0]-1,r+n[0].length):-1}function Qe(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.d=+n[0],r+n[0].length):-1}function $e(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.j=+n[0],r+n[0].length):-1}function tr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.H=+n[0],r+n[0].length):-1}function er(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.M=+n[0],r+n[0].length):-1}function rr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+2));return n?(t.S=+n[0],r+n[0].length):-1}function nr(t,e,r){je.lastIndex=0;var n=je.exec(e.slice(r,r+3));return n?(t.L=+n[0],r+n[0].length):-1}function ir(t){var e=t.getTimezoneOffset(),r=e>0?"-":"+",n=y(e)/60|0,i=y(e)%60;return r+Ue(n,"0",2)+Ue(i,"0",2)}function ar(t,e,r){Ve.lastIndex=0;var n=Ve.exec(e.slice(r,r+1));return n?r+n[0].length:-1}function or(t){for(var e=t.length,r=-1;++r0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:z;return function(e){var n=Le.exec(e),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],h=+n[6],f=n[7],p=n[8],d=n[9],g=1,v="",m="",y=!1,x=!0;switch(p&&(p=+p.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),d){case"n":f=!0,d="g";break;case"%":g=100,m="%",d="f";break;case"p":g=100,m="%",d="r";break;case"b":case"o":case"x":case"X":"#"===u&&(v="0"+d.toLowerCase());case"c":x=!1;case"d":y=!0,p=0;break;case"s":g=-1,d="r"}"$"===u&&(v=a[0],m=a[1]),"r"!=d||p||(d="g"),null!=p&&("g"==d?p=Math.max(1,Math.min(21,p)):"e"!=d&&"f"!=d||(p=Math.max(0,Math.min(20,p)))),d=ze.get(d)||Pe;var b=c&&f;return function(e){var n=m;if(y&&e%1)return"";var a=e<0||0===e&&1/e<0?(e=-e,"-"):"-"===l?"":l;if(g<0){var u=t.formatPrefix(e,p);e=u.scale(e),n=u.symbol+m}else e*=g;var _,w,M=(e=d(e,p)).lastIndexOf(".");if(M<0){var A=x?e.lastIndexOf("e"):-1;A<0?(_=e,w=""):(_=e.substring(0,A),w=e.substring(A))}else _=e.substring(0,M),w=r+e.substring(M+1);!c&&f&&(_=o(_,1/0));var k=v.length+_.length+w.length+(b?0:a.length),T=k"===s?T+a+e:"^"===s?T.substring(0,k>>=1)+a+e+T.substring(k):a+(b?e:T+e))+n}}}(e),timeFormat:function(e){var r=e.dateTime,n=e.date,i=e.time,a=e.periods,o=e.days,s=e.shortDays,l=e.months,u=e.shortMonths;function c(t){var e=t.length;function r(r){for(var n,i,a,o=[],s=-1,l=0;++s=u)return-1;if(37===(i=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=w[o in Ne?e.charAt(s++):o])||(n=a(t,r,n))<0)return-1}else if(i!=r.charCodeAt(n++))return-1}return n}c.utc=function(t){var e=c(t);function r(t){try{var r=new(De=Oe);return r._=t,e(r)}finally{De=Date}}return r.parse=function(t){try{De=Oe;var r=e.parse(t);return r&&r._}finally{De=Date}},r.toString=e.toString,r},c.multi=c.utc.multi=or;var f=t.map(),p=qe(o),d=He(o),g=qe(s),v=He(s),m=qe(l),y=He(l),x=qe(u),b=He(u);a.forEach(function(t,e){f.set(t.toLowerCase(),e)});var _={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:c(r),d:function(t,e){return Ue(t.getDate(),e,2)},e:function(t,e){return Ue(t.getDate(),e,2)},H:function(t,e){return Ue(t.getHours(),e,2)},I:function(t,e){return Ue(t.getHours()%12||12,e,2)},j:function(t,e){return Ue(1+Ie.dayOfYear(t),e,3)},L:function(t,e){return Ue(t.getMilliseconds(),e,3)},m:function(t,e){return Ue(t.getMonth()+1,e,2)},M:function(t,e){return Ue(t.getMinutes(),e,2)},p:function(t){return a[+(t.getHours()>=12)]},S:function(t,e){return Ue(t.getSeconds(),e,2)},U:function(t,e){return Ue(Ie.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ue(Ie.mondayOfYear(t),e,2)},x:c(n),X:c(i),y:function(t,e){return Ue(t.getFullYear()%100,e,2)},Y:function(t,e){return Ue(t.getFullYear()%1e4,e,4)},Z:ir,"%":function(){return"%"}},w={a:function(t,e,r){g.lastIndex=0;var n=g.exec(e.slice(r));return n?(t.w=v.get(n[0].toLowerCase()),r+n[0].length):-1},A:function(t,e,r){p.lastIndex=0;var n=p.exec(e.slice(r));return n?(t.w=d.get(n[0].toLowerCase()),r+n[0].length):-1},b:function(t,e,r){x.lastIndex=0;var n=x.exec(e.slice(r));return n?(t.m=b.get(n[0].toLowerCase()),r+n[0].length):-1},B:function(t,e,r){m.lastIndex=0;var n=m.exec(e.slice(r));return n?(t.m=y.get(n[0].toLowerCase()),r+n[0].length):-1},c:function(t,e,r){return h(t,_.c.toString(),e,r)},d:Qe,e:Qe,H:tr,I:tr,j:$e,L:nr,m:Ke,M:er,p:function(t,e,r){var n=f.get(e.slice(r,r+=2).toLowerCase());return null==n?-1:(t.p=n,r)},S:rr,U:We,w:Ge,W:Ye,x:function(t,e,r){return h(t,_.x.toString(),e,r)},X:function(t,e,r){return h(t,_.X.toString(),e,r)},y:Ze,Y:Xe,Z:Je,"%":ar};return c}(e)}};var sr=t.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function lr(){}t.format=sr.numberFormat,t.geo={},lr.prototype={s:0,t:0,add:function(t){cr(t,this.t,ur),cr(ur.s,this.s,this),this.s?this.t+=ur.t:this.s=ur.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var ur=new lr;function cr(t,e,r){var n=r.s=t+e,i=n-t,a=n-i;r.t=t-a+(e-i)}function hr(t,e){t&&pr.hasOwnProperty(t.type)&&pr[t.type](t,e)}t.geo.stream=function(t,e){t&&fr.hasOwnProperty(t.type)?fr[t.type](t,e):hr(t,e)};var fr={Feature:function(t,e){hr(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,n=-1,i=r.length;++n=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=i*u,h=n*l+c*Math.cos(s),f=c*o*Math.sin(s);Er.add(Math.atan2(f,h)),r=t,n=l,i=u}Cr.point=function(o,s){Cr.point=a,r=(t=o)*Ct,n=Math.cos(s=(e=s)*Ct/2+kt/4),i=Math.sin(s)},Cr.lineEnd=function(){a(t,e)}}function zr(t){var e=t[0],r=t[1],n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}function Pr(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Ir(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Dr(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Or(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Rr(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Fr(t){return[Math.atan2(t[1],t[0]),Dt(t[2])]}function Br(t,e){return y(t[0]-e[0])Mt?i=90:u<-Mt&&(r=-90),h[0]=e,h[1]=n}};function p(t,a){c.push(h=[e=t,n=t]),ai&&(i=a)}function d(t,o){var s=zr([t*Ct,o*Ct]);if(l){var u=Ir(l,s),c=Ir([u[1],-u[0],0],u);Rr(c),c=Fr(c);var h=t-a,f=h>0?1:-1,d=c[0]*Lt*f,g=y(h)>180;if(g^(f*ai&&(i=v);else if(g^(f*a<(d=(d+360)%360-180)&&di&&(i=o);g?t_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t):n>=e?(tn&&(n=t)):t>a?_(e,t)>_(e,n)&&(n=t):_(t,n)>_(e,n)&&(e=t)}else p(t,o);l=s,a=t}function g(){f.point=d}function v(){h[0]=e,h[1]=n,f.point=p,l=null}function m(t,e){if(l){var r=t-a;u+=y(r)>180?r+(r>0?360:-360):r}else o=t,s=e;Cr.point(t,e),d(t,e)}function x(){Cr.lineStart()}function b(){m(o,s),Cr.lineEnd(),y(u)>Mt&&(e=-(n=180)),h[0]=e,h[1]=n,l=null}function _(t,e){return(e-=t)<0?e+360:e}function w(t,e){return t[0]-e[0]}function M(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t_(g[0],g[1])&&(g[1]=p[1]),_(p[0],g[1])>_(g[0],g[1])&&(g[0]=p[0])):s.push(g=p);for(var l,u,p,d=-1/0,g=(o=0,s[u=s.length-1]);o<=u;g=p,++o)p=s[o],(l=_(g[1],p[0]))>d&&(d=l,e=p[0],n=g[1])}return c=h=null,e===1/0||r===1/0?[[NaN,NaN],[NaN,NaN]]:[[e,r],[n,i]]}}(),t.geo.centroid=function(e){mr=yr=xr=br=_r=wr=Mr=Ar=kr=Tr=Sr=0,t.geo.stream(e,Nr);var r=kr,n=Tr,i=Sr,a=r*r+n*n+i*i;return a=0;--s)i.point((h=c[s])[0],h[1]);else n(p.x,p.p.x,-1,i);p=p.p}c=(p=p.o).z,d=!d}while(!p.v);i.lineEnd()}}}function Xr(t){if(e=t.length){for(var e,r,n=0,i=t[0];++n=0?1:-1,M=w*_,A=M>kt,k=d*x;if(Er.add(Math.atan2(k*w*Math.sin(M),g*b+k*Math.cos(M))),a+=A?_+w*Tt:_,A^f>=r^m>=r){var T=Ir(zr(h),zr(t));Rr(T);var S=Ir(i,T);Rr(S);var E=(A^_>=0?-1:1)*Dt(S[2]);(n>E||n===E&&(T[0]||T[1]))&&(o+=A^_>=0?1:-1)}if(!v++)break;f=m,d=x,g=b,h=t}}return(a<-Mt||a0){for(x||(o.polygonStart(),x=!0),o.lineStart();++a1&&2&e&&r.push(r.pop().concat(r.shift())),s.push(r.filter(Kr))}return c}}function Kr(t){return t.length>1}function Qr(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,r){t.push([e,r])},lineEnd:O,buffer:function(){var r=e;return e=[],t=null,r},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function $r(t,e){return((t=t.x)[0]<0?t[1]-Et-Mt:Et-t[1])-((e=e.x)[0]<0?e[1]-Et-Mt:Et-e[1])}var tn=Jr(Wr,function(t){var e,r=NaN,n=NaN,i=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?kt:-kt,l=y(a-r);y(l-kt)0?Et:-Et),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),e=0):i!==s&&l>=kt&&(y(r-i)Mt?Math.atan((Math.sin(e)*(a=Math.cos(n))*Math.sin(r)-Math.sin(n)*(i=Math.cos(e))*Math.sin(t))/(i*a*o)):(e+n)/2}(r,n,a,o),t.point(i,n),t.lineEnd(),t.lineStart(),t.point(s,n),e=0),t.point(r=a,n=o),i=s},lineEnd:function(){t.lineEnd(),r=n=NaN},clean:function(){return 2-e}}},function(t,e,r,n){var i;if(null==t)i=r*Et,n.point(-kt,i),n.point(0,i),n.point(kt,i),n.point(kt,0),n.point(kt,-i),n.point(0,-i),n.point(-kt,-i),n.point(-kt,0),n.point(-kt,i);else if(y(t[0]-e[0])>Mt){var a=t[0]0)){if(a/=f,f<0){if(a0){if(a>h)return;a>c&&(c=a)}if(a=r-l,f||!(a<0)){if(a/=f,f<0){if(a>h)return;a>c&&(c=a)}else if(f>0){if(a0)){if(a/=p,p<0){if(a0){if(a>h)return;a>c&&(c=a)}if(a=n-u,p||!(a<0)){if(a/=p,p<0){if(a>h)return;a>c&&(c=a)}else if(p>0){if(a0&&(i.a={x:l+c*f,y:u+c*p}),h<1&&(i.b={x:l+h*f,y:u+h*p}),i}}}}}}var rn=1e9;function nn(e,r,n,i){return function(l){var u,c,h,f,p,d,g,v,m,y,x,b=l,_=Qr(),w=en(e,r,n,i),M={point:T,lineStart:function(){M.point=S,c&&c.push(h=[]);y=!0,m=!1,g=v=NaN},lineEnd:function(){u&&(S(f,p),d&&m&&_.rejoin(),u.push(_.buffer()));M.point=T,m&&l.lineEnd()},polygonStart:function(){l=_,u=[],c=[],x=!0},polygonEnd:function(){l=b,u=t.merge(u);var r=function(t){for(var e=0,r=c.length,n=t[1],i=0;in&&Pt(u,a,t)>0&&++e:a[1]<=n&&Pt(u,a,t)<0&&--e,u=a;return 0!==e}([e,i]),n=x&&r,a=u.length;(n||a)&&(l.polygonStart(),n&&(l.lineStart(),A(null,null,1,l),l.lineEnd()),a&&Yr(u,o,r,A,l),l.polygonEnd()),u=c=h=null}};function A(t,o,l,u){var c=0,h=0;if(null==t||(c=a(t,l))!==(h=a(o,l))||s(t,o)<0^l>0)do{u.point(0===c||3===c?e:n,c>1?i:r)}while((c=(c+l+4)%4)!==h);else u.point(o[0],o[1])}function k(t,a){return e<=t&&t<=n&&r<=a&&a<=i}function T(t,e){k(t,e)&&l.point(t,e)}function S(t,e){var r=k(t=Math.max(-rn,Math.min(rn,t)),e=Math.max(-rn,Math.min(rn,e)));if(c&&h.push([t,e]),y)f=t,p=e,d=r,y=!1,r&&(l.lineStart(),l.point(t,e));else if(r&&m)l.point(t,e);else{var n={a:{x:g,y:v},b:{x:t,y:e}};w(n)?(m||(l.lineStart(),l.point(n.a.x,n.a.y)),l.point(n.b.x,n.b.y),r||l.lineEnd(),x=!1):r&&(l.lineStart(),l.point(t,e),x=!1)}g=t,v=e,m=r}return M};function a(t,i){return y(t[0]-e)0?0:3:y(t[0]-n)0?2:1:y(t[1]-r)0?1:0:i>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var r=a(t,1),n=a(e,1);return r!==n?r-n:0===r?e[1]-t[1]:1===r?t[0]-e[0]:2===r?t[1]-e[1]:e[0]-t[0]}}function an(t){var e=0,r=kt/3,n=Sn(t),i=n(e,r);return i.parallels=function(t){return arguments.length?n(e=t[0]*kt/180,r=t[1]*kt/180):[e/kt*180,r/kt*180]},i}function on(t,e){var r=Math.sin(t),n=(r+Math.sin(e))/2,i=1+r*(2*n-r),a=Math.sqrt(i)/n;function o(t,e){var r=Math.sqrt(i-2*n*Math.sin(e))/n;return[r*Math.sin(t*=n),a-r*Math.cos(t)]}return o.invert=function(t,e){var r=a-e;return[Math.atan2(t,r)/n,Dt((i-(t*t+r*r)*n*n)/(2*n))]},o}t.geo.clipExtent=function(){var t,e,r,n,i,a,o={stream:function(t){return i&&(i.valid=!1),(i=a(t)).valid=!0,i},extent:function(s){return arguments.length?(a=nn(t=+s[0][0],e=+s[0][1],r=+s[1][0],n=+s[1][1]),i&&(i.valid=!1,i=null),o):[[t,e],[r,n]]}};return o.extent([[0,0],[960,500]])},(t.geo.conicEqualArea=function(){return an(on)}).raw=on,t.geo.albers=function(){return t.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},t.geo.albersUsa=function(){var e,r,n,i,a=t.geo.albers(),o=t.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=t.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(t,r){e=[t,r]}};function u(t){var a=t[0],o=t[1];return e=null,r(a,o),e||(n(a,o),e)||i(a,o),e}return u.invert=function(t){var e=a.scale(),r=a.translate(),n=(t[0]-r[0])/e,i=(t[1]-r[1])/e;return(i>=.12&&i<.234&&n>=-.425&&n<-.214?o:i>=.166&&i<.234&&n>=-.214&&n<-.115?s:a).invert(t)},u.stream=function(t){var e=a.stream(t),r=o.stream(t),n=s.stream(t);return{point:function(t,i){e.point(t,i),r.point(t,i),n.point(t,i)},sphere:function(){e.sphere(),r.sphere(),n.sphere()},lineStart:function(){e.lineStart(),r.lineStart(),n.lineStart()},lineEnd:function(){e.lineEnd(),r.lineEnd(),n.lineEnd()},polygonStart:function(){e.polygonStart(),r.polygonStart(),n.polygonStart()},polygonEnd:function(){e.polygonEnd(),r.polygonEnd(),n.polygonEnd()}}},u.precision=function(t){return arguments.length?(a.precision(t),o.precision(t),s.precision(t),u):a.precision()},u.scale=function(t){return arguments.length?(a.scale(t),o.scale(.35*t),s.scale(t),u.translate(a.translate())):a.scale()},u.translate=function(t){if(!arguments.length)return a.translate();var e=a.scale(),c=+t[0],h=+t[1];return r=a.translate(t).clipExtent([[c-.455*e,h-.238*e],[c+.455*e,h+.238*e]]).stream(l).point,n=o.translate([c-.307*e,h+.201*e]).clipExtent([[c-.425*e+Mt,h+.12*e+Mt],[c-.214*e-Mt,h+.234*e-Mt]]).stream(l).point,i=s.translate([c-.205*e,h+.212*e]).clipExtent([[c-.214*e+Mt,h+.166*e+Mt],[c-.115*e-Mt,h+.234*e-Mt]]).stream(l).point,u},u.scale(1070)};var sn,ln,un,cn,hn,fn,pn={point:O,lineStart:O,lineEnd:O,polygonStart:function(){ln=0,pn.lineStart=dn},polygonEnd:function(){pn.lineStart=pn.lineEnd=pn.point=O,sn+=y(ln/2)}};function dn(){var t,e,r,n;function i(t,e){ln+=n*t-r*e,r=t,n=e}pn.point=function(a,o){pn.point=i,t=r=a,e=n=o},pn.lineEnd=function(){i(t,e)}}var gn={point:function(t,e){thn&&(hn=t);efn&&(fn=e)},lineStart:O,lineEnd:O,polygonStart:O,polygonEnd:O};function vn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var mn,yn={point:xn,lineStart:bn,lineEnd:_n,polygonStart:function(){yn.lineStart=wn},polygonEnd:function(){yn.point=xn,yn.lineStart=bn,yn.lineEnd=_n}};function xn(t,e){xr+=t,br+=e,++_r}function bn(){var t,e;function r(r,n){var i=r-t,a=n-e,o=Math.sqrt(i*i+a*a);wr+=o*(t+r)/2,Mr+=o*(e+n)/2,Ar+=o,xn(t=r,e=n)}yn.point=function(n,i){yn.point=r,xn(t=n,e=i)}}function _n(){yn.point=xn}function wn(){var t,e,r,n;function i(t,e){var i=t-r,a=e-n,o=Math.sqrt(i*i+a*a);wr+=o*(r+t)/2,Mr+=o*(n+e)/2,Ar+=o,kr+=(o=n*t-r*e)*(r+t),Tr+=o*(n+e),Sr+=3*o,xn(r=t,n=e)}yn.point=function(a,o){yn.point=i,xn(t=r=a,e=n=o)},yn.lineEnd=function(){i(t,e)}}function Mn(t){var e=.5,r=Math.cos(30*Ct),n=16;function i(e){return(n?function(e){var r,i,o,s,l,u,c,h,f,p,d,g,v={point:m,lineStart:y,lineEnd:b,polygonStart:function(){e.polygonStart(),v.lineStart=_},polygonEnd:function(){e.polygonEnd(),v.lineStart=y}};function m(r,n){r=t(r,n),e.point(r[0],r[1])}function y(){h=NaN,v.point=x,e.lineStart()}function x(r,i){var o=zr([r,i]),s=t(r,i);a(h,f,c,p,d,g,h=s[0],f=s[1],c=r,p=o[0],d=o[1],g=o[2],n,e),e.point(h,f)}function b(){v.point=m,e.lineEnd()}function _(){y(),v.point=w,v.lineEnd=M}function w(t,e){x(r=t,e),i=h,o=f,s=p,l=d,u=g,v.point=x}function M(){a(h,f,c,p,d,g,i,o,r,s,l,u,n,e),v.lineEnd=b,b()}return v}:function(e){return kn(e,function(r,n){r=t(r,n),e.point(r[0],r[1])})})(e)}function a(n,i,o,s,l,u,c,h,f,p,d,g,v,m){var x=c-n,b=h-i,_=x*x+b*b;if(_>4*e&&v--){var w=s+p,M=l+d,A=u+g,k=Math.sqrt(w*w+M*M+A*A),T=Math.asin(A/=k),S=y(y(A)-1)e||y((x*z+b*P)/_-.5)>.3||s*p+l*d+u*g0&&16,i):Math.sqrt(e)},i}function An(t){this.stream=t}function kn(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 Tn(t){return Sn(function(){return t})()}function Sn(e){var r,n,i,a,o,s,l=Mn(function(t,e){return[(t=r(t,e))[0]*u+a,o-t[1]*u]}),u=150,c=480,h=250,f=0,p=0,d=0,g=0,v=0,m=tn,x=z,b=null,_=null;function w(t){return[(t=i(t[0]*Ct,t[1]*Ct))[0]*u+a,o-t[1]*u]}function M(t){return(t=i.invert((t[0]-a)/u,(o-t[1])/u))&&[t[0]*Lt,t[1]*Lt]}function A(){i=Gr(n=zn(d,g,v),r);var t=r(f,p);return a=c-t[0]*u,o=h+t[1]*u,k()}function k(){return s&&(s.valid=!1,s=null),w}return w.stream=function(t){return s&&(s.valid=!1),(s=En(m(n,l(x(t))))).valid=!0,s},w.clipAngle=function(t){return arguments.length?(m=null==t?(b=t,tn):function(t){var e=Math.cos(t),r=e>0,n=y(e)>Mt;return Jr(i,function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(h,f){var p,d=[h,f],g=i(h,f),v=r?g?0:o(h,f):g?o(h+(h<0?kt:-kt),f):0;if(!e&&(u=l=g)&&t.lineStart(),g!==l&&(p=a(e,d),(Br(e,p)||Br(d,p))&&(d[0]+=Mt,d[1]+=Mt,g=i(d[0],d[1]))),g!==l)c=0,g?(t.lineStart(),p=a(d,e),t.point(p[0],p[1])):(p=a(e,d),t.point(p[0],p[1]),t.lineEnd()),e=p;else if(n&&e&&r^g){var m;v&s||!(m=a(d,e,!0))||(c=0,r?(t.lineStart(),t.point(m[0][0],m[0][1]),t.point(m[1][0],m[1][1]),t.lineEnd()):(t.point(m[1][0],m[1][1]),t.lineEnd(),t.lineStart(),t.point(m[0][0],m[0][1])))}!g||e&&Br(e,d)||t.point(d[0],d[1]),e=d,l=g,s=v},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}},On(t,6*Ct),r?[0,-t]:[-kt,t-kt]);function i(t,r){return Math.cos(t)*Math.cos(r)>e}function a(t,r,n){var i=[1,0,0],a=Ir(zr(t),zr(r)),o=Pr(a,a),s=a[0],l=o-s*s;if(!l)return!n&&t;var u=e*o/l,c=-e*s/l,h=Ir(i,a),f=Or(i,u);Dr(f,Or(a,c));var p=h,d=Pr(f,p),g=Pr(p,p),v=d*d-g*(Pr(f,f)-1);if(!(v<0)){var m=Math.sqrt(v),x=Or(p,(-d-m)/g);if(Dr(x,f),x=Fr(x),!n)return x;var b,_=t[0],w=r[0],M=t[1],A=r[1];w<_&&(b=_,_=w,w=b);var k=w-_,T=y(k-kt)0^x[1]<(y(x[0]-_)kt^(_<=x[0]&&x[0]<=w)){var S=Or(p,(-d+m)/g);return Dr(S,f),[x,Fr(S)]}}}function o(e,n){var i=r?t:kt-t,a=0;return e<-i?a|=1:e>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}}((b=+t)*Ct),k()):b},w.clipExtent=function(t){return arguments.length?(_=t,x=t?nn(t[0][0],t[0][1],t[1][0],t[1][1]):z,k()):_},w.scale=function(t){return arguments.length?(u=+t,A()):u},w.translate=function(t){return arguments.length?(c=+t[0],h=+t[1],A()):[c,h]},w.center=function(t){return arguments.length?(f=t[0]%360*Ct,p=t[1]%360*Ct,A()):[f*Lt,p*Lt]},w.rotate=function(t){return arguments.length?(d=t[0]%360*Ct,g=t[1]%360*Ct,v=t.length>2?t[2]%360*Ct:0,A()):[d*Lt,g*Lt,v*Lt]},t.rebind(w,l,"precision"),function(){return r=e.apply(this,arguments),w.invert=r.invert&&M,A()}}function En(t){return kn(t,function(e,r){t.point(e*Ct,r*Ct)})}function Cn(t,e){return[t,e]}function Ln(t,e){return[t>kt?t-Tt:t<-kt?t+Tt:t,e]}function zn(t,e,r){return t?e||r?Gr(In(t),Dn(e,r)):In(t):e||r?Dn(e,r):Ln}function Pn(t){return function(e,r){return[(e+=t)>kt?e-Tt:e<-kt?e+Tt:e,r]}}function In(t){var e=Pn(t);return e.invert=Pn(-t),e}function Dn(t,e){var r=Math.cos(t),n=Math.sin(t),i=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*r+s*n;return[Math.atan2(l*i-c*a,s*r-u*n),Dt(c*i+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*i-l*a;return[Math.atan2(l*i+u*a,s*r+c*n),Dt(c*r-s*n)]},o}function On(t,e){var r=Math.cos(t),n=Math.sin(t);return function(i,a,o,s){var l=o*e;null!=i?(i=Rn(r,i),a=Rn(r,a),(o>0?ia)&&(i+=o*Tt)):(i=t+o*Tt,a=t-.5*l);for(var u,c=i;o>0?c>a:c2?t[2]*Ct:0),e.invert=function(e){return(e=t.invert(e[0]*Ct,e[1]*Ct))[0]*=Lt,e[1]*=Lt,e},e},Ln.invert=Cn,t.geo.circle=function(){var t,e,r=[0,0],n=6;function i(){var t="function"==typeof r?r.apply(this,arguments):r,n=zn(-t[0]*Ct,-t[1]*Ct,0).invert,i=[];return e(null,null,1,{point:function(t,e){i.push(t=n(t,e)),t[0]*=Lt,t[1]*=Lt}}),{type:"Polygon",coordinates:[i]}}return i.origin=function(t){return arguments.length?(r=t,i):r},i.angle=function(r){return arguments.length?(e=On((t=+r)*Ct,n*Ct),i):t},i.precision=function(r){return arguments.length?(e=On(t*Ct,(n=+r)*Ct),i):n},i.angle(90)},t.geo.distance=function(t,e){var r,n=(e[0]-t[0])*Ct,i=t[1]*Ct,a=e[1]*Ct,o=Math.sin(n),s=Math.cos(n),l=Math.sin(i),u=Math.cos(i),c=Math.sin(a),h=Math.cos(a);return Math.atan2(Math.sqrt((r=h*o)*r+(r=u*c-l*h*s)*r),l*c+u*h*s)},t.geo.graticule=function(){var e,r,n,i,a,o,s,l,u,c,h,f,p=10,d=p,g=90,v=360,m=2.5;function x(){return{type:"MultiLineString",coordinates:b()}}function b(){return t.range(Math.ceil(i/g)*g,n,g).map(h).concat(t.range(Math.ceil(l/v)*v,s,v).map(f)).concat(t.range(Math.ceil(r/p)*p,e,p).filter(function(t){return y(t%g)>Mt}).map(u)).concat(t.range(Math.ceil(o/d)*d,a,d).filter(function(t){return y(t%v)>Mt}).map(c))}return x.lines=function(){return b().map(function(t){return{type:"LineString",coordinates:t}})},x.outline=function(){return{type:"Polygon",coordinates:[h(i).concat(f(s).slice(1),h(n).reverse().slice(1),f(l).reverse().slice(1))]}},x.extent=function(t){return arguments.length?x.majorExtent(t).minorExtent(t):x.minorExtent()},x.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),x.precision(m)):[[i,l],[n,s]]},x.minorExtent=function(t){return arguments.length?(r=+t[0][0],e=+t[1][0],o=+t[0][1],a=+t[1][1],r>e&&(t=r,r=e,e=t),o>a&&(t=o,o=a,a=t),x.precision(m)):[[r,o],[e,a]]},x.step=function(t){return arguments.length?x.majorStep(t).minorStep(t):x.minorStep()},x.majorStep=function(t){return arguments.length?(g=+t[0],v=+t[1],x):[g,v]},x.minorStep=function(t){return arguments.length?(p=+t[0],d=+t[1],x):[p,d]},x.precision=function(t){return arguments.length?(m=+t,u=Fn(o,a,90),c=Bn(r,e,m),h=Fn(l,s,90),f=Bn(i,n,m),x):m},x.majorExtent([[-180,-90+Mt],[180,90-Mt]]).minorExtent([[-180,-80-Mt],[180,80+Mt]])},t.geo.greatArc=function(){var e,r,n=Nn,i=jn;function a(){return{type:"LineString",coordinates:[e||n.apply(this,arguments),r||i.apply(this,arguments)]}}return a.distance=function(){return t.geo.distance(e||n.apply(this,arguments),r||i.apply(this,arguments))},a.source=function(t){return arguments.length?(n=t,e="function"==typeof t?null:t,a):n},a.target=function(t){return arguments.length?(i=t,r="function"==typeof t?null:t,a):i},a.precision=function(){return arguments.length?a:0},a},t.geo.interpolate=function(t,e){return r=t[0]*Ct,n=t[1]*Ct,i=e[0]*Ct,a=e[1]*Ct,o=Math.cos(n),s=Math.sin(n),l=Math.cos(a),u=Math.sin(a),c=o*Math.cos(r),h=o*Math.sin(r),f=l*Math.cos(i),p=l*Math.sin(i),d=2*Math.asin(Math.sqrt(Rt(a-n)+o*l*Rt(i-r))),g=1/Math.sin(d),(v=d?function(t){var e=Math.sin(t*=d)*g,r=Math.sin(d-t)*g,n=r*c+e*f,i=r*h+e*p,a=r*s+e*u;return[Math.atan2(i,n)*Lt,Math.atan2(a,Math.sqrt(n*n+i*i))*Lt]}:function(){return[r*Lt,n*Lt]}).distance=d,v;var r,n,i,a,o,s,l,u,c,h,f,p,d,g,v},t.geo.length=function(e){return mn=0,t.geo.stream(e,Vn),mn};var Vn={sphere:O,point:O,lineStart:function(){var t,e,r;function n(n,i){var a=Math.sin(i*=Ct),o=Math.cos(i),s=y((n*=Ct)-t),l=Math.cos(s);mn+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=r*a-e*o*l)*s),e*a+r*o*l),t=n,e=a,r=o}Vn.point=function(i,a){t=i*Ct,e=Math.sin(a*=Ct),r=Math.cos(a),Vn.point=n},Vn.lineEnd=function(){Vn.point=Vn.lineEnd=O}},lineEnd:O,polygonStart:O,polygonEnd:O};function Un(t,e){function r(e,r){var n=Math.cos(e),i=Math.cos(r),a=t(n*i);return[a*i*Math.sin(e),a*Math.sin(r)]}return r.invert=function(t,r){var n=Math.sqrt(t*t+r*r),i=e(n),a=Math.sin(i),o=Math.cos(i);return[Math.atan2(t*a,n*o),Math.asin(n&&r*a/n)]},r}var qn=Un(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(t.geo.azimuthalEqualArea=function(){return Tn(qn)}).raw=qn;var Hn=Un(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},z);function Gn(t,e){var r=Math.cos(t),n=function(t){return Math.tan(kt/4+t/2)},i=t===e?Math.sin(t):Math.log(r/Math.cos(e))/Math.log(n(e)/n(t)),a=r*Math.pow(n(t),i)/i;if(!i)return Xn;function o(t,e){a>0?e<-Et+Mt&&(e=-Et+Mt):e>Et-Mt&&(e=Et-Mt);var r=a/Math.pow(n(e),i);return[r*Math.sin(i*t),a-r*Math.cos(i*t)]}return o.invert=function(t,e){var r=a-e,n=zt(i)*Math.sqrt(t*t+r*r);return[Math.atan2(t,r)/i,2*Math.atan(Math.pow(a/n,1/i))-Et]},o}function Wn(t,e){var r=Math.cos(t),n=t===e?Math.sin(t):(r-Math.cos(e))/(e-t),i=r/n+t;if(y(n)1&&Pt(t[r[n-2]],t[r[n-1]],t[i])<=0;)--n;r[n++]=i}return r.slice(0,n)}function ri(t,e){return t[0]-e[0]||t[1]-e[1]}(t.geo.stereographic=function(){return Tn(Kn)}).raw=Kn,Qn.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Et]},(t.geo.transverseMercator=function(){var t=Zn(Qn),e=t.center,r=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?r([t[0],t[1],t.length>2?t[2]+90:90]):[(t=r())[0],t[1],t[2]-90]},r([0,0,90])}).raw=Qn,t.geom={},t.geom.hull=function(t){var e=$n,r=ti;if(arguments.length)return n(t);function n(t){if(t.length<3)return[];var n,i=ve(e),a=ve(r),o=t.length,s=[],l=[];for(n=0;n=0;--n)p.push(t[s[u[n]][2]]);for(n=+h;nMt)s=s.L;else{if(!((i=a-xi(s,o))>Mt)){n>-Mt?(e=s.P,r=s):i>-Mt?(e=s,r=s.N):e=r=s;break}if(!s.R){e=s;break}s=s.R}var l=di(t);if(ui.insert(e,l),e||r){if(e===r)return Mi(e),r=di(e.site),ui.insert(l,r),l.edge=r.edge=Ti(e.site,l.site),wi(e),void wi(r);if(r){Mi(e),Mi(r);var u=e.site,c=u.x,h=u.y,f=t.x-c,p=t.y-h,d=r.site,g=d.x-c,v=d.y-h,m=2*(f*v-p*g),y=f*f+p*p,x=g*g+v*v,b={x:(v*y-p*x)/m+c,y:(f*x-g*y)/m+h};Si(r.edge,u,d,b),l.edge=Ti(u,t,null,b),r.edge=Ti(t,d,null,b),wi(e),wi(r)}else l.edge=Ti(e.site,l.site)}}function yi(t,e){var r=t.site,n=r.x,i=r.y,a=i-e;if(!a)return n;var o=t.P;if(!o)return-1/0;var s=(r=o.site).x,l=r.y,u=l-e;if(!u)return s;var c=s-n,h=1/a-1/u,f=c/u;return h?(-f+Math.sqrt(f*f-2*h*(c*c/(-2*u)-l+u/2+i-a/2)))/h+n:(n+s)/2}function xi(t,e){var r=t.N;if(r)return yi(r,e);var n=t.site;return n.y===e?n.x:1/0}function bi(t){this.site=t,this.edges=[]}function _i(t,e){return e.angle-t.angle}function wi(t){var e=t.P,r=t.N;if(e&&r){var n=e.site,i=t.site,a=r.site;if(n!==a){var o=i.x,s=i.y,l=n.x-o,u=n.y-s,c=a.x-o,h=2*(l*(v=a.y-s)-u*c);if(!(h>=-At)){var f=l*l+u*u,p=c*c+v*v,d=(v*f-u*p)/h,g=(l*p-c*f)/h,v=g+s,m=pi.pop()||new function(){Li(this),this.x=this.y=this.arc=this.site=this.cy=null};m.arc=t,m.site=i,m.x=d+o,m.y=v+Math.sqrt(d*d+g*g),m.cy=v,t.circle=m;for(var y=null,x=hi._;x;)if(m.y=s)return;if(f>d){if(a){if(a.y>=u)return}else a={x:v,y:l};r={x:v,y:u}}else{if(a){if(a.y1)if(f>d){if(a){if(a.y>=u)return}else a={x:(l-i)/n,y:l};r={x:(u-i)/n,y:u}}else{if(a){if(a.y=s)return}else a={x:o,y:n*o+i};r={x:s,y:n*s+i}}else{if(a){if(a.xMt||y(i-r)>Mt)&&(s.splice(o,0,new Ei((m=a.site,x=c,b=y(n-h)Mt?{x:h,y:y(e-h)Mt?{x:y(r-d)Mt?{x:f,y:y(e-f)Mt?{x:y(r-p)=r&&u.x<=i&&u.y>=n&&u.y<=o?[[r,o],[i,o],[i,n],[r,n]]:[]).point=t[s]}),e}function s(t){return t.map(function(t,e){return{x:Math.round(n(t,e)/Mt)*Mt,y:Math.round(i(t,e)/Mt)*Mt,i:e}})}return o.links=function(t){return Di(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},o.triangles=function(t){var e=[];return Di(s(t)).cells.forEach(function(r,n){for(var i,a,o,s,l=r.site,u=r.edges.sort(_i),c=-1,h=u.length,f=u[h-1].edge,p=f.l===l?f.r:f.l;++ca&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:Vi(r,n)})),a=Hi.lastIndex;return ag&&(g=l.x),l.y>v&&(v=l.y),u.push(l.x),c.push(l.y);else for(h=0;hg&&(g=b),_>v&&(v=_),u.push(b),c.push(_)}var w=g-p,M=v-d;function A(t,e,r,n,i,a,o,s){if(!isNaN(r)&&!isNaN(n))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(y(l-r)+y(u-n)<.01)k(t,e,r,n,i,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,k(t,c,l,u,i,a,o,s),k(t,e,r,n,i,a,o,s)}else t.x=r,t.y=n,t.point=e}else k(t,e,r,n,i,a,o,s)}function k(t,e,r,n,i,a,o,s){var l=.5*(i+o),u=.5*(a+s),c=r>=l,h=n>=u,f=h<<1|c;t.leaf=!1,t=t.nodes[f]||(t.nodes[f]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){A(T,t,+m(t,++h),+x(t,h),p,d,g,v)}}),c?i=l:o=l,h?a=u:s=u,A(t,e,r,n,i,a,o,s)}w>M?v=d+w:g=p+M;var T={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){A(T,t,+m(t,++h),+x(t,h),p,d,g,v)}};if(T.visit=function(t){!function t(e,r,n,i,a,o){if(!e(r,n,i,a,o)){var s=.5*(n+a),l=.5*(i+o),u=r.nodes;u[0]&&t(e,u[0],n,i,s,l),u[1]&&t(e,u[1],s,i,a,l),u[2]&&t(e,u[2],n,l,s,o),u[3]&&t(e,u[3],s,l,a,o)}}(t,T,p,d,g,v)},T.find=function(t){return function(t,e,r,n,i,a,o){var s,l=1/0;return function t(u,c,h,f,p){if(!(c>a||h>o||f=_)<<1|e>=b,M=w+4;w=0&&!(n=t.interpolators[i](e,r)););return n}function Wi(t,e){var r,n=[],i=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(r=0;r=1)return 1;var e=t*t,r=e*t;return 4*(t<.5?r:3*(t-e)+r-.75)}function ea(t){return 1-Math.cos(t*Et)}function ra(t){return Math.pow(2,10*(t-1))}function na(t){return 1-Math.sqrt(1-t*t)}function ia(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 aa(t,e){return e-=t,function(r){return Math.round(t+e*r)}}function oa(t){var e,r,n,i=[t.a,t.b],a=[t.c,t.d],o=la(i),s=sa(i,a),l=la(((e=a)[0]+=(n=-s)*(r=i)[0],e[1]+=n*r[1],e))||0;i[0]*a[1]=0?t.slice(0,n):t,a=n>=0?t.slice(n+1):"in";return i=Xi.get(i)||Yi,a=Zi.get(a)||z,e=a(i.apply(null,r.call(arguments,1))),function(t){return t<=0?0:t>=1?1:e(t)}},t.interpolateHcl=function(e,r){e=t.hcl(e),r=t.hcl(r);var n=e.h,i=e.c,a=e.l,o=r.h-n,s=r.c-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.c:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Yt(n+o*t,i+s*t,a+l*t)+""}},t.interpolateHsl=function(e,r){e=t.hsl(e),r=t.hsl(r);var n=e.h,i=e.s,a=e.l,o=r.h-n,s=r.s-i,l=r.l-a;isNaN(s)&&(s=0,i=isNaN(i)?r.s:i);isNaN(o)?(o=0,n=isNaN(n)?r.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Ht(n+o*t,i+s*t,a+l*t)+""}},t.interpolateLab=function(e,r){e=t.lab(e),r=t.lab(r);var n=e.l,i=e.a,a=e.b,o=r.l-n,s=r.a-i,l=r.b-a;return function(t){return te(n+o*t,i+s*t,a+l*t)+""}},t.interpolateRound=aa,t.transform=function(e){var r=i.createElementNS(t.ns.prefix.svg,"g");return(t.transform=function(t){if(null!=t){r.setAttribute("transform",t);var e=r.transform.baseVal.consolidate()}return new oa(e?e.matrix:ua)})(e)},oa.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ua={a:1,b:0,c:0,d:1,e:0,f:0};function ca(t){return t.length?t.pop()+",":""}function ha(e,r){var n=[],i=[];return e=t.transform(e),r=t.transform(r),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push("translate(",null,",",null,")");n.push({i:i-4,x:Vi(t[0],e[0])},{i:i-2,x:Vi(t[1],e[1])})}else(e[0]||e[1])&&r.push("translate("+e+")")}(e.translate,r.translate,n,i),function(t,e,r,n){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),n.push({i:r.push(ca(r)+"rotate(",null,")")-2,x:Vi(t,e)})):e&&r.push(ca(r)+"rotate("+e+")")}(e.rotate,r.rotate,n,i),function(t,e,r,n){t!==e?n.push({i:r.push(ca(r)+"skewX(",null,")")-2,x:Vi(t,e)}):e&&r.push(ca(r)+"skewX("+e+")")}(e.skew,r.skew,n,i),function(t,e,r,n){if(t[0]!==e[0]||t[1]!==e[1]){var i=r.push(ca(r)+"scale(",null,",",null,")");n.push({i:i-4,x:Vi(t[0],e[0])},{i:i-2,x:Vi(t[1],e[1])})}else 1===e[0]&&1===e[1]||r.push(ca(r)+"scale("+e+")")}(e.scale,r.scale,n,i),e=r=null,function(t){for(var e,r=-1,a=i.length;++r0?n=t:(e.c=null,e.t=NaN,e=null,l.end({type:"end",alpha:n=0})):t>0&&(l.start({type:"start",alpha:n=t}),e=Ae(s.tick)),s):n},s.start=function(){var t,e,r,n=m.length,l=y.length,c=u[0],d=u[1];for(t=0;t=0;)r.push(i[n])}function ka(t,e){for(var r=[t],n=[];null!=(t=r.pop());)if(n.push(t),(a=t.children)&&(i=a.length))for(var i,a,o=-1;++o=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;r&&(a.value=0),a.children=u}else r&&(a.value=+r.call(n,a,a.depth)||0),delete a.children;return ka(i,function(e){var n,i;t&&(n=e.children)&&n.sort(t),r&&(i=e.parent)&&(i.value+=e.value)}),s}return n.sort=function(e){return arguments.length?(t=e,n):t},n.children=function(t){return arguments.length?(e=t,n):e},n.value=function(t){return arguments.length?(r=t,n):r},n.revalue=function(t){return r&&(Aa(t,function(t){t.children&&(t.value=0)}),ka(t,function(t){var e;t.children||(t.value=+r.call(n,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},n},t.layout.partition=function(){var e=t.layout.hierarchy(),r=[1,1];function n(t,n){var i=e.call(this,t,n);return function t(e,r,n,i){var a=e.children;if(e.x=r,e.y=e.depth*i,e.dx=n,e.dy=i,a&&(o=a.length)){var o,s,l,u=-1;for(n=e.value?n/e.value:0;++us&&(s=n),o.push(n)}for(r=0;ri&&(n=r,i=e);return n}function Na(t){return t.reduce(ja,0)}function ja(t,e){return t+e[1]}function Va(t,e){return Ua(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function Ua(t,e){for(var r=-1,n=+t[0],i=(t[1]-n)/e,a=[];++r<=e;)a[r]=i*r+n;return a}function qa(e){return[t.min(e),t.max(e)]}function Ha(t,e){return t.value-e.value}function Ga(t,e){var r=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=r,r._pack_prev=e}function Wa(t,e){t._pack_next=e,e._pack_prev=t}function Ya(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 Xa(t){if((e=t.children)&&(l=e.length)){var e,r,n,i,a,o,s,l,u=1/0,c=-1/0,h=1/0,f=-1/0;if(e.forEach(Za),(r=e[0]).x=-r.r,r.y=0,x(r),l>1&&((n=e[1]).x=n.r,n.y=0,x(n),l>2))for(Ka(r,n,i=e[2]),x(i),Ga(r,i),r._pack_prev=i,Ga(i,n),n=r._pack_next,a=3;a0)for(o=-1;++o=h[0]&&l<=h[1]&&((s=u[t.bisect(f,l,1,d)-1]).y+=g,s.push(a[o]));return u}return a.value=function(t){return arguments.length?(r=t,a):r},a.range=function(t){return arguments.length?(n=ve(t),a):n},a.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return Ua(e,t)}:ve(t),a):i},a.frequency=function(t){return arguments.length?(e=!!t,a):e},a},t.layout.pack=function(){var e,r=t.layout.hierarchy().sort(Ha),n=0,i=[1,1];function a(t,a){var o=r.call(this,t,a),s=o[0],l=i[0],u=i[1],c=null==e?Math.sqrt:"function"==typeof e?e:function(){return e};if(s.x=s.y=0,ka(s,function(t){t.r=+c(t.value)}),ka(s,Xa),n){var h=n*(e?1:Math.max(2*s.r/l,2*s.r/u))/2;ka(s,function(t){t.r+=h}),ka(s,Xa),ka(s,function(t){t.r-=h})}return function t(e,r,n,i){var a=e.children;e.x=r+=i*e.x;e.y=n+=i*e.y;e.r*=i;if(a)for(var o=-1,s=a.length;++op.x&&(p=t),t.depth>d.depth&&(d=t)});var g=r(f,p)/2-f.x,v=n[0]/(p.x+r(p,f)/2+g),m=n[1]/(d.depth||1);Aa(c,function(t){t.x=(t.x+g)*v,t.y=t.depth*m})}return u}function o(t){var e=t.children,n=t.parent.children,i=t.i?n[t.i-1]:null;if(e.length){!function(t){var e,r=0,n=0,i=t.children,a=i.length;for(;--a>=0;)(e=i[a]).z+=r,e.m+=r,r+=e.s+(n+=e.c)}(t);var a=(e[0].z+e[e.length-1].z)/2;i?(t.z=i.z+r(t._,i._),t.m=t.z-a):t.z=a}else i&&(t.z=i.z+r(t._,i._));t.parent.A=function(t,e,n){if(e){for(var i,a=t,o=t,s=e,l=a.parent.children[0],u=a.m,c=o.m,h=s.m,f=l.m;s=to(s),a=$a(a),s&&a;)l=$a(l),(o=to(o)).a=t,(i=s.z+h-a.z-u+r(s._,a._))>0&&(eo(ro(s,t,n),t,i),u+=i,c+=i),h+=s.m,u+=a.m,f+=l.m,c+=o.m;s&&!to(o)&&(o.t=s,o.m+=h-c),a&&!$a(l)&&(l.t=a,l.m+=u-f,n=t)}return n}(t,i,t.parent.A||n[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t)?l:null,a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,a):i?n:null},Ma(a,e)},t.layout.cluster=function(){var e=t.layout.hierarchy().sort(null).value(null),r=Qa,n=[1,1],i=!1;function a(a,o){var s,l=e.call(this,a,o),u=l[0],c=0;ka(u,function(e){var n=e.children;n&&n.length?(e.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(n),e.y=function(e){return 1+t.max(e,function(t){return t.y})}(n)):(e.x=s?c+=r(e,s):0,e.y=0,s=e)});var h=function t(e){var r=e.children;return r&&r.length?t(r[0]):e}(u),f=function t(e){var r,n=e.children;return n&&(r=n.length)?t(n[r-1]):e}(u),p=h.x-r(h,f)/2,d=f.x+r(f,h)/2;return ka(u,i?function(t){t.x=(t.x-u.x)*n[0],t.y=(u.y-t.y)*n[1]}:function(t){t.x=(t.x-p)/(d-p)*n[0],t.y=(1-(u.y?t.y/u.y:1))*n[1]}),l}return a.separation=function(t){return arguments.length?(r=t,a):r},a.size=function(t){return arguments.length?(i=null==(n=t),a):i?null:n},a.nodeSize=function(t){return arguments.length?(i=null!=(n=t),a):i?n:null},Ma(a,e)},t.layout.treemap=function(){var e,r=t.layout.hierarchy(),n=Math.round,i=[1,1],a=null,o=no,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var r,n,i=-1,a=t.length;++i0;)s.push(r=u[i-1]),s.area+=r.area,"squarify"!==l||(n=p(s,g))<=f?(u.pop(),f=n):(s.area-=s.pop().area,d(s,g,a,!1),g=Math.min(a.dx,a.dy),s.length=s.area=0,f=1/0);s.length&&(d(s,g,a,!0),s.length=s.area=0),e.forEach(h)}}function f(t){var e=t.children;if(e&&e.length){var r,n=o(t),i=e.slice(),a=[];for(c(i,n.dx*n.dy/t.value),a.area=0;r=i.pop();)a.push(r),a.area+=r.area,null!=r.z&&(d(a,r.z?n.dx:n.dy,n,!i.length),a.length=a.area=0);e.forEach(f)}}function p(t,e){for(var r,n=t.area,i=0,a=1/0,o=-1,s=t.length;++oi&&(i=r));return e*=e,(n*=n)?Math.max(e*i*u/n,n/(e*a*u)):1/0}function d(t,e,r,i){var a,o=-1,s=t.length,l=r.x,u=r.y,c=e?n(t.area/e):0;if(e==r.dx){for((i||c>r.dy)&&(c=r.dy);++or.dx)&&(c=r.dx);++o1);return t+e*r*Math.sqrt(-2*Math.log(i)/i)}},logNormal:function(){var e=t.random.normal.apply(t,arguments);return function(){return Math.exp(e())}},bates:function(e){var r=t.random.irwinHall(e);return function(){return r()/e}},irwinHall:function(t){return function(){for(var e=0,r=0;r2?ho:so,s=i?pa:fa;return a=t(e,r,s,n),o=t(r,e,s,Gi),l}function l(t){return a(t)}l.invert=function(t){return o(t)};l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e};l.range=function(t){return arguments.length?(r=t,s()):r};l.rangeRound=function(t){return l.range(t).interpolate(aa)};l.clamp=function(t){return arguments.length?(i=t,s()):i};l.interpolate=function(t){return arguments.length?(n=t,s()):n};l.ticks=function(t){return vo(e,t)};l.tickFormat=function(t,r){return mo(e,t,r)};l.nice=function(t){return po(e,t),s()};l.copy=function(){return t(e,r,n,i)};return s()}([0,1],[0,1],Gi,!1)};var yo={s:1,g:1,p:1,r:1,e:1};function xo(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}t.scale.log=function(){return function e(r,n,i,a){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return r(o(t))}l.invert=function(t){return s(r.invert(t))};l.domain=function(t){return arguments.length?(i=t[0]>=0,r.domain((a=t.map(Number)).map(o)),l):a};l.base=function(t){return arguments.length?(n=+t,r.domain(a.map(o)),l):n};l.nice=function(){var t=lo(a.map(o),i?Math:_o);return r.domain(t),a=t.map(s),l};l.ticks=function(){var t=ao(a),e=[],r=t[0],l=t[1],u=Math.floor(o(r)),c=Math.ceil(o(l)),h=n%1?2:n;if(isFinite(c-u)){if(i){for(;u0;f--)e.push(s(u)*f);for(u=0;e[u]l;c--);e=e.slice(u,c)}return e};l.tickFormat=function(e,r){if(!arguments.length)return bo;arguments.length<2?r=bo:"function"!=typeof r&&(r=t.format(r));var i=Math.max(1,n*e/l.ticks().length);return function(t){var e=t/s(Math.round(o(t)));return e*n0?i[t-1]:r[0],th?0:1;if(u=St)return l(u,p)+(s?l(s,1-p):"")+"Z";var d,g,v,m,y,x,b,_,w,M,A,k,T=0,S=0,E=[];if((m=(+o.apply(this,arguments)||0)/2)&&(v=n===Eo?Math.sqrt(s*s+u*u):+n.apply(this,arguments),p||(S*=-1),u&&(S=Dt(v/u*Math.sin(m))),s&&(T=Dt(v/s*Math.sin(m)))),u){y=u*Math.cos(c+S),x=u*Math.sin(c+S),b=u*Math.cos(h-S),_=u*Math.sin(h-S);var C=Math.abs(h-c-2*S)<=kt?0:1;if(S&&Do(y,x,b,_)===p^C){var L=(c+h)/2;y=u*Math.cos(L),x=u*Math.sin(L),b=_=null}}else y=x=0;if(s){w=s*Math.cos(h-T),M=s*Math.sin(h-T),A=s*Math.cos(c+T),k=s*Math.sin(c+T);var z=Math.abs(c-h+2*T)<=kt?0:1;if(T&&Do(w,M,A,k)===1-p^z){var P=(c+h)/2;w=s*Math.cos(P),M=s*Math.sin(P),A=k=null}}else w=M=0;if(f>Mt&&(d=Math.min(Math.abs(u-s)/2,+r.apply(this,arguments)))>.001){g=s0?0:1}function Oo(t,e,r,n,i){var a=t[0]-e[0],o=t[1]-e[1],s=(i?n:-n)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,h=t[1]+u,f=e[0]+l,p=e[1]+u,d=(c+f)/2,g=(h+p)/2,v=f-c,m=p-h,y=v*v+m*m,x=r-n,b=c*p-f*h,_=(m<0?-1:1)*Math.sqrt(Math.max(0,x*x*y-b*b)),w=(b*m-v*_)/y,M=(-b*v-m*_)/y,A=(b*m+v*_)/y,k=(-b*v+m*_)/y,T=w-d,S=M-g,E=A-d,C=k-g;return T*T+S*S>E*E+C*C&&(w=A,M=k),[[w-l,M-u],[w*r/x,M*r/x]]}function Ro(t){var e=$n,r=ti,n=Wr,i=Bo,a=i.key,o=.7;function s(a){var s,l=[],u=[],c=-1,h=a.length,f=ve(e),p=ve(r);function d(){l.push("M",i(t(u),o))}for(;++c1&&i.push("H",n[0]);return i.join("")},"step-before":jo,"step-after":Vo,basis:Ho,"basis-open":function(t){if(t.length<4)return Bo(t);var e,r=[],n=-1,i=t.length,a=[0],o=[0];for(;++n<3;)e=t[n],a.push(e[0]),o.push(e[1]);r.push(Go(Xo,a)+","+Go(Xo,o)),--n;for(;++n9&&(i=3*e/Math.sqrt(i),o[s]=i*r,o[s+1]=i*n));s=-1;for(;++s<=l;)i=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([i||0,o[s]*i||0]);return a}(t))}});function Bo(t){return t.length>1?t.join("L"):t+"Z"}function No(t){return t.join("L")+"Z"}function jo(t){for(var e=0,r=t.length,n=t[0],i=[n[0],",",n[1]];++e1){s=e[1],a=t[l],l++,n+="C"+(i[0]+o[0])+","+(i[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;ukt)+",1 "+e}function l(t,e,r,n){return"Q 0,0 "+n}return a.radius=function(t){return arguments.length?(r=ve(t),a):r},a.source=function(e){return arguments.length?(t=ve(e),a):t},a.target=function(t){return arguments.length?(e=ve(t),a):e},a.startAngle=function(t){return arguments.length?(n=ve(t),a):n},a.endAngle=function(t){return arguments.length?(i=ve(t),a):i},a},t.svg.diagonal=function(){var t=Nn,e=jn,r=ts;function n(n,i){var a=t.call(this,n,i),o=e.call(this,n,i),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(r))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return n.source=function(e){return arguments.length?(t=ve(e),n):t},n.target=function(t){return arguments.length?(e=ve(t),n):e},n.projection=function(t){return arguments.length?(r=t,n):r},n},t.svg.diagonal.radial=function(){var e=t.svg.diagonal(),r=ts,n=e.projection;return e.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),r=e[0],n=e[1]-Et;return[r*Math.cos(n),r*Math.sin(n)]}}(r=t)):r},e},t.svg.symbol=function(){var t=rs,e=es;function r(r,n){return(is.get(t.call(this,r,n))||ns)(e.call(this,r,n))}return r.type=function(e){return arguments.length?(t=ve(e),r):t},r.size=function(t){return arguments.length?(e=ve(t),r):e},r};var is=t.map({circle:ns,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*os)),r=e*os;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"}});t.svg.symbolTypes=is.keys();var as=Math.sqrt(3),os=Math.tan(30*Ct);Y.transition=function(t){for(var e,r,n=cs||++ps,i=vs(t),a=[],o=hs||{time:Date.now(),ease:ta,delay:0,duration:250},s=-1,l=this.length;++s0;)u[--f].call(t,o);if(a>=1)return h.event&&h.event.end.call(t,t.__data__,e),--c.count?delete c[n]:delete t[r],1}h||(a=i.time,o=Ae(function(t){var e=h.delay;if(o.t=e+a,e<=t)return f(t-e);o.c=f},0,a),h=c[n]={tween:new b,time:a,timer:o,delay:i.delay,duration:i.duration,ease:i.ease,index:e},i=null,++c.count)}fs.call=Y.call,fs.empty=Y.empty,fs.node=Y.node,fs.size=Y.size,t.transition=function(e,r){return e&&e.transition?cs?e.transition(r):e:t.selection().transition(e)},t.transition.prototype=fs,fs.select=function(t){var e,r,n,i=this.id,a=this.namespace,o=[];t=X(t);for(var s=-1,l=this.length;++srect,.s>rect").attr("width",s[1]-s[0])}function g(t){t.select(".extent").attr("y",l[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",l[1]-l[0])}function v(){var h,v,m=this,y=t.select(t.event.target),x=n.of(m,arguments),b=t.select(m),_=y.datum(),w=!/^(n|s)$/.test(_)&&i,M=!/^(e|w)$/.test(_)&&a,A=y.classed("extent"),k=xt(m),T=t.mouse(m),S=t.select(o(m)).on("keydown.brush",function(){32==t.event.keyCode&&(A||(h=null,T[0]-=s[1],T[1]-=l[1],A=2),B())}).on("keyup.brush",function(){32==t.event.keyCode&&2==A&&(T[0]+=s[1],T[1]+=l[1],A=0,B())});if(t.event.changedTouches?S.on("touchmove.brush",L).on("touchend.brush",P):S.on("mousemove.brush",L).on("mouseup.brush",P),b.interrupt().selectAll("*").interrupt(),A)T[0]=s[0]-T[0],T[1]=l[0]-T[1];else if(_){var E=+/w$/.test(_),C=+/^n/.test(_);v=[s[1-E]-T[0],l[1-C]-T[1]],T[0]=s[E],T[1]=l[C]}else t.event.altKey&&(h=T.slice());function L(){var e=t.mouse(m),r=!1;v&&(e[0]+=v[0],e[1]+=v[1]),A||(t.event.altKey?(h||(h=[(s[0]+s[1])/2,(l[0]+l[1])/2]),T[0]=s[+(e[0]1?{floor:function(e){for(;s(e=t.floor(e));)e=Cs(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=Cs(+e+1);return e}}:t))},i.ticks=function(t,e){var r=ao(i.domain()),n=null==t?a(r,10):"number"==typeof t?a(r,t):!t.range&&[{range:t},e];return n&&(t=n[0],e=n[1]),t.range(r[0],Cs(+r[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Es(e.copy(),r,n)},fo(i,e)}function Cs(t){return new Date(t)}As.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?Ss:Ts,Ss.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},Ss.toString=Ts.toString,Ie.second=Fe(function(t){return new De(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),Ie.seconds=Ie.second.range,Ie.seconds.utc=Ie.second.utc.range,Ie.minute=Fe(function(t){return new De(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),Ie.minutes=Ie.minute.range,Ie.minutes.utc=Ie.minute.utc.range,Ie.hour=Fe(function(t){var e=t.getTimezoneOffset()/60;return new De(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),Ie.hours=Ie.hour.range,Ie.hours.utc=Ie.hour.utc.range,Ie.month=Fe(function(t){return(t=Ie.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),Ie.months=Ie.month.range,Ie.months.utc=Ie.month.utc.range;var Ls=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],zs=[[Ie.second,1],[Ie.second,5],[Ie.second,15],[Ie.second,30],[Ie.minute,1],[Ie.minute,5],[Ie.minute,15],[Ie.minute,30],[Ie.hour,1],[Ie.hour,3],[Ie.hour,6],[Ie.hour,12],[Ie.day,1],[Ie.day,2],[Ie.week,1],[Ie.month,1],[Ie.month,3],[Ie.year,1]],Ps=As.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Wr]]),Is={range:function(e,r,n){return t.range(Math.ceil(e/n)*n,+r,n).map(Cs)},floor:z,ceil:z};zs.year=Ie.year,Ie.scale=function(){return Es(t.scale.linear(),zs,Ps)};var Ds=zs.map(function(t){return[t[0].utc,t[1]]}),Os=ks.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Wr]]);function Rs(t){return JSON.parse(t.responseText)}function Fs(t){var e=i.createRange();return e.selectNode(i.body),e.createContextualFragment(t.responseText)}Ds.year=Ie.year.utc,Ie.scale.utc=function(){return Es(t.scale.linear(),Ds,Os)},t.text=me(function(t){return t.responseText}),t.json=function(t,e){return ye(t,"application/json",Rs,e)},t.html=function(t,e){return ye(t,"text/html",Fs,e)},t.xml=me(function(t){return t.responseXML}),e.exports?e.exports=t:this.d3=t}(),e=e.exports;var r=function(t){var e=typeof t;if("string"===e){var r=t;if(0===(t=+t)&&function(t){for(var e,r=t.length,n=0;n13)&&32!==e&&133!==e&&160!==e&&5760!==e&&6158!==e&&(e<8192||e>8205)&&8232!==e&&8233!==e&&8239!==e&&8287!==e&&8288!==e&&12288!==e&&65279!==e)return!1;return!0}(r))return!1}else if("number"!==e)return!1;return t-t<1},n={},i=Math.PI;n.deg2rad=function(t){return t/180*i},n.rad2deg=function(t){return t/i*180},n.wrap360=function(t){var e=t%360;return e<0?e+360:e},n.wrap180=function(t){return Math.abs(t)>180&&(t-=360*Math.round(t/360)),t};var a=t.BADNUM,o=/^['"%,$#\s']+|[, ]|['"%,$#\s']+$/g,s={exports:{}};!function(t){var e=/^\s+/,r=/\s+$/,n=0,i=t.round,a=t.min,o=t.max,l=t.random;function u(s,l){if(s=s||"",l=l||{},s instanceof u)return s;if(!(this instanceof u))return new u(s,l);var c=function(n){var i={r:0,g:0,b:0},s=1,l=null,u=null,c=null,h=!1,f=!1;"string"==typeof n&&(n=function(t){t=t.replace(e,"").replace(r,"").toLowerCase();var n,i=!1;if(S[t])t=S[t],i=!0;else if("transparent"==t)return{r:0,g:0,b:0,a:0,format:"name"};if(n=j.rgb.exec(t))return{r:n[1],g:n[2],b:n[3]};if(n=j.rgba.exec(t))return{r:n[1],g:n[2],b:n[3],a:n[4]};if(n=j.hsl.exec(t))return{h:n[1],s:n[2],l:n[3]};if(n=j.hsla.exec(t))return{h:n[1],s:n[2],l:n[3],a:n[4]};if(n=j.hsv.exec(t))return{h:n[1],s:n[2],v:n[3]};if(n=j.hsva.exec(t))return{h:n[1],s:n[2],v:n[3],a:n[4]};if(n=j.hex8.exec(t))return{r:P(n[1]),g:P(n[2]),b:P(n[3]),a:R(n[4]),format:i?"name":"hex8"};if(n=j.hex6.exec(t))return{r:P(n[1]),g:P(n[2]),b:P(n[3]),format:i?"name":"hex"};if(n=j.hex4.exec(t))return{r:P(n[1]+""+n[1]),g:P(n[2]+""+n[2]),b:P(n[3]+""+n[3]),a:R(n[4]+""+n[4]),format:i?"name":"hex8"};if(n=j.hex3.exec(t))return{r:P(n[1]+""+n[1]),g:P(n[2]+""+n[2]),b:P(n[3]+""+n[3]),format:i?"name":"hex"};return!1}(n));"object"==typeof n&&(V(n.r)&&V(n.g)&&V(n.b)?(p=n.r,d=n.g,g=n.b,i={r:255*L(p,255),g:255*L(d,255),b:255*L(g,255)},h=!0,f="%"===String(n.r).substr(-1)?"prgb":"rgb"):V(n.h)&&V(n.s)&&V(n.v)?(l=D(n.s),u=D(n.v),i=function(e,r,n){e=6*L(e,360),r=L(r,100),n=L(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),u=i%6;return{r:255*[n,s,o,o,l,n][u],g:255*[l,n,n,s,o,o][u],b:255*[o,o,l,n,n,s][u]}}(n.h,l,u),h=!0,f="hsv"):V(n.h)&&V(n.s)&&V(n.l)&&(l=D(n.s),c=D(n.l),i=function(t,e,r){var n,i,a;function o(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}if(t=L(t,360),e=L(e,100),r=L(r,100),0===e)n=i=a=r;else{var s=r<.5?r*(1+e):r+e-r*e,l=2*r-s;n=o(l,s,t+1/3),i=o(l,s,t),a=o(l,s,t-1/3)}return{r:255*n,g:255*i,b:255*a}}(n.h,l,c),h=!0,f="hsl"),n.hasOwnProperty("a")&&(s=n.a));var p,d,g;return s=C(s),{ok:h,format:n.format||f,r:a(255,o(i.r,0)),g:a(255,o(i.g,0)),b:a(255,o(i.b,0)),a:s}}(s);this._originalInput=s,this._r=c.r,this._g=c.g,this._b=c.b,this._a=c.a,this._roundA=i(100*this._a)/100,this._format=l.format||c.format,this._gradientType=l.gradientType,this._r<1&&(this._r=i(this._r)),this._g<1&&(this._g=i(this._g)),this._b<1&&(this._b=i(this._b)),this._ok=c.ok,this._tc_id=n++}function c(t,e,r){t=L(t,255),e=L(e,255),r=L(r,255);var n,i,s=o(t,e,r),l=a(t,e,r),u=(s+l)/2;if(s==l)n=i=0;else{var c=s-l;switch(i=u>.5?c/(2-s-l):c/(s+l),s){case t:n=(e-r)/c+(e>1)+720)%360;--e;)n.h=(n.h+i)%360,a.push(u(n));return a}function T(t,e){e=e||6;for(var r=u(t).toHsv(),n=r.h,i=r.s,a=r.v,o=[],s=1/e;e--;)o.push(u({h:n,s:i,v:a})),a=(a+s)%1;return o}u.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(299*t.r+587*t.g+114*t.b)/1e3},getLuminance:function(){var e,r,n,i=this.toRgb();return e=i.r/255,r=i.g/255,n=i.b/255,.2126*(e<=.03928?e/12.92:t.pow((e+.055)/1.055,2.4))+.7152*(r<=.03928?r/12.92:t.pow((r+.055)/1.055,2.4))+.0722*(n<=.03928?n/12.92:t.pow((n+.055)/1.055,2.4))},setAlpha:function(t){return this._a=C(t),this._roundA=i(100*this._a)/100,this},toHsv:function(){var t=h(this._r,this._g,this._b);return{h:360*t.h,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=h(this._r,this._g,this._b),e=i(360*t.h),r=i(100*t.s),n=i(100*t.v);return 1==this._a?"hsv("+e+", "+r+"%, "+n+"%)":"hsva("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var t=c(this._r,this._g,this._b);return{h:360*t.h,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=c(this._r,this._g,this._b),e=i(360*t.h),r=i(100*t.s),n=i(100*t.l);return 1==this._a?"hsl("+e+", "+r+"%, "+n+"%)":"hsla("+e+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(t){return f(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return function(t,e,r,n,a){var o=[I(i(t).toString(16)),I(i(e).toString(16)),I(i(r).toString(16)),I(O(n))];if(a&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1))return o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0);return o.join("")}(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:i(this._r),g:i(this._g),b:i(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+i(this._r)+", "+i(this._g)+", "+i(this._b)+")":"rgba("+i(this._r)+", "+i(this._g)+", "+i(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:i(100*L(this._r,255))+"%",g:i(100*L(this._g,255))+"%",b:i(100*L(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%)":"rgba("+i(100*L(this._r,255))+"%, "+i(100*L(this._g,255))+"%, "+i(100*L(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(E[f(this._r,this._g,this._b,!0)]||!1)},toFilter:function(t){var e="#"+p(this._r,this._g,this._b,this._a),r=e,n=this._gradientType?"GradientType = 1, ":"";if(t){var i=u(t);r="#"+p(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+e+",endColorstr="+r+")"},toString:function(t){var e=!!t;t=t||this._format;var r=!1,n=this._a<1&&this._a>=0;return e||!n||"hex"!==t&&"hex6"!==t&&"hex3"!==t&&"hex4"!==t&&"hex8"!==t&&"name"!==t?("rgb"===t&&(r=this.toRgbString()),"prgb"===t&&(r=this.toPercentageRgbString()),"hex"!==t&&"hex6"!==t||(r=this.toHexString()),"hex3"===t&&(r=this.toHexString(!0)),"hex4"===t&&(r=this.toHex8String(!0)),"hex8"===t&&(r=this.toHex8String()),"name"===t&&(r=this.toName()),"hsl"===t&&(r=this.toHslString()),"hsv"===t&&(r=this.toHsvString()),r||this.toHexString()):"name"===t&&0===this._a?this.toName():this.toRgbString()},clone:function(){return u(this.toString())},_applyModification:function(t,e){var r=t.apply(null,[this].concat([].slice.call(e)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(y,arguments)},darken:function(){return this._applyModification(x,arguments)},desaturate:function(){return this._applyModification(d,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(v,arguments)},spin:function(){return this._applyModification(b,arguments)},_applyCombination:function(t,e){return t.apply(null,[this].concat([].slice.call(e)))},analogous:function(){return this._applyCombination(k,arguments)},complement:function(){return this._applyCombination(_,arguments)},monochromatic:function(){return this._applyCombination(T,arguments)},splitcomplement:function(){return this._applyCombination(A,arguments)},triad:function(){return this._applyCombination(w,arguments)},tetrad:function(){return this._applyCombination(M,arguments)}},u.fromRatio=function(t,e){if("object"==typeof t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="a"===n?t[n]:D(t[n]));t=r}return u(t,e)},u.equals=function(t,e){return!(!t||!e)&&u(t).toRgbString()==u(e).toRgbString()},u.random=function(){return u.fromRatio({r:l(),g:l(),b:l()})},u.mix=function(t,e,r){r=0===r?0:r||50;var n=u(t).toRgb(),i=u(e).toRgb(),a=r/100;return u({r:(i.r-n.r)*a+n.r,g:(i.g-n.g)*a+n.g,b:(i.b-n.b)*a+n.b,a:(i.a-n.a)*a+n.a})},u.readability=function(e,r){var n=u(e),i=u(r);return(t.max(n.getLuminance(),i.getLuminance())+.05)/(t.min(n.getLuminance(),i.getLuminance())+.05)},u.isReadable=function(t,e,r){var n,i,a=u.readability(t,e);switch(i=!1,(n=function(t){var e,r;e=((t=t||{level:"AA",size:"small"}).level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),"AA"!==e&&"AAA"!==e&&(e="AA");"small"!==r&&"large"!==r&&(r="small");return{level:e,size:r}}(r)).level+n.size){case"AAsmall":case"AAAlarge":i=a>=4.5;break;case"AAlarge":i=a>=3;break;case"AAAsmall":i=a>=7}return i},u.mostReadable=function(t,e,r){var n,i,a,o,s=null,l=0;i=(r=r||{}).includeFallbackColors,a=r.level,o=r.size;for(var c=0;cl&&(l=n,s=u(e[c]));return u.isReadable(t,s,{level:a,size:o})||!i?s:(r.includeFallbackColors=!1,u.mostReadable(t,["#fff","#000"],r))};var S=u.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},E=u.hexNames=function(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}(S);function C(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function L(e,r){(function(t){return"string"==typeof t&&-1!=t.indexOf(".")&&1===parseFloat(t)})(e)&&(e="100%");var n=function(t){return"string"==typeof t&&-1!=t.indexOf("%")}(e);return e=a(r,o(0,parseFloat(e))),n&&(e=parseInt(e*r,10)/100),t.abs(e-r)<1e-6?1:e%r/parseFloat(r)}function z(t){return a(1,o(0,t))}function P(t){return parseInt(t,16)}function I(t){return 1==t.length?"0"+t:""+t}function D(t){return t<=1&&(t=100*t+"%"),t}function O(e){return t.round(255*parseFloat(e)).toString(16)}function R(t){return P(t)/255}var F,B,N,j=(B="[\\s|\\(]+("+(F="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",N="[\\s|\\(]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")[,|\\s]+("+F+")\\s*\\)?",{CSS_UNIT:new RegExp(F),rgb:new RegExp("rgb"+B),rgba:new RegExp("rgba"+N),hsl:new RegExp("hsl"+B),hsla:new RegExp("hsla"+N),hsv:new RegExp("hsv"+B),hsva:new RegExp("hsva"+N),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function V(t){return!!j.CSS_UNIT.exec(t)}s.exports?s.exports=u:window.tinycolor=u}(Math),s=s.exports;var l={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)"]]},u=l.RdBu,c=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;r1){for(var t=["LOG:"],e=0;e0){for(var t=["WARN:"],e=0;e0){for(var t=["ERROR:"],e=0;e=0;e--){if(n=t[e][0],i=t[e][1],o=!1,G(n))for(r=n.length-1;r>=0;r--)Z(n[r],K(i,r))?o?n[r]=void 0:n.pop():o=!0;else if("object"==typeof n&&null!==n)for(a=Object.keys(n),o=!1,r=a.length-1;r>=0;r--)Z(n[a[r]],K(i,a[r]))?delete n[a[r]]:o=!0;if(o)return}}(l)):o[e[a]]=n}}function K(t,e){var n=e;return r(e)?n="["+e+"]":t&&(n="."+e),t+n}function Q(t,e,r,n){var i,a=G(r),o=!0,s=r,l=n.replace("-1",0),u=!a&&Z(r,l),c=e[0];for(i=0;ii.max?e.set(n):e.set(+t)}},integer:{coerceFunction:function(t,e,n,i){t%1||!r(t)||void 0!==i.min&&ti.max?e.set(n):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){s(t).isValid()?e.set(t):e.set(r)}},colorlist:{coerceFunction:function(t,e,r){Array.isArray(t)&&t.length&&t.every(function(t){return s(t).isValid()})?e.set(t):e.set(r)}},colorscale:{coerceFunction:function(t,e,r){e.set(h(t,r))}},angle:{coerceFunction:function(t,e,n){"auto"===t?e.set("auto"):r(t)?e.set(it(+t)):e.set(n)}},subplotid:{coerceFunction:function(t,e,r){"string"==typeof t&&rt(r).test(t)?e.set(t):e.set(r)},validateFunction:function(t,e){var r=e.dflt;return t===r||"string"==typeof t&&!!rt(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=ot&&t<=st?t:ct;if("string"!=typeof t&&"number"!=typeof t)return ct;t=String(t);var r=bt(e),n=t.charAt(0);!r||"G"!==n&&"g"!==n||(t=t.substr(1),e="");var i=r&&"chinese"===e.substr(0,7),a=t.match(i?yt:mt);if(!a)return ct;var o=a[1],s=a[3]||"1",l=Number(a[5]||1),u=Number(a[7]||0),c=Number(a[9]||0),h=Number(a[11]||0);if(r){if(2===o.length)return ct;var f;o=Number(o);try{var p=P.getComponentMethod("calendars","getCal")(e);if(i){var d="i"===s.charAt(s.length-1);s=parseInt(s,10),f=p.newDate(o,p.toMonthIndex(o,s,d),l)}else f=p.newDate(o,Number(s),l)}catch(t){return ct}return f?(f.toJD()-gt)*ht+u*ft+c*pt+h*dt:ct}o=2===o.length?(Number(o)+2e3-xt)%100+xt:Number(o),s-=1;var g=new Date(Date.UTC(2e3,s,l,u,c));return g.setUTCFullYear(o),g.getUTCMonth()!==s?ct:g.getUTCDate()!==l?ct:g.getTime()+h*dt},ot=ut.MIN_MS=ut.dateTime2ms("-9999"),st=ut.MAX_MS=ut.dateTime2ms("9999-12-31 23:59:59.9999"),ut.isDateTime=function(t,e){return ut.dateTime2ms(t,e)!==ct};var wt=90*ht,Mt=3*ft,At=5*pt;function kt(t,e,r,n,i){if((e||r||n||i)&&(t+=" "+_t(e,2)+":"+_t(r,2),(n||i)&&(t+=":"+_t(n,2),i))){for(var a=4;i%10==0;)a-=1,i/=10;t+="."+_t(i,a)}return t}ut.ms2DateTime=function(t,e,r){if("number"!=typeof t||!(t>=ot&&t<=st))return ct;e||(e=0);var n,i,a,o,s,l,u=Math.floor(10*lt(t+.05,1)),c=Math.round(t-u/10);if(bt(r)){var h=Math.floor(c/ht)+gt,f=Math.floor(lt(t,ht));try{n=P.getComponentMethod("calendars","getCal")(r).fromJD(h).formatDate("yyyy-mm-dd")}catch(t){n=vt("G%Y-%m-%d")(new Date(c))}if("-"===n.charAt(0))for(;n.length<11;)n="-0"+n.substr(1);else for(;n.length<10;)n="0"+n;i=e=ot+ht&&t<=st-ht))return ct;var r=Math.floor(10*lt(t+.05,1)),n=new Date(Math.round(t-r/10));return kt(e.time.format("%Y-%m-%d")(n),n.getHours(),n.getMinutes(),n.getSeconds(),10*n.getUTCMilliseconds()+r)},ut.cleanDate=function(t,e,r){if(ut.isJSDate(t)||"number"==typeof t){if(bt(r))return _.error("JS Dates and milliseconds are incompatible with world calendars",t),e;if(!(t=ut.ms2DateTimeLocal(+t))&&void 0!==e)return e}else if(!ut.isDateTime(t,r))return _.error("unrecognized date",t),e;return t};var Tt=/%\d?f/g;function St(t,e,r,n){t=t.replace(Tt,function(t){var r=Math.min(+t.charAt(1)||6,6);return(e/1e3%1+2).toFixed(r).substr(2).replace(/0+$/,"")||"0"});var i=new Date(Math.floor(e+.05));if(bt(n))try{t=P.getComponentMethod("calendars","worldCalFmt")(t,e,n)}catch(t){return"Invalid"}return r(t)(i)}var Et=[59,59.9,59.99,59.999,59.9999];ut.formatDate=function(t,e,n,i,a,o){if(a=bt(a)&&a,!e)if("y"===n)e=o.year;else if("m"===n)e=o.month;else{if("d"!==n)return function(t,e){var n=lt(t+.05,ht),i=_t(Math.floor(n/ft),2)+":"+_t(lt(Math.floor(n/pt),60),2);if("M"!==e){r(e)||(e=0);var a=(100+Math.min(lt(t/dt,60),Et[e])).toFixed(e).substr(1);e>0&&(a=a.replace(/0+$/,"").replace(/[\.]$/,"")),i+=":"+a}return i}(t,n)+"\n"+St(o.dayMonthYear,t,i,a);e=o.dayMonth+"\n"+o.year}return St(e,t,i,a)};var Ct=3*ht;ut.incrementMonth=function(t,e,r){r=bt(r)&&r;var n=lt(t,ht);if(t=Math.round(t-n),r)try{var i=Math.round(t/ht)+gt,a=P.getComponentMethod("calendars","getCal")(r),o=a.fromJD(i);return e%12?a.add(o,e,"m"):a.add(o,e/12,"y"),(o.toJD()-gt)*ht+n}catch(e){_.error("invalid ms "+t+" in calendar "+r)}var s=new Date(t+Ct);return s.setUTCMonth(s.getUTCMonth()+e)+n-Ct},ut.findExactDates=function(t,e){for(var n,i,a=0,o=0,s=0,l=0,u=bt(e)&&P.getComponentMethod("calendars","getCal")(e),c=0;c1||g<0||g>1?null:{x:t+l*g,y:e+h*g}}function Ft(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}Ot.segmentsIntersect=Rt,Ot.segmentDistance=function(t,e,r,n,i,a,o,s){if(Rt(t,e,r,n,i,a,o,s))return 0;var l=r-t,u=n-e,c=o-i,h=s-a,f=l*l+u*u,p=c*c+h*h,d=Math.min(Ft(l,u,f,i-t,a-e),Ft(l,u,f,o-t,s-e),Ft(c,h,p,t-i,e-a),Ft(c,h,p,r-i,n-a));return Math.sqrt(d)},Ot.getTextLocation=function(t,e,r,n){if(t===It&&n===Dt||(Pt={},It=t,Dt=n),Pt[r])return Pt[r];var i=t.getPointAtLength(lt(r-n/2,e)),a=t.getPointAtLength(lt(r+n/2,e)),o=Math.atan((a.y-i.y)/(a.x-i.x)),s=t.getPointAtLength(lt(r,e)),l={x:(4*s.x+i.x+a.x)/6,y:(4*s.y+i.y+a.y)/6,theta:o};return Pt[r]=l,l},Ot.clearLocationCache=function(){It=null},Ot.getVisibleSegment=function(t,e,r){var n,i,a=e.left,o=e.right,s=e.top,l=e.bottom,u=0,c=t.getTotalLength(),h=c;function f(e){var r=t.getPointAtLength(e);0===e?n=r:e===c&&(i=r);var u=r.xo?r.x-o:0,h=r.yl?r.y-l:0;return Math.sqrt(u*u+h*h)}for(var p=f(u);p;){if((u+=p+r)>h)return;p=f(u)}for(p=f(h);p;){if(u>(h-=p+r))return;p=f(h)}return{min:u,max:h,len:h-u,total:c,isClosed:0===u&&h===c&&Math.abs(n.x-i.x)<.1&&Math.abs(n.y-i.y)<.1}},Ot.findPointOnPath=function(t,e,r,n){for(var i,a,o,s=(n=n||{}).pathLength||t.getTotalLength(),l=n.tolerance||.001,u=n.iterationLimit||30,c=t.getPointAtLength(0)[r]>t.getPointAtLength(s)[r]?-1:1,h=0,f=0,p=s;h0?p=i:f=i,h++}return a};var Bt=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},Nt=function(t){return t},jt=/^\w*$/,Vt={init2dArray:function(t,e){for(var r=new Array(t),n=0;ne}function Jt(t,e){return t>=e}Wt.findBin=function(t,e,n){if(r(e.start))return n?Math.ceil((t-e.start)/e.size-1e-9)-1:Math.floor((t-e.start)/e.size+1e-9);var i,a,o=0,s=e.length,l=0,u=s>1?(e[s-1]-e[0])/(s-1):1;for(a=u>=0?n?Yt:Xt:n?Jt:Zt,t+=1e-9*u*(n?-1:1)*(u>=0?1:-1);o90&&_.log("Long binary search..."),o-1},Wt.sorterAsc=function(t,e){return t-e},Wt.sorterDes=function(t,e){return e-t},Wt.distinctVals=function(t){var e=t.slice();e.sort(Wt.sorterAsc);for(var r=e.length-1,n=e[r]-e[0]||1,i=n/(r||1)/1e4,a=[e[0]],o=0;oe[o]+i&&(n=Math.min(n,e[o+1]-e[o]),a.push(e[o+1]));return{vals:a,minDiff:n}},Wt.roundUp=function(t,e,r){for(var n,i=0,a=e.length-1,o=0,s=r?0:1,l=r?1:0,u=r?Math.ceil:Math.floor;in.length)&&(i=n.length),r(e)||(e=!1),Qt(n[0])){for(o=new Array(i),a=0;at.length-1)return t[t.length-1];var n=e%1;return n*t[Math.ceil(e)]+(1-n)*t[Math.floor(e)]};var $t={},te={};function ee(t){t&&null!==t.timer&&(clearTimeout(t.timer),t.timer=null)}$t.throttle=function(t,e,r){var n=te[t],i=Date.now();if(!n){for(var a in te)te[a].tsn.ts+e?o():n.timer=setTimeout(function(){o(),n.timer=null},e)},$t.done=function(t){var e=te[t];return e&&e.timer?new Promise(function(t){var r=e.onDone;e.onDone=function(){r&&r(),t(),e.onDone=null}}):Promise.resolve()},$t.clear=function(t){if(t)ee(te[t]),delete te[t];else for(var e in te)$t.clear(e)};var re=function(t,e){if(t>0)return Math.log(t)/Math.LN10;var n=Math.log(Math.min(e[0],e[1]))/Math.LN10;return r(n)||(n=Math.log(Math.max(e[0],e[1]))/Math.LN10-6),n},ne={},ie=t.FP_SAFE,ae=t.BADNUM,oe=ne={};oe.nestedProperty=W,oe.keyedContainer=function(t,e,r,n){var i,a;r=r||"name",n=n||"value";var o={};a=e&&e.length?W(t,e).get():t,e=e||"",a=a||[];var s={};for(i=0;i2)return o[e]=2|o[e],u.set(t,null);if(l){for(i=e;i/g),s=0;sie?ae:r(t)?Number(t):ae:ae},oe.noop=A,oe.identity=Nt,oe.swapAttrs=function(t,e,r,n){r||(r="x"),n||(n="y");for(var i=0;ir?Math.max(r,Math.min(e,t)):Math.max(e,Math.min(r,t))},oe.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},oe.simpleMap=function(t,e,r,n){for(var i=t.length,a=new Array(i),o=0;o-1||u!==1/0&&u>=Math.pow(2,r)?t(e,r,n):s},oe.OptionControl=function(t,e){t||(t={}),e||(e="opt");var r={optionList:[],_newoption:function(n){n[e]=t,r[n.name]=n,r.optionList.push(n)}};return r["_"+e]=t,r},oe.smooth=function(t,e){if((e=Math.round(e)||0)<2)return t;var r,n,i,a,o=t.length,s=2*o,l=2*e-1,u=new Array(l),c=new Array(o);for(r=0;r=s&&(i-=s*Math.floor(i/s)),i<0?i=-1-i:i>=o&&(i=s-1-i),a+=t[i]*u[n];c[r]=a}return c},oe.syncOrAsync=function(t,e,r){var n;function i(){return oe.syncOrAsync(t,e,r)}for(;t.length;)if((n=(0,t.splice(0,1)[0])(e))&&n.then)return n.then(i).then(void 0,oe.promiseError);return r&&r(e)},oe.stripTrailingSlash=function(t){return"/"===t.substr(-1)?t.substr(0,t.length-1):t},oe.noneOrAll=function(t,e,r){if(t){var n,i,a=!1,o=!0;for(n=0;n=0&&a%1==0){var d=i?i[p]:p,g=n?n[d]:d;h(g)&&(t[g].selected=1)}}},oe.getTargetArray=function(t,e){var r=e.target;if("string"==typeof r&&r){var n=oe.nestedProperty(t,r).get();return!!Array.isArray(n)&&n}return!!Array.isArray(r)&&r},oe.minExtend=function(t,e){var r={};"object"!=typeof e&&(e={});var n,i,a,o=Object.keys(t);for(n=0;n1?i+o[1]:"";if(a&&(o.length>1||s.length>4||r))for(;n.test(s);)s=s.replace(n,"$1"+a+"$2");return s+l};var ue=/%{([^\s%{}]*)}/g,ce=/^\w*$/;oe.templateString=function(t,e){var r={};return t.replace(ue,function(t,n){return ce.test(n)?e[n]||"":(r[n]=r[n]||oe.nestedProperty(e,n).get,r[n]()||"")})};oe.subplotSort=function(t,e){for(var r=Math.min(t.length,e.length)+1,n=0,i=0,a=0;a=48&&o<=57,u=s>=48&&s<=57;if(l&&(n=10*n+o-48),u&&(i=10*i+s-48),!l||!u){if(n!==i)return n-i;if(o!==s)return o-s}}return i-n};var he=2e9;oe.seedPseudoRandom=function(){he=2e9},oe.pseudoRandom=function(){var t=he;return he=(69069*he+1)%4294967296,Math.abs(he-t)<429496729?oe.pseudoRandom():he/4294967296};var fe=ne.extendFlat,pe=ne.isPlainObject,de={valType:"flaglist",extras:["none"],flags:["calc","calcIfAutorange","clearAxisTypes","plot","style","colorbars"]},ge={valType:"flaglist",extras:["none"],flags:["calc","calcIfAutorange","plot","legend","ticks","margins","layoutstyle","modebar","camera","arraydraw"]},ve=de.flags.slice().concat(["clearCalc","fullReplot"]),me=ge.flags.slice().concat("layoutReplot"),ye={traces:de,layout:ge,traceFlags:function(){return xe(ve)},layoutFlags:function(){return xe(me)},update:function(t,e){var r=e.editType;if(r&&"none"!==r)for(var n=r.split("+"),i=0;i=0))return t;if(3===o)i[o]>1&&(i[o]=1);else if(i[o]>=1)return t}var s=Math.round(255*i[0])+", "+Math.round(255*i[1])+", "+Math.round(255*i[2]);return a?"rgba("+s+", "+i[3]+")":"rgb("+s+")"}Re.tinyRGB=function(t){var e=t.toRgb();return"rgb("+Math.round(e.r)+", "+Math.round(e.g)+", "+Math.round(e.b)+")"},Re.rgb=function(t){return Re.tinyRGB(s(t))},Re.opacity=function(t){return t?s(t).getAlpha():0},Re.addOpacity=function(t,e){var r=s(t).toRgb();return"rgba("+Math.round(r.r)+", "+Math.round(r.g)+", "+Math.round(r.b)+", "+e+")"},Re.combine=function(t,e){var r=s(t).toRgb();if(1===r.a)return s(t).toRgbString();var n=s(e||Be).toRgb(),i=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},a={r:i.r*(1-r.a)+r.r*r.a,g:i.g*(1-r.a)+r.g*r.a,b:i.b*(1-r.a)+r.b*r.a};return s(a).toRgbString()},Re.contrast=function(t,e,r){var n=s(t);return 1!==n.getAlpha()&&(n=s(Re.combine(t,Be))),(n.isDark()?e?n.lighten(e):Be:r?n.darken(r):Fe).toString()},Re.stroke=function(t,e){var r=s(e);t.style({stroke:Re.tinyRGB(r),"stroke-opacity":r.getAlpha()})},Re.fill=function(t,e){var r=s(e);t.style({fill:Re.tinyRGB(r),"fill-opacity":r.getAlpha()})},Re.clean=function(t){if(t&&"object"==typeof t){var e,r,n,i,a=Object.keys(t);for(e=0;e=0;i--,a++)e=t[i],n[a]=[1-e[0],e[1]];return n},Ve=function(t,e,r,n){var i,a;r?(i=ne.nestedProperty(t,r).get(),a=ne.nestedProperty(t._input,r).get()):(i=t,a=t._input);var o=n+"auto",s=n+"min",u=n+"max",c=i[o],h=i[s],f=i[u],p=i.colorscale;!1===c&&void 0!==h||(h=ne.aggNums(Math.min,null,e)),!1===c&&void 0!==f||(f=ne.aggNums(Math.max,null,e)),h===f&&(h-=.5,f+=.5),i[s]=h,i[u]=f,a[s]=h,a[u]=f,a[o]=!1!==c||void 0===h&&void 0===f,i.autocolorscale&&(p=h*f<0?l.RdBu:h>=0?l.Reds:l.Blues,a.colorscale=p,i.reversescale&&(p=je(p)),i.colorscale=p)},Ue=function(t,e,r,n,i){var a=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);if(r("tickprefix")&&r("showtickprefix",a),r("ticksuffix",i.tickSuffixDflt)&&r("showticksuffix",a),r("showticklabels")){var o=i.font||{},s=e.color===t.color?e.color:o.color;if(ne.coerceFont(r,"tickfont",{family:o.family,size:o.size,color:s}),r("tickangle"),"category"!==n){var l=r("tickformat");!function(t,e){var r,n,i=t.tickformatstops,a=e.tickformatstops=[];if(!Array.isArray(i))return;function o(t,e){return ne.coerce(r,n,Ce.tickformatstops,t,e)}for(var s=0;s0?Number(l):s;else if("string"!=typeof l)e.dtick=s;else{var u=l.charAt(0),c=l.substr(1);((c=r(c)?Number(c):0)<=0||!("date"===i&&"M"===u&&c===Math.round(c)||"log"===i&&"L"===u||"log"===i&&"D"===u&&(1===c||2===c)))&&(e.dtick=s)}var h="date"===i?ne.dateTick0(e.calendar):0,f=n("tick0",h);"date"===i?e.tick0=ne.cleanDate(f,h):r(f)&&"D1"!==l&&"D2"!==l?e.tick0=Number(f):e.tick0=h}else{void 0===n("tickvals")?e.tickmode="auto":n("ticktext")}},We=function(t){return void 0!==l[t]||c(t)},Ye=function(t,e,n,i,a){var o,s=a.prefix,l=a.cLetter,u=s.slice(0,s.length-1),c=s?ne.nestedProperty(t,u).get()||{}:t,h=s?ne.nestedProperty(e,u).get()||{}:e,f=c[l+"min"],p=c[l+"max"],d=c.colorscale;i(s+l+"auto",!(r(f)&&r(p)&&f","#62":">",nbsp:"\xa0","#160":"\xa0",times:"\xd7","#215":"\xd7",plusmn:"\xb1","#177":"\xb1",deg:"\xb0","#176":"\xb0"}},er={},rr=Qe.LINE_SPACING;function nr(t,e){return t.node().getBoundingClientRect()[e]}var ir=/([^$]*)([$]+[^$]*[$]+)([^$]*)/;er.convertToTspans=function(t,r,n){var i=t.text(),a=!t.attr("data-notex")&&"undefined"!=typeof MathJax&&i.match(ir),o=e.select(t.node().parentNode);if(!o.empty()){var s=t.attr("class")?t.attr("class").split(" ")[0]:"text";return s+="-math",o.selectAll("svg."+s).remove(),o.selectAll("g."+s+"-group").remove(),t.style("display",null).attr({"data-unformatted":i,"data-math":"N"}),a?(r&&r._promises||[]).push(new Promise(function(r){t.style("display","none");var u=parseInt(t.node().style.fontSize,10),c={fontSize:u};!function(t,r,n){var i="math-output-"+ne.randstr([],64),a=e.select("body").append("div").attr({id:i}).style({visibility:"hidden",position:"absolute"}).style({"font-size":r.fontSize+"px"}).text((o=t,o.replace(ar,"\\lt ").replace(or,"\\gt ")));var o;MathJax.Hub.Queue(["Typeset",MathJax.Hub,a.node()],function(){var r=e.select("body").select("#MathJax_SVG_glyphs");if(a.select(".MathJax_SVG").empty()||!a.select("svg").node())ne.log("There was an error in the tex syntax.",t),n();else{var i=a.select("svg").node().getBoundingClientRect();n(a.select(".MathJax_SVG"),r,i)}a.remove()})}(a[2],c,function(e,a,c){o.selectAll("svg."+s).remove(),o.selectAll("g."+s+"-group").remove();var h=e&&e.select("svg");if(!h||!h.node())return l(),void r();var f=o.append("g").classed(s+"-group",!0).attr({"pointer-events":"none","data-unformatted":i,"data-math":"Y"});f.node().appendChild(h.node()),a&&a.node()&&h.node().insertBefore(a.node().cloneNode(!0),h.node().firstChild),h.attr({class:s,height:c.height,preserveAspectRatio:"xMinYMin meet"}).style({overflow:"visible","pointer-events":"none"});var p=t.node().style.fill||"black";h.select("g").attr({fill:p,stroke:p});var d=nr(h,"width"),g=nr(h,"height"),v=+t.attr("x")-d*{start:0,middle:.5,end:1}[t.attr("text-anchor")||"start"],m=-(u||nr(t,"height"))/4;"y"===s[0]?(f.attr({transform:"rotate("+[-90,+t.attr("x"),+t.attr("y")]+") translate("+[-d/2,m-g/2]+")"}),h.attr({x:+t.attr("x"),y:+t.attr("y")})):"l"===s[0]?h.attr({x:t.attr("x"),y:m-g/2}):"a"===s[0]?h.attr({x:0,y:m}):h.attr({x:v,y:+t.attr("y")+m-g/2}),n&&n.call(t,f),r(f)})})):l(),t}function l(){o.empty()||(s=t.attr("class")+"-math",o.select("svg."+s).remove()),t.text("").style("white-space","pre"),function(t,r){r=(n=r,function(t,e){if(!t)return"";for(var r=0;r1)for(var a=1;a doesnt match end tag <"+t+">. Pretending it did match.",r),i=o[o.length-1].node}else ne.log("Ignoring unexpected end tag .",r)}mr.test(r)?l():(i=t,o=[{node:t}]);for(var f=r.split(gr),p=0;p|>|>)/g;var sr={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"},lr={sub:"0.3em",sup:"-0.6em"},ur={sub:"-0.21em",sup:"0.42em"},cr="\u200b",hr=["http:","https:","mailto:","",void 0,":"],fr=new RegExp("]*)?/?>","g"),pr=Object.keys(tr.entityToUnicode).map(function(t){return{regExp:new RegExp("&"+t+";","g"),sub:tr.entityToUnicode[t]}}),dr=/(\r\n?|\n)/g,gr=/(<[^<>]*>)/,vr=/<(\/?)([^ >]*)(\s+(.*))?>/i,mr=//i,yr=/(^|[\s"'])style\s*=\s*("([^"]*);?"|'([^']*);?')/i,xr=/(^|[\s"'])href\s*=\s*("([^"]*)"|'([^']*)')/i,br=/(^|[\s"'])target\s*=\s*("([^"\s]*)"|'([^'\s]*)')/i,_r=/(^|[\s"'])popup\s*=\s*("([\w=,]*)"|'([\w=,]*)')/i;function wr(t,e){if(!t)return null;var r=t.match(e);return r&&(r[3]||r[4])}var Mr=/(^|;)\s*color:/;function Ar(t,e,r){var n,i,a,o=r.horizontalAlign,s=r.verticalAlign||"top",l=t.node().getBoundingClientRect(),u=e.node().getBoundingClientRect();return i="bottom"===s?function(){return l.bottom-n.height}:"middle"===s?function(){return l.top+(l.height-n.height)/2}:function(){return l.top},a="right"===o?function(){return l.right-n.width}:"center"===o?function(){return l.left+(l.width-n.width)/2}:function(){return l.left},function(){return n=this.node().getBoundingClientRect(),this.style({top:i()-u.top+"px",left:a()-u.left+"px","z-index":1e3}),this}}er.plainText=function(t){return(t||"").replace(fr," ")},er.lineCount=function(t){return t.selectAll("tspan.line").size()||1},er.positionText=function(t,r,n){return t.each(function(){var t=e.select(this);function i(e,r){return void 0===r?null===(r=t.attr(e))&&(t.attr(e,0),r=0):t.attr(e,r),r}var a=i("x",r),o=i("y",n);"text"===this.nodeName&&t.selectAll("tspan.line").attr({x:a,y:o})})},er.makeEditable=function(t,r){var n=r.gd,i=r.delegate,a=e.dispatch("edit","input","cancel"),o=i||t;if(t.style({"pointer-events":i?"none":"all"}),1!==t.size())throw new Error("boo");function s(){var i,s,u,c;i=e.select(n).select(".svg-container"),s=i.append("div"),u=t.node().style,c=parseFloat(u.fontSize||12),s.classed("plugin-editable editable",!0).style({position:"absolute","font-family":u.fontFamily||"Arial","font-size":c,color:r.fill||u.fill||"black",opacity:1,"background-color":r.background||"transparent",outline:"#ffffff33 1px solid",margin:[-c/8+1,0,0,-1].join("px ")+"px",padding:"0","box-sizing":"border-box"}).attr({contenteditable:!0}).text(r.text||t.attr("data-unformatted")).call(Ar(t,i,r)).on("blur",function(){n._editing=!1,t.text(this.textContent).style({opacity:1});var r,i=e.select(this).attr("class");(r=i?"."+i.split(" ")[0]+"-math-group":"[class*=-math-group]")&&e.select(t.node().parentNode).select(r).style({opacity:0});var o=this.textContent;e.select(this).transition().duration(0).remove(),e.select(document).on("mouseup",null),a.edit.call(t,o)}).on("focus",function(){var t=this;n._editing=!0,e.select(document).on("mouseup",function(){if(e.event.target===t)return!1;document.activeElement===s.node()&&s.node().blur()})}).on("keyup",function(){27===e.event.which?(n._editing=!1,t.style({opacity:1}),e.select(this).style({opacity:0}).on("blur",function(){return!1}).transition().remove(),a.cancel.call(t,this.textContent)):(a.input.call(t,this.textContent),e.select(this).call(Ar(t,i,r)))}).on("keydown",function(){13===e.event.which&&this.blur()}).call(l),t.style({opacity:0});var h,f=o.attr("class");(h=f?"."+f.split(" ")[0]+"-math-group":"[class*=-math-group]")&&e.select(t.node().parentNode).select(h).style({opacity:0})}function l(t){var e=t.node(),r=document.createRange();r.selectNodeContents(e);var n=window.getSelection();n.removeAllRanges(),n.addRange(r),e.focus()}return r.immediate?s():o.on("click",s),e.rebind(t,a,"on")};var kr=function(t){var e=t.marker,n=e.sizeref||1,i=e.sizemin||0,a="area"===e.sizemode?function(t){return Math.sqrt(t/n)}:function(t){return t/n};return function(t){var e=a(t/2);return r(e)&&e>0?Math.max(e,i):0}},Tr={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 ne.isPlainObject(t.marker)&&ne.isArrayOrTypedArray(t.marker.size)}},Sr={},Er=Qe.LINE_SPACING,Cr=f.DESELECTDIM,Lr=Sr={};Lr.font=function(t,e,r,n){ne.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(Oe.fill,n)},Lr.setPosition=function(t,e,r){t.attr("x",e).attr("y",r)},Lr.setSize=function(t,e,r){t.attr("width",e).attr("height",r)},Lr.setRect=function(t,e,r,n,i){t.call(Lr.setPosition,e,r).call(Lr.setSize,n,i)},Lr.translatePoint=function(t,e,n,i){var a=n.c2p(t.x),o=i.c2p(t.y);return!!(r(a)&&r(o)&&e.node())&&("text"===e.node().nodeName?e.attr("x",a).attr("y",o):e.attr("transform","translate("+a+","+o+")"),!0)},Lr.translatePoints=function(t,r,n){t.each(function(t){var i=e.select(this);Lr.translatePoint(t,i,r,n)})},Lr.hideOutsideRangePoint=function(t,e,r,n,i,a){e.attr("display",r.isPtWithinRange(t,i)&&n.isPtWithinRange(t,a)?null:"none")},Lr.hideOutsideRangePoints=function(t,r,n){if(r._hasClipOnAxisFalse){n=n||".point,.textpoint";var i=r.xaxis,a=r.yaxis;t.each(function(r){var o=r[0].trace,s=o.xcalendar,l=o.ycalendar;t.selectAll(n).each(function(t){Lr.hideOutsideRangePoint(t,e.select(this),i,a,s,l)})})}},Lr.crispRound=function(t,e,n){return e&&r(e)?t._context.staticPlot?e:e<1?1:Math.round(e):n||0},Lr.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||"";Oe.stroke(e,n||a.color),Lr.dashLine(e,s,o)},Lr.lineGroupStyle=function(t,r,n,i){t.style("fill","none").each(function(t){var a=(((t||[])[0]||{}).trace||{}).line||{},o=r||a.width||0,s=i||a.dash||"";e.select(this).call(Oe.stroke,n||a.color).call(Lr.dashLine,s,o)})},Lr.dashLine=function(t,e,r){r=+r||0,e=Lr.dashStyle(e,r),t.style({"stroke-dasharray":e,"stroke-width":r+"px"})},Lr.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},Lr.singleFillStyle=function(t){var r=(((e.select(t.node()).data()[0]||[])[0]||{}).trace||{}).fillcolor;r&&t.call(Oe.fill,r)},Lr.fillGroupStyle=function(t){t.style("stroke-width",0).each(function(r){var n=e.select(this);try{n.call(Oe.fill,r[0].trace.fillcolor)}catch(e){ne.error(e,t),n.remove()}})},Lr.symbolNames=[],Lr.symbolFuncs=[],Lr.symbolNeedLines={},Lr.symbolNoDot={},Lr.symbolNoFill={},Lr.symbolList=[],Object.keys(Ke).forEach(function(t){var e=Ke[t];Lr.symbolList=Lr.symbolList.concat([e.n,t,e.n+100,t+"-open"]),Lr.symbolNames[e.n]=t,Lr.symbolFuncs[e.n]=e.f,e.needLine&&(Lr.symbolNeedLines[e.n]=!0),e.noDot?Lr.symbolNoDot[e.n]=!0:Lr.symbolList=Lr.symbolList.concat([e.n+200,t+"-dot",e.n+300,t+"-open-dot"]),e.noFill&&(Lr.symbolNoFill[e.n]=!0)});var zr=Lr.symbolNames.length,Pr="M0,0.5L0.5,0L0,-0.5L-0.5,0Z";function Ir(t,e){var r=t%100;return Lr.symbolFuncs[r](e)+(t>=200?Pr:"")}Lr.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=Lr.symbolNames.indexOf(t))>=0&&(t+=e)}return t%100>=zr||t>=400?0:Math.floor(Math.max(t,0))};var Dr={x1:1,x2:0,y1:0,y2:0},Or={x1:0,x2:0,y1:1,y2:0};Lr.gradient=function(t,r,n,i,a,o){var l=r._fullLayout._defs.select(".gradients").selectAll("#"+n).data([i+a+o],ne.identity);l.exit().remove(),l.enter().append("radial"===i?"radialGradient":"linearGradient").each(function(){var t=e.select(this);"horizontal"===i?t.attr(Dr):"vertical"===i&&t.attr(Or),t.attr("id",n);var r=s(a),l=s(o);t.append("stop").attr({offset:"0%","stop-color":Oe.tinyRGB(l),"stop-opacity":l.getAlpha()}),t.append("stop").attr({offset:"100%","stop-color":Oe.tinyRGB(r),"stop-opacity":r.getAlpha()})}),t.style({fill:"url(#"+n+")","fill-opacity":null})},Lr.initGradients=function(t){var e=t._fullLayout._defs.selectAll(".gradients").data([0]);e.enter().append("g").classed("gradients",!0),e.selectAll("linearGradient,radialGradient").remove()},Lr.singlePointStyle=function(t,e,r,n,i,a){var o=r.marker;!function(t,e,r,n,i,a,o,s){if(P.traceIs(r,"symbols")){var l=kr(r);e.attr("d",function(t){var e;e="various"===t.ms||"various"===a.size?3:Tr.isBubble(r)?l(t.ms):(a.size||6)/2,t.mrc=e;var n=Lr.symbolNumber(t.mx||a.symbol)||0;return t.om=n%200>=100,Ir(n,e)})}e.style("opacity",function(t){return(t.mo+1||a.opacity+1)-1});var u,c,h,f=!1;if(t.so?(h=o.outlierwidth,c=o.outliercolor,u=a.outliercolor):(h=(t.mlw+1||o.width+1||(t.trace?t.trace.marker.line.width:0)+1)-1,c="mlc"in t?t.mlcc=i(t.mlc):ne.isArrayOrTypedArray(o.color)?Oe.defaultLine:o.color,ne.isArrayOrTypedArray(a.color)&&(u=Oe.defaultLine,f=!0),u="mc"in t?t.mcc=n(t.mc):a.color||"rgba(0,0,0,0)"),t.om)e.call(Oe.stroke,u).style({"stroke-width":(h||1)+"px",fill:"none"});else{e.style("stroke-width",h+"px");var p=a.gradient,d=t.mgt;if(d?f=!0:d=p&&p.type,d&&"none"!==d){var g=t.mgc;g?f=!0:g=p.color;var v="g"+s._fullLayout._uid+"-"+r.uid;f&&(v+="-"+t.i),e.call(Lr.gradient,s,v,d,u,g)}else e.call(Oe.fill,u);h&&e.call(Oe.stroke,c)}}(t,e,r,n,i,o,o.line,a)},Lr.pointStyle=function(t,r,n){if(t.size()){var i=r.marker,a=Lr.tryColorscale(i,""),o=Lr.tryColorscale(i,"line");t.each(function(t){Lr.singlePointStyle(t,e.select(this),r,a,o,n)})}},Lr.makeSelectedPointStyleFns=function(t){var e={},r=t.selected||{},n=t.unselected||{},i=t.marker||{},a=r.marker||{},o=n.marker||{},s=i.opacity,l=a.opacity,u=o.opacity,c=void 0!==l,h=void 0!==u;e.opacityFn=function(t){var e=t.mo,r=void 0!==e;if(r||c||h){if(!t.selected)return h?u:Cr*(r?e:s);if(c)return l}};var f=a.color,p=o.color;(f||p)&&(e.colorFn=function(t){if(t.selected){if(f)return f}else if(p)return p});var d=a.size,g=o.size,v=void 0!==d,m=void 0!==g;return(v||m)&&(e.sizeFn=function(t){var e=t.mrc;return t.selected?v?d/2:e:m?g/2:e}),e},Lr.selectedPointStyle=function(t,r){if(t.size()&&r.selectedpoints){var n=Lr.makeSelectedPointStyleFns(r),i=r.marker||{};t.each(function(t){var r=e.select(this),i=n.opacityFn(t);void 0!==i&&r.style("opacity",i)}),n.colorFn&&t.each(function(t){var r=e.select(this),i=n.colorFn(t);i&&Oe.fill(r,i)}),P.traceIs(r,"symbols")&&n.sizeFn&&t.each(function(t){var r=e.select(this),a=t.mx||i.symbol||0,o=n.sizeFn(t);r.attr("d",Ir(Lr.symbolNumber(a),o)),t.mrc2=o})}},Lr.tryColorscale=function(t,e){var r=e?ne.nestedProperty(t,e).get():t,n=r.colorscale,i=r.color;return n&&ne.isArrayOrTypedArray(i)?Je.makeColorScaleFunc(Je.extractScale(n,r.cmin,r.cmax)):ne.identity};var Rr={start:1,end:-1,middle:0,bottom:1,top:-1};function Fr(t,r,n,i){var a=e.select(t.node().parentNode),o=-1!==r.indexOf("top")?"top":-1!==r.indexOf("bottom")?"bottom":"middle",s=-1!==r.indexOf("left")?"end":-1!==r.indexOf("right")?"start":"middle",l=i?i/.8+1:0,u=(er.lineCount(t)-1)*Er+1,c=Rr[s]*l,h=.75*n+Rr[o]*l+(Rr[o]-1)*u*n/2;t.attr("text-anchor",s),a.attr("transform","translate("+c+","+h+")")}function Br(t,e){var n=t.ts||e.textfont.size;return r(n)&&n>0?n:0}Lr.textPointStyle=function(t,r,n){t.each(function(t){var i=e.select(this),a=ne.extractOption(t,r,"tx","text");if(a){var o=t.tp||r.textposition,s=Br(t,r);i.call(Lr.font,t.tf||r.textfont.family,s,t.tc||r.textfont.color).text(a).call(er.convertToTspans,n).call(Fr,o,s,t.mrc)}else i.remove()})},Lr.selectedTextStyle=function(t,r){if(t.size()&&r.selectedpoints){var n=r.selected||{},i=r.unselected||{};t.each(function(t){var a,o=e.select(this),s=t.tc||r.textfont.color,l=t.tp||r.textposition,u=Br(t,r),c=(n.textfont||{}).color,h=(i.textfont||{}).color;t.selected?c&&(a=c):h?a=h:c||(a=Oe.addOpacity(s,Cr)),a&&Oe.fill(o,a),Fr(o,l,u,t.mrc2||t.mrc)})}};var Nr=.5;function jr(t,r,n,i){var a=t[0]-r[0],o=t[1]-r[1],s=n[0]-r[0],l=n[1]-r[1],u=Math.pow(a*a+o*o,Nr/2),c=Math.pow(s*s+l*l,Nr/2),h=(c*c*a-u*u*s)*i,f=(c*c*o-u*u*l)*i,p=3*c*(u+c),d=3*u*(u+c);return[[e.round(r[0]+(p&&h/p),2),e.round(r[1]+(p&&f/p),2)],[e.round(r[0]-(d&&h/d),2),e.round(r[1]-(d&&f/d),2)]]}Lr.smoothopen=function(t,e){if(t.length<3)return"M"+t.join("L");var r,n="M"+t[0],i=[];for(r=1;r=1e4&&(Lr.savedBBoxes={},qr=0),n&&(Lr.savedBBoxes[n]=d),qr++,ne.extendFlat({},d)},Lr.setClipUrl=function(t,r){if(r){var n="#"+r,i=e.select("base");i.size()&&i.attr("href")&&(n=window.location.href.split("#")[0]+n),t.attr("clip-path","url("+n+")")}else t.attr("clip-path",null)},Lr.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}},Lr.setTranslate=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||0,r=r||0,a=a.replace(/(\btranslate\(.*?\);?)/,"").trim(),a=(a+=" translate("+e+", "+r+")").trim(),t[i]("transform",a),a},Lr.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}},Lr.setScale=function(t,e,r){var n=t.attr?"attr":"getAttribute",i=t.attr?"attr":"setAttribute",a=t[n]("transform")||"";return e=e||1,r=r||1,a=a.replace(/(\bscale\(.*?\);?)/,"").trim(),a=(a+=" scale("+e+", "+r+")").trim(),t[i]("transform",a),a},Lr.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 Gr=/translate\([^)]*\)\s*$/;Lr.setTextPointsScale=function(t,r,n){t.each(function(){var t,i=e.select(this),a=i.select("text");if(a.node()){var o=parseFloat(a.attr("x")||0),s=parseFloat(a.attr("y")||0),l=(i.attr("transform")||"").match(Gr);t=1===r&&1===n?[]:["translate("+o+","+s+")","scale("+r+","+n+")","translate("+-o+","+-s+")"],l&&t.push(l),i.attr("transform",t.join(" "))}})};var Wr={PTS_LINESONLY:20,minTolerance:.2,toleranceGrowth:10,maxScreensAway:20},Yr=Ae.dash,Xr=m.extendFlat,Zr={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:Xr({},Yr,{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:Xr({symbol:{valType:"enumerated",values:Sr.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:ze,line:Xr({width:{valType:"number",min:0,arrayOk:!0,editType:"style"},editType:"calc"},De()),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"},De()),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:T({editType:"calc",colorEditType:"style",arrayOk:!0}),r:{valType:"data_array",editType:"calc"},t:{valType:"data_array",editType:"calc"}},Jr=Zr.marker,Kr={r:Zr.r,t:Zr.t,marker:{color:Jr.color,size:Jr.size,symbol:Jr.symbol,opacity:Jr.opacity,editType:"calc"}},Qr=m.extendFlat,$r=ye.overrideAll,tn=Qr({},Ce.domain,{});function en(t,e){return Qr({},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 rn=$r({radialaxis:en(0,{range:{valType:"info_array",items:[{valType:"number"},{valType:"number"}]},domain:tn,orientation:{valType:"number"}}),angularaxis:en(0,{range:{valType:"info_array",items:[{valType:"number",dflt:0},{valType:"number",dflt:360}]},domain:tn}),layout:{direction:{valType:"enumerated",values:["clockwise","counterclockwise"]},orientation:{valType:"angle"}}},"plot","nested"),nn={},an=ne.extendFlat,on=ne.extendDeepAll,sn="_isSubplotObj",ln="_isLinkedToArray",un=[sn,ln,"_arrayAttrRegexps","_deprecated"];function cn(t,e,r){if(!t)return!1;if(t._isLinkedToArray)if(hn(e[r]))r++;else if(r=a.length)return!1;if(2===t.dimensions){if(r++,e.length===r)return t;var o=e[r];if(!hn(o))return!1;t=a[i][o]}else t=a[i]}else t=a}}return t}function hn(t){return t===Math.round(t)&&t>=0}function fn(t){return function(t){nn.crawl(t,function(t,e,r){nn.isValObject(t)?"data_array"===t.valType?(t.role="data",r[e+"src"]={valType:"string",editType:"none"}):!0===t.arrayOk&&(r[e+"src"]={valType:"string",editType:"none"}):ne.isPlainObject(t)&&(t.role="object")})}(t),function(t){nn.crawl(t,function(t,e,r){if(!t)return;var n=t[ln];if(!n)return;delete t[ln],r[e]={items:{}},r[e].items[n]=t,r[e].role="object"})}(t),t}function pn(t,e,r){var n=ne.nestedProperty(t,r),i=on({},e.layoutAttributes);i[sn]=!0,n.set(i)}function dn(t,e,r){var n=ne.nestedProperty(t,r);n.set(on(n.get()||{},e))}nn.IS_SUBPLOT_OBJ=sn,nn.IS_LINKED_TO_ARRAY=ln,nn.DEPRECATED="_deprecated",nn.UNDERSCORE_ATTRS=un,nn.get=function(){var t={};P.allTypes.concat("area").forEach(function(e){t[e]=function(t){var e,r;"area"===t?(e={attributes:Kr},r={}):(e=P.modules[t]._module,r=e.basePlotModule);var n={type:null};on(n,E),on(n,e.attributes),r.attributes&&on(n,r.attributes);n.type=t;var i={meta:e.meta||{},attributes:fn(n)};if(e.layoutAttributes){var a={};on(a,e.layoutAttributes),i.layoutAttributes=fn(a)}return i}(e)});var e,r={};return Object.keys(P.transformsRegistry).forEach(function(t){r[t]=function(t){var e=P.transformsRegistry[t],r=on({},e.attributes);return Object.keys(P.componentsRegistry).forEach(function(e){var n=P.componentsRegistry[e];n.schema&&n.schema.transforms&&n.schema.transforms[t]&&Object.keys(n.schema.transforms[t]).forEach(function(e){dn(r,n.schema.transforms[t][e],e)})}),{attributes:fn(r)}}(t)}),{defs:{valObjects:ne.valObjectMeta,metaKeys:un.concat(["description","role","editType","impliedEdits"]),editType:{traces:ye.traces,layout:ye.layout},impliedEdits:{}},traces:t,layout:function(){var t,e,r={};for(t in on(r,z),P.subplotsRegistry)if((e=P.subplotsRegistry[t]).layoutAttributes)if("cartesian"===e.name)pn(r,e,"xaxis"),pn(r,e,"yaxis");else{var n="subplot"===e.attr?e.name:e.attr;pn(r,e,n)}for(t in r=function(t){return an(t,{radialaxis:rn.radialaxis,angularaxis:rn.angularaxis}),an(t,rn.layout),t}(r),P.componentsRegistry){var i=(e=P.componentsRegistry[t]).schema;if(i&&(i.subplots||i.layout)){var a=i.subplots;if(a&&a.xaxis&&!a.yaxis)for(var o in a.xaxis)delete r.yaxis[o]}else e.layoutAttributes&&dn(r,e.layoutAttributes,e.name)}return{layoutAttributes:fn(r)}}(),transforms:r,frames:(e={frames:ne.extendDeepAll({},Me)},fn(e),e.frames),animation:fn(we)}},nn.crawl=function(t,e,r,n){var i=r||0;n=n||"",Object.keys(t).forEach(function(r){var a=t[r];if(-1===un.indexOf(r)){var o=(n?n+".":"")+r;e(a,r,t,i,o),nn.isValObject(a)||ne.isPlainObject(a)&&"impliedEdits"!==r&&nn.crawl(a,e,i+1,o)}})},nn.isValObject=function(t){return t&&void 0!==t.valType},nn.findArrayAttributes=function(t){var e=[],r=[];function n(n,i,a,o){if(r=r.slice(0,o).concat([i]),n&&("data_array"===n.valType||!0===n.arrayOk)&&!("colorbar"===r[o-1]&&("ticktext"===i||"tickvals"===i))){var s=function(t){return t.join(".")}(r),l=ne.nestedProperty(t,s).get();ne.isArrayOrTypedArray(l)&&e.push(s)}}if(nn.crawl(E,n),t._module&&t._module.attributes&&nn.crawl(t._module.attributes,n),t.transforms)for(var i=t.transforms,a=0;a=t.transforms.length)return!1;n=(r=(P.transformsRegistry[t.transforms[o].type]||{}).attributes)&&r[e[2]],a=3}else if("area"===t.type)n=Kr[i];else{var s=t._module;if(s||(s=(P.modules[t.type||E.type.dflt]||{})._module),!s)return!1;if(!(n=(r=s.attributes)&&r[i])){var l=s.basePlotModule;l&&l.attributes&&(n=l.attributes[i])}n||(n=E[i])}return cn(n,e,a)},nn.getLayoutValObject=function(t,e){return cn(function(t,e){var r,n,i,a,o=t._basePlotModules;if(o){var s;for(r=0;rn?1:-1:+(t.substr(1)||1)-+(e.substr(1)||1)}},vn={};function mn(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=ne.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 yn(t,e){var r=[],n=e[0],i={};if("string"==typeof n)i[n]=e[1];else{if(!ne.isPlainObject(n))return r;i=n}return bn(i,function(t,e,n){r.push({type:"layout",prop:t,value:n})},"",0),r}function xn(t,e){var r,n,i,a,o=[];if(n=e[0],i=e[1],r=e[2],a={},"string"==typeof n)a[n]=i;else{if(!ne.isPlainObject(n))return o;a=n,void 0===r&&(r=i)}return void 0===r&&(r=null),bn(a,function(e,n,i){var a;if(Array.isArray(i)){var s=Math.min(i.length,t.data.length);r&&(s=Math.min(s,r.length)),a=[];for(var l=0;l0?".":"")+i;ne.isPlainObject(a)?bn(a,e,o,n+1):e(o,i,a)}})}vn.manageCommandObserver=function(t,e,r,n){var i={},a=!0;e&&e._commandObserver&&(i=e._commandObserver),i.cache||(i.cache={}),i.lookupTable={};var o=vn.hasSimpleAPICommandBindings(t,r,i.lookupTable);if(e&&e._commandObserver){if(o)return i;if(e._commandObserver.remove)return e._commandObserver.remove(),e._commandObserver=null,i}if(o){mn(t,o,i.cache),i.check=function(){if(a){var e=mn(t,o,i.cache);return e.changed&&n&&void 0!==i.lookupTable[e.value]&&(i.disable(),Promise.resolve(n({value:e.value,type:o.type,prop:o.prop,traces:o.traces,index:i.lookupTable[e.value]})).then(i.enable,i.enable)),e.changed}};for(var s=["plotly_relayout","plotly_redraw","plotly_restyle","plotly_update","plotly_animatingframe","plotly_afterplot"],l=0;l=r.width-20?(a["text-anchor"]="start",a.x=5):(a["text-anchor"]="end",a.x=r._paper.attr("width")-7),n.attr(a);var o=n.select(".js-link-to-tool"),s=n.select(".js-link-spacer"),l=n.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(){An.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()?" - ":"")}},An.sendDataToCloud=function(t){t.emit("plotly_beforeexport");var r=window.PLOTLYENV&&window.PLOTLYENV.BASE_URL||"https://plot.ly",n=e.select(t).append("div").attr("id","hiddenform").style("display","none"),i=n.append("form").attr({action:r+"/external",method:"post",target:"_blank"});return i.append("input").attr({type:"text",name:"data"}).node().value=An.graphJson(t,!1,"keepdata"),i.node().submit(),n.remove(),t.emit("plotly_afterexport"),!1};var Sn,En=["days","shortDays","months","shortMonths","periods","dateTime","date","time","decimal","thousands","grouping","currency"],Cn=["year","month","dayMonth","dayMonthYear"];function Ln(t,e){var r,n,i=t.trace,a=i._arrayAttrs,o={};for(r=0;r=0)return!0}return!1},An.cleanPlot=function(t,e,r,n){var i,a,o=n._basePlotModules||[];for(i=0;i0){var u=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),c=u.left+u.right,h=u.bottom+u.top,f=1-2*s,p=n._container&&n._container.node?n._container.node().getBoundingClientRect():{width:n.width,height:n.height};i=Math.round(f*(p.width-c)),a=Math.round(f*(p.height-h))}else{var d=l?window.getComputedStyle(t):{};i=parseFloat(d.width)||n.width,a=parseFloat(d.height)||n.height}var g=An.layoutAttributes.width.min,v=An.layoutAttributes.height.min;i1,y=!e.height&&Math.abs(n.height-a)>1;(y||m)&&(m&&(n.width=i),y&&(n.height=a)),t._initialAutoSize||(t._initialAutoSize={width:i,height:a}),An.sanitizeMargins(n)},An.supplyLayoutModuleDefaults=function(t,e,r,n){var i,a,o,s=P.componentsRegistry,l=e._basePlotModules,u=P.subplotsRegistry.cartesian;for(i in s)(o=s[i]).includeBasePlot&&o.includeBasePlot(t,e);for(var c in l.length||l.push(u),e._has("cartesian")&&(P.getComponentMethod("grid","contentDefaults")(t,e),u.finalizeSubplots(t,e)),e._subplots)e._subplots[c].sort(ne.subplotSort);for(a=0;a.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||An.doAutoMargin(t)}},An.doAutoMargin=function(t){var e=t._fullLayout;e._size||(e._size={}),e._pushmargin||(e._pushmargin={});var n=e._size,i=JSON.stringify(n),a=Math.max(e.margin.l||0,0),o=Math.max(e.margin.r||0,0),s=Math.max(e.margin.t||0,0),l=Math.max(e.margin.b||0,0),u=e._pushmargin;if(!1!==e.margin.autoexpand)for(var c in u.base={l:{val:0,size:a},r:{val:1,size:o},t:{val:1,size:s},b:{val:0,size:l}},u){var h=u[c].l||{},f=u[c].b||{},p=h.val,d=h.size,g=f.val,v=f.size;for(var m in u){if(r(d)&&u[m].r){var y=u[m].r.val,x=u[m].r.size;if(y>p){var b=(d*y+(x-e.width)*p)/(y-p),_=(x*(1-p)+(d-e.width)*(1-y))/(y-p);b>=0&&_>=0&&b+_>a+o&&(a=b,o=_)}}if(r(v)&&u[m].t){var w=u[m].t.val,M=u[m].t.size;if(w>g){var A=(v*w+(M-e.height)*g)/(w-g),k=(M*(1-g)+(v-e.height)*(1-w))/(w-g);A>=0&&k>=0&&A+k>l+s&&(l=A,s=k)}}}}if(n.l=Math.round(a),n.r=Math.round(o),n.t=Math.round(s),n.b=Math.round(l),n.p=Math.round(e.margin.pad),n.w=Math.round(e.width)-n.l-n.r,n.h=Math.round(e.height)-n.t-n.b,!e._replotting&&"{}"!==i&&i!==JSON.stringify(e._size))return P.call("plot",t)},An.graphJson=function(t,e,r,n,i){(i&&e&&!t._fullData||i&&!e&&!t._fullLayout)&&An.supplyDefaults(t);var a=i?t._fullData:t.data,o=i?t._fullLayout:t.layout,s=(t._transitionData||{})._frames;function l(t){if("function"==typeof t)return null;if(ne.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&&!ne.isPlainObject(t.stream))continue}else if("keepall"!==r&&"string"==typeof(n=t[e+"src"])&&n.indexOf(":")>0)continue;i[e]=l(t[e])}return i}return Array.isArray(t)?t.map(l):ne.isJSDate(t)?ne.ms2DateTimeLocal(+t):t}var u={data:(a||[]).map(function(t){var r=l(t);return e&&delete r.fit,r})};return e||(u.layout=l(o)),t.framework&&t.framework.isPolar&&(u=t.framework.getConfig()),s&&(u.frames=l(s)),"object"===n?u:JSON.stringify(u)},An.modifyFrames=function(t,e){var r,n,i,a=t._transitionData._frames,o=t._transitionData._frameHash;for(r=0;r0&&(t._transitioningWithDuration=!0),t._transitionData._interruptCallbacks.push(function(){h=!0}),i.redraw&&t._transitionData._interruptCallbacks.push(function(){return P.call("redraw",t)}),t._transitionData._interruptCallbacks.push(function(){t.emit("plotly_transitioninterrupted",[])});var n,o,s=0,l=0;function u(){return s++,function(){var r;h||++l!==s||(r=e,t._transitionData&&(function(t){if(t)for(;t.length;)t.shift()}(t._transitionData._interruptCallbacks),Promise.resolve().then(function(){if(i.redraw)return P.call("redraw",t)}).then(function(){t._transitioning=!1,t._transitioningWithDuration=!1,t.emit("plotly_transitioned",[])}).then(r)))}}var f=t._fullLayout._basePlotModules,p=!1;if(r)for(o=0;o=0;a--)if(g[a].enabled){r._indexToPoints=g[a]._indexToPoints;break}n&&n.calc&&(d=n.calc(t,r))}Array.isArray(d)&&d[0]||(d=[{x:Mn,y:Mn}]),d[0].t||(d[0].t={}),d[0].trace=r,u[i]=d}P.getComponentMethod("fx","calc")(t)},An.rehover=function(t){t._fullLayout._rehover&&t._fullLayout._rehover()},An.generalUpdatePerTraceModule=function(t,e,r,n){var i,a=e.traceHash,o={};for(i=0;i0||h<0){var d={left:[-i,0],right:[i,0],top:[0,-i],bottom:[0,i]}[c.side];n.attr("transform","translate("+d+")")}}}k.call(T),M&&(w?k.on(".opacity",null):(b=0,_=!0,k.text(l).on("mouseover.opacity",function(){e.select(this).transition().duration(f.SHOW_PLACEHOLDER).style("opacity",1)}).on("mouseout.opacity",function(){e.select(this).transition().duration(f.HIDE_PLACEHOLDER).style("opacity",0)})),k.call(er.makeEditable,{gd:t}).on("edit",function(e){void 0!==u?P.call("restyle",t,s,e,u):P.call("relayout",t,s,e)}).on("cancel",function(){this.text(this.attr("data-unformatted")).call(T)}).on("input",function(t){this.text(t||" ").call(er.positionText,h.x,h.y)}));return k.classed("js-placeholder",_),d}},On=/ [XY][0-9]* /;var Rn=t.FP_SAFE,Fn=Vn,Bn=Un,Nn=function(t){t._length||t.setScale();var e,r=t._min&&t._max&&t._min.length&&t._max.length;t.autorange&&r&&(t.range=Vn(t),t._r=t.range.slice(),t._rl=ne.simpleMap(t._r,t.r2l),(e=t._input).range=t.range.slice(),e.autorange=t.autorange);if(t._anchorAxis&&t._anchorAxis.rangeslider){var n=t._anchorAxis.rangeslider[t._name];n&&"auto"===n.rangemode&&(n.range=r?Vn(t):t._rangeInitial?t._rangeInitial.slice():t.range.slice()),(e=t._anchorAxis._input).rangeslider[t._name]=ne.extendFlat({},n)}},jn=function(t,e,n){if(!function(t){return t.autorange||t._rangesliderAutorange}(t)||!e)return;t._min||(t._min=[]);t._max||(t._max=[]);n||(n={});t._m||t.setScale();var i,a,o,s,l,u,c,h,f,p,d,g,v=e.length,m=n.padded||!1,y=n.tozero&&("linear"===t.type||"-"===t.type),x="log"===t.type,b=!1;function _(t){if(Array.isArray(t))return b=!0,function(e){return Math.max(Number(t[e]||0),0)};var e=Math.max(Number(t||0),0);return function(){return e}}var w=_((t._m>0?n.ppadplus:n.ppadminus)||n.ppad||0),M=_((t._m>0?n.ppadminus:n.ppadplus)||n.ppad||0),A=_(n.vpadplus||n.vpad),k=_(n.vpadminus||n.vpad);if(!b){if(d=1/0,g=-1/0,x)for(i=0;i0&&(d=s),s>g&&s-Rn&&(d=s),s>g&&s=b&&(s.extrapad||!m)){p=!1;break}_(i,s.val)&&s.pad<=b&&(m||!s.extrapad)&&(v.splice(a,1),a--)}if(p){var T=y&&0===i;v.push({val:i,pad:T?0:b,extrapad:!T&&m})}}}}var S=Math.min(6,v);for(i=0;i=S;i--)T(i)};function Vn(t){var e,r,n,i,a,o,s,l,u=[],c=t._min[0].val,h=t._max[0].val,f=0,p=!1,d=Un(t);for(e=1;e0&&s>0&&l/s>f&&(a=n,o=i,f=l/s);if(c===h){var v=c-1,m=c+1;u="tozero"===t.rangemode?c<0?[v,0]:[0,m]:"nonnegative"===t.rangemode?[Math.max(0,v),Math.max(0,m)]:[v,m]}else f&&("linear"!==t.type&&"-"!==t.type||("tozero"===t.rangemode?(a.val>=0&&(a={val:0,pad:0}),o.val<=0&&(o={val:0,pad:0})):"nonnegative"===t.rangemode&&(a.val-f*d(a)<0&&(a={val:0,pad:0}),o.val<0&&(o={val:1,pad:0})),f=(o.val-a.val)/(t._length-d(a)-d(o))),u=[a.val-f*d(a),o.val+f*d(o)]);return u[0]===u[1]&&("tozero"===t.rangemode?u=u[0]<0?[u[0],0]:u[0]>0?[0,u[0]]:[0,1]:(u=[u[0]-1,u[0]+1],"nonnegative"===t.rangemode&&(u[0]=Math.max(0,u[0])))),p&&u.reverse(),ne.simpleMap(u,t.l2r||Number)}function Un(t){var e=t._length/20;return"domain"===t.constrain&&t._inputDomain&&(e*=(t._inputDomain[1]-t._inputDomain[0])/(t.domain[1]-t.domain[0])),function(t){return t.pad+(t.extrapad?e:0)}}function qn(t){return r(t)&&Math.abs(t)=e}var Wn=t.BADNUM,Yn=function(t,e){return function(t,e){for(var n,i=0,a=0,o=Math.max(1,(t.length-1)/1e3),s=0;s2*a}(t,e)?"date":function(t){for(var e,r=Math.max(1,(t.length-1)/1e3),n=0,i=0,a=0;a2*n}(t)?"category":function(t){if(!t)return!1;for(var e=0;e0)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*a*Math.abs(n-i))}return $n}function s(e,n,i){var a=Jn(e,i||t.calendar);if(a===$n){if(!r(e))return $n;a=Jn(new Date(+e))}return a}function l(e,r,n){return Zn(e,r,n||t.calendar)}function u(e){return t._categories[Math.round(e)]}function c(e){if(t._categoriesMap){var n=t._categoriesMap[e];if(void 0!==n)return n}if(r(e))return+e}function h(n){return r(n)?e.round(t._b+t._m*n,2):$n}function f(e){return(e-t._b)/t._m}t.c2l="log"===t.type?o:Kn,t.l2c="log"===t.type?ti:Kn,t.l2p=h,t.p2l=f,t.c2p="log"===t.type?function(t,e){return h(o(t,e))}:h,t.p2c="log"===t.type?function(t){return ti(f(t))}:f,-1!==["linear","-"].indexOf(t.type)?(t.d2r=t.r2d=t.d2c=t.r2c=t.d2l=t.r2l=Xn,t.c2d=t.c2r=t.l2d=t.l2r=Kn,t.d2p=t.r2p=function(e){return t.l2p(Xn(e))},t.p2d=t.p2r=f,t.cleanPos=Kn):"log"===t.type?(t.d2r=t.d2l=function(t,e){return o(Xn(t),e)},t.r2d=t.r2c=function(t){return ti(Xn(t))},t.d2c=t.r2l=Xn,t.c2d=t.l2r=Kn,t.c2r=o,t.l2d=ti,t.d2p=function(e,r){return t.l2p(t.d2r(e,r))},t.p2d=function(t){return ti(f(t))},t.r2p=function(e){return t.l2p(Xn(e))},t.p2r=f,t.cleanPos=Kn):"date"===t.type?(t.d2r=t.r2d=ne.identity,t.d2c=t.r2c=t.d2l=t.r2l=s,t.c2d=t.c2r=t.l2d=t.l2r=l,t.d2p=t.r2p=function(e,r,n){return t.l2p(s(e,0,n))},t.p2d=t.p2r=function(t,e,r){return l(f(t),e,r)},t.cleanPos=function(e){return ne.cleanDate(e,$n,t.calendar)}):"category"===t.type&&(t.d2c=t.d2l=function(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 $n},t.r2d=t.c2d=t.l2d=u,t.d2r=t.d2l_noadd=c,t.r2c=function(e){var r=c(e);return void 0!==r?r:t.fraction2r(.5)},t.l2r=t.c2r=Kn,t.r2l=c,t.d2p=function(e){return t.l2p(t.r2c(e))},t.p2d=function(t){return u(f(t))},t.r2p=t.d2p,t.p2r=f,t.cleanPos=function(t){return"string"==typeof t&&""!==t?t:Kn(t)}),t.fraction2r=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return t.l2r(r+e*(n-r))},t.r2fraction=function(e){var r=t.r2l(t.range[0]),n=t.r2l(t.range[1]);return(t.r2l(e)-r)/(n-r)},t.cleanRange=function(e,n){n||(n={}),e||(e="range");var a,o,s=ne.nestedProperty(t,e).get();if(o=(o="date"===t.type?ne.dfltRange(t.calendar):"y"===i?Te.DFLTRANGEY:n.dfltRange||Te.DFLTRANGEX).slice(),s&&2===s.length)for("date"===t.type&&(s[0]=ne.cleanDate(s[0],$n,t.calendar),s[1]=ne.cleanDate(s[1],$n,t.calendar)),a=0;a<2;a++)if("date"===t.type){if(!ne.isDateTime(s[a],t.calendar)){t[e]=o;break}if(t.r2l(s[0])===t.r2l(s[1])){var l=ne.constrain(t.r2l(s[0]),ne.MIN_MS+1e3,ne.MAX_MS-1e3);s[0]=t.l2r(l-1e3),s[1]=t.l2r(l+1e3);break}}else{if(!r(s[a])){if(!r(s[1-a])){t[e]=o;break}s[a]=s[1-a]*(a?10:.1)}if(s[a]<-Qn?s[a]=-Qn:s[a]>Qn&&(s[a]=Qn),s[0]===s[1]){var u=Math.max(1,Math.abs(1e-6*s[0]));s[0]-=u,s[1]+=u}}else ne.nestedProperty(t,e).set(o)},t.setScale=function(e){var r=n._size;if(t._categories||(t._categories=[]),t._categoriesMap||(t._categoriesMap={}),t.overlaying){var a=gn.getFromId({_fullLayout:n},t.overlaying);t.domain=a.domain}var o=e&&t._r?"_r":"range",s=t.calendar;t.cleanRange(o);var l=t.r2l(t[o][0],s),u=t.r2l(t[o][1],s);if("y"===i?(t._offset=r.t+(1-t.domain[1])*r.h,t._length=r.h*(t.domain[1]-t.domain[0]),t._m=t._length/(l-u),t._b=-t._m*u):(t._offset=r.l+t.domain[0]*r.w,t._length=r.w*(t.domain[1]-t.domain[0]),t._m=t._length/(u-l),t._b=-t._m*l),!isFinite(t._m)||!isFinite(t._b))throw n._replotting=!1,new Error("Something went wrong with axis scaling")},t.makeCalcdata=function(e,r){var n,i,a,o,s=t.type,l="date"===s&&e[r+"calendar"];if(r in e){if(n=e[r],o=e._length||n.length,ne.isTypedArray(n)&&("linear"===s||"log"===s)){if(o===n.length)return n;if(n.subarray)return n.subarray(0,o)}for(i=new Array(o),a=0;a=t.r2l(t.range[0])&&n<=t.r2l(t.range[1])},t.clearCalc=function(){t._min=[],t._max=[],t._categories=(t._initialCategories||[]).slice(),t._categoriesMap={};for(var e=0;e2e-6||((r-t._forceTick0)/t._minDtick%1+1.000001)%1>2e-6)&&(t._minDtick=0)):t._minDtick=0},pi.saveRangeInitial=function(t,e){for(var r=pi.list(t,"",!0),n=!1,i=0;i.3*f||c(i)||c(a))){var p=n.dtick/2;t+=t+p.8){var o=Number(r.substr(1));a.exactYears>.8&&o%12==0?t=pi.tickIncrement(t,"M6","reverse")+1.5*ai:a.exactMonths>.8?t=pi.tickIncrement(t,"M1","reverse")+15.5*ai:t-=ai/2;var s=pi.tickIncrement(t,r);if(s<=n)return s}return t}(d,t,s.dtick,l,a)),p=d,0;p<=u;)p=pi.tickIncrement(p,s.dtick,!1,a),0;return{start:e.c2r(d,0,a),end:e.c2r(p,0,a),size:s.dtick,_dataSpan:u-l}},pi.prepTicks=function(t){var e=ne.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=ne.constrain(t._length/r,4,9)+1),"radialaxis"===t._name&&(n*=2)),"array"===t.tickmode&&(n*=100),pi.autoTicks(t,Math.abs(e[1]-e[0])/n),t._minDtick>0&&t.dtick<2*t._minDtick&&(t.dtick=t._minDtick,t.tick0=t.l2r(t._forceTick0))}t.tick0||(t.tick0="date"===t.type?"2000-01-01":0),ki(t)},pi.calcTicks=function(t){pi.prepTicks(t);var e=ne.simpleMap(t.range,t.r2l);if("array"===t.tickmode)return function(t){var e,r,n=t.tickvals,i=t.ticktext,a=new Array(n.length),o=ne.simpleMap(t.range,t.r2l),s=1.0001*o[0]-1e-4*o[1],l=1.0001*o[1]-1e-4*o[0],u=Math.min(s,l),c=Math.max(s,l),h=0;Array.isArray(i)||(i=[]);var f="category"===t.type?t.d2l_noadd:t.d2l;"log"===t.type&&"L"!==String(t.dtick).charAt(0)&&(t.dtick="L"+Math.pow(10,Math.floor(Math.min(t.range[0],t.range[1]))-1));for(r=0;ru&&e=n:l<=n)&&!(a.length>s||l===o);l=pi.tickIncrement(l,t.dtick,i,t.calendar))o=l,a.push(l);"angular"===t._id&&360===Math.abs(e[1]-e[0])&&a.pop(),t._tmax=a[a.length-1],t._prevDateHead="",t._inCalcTicks=!0;for(var u=new Array(a.length),c=0;c10||"01-01"!==i.substr(5)?t._tickround="d":t._tickround=+e.substr(1)%12==0?"y":"m";else if(e>=ai&&a<=10||e>=15*ai)t._tickround="d";else if(e>=si&&a<=16||e>=oi)t._tickround="M";else if(e>=li&&a<=19||e>=si)t._tickround="S";else{var o=t.l2r(n+e).replace(/^-/,"").length;t._tickround=Math.max(a,o)-20}}else if(r(e)||"L"===e.charAt(0)){var s=t.range.map(t.r2d||Number);r(e)||(e=Number(e.substr(1))),t._tickround=2-Math.floor(Math.log(e)/Math.LN10+.01);var l=Math.max(Math.abs(s[0]),Math.abs(s[1])),u=Math.floor(Math.log(l)/Math.LN10+.01);Math.abs(u)>3&&(Ei(t.exponentformat)&&!Ci(u)?t._tickexponent=3*Math.round((u-1)/3):t._tickexponent=u)}else t._tickround=null}function Ti(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}}pi.autoTicks=function(t,e){var n;function i(t){return Math.pow(t,Math.floor(Math.log(e)/Math.LN10))}if("date"===t.type){t.tick0=ne.dateTick0(t.calendar);var a=2*e;a>ni?(e/=ni,n=i(10),t.dtick="M"+12*Ai(e,n,mi)):a>ii?(e/=ii,t.dtick="M"+Ai(e,1,yi)):a>ai?(t.dtick=Ai(e,ai,bi),t.tick0=ne.dateTick0(t.calendar,!0)):a>oi?t.dtick=Ai(e,oi,yi):a>si?t.dtick=Ai(e,si,xi):a>li?t.dtick=Ai(e,li,xi):(n=i(10),t.dtick=Ai(e,n,mi))}else if("log"===t.type){t.tick0=0;var o=ne.simpleMap(t.range,t.r2l);if(e>.7)t.dtick=Math.ceil(e);else if(Math.abs(o[1]-o[0])<1){var s=1.5*Math.abs((o[1]-o[0])/e);e=Math.abs(Math.pow(10,o[1])-Math.pow(10,o[0]))/s,n=i(10),t.dtick="L"+Ai(e,n,mi)}else t.dtick=e>.3?"D2":"D1"}else"category"===t.type?(t.tick0=0,t.dtick=Math.ceil(Math.max(e,1))):"angular"===t._id?(t.tick0=0,n=1,t.dtick=Ai(e,n,Mi)):(t.tick0=0,n=i(10),t.dtick=Ai(e,n,mi));if(0===t.dtick&&(t.dtick=1),!r(t.dtick)&&"string"!=typeof t.dtick){var l=t.dtick;throw t.dtick=1,"ax.dtick error: "+String(l)}},pi.tickIncrement=function(t,n,i,a){var o=i?-1:1;if(r(n))return t+o*n;var s=n.charAt(0),l=o*Number(n.substr(1));if("M"===s)return ne.incrementMonth(t,l,a);if("L"===s)return Math.log(Math.pow(10,t)+l)/Math.LN10;if("D"===s){var u="D2"===n?wi:_i,c=t+.01*o,h=ne.roundUp(ne.mod(c,1),u,i);return Math.floor(c)+Math.log(e.round(Math.pow(10,h),1))/Math.LN10}throw"unrecognized dtick "+String(n)},pi.tickFirst=function(t){var n=t.r2l||Number,i=ne.simpleMap(t.range,n),a=i[1]"+s,t._prevDateHead=s));e.text=l}(t,o,n,l):"log"===t.type?function(t,e,n,i,a){var o=t.dtick,s=e.x,l=t.tickformat;"never"===a&&(a="");!i||"string"==typeof o&&"L"===o.charAt(0)||(o="L3");if(l||"string"==typeof o&&"L"===o.charAt(0))e.text=Li(Math.pow(10,s),t,a,i);else if(r(o)||"D"===o.charAt(0)&&ne.mod(s+.01,1)<.1){var u=Math.round(s);-1!==["e","E","power"].indexOf(t.exponentformat)||Ei(t.exponentformat)&&Ci(u)?(e.text=0===u?1:1===u?"10":u>1?"10"+u+"":"10"+ui+-u+"",e.fontSize*=1.25):(e.text=Li(Math.pow(10,s),t,"","fakehover"),"D1"===o&&"y"===t._id.charAt(0)&&(e.dy-=e.fontSize/6))}else{if("D"!==o.charAt(0))throw"unrecognized dtick "+String(o);e.text=String(Math.round(Math.pow(10,ne.mod(s,1)))),e.fontSize*=.75}if("D1"===t.dtick){var c=String(e.text).charAt(0);"0"!==c&&"1"!==c||("y"===t._id.charAt(0)?e.dx-=e.fontSize/4:(e.dy+=e.fontSize/2,e.dx+=(t.range[1]>t.range[0]?1:-1)*e.fontSize*(s<0?.5:.25)))}}(t,o,0,l,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):"angular"===t._id?function(t,e,r,n,i){if("radians"!==t.thetaunit||r)e.text=Li(e.x,t,i,n);else{var a=e.x/180;if(0===a)e.text="0";else{var o=function(t){function e(t,e){return Math.abs(t-e)<=1e-6}var r=function(t){var r=1;for(;!e(Math.round(t*r)/r,t);)r*=10;return r}(t),n=t*r,i=Math.abs(function t(r,n){return e(n,0)?r:t(n,r%n)}(n,r));return[Math.round(n/i),Math.round(r/i)]}(a);if(o[1]>=100)e.text=Li(ne.deg2rad(e.x),t,i,n);else{var s=e.x<0;1===o[1]?1===o[0]?e.text="\u03c0":e.text=o[0]+"\u03c0":e.text=["",o[0],"","\u2044","",o[1],"","\u03c0"].join(""),s&&(e.text=ui+e.text)}}}}(t,o,n,l,i):function(t,e,r,n,i){"never"===i?i="":"all"===t.showexponent&&Math.abs(e.x/t.dtick)<1e-6&&(i="hide");e.text=Li(e.x,t,i,n)}(t,o,0,l,i),t.tickprefix&&!f(t.showtickprefix)&&(o.text=t.tickprefix+o.text),t.ticksuffix&&!f(t.showticksuffix)&&(o.text+=t.ticksuffix),o},pi.hoverLabelText=function(t,e,r){if(r!==ci&&r!==e)return pi.hoverLabelText(t,e)+" - "+pi.hoverLabelText(t,r);var n="log"===t.type&&e<=0,i=pi.tickText(t,t.c2l(n?-e:e),"hover").text;return n?0===e?"0":ui+i:i};var Si=["f","p","n","\u03bc","m","","k","M","G","T"];function Ei(t){return"SI"===t||"B"===t}function Ci(t){return t>14||t<-15}function Li(t,e,n,i){var a=t<0,o=e._tickround,s=n||e.exponentformat||"B",l=e._tickexponent,u=pi.getTickFormat(e),c=e.separatethousands;if(i){var h={exponentformat:s,dtick:"none"===e.showexponent?e.dtick:r(t)&&Math.abs(t)||1,range:"none"===e.showexponent?e.range.map(e.r2d):[0,t||1]};ki(h),o=(Number(h._tickround)||0)+4,l=h._tickexponent,e.hoverformat&&(u=e.hoverformat)}if(u)return e._numFormat(u)(t).replace(/-/g,ui);var f,p=Math.pow(10,-o)/2;if("none"===s&&(l=0),(t=Math.abs(t))"+f+"":"B"===s&&9===l?t+="B":Ei(s)&&(t+=Si[l/3+5]));return a?ui+t:t}function zi(t,e){for(var r=0;r=0,a=u(t,e[1])<=0;return(r||i)&&(n||a)}if(t.tickformatstops&&t.tickformatstops.length>0)switch(t.type){case"date":case"linear":for(e=0;e=a(n))){r=t.tickformatstops[e];break}break;case"log":for(e=0;e1&&e1)for(n=1;na&&(a=u,o=l)}}return a?i(o):Fi};case"rms":return function(t,e){for(var r=0,a=0,o=0;o0;a&&(n="array");var o=r("categoryorder",n);"array"===o&&r("categoryarray"),a||"array"!==o||(e.categoryorder="trace")}},Yi=s.mix,Xi=C.lightFraction,Zi=function(t,e,r,n){var i=(n=n||{}).dfltColor;function a(r,i){return ne.coerce2(t,e,n.attributes,r,i)}var o=a("linecolor",i),s=a("linewidth");r("showline",n.showLine||!!o||!!s)||(delete e.linecolor,delete e.linewidth);var l=a("gridcolor",Yi(i,n.bgColor,n.blend||Xi).toRgbString()),u=a("gridwidth");if(r("showgrid",n.showGrid||!!l||!!u)||(delete e.gridcolor,delete e.gridwidth),!n.noZeroLine){var c=a("zerolinecolor",i),h=a("zerolinewidth");r("zeroline",n.showGrid||!!c||!!h)||(delete e.zerolinecolor,delete e.zerolinewidth)}};function Ji(t,r,n){var i,a,o,s,l,u=[],c=n.map(function(e){return e[t]}),h=e.bisector(r).left;for(i=0;id[1]-.01&&(e.domain=o),ne.noneOrAll(t.domain,e.domain,o)}return n("layer"),e},ra=gn.name2id,na=function(t,e,r,n,i){i&&(e._name=i,e._id=ra(i)),"-"===r("type")&&(!function(t,e){if("-"!==t.type)return;var r=t._id,n=r.charAt(0);-1!==r.indexOf("scene")&&(r=n);var i=function(t,e,r){for(var n=0;n rect").call(Sr.setTranslate,0,0).call(Sr.setScale,1,1),t.plot.call(Sr.setTranslate,e._offset,r._offset).call(Sr.setScale,1,1);var n=t.plot.selectAll(".scatterlayer .trace");n.selectAll(".point").call(Sr.setPointGroupScale,1,1),n.selectAll(".textpoint").call(Sr.setTextPointsScale,1,1),n.call(Sr.hideOutsideRangePoints,t)}function g(e,r){var n,i,o,s=h[e.xaxis._id],l=h[e.yaxis._id],u=[];if(s){i=(n=t._fullLayout[s.axisName])._r,o=s.to,u[0]=(i[0]*(1-r)+r*o[0]-i[0])/(i[1]-i[0])*e.xaxis._length;var c=i[1]-i[0],f=o[1]-o[0];n.range[0]=i[0]*(1-r)+r*o[0],n.range[1]=i[1]*(1-r)+r*o[1],u[2]=e.xaxis._length*(1-r+r*f/c)}else u[0]=0,u[2]=e.xaxis._length;if(l){i=(n=t._fullLayout[l.axisName])._r,o=l.to,u[1]=(i[1]*(1-r)+r*o[1]-i[1])/(i[0]-i[1])*e.yaxis._length;var p=i[1]-i[0],d=o[1]-o[0];n.range[0]=i[0]*(1-r)+r*o[0],n.range[1]=i[1]*(1-r)+r*o[1],u[3]=e.yaxis._length*(1-r+r*d/p)}else u[1]=0,u[3]=e.yaxis._length;!function(e,r){var n,i=[];for(i=[e._id,r._id],n=0;n rect").call(Sr.setTranslate,_,w).call(Sr.setScale,1/x,1/b),e.plot.call(Sr.setTranslate,k,T).call(Sr.setScale,x,b).selectAll(".points").selectAll(".point").call(Sr.setPointGroupScale,1/x,1/b),e.plot.selectAll(".points").selectAll(".textpoint").call(Sr.setTextPointsScale,1/x,1/b)}i&&(s=i());var v=e.ease(n.easing);return t._transitionData._interruptCallbacks.push(function(){return window.cancelAnimationFrame(c),c=null,function(){for(var e={},r=0;rn.duration?(function(){for(var e={},r=0;r0&&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},Ia.prototype.on=Ia.prototype.addListener,Ia.prototype.once=function(t,e){if(!Oa(e))throw TypeError("listener must be a function");var r=!1;function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}return n.listener=e,this.on(t,n),this},Ia.prototype.removeListener=function(t,e){var r,n,i,a;if(!Oa(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(i=(r=this._events[t]).length,n=-1,r===e||Oa(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(Ra(r)){for(a=i;a-- >0;)if(r[a]===e||r[a].listener&&r[a].listener===e){n=a;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},Ia.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(Oa(r=this._events[t]))this.removeListener(t,r);else if(r)for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},Ia.prototype.listeners=function(t){return this._events&&this._events[t]?Oa(this._events[t])?[this._events[t]]:this._events[t].slice():[]},Ia.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(Oa(e))return 1;if(e)return e.length}return 0},Ia.listenerCount=function(t,e){return t.listenerCount(e)};var Ba,Na=Da.EventEmitter,ja={init:function(t){if(t._ev instanceof Na)return t;var e=new Na,r=new Na;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;l4/3-s?o:s},qa.getCursor=function(t,e,r,n){return t="left"===r?0:"center"===r?1:"right"===r?2:ne.constrain(Math.floor(3*t),0,2),e="bottom"===n?0:"middle"===n?1:"top"===n?2:ne.constrain(Math.floor(3*e),0,2),za[e][t]},qa.unhover=Ba.wrapped,qa.unhoverRaw=Ba.raw,qa.init=function(t){var e,r,n,i,a,o,s,l,u=t.gd,c=1,h=f.DBLCLICKDELAY,p=t.element;u._mouseDownTime||(u._mouseDownTime=0),p.style.pointerEvents="all",p.onmousedown=g,Ea?(p._ontouchstart&&p.removeEventListener("touchstart",p._ontouchstart),p._ontouchstart=g,p.addEventListener("touchstart",g,{passive:!1})):p.ontouchstart=g;var d=t.clampFn||function(t,e,r){return Math.abs(t)h&&(c=Math.max(c-1,1)),u._dragged)t.doneFn&&t.doneFn(e);else if(t.clickFn&&t.clickFn(c,o),!l){var r;try{r=new MouseEvent("click",e)}catch(t){var n=Ga(e);(r=document.createEvent("MouseEvents")).initMouseEvent("click",e.bubbles,e.cancelable,e.view,e.detail,e.screenX,e.screenY,n[0],n[1],e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,e.button,e.relatedTarget)}s.dispatchEvent(r)}!function(t){t._dragging=!1,t._replotPending&&P.call("plot",t)}(u),u._dragged=!1}else u._dragged=!1}},qa.coverSlip=Ha;function Wa(t,e,r,n){n=n||ne.identity,Array.isArray(t)&&(e[0][r]=n(t))}var Ya={getSubplot:function(t){return t.subplot||t.xaxis+t.yaxis||t.geo},flat:function(t,e){for(var r=new Array(t.length),n=0;n=0&&r.index-1&&s.length>d&&(s=d>3?s.substr(0,d-3)+"...":s.substr(0,d))}void 0!==t.extraText&&(l+=t.extraText),void 0!==t.zLabel?(void 0!==t.xLabel&&(l+="x: "+t.xLabel+"
"),void 0!==t.yLabel&&(l+="y: "+t.yLabel+"
"),l+=(l?"z: ":"")+t.zLabel):w&&t[i+"Label"]===v?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?"
":"")+t.text),""===l&&(""===s&&r.remove(),l=s);var g=r.select("text.nums").call(Sr.font,t.fontFamily||c,t.fontSize||h,t.fontColor||p).text(l).attr("data-notex",1).call(er.positionText,0,0).call(er.convertToTspans,n),m=r.select("text.name"),y=0;s&&s!==l?(m.call(Sr.font,t.fontFamily||c,t.fontSize||h,f).text(s).attr("data-notex",1).call(er.positionText,0,0).call(er.convertToTspans,n),y=m.node().getBoundingClientRect().width+2*so):(m.remove(),r.select("rect").remove()),r.select("path").style({fill:f,stroke:p});var M,A,k=g.node().getBoundingClientRect(),T=t.xa._offset+(t.x0+t.x1)/2,S=t.ya._offset+(t.y0+t.y1)/2,E=Math.abs(t.x1-t.x0),C=Math.abs(t.y1-t.y0),L=k.width+oo+so+y;t.ty0=x-k.top,t.bx=k.width+2*so,t.by=k.height+2*so,t.anchor="start",t.txwidth=k.width,t.tx2width=y,t.offset=0,a?(t.pos=T,M=S+C/2+L<=_,A=S-C/2-L>=0,"top"!==t.idealAlign&&M||!A?M?(S+=C/2,t.anchor="start"):t.anchor="middle":(S-=C/2,t.anchor="end")):(t.pos=S,M=T+E/2+L<=b,A=T-E/2-L>=0,"left"!==t.idealAlign&&M||!A?M?(T+=E/2,t.anchor="start"):t.anchor="middle":(T-=E/2,t.anchor="end")),g.attr("text-anchor",t.anchor),y&&m.attr("text-anchor",t.anchor),r.attr("transform","translate("+T+","+S+")"+(a?"rotate("+eo+")":""))}),E}function uo(t,r){t.each(function(t){var n=e.select(this);if(t.del)n.remove();else{var i="end"===t.anchor?-1:1,a=n.select("text.nums"),o={start:1,end:-1,middle:0}[t.anchor],s=o*(oo+so),l=s+o*(t.txwidth+so),u=0,c=t.offset;"middle"===t.anchor&&(s-=t.tx2width/2,l+=t.txwidth/2+so),r&&(c*=-ao,u=t.offset*io),n.select("path").attr("d","middle"===t.anchor?"M-"+(t.bx/2+t.tx2width/2)+","+(c-t.by/2)+"h"+t.bx+"v"+t.by+"h-"+t.bx+"Z":"M0,0L"+(i*oo+u)+","+(oo+c)+"v"+(t.by/2-oo)+"h"+i*t.bx+"v-"+t.by+"H"+(i*oo+u)+"V"+(c-oo)+"Z"),a.call(er.positionText,s+u,c+t.ty0-t.by/2+so),t.tx2width&&(n.select("text.name").call(er.positionText,l+o*so+u,c+t.ty0-t.by/2+so),n.select("rect").call(Sr.setRect,l+(o-1)*t.tx2width/2+u,c-t.by/2-1,t.tx2width,t.by+2))}})}function co(t,e){var r=t.index,n=t.trace||{},i=t.cd[0],a=t.cd[r]||{},o=Array.isArray(r)?function(t,e){return ne.castOption(i,r,t)||ne.extractOption({},n,"",e)}:function(t,e){return ne.extractOption(a,n,t,e)};function s(e,r,n){var i=o(r,n);i&&(t[e]=i)}if(s("hoverinfo","hi","hoverinfo"),s("color","hbg","hoverlabel.bgcolor"),s("borderColor","hbc","hoverlabel.bordercolor"),s("fontFamily","htf","hoverlabel.font.family"),s("fontSize","hts","hoverlabel.font.size"),s("fontColor","htc","hoverlabel.font.color"),s("nameLength","hnl","hoverlabel.namelength"),t.posref="y"===e?t.xa._offset+(t.x0+t.x1)/2:t.ya._offset+(t.y0+t.y1)/2,t.x0=ne.constrain(t.x0,0,t.xa._length),t.x1=ne.constrain(t.x1,0,t.xa._length),t.y0=ne.constrain(t.y0,0,t.ya._length),t.y1=ne.constrain(t.y1,0,t.ya._length),void 0!==t.xLabelVal&&(t.xLabel="xLabel"in t?t.xLabel:ri.hoverLabelText(t.xa,t.xLabelVal),t.xVal=t.xa.c2d(t.xLabelVal)),void 0!==t.yLabelVal&&(t.yLabel="yLabel"in t?t.yLabel:ri.hoverLabelText(t.ya,t.yLabelVal),t.yVal=t.ya.c2d(t.yLabelVal)),void 0!==t.zLabelVal&&void 0===t.zLabel&&(t.zLabel=String(t.zLabelVal)),!(isNaN(t.xerr)||"log"===t.xa.type&&t.xerr<=0)){var l=ri.tickText(t.xa,t.xa.c2l(t.xerr),"hover").text;void 0!==t.xerrneg?t.xLabel+=" +"+l+" / -"+ri.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 u=ri.tickText(t.ya,t.ya.c2l(t.yerr),"hover").text;void 0!==t.yerrneg?t.yLabel+=" +"+u+" / -"+ri.tickText(t.ya,t.ya.c2l(t.yerrneg),"hover").text:t.yLabel+=" \xb1 "+u,"y"===e&&(t.distance+=1)}var c=t.hoverinfo||t.trace.hoverinfo;return"all"!==c&&(-1===(c=Array.isArray(c)?c:c.split("+")).indexOf("x")&&(t.xLabel=void 0),-1===c.indexOf("y")&&(t.yLabel=void 0),-1===c.indexOf("z")&&(t.zLabel=void 0),-1===c.indexOf("text")&&(t.text=void 0),-1===c.indexOf("name")&&(t.name=void 0)),t}function ho(t,e){var r,n,i=e.container,a=e.fullLayout,o=e.event,l=!!t.hLinePoint,u=!!t.vLinePoint;if(i.selectAll(".spikeline").remove(),u||l){var c=Oe.combine(a.plot_bgcolor,a.paper_bgcolor);if(l){var h,f,p=t.hLinePoint;r=p&&p.xa,"cursor"===(n=p&&p.ya).spikesnap?(h=o.pointerX,f=o.pointerY):(h=r._offset+p.x,f=n._offset+p.y);var d,g,v=s.readability(p.color,c)<1.5?Oe.contrast(c):p.color,m=n.spikemode,y=n.spikethickness,x=n.spikecolor||v,b=n._boundingBox,_=(b.left+b.right)/2q.width||V<0||V>q.height)return Ua.unhoverRaw(t,n);n.pointerX=n.offsetX,n.pointerY=n.offsetY}if(_="xval"in n?Ya.flat(o,n.xval):Ya.p2c(p,j),w="yval"in n?Ya.flat(o,n.yval):Ya.p2c(d,V),!r(_[0])||!r(w[0]))return ne.warn("Fx.hover failed",n,t),Ua.unhoverRaw(t,n)}var H=1/0;for(A=0;AD&&(F.splice(0,D),H=F[0].distance),c&&0!==R&&0===F.length){I.distance=R,I.index=!1;var Z=T._module.hoverPoints(I,L,z,"closest",s._hoverlayer);if(Z&&(Z=Z.filter(function(t){return t.spikeDistance<=R})),Z&&Z.length){var J,K=Z.filter(function(t){return t.xa.showspikes});if(K.length){var Q=K[0];r(Q.x0)&&r(Q.y0)&&(J=rt(Q),(!N.vLinePoint||N.vLinePoint.spikeDistance>J.spikeDistance)&&(N.vLinePoint=J))}var $=Z.filter(function(t){return t.ya.showspikes});if($.length){var tt=$[0];r(tt.x0)&&r(tt.y0)&&(J=rt(tt),(!N.hLinePoint||N.hLinePoint.spikeDistance>J.spikeDistance)&&(N.hLinePoint=J))}}}}function et(t,e){for(var r,n=null,i=1/0,a=0;a1,gt=Oe.combine(s.plot_bgcolor||Oe.background,s.paper_bgcolor),vt={hovermode:b,rotateLabels:dt,bgColor:gt,container:s._hoverlayer,outerContainer:s._paperdiv,commonLabelOpts:s.hoverlabel,hoverdistance:s.hoverdistance},mt=lo(F,vt,t);if(function(t,e,r){var n,i,a,o,s,l,u,c=0,h=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)?no:1)/2,pmin:0,pmax:"x"===i._id.charAt(0)?r.width:r.height}]}).sort(function(t,e){return t[0].posref-e[0].posref});function f(t){var e=t[0],r=t[t.length-1];if(i=e.pmin-e.pos-e.dp+e.size,a=r.pos+r.dp+r.size-e.pmax,i>.01){for(s=t.length-1;s>=0;s--)t[s].dp+=i;n=!1}if(!(a<.01)){if(i<-.01){for(s=t.length-1;s>=0;s--)t[s].dp-=a;n=!1}if(n){var u=0;for(o=0;oe.pmax&&u++;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos>e.pmax-1&&(l.del=!0,u--);for(o=0;o=0;s--)t[s].dp-=a;for(o=t.length-1;o>=0&&!(u<=0);o--)(l=t[o]).pos+l.dp+l.size>e.pmax&&(l.del=!0,u--)}}}for(;!n&&c<=t.length;){for(c++,n=!0,o=0;o.01&&g.pmin===v.pmin&&g.pmax===v.pmax){for(s=d.length-1;s>=0;s--)d[s].dp+=i;for(p.push.apply(p,d),h.splice(o+1,1),u=0,s=p.length-1;s>=0;s--)u+=p[s].dp;for(a=u/p.length,s=p.length-1;s>=0;s--)p[s].dp-=a;n=!1}else o++}h.forEach(f)}for(o=h.length-1;o>=0;o--){var m=h[o];for(s=m.length-1;s>=0;s--){var y=m[s],x=t[y.i];x.offset=y.dp,x.del=y.del}}}(F,dt?"xa":"ya",s),uo(mt,dt),n.target&&n.target.tagName){var yt=P.getComponentMethod("annotations","hasClickToShow")(t,ft);$a(e.select(n.target),yt?"pointer":"")}if(!n.target||a||!function(t,e,r){if(!r||r.length!==t._hoverdata.length)return!0;for(var n=r.length-1;n>=0;n--){var i=r[n],a=t._hoverdata[n];if(i.curveNumber!==a.curveNumber||String(i.pointNumber)!==String(a.pointNumber))return!0}return!1}(t,0,ht))return;ht&&t.emit("plotly_unhover",{event:n,points:ht});t.emit("plotly_hover",{event:n,points:t._hoverdata,xaxes:p,yaxes:d,xvals:_,yvals:w})}(t,n,i,a)})},to.loneHover=function(t,r){var n={color:t.color||Oe.defaultLine,x0:t.x0||t.x||0,x1:t.x1||t.x||0,y0:t.y0||t.y||0,y1:t.y1||t.y||0,xLabel:t.xLabel,yLabel:t.yLabel,zLabel:t.zLabel,text:t.text,name:t.name,idealAlign:t.idealAlign,borderColor:t.borderColor,fontFamily:t.fontFamily,fontSize:t.fontSize,fontColor:t.fontColor,trace:{index:0,hoverinfo:""},xa:{_offset:0},ya:{_offset:0},index:0},i=e.select(r.container),a=r.outerContainer?e.select(r.outerContainer):i,o={hovermode:"closest",rotateLabels:!1,bgColor:r.bgColor||Oe.background,container:i,outerContainer:a},s=lo([n],o,r.gd);return uo(s,o.rotateLabels),s.node()};var po=to.hover,go=function(t,e,r,n){r("hoverlabel.bgcolor",(n=n||{}).bgcolor),r("hoverlabel.bordercolor",n.bordercolor),r("hoverlabel.namelength",n.namelength),ne.coerceFont(r,"hoverlabel.font",n.font)},vo=T({editType:"none"});vo.family.dflt=Pa.HOVERFONT,vo.size.dflt=Pa.HOVERFONTSIZE;var mo={dragmode:{valType:"enumerated",values:["zoom","pan","select","lasso","orbit","turntable"],dflt:"zoom",editType:"modebar"},hovermode:{valType:"enumerated",values:["x","y","closest",!1],editType:"modebar"},hoverdistance:{valType:"integer",min:-1,dflt:20,editType:"none"},spikedistance:{valType:"integer",min:-1,dflt:20,editType:"none"},hoverlabel:{bgcolor:{valType:"color",editType:"none"},bordercolor:{valType:"color",editType:"none"},font:vo,namelength:{valType:"integer",min:-1,dflt:15,editType:"none"},editType:"none"}};var yo={moduleType:"component",name:"fx",constants:Pa,schema:{layout:mo},attributes:S,layoutAttributes:mo,supplyLayoutGlobalDefaults:function(t,e){go(0,0,function(r,n){return ne.coerce(t,e,mo,r,n)})},supplyDefaults:function(t,e,r,n){go(0,0,function(r,n){return ne.coerce(t,e,S,r,n)},n.hoverlabel)},supplyLayoutDefaults:function(t,e,r){function n(r,n){return ne.coerce(t,e,mo,r,n)}var i;n("dragmode"),e._has("cartesian")?(e._isHoriz=function(t){for(var e=!0,r=0;r.01?k:function(t,e){return Math.abs(t-e)>=2?k(t):t>e?Math.ceil(t):Math.floor(t)};d=M(d,p=M(p,d)),v=M(v,g=M(g,v))}var A=e.select(this);A.append("path").style("vector-effect","non-scaling-stroke").attr("d","M"+p+","+g+"V"+v+"H"+d+"V"+g+"Z").call(Sr.setClipUrl,n.layerClipId),function(t,e,r,n,i,a,o,s){var l;function u(e,r,n){var i=e.append("text").text(r).attr({class:"bartext bartext-"+l,transform:"","text-anchor":"middle","data-notex":1}).call(Sr.font,n).call(er.convertToTspans,t);return i}var c=r[0].trace,h=c.orientation,f=function(t,e){var r=Io(t.text,e);return Do(Ao,r)}(c,n);if(!f)return;if("none"===(l=function(t,e){var r=Io(t.textposition,e);return function(t,e,r){return t.coerceNumber&&(e=+e),-1!==t.values.indexOf(e)?e:void 0!==r?r:t.dflt}(ko,r)}(c,n)))return;var p,d,g,v,m,y,x=function(t,e,r){return Po(To,t.textfont,e,r)}(c,n,t._fullLayout.font),b=function(t,e,r){return Po(So,t.insidetextfont,e,r)}(c,n,x),_=function(t,e,r){return Po(Eo,t.outsidetextfont,e,r)}(c,n,x),w=t._fullLayout.barmode,M="stack"===w||"relative"===w,A=r[n],k=!M||A._outmost,T=Math.abs(a-i)-2*Co,S=Math.abs(s-o)-2*Co;"outside"===l&&(k||(l="inside"));if("auto"===l)if(k){l="inside",p=u(e,f,b),d=Sr.bBox(p.node()),g=d.width,v=d.height;var E=g>0&&v>0,C=g<=T&&v<=S,L=g<=S&&v<=T,z="h"===h?T>=g*(S/v):S>=v*(T/g);E&&(C||L||z)?l="inside":(l="outside",p.remove(),p=null)}else l="inside";if(!p&&(p=u(e,f,"outside"===l?_:b),d=Sr.bBox(p.node()),g=d.width,v=d.height,g<=0||v<=0))return void p.remove();"outside"===l?(y="both"===c.constraintext||"outside"===c.constraintext,m=function(t,e,r,n,i,a,o){var s,l="h"===a?Math.abs(n-r):Math.abs(e-t);l>2*Co&&(s=Co);var u=1;o&&(u="h"===a?Math.min(1,l/i.height):Math.min(1,l/i.width));var c,h,f,p,d=(i.left+i.right)/2,g=(i.top+i.bottom)/2;c=u*i.width,h=u*i.height,"h"===a?er?(f=(t+e)/2,p=n+s+h/2):(f=(t+e)/2,p=n-s-h/2);return zo(d,g,f,p,u,!1)}(i,a,o,s,d,h,y)):(y="both"===c.constraintext||"inside"===c.constraintext,m=function(t,e,r,n,i,a,o){var s,l,u,c,h,f,p,d=i.width,g=i.height,v=(i.left+i.right)/2,m=(i.top+i.bottom)/2,y=Math.abs(e-t),x=Math.abs(n-r);y>2*Co&&x>2*Co?(y-=2*(h=Co),x-=2*h):h=0;d<=y&&g<=x?(f=!1,p=1):d<=x&&g<=y?(f=!0,p=1):dr?(u=(t+e)/2,c=n-h-l/2):(u=(t+e)/2,c=n+h+l/2);return zo(v,m,u,c,p,f)}(i,a,o,s,d,h,y));p.attr("transform",m)}(t,A,i,u,p,d,g,v),n.layerClipId&&Sr.hideOutsideRangePoint(i[u],A.select("text"),a,o,c.xcalendar,c.ycalendar)}else e.select(this).remove();function k(t){return 0===s.bargap&&0===s.bargroupgap?e.round(Math.round(t)-w,2):t}})}),P.getComponentMethod("errorbars","plot")(l,n),l.each(function(t){var r=!1===t[0].trace.cliponaxis;Sr.setClipUrl(e.select(this),r?null:n.layerClipId)})};function zo(t,e,r,n,i,a){var o;return i<1?o="scale("+i+") ":(i=1,o=""),"translate("+(r-i*t)+" "+(n-i*e)+")"+o+(a?"rotate("+a+" "+t+" "+e+") ":"")}function Po(t,e,n,i){var a=Io((e=e||{}).family,n),o=Io(e.size,n),l=Io(e.color,n);return{family:Do(t.family,a,i.family),size:function(t,e,n){if(r(e)){e=+e;var i=t.min,a=t.max,o=void 0!==i&&ea;if(!o)return e}return void 0!==n?n:t.dflt}(t.size,o,i.size),color:function(t,e,r){return s(e).isValid()?e:void 0!==r?r:t.dflt}(t.color,l,i.color)}}function Io(t,e){var r;return Array.isArray(t)?eu+s||!r(l))&&(h=!0,Xo(c,t))}for(var p=0;p1||0===a.bargap&&0===a.bargroupgap&&!t[0].trace.marker.line.width)&&e.select(this).attr("shape-rendering","crispEdges")}),n.selectAll("g.points").each(function(r){var n=e.select(this),i=n.selectAll("path"),a=n.selectAll("text"),o=r[0].trace;Sr.pointStyle(i,o,t),Sr.selectedPointStyle(i,o),a.each(function(t){var r,n=e.select(this);function i(e){var n=r[e];return Array.isArray(n)?n[t.i]:n}n.classed("bartext-inside")?r=o.insidetextfont:n.classed("bartext-outside")&&(r=o.outsidetextfont),r||(r=o.textfont),Sr.font(n,i("family"),i("size"),i("color"))}),Sr.selectedTextStyle(a,o)}),P.getComponentMethod("errorbars","style")(n)},ts=m.extendFlat,es=Qe.LINE_SPACING,rs={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"},ns=function(t,r){var n={};function i(){var o=t._fullLayout,l=o._size;if("function"==typeof n.fillcolor||"function"==typeof n.line.color){var u,c,h=e.extent(("function"==typeof n.fillcolor?n.fillcolor:n.line.color).domain()),f=[],p=[],d="function"==typeof n.line.color?n.line.color:function(){return n.line.color},g="function"==typeof n.fillcolor?n.fillcolor:function(){return n.fillcolor},v=n.levels.end+n.levels.size/100,m=n.levels.size,y=1.001*h[0]-.001*h[1],x=1.001*h[1]-.001*h[0];for(c=0;c<1e5&&(u=n.levels.start+c*m,!(m>0?u>=v:u<=v));c++)u>y&&u0?u>=v:u<=v));c++)u>h[0]&&u1){var U=Math.pow(10,Math.floor(Math.log(V)/Math.LN10));N*=U*ne.roundUp(V/U,[2,5,10]),(Math.abs(n.levels.start)/n.levels.size+1e-6)%1<2e-6&&(F.tick0=0)}F.dtick=N}F.domain=[I+C,I+T-C],F.setScale();var q=o._infolayer.selectAll("g."+r).data([0]);q.enter().append("g").classed(r,!0).classed(rs.colorbar,!0).each(function(){var t=e.select(this);t.append("rect").classed(rs.cbbg,!0),t.append("g").classed(rs.cbfills,!0),t.append("g").classed(rs.cblines,!0),t.append("g").classed(rs.cbaxis,!0).classed(rs.crisp,!0),t.append("g").classed(rs.cbtitleunshift,!0).append("g").classed(rs.cbtitle,!0),t.append("rect").classed(rs.cboutline,!0),t.select(".cbtitle").datum(0)}),q.attr("transform","translate("+Math.round(l.l)+","+Math.round(l.t)+")");var H=q.select(".cbtitleunshift").attr("transform","translate(-"+Math.round(l.l)+",-"+Math.round(l.t)+")");F._axislayer=q.select(".cbaxis");var G=0;if(-1!==["top","bottom"].indexOf(n.titleside)){var W,Y=l.l+(n.x+S)*l.w,X=F.titlefont.size;W="top"===n.titleside?(1-(I+T-C))*l.h+l.t+3+.75*X:(1-(I+C))*l.h+l.t-3-.25*X,tt(F._id+"title",{attributes:{x:Y,y:W,"text-anchor":"start"}})}var Z,J,K,Q=ne.syncOrAsync([_n.previousPromises,function(){if(-1!==["top","bottom"].indexOf(n.titleside)){var r=q.select(".cbtitle"),i=r.select("text"),a=[-n.outlinewidth/2,n.outlinewidth/2],u=r.select(".h"+F._id+"title-math-group").node(),c=15.6;if(i.node()&&(c=parseInt(i.node().style.fontSize,10)*es),u?(G=Sr.bBox(u).height)>c&&(a[1]-=(G-c)/2):i.node()&&!i.classed(rs.jsPlaceholder)&&(G=Sr.bBox(i.node()).height),G){if(G+=5,"top"===n.titleside)F.domain[1]-=G/l.h,a[1]*=-1;else{F.domain[0]+=G/l.h;var v=er.lineCount(i);a[1]+=(1-v)*c}r.attr("transform","translate("+a+")"),F.setScale()}}q.selectAll(".cbfills,.cblines").attr("transform","translate(0,"+Math.round(l.h*(1-F.domain[1]))+")"),F._axislayer.attr("transform","translate(0,"+Math.round(-l.t)+")");var m=q.select(".cbfills").selectAll("rect.cbfill").data(p);m.enter().append("rect").classed(rs.cbfill,!0).style("stroke","none"),m.exit().remove(),m.each(function(t,r){var n=[0===r?h[0]:(p[r]+p[r-1])/2,r===p.length-1?h[1]:(p[r]+p[r+1])/2].map(F.c2p).map(Math.round);r!==p.length-1&&(n[1]+=n[1]>n[0]?1:-1);var i=g(t).replace("e-",""),a=s(i).toHexString();e.select(this).attr({x:L,width:Math.max(M,2),y:e.min(n),height:Math.max(e.max(n)-e.min(n),2),fill:a})});var y=q.select(".cblines").selectAll("path.cbline").data(n.line.color&&n.line.width?f:[]);return y.enter().append("path").classed(rs.cbline,!0),y.exit().remove(),y.each(function(t){e.select(this).attr("d","M"+L+","+(Math.round(F.c2p(t))+n.line.width/2%1)+"h"+M).call(Sr.lineGroupStyle,n.line.width,d(t),n.line.dash)}),F._axislayer.selectAll("g."+F._id+"tick,path").remove(),F._pos=L+M+(n.outlinewidth||0)/2-("outside"===n.ticks?1:0),F.side="right",ne.syncOrAsync([function(){return ri.doTicks(t,F,!0)},function(){if(-1===["top","bottom"].indexOf(n.titleside)){var r=F.titlefont.size,i=F._offset+F._length/2,a=l.l+(F.position||0)*l.w+("right"===F.side?10+r*(F.showticklabels?1:.5):-10-r*(F.showticklabels?.5:0));tt("h"+F._id+"title",{avoid:{selection:e.select(t).selectAll("g."+F._id+"tick"),side:n.titleside,offsetLeft:l.l,offsetTop:0,maxShift:o.width},attributes:{x:a,y:i,"text-anchor":"middle"},transform:{rotate:"-90",offset:0}})}}])},_n.previousPromises,function(){var e=M+n.outlinewidth/2+Sr.bBox(F._axislayer.node()).width;if((b=H.select("text")).node()&&!b.classed(rs.jsPlaceholder)){var i,a=H.select(".h"+F._id+"title-math-group").node();i=a&&-1!==["top","bottom"].indexOf(n.titleside)?Sr.bBox(a).width:Sr.bBox(H.node()).right-L-l.l,e=Math.max(e,i)}var o=2*n.xpad+e+n.borderwidth+n.outlinewidth/2,s=D-O;q.select(".cbbg").attr({x:L-n.xpad-(n.borderwidth+n.outlinewidth)/2,y:O-E,width:Math.max(o,2),height:Math.max(s+2*E,2)}).call(Oe.fill,n.bgcolor).call(Oe.stroke,n.bordercolor).style({"stroke-width":n.borderwidth}),q.selectAll(".cboutline").attr({x:L,y:O+n.ypad+("top"===n.titleside?G:0),width:Math.max(M,2),height:Math.max(s-2*n.ypad-G,2)}).call(Oe.stroke,n.outlinecolor).style({fill:"None","stroke-width":n.outlinewidth});var u=({center:.5,right:1}[n.xanchor]||0)*o;q.attr("transform","translate("+(l.l-u)+","+l.t+")"),_n.autoMargin(t,r,{x:n.x,y:n.y,l:o*({right:1,center:.5}[n.xanchor]||0),r:o*({left:1,center:.5}[n.xanchor]||0),t:s*({bottom:1,middle:.5}[n.yanchor]||0),b:s*({top:1,middle:.5}[n.yanchor]||0)})}],t);if(Q&&Q.then&&(t._promises||[]).push(Q),t._context.edits.colorbarPosition)Ua.init({element:q.node(),gd:t,prepFn:function(){Z=q.attr("transform"),Ka(q)},moveFn:function(t,e){q.attr("transform",Z+" translate("+t+","+e+")"),J=Ua.align(z+t/l.w,A,0,1,n.xanchor),K=Ua.align(I-e/l.h,T,0,1,n.yanchor);var r=Ua.getCursor(J,K,n.xanchor,n.yanchor);Ka(q,r)},doneFn:function(){Ka(q),void 0!==J&&void 0!==K&&P.call("restyle",t,{"colorbar.x":J,"colorbar.y":K},a().index)}});return Q}function $(t,e){return ne.coerce(R,F,Ce,t,e)}function tt(e,r){var n,i=a();n=P.traceIs(i,"markerColorscale")?"marker.colorbar.title":"colorbar.title";var s={propContainer:F,propName:n,traceIndex:i.index,placeholder:o._dfltTitle.colorbar,containerGroup:q.select(".cbtitle")},l="h"===e.charAt(0)?e.substr(1):"h"+e;q.selectAll("."+l+",."+l+"-math-group").remove(),Dn.draw(t,e,ts(s,r||{}))}o._infolayer.selectAll("g."+r).remove()}function a(){var e,n,i=r.substr(2);for(e=0;e=0&&M0){var k=_[n].sort(ds),T=k.map(gs),S=T.length,E={pos:v[n],pts:k};E.min=T[0],E.max=T[S-1],E.mean=ne.mean(T,S),E.sd=ne.stdev(T,S,E.mean),E.q1=ne.interp(T,.25),E.med=ne.interp(T,.5),E.q3=ne.interp(T,.75),E.lf=Math.min(E.q1,T[Math.min(ne.findBin(2.5*E.q1-1.5*E.q3,T,!0)+1,S-1)]),E.uf=Math.max(E.q3,T[Math.max(ne.findBin(2.5*E.q3-1.5*E.q1,T),0)]),E.lo=4*E.q1-3*E.q3,E.uo=4*E.q3-3*E.q1;var C=1.57*(E.q3-E.q1)/Math.sqrt(S);E.ln=E.med-C,E.un=E.med+C,h.push(E)}return function(t,e){if(ne.isArrayOrTypedArray(e.selectedpoints))for(var r=0;r0?(h[0].t={num:l[f],dPos:m,posLetter:s,valLetter:a,labels:{med:hs(t,"median:"),min:hs(t,"min:"),q1:hs(t,"q1:"),q3:hs(t,"q3:"),max:hs(t,"max:"),mean:"sd"===e.boxmean?hs(t,"mean \xb1 \u03c3:"):hs(t,"mean:"),lf:hs(t,"lower fence:"),uf:hs(t,"upper fence:")}},e._fullInput&&"candlestick"===e._fullInput.type&&delete h[0].t.labels,l[f]++,h):[{t:{empty:!0}}]};function ps(t,e,r){var n={text:"tx"};for(var i in n)Array.isArray(e[i])&&(t[n[i]]=e[i][r])}function ds(t,e){return t.v-e.v}function gs(t){return t.v}function vs(t,e,r,n){var i,a=r("y"),o=r("x");if(a&&a.length)i="v",o||r("x0");else{if(!o||!o.length)return void(e.visible=!1);i="h",r("y0")}P.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],n),r("orientation",i)}function ms(t,e,r,n){var i=n.prefix,a=ne.coerce2(t,e,cs,"marker.outliercolor"),o=r("marker.line.outliercolor"),s=r(i+"points",a||o?"suspectedoutliers":void 0);s?(r("jitter","all"===s?.3:0),r("pointpos","all"===s?-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"===s&&(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"),ne.coerceSelectionMarkerOpacity(e,r)}var ys={supplyDefaults:function(t,e,r,n){function i(r,n){return ne.coerce(t,e,cs,r,n)}vs(t,e,i,n),!1!==e.visible&&(i("line.color",(t.marker||{}).color||r),i("line.width"),i("fillcolor",Oe.addOpacity(e.line.color,.5)),i("whiskerwidth"),i("boxmean"),i("notched",void 0!==t.notchwidth)&&i("notchwidth"),ms(t,e,i,{prefix:"box"}))},handleSampleDefaults:vs,handlePointsDefaults:ms};function xs(t,e,r,n){var i,a,o,s,l,u,c,h,f,p,d,g,v=t.cd,m=t.xa,y=t.ya,x=v[0].trace,b=v[0].t,_="violin"===x.type,w=[],M=b.bdPos,A=function(t){return t.pos+b.bPos-u};_&&"both"!==x.side?("positive"===x.side&&(f=function(t){var e=A(t);return yo.inbox(e,e+M,p)}),"negative"===x.side&&(f=function(t){var e=A(t);return yo.inbox(e-M,e,p)})):f=function(t){var e=A(t);return yo.inbox(e-M,e+M,p)},g=_?function(t){return yo.inbox(t.span[0]-l,t.span[1]-l,p)}:function(t){return yo.inbox(t.min-l,t.max-l,p)},"h"===x.orientation?(l=e,u=r,c=g,h=f,i="y",o=y,a="x",s=m):(l=r,u=e,c=f,h=g,i="x",o=m,a="y",s=y);var k=Math.min(1,M/Math.abs(o.r2c(o.range[1])-o.r2c(o.range[0])));function T(t){return(c(t)+h(t))/2}p=t.maxHoverDistance-k,d=t.maxSpikeDistance-k;var S=yo.getDistanceFunction(n,c,h,T);if(yo.getClosest(v,S,t),!1===t.index)return[];var E=v[t.index],C=x.line.color,L=(x.marker||{}).color;Oe.opacity(C)&&x.line.width?t.color=C:Oe.opacity(L)&&x.boxpoints?t.color=L:t.color=x.fillcolor,t[i+"0"]=o.c2p(E.pos+b.bPos-b.bdPos,!0),t[i+"1"]=o.c2p(E.pos+b.bPos+b.bdPos,!0),ri.tickText(o,o.c2l(E.pos),"hover").text,t[i+"LabelVal"]=E.pos;var z=i+"Spike";t.spikeDistance=T(E)*d/p,t[z]=o.c2p(E.pos,!0);var P={},I=["med","min","q1","q3","max"];(x.boxmean||(x.meanline||{}).visible)&&I.push("mean"),(x.boxpoints||x.points)&&I.push("lf","uf");for(var D=0;Dt.uf}),a=Math.max((t.max-t.min)/10,t.q3-t.q1),u=1e-9*a,c=a*Ts,h=[],f=0;if(r.jitter){if(0===a)for(f=1,h=new Array(i.length),e=0;et.lo&&(y.so=!0)}return i}).enter().append("path").classed("point",!0).call(Sr.translatePoints,i,a)}function Cs(t,r,n,i){var a,o,s=r.pos,l=r.val,u=i.bPos,c=i.bPosPxOffset||0;Array.isArray(i.bdPos)?(a=i.bdPos[0],o=i.bdPos[1]):(a=i.bdPos,o=i.bdPos),t.selectAll("path.mean").data(ne.identity).enter().append("path").attr("class","mean").style({fill:"none","vector-effect":"non-scaling-stroke"}).each(function(t){var r=s.c2p(t.pos+u,!0)+c,i=s.c2p(t.pos+u-a,!0)+c,h=s.c2p(t.pos+u+o,!0)+c,f=l.c2p(t.mean,!0),p=l.c2p(t.mean-t.sd,!0),d=l.c2p(t.mean+t.sd,!0);"h"===n.orientation?e.select(this).attr("d","M"+f+","+i+"V"+h+("sd"===n.boxmean?"m0,0L"+p+","+r+"L"+f+","+i+"L"+d+","+r+"Z":"")):e.select(this).attr("d","M"+i+","+f+"H"+h+("sd"===n.boxmean?"m0,0L"+r+","+p+"L"+i+","+f+"L"+r+","+d+"Z":""))})}var Ls={plot:function(t,r,n){var i=t._fullLayout,a=r.xaxis,o=r.yaxis;r.plot.select(".boxlayer").selectAll("g.trace.boxes").data(n).enter().append("g").attr("class","trace boxes").each(function(t){var r,n,s=t[0],l=s.t,u=s.trace,c=s.node3=e.select(this),h=i._numBoxes,f="group"===i.boxmode&&h>1,p=l.dPos*(1-i.boxgap)*(1-i.boxgroupgap)/(f?h:1),d=f?2*l.dPos*((l.num+.5)/h-.5)*(1-i.boxgap):0,g=p*u.whiskerwidth;!0!==u.visible||l.empty?e.select(this).remove():("h"===u.orientation?(r=o,n=a):(r=a,n=o),l.bPos=d,l.bdPos=p,l.wdPos=g,Ss(c,{pos:r,val:n},u,l),u.boxpoints&&Es(c,{x:a,y:o},u,l),u.boxmean&&Cs(c,{pos:r,val:n},u,l))})},plotBoxAndWhiskers:Ss,plotPoints:Es,plotBoxMean:Cs},zs=function(t,e){var r,n,i=t.cd,a=t.xaxis,o=t.yaxis,s=[];if(!1===e)for(r=0;r0;){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]}}}),Us(Gs.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(Zs.local.invalidDate||Zs.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(Zs.local.differentCalendars||Zs.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?"-":"")+Ws(Math.abs(this.year()),4)+"-"+Ws(this.month(),2)+"-"+Ws(this.day(),2)}}),Us(Ys.prototype,{_validateLevel:0,newDate:function(t,e,r){return null==t?this.today():(t.year&&(this._validate(t,e,r,Zs.local.invalidDate||Zs.regionalOptions[""].invalidDate),r=t.day(),e=t.month(),t=t.year()),new Gs(this,t,e,r))},today:function(){return this.fromJSDate(new Date)},epoch:function(t){return this._validate(t,this.minMonth,this.minDay,Zs.local.invalidYear||Zs.regionalOptions[""].invalidYear).year()<0?this.local.epochs[0]:this.local.epochs[1]},formatYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,Zs.local.invalidYear||Zs.regionalOptions[""].invalidYear);return(e.year()<0?"-":"")+Ws(Math.abs(e.year()),4)},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,Zs.local.invalidYear||Zs.regionalOptions[""].invalidYear),12},monthOfYear:function(t,e){var r=this._validate(t,e,this.minDay,Zs.local.invalidMonth||Zs.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,Zs.local.invalidMonth||Zs.regionalOptions[""].invalidMonth),r},daysInYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,Zs.local.invalidYear||Zs.regionalOptions[""].invalidYear);return this.leapYear(e)?366:365},dayOfYear:function(t,e,r){var n=this._validate(t,e,r,Zs.local.invalidDate||Zs.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,Zs.local.invalidDate||Zs.regionalOptions[""].invalidDate);return(Math.floor(this.toJD(n))+2)%this.daysInWeek()},extraInfo:function(t,e,r){return this._validate(t,e,r,Zs.local.invalidDate||Zs.regionalOptions[""].invalidDate),{}},add:function(t,e,r){return this._validate(t,this.minMonth,this.minDay,Zs.local.invalidDate||Zs.regionalOptions[""].invalidDate),this._correctAdd(t,this._add(t,e,r),e,r)},_add:function(t,e,r){if(this._validateLevel++,"d"===r||"w"===r){var n=t.toJD()+e*("w"===r?this.daysInWeek():1),i=t.calendar().fromJD(n);return this._validateLevel--,[i.year(),i.month(),i.day()]}try{var a=t.year()+("y"===r?e:0),o=t.monthOfYear()+("m"===r?e:0);i=t.day();"y"===r?(t.month()!==this.fromMonthOfYear(a,o)&&(o=this.newDate(a,t.month(),this.minDay).monthOfYear()),o=Math.min(o,this.monthsInYear(a)),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o)))):"m"===r&&(!function(t){for(;oe-1+t.minMonth;)a++,o-=e,e=t.monthsInYear(a)}(this),i=Math.min(i,this.daysInMonth(a,this.fromMonthOfYear(a,o))));var s=[a,this.fromMonthOfYear(a,o),i];return this._validateLevel--,s}catch(t){throw this._validateLevel--,t}},_correctAdd:function(t,e,r,n){if(!(this.hasYearZero||"y"!==n&&"m"!==n||0!==e[0]&&t.year()>0==e[0]>0)){var i={y:[1,1,"y"],m:[1,this.monthsInYear(-1),"m"],w:[this.daysInWeek(),this.daysInYear(-1),"d"],d:[1,this.daysInYear(-1),"d"]}[n],a=r<0?-1:1;e=this._add(t,r*i[0]+a*i[1],i[2])}return t.date(e[0],e[1],e[2])},set:function(t,e,r){this._validate(t,this.minMonth,this.minDay,Zs.local.invalidDate||Zs.regionalOptions[""].invalidDate);var n="y"===r?e:t.year(),i="m"===r?e:t.month(),a="d"===r?e:t.day();return"y"!==r&&"m"!==r||(a=Math.min(a,this.daysInMonth(n,i))),t.date(n,i,a)},isValid:function(t,e,r){this._validateLevel++;var n=this.hasYearZero||0!==t;if(n){var i=this.newDate(t,e,this.minDay);n=e>=this.minMonth&&e-this.minMonth=this.minDay&&r-this.minDay13.5?13:1),u=i-(l>2.5?4716:4715);return u<=0&&u--,this.newDate(u,l,s)},toJSDate:function(t,e,r){var n=this._validate(t,e,r,Zs.local.invalidDate||Zs.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 Zs=qs=new Hs;Zs.cdate=Gs,Zs.baseCalendar=Ys,Zs.calendars.gregorian=Xs;var Js=qs.instance();function Ks(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}Ks.prototype=new qs.baseCalendar,Us(Ks.prototype,{name:"Chinese",jdEpoch:1721425.5,hasYearZero:!1,minMonth:0,firstMonth:0,minDay:1,regionalOptions:{"":{name:"Chinese",epochs:["BEC","EC"],monthNumbers:function(t,e){if("string"==typeof t){var r=t.match($s);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(tl);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(el);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 qs.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 qs.local.invalidMonth.replace(/\{0\}/,this.local.name);return r?e>13},isIntercalaryMonth:function(t,e){t.year&&(e=(t=t.year()).month());var r=this.intercalaryMonth(t);return!!r&&r===e},leapYear:function(t){return 0!==this.intercalaryMonth(t)},weekOfYear:function(t,e,r){var n,i=this._validateYear(t,qs.local.invalidyear),a=nl[i-nl[0]],o=a>>9&4095,s=a>>5&15,l=31&a;(n=Js.newDate(o,s,l)).add(4-(n.dayOfWeek()||7),"d");var u=this.toJD(t,e,r)-n.toJD();return 1+Math.floor(u/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=rl[t-rl[0]];if(e>(r>>13?12:11))throw qs.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,a,r,qs.local.invalidDate);t=this._validateYear(n.year()),e=n.month(),r=n.day();var i=this.isIntercalaryMonth(t,e),a=this.toChineseMonth(t,e),o=function(t,e,r,n,i){var a,o,s;if("object"==typeof t)o=t,a=e||{};else{var l="number"==typeof t&&t>=1888&&t<=2111;if(!l)throw new Error("Lunar year outside range 1888-2111");var u="number"==typeof e&&e>=1&&e<=12;if(!u)throw new Error("Lunar month outside range 1 - 12");var c,h="number"==typeof r&&r>=1&&r<=30;if(!h)throw new Error("Lunar day outside range 1 - 30");"object"==typeof n?(c=!1,a=n):(c=!!n,a=i||{}),o={year:t,month:e,day:r,isIntercalary:c}}s=o.day-1;var f,p=rl[o.year-rl[0]],d=p>>13;f=d?o.month>d?o.month:o.isIntercalary?o.month:o.month-1:o.month-1;for(var g=0;g>9&4095,(m>>5&15)-1,(31&m)+s);return a.year=y.getFullYear(),a.month=1+y.getMonth(),a.day=y.getDate(),a}(t,a,r,i);return Js.toJD(o.year,o.month,o.day)},fromJD:function(t){var e=Js.fromJD(t),r=function(t,e,r,n){var i,a;if("object"==typeof t)i=t,a=e||{};else{var o="number"==typeof t&&t>=1888&&t<=2111;if(!o)throw new Error("Solar year outside range 1888-2111");var s="number"==typeof e&&e>=1&&e<=12;if(!s)throw new Error("Solar month outside range 1 - 12");var l="number"==typeof r&&r>=1&&r<=31;if(!l)throw new Error("Solar day outside range 1 - 31");i={year:t,month:e,day:r},a=n||{}}var u=nl[i.year-nl[0]],c=i.year<<9|i.month<<5|i.day;a.year=c>=u?i.year:i.year-1,u=nl[a.year-nl[0]];var h,f=new Date(u>>9&4095,(u>>5&15)-1,31&u),p=new Date(i.year,i.month-1,i.day);h=Math.round((p-f)/864e5);var d,g=rl[a.year-rl[0]];for(d=0;d<13;d++){var v=g&1<<12-d?30:29;if(h>13;!m||d=2&&n<=6},extraInfo:function(t,e,r){var n=this._validate(t,e,r,qs.local.invalidDate);return{century:ol[Math.floor((n.year()-1)/100)+1]||""}},toJD:function(t,e,r){var n=this._validate(t,e,r,qs.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 ol={20:"Fruitbat",21:"Anchovy"};qs.calendars.discworld=al;function sl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}sl.prototype=new qs.baseCalendar,Us(sl.prototype,{name:"Ethiopian",jdEpoch:1724220.5,daysPerMonth:[30,30,30,30,30,30,30,30,30,30,30,30,5],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Ethiopian",epochs:["BEE","EE"],monthNames:["Meskerem","Tikemet","Hidar","Tahesas","Tir","Yekatit","Megabit","Miazia","Genbot","Sene","Hamle","Nehase","Pagume"],monthNamesShort:["Mes","Tik","Hid","Tah","Tir","Yek","Meg","Mia","Gen","Sen","Ham","Neh","Pag"],dayNames:["Ehud","Segno","Maksegno","Irob","Hamus","Arb","Kidame"],dayNamesShort:["Ehu","Seg","Mak","Iro","Ham","Arb","Kid"],dayNamesMin:["Eh","Se","Ma","Ir","Ha","Ar","Ki"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,qs.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,qs.local.invalidYear||qs.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,qs.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,qs.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)}}),qs.calendars.ethiopian=sl;function ll(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function ul(t,e){return t-e*Math.floor(t/e)}ll.prototype=new qs.baseCalendar,Us(ll.prototype,{name:"Hebrew",jdEpoch:347995.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29,29],hasYearZero:!1,minMonth:1,firstMonth:7,minDay:1,regionalOptions:{"":{name:"Hebrew",epochs:["BAM","AM"],monthNames:["Nisan","Iyar","Sivan","Tammuz","Av","Elul","Tishrei","Cheshvan","Kislev","Tevet","Shevat","Adar","Adar II"],monthNamesShort:["Nis","Iya","Siv","Tam","Av","Elu","Tis","Che","Kis","Tev","She","Ada","Ad2"],dayNames:["Yom Rishon","Yom Sheni","Yom Shlishi","Yom Revi'i","Yom Chamishi","Yom Shishi","Yom Shabbat"],dayNamesShort:["Ris","She","Shl","Rev","Cha","Shi","Sha"],dayNamesMin:["Ri","She","Shl","Re","Ch","Shi","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear);return this._leapYear(e.year())},_leapYear:function(t){return ul(7*(t=t<0?t+1:t)+1,19)<7},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,qs.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,qs.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,qs.local.invalidMonth),12===e&&this.leapYear(t)?30:8===e&&5===ul(this.daysInYear(t),10)?30:9===e&&3===ul(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,qs.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,qs.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var i=t<=0?t+1:t,a=this.jdEpoch+this._delay1(i)+this._delay2(i)+r+1;if(e<7){for(var o=7;o<=this.monthsInYear(t);o++)a+=this.daysInMonth(t,o);for(o=1;o=this.toJD(-1===e?1:e+1,7,1);)e++;for(var r=tthis.toJD(e,r,this.daysInMonth(e,r));)r++;var n=t-this.toJD(e,r,1)+1;return this.newDate(e,r,n)}}),qs.calendars.hebrew=ll;function cl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}cl.prototype=new qs.baseCalendar,Us(cl.prototype,{name:"Islamic",jdEpoch:1948439.5,daysPerMonth:[30,29,30,29,30,29,30,29,30,29,30,29],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Islamic",epochs:["BH","AH"],monthNames:["Muharram","Safar","Rabi' al-awwal","Rabi' al-thani","Jumada al-awwal","Jumada al-thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-ahad","Yawm al-ithnayn","Yawm ath-thulaathaa'","Yawm al-arbi'aa'","Yawm al-kham\u012bs","Yawm al-jum'a","Yawm as-sabt"],dayNamesShort:["Aha","Ith","Thu","Arb","Kha","Jum","Sab"],dayNamesMin:["Ah","It","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!1}},leapYear:function(t){return(11*this._validate(t,this.minMonth,this.minDay,qs.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,qs.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,qs.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)}}),qs.calendars.islamic=cl;function hl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}hl.prototype=new qs.baseCalendar,Us(hl.prototype,{name:"Julian",jdEpoch:1721423.5,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Julian",epochs:["BC","AD"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"mm/dd/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,qs.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,qs.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,qs.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)}}),qs.calendars.julian=hl;function fl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}function pl(t,e){return t-e*Math.floor(t/e)}function dl(t,e){return pl(t-1,e)+1}fl.prototype=new qs.baseCalendar,Us(fl.prototype,{name:"Mayan",jdEpoch:584282.5,hasYearZero:!0,minMonth:0,firstMonth:0,minDay:0,regionalOptions:{"":{name:"Mayan",epochs:["",""],monthNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],monthNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"],dayNames:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesShort:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],dayNamesMin:["0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19"],digits:null,dateFormat:"YYYY.m.d",firstDay:0,isRTL:!1,haabMonths:["Pop","Uo","Zip","Zotz","Tzec","Xul","Yaxkin","Mol","Chen","Yax","Zac","Ceh","Mac","Kankin","Muan","Pax","Kayab","Cumku","Uayeb"],tzolkinMonths:["Imix","Ik","Akbal","Kan","Chicchan","Cimi","Manik","Lamat","Muluc","Oc","Chuen","Eb","Ben","Ix","Men","Cib","Caban","Etznab","Cauac","Ahau"]}},leapYear:function(t){return this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear),!1},formatYear:function(t){t=this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear).year();var e=Math.floor(t/400);return t%=400,t+=t<0?400:0,e+"."+Math.floor(t/20)+"."+t%20},forYear:function(t){if((t=t.split(".")).length<3)throw"Invalid Mayan year";for(var e=0,r=0;r19||r>0&&n<0)throw"Invalid Mayan year";e=20*e+n}return e},monthsInYear:function(t){return this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear),18},weekOfYear:function(t,e,r){return this._validate(t,e,r,qs.local.invalidDate),0},daysInYear:function(t){return this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear),360},daysInMonth:function(t,e){return this._validate(t,e,this.minDay,qs.local.invalidMonth),20},daysInWeek:function(){return 5},dayOfWeek:function(t,e,r){return this._validate(t,e,r,qs.local.invalidDate).day()},weekDay:function(t,e,r){return this._validate(t,e,r,qs.local.invalidDate),!0},extraInfo:function(t,e,r){var n=this._validate(t,e,r,qs.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=pl((t-=this.jdEpoch)+8+340,365);return[Math.floor(e/20)+1,pl(e,20)]},_toTzolkin:function(t){return[dl((t-=this.jdEpoch)+20,20),dl(t+4,13)]},toJD:function(t,e,r){var n=this._validate(t,e,r,qs.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)}}),qs.calendars.mayan=fl;function vl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}vl.prototype=new qs.baseCalendar;var ml=qs.instance("gregorian");Us(vl.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,qs.local.invalidYear||qs.regionalOptions[""].invalidYear);return ml.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,qs.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,qs.local.invalidMonth);(t=n.year())<0&&t++;for(var i=n.day(),a=1;a=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)}}),qs.calendars.nanakshahi=vl;function yl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}yl.prototype=new qs.baseCalendar,Us(yl.prototype,{name:"Nepali",jdEpoch:1700709.5,daysPerMonth:[31,31,32,32,31,30,30,29,30,29,30,30],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,daysPerYear:365,regionalOptions:{"":{name:"Nepali",epochs:["BBS","ABS"],monthNames:["Baisakh","Jestha","Ashadh","Shrawan","Bhadra","Ashwin","Kartik","Mangsir","Paush","Mangh","Falgun","Chaitra"],monthNamesShort:["Bai","Je","As","Shra","Bha","Ash","Kar","Mang","Pau","Ma","Fal","Chai"],dayNames:["Aaitabaar","Sombaar","Manglbaar","Budhabaar","Bihibaar","Shukrabaar","Shanibaar"],dayNamesShort:["Aaita","Som","Mangl","Budha","Bihi","Shukra","Shani"],dayNamesMin:["Aai","So","Man","Bu","Bi","Shu","Sha"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:1,isRTL:!1}},leapYear:function(t){return this.daysInYear(t)!==this.daysPerYear},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-n.dayOfWeek(),"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInYear:function(t){if(t=this._validate(t,this.minMonth,this.minDay,qs.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,qs.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,qs.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var i=qs.instance(),a=0,o=e,s=t;this._createMissingCalendarData(t);var l=t-(o>9||9===o&&r>=this.NEPALI_CALENDAR_DATA[s][0]?56:57);for(9!==e&&(a=r,o--);9!==o;)o<=0&&(o=12,s--),a+=this.NEPALI_CALENDAR_DATA[s][o],o--;return 9===e?(a+=r-this.NEPALI_CALENDAR_DATA[s][0])<0&&(a+=i.daysInYear(l)):a+=this.NEPALI_CALENDAR_DATA[s][9]-this.NEPALI_CALENDAR_DATA[s][0],i.newDate(l,1,1).add(a,"d").toJD()},fromJD:function(t){var e=qs.instance().fromJD(t),r=e.year(),n=e.dayOfYear(),i=r+56;this._createMissingCalendarData(i);for(var a=9,o=this.NEPALI_CALENDAR_DATA[i][0],s=this.NEPALI_CALENDAR_DATA[i][a]-o+1;n>s;)++a>12&&(a=1,i++),s+=this.NEPALI_CALENDAR_DATA[i][a];var l=this.NEPALI_CALENDAR_DATA[i][a]-(s-n);return this.newDate(i,a,l)},_createMissingCalendarData:function(t){var e=this.daysPerMonth.slice(0);e.unshift(17);for(var r=t-1;r0?474:473))%2820+474+38)%2816<682},weekOfYear:function(t,e,r){var n=this.newDate(t,e,r);return n.add(-(n.dayOfWeek()+1)%7,"d"),Math.floor((n.dayOfYear()-1)/7)+1},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,qs.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,qs.local.invalidDate);t=n.year(),e=n.month(),r=n.day();var i=t-(t>=0?474:473),a=474+bl(i,2820);return r+(e<=7?31*(e-1):30*(e-1)+6)+Math.floor((682*a-110)/2816)+365*(a-1)+1029983*Math.floor(i/2820)+this.jdEpoch-1},fromJD:function(t){var e=(t=Math.floor(t)+.5)-this.toJD(475,1,1),r=Math.floor(e/1029983),n=bl(e,1029983),i=2820;if(1029982!==n){var a=Math.floor(n/366),o=bl(n,366);i=Math.floor((2134*a+2816*o+2815)/1028522)+a+1}var s=i+2820*r+474;s=s<=0?s-1:s;var l=t-this.toJD(s,1,1)+1,u=l<=186?Math.ceil(l/31):Math.ceil((l-6)/30),c=t-this.toJD(s,u,1)+1;return this.newDate(s,u,c)}}),qs.calendars.persian=xl,qs.calendars.jalali=xl;var _l=qs.instance();function wl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}wl.prototype=new qs.baseCalendar,Us(wl.prototype,{name:"Taiwan",jdEpoch:2419402.5,yearsOffset:1911,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Taiwan",epochs:["BROC","ROC"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:1,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear);t=this._t2gYear(e.year());return _l.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear);t=this._t2gYear(n.year());return _l.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,qs.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,qs.local.invalidDate);t=this._t2gYear(n.year());return _l.toJD(t,n.month(),n.day())},fromJD:function(t){var e=_l.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)}}),qs.calendars.taiwan=wl;var Ml=qs.instance();function Al(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}Al.prototype=new qs.baseCalendar,Us(Al.prototype,{name:"Thai",jdEpoch:1523098.5,yearsOffset:543,daysPerMonth:[31,28,31,30,31,30,31,31,30,31,30,31],hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Thai",epochs:["BBE","BE"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],digits:null,dateFormat:"dd/mm/yyyy",firstDay:0,isRTL:!1}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear);t=this._t2gYear(e.year());return Ml.leapYear(t)},weekOfYear:function(t,e,r){var n=this._validate(t,this.minMonth,this.minDay,qs.local.invalidYear);t=this._t2gYear(n.year());return Ml.weekOfYear(t,n.month(),n.day())},daysInMonth:function(t,e){var r=this._validate(t,e,this.minDay,qs.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,qs.local.invalidDate);t=this._t2gYear(n.year());return Ml.toJD(t,n.month(),n.day())},fromJD:function(t){var e=Ml.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)}}),qs.calendars.thai=Al;function kl(t){this.local=this.regionalOptions[t||""]||this.regionalOptions[""]}kl.prototype=new qs.baseCalendar,Us(kl.prototype,{name:"UmmAlQura",hasYearZero:!1,minMonth:1,firstMonth:1,minDay:1,regionalOptions:{"":{name:"Umm al-Qura",epochs:["BH","AH"],monthNames:["Al-Muharram","Safar","Rabi' al-awwal","Rabi' Al-Thani","Jumada Al-Awwal","Jumada Al-Thani","Rajab","Sha'aban","Ramadan","Shawwal","Dhu al-Qi'dah","Dhu al-Hijjah"],monthNamesShort:["Muh","Saf","Rab1","Rab2","Jum1","Jum2","Raj","Sha'","Ram","Shaw","DhuQ","DhuH"],dayNames:["Yawm al-Ahad","Yawm al-Ithnain","Yawm al-Thal\u0101th\u0101\u2019","Yawm al-Arba\u2018\u0101\u2019","Yawm al-Kham\u012bs","Yawm al-Jum\u2018a","Yawm al-Sabt"],dayNamesMin:["Ah","Ith","Th","Ar","Kh","Ju","Sa"],digits:null,dateFormat:"yyyy/mm/dd",firstDay:6,isRTL:!0}},leapYear:function(t){var e=this._validate(t,this.minMonth,this.minDay,qs.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,qs.local.invalidMonth).toJD()-24e5+.5,n=0,i=0;ir)return Tl[n]-Tl[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,qs.local.invalidDate),i=12*(n.year()-1)+n.month()-15292;return n.day()+Tl[i-1]-1+24e5-.5},fromJD:function(t){for(var e=t-24e5+.5,r=0,n=0;ne);n++)r++;var i=r+15292,a=Math.floor((i-1)/12),o=a+1,s=i-12*a,l=e-Tl[r-1]+1;return this.newDate(o,s,l)},isValid:function(t,e,r){var n=qs.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 i=qs.baseCalendar.prototype._validate.apply(this,arguments);if(i.year<1276||i.year>1500)throw n.replace(/\{0\}/,this.local.name);return i}}),qs.calendars.ummalqura=kl;var Tl=[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];Us(qs.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"}),qs.local=qs.regionalOptions[""],Us(qs.cdate.prototype,{formatDate:function(t,e){return"string"!=typeof t&&(e=t,t=""),this._calendar.formatDate(t||"",this,e)}}),Us(qs.baseCalendar.prototype,{UNIX_EPOCH:qs.instance().newDate(1970,1,1).toJD(),SECS_PER_DAY:86400,TICKS_EPOCH:qs.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 qs.local.invalidFormat||qs.regionalOptions[""].invalidFormat;t=t||this.local.dateFormat;for(var n,i,a,o,s=(r=r||{}).dayNamesShort||this.local.dayNamesShort,l=r.dayNames||this.local.dayNames,u=r.monthNumbers||this.local.monthNumbers,c=r.monthNamesShort||this.local.monthNamesShort,h=r.monthNames||this.local.monthNames,f=(r.calculateWeek||this.local.calculateWeek,function(e,r){for(var n=1;_+n1}),p=function(t,e,r,n){var i=""+e;if(f(t,n))for(;i.length1},y=function(t,r){var n=m(t,r),i=[2,3,n?4:2,n?4:2,10,11,20]["oyYJ@!".indexOf(t)+1],a=new RegExp("^-?\\d{1,"+i+"}"),o=e.substring(A).match(a);if(!o)throw(qs.local.missingNumberAt||qs.regionalOptions[""].missingNumberAt).replace(/\{0\}/,A);return A+=o[0].length,parseInt(o[0],10)},x=this,b=function(){if("function"==typeof s){m("m");var t=s.call(x,e.substring(A));return A+=t.length,t}return y("m")},_=function(t,r,n,i){for(var a=m(t,i)?n:r,o=0;o-1){f=1,p=d;for(var S=this.daysInMonth(h,f);p>S;S=this.daysInMonth(h,f))f++,p-=S}return c>-1?this.fromJD(c):this.newDate(h,f,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)}});var Sl=qs,El=t.EPOCHJD,Cl=t.ONEDAY,Ll={valType:"enumerated",values:Object.keys(Sl.calendars),editType:"calc",dflt:"gregorian"},zl=function(t,e,r,n){var i={};return i[r]=Ll,ne.coerce(t,e,i,r,n)},Pl="##",Il={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:Pl,w:Pl,c:{0:"D M d %X yyyy","-":"D M d %X yyyy"},x:{0:"mm/dd/yyyy","-":"mm/dd/yyyy"}};var Dl={};function Ol(t){var e=Dl[t];return e||(e=Dl[t]=Sl.instance(t))}function Rl(t){return ne.extendFlat({},Ll,{description:t})}function Fl(t){return"Sets the calendar system to use with `"+t+"` date data."}var Bl={xcalendar:Rl(Fl("x"))},Nl=ne.extendFlat({},Bl,{ycalendar:Rl(Fl("y"))}),jl=ne.extendFlat({},Nl,{zcalendar:Rl(Fl("z"))}),Vl=Rl(["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(" ")),Ul={moduleType:"component",name:"calendars",schema:{traces:{scatter:Nl,bar:Nl,box:Nl,heatmap:Nl,contour:Nl,histogram:Nl,histogram2d:Nl,histogram2dcontour:Nl,scatter3d:jl,surface:jl,mesh3d:jl,scattergl:Nl,ohlc:Bl,candlestick:Bl},layout:{calendar:Rl(["Sets the default calendar system to use for interpreting and","displaying dates throughout the plot."].join(" "))},subplots:{xaxis:{calendar:Vl},yaxis:{calendar:Vl},scene:{xaxis:{calendar:Vl},yaxis:{calendar:Vl},zaxis:{calendar:Vl}},polar:{radialaxis:{calendar:Vl}}},transforms:{filter:{valuecalendar:Rl(["Sets the calendar system to use for `value`, if it is a date."].join(" ")),targetcalendar:Rl(["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:Ll,handleDefaults:zl,handleTraceDefaults:function(t,e,r,n){for(var i=0;in?e=!0:r=10)return null;var n=1/0;var i=-1/0;var a=e.length;for(var o=0;o0&&(p=t.dxydi([],i-1,o,0,s),m.push(l[0]+p[0]/3),y.push(l[1]+p[1]/3),d=t.dxydi([],i-1,o,1,s),m.push(f[0]-d[0]/3),y.push(f[1]-d[1]/3)),m.push(f[0]),y.push(f[1]),l=f;else for(i=t.a2i(e),u=Math.floor(Math.max(0,Math.min(C-2,i))),c=i-u,b.length=C,b.crossLength=L,b.xy=function(e){return t.evalxy([],i,e)},b.dxy=function(e,r){return t.dxydj([],u,e,c,r)},a=0;a0&&(g=t.dxydj([],u,a-1,c,0),m.push(l[0]+g[0]/3),y.push(l[1]+g[1]/3),v=t.dxydj([],u,a-1,c,1),m.push(f[0]-v[0]/3),y.push(f[1]-v[1]/3)),m.push(f[0]),y.push(f[1]),l=f;return b.axisLetter=r,b.axis=x,b.crossAxis=A,b.value=e,b.constvar=n,b.index=h,b.x=m,b.y=y,b.smoothing=A.smoothing,b}function I(e){var i,a,o,s,l,u=[],c=[],h={};if(h.length=y.length,h.crossLength=M.length,"b"===r)for(o=Math.max(0,Math.min(L-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)},i=0;iy.length-1||b.push(hu(I(a),{color:x.gridcolor,width:x.gridwidth}));for(h=u;hy.length-1||d<0||d>y.length-1))for(g=y[o],v=y[d],i=0;iy[y.length-1]||_.push(hu(P(p),{color:x.minorgridcolor,width:x.minorgridwidth}));x.startline&&w.push(hu(I(0),{color:x.startlinecolor,width:x.startlinewidth})),x.endline&&w.push(hu(I(y.length-1),{color:x.endlinecolor,width:x.endlinewidth}))}else{for(s=5e-15,u=(l=[Math.floor((y[y.length-1]-x.tick0)/x.dtick*(1+s)),Math.ceil((y[0]-x.tick0)/x.dtick/(1+s))].sort(function(t,e){return t-e}))[0],c=l[1],h=u;h<=c;h++)f=x.tick0+x.dtick*h,b.push(hu(P(f),{color:x.gridcolor,width:x.gridwidth}));for(h=u-1;hy[y.length-1]||_.push(hu(P(p),{color:x.minorgridcolor,width:x.minorgridwidth}));x.startline&&w.push(hu(P(y[0]),{color:x.startlinecolor,width:x.startlinewidth})),x.endline&&w.push(hu(P(y[y.length-1]),{color:x.endlinecolor,width:x.endlinewidth}))}},pu=m.extendFlat,du=function(t,e){var r,n,i,a=e._labels=[],o=e._gridlines;for(r=0;re.length&&(t=t.slice(0,e.length)):t=[],n=0;ne.length&&(t[n]=t[n].slice(0,e.length)):t[n]=[],i=0;i0&&void 0!==(n=t[r][e-1])&&(a++,i+=n),e0&&void 0!==(n=t[r-1][e])&&(a++,i+=n),r0&&i0&&n1e-5);return ne.log("Smoother converged to",M,"after",A,"iterations"),t},xu=function(t,e){var n,i,a,o,s,l;function u(t){if(r(t))return+t}if(e){for(n=0,s=0;ss&&tu&&el||ec},a.c2p=function(t){return t},o.c2p=function(t){return t},t.setScale=function(){var e,r,s,l=t._x,u=t._y,c=function(t,e,r,n,i,a){var o,s,l,u,c,h,f,p,d,g,v=r[0].length,m=r.length,y=i?3*v-2:v,x=a?3*m-2:m;for(t=Au(t,x),e=Au(e,x),l=0;le[n-1]|or[i-1]))return[!1,!1];var l=t.a2i(a),u=t.b2j(o),c=t.evalxy([],l,u);if(s){var h,f,p,d,g=0,v=0,m=[];ae[n-1]?(h=n-2,f=1,g=(a-e[n-1])/(e[n-1]-e[n-2])):f=l-(h=Math.max(0,Math.min(n-2,Math.floor(l)))),or[i-1]?(p=i-2,d=1,v=(o-r[i-1])/(r[i-1]-r[i-2])):d=u-(p=Math.max(0,Math.min(i-2,Math.floor(u)))),g&&(t.dxydi(m,h,p,f,d),c[0]+=m[0]*g,c[1]+=m[1]*g),v&&(t.dxydj(m,h,p,f,d),c[0]+=m[0]*v,c[1]+=m[1]*v)}return c},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=h*(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=f*(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}},Cu=ne.isArrayOrTypedArray,Lu=function(t){return Cu(t[0])},zu=t.BADNUM,Pu=function(t,e,r,n,i,a){n=n||"x",i=i||"y",a=a||["z"];var o,s,l,u=t[n].slice(),c=t[i].slice(),h=t.text,f=Math.min(u.length,c.length),p=void 0!==h&&!Array.isArray(h[0]),d=t[n+"calendar"],g=t[i+"calendar"];for(o=0;oe.length&&(t=t.slice(0,e.length)):t=[],n=0;n90&&(p-=180,l=-l),{angle:p,flip:l,p:t.c2p(n,e,r),offsetMultplier:u}};function Fu(t,e,r){var n=t.selectAll(e+"."+r).data([0]);return n.enter().append(e).classed(r,!0),n}function Bu(t,e,r){var n=r[0],i=r[0].trace,a=e.xaxis,o=e.yaxis,s=i.aaxis,l=i.baxis,u=t._fullLayout,c=e.plot.selectAll(".carpetlayer"),h=u._clips,f=Fu(c,"g","carpet"+i.uid).classed("trace",!0),p=Fu(f,"g","minorlayer"),d=Fu(f,"g","majorlayer"),g=Fu(f,"g","boundarylayer"),v=Fu(f,"g","labellayer");f.style("opacity",i.opacity),Nu(a,o,d,s,"a",s._gridlines),Nu(a,o,d,l,"b",l._gridlines),Nu(a,o,p,s,"a",s._minorgridlines),Nu(a,o,p,l,"b",l._minorgridlines),Nu(a,o,g,s,"a-boundary",s._boundarylines),Nu(a,o,g,l,"b-boundary",l._boundarylines),function(t,e,r,n,i,a,o,s){var l,u,c,h;l=.5*(r.a[0]+r.a[r.a.length-1]),u=r.b[0],c=r.ab2xy(l,u,!0),h=r.dxyda_rough(l,u),void 0===o.angle&&ne.extendFlat(o,Ru(r,i,a,c,r.dxydb_rough(l,u)));qu(t,e,r,n,c,h,r.aaxis,i,a,o,"a-title"),l=r.a[0],u=.5*(r.b[0]+r.b[r.b.length-1]),c=r.ab2xy(l,u,!0),h=r.dxydb_rough(l,u),void 0===s.angle&&ne.extendFlat(s,Ru(r,i,a,c,r.dxyda_rough(l,u)));qu(t,e,r,n,c,h,r.baxis,i,a,s,"b-title")}(t,v,i,n,a,o,ju(t,a,o,i,n,v,s._labels,"a-label"),ju(t,a,o,i,n,v,l._labels,"b-label")),function(t,e,r,n,i){var a,o,s,l,u=r.select("#"+t._clipPathId);u.size()||(u=r.append("clipPath").classed("carpetclip",!0));var c=Fu(u,"path","carpetboundary"),h=e.clipsegments,f=[];for(l=0;l0?"start":"end","data-notex":1}).call(Sr.font,a.font).text(a.text).call(er.convertToTspans,t),p=Sr.bBox(this);f.attr("transform","translate("+s.p[0]+","+s.p[1]+") rotate("+s.angle+")translate("+a.axis.labelpadding*u+","+.3*p.height+")"),c=Math.max(c,p.width+a.axis.labelpadding)}),u.exit().remove(),h.maxExtent=c,h}var Vu=Qe.LINE_SPACING,Uu=(1-Qe.MID_SHIFT)/Vu+1;function qu(t,r,n,i,a,o,s,l,u,c,h){var f=[];s.title&&f.push(s.title);var p=r.selectAll("text."+h).data(f),d=c.maxExtent;p.enter().append("text").classed(h,!0),p.each(function(){var r=Ru(n,l,u,a,o);-1===["start","both"].indexOf(s.showticklabels)&&(d=0);var i=s.titlefont.size;d+=i+s.titleoffset;var h=(c.angle+(c.flip<0?180:0)-r.angle+450)%360,f=h>90&&h<270,p=e.select(this);p.text(s.title||"").call(er.convertToTspans,t),f&&(d=(-er.lineCount(p)+Uu)*Vu*i-d),p.attr("transform","translate("+r.p[0]+","+r.p[1]+") rotate("+r.angle+") translate(0,"+d+")").classed("user-select-none",!0).attr("text-anchor","middle").call(Sr.font,s.titlefont)}),p.exit().remove()}var Hu={};Hu.attributes=lu,Hu.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,lu,r,n)}e._clipPathId="clip"+e.uid+"carpet";var a=i("color",C.defaultLine);if(ne.coerceFont(i,"font"),i("carpet"),wu(t,e,n,i,a),e.a&&e.b){e.a.length<3&&(e.aaxis.smoothing=0),e.b.length<3&&(e.baxis.smoothing=0);var o=function(t,e,r){var n=[],i=r("x");i&&!Lu(i)&&n.push("x"),e._cheater=!i;var a=r("y");if(a&&!Lu(a)&&n.push("y"),i||a)return n.length&&Pu(e,e.aaxis,e.baxis,"a","b",n),!0}(0,e,i);Eu(e),e._cheater&&i("cheaterslope"),o||(e.visible=!1)}else e.visible=!1},Hu.plot=function(t,e,r){for(var n=0;n=0;i--)a[c-i]=t[h][i],o[c-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:u}),s}(e.xctrl,e.yctrl,a,o),u.x=r,u.y=c,u.a=s,u.b=l,[u]},Hu.animatable=!0,Hu.moduleType="trace",Hu.name="carpet",Hu.basePlotModule=ua,Hu.categories=["cartesian","carpet","carpetAxis","notLegendIsolatable"],Hu.meta={};var Gu=Hu,Wu={exports:{}};!function(t,e){"object"==typeof Wu.exports?e(Wu.exports):e(t.topojson=t.topojson||{})}(this,function(t){"use strict";var e=function(t){return t},r=function(t){if(null==(r=t.transform))return e;var r,n,i,a=r.scale[0],o=r.scale[1],s=r.translate[0],l=r.translate[1];return function(t,e){return e||(n=i=0),t[0]=(n+=t[0])*a+s,t[1]=(i+=t[1])*o+l,t}},n=function(t){var e=t.bbox;function n(t){l[0]=t[0],l[1]=t[1],s(l),l[0]h&&(h=l[0]),l[1]f&&(f=l[1])}function i(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(i);break;case"Point":n(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(n)}}if(!e){var a,o,s=r(t),l=new Array(2),u=1/0,c=u,h=-u,f=-u;for(o in t.arcs.forEach(function(t){for(var e=-1,r=t.length;++eh&&(h=l[0]),l[1]f&&(f=l[1])}),t.objects)i(t.objects[o]);e=t.bbox=[u,c,h,f]}return e},i=function(t,e){for(var r,n=t.length,i=n-e;i<--n;)r=t[i],t[i++]=t[n],t[n]=r};function a(t,e){var r=e.id,n=e.bbox,i=null==e.properties?{}:e.properties,a=o(t,e);return null==r&&null==n?{type:"Feature",properties:i,geometry:a}:null==n?{type:"Feature",id:r,properties:i,geometry:a}:{type:"Feature",id:r,bbox:n,properties:i,geometry:a}}function o(t,e){var n=r(t),a=t.arcs;function o(t,e){e.length&&e.pop();for(var r=a[t<0?~t:t],o=0,s=r.length;o1)n=function(t,e,r){var n,i=[],a=[];function o(t){var e=t<0?~t:t;(a[e]||(a[e]=[])).push({i:t,g:n})}function s(t){t.forEach(o)}function l(t){t.forEach(s)}return function t(e){switch(n=e,e.type){case"GeometryCollection":e.geometries.forEach(t);break;case"LineString":s(e.arcs);break;case"MultiLineString":case"Polygon":l(e.arcs);break;case"MultiPolygon":e.arcs.forEach(l)}}(e),a.forEach(null==r?function(t){i.push(t[0].i)}:function(t){r(t[0].g,t[t.length-1].g)&&i.push(t[0].i)}),i}(0,e,r);else for(i=0,n=new Array(a=t.arcs.length);i1)for(var a,o,u=1,c=l(i[0]);uc&&(o=i[0],i[0]=i[u],i[u]=o,c=a);return i})}}var c=function(t,e){for(var r=0,n=t.length;r>>1;t[i]=2))throw new Error("n must be \u22652");if(t.transform)throw new Error("already quantized");var r,i=n(t),a=i[0],o=(i[2]-a)/(e-1)||1,s=i[1],l=(i[3]-s)/(e-1)||1;function u(t){t[0]=Math.round((t[0]-a)/o),t[1]=Math.round((t[1]-s)/l)}function c(t){switch(t.type){case"GeometryCollection":t.geometries.forEach(c);break;case"Point":u(t.coordinates);break;case"MultiPoint":t.coordinates.forEach(u)}}for(r in t.arcs.forEach(function(t){for(var e,r,n,i=1,u=1,c=t.length,h=t[0],f=h[0]=Math.round((h[0]-a)/o),p=h[1]=Math.round((h[1]-s)/l);i0})}function u(t,n){var i=t.seg,a=n.seg,o=i.start,l=i.end,u=a.start,c=a.end;r&&r.checkIntersection(i,a);var h=e.linesIntersect(o,l,u,c);if(!1===h){if(!e.pointsCollinear(o,l,u))return!1;if(e.pointsSame(o,c)||e.pointsSame(l,u))return!1;var f=e.pointsSame(o,u),p=e.pointsSame(l,c);if(f&&p)return n;var d=!f&&e.pointBetween(o,u,c),g=!p&&e.pointBetween(l,u,c);if(f)return g?s(n,l):s(t,c),n;d&&(p||(g?s(n,l):s(t,c)),s(n,o))}else 0===h.alongA&&(-1===h.alongB?s(t,u):0===h.alongB?s(t,h.pt):1===h.alongB&&s(t,c)),0===h.alongB&&(-1===h.alongA?s(n,o):0===h.alongA?s(n,h.pt):1===h.alongA&&s(n,l));return!1}for(var c=[];!i.isEmpty();){var h=i.getHead();if(r&&r.vert(h.pt[0]),h.isStart){r&&r.segmentNew(h.seg,h.primary);var f=l(h),p=f.before?f.before.ev:null,d=f.after?f.after.ev:null;function g(){if(p){var t=u(h,p);if(t)return t}return!!d&&u(h,d)}r&&r.tempStatus(h.seg,!!p&&p.seg,!!d&&d.seg);var v,m,y=g();if(y)t?(m=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below)&&(y.seg.myFill.above=!y.seg.myFill.above):y.seg.otherFill=h.seg.myFill,r&&r.segmentUpdate(y.seg),h.other.remove(),h.remove();if(i.getHead()!==h){r&&r.rewind(h.seg);continue}t?(m=null===h.seg.myFill.below||h.seg.myFill.above!==h.seg.myFill.below,h.seg.myFill.below=d?d.seg.myFill.above:n,h.seg.myFill.above=m?!h.seg.myFill.below:h.seg.myFill.below):null===h.seg.otherFill&&(v=d?h.primary===d.primary?d.seg.otherFill.above:d.seg.myFill.above:h.primary?a:n,h.seg.otherFill={above:v,below:v}),r&&r.status(h.seg,!!p&&p.seg,!!d&&d.seg),h.other.status=f.insert(tc.node({ev:h}))}else{var x=h.status;if(null===x)throw new Error("PolyBool: Zero-length segment detected; your epsilon is probably too small or too large");if(o.exists(x.prev)&&o.exists(x.next)&&u(x.prev.ev,x.next.ev),r&&r.statusRemove(x.ev.seg),x.remove(),!h.primary){var b=h.seg.myFill;h.seg.myFill=h.seg.otherFill,h.seg.otherFill=b}c.push(h.seg)}i.getHead().remove()}return r&&r.done(),c}return t?{addRegion:function(t){for(var n,i,a,s=t[t.length-1],l=0;l=-t},pointBetween:function(e,r,n){var i=e[1]-r[1],a=n[0]-r[0],o=e[0]-r[0],s=n[1]-r[1],l=o*a+i*s;return!(l-t)},pointsSameX:function(e,r){return Math.abs(e[0]-r[0])t!=o-i>t&&(a-u)*(i-c)/(o-c)+u-n>t&&(s=!s),a=u,o=c}return s}};return e}();function lc(t,e,r){var n=ic.segments(t),i=ic.segments(e),a=r(ic.combine(n,i));return ic.polygon(a)}ic={buildLog:function(t){return!0===t?oc=Qu():!1===t&&(oc=!1),!1!==oc&&oc.list},epsilon:function(t){return sc.epsilon(t)},segments:function(t){var e=ec(!0,sc,oc);return t.regions.forEach(e.addRegion),{segments:e.calculate(t.inverted),inverted:t.inverted}},combine:function(t,e){return{combined:ec(!1,sc,oc).calculate(t.segments,t.inverted,e.segments,e.inverted),inverted1:t.inverted,inverted2:e.inverted}},selectUnion:function(t){return{segments:ac.union(t.combined,oc),inverted:t.inverted1||t.inverted2}},selectIntersect:function(t){return{segments:ac.intersect(t.combined,oc),inverted:t.inverted1&&t.inverted2}},selectDifference:function(t){return{segments:ac.difference(t.combined,oc),inverted:t.inverted1&&!t.inverted2}},selectDifferenceRev:function(t){return{segments:ac.differenceRev(t.combined,oc),inverted:!t.inverted1&&t.inverted2}},selectXor:function(t){return{segments:ac.xor(t.combined,oc),inverted:t.inverted1!==t.inverted2}},polygon:function(t){return{regions:rc(t.segments,sc,oc),inverted:t.inverted}},polygonFromGeoJSON:function(t){return $u.toPolygon(ic,t)},polygonToGeoJSON:function(t){return $u.fromPolygon(ic,sc,t)},union:function(t,e){return lc(t,e,ic.selectUnion)},intersect:function(t,e){return lc(t,e,ic.selectIntersect)},difference:function(t,e){return lc(t,e,ic.selectDifference)},differenceRev:function(t,e){return lc(t,e,ic.selectDifferenceRev)},xor:function(t,e){return lc(t,e,ic.selectXor)}},"object"==typeof window&&(window.PolyBool=ic);var uc=ic,cc={},hc=Vt.dot,fc=t.BADNUM,pc=cc={};pc.tester=function(t){if(Array.isArray(t[0][0]))return pc.multitester(t);var e,r=t.slice(),n=r[0][0],i=n,a=r[0][1],o=a;for(r.push(r[0]),e=1;ei||l===fc||lo||e&&s(t))}:function(t,e){var s=t[0],l=t[1];if(s===fc||si||l===fc||lo)return!1;var u,c,h,f,p,d=r.length,g=r[0][0],v=r[0][1],m=0;for(u=1;uMath.max(c,g)||l>Math.max(h,v)))if(lu||Math.abs(hc(a,h))>n)return!0;return!1};pc.filter=function(t,e){var r=[t[0]],n=0,i=0;function a(a){t.push(a);var o=r.length,s=n;r.splice(i+1);for(var l=s+1;l1&&a(t.pop());return{addPt:a,raw:t,filtered:r}};var gc=Ya.makeEventData,vc=cc.filter,mc=cc.tester,yc=cc.multitester,xc=Te.MINSELECT;function bc(t){return t._id}var _c=function(t,e,r,n,i){var a,o,s,l,u=n.gd,c=u._fullLayout,h=c._zoomlayer,f=n.element.getBoundingClientRect(),p=n.plotinfo,d=p.xaxis._offset,g=p.yaxis._offset,v=e-f.left,m=r-f.top,y=v,x=m,b="M"+v+","+m,_=n.xaxes[0]._length,w=n.yaxes[0]._length,M=n.xaxes.map(bc),A=n.yaxes.map(bc),k=n.xaxes.concat(n.yaxes),T=t.altKey;(t.shiftKey||t.altKey)&&p.selection&&p.selection.polygons&&!n.polygons?(n.polygons=p.selection.polygons,n.mergedPolygons=p.selection.mergedPolygons):(!t.shiftKey&&!t.altKey||(t.shiftKey||t.altKey)&&!p.selection)&&(p.selection={},p.selection.polygons=n.polygons=[],p.selection.mergedPolygons=n.mergedPolygons=[]),"lasso"===i&&(a=vc([[v,m]],Te.BENDPX));var S=h.selectAll("path.select-outline-"+p.id).data([1,2]);S.enter().append("path").attr("class",function(t){return"select-outline select-outline-"+t+" select-outline-"+p.id}).attr("transform","translate("+d+", "+g+")").attr("d",b+"Z");var E,C,L,z,P,I,D=h.append("path").attr("class","zoombox-corners").style({fill:Oe.background,stroke:Oe.defaultLine,"stroke-width":1}).attr("transform","translate("+d+", "+g+")").attr("d","M0,0Z"),O=[],R=c._uid+Te.SELECTID,F=[];for(E=0;En^p>n&&r<(f-u)*(n-c)/(p-c)+u&&(i=!i)}return i}(t[0],r))return t.push(e),!0})||t.push([e])}),a=[],t.length?t.length>1?{type:"MultiPolygon",coordinates:t}:{type:"Polygon",coordinates:t[0]}:null}},u={Point:o,MultiPoint:o,LineString:s,MultiLineString:s,Polygon:l,MultiPolygon:l,Sphere:l};function c(){}var h=1e-6,f=h*h,p=Math.PI,d=p/2,g=(Math.sqrt(p),p/180),v=180/p;function m(t){return t>1?d:t<-1?-d:Math.asin(t)}function y(t){return t>1?0:t<-1?p:Math.acos(t)}var x=t.geo.projection,b=t.geo.projectionMutator;function _(t,e){var r=(2+d)*Math.sin(e);e/=2;for(var n=0,i=1/0;n<10&&Math.abs(i)>h;n++){var a=Math.cos(e);e-=i=(e+Math.sin(e)*(a+2)-r)/(2*a*(1+a))}return[2/Math.sqrt(p*(4+p))*t*(1+Math.cos(e)),2*Math.sqrt(p/(4+p))*Math.sin(e)]}t.geo.interrupt=function(e){var r,n=[[[[-p,0],[0,d],[p,0]]],[[[-p,0],[0,-d],[p,0]]]];function i(t,r){for(var i=r<0?-1:1,a=n[+(r<0)],o=0,s=a.length-1;oa[o][2][0];++o);var l=e(t-a[o][1][0],r);return l[0]+=e(a[o][1][0],i*r>i*a[o][0][1]?a[o][0][1]:r)[0],l}e.invert&&(i.invert=function(t,a){for(var o=r[+(a<0)],s=n[+(a<0)],u=0,c=o.length;u=0;--i){var o=n[1][i],l=180*o[0][0]/p,u=180*o[0][1]/p,c=180*o[1][1]/p,h=180*o[2][0]/p,f=180*o[2][1]/p;r.push(s([[h-e,f-e],[h-e,c+e],[l+e,c+e],[l+e,u-e]],30))}return{type:"Polygon",coordinates:[t.merge(r)]}}(),l)},i},a.lobes=function(t){return arguments.length?(n=t.map(function(t){return t.map(function(t){return[[t[0][0]*p/180,t[0][1]*p/180],[t[1][0]*p/180,t[1][1]*p/180],[t[2][0]*p/180,t[2][1]*p/180]]})}),r=n.map(function(t){return t.map(function(t){var r,n=e(t[0][0],t[0][1])[0],i=e(t[2][0],t[2][1])[0],a=e(t[1][0],t[0][1])[1],o=e(t[1][0],t[1][1])[1];return a>o&&(r=a,a=o,o=r),[[n,a],[i,o]]})}),a):n.map(function(t){return t.map(function(t){return[[180*t[0][0]/p,180*t[0][1]/p],[180*t[1][0]/p,180*t[1][1]/p],[180*t[2][0]/p,180*t[2][1]/p]]})})},a},_.invert=function(t,e){var r=.5*e*Math.sqrt((4+p)/p),n=m(r),i=Math.cos(n);return[t/(2/Math.sqrt(p*(4+p))*(1+i)),m((n+r*(i+2))/(2+d))]},(t.geo.eckert4=function(){return x(_)}).raw=_;var w=t.geo.azimuthalEqualArea.raw;function M(t,e){if(arguments.length<2&&(e=t),1===e)return w;if(e===1/0)return A;function r(r,n){var i=w(r/e,n);return i[0]*=t,i}return r.invert=function(r,n){var i=w.invert(r/t,n);return i[0]*=e,i},r}function A(t,e){return[t*Math.cos(e)/Math.cos(e/=2),2*Math.sin(e)]}function k(t,e){return[3*t/(2*p)*Math.sqrt(p*p/3-e*e),e]}function T(t,e){return[t,1.25*Math.log(Math.tan(p/4+.4*e))]}function S(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)>h&&--i>0);return e/2}}A.invert=function(t,e){var r=2*m(e/2);return[t*Math.cos(r/2)/Math.cos(r),r]},(t.geo.hammer=function(){var t=2,e=b(M),r=e(t);return r.coefficient=function(r){return arguments.length?e(t=+r):t},r}).raw=M,k.invert=function(t,e){return[2/3*p*t/Math.sqrt(p*p/3-e*e),e]},(t.geo.kavrayskiy7=function(){return x(k)}).raw=k,T.invert=function(t,e){return[t,2.5*Math.atan(Math.exp(.8*e))-.625*p]},(t.geo.miller=function(){return x(T)}).raw=T,S(p);var E=function(t,e,r){var n=S(r);function i(r,i){return[t*r*Math.cos(i=n(i)),e*Math.sin(i)]}return i.invert=function(n,i){var a=m(i/e);return[n/(t*Math.cos(a)),m((2*a+Math.sin(2*a))/r)]},i}(Math.SQRT2/d,Math.SQRT2,p);function C(t,e){var r=e*e,n=r*r;return[t*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791)),e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))]}(t.geo.mollweide=function(){return x(E)}).raw=E,C.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)>h&&--i>0);return[t/(.8707+(a=n*n)*(a*(a*a*a*(.003971-.001529*a)-.013791)-.131979)),n]},(t.geo.naturalEarth=function(){return x(C)}).raw=C;var L=[[.9986,-.062],[1,0],[.9986,.062],[.9954,.124],[.99,.186],[.9822,.248],[.973,.31],[.96,.372],[.9427,.434],[.9216,.4958],[.8962,.5571],[.8679,.6176],[.835,.6769],[.7986,.7346],[.7597,.7903],[.7186,.8435],[.6732,.8936],[.6213,.9394],[.5722,.9761],[.5322,1]];function z(t,e){var r,n=Math.min(18,36*Math.abs(e)/p),i=Math.floor(n),a=n-i,o=(r=L[i])[0],s=r[1],l=(r=L[++i])[0],u=r[1],c=(r=L[Math.min(19,++i)])[0],h=r[1];return[t*(l+a*(c-o)/2+a*a*(c-2*l+o)/2),(e>0?d:-d)*(u+a*(h-s)/2+a*a*(h-2*u+s)/2)]}function P(t,e){return[t*Math.cos(e),e]}function I(t,e){var r,n=Math.cos(e),i=(r=y(n*Math.cos(t/=2)))?r/Math.sin(r):1;return[2*n*Math.sin(t)*i,Math.sin(e)*i]}function D(t,e){var r=I(t,e);return[(r[0]+t/d)/2,(r[1]+e)/2]}L.forEach(function(t){t[1]*=1.0144}),z.invert=function(t,e){var r=e/d,n=90*r,i=Math.min(18,Math.abs(n/5)),a=Math.max(0,Math.floor(i));do{var o=L[a][1],s=L[a+1][1],l=L[Math.min(19,a+2)][1],u=l-o,c=l-2*s+o,h=2*(Math.abs(r)-s)/u,p=c/u,m=h*(1-p*h*(1-2*p*h));if(m>=0||1===a){n=(e>=0?5:-5)*(m+i);var y,x=50;do{m=(i=Math.min(18,Math.abs(n)/5))-(a=Math.floor(i)),o=L[a][1],s=L[a+1][1],l=L[Math.min(19,a+2)][1],n-=(y=(e>=0?d:-d)*(s+m*(l-o)/2+m*m*(l-2*s+o)/2)-e)*v}while(Math.abs(y)>f&&--x>0);break}}while(--a>=0);var b=L[a][0],_=L[a+1][0],w=L[Math.min(19,a+2)][0];return[t/(_+m*(w-b)/2+m*m*(w-2*_+b)/2),n*g]},(t.geo.robinson=function(){return x(z)}).raw=z,P.invert=function(t,e){return[t/Math.cos(e),e]},(t.geo.sinusoidal=function(){return x(P)}).raw=P,I.invert=function(t,e){if(!(t*t+4*e*e>p*p+h)){var r=t,n=e,i=25;do{var a,o=Math.sin(r),s=Math.sin(r/2),l=Math.cos(r/2),u=Math.sin(n),c=Math.cos(n),f=Math.sin(2*n),d=u*u,g=c*c,v=s*s,m=1-g*l*l,x=m?y(c*l)*Math.sqrt(a=1/m):a=0,b=2*x*c*s-t,_=x*u-e,w=a*(g*v+x*c*l*d),M=a*(.5*o*f-2*x*u*s),A=.25*a*(f*s-x*u*g*o),k=a*(d*l+x*v*c),T=M*A-k*w;if(!T)break;var S=(_*M-b*k)/T,E=(b*A-_*w)/T;r-=S,n-=E}while((Math.abs(S)>h||Math.abs(E)>h)&&--i>0);return[r,n]}},(t.geo.aitoff=function(){return x(I)}).raw=I,D.invert=function(t,e){var r=t,n=e,i=25;do{var a,o=Math.cos(n),s=Math.sin(n),l=Math.sin(2*n),u=s*s,c=o*o,f=Math.sin(r),p=Math.cos(r/2),g=Math.sin(r/2),v=g*g,m=1-c*p*p,x=m?y(o*p)*Math.sqrt(a=1/m):a=0,b=.5*(2*x*o*g+r/d)-t,_=.5*(x*s+n)-e,w=.5*a*(c*v+x*o*p*u)+.5/d,M=a*(f*l/4-x*s*g),A=.125*a*(l*g-x*s*c*f),k=.5*a*(u*p+x*v*o)+.5,T=M*A-k*w,S=(_*M-b*k)/T,E=(b*A-_*w)/T;r-=S,n-=E}while((Math.abs(S)>h||Math.abs(E)>h)&&--i>0);return[r,n]},(t.geo.winkel3=function(){return x(D)}).raw=D},kc=Math.PI/180,Tc=180/Math.PI,Sc={cursor:"pointer"},Ec={cursor:"auto"};var Cc=function(t,e){var r=t.projection;return(e._isScoped?Pc:e._isClipped?Dc:Ic)(t,r)};function Lc(t,r){return e.behavior.zoom().translate(r.translate()).scale(r.scale())}function zc(t,e,r){var n=t.id,i=t.graphDiv,a=i.layout[n],o=i._fullLayout[n],s={};function l(t,e){var r=ne.nestedProperty(o,t);r.get()!==e&&(r.set(e),ne.nestedProperty(a,t).set(e),s[n+"."+t]=e)}r(l),l("projection.scale",e.scale()/t.fitScale),i.emit("plotly_relayout",s)}function Pc(t,r){var n=Lc(0,r);function i(e){var n=r.invert(t.midPt);e("center.lon",n[0]),e("center.lat",n[1])}return n.on("zoomstart",function(){e.select(this).style(Sc)}).on("zoom",function(){r.scale(e.event.scale).translate(e.event.translate),t.render()}).on("zoomend",function(){e.select(this).style(Ec),zc(t,r,i)}),n}function Ic(t,r){var n,i,a,o,s,l,u,c,h=Lc(0,r),f=2;function p(t){return r.invert(t)}function d(e){var n=r.rotate(),i=r.invert(t.midPt);e("projection.rotation.lon",-n[0]),e("center.lon",i[0]),e("center.lat",i[1])}return h.on("zoomstart",function(){e.select(this).style(Sc),n=e.mouse(this),i=r.rotate(),a=r.translate(),o=i,s=p(n)}).on("zoom",function(){if(l=e.mouse(this),g=r(p(d=n)),Math.abs(g[0]-d[0])>f||Math.abs(g[1]-d[1])>f)return h.scale(r.scale()),void h.translate(r.translate());var d,g;r.scale(e.event.scale),r.translate([a[0],e.event.translate[1]]),s?p(l)&&(c=p(l),u=[o[0]+(c[0]-s[0]),i[1],i[2]],r.rotate(u),o=u):s=p(n=l),t.render()}).on("zoomend",function(){e.select(this).style(Ec),zc(t,r,d)}),h}function Dc(t,r){var n,i={r:r.rotate(),k:r.scale()},a=Lc(0,r),o=function(t){var r=0,n=arguments.length,i=[];for(;++rp?(a=(c>0?90:-90)-f,i=0):(a=Math.asin(c/p)*Tc-f,i=Math.sqrt(p*p-c*c));var d=180-a-2*f,g=(Math.atan2(h,u)-Math.atan2(l,i))*Tc,v=(Math.atan2(h,u)-Math.atan2(l,-i))*Tc,m=Rc(r[0],r[1],a,g),y=Rc(r[0],r[1],d,v);return m<=y?[a,g,r[2]]:[d,v,r[2]]}(y,n,_);isFinite(A[0])&&isFinite(A[1])&&isFinite(A[2])||(A=_),r.rotate(A),_=A}}else n=Oc(r,x=g);o.of(this,arguments)({type:"zoom"})}),y=o.of(this,arguments),s++||y({type:"zoomstart"})}).on("zoomend",function(){var n;e.select(this).style(Ec),l.call(a,"zoom",null),n=o.of(this,arguments),--s||n({type:"zoomend"}),zc(t,r,u)}).on("zoom.redraw",function(){t.render()}),e.rebind(a,o,"on")}function Oc(t,e){var r=t.invert(e);return r&&isFinite(r[0])&&isFinite(r[1])&&function(t){var e=t[0]*kc,r=t[1]*kc,n=Math.cos(r);return[n*Math.cos(e),n*Math.sin(e),Math.sin(r)]}(r)}function Rc(t,e,r,n){var i=Fc(r-t),a=Fc(n-e);return Math.sqrt(i*i+a*a)}function Fc(t){return(t%360+540)%360-180}function Bc(t,e,r){var n=r*kc,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 Nc(t,e){for(var r=0,n=0,i=t.length;ni*Math.PI/180}return!1},n.getPath=function(){return e.geo.path().projection(n)},n.getBounds=function(t){return n.getPath().bounds(t)},n.fitExtent=function(t,e){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=n.clipExtent&&n.clipExtent();n.scale(150).translate([0,0]),a&&n.clipExtent(null);var o=n.getBounds(e),s=Math.min(r/(o[1][0]-o[0][0]),i/(o[1][1]-o[0][1])),l=+t[0][0]+(r-s*(o[1][0]+o[0][0]))/2,u=+t[0][1]+(i-s*(o[1][1]+o[0][1]))/2;return a&&n.clipExtent(a),n.scale(150*s).translate([l,u])},n.precision(Yu.precision),i&&n.clipAngle(i-Yu.clipPad);return n}(r);l.center([s.lon-o.lon,s.lat-o.lat]).rotate([-o.lon,-o.lat,o.roll]).parallels(a.parallels);var u=[[n.l+n.w*i.x[0],n.t+n.h*(1-i.y[1])],[n.l+n.w*i.x[1],n.t+n.h*(1-i.y[0])]],c=r.lonaxis,h=r.lataxis,f=function(t,e){var r=Yu.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]]]}}(c.range,h.range);l.fitExtent(u,f);var p=this.bounds=l.getBounds(f),d=this.fitScale=l.scale(),g=l.translate();if(!isFinite(p[0][0])||!isFinite(p[0][1])||!isFinite(p[1][0])||!isFinite(p[1][1])||isNaN(g[0])||isNaN(g[0])){for(var v=this.graphDiv,m=["projection.rotation","center","lonaxis.range","lataxis.range"],y="Invalid geo settings, relayout'ing to default view.",x={},b=0;b0&&b<0&&(b+=360);var _,w,M,A=(x+b)/2;if(!s){var k=l?a.projRotate:[A,0,0];_=r("projection.rotation.lon",k[0]),r("projection.rotation.lat",k[1]),r("projection.rotation.roll",k[2]),r("showcoastlines",!l)&&(r("coastlinecolor"),r("coastlinewidth")),r("showocean")&&r("oceancolor")}(s?(w=-96.6,M=38.7):(w=l?A:_,M=(y[0]+y[1])/2),r("center.lon",w),r("center.lat",M),u)&&r("projection.parallels",a.projParallels||[0,60]);r("projection.scale"),r("showland")&&r("landcolor"),r("showlakes")&&r("lakecolor"),r("showrivers")&&(r("rivercolor"),r("riverwidth")),r("showcountries",l&&"usa"!==i)&&(r("countrycolor"),r("countrywidth")),("usa"===i||"north america"===i&&50===n)&&(r("showsubunits",!0),r("subunitcolor"),r("subunitwidth")),l||r("showframe",!0)&&(r("framecolor"),r("framewidth")),r("bgcolor")}var $c={},th=sa.getSubplotCalcData,eh=ne.counterRegex,rh="geo";$c.name=rh,$c.attr=rh,$c.idRoot=rh,$c.idRegex=$c.attrRegex=eh(rh),$c.attributes={geo:{valType:"subplotid",dflt:"geo",editType:"calc"}},$c.layoutAttributes=Xc,$c.supplyLayoutDefaults=function(t,e,r){Jc(t,e,0,{type:"geo",attributes:Xc,handleDefaults:Qc,partition:"y"})},$c.plot=function(t){var e=t._fullLayout,r=t.calcdata,n=e._subplots.geo;void 0===window.PlotlyGeoAssets&&(window.PlotlyGeoAssets={topojson:{}});for(var i=0;i0&&t[e+1][0]<0)return e;return null}switch(e="RUS"===s||"FJI"===s?function(t){var e;if(null===u(t))e=t;else for(e=new Array(t.length),i=0;ie?r[n++]=[t[i][0]+360,t[i][1]]:i===e?(r[n++]=t[i],r[n++]=[t[i][0],-90]):r[n++]=t[i];var a=cc.tester(r);a.pts.pop(),l.push(a)}:function(t){l.push(cc.tester(t))},a.type){case"MultiPolygon":for(r=0;ra&&(e.z=s.slice(0,a)),i("locationmode"),i("text"),i("marker.line.color"),i("marker.line.width"),i("marker.opacity"),Ye(t,e,n,i,{prefix:"",cLetter:"z"}),ne.coerceSelectionMarkerOpacity(e,i)):e.visible=!1}else e.visible=!1},Th.colorbar=kh,Th.calc=function(t,e){for(var n=e.locations.length,i=new Array(n),a=0;a")}(t,l,n,u.mockAxis),[t]},Th.eventData=function(t,e){return t.location=e.location,t.z=e.z,t},Th.selectPoints=function(t,e){var r,n,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[];if(!1===e)for(r=0;r=",">","<="],COMPARISON_OPS2:["=","<",">=",">","<="],INTERVAL_OPS:["[]","()","[)","(]","][",")(","](",")["],SET_OPS:["{}","}{"],CONSTRAINT_REDUCTION:{"=":"=","<":"<","<=":"<",">":">",">=":">","[]":"[]","()":"[]","[)":"[]","(]":"[]","][":"][",")(":"][","](":"][",")[":"]["}},Ch=m.extendFlat,Lh=Ch({},{z:{valType:"data_array",editType:"calc"},x:Ch({},Zr.x,{impliedEdits:{xtype:"array"}}),x0:Ch({},Zr.x0,{impliedEdits:{xtype:"scaled"}}),dx:Ch({},Zr.dx,{impliedEdits:{xtype:"scaled"}}),y:Ch({},Zr.y,{impliedEdits:{ytype:"array"}}),y0:Ch({},Zr.y0,{impliedEdits:{ytype:"scaled"}}),dy:Ch({},Zr.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"}},Pe,{autocolorscale:Ch({},Pe.autocolorscale,{dflt:!1})},{colorbar:ze}),zh=Ae.dash,Ph=m.extendFlat,Ih=Eh.COMPARISON_OPS2,Dh=Eh.INTERVAL_OPS,Oh=Zr.line,Rh=Ph({z:Lh.z,x:Lh.x,x0:Lh.x0,dx:Lh.dx,y:Lh.y,y0:Lh.y0,dy:Lh.dy,text:Lh.text,transpose:Lh.transpose,xtype:Lh.xtype,ytype:Lh.ytype,zhoverformat:Lh.zhoverformat,connectgaps:Lh.connectgaps,fillcolor:{valType:"color",editType:"calc"},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:{type:{valType:"enumerated",values:["levels","constraint"],dflt:"levels",editType:"calc"},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:T({editType:"plot",colorEditType:"style"}),labelformat:{valType:"string",dflt:"",editType:"plot"},operation:{valType:"enumerated",values:[].concat(Ih).concat(Dh),dflt:"=",editType:"calc"},value:{valType:"any",dflt:0,editType:"calc"},editType:"calc",impliedEdits:{autocontour:!1}},line:{color:Ph({},Oh.color,{editType:"style+colorbars"}),width:Ph({},Oh.width,{editType:"style+colorbars"}),dash:zh,smoothing:Ph({},Oh.smoothing,{}),editType:"plot"}},Pe,{autocolorscale:Ph({},Pe.autocolorscale,{dflt:!1}),zmin:Ph({},Pe.zmin,{editType:"calc"}),zmax:Ph({},Pe.zmax,{editType:"calc"})},{colorbar:ze}),Fh=ne.extendFlat,Bh=function(t){var e=t.contours;if(t.autocontour){var r=Nh(t.zmin,t.zmax,t.ncontours);e.size=r.dtick,e.start=ri.tickFirst(r),r.range.reverse(),e.end=ri.tickFirst(r),e.start===t.zmin&&(e.start+=e.size),e.end===t.zmax&&(e.end-=e.size),e.start>e.end&&(e.start=e.end=(e.start+e.end)/2),t._input.contours||(t._input.contours={}),Fh(t._input.contours,{start:e.start,end:e.end,size:e.size}),t._input.autocontour=!0}else if("constraint"!==e.type){var n,i=e.start,a=e.end,o=t._input.contours;if(i>a&&(e.start=o.start=a,a=e.end=o.end=i,i=e.start),!(e.size>0))n=i===a?1:Nh(i,a,t.ncontours).dtick,o.size=e.size=n}};function Nh(t,e,r){var n={type:"linear",range:[t,e]};return ri.autoTicks(n,(e-t)/(r||15)),n}var jh=function(t){for(var e=0,r=0;r=0;a--)(o=((c[[(r=(i=h[a])[0])-1,n=i[1]]]||d)[2]+(c[[r+1,n]]||d)[2]+(c[[r,n-1]]||d)[2]+(c[[r,n+1]]||d)[2])/20)&&(s[i]=[r,n,o],h.splice(a,1),l=!0);if(!l)throw"findEmpties iterated with no new neighbors";for(i in s)c[i]=s[i],u.push(s[i])}return u.sort(function(t,e){return e[2]-t[2]})},Uh=ne.isArrayOrTypedArray,qh=function(t){return!Uh(t.z[0])},Hh=[[-1,0],[1,0],[0,-1],[0,1]];function Gh(t){return.5-.25*Math.min(1,.5*t)}var Wh=function(t,e,r){var n,i,a=1;if(Array.isArray(r))for(n=0;n.01;n++)a=Yh(t,e,Gh(a));return a>.01&&ne.log("interp2d didn't converge quickly",a),t};function Yh(t,e,r){var n,i,a,o,s,l,u,c,h,f,p,d,g,v=0;for(o=0;od&&(v=Math.max(v,Math.abs(t[i][a]-p)/(g-d))))}return v}var Xh=ne.isArrayOrTypedArray,Zh=function(t,e,r,n,i,a){var o,s,l,u=[],c=P.traceIs(t,"contour"),h=P.traceIs(t,"histogram"),f=P.traceIs(t,"gl2d");if(Xh(e)&&e.length>1&&!h&&"category"!==a.type){var p=e.length;if(!(p<=i))return c?e.slice(0,i):e.slice(0,i+1);if(c||f)u=e.slice(0,i);else if(1===i)u=[e[0]-.5,e[0]+.5];else{for(u=[1.5*e[0]-.5*e[1]],l=1;la){var o=a-n[t];return n[t]=a,o}}return 0},max:function(t,e,n,i){var a=i[e];if(r(a)){if(a=Number(a),!r(n[t]))return n[t]=a,a;if(n[t]p&&ptf){var d=a===Qh?1:6,g=a===Qh?"M12":"M1";return function(e,r){var a=n.c2d(e,Qh,i),s=a.indexOf("-",d);s>0&&(a=a.substr(0,s));var l=n.d2c(a,0,i);if(lnf?t>tf?t>1.1*Qh?Qh:t>1.1*$h?$h:tf:t>ef?ef:t>rf?rf:nf:Math.pow(10,Math.floor(Math.log(t)/Math.LN10))}function uf(t,e,r,n,i,a){if(n&&t>tf){var o=cf(e,i,a),s=cf(r,i,a),l=t===Qh?0:1;return o[l]!==s[l]}return Math.floor(r/t)-Math.floor(e/t)>.1}function cf(t,e,r){var n=e.c2d(t,Qh,r).split("-");return""===n[0]&&(n.unshift(),n[0]="-"+n[0]),n}var hf=ne.cleanDate,ff=t.ONEDAY,pf=t.BADNUM,df=function(t,e,n){var i=e.type,a=n+"bins",o=t[a];o||(o=t[a]={});var s="date"===i?function(t){return t||0===t?hf(t,pf,o.calendar):null}:function(t){return r(t)?Number(t):null};o.start=s(o.start),o.end=s(o.end);var l="date"===i?ff:1,u=o.size;if(r(u))o.size=u>0?Number(u):l;else if("string"!=typeof u)o.size=l;else{var c=u.charAt(0),h=u.substr(1);((h=r(h)?Number(h):0)<=0||"date"!==i||"M"!==c||h!==Math.round(h))&&(o.size=l)}var f="autobin"+n;"boolean"!=typeof t[f]&&(t[f]=t._fullInput[f]=t._input[f]=!((o.start||0===o.start)&&(o.end||0===o.end))),t[f]||(delete t["nbins"+n],delete t._fullInput["nbins"+n])},gf={percent:function(t,e){for(var r=t.length,n=100/e,i=0;iv&&s.splice(v,s.length-v),u.length>v&&u.splice(v,u.length-v),vf(e,"x",s,o,f,d,c),vf(e,"y",u,l,p,g,h);var m=[],y=[],x=[],b="string"==typeof e.xbins.size,_="string"==typeof e.ybins.size,w=[],M=[],A=b?w:e.xbins,k=_?M:e.ybins,T=0,S=[],E=[],C=e.histnorm,L=e.histfunc,z=-1!==C.indexOf("density"),P="max"===L||"min"===L?null:0,I=Kh.count,D=gf[C],O=!1,R=[],F=[],B="z"in e?e.z:"marker"in e&&Array.isArray(e.marker.color)?e.marker.color:"";B&&"count"!==L&&(O="avg"===L,I=Kh[L]);var N=e.xbins,j=f(N.start),V=f(N.end)+(j-ri.tickIncrement(j,N.size,!1,c))/1e6;for(r=j;r=0&&i=0&&ax){m("x scale is not linear");break}}if(a.length&&"fast"===v){var b=(a[a.length-1]-a[0])/(a.length-1),_=Math.abs(b/100);for(u=0;u_){m("y scale is not linear");break}}}var w=jh(l),M="scaled"===e.xtype?"":r,A=Zh(e,M,n,i,w,h),k="scaled"===e.ytype?"":a,T=Zh(e,k,o,s,l.length,f);g||(ri.expand(h,A),ri.expand(f,T));var S={x:A,y:T,z:l,text:e.text};if(M&&M.length===A.length-1&&(S.xCenter=M),k&&k.length===T.length-1&&(S.yCenter=k),d&&(S.xRanges=c.xRanges,S.yRanges=c.yRanges,S.pts=c.pts),p&&"constraint"===e.contours.type||Ve(e,l,"","z"),p&&e.contours&&"heatmap"===e.contours.coloring){var E={type:"contour"===e.type?"heatmap":"histogram2d",xcalendar:e.xcalendar,ycalendar:e.ycalendar};S.xfill=Zh(E,M,n,i,w,h),S.yfill=Zh(E,k,o,s,l.length,f)}return[S]},_f=function(t,e){var r=bf(t,e);return Bh(e),r},wf=function(t){return t.end+t.size/1e6},Mf=function(t){var r=t.contours,n=r.start,i=wf(r),a=r.size||1,o=Math.floor((i-n)/a)+1,s="lines"===r.coloring?0:1;isFinite(a)||(a=1,o=1);var l,u,c=t.colorscale,h=c.length,f=new Array(h),p=new Array(h);if("heatmap"===r.coloring){for(t.zauto&&!1===t.autocontour&&(t.zmin=n-a/2,t.zmax=t.zmin+o*a),u=0;u2?e.value=e.value.slice(2):0===e.length?e.value=[0,1]:e.length<2?(n=parseFloat(e.value[0]),e.value=[n,n+1]):e.value=[parseFloat(e.value[0]),parseFloat(e.value[1])]:r(e.value)&&(n=parseFloat(e.value),e.value=[n,n+1])):(t("contours.value",0),r(e.value)||(Array.isArray(e.value)?e.value=parseFloat(e.value[0]):e.value=0))}(n,c),"="===h?s=c.showlines=!0:(s=n("contours.showlines"),u=n("fillcolor",Tf((t.line||{}).color||a,.5))),s)&&(l=n("line.color",u&&Sf(u)?Tf(e.fillcolor,1):a),n("line.width",2),n("line.dash"));n("line.smoothing"),kf(n,i,l,o)};var zf=function(t,e,r,n){var i=n("contours.start"),a=n("contours.end"),o=!1===i||!1===a,s=r("contours.size");!(o?e.autocontour=!0:r("autocontour",!1))&&s||r("ncontours")},Pf=function(t,e,r,n,i){var a,o=r("contours.coloring"),s="";"fill"===o&&(a=r("contours.showlines")),!1!==a&&("lines"!==o&&(s=r("line.color","#000")),r("line.width",.5),r("line.dash")),"none"!==o&&Ye(t,e,n,r,{prefix:"",cLetter:"z"}),r("line.smoothing"),kf(r,n,s,i)},If=ne.isArrayOrTypedArray,Df=function(t,e,n,i,a,o){var s,l,u=n("z");if(a=a||"x",o=o||"y",void 0===u||!u.length)return 0;if(qh(t)){if(s=n(a),l=n(o),!s||!l)return 0}else{if(s=Of(a,n),l=Of(o,n),!function(t){for(var e,n=!0,i=!1,a=!1,o=0;o0&&(i=!0);for(var s=0;s=v[0].length||u<0||u>v.length)return}else{if(yo.inbox(e-d[0],e-d[d.length-1],0)>0||yo.inbox(r-g[0],r-g[g.length-1],0)>0)return;if(a){var A;for(w=[2*d[0]-d[1]],A=1;A":h.value>f&&(s.prefixBoundary=!0);break;case"<":h.valuef)&&(s.prefixBoundary=!0);break;case"][":a=Math.min.apply(null,h.value),o=Math.max.apply(null,h.value),af&&(s.prefixBoundary=!0)}},Nf={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}},jf=function(t,e){var r,n,i,a=function(t){return t.reverse()},o=function(t){return t};switch(e){case"=":case"<":return t;case">":for(1!==t.length&&ne.warn("Contour data invalid for the specified inequality operation."),n=t[0],r=0;r":Gf(">"),"<":Gf("<"),"=":Gf("=")};function qf(t,e){var n,i=Array.isArray(e);function a(t){return r(t)?+t:null}return-1!==Eh.COMPARISON_OPS2.indexOf(t)?n=a(i?e[0]:e):-1!==Eh.INTERVAL_OPS.indexOf(t)?n=i?[a(e[0]),a(e[1])]:[a(e),a(e)]:-1!==Eh.SET_OPS.indexOf(t)&&(n=i?e.map(a):[a(e)]),n}function Hf(t){return function(e){e=qf(t,e);var r=Math.min(e[0],e[1]),n=Math.max(e[0],e[1]);return{start:r,end:n,size:n-r}}}function Gf(t){return function(e){return{start:e=qf(t,e),end:1/0,size:1/0}}}var Wf=function(t,e,r){for(var n="constraint"===t.type?Uf[t._operation](t.value):t,i=n.size,a=[],o=wf(n),s=r.trace.carpetTrace,l=s?{xaxis:s.aaxis,yaxis:s.baxis,x:r.a,y:r.b}:{xaxis:e.xaxis,yaxis:e.yaxis,x:r.x,y:r.y},u=n.start;u1e3){ne.warn("Too many contours, clipping at 1000",t);break}return a},Yf=function(t,e,r){var n,i,a,o;for(e=e||.01,r=r||.01,i=0;i20&&e?208===t||1114===t?n=0===r[0]?1:-1:i=0===r[1]?1:-1:-1!==Nf.BOTTOMSTART.indexOf(t)?i=1:-1!==Nf.LEFTSTART.indexOf(t)?n=1:-1!==Nf.TOPSTART.indexOf(t)?i=-1:n=-1;return[n,i]}(l,r,e),c=[Jf(t,e,[-u[0],-u[1]])],h=u.join(","),f=t.z.length,p=t.z[0].length;for(a=0;a<1e4;a++){if(l>20?(l=Nf.CHOOSESADDLE[l][(u[0]||u[1])<0?0:1],t.crossings[s]=Nf.SADDLEREMAINDER[l]):delete t.crossings[s],!(u=Nf.NEWDELTA[l])){ne.log("Found bad marching index:",l,e,t.level);break}c.push(Jf(t,e,u)),e[0]+=u[0],e[1]+=u[1],Xf(c[c.length-1],c[c.length-2],n,i)&&c.pop(),s=e.join(",");var d=u[0]&&(e[0]<0||e[0]>p-2)||u[1]&&(e[1]<0||e[1]>f-2);if(s===o&&u.join(",")===h||r&&d)break;l=t.crossings[s]}1e4===a&&ne.log("Infinite loop in contour?");var g,v,m,y,x,b,_,w,M,A,k,T,S,E,C,L=Xf(c[0],c[c.length-1],n,i),z=0,P=.2*t.smoothing,I=[],D=0;for(a=1;a=D;a--)if((g=I[a])=D&&g+I[v]w&&M--,t.edgepaths[M]=k.concat(c,A));break}B||(t.edgepaths[w]=c.concat(A))}for(w=0;wt?0:1)+(e[0][1]>t?0:2)+(e[1][1]>t?0:4)+(e[1][0]>t?0:8);return 5===r||10===r?t>(e[0][0]+e[0][1]+e[1][0]+e[1][1])/4?5===r?713:1114:5===r?104:208:15===r?0:r}var $f=function(t,e,r){for(var n=0;n0;)f=o.c2p(y[v]),v--;for(f0;)g=l.c2p(x[v]),v--;if(gt.level}return r?"M"+e.join("L")+"Z":""}(t,e),c=0,h=t.edgepaths.map(function(t,e){return e}),f=!0;function p(t){return Math.abs(t[1]-e[2][1])<.01}function d(t){return Math.abs(t[0]-e[0][0])<.01}function g(t){return Math.abs(t[0]-e[2][0])<.01}for(;h.length;){for(s=Sr.smoothopen(t.edgepaths[c],t.smoothing),u+=f?s:s.replace(/^M/,"L"),h.splice(h.indexOf(c),1),r=t.edgepaths[c][t.edgepaths[c].length-1],a=-1,i=0;i<4;i++){if(!r){ne.log("Missing end?",c,t);break}for(l=r,Math.abs(l[1]-e[0][1])<.01&&!g(r)?n=e[1]:d(r)?n=e[0]:p(r)?n=e[3]:g(r)&&(n=e[2]),o=0;o=0&&(n=v,a=o):Math.abs(r[1]-n[1])<.01?Math.abs(r[1]-v[1])<.01&&(v[0]-r[0])*(n[0]-v[0])>=0&&(n=v,a=o):ne.log("endpt to newendpt is not vert. or horz.",r,n,v)}if(r=n,a>=0)break;u+="L"+n}if(a===t.edgepaths.length){ne.log("unclosed perimeter path");break}c=a,(f=-1===h.indexOf(c))&&(c=h[0],u+="Z")}for(c=0;cn.center?n.right-o:o-n.left)/(u+Math.abs(Math.sin(l)*a)),f=(s>n.middle?n.bottom-s:s-n.top)/(Math.abs(c)+Math.cos(l)*a);if(h<1||f<1)return 1/0;var p=ap.EDGECOST*(1/(h-1)+1/(f-1));p+=ap.ANGLECOST*l*l;for(var d=o-u,g=s-c,v=o+u,m=s+c,y=0;y2*ap.MAXCOST)break;f&&(o/=2),s=(a=l-o/2)+1.5*o}if(h<=ap.MAXCOST)return u},ip.addLabelData=function(t,e,r,n){var i=e.width/2,a=e.height/2,o=t.x,s=t.y,l=t.theta,u=Math.sin(l),c=Math.cos(l),h=i*c,f=a*u,p=i*u,d=-a*c,g=[[o-h-f,s-p-d],[o+h-f,s+p-d],[o+h+f,s+p+d],[o-h+f,s-p+d]];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(g)},ip.drawLabels=function(t,r,n,i,a){var o=t.selectAll("text").data(r,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 r=t.x+Math.sin(t.theta)*t.dy,i=t.y-Math.cos(t.theta)*t.dy;e.select(this).text(t.text).attr({x:r,y:i,transform:"rotate("+180*t.theta/Math.PI+" "+r+" "+i+")"}).call(er.convertToTspans,n)}),a){for(var s="",l=0;l0?Math.floor:Math.ceil,z=E>0?Math.ceil:Math.floor,P=E>0?Math.min:Math.max,I=E>0?Math.max:Math.min,D=L(T+C),O=z(S-C),R=[[c=k(T)]];for(i=D;i*E=0&&(c=T,f=p):Math.abs(u[1]-c[1])=0&&(c=T,f=p):ne.log("endpt to newendpt is not vert. or horz.",u,c,T)}if(f>=0)break;g+=A(u,c),u=c}if(f===e.edgepaths.length){ne.log("unclosed perimeter path");break}l=f,(m=-1===v.indexOf(l))&&(l=v[0],g+=A(u,c)+"Z",u=null)}for(l=0;l=0;T--)M=o.clipsegments[T],A=Ou([],M.x,h.c2p),k=Ou([],M.y,f.c2p),A.reverse(),k.reverse(),E.push(Iu(A,k,M.bicubic));var C="M"+E.join("L")+"Z";!function(t,e,r,n,i,a){var o,s,l,u,c=t.selectAll("g.contourbg").data([0]);c.enter().append("g").classed("contourbg",!0);var h=c.selectAll("path").data("fill"!==a||i?[]:[0]);h.enter().append("path"),h.exit().remove();var f=[];for(u=0;uv&&(n.max=v);n.len=n.max-n.min}(this,e,t,n,s,r.height),!(n.len<(r.width+r.height)*Nf.LABELMIN)))for(var i=Math.min(Math.ceil(n.len/k),Nf.LABELMAX),a=0;a1)for(var r=1;r=0,d=r.indexOf("end")>=0,g=u.backoff*h+n.standoff,v=c.backoff*f+n.startstandoff;if("line"===l.nodeName){i={x:+t.attr("x1"),y:+t.attr("y1")},a={x:+t.attr("x2"),y:+t.attr("y2")};var m=i.x-a.x,y=i.y-a.y;if(s=(o=Math.atan2(y,m))+Math.PI,g&&v&&g+v>Math.sqrt(m*m+y*y))return void C();if(g){if(g*g>m*m+y*y)return void C();var x=g*Math.cos(o),b=g*Math.sin(o);a.x+=x,a.y+=b,t.attr({x2:a.x,y2:a.y})}if(v){if(v*v>m*m+y*y)return void C();var _=v*Math.cos(o),w=v*Math.sin(o);i.x-=_,i.y-=w,t.attr({x1:i.x,y1:i.y})}}else if("path"===l.nodeName){var M=l.getTotalLength(),A="";if(M2/3?"right":"center"),{center:0,middle:0,left:.5,bottom:-.5,right:-.5,top:.5}[e]}r._w=E,r._h=C;for(var D=!1,O=["x","y"],R=0;R1)&&(H===q?(($=G.r2fraction(r["a"+U]))<0||$>1)&&(D=!0):D=!0,D))continue;F=G._offset+G.r2p(r[U]),j=.5}else"x"===U?(N=r[U],F=c.l+c.w*N):(N=1-r[U],F=c.t+c.h*N),j=r.showarrow?.5:N;if(r.showarrow){Q.head=F;var tt=r["a"+U];V=Y*I(.5,r.xanchor)-X*I(.5,r.yanchor),H===q?(Q.tail=G._offset+G.r2p(tt),B=V):(Q.tail=F+tt,B=V+tt),Q.text=Q.tail+V;var et=u["x"===U?"width":"height"];if("paper"===q&&(Q.head=ne.constrain(Q.head,1,et-1)),"pixel"===H){var rt=-Math.max(Q.tail-3,Q.text),nt=Math.min(Q.tail+3,Q.text)-et;rt>0?(Q.tail+=rt,Q.text+=rt):nt>0&&(Q.tail-=nt,Q.text-=nt)}Q.tail+=K,Q.head+=K}else B=V=Z*I(j,J),Q.text=F+V;Q.text+=K,V+=K,B+=K,r["_"+U+"padplus"]=Z/2+B,r["_"+U+"padminus"]=Z/2-B,r["_"+U+"size"]=Z,r["_"+U+"shift"]=V}if(D)x.remove();else{var it=0,at=0;if("left"!==r.align&&(it=(E-_)*("center"===r.align?.5:1)),"top"!==r.valign&&(at=(C-T)*("middle"===r.valign?.5:1)),s)n.select("svg").attr({x:w+it-1,y:w+at}).call(Sr.setClipUrl,A?f:null);else{var ot=w+at-y.top,st=w+it-y.left;S.call(er.positionText,st,ot).call(Sr.setClipUrl,A?f:null)}k.select("rect").call(Sr.setRect,w,w,E,C),M.call(Sr.setRect,b/2,b/2,L-b,z-b),x.call(Sr.setTranslate,Math.round(p.x.text-L/2),Math.round(p.y.text-z/2)),v.attr({transform:"rotate("+d+","+p.x.text+","+p.y.text+")"});var lt,ut,ct=function(e,n){g.selectAll(".annotation-arrow-g").remove();var s=p.x.head,u=p.y.head,f=p.x.tail+e,m=p.y.tail+n,y=p.x.text+e,b=p.y.text+n,_=ne.rotationXYMatrix(d,y,b),w=ne.apply2DTransform(_),A=ne.apply2DTransform2(_),k=+M.attr("width"),T=+M.attr("height"),S=y-.5*k,E=S+k,C=b-.5*T,L=C+T,z=[[S,C,S,L],[S,L,E,L],[E,L,E,C],[E,C,S,C]].map(A);if(!z.reduce(function(t,e){return t^!!ne.segmentsIntersect(s,u,s+1e6,u+1e6,e[0],e[1],e[2],e[3])},!1)){z.forEach(function(t){var e=ne.segmentsIntersect(f,m,s,u,t[0],t[1],t[2],t[3]);e&&(f=e.x,m=e.y)});var I=r.arrowwidth,D=r.arrowcolor,O=r.arrowside,R=g.append("g").style({opacity:Oe.opacity(D)}).classed("annotation-arrow-g",!0),F=R.append("path").attr("d","M"+f+","+m+"L"+s+","+u).style("stroke-width",I+"px").call(Oe.stroke,Oe.rgb(D));if(Kp(F,O,r),h.annotationPosition&&F.node().parentNode&&!i){var B=s,N=u;if(r.standoff){var j=Math.sqrt(Math.pow(s-f,2)+Math.pow(u-m,2));B+=r.standoff*(f-s)/j,N+=r.standoff*(m-u)/j}var V,U,q,H=R.append("path").classed("annotation-arrow",!0).classed("anndrag",!0).attr({d:"M3,3H-3V-3H3ZM0,0L"+(f-B)+","+(m-N),transform:"translate("+B+","+N+")"}).style("stroke-width",I+6+"px").call(Oe.stroke,"rgba(0,0,0,0)").call(Oe.fill,"rgba(0,0,0,0)");Ua.init({element:H.node(),gd:t,prepFn:function(){var t=Sr.getTranslate(x);U=t.x,q=t.y,V={},a&&a.autorange&&(V[a._name+".autorange"]=!0),o&&o.autorange&&(V[o._name+".autorange"]=!0)},moveFn:function(t,e){var n=w(U,q),i=n[0]+t,s=n[1]+e;x.call(Sr.setTranslate,i,s),V[l+".x"]=a?a.p2r(a.r2p(r.x)+t):r.x+t/c.w,V[l+".y"]=o?o.p2r(o.r2p(r.y)+e):r.y-e/c.h,r.axref===r.xref&&(V[l+".ax"]=a.p2r(a.r2p(r.ax)+t)),r.ayref===r.yref&&(V[l+".ay"]=o.p2r(o.r2p(r.ay)+e)),R.attr("transform","translate("+t+","+e+")"),v.attr({transform:"rotate("+d+","+i+","+s+")"})},doneFn:function(){P.call("relayout",t,V);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}};if(r.showarrow&&ct(0,0),m)Ua.init({element:x.node(),gd:t,prepFn:function(){ut=v.attr("transform"),lt={}},moveFn:function(t,e){var n="pointer";if(r.showarrow)r.axref===r.xref?lt[l+".ax"]=a.p2r(a.r2p(r.ax)+t):lt[l+".ax"]=r.ax+t,r.ayref===r.yref?lt[l+".ay"]=o.p2r(o.r2p(r.ay)+e):lt[l+".ay"]=r.ay+e,ct(t,e);else{if(i)return;if(a)lt[l+".x"]=a.p2r(a.r2p(r.x)+t);else{var s=r._xsize/c.w,u=r.x+(r._xshift-r.xshift)/c.w-s/2;lt[l+".x"]=Ua.align(u+t/c.w,s,0,1,r.xanchor)}if(o)lt[l+".y"]=o.p2r(o.r2p(r.y)+e);else{var h=r._ysize/c.h,f=r.y-(r._yshift+r.yshift)/c.h-h/2;lt[l+".y"]=Ua.align(f-e/c.h,h,0,1,r.yanchor)}a&&o||(n=Ua.getCursor(a?.5:lt[l+".x"],o?.5:lt[l+".y"],r.xanchor,r.yanchor))}v.attr({transform:"translate("+t+","+e+")"+ut}),Ka(x,n)},doneFn:function(){Ka(x),P.call("relayout",t,lt);var e=document.querySelector(".js-notes-box-panel");e&&e.redraw(e.selectedObj)}})}}}var ed=Qp.draw;function rd(t){var e=t._fullLayout;ne.filterVisible(e.annotations).forEach(function(e){var r,n,i,a,o=ri.getFromId(t,e.xref),s=ri.getFromId(t,e.yref),l=3*e.arrowsize*e.arrowwidth||0,u=3*e.startarrowsize*e.arrowwidth||0;o&&o.autorange&&(r=l+e.xshift,n=l-e.xshift,i=u+e.xshift,a=u-e.xshift,e.axref===e.xref?(ri.expand(o,[o.r2c(e.x)],{ppadplus:r,ppadminus:n}),ri.expand(o,[o.r2c(e.ax)],{ppadplus:Math.max(e._xpadplus,i),ppadminus:Math.max(e._xpadminus,a)})):(i=e.ax?i+e.ax:i,a=e.ax?a-e.ax:a,ri.expand(o,[o.r2c(e.x)],{ppadplus:Math.max(e._xpadplus,r,i),ppadminus:Math.max(e._xpadminus,n,a)}))),s&&s.autorange&&(r=l-e.yshift,n=l+e.yshift,i=u-e.yshift,a=u+e.yshift,e.ayref===e.yref?(ri.expand(s,[s.r2c(e.y)],{ppadplus:r,ppadminus:n}),ri.expand(s,[s.r2c(e.ay)],{ppadplus:Math.max(e._ypadplus,i),ppadminus:Math.max(e._ypadminus,a)})):(i=e.ay?i+e.ay:i,a=e.ay?a-e.ay:a,ri.expand(s,[s.r2c(e.y)],{ppadplus:Math.max(e._ypadplus,r,i),ppadminus:Math.max(e._ypadminus,n,a)})))})}var nd={hasClickToShow:function(t,e){var r=id(t,e);return r.on.length>0||r.explicitOff.length>0},onClick:function(t,e){var r,n=id(t,e),i=n.on,a=n.off.concat(n.explicitOff),o={};if(!i.length&&!a.length)return;for(r=0;r1){o=!0;break}}o?t.fullLayout._infolayer.select(".annotation-"+t.id+'[data-index="'+i+'"]').remove():(a._pdata=gd(t.glplot.cameraParams,[e.xaxis.r2l(a.x)*r[0],e.yaxis.r2l(a.y)*r[1],e.zaxis.r2l(a.z)*r[2]]),vd(t.graphDiv,a,i,t.id,a._xa,a._ya))}}};var xd={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"}}},bd=function(t){var e=t.type,r=t.symmetric;if("data"===e){var n=t.array||[];if(r)return function(t,e){var r=+n[e];return[r,r]};var i=t.arrayminus||[];return function(t,e){var r=+n[e],a=+i[e];return isNaN(r)&&isNaN(a)?[NaN,NaN]:[a||0,r||0]}}var a=_d(e,t.value),o=_d(e,t.valueminus);return r||void 0===t.valueminus?function(t){var e=a(t);return[e,e]}:function(t){return[o(t),a(t)]}};function _d(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}var wd=function(t){for(var e=t.calcdata,r=0;r0;t.each(function(t){var l,u=t[0].trace,c=u.error_x||{},h=u.error_y||{};u.ids&&(l=function(t){return t.id});var f=Tr.hasMarkers(u)&&u.marker.maxdisplayed>0;h.visible||c.visible||(t=[]);var p=e.select(this).selectAll("g.errorbar").data(t,l);if(p.exit().remove(),t.length){c.visible||p.selectAll("path.xerror").remove(),h.visible||p.selectAll("path.yerror").remove(),p.style("opacity",1);var d=p.enter().append("g").classed("errorbar",!0);s&&d.style("opacity",0).transition().duration(i.duration).style("opacity",1),Sr.setClipUrl(p,n.layerClipId),p.each(function(t){var n=e.select(this),l=function(t,e,n){var i={x:e.c2p(t.x),y:n.c2p(t.y)};return void 0!==t.yh&&(i.yh=n.c2p(t.yh),i.ys=n.c2p(t.ys),r(i.ys)||(i.noYS=!0,i.ys=n.c2p(t.ys,!0))),void 0!==t.xh&&(i.xh=e.c2p(t.xh),i.xs=e.c2p(t.xs),r(i.xs)||(i.noXS=!0,i.xs=e.c2p(t.xs,!0))),i}(t,a,o);if(!f||t.vis){var u,p=n.select("path.yerror");if(h.visible&&r(l.x)&&r(l.yh)&&r(l.ys)){var d=h.width;u="M"+(l.x-d)+","+l.yh+"h"+2*d+"m-"+d+",0V"+l.ys,l.noYS||(u+="m-"+d+",0h"+2*d),p.size()?s&&(p=p.transition().duration(i.duration).ease(i.easing)):p=n.append("path").style("vector-effect","non-scaling-stroke").classed("yerror",!0),p.attr("d",u)}else p.remove();var g=n.select("path.xerror");if(c.visible&&r(l.y)&&r(l.xh)&&r(l.xs)){var v=(c.copy_ystyle?h:c).width;u="M"+l.xh+","+(l.y-v)+"v"+2*v+"m0,-"+v+"H"+l.xs,l.noXS||(u+="m0,-"+v+"v"+2*v),g.size()?s&&(g=g.transition().duration(i.duration).ease(i.easing)):g=n.append("path").style("vector-effect","non-scaling-stroke").classed("xerror",!0),g.attr("d",u)}else g.remove()}})}})},style:function(t){t.each(function(t){var r=t[0].trace,n=r.error_y||{},i=r.error_x||{},a=e.select(this);a.selectAll("path.yerror").style("stroke-width",n.thickness+"px").call(Oe.stroke,n.color),i.copy_ystyle&&(i=n),a.selectAll("path.xerror").style("stroke-width",i.thickness+"px").call(Oe.stroke,i.color)})},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))}};var Ed=tt.counter,Cd=qc.attributes,Ld=Te.idRegex,zd={rows:{valType:"integer",min:1,editType:"plot"},roworder:{valType:"enumerated",values:["top to bottom","bottom to top"],dflt:"top to bottom",editType:"plot"},columns:{valType:"integer",min:1,editType:"plot"},subplots:{valType:"info_array",freeLength:!0,dimensions:2,items:{valType:"enumerated",values:[Ed("xy").toString(),""],editType:"plot"},editType:"plot"},xaxes:{valType:"info_array",freeLength:!0,items:{valType:"enumerated",values:[Ld.x.toString(),""],editType:"plot"},editType:"plot"},yaxes:{valType:"info_array",freeLength:!0,items:{valType:"enumerated",values:[Ld.y.toString(),""],editType:"plot"},editType:"plot"},pattern:{valType:"enumerated",values:["independent","coupled"],dflt:"coupled",editType:"plot"},xgap:{valType:"number",min:0,max:1,editType:"plot"},ygap:{valType:"number",min:0,max:1,editType:"plot"},domain:Cd({name:"grid",editType:"plot",noGridCell:!0},{}),xside:{valType:"enumerated",values:["bottom","bottom plot","top plot","top"],dflt:"bottom plot",editType:"ticks"},yside:{valType:"enumerated",values:["left","left plot","right plot","right"],dflt:"left plot",editType:"ticks"},editType:"plot"};function Pd(t,e,r,n,i){var a=e(t+"gap",r),o=e("domain."+t);e(t+"side");for(var s=new Array(n),l=o[0],u=(o[1]-l)/(n-a),c=u*(1-a),h=0;h1){a||o||s||"independent"===f("pattern")&&(a=!0),l._hasSubplotGrid=a;var h="top to bottom"===f("roworder");l._domains={x:Pd("x",f,a?.2:.1,c),y:Pd("y",f,a?.3:.1,u,h)}}}function f(t,e){return ne.coerce(r,l,zd,t,e)}},contentDefaults:function(t,e){var r=e.grid;if(r&&r._domains){var n,i,a,o,s,l,u,c=t.grid,h=e._subplots,f=r._hasSubplotGrid,p=r.rows,d=r.columns,g="independent"===r.pattern,v=r._axisMap={};if(f){var m=c.subplots||[];l=r.subplots=new Array(p);var y=1;for(n=0;n=2/3},isCenterAnchor:function(t){return"center"===t.xanchor||"auto"===t.xanchor&&t.x>1/3&&t.x<2/3},isBottomAnchor:function(t){return"bottom"===t.yanchor||"auto"===t.yanchor&&t.y<=1/3},isMiddleAnchor:function(t){return"middle"===t.yanchor||"auto"===t.yanchor&&t.y>1/3&&t.y<2/3}},Ud={scrollBarWidth:6,scrollBarMinHeight:20,scrollBarColor:"#808BA4",scrollBarMargin:4},qd=!0,Hd=function(t,e,r){if(!e._dragged&&!e._editing){var n,i,a,o,s,l=e._fullLayout.hiddenlabels?e._fullLayout.hiddenlabels.slice():[],u=t.data()[0][0],c=e._fullData,h=u.trace,f=h.legendgroup,p={},d=[],g=[],v=[];if(1===r&&qd&&e.data&&e._context.showTips?(ne.notifier(ne._(e,"Double-click on legend to isolate one trace"),"long"),qd=!1):qd=!1,P.traceIs(h,"pie")){var m=u.label,y=l.indexOf(m);1===r?-1===y?l.push(m):l.splice(y,1):2===r&&(l=[],e.calcdata[0].forEach(function(t){m!==t.label&&l.push(t.label)}),e._fullLayout.hiddenlabels&&e._fullLayout.hiddenlabels.length===l.length&&-1===y&&(l=[])),P.call("relayout",e,"hiddenlabels",l)}else{var x,b=f&&f.length,_=[];if(b)for(n=0;nr[1])return r[1]}return i}function h(t){return t[0]}if(s||l||u){var f={},p={};s&&(f.mc=c("marker.color",h),f.mo=c("marker.opacity",ne.mean,[.2,1]),f.ms=c("marker.size",ne.mean,[2,16]),f.mlc=c("marker.line.color",h),f.mlw=c("marker.line.width",ne.mean,[0,5]),p.marker={sizeref:1,sizemin:1,sizemode:"diameter"}),u&&(p.line={width:c("line.width",h,[0,10])}),l&&(f.tx="Aa",f.tp=c("textposition",h),f.ts=10,f.tc=c("textfont.color",h),f.tf=c("textfont.family",h)),n=[ne.minExtend(a,f)],i=ne.minExtend(o,p)}var d=e.select(this).select("g.legendpoints"),g=d.selectAll("path.scatterpts").data(s?n:[]);g.enter().append("path").classed("scatterpts",!0).attr("transform","translate(20,0)"),g.exit().remove(),g.call(Sr.pointStyle,i,r),s&&(n[0].mrc=3);var v=d.selectAll("g.pointtext").data(l?n:[]);v.enter().append("g").classed("pointtext",!0).append("text").attr("transform","translate(20,0)"),v.exit().remove(),v.selectAll("text").call(Sr.textPointStyle,i,r)})},Zd=Qe.LINE_SPACING,Jd=Qe.FROM_TL,Kd=Qe.FROM_BR,Qd=f.DBLCLICKDELAY;function $d(t,e){var r=t.data()[0][0],n=e._fullLayout,i=r.trace,a=P.traceIs(i,"pie"),o=i.index,s=a?r.label:i.name,l=t.selectAll("text.legendtext").data([0]);function u(r){er.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*Zd;if(o){var l=Sr.bBox(o);n=l.height,i=l.width,Sr.setTranslate(a,0,n/4)}else{var u=t.select(".legendtext"),c=er.lineCount(u),h=u.node();n=s*c,i=h?Sr.bBox(h).width:0;var f=s*(.3+(1-c)/2);er.positionText(u,40,f)}n=Math.max(n,16)+3,r.height=n,r.width=i}(t,e)})}l.enter().append("text").classed("legendtext",!0),l.attr("text-anchor","start").classed("user-select-none",!0).call(Sr.font,n.legend.font).text(s),e._context.edits.legendText&&!a?l.call(er.makeEditable,{gd:e}).call(u).on("edit",function(t){this.text(t).call(u);var n,i=t;this.text()||(t=" ");var a=r.trace._fullInput||{},s={};if(-1!==["ohlc","candlestick"].indexOf(a.type))s[(n=r.trace.transforms)[n.length-1].direction+".name"]=t;else if(P.hasTransform(a,"groupby")){var l=P.getTransformIndices(a,"groupby"),c=l[l.length-1],h=ne.keyedContainer(a,"transforms["+c+"].styles","target","value.name");""===i?h.remove(r.trace._group):h.set(r.trace._group,t),s=h.constructUpdate()}else s.name=t;return P.call("restyle",e,s,o)}):u(l)}function tg(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(Oe.fill,"rgba(0,0,0,0)"),i.on("mousedown",function(){(r=(new Date).getTime())-e._legendMouseDownTimeQd&&(n=Math.max(n-1,1)),1===n?r._clickTimeout=setTimeout(function(){Hd(t,e,n)},Qd):2===n&&(r._clickTimeout&&clearTimeout(r._clickTimeout),e._legendMouseDownTime=0,Hd(t,e,n))}})}function eg(t,r,n){var i=t._fullLayout,a=i.legend,o=a.borderwidth,s=jd.isGrouped(a),l=0;if(a._width=0,a._height=0,jd.isVertical(a))s&&r.each(function(t,e){Sr.setTranslate(this,0,e*a.tracegroupgap)}),n.each(function(t){var e=t[0],r=e.height,n=e.width;Sr.setTranslate(this,o,5+o+a._height+r/2),a._height+=r,a._width=Math.max(a._width,n)}),a._width+=45+2*o,a._height+=10+2*o,s&&(a._height+=(a._lgroupsLength-1)*a.tracegroupgap),l=40;else if(s){for(var u=[a._width],c=r.data(),h=0,f=c.length;ho+b-_,n.each(function(t){var e=t[0],r=g?40+t[0].width:y;o+x+_+r>i.width-(i.margin.r+i.margin.l)&&(x=0,v+=m,a._height=a._height+m,m=0),Sr.setTranslate(this,o+x,5+o+e.height/2+v),a._width+=_+r,a._height=Math.max(a._height,e.height),x+=_+r,m=Math.max(e.height,m)}),a._width+=2*o,a._height+=10+2*o}a._width=Math.ceil(a._width),a._height=Math.ceil(a._height),n.each(function(r){var n=r[0],i=e.select(this).select(".legendtoggle");Sr.setRect(i,0,-n.height/2,(t._context.edits.legendText?0:a._width)+l,n.height)})}function rg(t){var e=t._fullLayout.legend,r="left";Vd.isRightAnchor(e)?r="right":Vd.isCenterAnchor(e)&&(r="center");var n="top";Vd.isBottomAnchor(e)?n="bottom":Vd.isMiddleAnchor(e)&&(n="middle"),_n.autoMargin(t,"legend",{x:e.x,y:e.y,l:e._width*Jd[r],r:e._width*Kd[r],b:e._height*Kd[n],t:e._height*Jd[n]})}var ng={moduleType:"component",name:"legend",layoutAttributes:Nd,supplyLayoutDefaults:function(t,e,r){for(var n,i,a,o,s=t.legend||{},l={},u=0,c="normal",h=0;h1)){if(e.legend=l,p("bgcolor",e.paper_bgcolor),p("bordercolor"),p("borderwidth"),ne.coerceFont(p,"font",e.font),p("orientation"),"h"===l.orientation){var d=t.xaxis;d&&d.rangeslider&&d.rangeslider.visible?(n=0,a="left",i=1.1,o="bottom"):(n=0,a="left",i=-.1,o="top")}p("traceorder",c),jd.isGrouped(e.legend)&&p("tracegroupgap"),p("x",n),p("xanchor",a),p("y",i),p("yanchor",o),ne.noneOrAll(s,l,["x","y"])}},draw:function(t){var r=t._fullLayout,n="legend"+r._uid;if(r._infolayer&&t.calcdata){t._legendMouseDownTime||(t._legendMouseDownTime=0);var i=r.legend,a=r.showlegend&&function(t,e){var r,n,i={},a=[],o=!1,s={},l=0;function u(t,r){if(""!==t&&jd.isGrouped(e))-1===a.indexOf(t)?(a.push(t),o=!0,i[t]=[[r]]):i[t].push([r]);else{var n="~~i"+l;a.push(n),i[n]=[[r]],l++}}for(r=0;rg?function(t){var e=t._fullLayout.legend,r="left";Vd.isRightAnchor(e)?r="right":Vd.isCenterAnchor(e)&&(r="center"),_n.autoMargin(t,"legend",{x:e.x,y:.5,l:e._width*Jd[r],r:e._width*Kd[r],b:0,t:0})}(t):rg(t);var v=r._size,m=v.l+v.w*i.x,y=v.t+v.h*(1-i.y);Vd.isRightAnchor(i)?m-=i._width:Vd.isCenterAnchor(i)&&(m-=i._width/2),Vd.isBottomAnchor(i)?y-=i._height:Vd.isMiddleAnchor(i)&&(y-=i._height/2);var x=i._width,b=v.w;x>b?(m=v.l,x=b):(m+x>d&&(m=d-x),m<0&&(m=0),x=Math.min(d-m,i._width));var _,w,M,A,k=i._height,T=v.h;if(k>T?(y=v.t,k=T):(y+k>g&&(y=g-k),y<0&&(y=0),k=Math.min(g-y,i._height)),Sr.setTranslate(s,m,y),h.on(".drag",null),s.on("wheel",null),i._height<=k||t._context.staticPlot)u.attr({width:x-i.borderwidth,height:k-i.borderwidth,x:i.borderwidth/2,y:i.borderwidth/2}),Sr.setTranslate(c,0,0),l.select("rect").attr({width:x-2*i.borderwidth,height:k-2*i.borderwidth,x:i.borderwidth,y:i.borderwidth}),Sr.setClipUrl(c,n),Sr.setRect(h,0,0,0,0),delete i._scrollY;else{var S,E,C=Math.max(Ud.scrollBarMinHeight,k*k/i._height),L=k-C-2*Ud.scrollBarMargin,z=i._height-k,I=L/z,D=Math.min(i._scrollY||0,z);u.attr({width:x-2*i.borderwidth+Ud.scrollBarWidth+Ud.scrollBarMargin,height:k-i.borderwidth,x:i.borderwidth/2,y:i.borderwidth/2}),l.select("rect").attr({width:x-2*i.borderwidth+Ud.scrollBarWidth+Ud.scrollBarMargin,height:k-2*i.borderwidth,x:i.borderwidth,y:i.borderwidth+D}),Sr.setClipUrl(c,n),R(D,C,I),s.on("wheel",function(){R(D=ne.constrain(i._scrollY+e.event.deltaY/L*z,0,z),C,I),0!==D&&D!==z&&e.event.preventDefault()});var O=e.behavior.drag().on("dragstart",function(){S=e.event.sourceEvent.clientY,E=D}).on("drag",function(){var t=e.event.sourceEvent;2===t.buttons||t.ctrlKey||R(D=ne.constrain((t.clientY-S)/I+E,0,z),C,I)});h.call(O)}t._context.edits.legendPosition&&(s.classed("cursor-move",!0),Ua.init({element:s.node(),gd:t,prepFn:function(){var t=Sr.getTranslate(s);M=t.x,A=t.y},moveFn:function(t,e){var r=M+t,n=A+e;Sr.setTranslate(s,r,n),_=Ua.align(r,0,v.l,v.l+v.w,i.xanchor),w=Ua.align(n,0,v.t+v.h,v.t,i.yanchor)},doneFn:function(){void 0!==_&&void 0!==w&&P.call("relayout",t,{"legend.x":_,"legend.y":w})},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?s._clickTimeout=setTimeout(function(){Hd(i,t,e)},Qd):2===e&&(s._clickTimeout&&clearTimeout(s._clickTimeout),Hd(i,t,e)))}}))}function R(e,r,n){i._scrollY=t._fullLayout.legend._scrollY=e,Sr.setTranslate(c,0,-e),Sr.setRect(h,x,Ud.scrollBarMargin+e*n,Ud.scrollBarWidth,r),l.select("rect").attr({y:i.borderwidth+e})}},style:Xd},ig={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"},ag=m.extendFlat,og={visible:{valType:"boolean",editType:"plot"},buttons:ig=ag(ig,{_isLinkedToArray:"button"}),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:T({editType:"plot"}),bgcolor:{valType:"color",dflt:C.lightLine,editType:"plot"},activecolor:{valType:"color",editType:"plot"},bordercolor:{valType:"color",dflt:C.defaultLine,editType:"plot"},borderwidth:{valType:"number",min:0,dflt:0,editType:"plot"},editType:"plot"},sg={yPad:.02,minButtonWidth:30,rx:3,ry:3,lightAmount:25,darkAmount:10};var lg=function(t,r){var n=t._name,i={};if("all"===r.step)i[n+".autorange"]=!0;else{var a=function(t,r){var n,i=t.range,a=new Date(t.r2l(i[1])),o=r.step,s=r.count;switch(r.stepmode){case"backward":n=t.l2r(+e.time[o].utc.offset(a,-s));break;case"todate":var l=e.time[o].utc.offset(a,-s);n=t.l2r(+e.time[o].utc.ceil(l))}var u=i[1];return[n,u]}(t,r);i[n+".range[0]"]=a[0],i[n+".range[1]"]=a[1]}return i};var ug=Qe.LINE_SPACING,cg=Qe.FROM_TL,hg=Qe.FROM_BR;function fg(t){return t._id}function pg(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:sg.rx,ry:sg.ry}),n.call(Oe.stroke,e.bordercolor).call(Oe.fill,function(t,e){return e._isActive||e._isHovered?t.activecolor:t.bgcolor}(e,r)).style("stroke-width",e.borderwidth+"px")}function dg(t,e,r,n){var i,a=t.selectAll("text").data([0]);a.enter().append("text").classed("selector-text",!0).classed("user-select-none",!0),a.attr("text-anchor","middle"),a.call(Sr.font,e.font).text((i=r,i.label?i.label:"all"===i.step?"all":i.count+i.step.charAt(0))).call(function(t){er.convertToTspans(t,n)})}var gg={moduleType:"component",name:"rangeselector",schema:{subplots:{xaxis:{rangeselector:og}}},layoutAttributes:og,handleDefaults:function(t,e,r,n,i){var a=t.rangeselector||{},o=e.rangeselector={};function s(t,e){return ne.coerce(a,o,og,t,e)}if(s("visible",function(t,e,r){var n,i,a=t.buttons||[],o=e.buttons=[];function s(t,e){return ne.coerce(n,i,ig,t,e)}for(var l=0;l0)){var l=function(t,e,r){for(var n=r.filter(function(r){return e[r].anchor===t._id}),i=0,a=0;ah&&(h=u)));return h>=c?[c,h]:void 0}}var Og=function(t,e,r,n,i){function a(r,n){return ne.coerce(t,e,zg,r,n)}if(n=n||{},!a("visible",!(i=i||{}).itemIsNotPlainObject))return e;a("layer"),a("opacity"),a("fillcolor"),a("line.color"),a("line.width"),a("line.dash");for(var o=a("type",t.path?"path":"rect"),s=["x","y"],l=0;l<2;l++){var u=s[l],c={_fullLayout:r},h=ri.coerceRef(t,e,c,u,"","paper");if("path"!==o){var f,p,d;"paper"!==h?(f=ri.getFromId(c,h),d=Ig.rangeToShapePosition(f),p=Ig.shapePositionToRange(f)):p=d=ne.identity;var g=u+"0",v=u+"1",m=t[g],y=t[v];t[g]=p(t[g],!0),t[v]=p(t[v],!0),ri.coercePosition(e,c,a,h,g,.25),ri.coercePosition(e,c,a,h,v,.75),e[g]=d(e[g]),e[v]=d(e[v]),t[g]=m,t[v]=y}}return"path"===o?a("path"):ne.noneOrAll(t,e,["x0","x1","y0","y1"]),e},Rg={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;rO&&n>R&&!t.shiftKey?Ua.getCursor(i/r,1-a/n):"move";Ka(e,o),D=o.split("-")[0]}function j(n,p){if("path"===r.type){var d=function(t){return z(C(t)+n)};S&&"date"===S.type&&(d=Ig.encodeDate(d));var g=function(t){return I(L(t)+p)};E&&"date"===E.type&&(g=Ig.encodeDate(g)),r.path=Ng(k,d,g),i[T]=r.path}else i[u]=r.x0=z(a+n),i[c]=r.y0=I(o+p),i[h]=r.x1=z(s+n),i[f]=r.y1=I(l+p);e.attr("d",Bg(t,r))}function V(n,a){if("path"===r.type){var o=function(t){return z(C(t)+n)};S&&"date"===S.type&&(o=Ig.encodeDate(o));var s=function(t){return I(L(t)+a)};E&&"date"===E.type&&(s=Ig.encodeDate(s)),r.path=Ng(k,o,s),i[T]=r.path}else{var l=~D.indexOf("n")?p+a:p,u=~D.indexOf("s")?d+a:d,c=~D.indexOf("w")?g+n:g,h=~D.indexOf("e")?v+n:v;u-l>R&&(i[m]=r[_]=I(l),i[y]=r[w]=I(u)),h-c>O&&(i[x]=r[M]=z(c),i[b]=r[A]=z(h))}e.attr("d",Bg(t,r))}Ua.init(F),e.node().onmousemove=N}(t,o,n,e)}}function Bg(t,e){var r,n,i,a,o=e.type,s=ri.getFromId(t,e.xref),l=ri.getFromId(t,e.yref),u=t._fullLayout._size;if(s?(r=Ig.shapePositionToRange(s),n=function(t){return s._offset+s.r2p(r(t,!0))}):n=function(t){return u.l+u.w*t},l?(i=Ig.shapePositionToRange(l),a=function(t){return l._offset+l.r2p(i(t,!0))}):a=function(t){return u.t+u.h*(1-t)},"path"===o)return s&&"date"===s.type&&(n=Ig.decodeDate(n)),l&&"date"===l.type&&(a=Ig.decodeDate(a)),function(t,e,r){return t.replace(Pg.segmentRE,function(t){var n=0,i=t.charAt(0),a=Pg.paramIsX[i],o=Pg.paramIsY[i],s=Pg.numParams[i],l=t.substr(1).replace(Pg.paramRE,function(t){return a[n]?t=e(t):o[n]&&(t=r(t)),++n>s&&(t="X"),t});return n>s&&(l=l.replace(/[\s,]*X.*/,""),ne.log("Ignoring extra params in segment "+t)),i+l})}(e.path,n,a);var c=n(e.x0),h=n(e.x1),f=a(e.y0),p=a(e.y1);if("line"===o)return"M"+c+","+f+"L"+h+","+p;if("rect"===o)return"M"+c+","+f+"H"+h+"V"+p+"H"+c+"Z";var d=(c+h)/2,g=(f+p)/2,v=Math.abs(d-c),m=Math.abs(g-f),y="A"+v+","+m,x=d+v+","+g;return"M"+x+y+" 0 1,1 "+(d+","+(g-m))+y+" 0 0,1 "+x+"Z"}function Ng(t,e,r){return t.replace(Pg.segmentRE,function(t){var n=0,i=t.charAt(0),a=Pg.paramIsX[i],o=Pg.paramIsY[i],s=Pg.numParams[i];return i+t.substr(1).replace(Pg.paramRE,function(t){return n>=s?t:(a[n]?t=e(t):o[n]&&(t=r(t)),n++,t)})})}var jg={moduleType:"component",name:"shapes",layoutAttributes:zg,supplyLayoutDefaults:function(t,e){ld(t,e,{name:"shapes",handleItemDefaults:Og})},includeBasePlot:ud("shapes"),calcAutorange:function(t){var e=t._fullLayout,r=ne.filterVisible(e.shapes);if(r.length&&t._fullData.length)for(var n=0;n0)&&(n("active"),n("x"),n("y"),ne.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"),ne.coerceFont(n,"font",r.font),n("currentvalue.visible")&&(n("currentvalue.xanchor"),n("currentvalue.prefix"),n("currentvalue.suffix"),n("currentvalue.offset"),ne.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 Xg=Qe.LINE_SPACING,Zg=Qe.FROM_TL,Jg=Qe.FROM_BR;function Kg(t){return t._index}function Qg(t,r){var n=Sr.tester.selectAll("g."+Vg.labelGroupClass).data(r.steps);n.enter().append("g").classed(Vg.labelGroupClass,!0);var i=0,a=0;n.each(function(t){var n=ev(e.select(this),{step:t},r).node();if(n){var o=Sr.bBox(n);a=Math.max(a,o.height),i=Math.max(i,o.width)}}),n.remove();var o=r._dims={};o.inputAreaWidth=Math.max(Vg.railWidth,Vg.gripHeight);var s=t._fullLayout._size;o.lx=s.l+s.w*r.x,o.ly=s.t+s.h*(1-r.y),"fraction"===r.lenmode?o.outerLength=Math.round(s.w*r.len):o.outerLength=r.len,o.inputAreaStart=0,o.inputAreaLength=Math.round(o.outerLength-r.pad.l-r.pad.r);var l=(o.inputAreaLength-2*Vg.stepInset)/(r.steps.length-1),u=i+Vg.labelPadding;if(o.labelStride=Math.max(1,Math.ceil(u/l)),o.labelHeight=a,o.currentValueMaxWidth=0,o.currentValueHeight=0,o.currentValueTotalHeight=0,o.currentValueMaxLines=1,r.currentvalue.visible){var c=Sr.tester.append("g");n.each(function(t){var e=$g(c,r,t.label),n=e.node()&&Sr.bBox(e.node())||{width:0,height:0},i=er.lineCount(e);o.currentValueMaxWidth=Math.max(o.currentValueMaxWidth,Math.ceil(n.width)),o.currentValueHeight=Math.max(o.currentValueHeight,Math.ceil(n.height)),o.currentValueMaxLines=Math.max(o.currentValueMaxLines,i)}),o.currentValueTotalHeight=o.currentValueHeight+r.currentvalue.offset,c.remove()}o.height=o.currentValueTotalHeight+Vg.tickOffset+r.ticklen+Vg.labelOffset+o.labelHeight+r.pad.t+r.pad.b;var h="left";Vd.isRightAnchor(r)&&(o.lx-=o.outerLength,h="right"),Vd.isCenterAnchor(r)&&(o.lx-=o.outerLength/2,h="center");var f="top";Vd.isBottomAnchor(r)&&(o.ly-=o.height,f="bottom"),Vd.isMiddleAnchor(r)&&(o.ly-=o.height/2,f="middle"),o.outerLength=Math.ceil(o.outerLength),o.height=Math.ceil(o.height),o.lx=Math.round(o.lx),o.ly=Math.round(o.ly),_n.autoMargin(t,Vg.autoMarginIdRoot+r._index,{x:r.x,y:r.y,l:o.outerLength*Zg[h],r:o.outerLength*Jg[h],b:o.height*Jg[f],t:o.height*Zg[f]})}function $g(t,e,r){if(e.currentvalue.visible){var n,i,a=t.selectAll("text").data([0]),o=e._dims;switch(e.currentvalue.xanchor){case"right":n=o.inputAreaLength-Vg.currentValueInset-o.currentValueMaxWidth,i="left";break;case"center":n=.5*o.inputAreaLength,i="middle";break;default:n=Vg.currentValueInset,i="left"}a.enter().append("text").classed(Vg.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":i,"data-notex":1});var s=e.currentvalue.prefix?e.currentvalue.prefix:"";if("string"==typeof r)s+=r;else s+=e.steps[e.active].label;e.currentvalue.suffix&&(s+=e.currentvalue.suffix),a.call(Sr.font,e.currentvalue.font).text(s).call(er.convertToTspans,e._gd);var l=er.lineCount(a),u=(o.currentValueMaxLines+1-l)*e.currentvalue.font.size*Xg;return er.positionText(a,n,u),a}}function tv(t,e,r){var n=t.selectAll("rect."+Vg.gripRectClass).data([0]);n.enter().append("rect").classed(Vg.gripRectClass,!0).call(av,e,t,r).style("pointer-events","all"),n.attr({width:Vg.gripWidth,height:Vg.gripHeight,rx:Vg.gripRadius,ry:Vg.gripRadius}).call(Oe.stroke,r.bordercolor).call(Oe.fill,r.bgcolor).style("stroke-width",r.borderwidth+"px")}function ev(t,e,r){var n=t.selectAll("text").data([0]);return n.enter().append("text").classed(Vg.labelClass,!0).classed("user-select-none",!0).attr({"text-anchor":"middle","data-notex":1}),n.call(Sr.font,r.font).text(e.step.label).call(er.convertToTspans,r._gd),n}function rv(t,r){var n=t.selectAll("g."+Vg.labelsClass).data([0]),i=r._dims;n.enter().append("g").classed(Vg.labelsClass,!0);var a=n.selectAll("g."+Vg.labelGroupClass).data(i.labelSteps);a.enter().append("g").classed(Vg.labelGroupClass,!0),a.exit().remove(),a.each(function(t){var n=e.select(this);n.call(ev,t,r),Sr.setTranslate(n,lv(r,t.fraction),Vg.tickOffset+r.ticklen+r.font.size*Xg+Vg.labelOffset+i.currentValueTotalHeight)})}function nv(t,e,r,n,i){var a=Math.round(n*(r.steps.length-1));a!==r.active&&iv(t,e,r,a,!0,i)}function iv(t,e,r,n,i,a){var o=r.active;r._input.active=r.active=n;var s=r.steps[r.active];e.call(sv,r,r.active/(r.steps.length-1),a),e.call($g,r),t.emit("plotly_sliderchange",{slider:r,step:r.steps[r.active],interaction:i,previousActive:o}),s&&s.method&&i&&(e._nextMethod?(e._nextMethod.step=s,e._nextMethod.doCallback=i,e._nextMethod.doTransition=a):(e._nextMethod={step:s,doCallback:i,doTransition:a},e._nextMethodRaf=window.requestAnimationFrame(function(){var r=e._nextMethod.step;r.method&&(r.execute&&_n.executeAPICommand(t,r.method,r.args),e._nextMethod=null,e._nextMethodRaf=null)})))}function av(t,r,n){var i=n.node(),a=e.select(r);function o(){return n.data()[0]}t.on("mousedown",function(){var t=o();r.emit("plotly_sliderstart",{slider:t});var s=n.select("."+Vg.gripRectClass);e.event.stopPropagation(),e.event.preventDefault(),s.call(Oe.fill,t.activebgcolor);var l=uv(t,e.mouse(i)[0]);nv(r,n,t,l,!0),t._dragging=!0,a.on("mousemove",function(){var t=o(),a=uv(t,e.mouse(i)[0]);nv(r,n,t,a,!1)}),a.on("mouseup",function(){var t=o();t._dragging=!1,s.call(Oe.fill,t.bgcolor),a.on("mouseup",null),a.on("mousemove",null),r.emit("plotly_sliderend",{slider:t,step:t.steps[t.active]})})})}function ov(t,r){var n=t.selectAll("rect."+Vg.tickRectClass).data(r.steps),i=r._dims;n.enter().append("rect").classed(Vg.tickRectClass,!0),n.exit().remove(),n.attr({width:r.tickwidth+"px","shape-rendering":"crispEdges"}),n.each(function(t,n){var a=n%i.labelStride==0,o=e.select(this);o.attr({height:a?r.ticklen:r.minorticklen}).call(Oe.fill,r.tickcolor),Sr.setTranslate(o,lv(r,n/(r.steps.length-1))-.5*r.tickwidth,(a?Vg.tickOffset:Vg.minorTickOffset)+i.currentValueTotalHeight)})}function sv(t,e,r,n){var i=t.select("rect."+Vg.gripRectClass),a=lv(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*Vg.gripWidth)+","+e._dims.currentValueTotalHeight+")")}}function lv(t,e){var r=t._dims;return r.inputAreaStart+Vg.stepInset+(r.inputAreaLength-2*Vg.stepInset)*Math.min(1,Math.max(0,e))}function uv(t,e){var r=t._dims;return Math.min(1,Math.max(0,(e-Vg.stepInset-r.inputAreaStart)/(r.inputAreaLength-2*Vg.stepInset-2*r.inputAreaStart)))}function cv(t,e,r){var n=t.selectAll("rect."+Vg.railTouchRectClass).data([0]),i=r._dims;n.enter().append("rect").classed(Vg.railTouchRectClass,!0).call(av,e,t,r).style("pointer-events","all"),n.attr({width:i.inputAreaLength,height:Math.max(i.inputAreaWidth,Vg.tickOffset+r.ticklen+i.labelHeight)}).call(Oe.fill,r.bgcolor).attr("opacity",0),Sr.setTranslate(n,0,i.currentValueTotalHeight)}function hv(t,e){var r=t.selectAll("rect."+Vg.railRectClass).data([0]),n=e._dims;r.enter().append("rect").classed(Vg.railRectClass,!0);var i=n.inputAreaLength-2*Vg.railInset;r.attr({width:i,height:Vg.railWidth,rx:Vg.railRadius,ry:Vg.railRadius,"shape-rendering":"crispEdges"}).call(Oe.stroke,e.bordercolor).call(Oe.fill,e.bgcolor).style("stroke-width",e.borderwidth+"px"),Sr.setTranslate(r,Vg.railInset,.5*(n.inputAreaWidth-Vg.railWidth)+n.currentValueTotalHeight)}var fv={moduleType:"component",name:Vg.name,layoutAttributes:Hg,supplyLayoutDefaults:function(t,e){ld(t,e,{name:Gg,handleItemDefaults:Yg})},draw:function(t){var r=t._fullLayout,n=function(t,e){for(var r=t[Vg.name],n=[],i=0;i0?[0]:[]);if(i.enter().append("g").classed(Vg.containerClassName,!0).style("cursor","ew-resize"),i.exit().remove(),i.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;n=r.steps.length&&(r.active=0),e.call($g,r).call(hv,r).call(rv,r).call(ov,r).call(cv,t,r).call(tv,t,r);var n=r._dims;Sr.setTranslate(e,n.lx+r.pad.l,n.ly+r.pad.t),e.call(sv,r,r.active/(r.steps.length-1),!1),e.call($g,r)}(t,e.select(this),r)}})}}},pv=m.extendFlat,dv=(0,ye.overrideAll)({_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:pv({},Ug,{}),font:T({}),bgcolor:{valType:"color"},bordercolor:{valType:"color",dflt:C.borderLine},borderwidth:{valType:"number",min:0,dflt:1,editType:"arraydraw"}},"arraydraw","from-root"),gv={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"}},vv=gv.name,mv=dv.buttons;function yv(t,e,r){function n(r,n){return ne.coerce(t,e,dv,r,n)}n("visible",function(t,e){var r,n,i=t.buttons||[],a=e.buttons=[];function o(t,e){return ne.coerce(r,n,mv,t,e)}for(var s=0;s0)&&(n("active"),n("direction"),n("type"),n("showactive"),n("x"),n("y"),ne.noneOrAll(t,e,["x","y"]),n("xanchor"),n("yanchor"),n("pad.t"),n("pad.r"),n("pad.b"),n("pad.l"),ne.coerceFont(n,"font",r.font),n("bgcolor",r.paper_bgcolor),n("bordercolor"),n("borderwidth"))}var xv=bv;function bv(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})}bv.barWidth=2,bv.barLength=20,bv.barRadius=2,bv.barPad=1,bv.barColor="#808BA4",bv.prototype.enable=function(t,r,n){var i=this.gd._fullLayout,a=i.width,o=i.height;this.position=t;var s,l,u,c,h=this.position.l,f=this.position.w,p=this.position.t,d=this.position.h,g=this.position.direction,v="down"===g,m="left"===g,y="up"===g,x=f,b=d;v||m||"right"===g||y||(this.position.direction="down",v=!0),v||y?(l=(s=h)+x,v?(u=p,b=(c=Math.min(u+b,o))-u):b=(c=p+b)-(u=Math.max(c-b,0))):(c=(u=p)+b,m?x=(l=h+x)-(s=Math.max(l-x,0)):(s=h,x=(l=Math.min(s+x,a))-s)),this._box={l:s,t:u,w:x,h:b};var _=f>x,w=bv.barLength+2*bv.barPad,M=bv.barWidth+2*bv.barPad,A=h,k=p+d;k+M>o&&(k=o-M);var T=this.container.selectAll("rect.scrollbar-horizontal").data(_?[0]:[]);T.exit().on(".drag",null).remove(),T.enter().append("rect").classed("scrollbar-horizontal",!0).call(Oe.fill,bv.barColor),_?(this.hbar=T.attr({rx:bv.barRadius,ry:bv.barRadius,x:A,y:k,width:w,height:M}),this._hbarXMin=A+w/2,this._hbarTranslateMax=x-w):(delete this.hbar,delete this._hbarXMin,delete this._hbarTranslateMax);var S=d>b,E=bv.barWidth+2*bv.barPad,C=bv.barLength+2*bv.barPad,L=h+f,z=p;L+E>a&&(L=a-E);var P=this.container.selectAll("rect.scrollbar-vertical").data(S?[0]:[]);P.exit().on(".drag",null).remove(),P.enter().append("rect").classed("scrollbar-vertical",!0).call(Oe.fill,bv.barColor),S?(this.vbar=P.attr({rx:bv.barRadius,ry:bv.barRadius,x:L,y:z,width:E,height:C}),this._vbarYMin=z+C/2,this._vbarTranslateMax=b-C):(delete this.vbar,delete this._vbarYMin,delete this._vbarTranslateMax);var I=this.id,D=s-.5,O=S?l+E+.5:l+.5,R=u-.5,F=_?c+M+.5:c+.5,B=i._topdefs.selectAll("#"+I).data(_||S?[0]:[]);if(B.exit().remove(),B.enter().append("clipPath").attr("id",I).append("rect"),_||S?(this._clipRect=B.select("rect").attr({x:Math.floor(D),y:Math.floor(R),width:Math.ceil(O)-Math.floor(D),height:Math.ceil(F)-Math.floor(R)}),this.container.call(Sr.setClipUrl,I),this.bg.attr({x:h,y:p,width:f,height:d})):(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(Sr.setClipUrl,null),delete this._clipRect),_||S){var N=e.behavior.drag().on("dragstart",function(){e.event.sourceEvent.preventDefault()}).on("drag",this._onBoxDrag.bind(this));this.container.on("wheel",null).on("wheel",this._onBoxWheel.bind(this)).on(".drag",null).call(N);var j=e.behavior.drag().on("dragstart",function(){e.event.sourceEvent.preventDefault(),e.event.sourceEvent.stopPropagation()}).on("drag",this._onBarDrag.bind(this));_&&this.hbar.on(".drag",null).call(j),S&&this.vbar.on(".drag",null).call(j)}this.setTranslate(r,n)},bv.prototype.disable=function(){(this.hbar||this.vbar)&&(this.bg.attr({width:0,height:0}),this.container.on("wheel",null).on(".drag",null).call(Sr.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)},bv.prototype._onBoxDrag=function(){var t=this.translateX,r=this.translateY;this.hbar&&(t-=e.event.dx),this.vbar&&(r-=e.event.dy),this.setTranslate(t,r)},bv.prototype._onBoxWheel=function(){var t=this.translateX,r=this.translateY;this.hbar&&(t+=e.event.deltaY),this.vbar&&(r+=e.event.deltaY),this.setTranslate(t,r)},bv.prototype._onBarDrag=function(){var t=this.translateX,r=this.translateY;if(this.hbar){var n=t+this._hbarXMin,i=n+this._hbarTranslateMax;t=(ne.constrain(e.event.x,n,i)-n)/(i-n)*(this.position.w-this._box.w)}if(this.vbar){var a=r+this._vbarYMin,o=a+this._vbarTranslateMax;r=(ne.constrain(e.event.y,a,o)-a)/(o-a)*(this.position.h-this._box.h)}this.setTranslate(t,r)},bv.prototype.setTranslate=function(t,e){var r=this.position.w-this._box.w,n=this.position.h-this._box.h;if(t=ne.constrain(t||0,0,r),e=ne.constrain(e||0,0,n),this.translateX=t,this.translateY=e,this.container.call(Sr.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(Sr.setTranslate,t+i*this._hbarTranslateMax,e)}if(this.vbar){var a=e/n;this.vbar.call(Sr.setTranslate,t,e+a*this._vbarTranslateMax)}};var _v=Qe.LINE_SPACING;function wv(t){return t._index}function Mv(t,e){return+t.attr(gv.menuIndexAttrName)===e._index}function Av(t,e,r,n,i,a,o,s){e._input.active=e.active=o,"buttons"===e.type?Tv(t,n,null,null,e):"dropdown"===e.type&&(i.attr(gv.menuIndexAttrName,"-1"),kv(t,n,i,a,e),s||Tv(t,n,i,a,e))}function kv(t,e,r,n,i){var a=e.selectAll("g."+gv.headerClassName).data([0]),o=i._dims;a.enter().append("g").classed(gv.headerClassName,!0).style("pointer-events","all");var s=i.active,l=i.buttons[s]||gv.blankHeaderOpts,u={y:i.pad.t,yPad:0,x:i.pad.l,xPad:0,index:0},c={width:o.headerWidth,height:o.headerHeight};a.call(Sv,i,l,t).call(Dv,i,u,c);var h=e.selectAll("text."+gv.headerArrowClassName).data([0]);h.enter().append("text").classed(gv.headerArrowClassName,!0).classed("user-select-none",!0).attr("text-anchor","end").call(Sr.font,i.font).text(gv.arrowSymbol[i.direction]),h.attr({x:o.headerWidth-gv.arrowOffsetX+i.pad.l,y:o.headerHeight/2+gv.textOffsetY+i.pad.t}),a.on("click",function(){r.call(Ov),r.attr(gv.menuIndexAttrName,Mv(r,i)?-1:String(i._index)),Tv(t,e,r,n,i)}),a.on("mouseover",function(){a.call(zv)}),a.on("mouseout",function(){a.call(Pv,i)}),Sr.setTranslate(e,o.lx,o.ly)}function Tv(t,r,n,i,a){n||(n=r).attr("pointer-events","all");var o=function(t){return-1==+t.attr(gv.menuIndexAttrName)}(n)&&"buttons"!==a.type?[]:a.buttons,s="dropdown"===a.type?gv.dropdownButtonClassName:gv.buttonClassName,l=n.selectAll("g."+s).data(o),u=l.enter().append("g").classed(s,!0),c=l.exit();"dropdown"===a.type?(u.attr("opacity","0").transition().attr("opacity","1"),c.transition().attr("opacity","0").remove()):c.remove();var h=0,f=0,p=a._dims,d=-1!==["up","down"].indexOf(a.direction);"dropdown"===a.type&&(d?f=p.headerHeight+gv.gapButtonHeader:h=p.headerWidth+gv.gapButtonHeader),"dropdown"===a.type&&"up"===a.direction&&(f=-gv.gapButtonHeader+gv.gapButton-p.openHeight),"dropdown"===a.type&&"left"===a.direction&&(h=-gv.gapButtonHeader+gv.gapButton-p.openWidth);var g={x:p.lx+h+a.pad.l,y:p.ly+f+a.pad.t,yPad:gv.gapButton,xPad:gv.gapButton,index:0},v={l:g.x+a.borderwidth,t:g.y+a.borderwidth};l.each(function(o,s){var u=e.select(this);u.call(Sv,a,o,t).call(Dv,a,g),u.on("click",function(){e.event.defaultPrevented||(Av(t,a,0,r,n,i,s),o.execute&&_n.executeAPICommand(t,o.method,o.args),t.emit("plotly_buttonclicked",{menu:a,button:o,active:a.active}))}),u.on("mouseover",function(){u.call(zv)}),u.on("mouseout",function(){u.call(Pv,a),l.call(Lv,a)})}),l.call(Lv,a),d?(v.w=Math.max(p.openWidth,p.headerWidth),v.h=g.y-v.t):(v.w=g.x-v.l,v.h=Math.max(p.openHeight,p.headerHeight)),v.direction=a.direction,i&&(l.size()?function(t,e,r,n,i,a){var o,s,l,u=i.direction,c="up"===u||"down"===u,h=i._dims,f=i.active;if(c)for(s=0,l=0;l0?[0]:[]);if(i.enter().append("g").classed(gv.containerClassName,!0).style("cursor","pointer"),i.exit().remove(),i.exit().size()&&function(t){for(var e=t._fullLayout._pushmargin||{},r=Object.keys(e),n=0;nb.queueLength&&(t.undoQueue.queue.shift(),t.undoQueue.index--))},startSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!0,t.undoQueue.beginSequence=!0},stopSequence:function(t){t.undoQueue=t.undoQueue||{index:0,queue:[],sequence:!1},t.undoQueue.sequence=!1,t.undoQueue.beginSequence=!1},undo:function(t){var e,r;if(t.framework&&t.framework.isPolar)t.framework.undo();else if(!(void 0===t.undoQueue||isNaN(t.undoQueue.index)||t.undoQueue.index<=0)){for(t.undoQueue.index--,e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r=t.undoQueue.queue.length)){for(e=t.undoQueue.queue[t.undoQueue.index],t.undoQueue.inSequence=!0,r=0;r0&&ne.log("Clearing previous rejected promises from queue."),t._promises=[]},Vv.cleanLayout=function(t){var e,r;t||(t={}),t.xaxis1&&(t.xaxis||(t.xaxis=t.xaxis1),delete t.xaxis1),t.yaxis1&&(t.yaxis||(t.yaxis=t.yaxis1),delete t.yaxis1),t.scene1&&(t.scene||(t.scene=t.scene1),delete t.scene1);var n=(_n.subplotsRegistry.cartesian||{}).attrRegex,i=(_n.subplotsRegistry.gl3d||{}).attrRegex,a=Object.keys(t);for(e=0;e3?(x.x=1.02,x.xanchor="left"):x.x<-2&&(x.x=-.02,x.xanchor="right"),x.y>3?(x.y=1.02,x.yanchor="bottom"):x.y<-2&&(x.y=-.02,x.yanchor="top")),"rotate"===t.dragmode&&(t.dragmode="orbit"),Oe.clean(t),t},Vv.cleanData=function(t,e){for(var r=[],n=t.concat(Array.isArray(e)?e:[]).filter(function(t){return"uid"in t}).map(function(t){return t.uid}),i=0;i0)return t.substr(0,e)}Vv.hasParent=function(t,e){for(var r=Xv(e);r;){if(r in t)return!0;r=Xv(r)}return!1};var Zv=["x","y","z"];Vv.clearAxisTypes=function(t,e,r){for(var n=0;n1&&_.warn("Full array edits are incompatible with other edits",i);var h=r[""][""];if($v(h))e.set(null);else{if(!Array.isArray(h))return _.warn("Unrecognized full array edit value",i,h),!0;e.set(h)}return!l&&(a(u,c),o(t),!0)}var f,p,d,g,v,m,y,x=Object.keys(r).map(Number).sort(Kv),b=e.get(),w=b||[],M=W(c,i).get(),k=[],T=-1,S=w.length;for(f=0;fw.length-(y?0:1))_.warn("index out of range",i,d);else if(void 0!==m)v.length>1&&_.warn("Insertion & removal are incompatible with edits to the same index.",i,d),$v(m)?k.push(d):y?("add"===m&&(m={}),w.splice(d,0,m),M&&M.splice(d,0,{})):_.warn("Unrecognized full object edit value",i,d,m),-1===T&&(T=d);else for(p=0;p=0;f--)w.splice(k[f],1),M&&M.splice(k[f],1);if(w.length?b||e.set(w):e.set(null),l)return!1;if(a(u,c),s!==A){var E;if(-1===T)E=x;else{for(S=Math.max(w.length,S),E=[],f=0;f=T);f++)E.push(d);for(f=T;f1?(m=["toggleHover"],y=["resetViews"]):s?(v=["zoomInGeo","zoomOutGeo"],m=["hoverClosestGeo"],y=["resetGeo"]):o?(m=["hoverClosest3d"],y=["resetCameraDefault3d","resetCameraLastSave3d"]):h?(m=["toggleHover"],y=["resetViewMapbox"]):m=u?["hoverClosestGl2d"]:l?["hoverClosestPie"]:["toggleHover"],a&&(m=["toggleSpikelines","hoverClosestCartesian","hoverCompareCartesian"]),!a&&!u||p||(v=["zoomIn2d","zoomOut2d","autoScale2d"],"resetViews"!==y[0]&&(y=["resetScale2d"])),o?x=["zoom3d","pan3d","orbitRotation","tableRotation"]:(a||u)&&!p||c?x=["zoom2d","pan2d"]:h||s?x=["pan2d"]:f&&(x=["zoom2d"]),function(t){for(var e=!1,r=0;r=0?Math.min(t,.9):1/(1/Math.max(t,-.3)+3.222))}function Em(t,e,r,n,i){return t.append("path").attr("class","zoombox").style({fill:e>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("transform","translate("+r+", "+n+")").attr("d",i+"Z")}function Cm(t,e,r){return t.append("path").attr("class","zoombox-corners").style({fill:Oe.background,stroke:Oe.defaultLine,"stroke-width":1,opacity:0}).attr("transform","translate("+e+", "+r+")").attr("d","M0,0Z")}function Lm(t){t.selectAll(".select-outline").remove()}function zm(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"),Pm(t,e,i,a)}function Pm(t,e,r,n){r||(t.transition().style("fill",n>.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),e.transition().style("opacity",1).duration(200))}function Im(t){e.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}function Dm(t){_m&&t.data&&t._context.showTips&&(ne.notifier(ne._(t,"Double-click to zoom back out"),"long"),_m=!1)}function Om(t){return"lasso"===t||"select"===t}function Rm(t){var e=Math.floor(Math.min(t.b-t.t,t.r-t.l,bm)/2);return"M"+(t.l-3.5)+","+(t.t-.5+e)+"h3v"+-e+"h"+e+"v-3h-"+(e+3)+"ZM"+(t.r+3.5)+","+(t.t-.5+e)+"h-3v"+-e+"h"+-e+"v-3h"+(e+3)+"ZM"+(t.r+3.5)+","+(t.b+.5-e)+"h-3v"+e+"h"+-e+"v3h"+(e+3)+"ZM"+(t.l-3.5)+","+(t.b+.5-e)+"h3v"+e+"h"+e+"v3h-"+(e+3)+"Z"}function Fm(t,e){if(Ea){var r=void 0!==t.onwheel?"wheel":"mousewheel";t._onwheel&&t.removeEventListener(r,t._onwheel),t._onwheel=e,t.addEventListener(r,e,{passive:!1})}else void 0!==t.onwheel?t.onwheel=e:void 0!==t.onmousewheel&&(t.onmousewheel=e)}var Bm={makeDragBox:function(t,r,n,i,a,o,l,u){var c,h,f,p,d,g,v,m,y,x,b,_,w,M=t._fullLayout,A=t._fullLayout._zoomlayer,k=l+u==="nsew",T=1===(l+u).length;function S(){h=[r.xaxis],f=[r.yaxis];var e=h[0],n=f[0];g=e._length,v=n._length;var i,a,o=M._axisConstraintGroups,s=[e._id],A=[n._id];c=[r].concat(l&&u?r.overlays:[]);for(var k=1;kbm||o>bm?(F="xy",a/g>o/v?(o=a*v/g,z>i?I.t=z-o:I.b=z+o):(a=o*g/v,L>n?I.l=L-a:I.r=L+a),N.attr("d",Rm(I))):s():!y||o rect").call(Sr.setTranslate,i,a).call(Sr.setScale,r,n);var P=x.plot.selectAll(".scatterlayer .trace, .boxlayer .trace, .violinlayer .trace");x.plot.call(Sr.setTranslate,L,z).call(Sr.setScale,1/r,1/n),P.selectAll(".point").call(Sr.setPointGroupScale,r,n),P.selectAll(".textpoint").call(Sr.setTextPointsScale,r,n),P.call(Sr.hideOutsideRangePoints,x),x.plot.selectAll(".barlayer .trace").call(Sr.hideOutsideRangePoints,x,".bartext")}}}return l.length*u.length!=1&&Fm(E,function(e){if(t._context.scrollZoom||M._enablescrollzoom){if(null===G&&Lm(A),t._transitioningWithDuration)return e.preventDefault(),void e.stopPropagation();var r=t.querySelector(".plotly");if(S(),!(r.scrollHeight-r.clientHeight>10||r.scrollWidth-r.clientWidth>10)){clearTimeout(G);var n=-e.deltaY;if(isFinite(n)||(n=e.wheelDelta/10),isFinite(n)){var i,a=Math.exp(-Math.min(Math.max(n,-20),20)/200),o=Y.draglayer.select(".nsewdrag").node().getBoundingClientRect(),s=(e.clientX-o.left)/o.width,c=(o.bottom-e.clientY)/o.height;if(u||b){for(u||(s=.5),i=0;i=t[1]||i[1]<=t[0])&&a[0]e[0])return!0}return!1}(r,i,p)?(f.push(t),p.push([r,i])):a=[0];var o=e.plotgroup.selectAll(".bg").data(a);o.enter().append("rect").classed("bg",!0),o.exit().remove(),o.each(function(){e.bg=o;var t=e.plotgroup.node();t.insertBefore(this,t.childNodes[0])})});var d=n._bgLayer.selectAll(".bg").data(f);return d.enter().append("rect").classed("bg",!0),d.exit().remove(),d.each(function(t){n._plots[t].bg=e.select(this)}),h.each(function(t){var e=n._plots[t],i=e.xaxis,u=e.yaxis;e.bg&&s&&e.bg.call(Sr.setRect,i._offset-a,u._offset-a,i._length+2*a,u._length+2*a).call(Oe.fill,n.plot_bgcolor).style("stroke-width",0),e.clipId="clip"+n._uid+t+"plot";var c,h,f=n._clips.selectAll("#"+e.clipId).data([0]);for(f.enter().append("clipPath").attr({class:"plotclip",id:e.clipId}).append("rect"),f.selectAll("rect").attr({width:i._length,height:u._length}),Sr.setTranslate(e.plot,i._offset,u._offset),e._hasClipOnAxisFalse?(c=null,h=e.clipId):(c=e.clipId,h=null),Sr.setClipUrl(e.plot,c),r=0;rXm*p)||m)for(r=0;rS&&Lk&&(k=L);s/=(k-A)/(2*T),A=i.l2r(A),k=i.l2r(k),i.range=i._input.range=_=0?u.angularAxis.domain:e.extent(x),A=Math.abs(x[1]-x[0]);_&&!b&&(A=0);var k=M.slice();w&&b&&(k[1]+=A);var T=u.angularAxis.ticksCount||4;T>8&&(T=T/(T/8)+T%8),u.angularAxis.ticksStep&&(T=(k[1]-k[0])/T);var S=u.angularAxis.ticksStep||(k[1]-k[0])/(T*(u.minorTicks+1));y&&(S=Math.max(Math.round(S),1)),k[2]||(k[2]=S);var E=e.range.apply(this,k);if(E=E.map(function(t,e){return parseFloat(t.toPrecision(12))}),i=e.scale.linear().domain(k.slice(0,2)).range("clockwise"===u.direction?[0,360]:[360,0]),s.layout.angularAxis.domain=i.domain(),s.layout.angularAxis.endPadding=w?A:0,void 0===(t=e.select(this).select("svg.chart-root"))||t.empty()){var C=(new DOMParser).parseFromString("' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '' + '","application/xml"),L=this.appendChild(this.ownerDocument.importNode(C.documentElement,!0));t=e.select(L)}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 z,P=t.select(".chart-group"),I={fill:"none",stroke:u.tickColor},D={"font-size":u.font.size,"font-family":u.font.family,fill:u.font.color,"text-shadow":["-1px 0px","1px -1px","-1px 1px","1px 1px"].map(function(t,e){return" "+t+" 0 "+u.font.outlineColor}).join(",")};if(u.showLegend){z=t.select(".legend-group").attr({transform:"translate("+[g,u.margin.top]+")"}).style({display:"block"});var O=c.map(function(t,e){var r=ty.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});ty.Legend().config({data:c.map(function(t,e){return t.name||"Element"+e}),legendConfig:Qm({},ty.Legend.defaultConfig().legendConfig,{container:z,elements:O,reverseOrder:u.legend.reverseOrder})})();var R=z.node().getBBox();g=Math.min(u.width-R.width-u.margin.left-u.margin.right,u.height-u.margin.top-u.margin.bottom)/2,g=Math.max(10,g),m=[u.margin.left+g,u.margin.top+g],n.range([0,g]),s.layout.radialAxis.domain=n.domain(),z.attr("transform","translate("+[m[0]+g,m[1]-g]+")")}else z=t.select(".legend-group").style({display:"none"});t.attr({width:u.width,height:u.height}).style({opacity:u.opacity}),P.attr("transform","translate("+m+")").style({cursor:"crosshair"});var F=[(u.width-(u.margin.left+u.margin.right+2*g+(R?R.width:0)))/2,(u.height-(u.margin.top+u.margin.bottom+2*g))/2];if(F[0]=Math.max(0,F[0]),F[1]=Math.max(0,F[1]),t.select(".outer-group").attr("transform","translate("+F+")"),u.title){var B=t.select("g.title-group text").style(D).text(u.title),N=B.node().getBBox();B.attr({x:m[0]-N.width/2,y:m[1]-g-20})}var j=t.select(".radial.axis-group");if(u.radialAxis.gridLinesVisible){var V=j.selectAll("circle.grid-circle").data(n.ticks(5));V.enter().append("circle").attr({class:"grid-circle"}).style(I),V.attr("r",n),V.exit().remove()}j.select("circle.outside-circle").attr({r:g}).style(I);var U=t.select("circle.background-circle").attr({r:g}).style({fill:u.backgroundColor,stroke:u.stroke});function q(t,e){return i(t)%360+u.orientation}if(u.radialAxis.visible){var H=e.svg.axis().scale(n).ticks(5).tickSize(5);j.call(H).attr({transform:"rotate("+u.radialAxis.orientation+")"}),j.selectAll(".domain").style(I),j.selectAll("g>text").text(function(t,e){return this.textContent+u.radialAxis.ticksSuffix}).style(D).style({"text-anchor":"start"}).attr({x:0,y:0,dx:0,dy:0,transform:function(t,e){return"horizontal"===u.radialAxis.tickOrientation?"rotate("+-u.radialAxis.orientation+") translate("+[0,D["font-size"]]+")":"translate("+[0,D["font-size"]]+")"}}),j.selectAll("g>line").style({stroke:"black"})}var G=t.select(".angular.axis-group").selectAll("g.angular-tick").data(E),W=G.enter().append("g").classed("angular-tick",!0);G.attr({transform:function(t,e){return"rotate("+q(t)+")"}}).style({display:u.angularAxis.visible?"block":"none"}),G.exit().remove(),W.append("line").classed("grid-line",!0).classed("major",function(t,e){return e%(u.minorTicks+1)==0}).classed("minor",function(t,e){return!(e%(u.minorTicks+1)==0)}).style(I),W.selectAll(".minor").style({stroke:u.minorTickColor}),G.select("line.grid-line").attr({x1:u.tickLength?g-u.tickLength:0,x2:g}).style({display:u.angularAxis.gridLinesVisible?"block":"none"}),W.append("text").classed("axis-text",!0).style(D);var Y=G.select("text.axis-text").attr({x:g+u.labelOffset,dy:$m+"em",transform:function(t,e){var r=q(t),n=g+u.labelOffset,i=u.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:u.angularAxis.labelsVisible?"block":"none"}).text(function(t,e){return e%(u.minorTicks+1)!=0?"":y?y[t]+u.angularAxis.ticksSuffix:t+u.angularAxis.ticksSuffix}).style(D);u.angularAxis.rewriteTicks&&Y.text(function(t,e){return e%(u.minorTicks+1)!=0?"":u.angularAxis.rewriteTicks(this.textContent,e)});var X=e.max(P.selectAll(".angular-tick text")[0].map(function(t,e){return t.getCTM().e+t.getBBox().width}));z.attr({transform:"translate("+[g+X,u.margin.top]+")"});var Z=t.select("g.geometry-group").selectAll("g").size()>0,J=t.select("g.geometry-group").selectAll("g.geometry").data(c);if(J.enter().append("g").attr({class:function(t,e){return"geometry geometry"+e}}),J.exit().remove(),c[0]||Z){var K=[];c.forEach(function(t,e){var r={};r.radialScale=n,r.angularScale=i,r.container=J.filter(function(t,r){return r==e}),r.geometry=t.geometry,r.orientation=u.orientation,r.direction=u.direction,r.index=e,K.push({data:t,geometryConfig:r})});var Q=[];e.nest().key(function(t,e){return void 0!==t.data.groupId||"unstacked"}).entries(K).forEach(function(t,e){"unstacked"===t.key?Q=Q.concat(t.values.map(function(t,e){return[t]})):Q.push(t.values)}),Q.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 Qm(ty[r].defaultConfig(),t)});ty[r]().config(n)()})}var $,tt,et=t.select(".guides-group"),rt=t.select(".tooltips-group"),nt=ty.tooltipPanel().config({container:rt,fontSize:8})(),it=ty.tooltipPanel().config({container:rt,fontSize:8})(),at=ty.tooltipPanel().config({container:rt,hasTick:!0})();if(!b){var ot=et.select("line").attr({x1:0,y1:0,y2:0}).style({stroke:"grey","pointer-events":"none"});P.on("mousemove.angular-guide",function(t,e){var r=ty.util.getMousePos(U).angle;ot.attr({x2:-g,transform:"rotate("+r+")"}).style({opacity:.5});var n=(r+180+360-u.orientation)%360;$=i.invert(n);var a=ty.util.convertToCartesian(g+12,r+180);nt.text(ty.util.round($)).move([a[0]+m[0],a[1]+m[1]])}).on("mouseout.angular-guide",function(t,e){et.select("line").style({opacity:0})})}var st=et.select("circle").style({stroke:"grey",fill:"none"});P.on("mousemove.radial-guide",function(t,e){var r=ty.util.getMousePos(U).radius;st.attr({r:r}).style({opacity:.5}),tt=n.invert(ty.util.getMousePos(U).radius);var i=ty.util.convertToCartesian(r,u.radialAxis.orientation);it.text(ty.util.round(tt)).move([i[0]+m[0],i[1]+m[1]])}).on("mouseout.radial-guide",function(t,e){st.style({opacity:0}),at.hide(),nt.hide(),it.hide()}),t.selectAll(".geometry-group .mark").on("mouseover.tooltip",function(r,n){var i=e.select(this),a=this.style.fill,o="black",s=this.style.opacity||1;if(i.attr({"data-opacity":s}),a&&"none"!==a){i.attr({"data-fill":a}),o=e.hsl(a).darker().toString(),i.style({fill:o,opacity:1});var l={t:ty.util.round(r[0]),r:ty.util.round(r[1])};b&&(l.t=y[r[0]]);var u="t: "+l.t+", r: "+l.r,c=this.getBoundingClientRect(),h=t.node().getBoundingClientRect(),f=[c.left+c.width/2-F[0]-h.left,c.top+c.height/2-F[1]-h.top];at.config({color:o}).text(u),at.move(f)}else a=this.style.stroke||"black",i.attr({"data-stroke":a}),o=e.hsl(a).darker().toString(),i.style({stroke:o,opacity:1})}).on("mousemove.tooltip",function(t,r){if(0!=e.event.which)return!1;e.select(this).attr("data-fill")&&at.show()}).on("mouseout.tooltip",function(t,r){at.hide();var n=e.select(this),i=n.attr("data-fill");i?n.style({fill:i,opacity:n.attr("data-opacity")}):n.style({stroke:n.attr("data-stroke"),opacity:n.attr("data-opacity")})})})}(o),this},u.config=function(t){if(!arguments.length)return a;var e=ty.util.cloneJson(t);return e.data.forEach(function(t,e){a.data[e]||(a.data[e]={}),Qm(a.data[e],ty.Axis.defaultConfig().data[0]),Qm(a.data[e],t)}),Qm(a.layout,ty.Axis.defaultConfig().layout),Qm(a.layout,e.layout),this},u.getLiveConfig=function(){return s},u.getinputConfig=function(){return o},u.radialScale=function(t){return n},u.angularScale=function(t){return i},u.svg=function(){return t},e.rebind(u,l,"on"),u},ty.Axis.defaultConfig=function(t,r){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:e.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}}},ty.util={},ty.DATAEXTENT="dataExtent",ty.AREA="AreaChart",ty.LINE="LinePlot",ty.DOT="DotPlot",ty.BAR="BarChart",ty.util._override=function(t,e){for(var r in t)r in e&&(e[r]=t[r])},ty.util._extend=function(t,e){for(var r in t)e[r]=t[r]},ty.util._rndSnd=function(){return 2*Math.random()-1+(2*Math.random()-1)+(2*Math.random()-1)},ty.util.dataFromEquation2=function(t,r){var n=r||6;return e.range(0,360+n,n).map(function(e,r){var n=e*Math.PI/180;return[e,t(n)]})},ty.util.dataFromEquation=function(t,r,n){var i=r||6,a=[],o=[];e.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 n&&(s.name=n),s},ty.util.ensureArray=function(t,r){if(void 0===t)return null;var n=[].concat(t);return e.range(r).map(function(t,e){return n[e]||n[0]})},ty.util.fillArrays=function(t,e,r){return e.forEach(function(e,n){t[e]=ty.util.ensureArray(t[e],r)}),t},ty.util.cloneJson=function(t){return JSON.parse(JSON.stringify(t))},ty.util.validateKeys=function(t,e){"string"==typeof e&&(e=e.split("."));var r=e.shift();return t[r]&&(!e.length||objHasKeys(t[r],e))},ty.util.sumArrays=function(t,r){return e.zip(t,r).map(function(t,r){return e.sum(t)})},ty.util.arrayLast=function(t){return t[t.length-1]},ty.util.arrayEqual=function(t,e){for(var r=Math.max(t.length,e.length,1);r-- >=0&&t[r]===e[r];);return-2===r},ty.util.flattenArray=function(t){for(var e=[];!ty.util.arrayEqual(e,t);)e=t,t=[].concat.apply([],t);return t},ty.util.deduplicate=function(t){return t.filter(function(t,e,r){return r.indexOf(t)==e})},ty.util.convertToCartesian=function(t,e){var r=e*Math.PI/180;return[t*Math.cos(r),t*Math.sin(r)]},ty.util.round=function(t,e){var r=e||2,n=Math.pow(10,r);return Math.round(t*n)/n},ty.util.getMousePos=function(t){var r=e.mouse(t.node()),n=r[0],i=r[1],a={};return a.x=n,a.y=i,a.pos=r,a.angle=180*(Math.atan2(i,n)+Math.PI)/Math.PI,a.radius=Math.sqrt(n*n+i*i),a},ty.util.duplicatesCount=function(t){for(var e,r={},n={},i=0,a=t.length;i0)){var l=e.select(this.parentNode).selectAll("path.line").data([0]);l.enter().insert("path"),l.attr({class:"line",d:c(s),transform:function(t,e){return"rotate("+(r.orientation+90)+")"},"pointer-events":"none"}).style({fill:function(t,e){return d.fill(n,i,a)},"fill-opacity":0,stroke:function(t,e){return d.stroke(n,i,a)},"stroke-width":function(t,e){return d["stroke-width"](n,i,a)},"stroke-dasharray":function(t,e){return d["stroke-dasharray"](n,i,a)},opacity:function(t,e){return d.opacity(n,i,a)},display:function(t,e){return d.display(n,i,a)}})}};var h=r.angularScale.range(),f=Math.abs(h[1]-h[0])/o[0].length*Math.PI/180,p=e.svg.arc().startAngle(function(t){return-f/2}).endAngle(function(t){return f/2}).innerRadius(function(t){return r.radialScale(l+(t[2]||0))}).outerRadius(function(t){return r.radialScale(l+(t[2]||0))+r.radialScale(t[1])});u.arc=function(t,n,i){e.select(this).attr({class:"mark arc",d:p,transform:function(t,e){return"rotate("+(r.orientation+s(t[0])+90)+")"}})};var d={fill:function(e,r,n){return t[n].data.color},stroke:function(e,r,n){return t[n].data.strokeColor},"stroke-width":function(e,r,n){return t[n].data.strokeSize+"px"},"stroke-dasharray":function(e,r,i){return n[t[i].data.strokeDash]},opacity:function(e,r,n){return t[n].data.opacity},display:function(e,r,n){return void 0===t[n].data.visible||t[n].data.visible?"block":"none"}},g=e.select(this).selectAll("g.layer").data(o);g.enter().append("g").attr({class:"layer"});var v=g.selectAll("path.mark").data(function(t,e){return t});v.enter().append("path").attr({class:"mark"}),v.style(d).each(u[r.geometryType]),v.exit().remove(),g.exit().remove()})}return i.config=function(e){return arguments.length?(e.forEach(function(e,r){t[r]||(t[r]={}),Qm(t[r],ty.PolyChart.defaultConfig()),Qm(t[r],e)}),this):t},i.getColorScale=function(){},e.rebind(i,r,"on"),i},ty.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:e.scale.category20()}}},ty.BarChart=function(){return ty.PolyChart()},ty.BarChart.defaultConfig=function(){return{geometryConfig:{geometryType:"bar"}}},ty.AreaChart=function(){return ty.PolyChart()},ty.AreaChart.defaultConfig=function(){return{geometryConfig:{geometryType:"arc"}}},ty.DotPlot=function(){return ty.PolyChart()},ty.DotPlot.defaultConfig=function(){return{geometryConfig:{geometryType:"dot",dotType:"circle"}}},ty.LinePlot=function(){return ty.PolyChart()},ty.LinePlot.defaultConfig=function(){return{geometryConfig:{geometryType:"line"}}},ty.Legend=function(){var t=ty.Legend.defaultConfig(),r=e.dispatch("hover");function n(){var r=t.legendConfig,i=t.data.map(function(t,e){return[].concat(t).map(function(t,n){var i=Qm({},r.elements[e]);return i.name=t,i.color=[].concat(r.elements[e].color)[n],i})}),a=e.merge(i);a=a.filter(function(t,e){return r.elements[e]&&(r.elements[e].visibleInLegend||void 0===r.elements[e].visibleInLegend)}),r.reverseOrder&&(a=a.reverse());var o=r.container;("string"==typeof o||o.nodeName)&&(o=e.select(o));var s=a.map(function(t,e){return t.color}),l=r.fontSize,u=null==r.isContinuous?"number"==typeof a[0]:r.isContinuous,c=u?r.height:l*a.length,h=o.classed("legend-group",!0).selectAll("svg").data([0]),f=h.enter().append("svg").attr({width:300,height:c+l,xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink",version:"1.1"});f.append("g").classed("legend-axis",!0),f.append("g").classed("legend-marks",!0);var p=e.range(a.length),d=e.scale[u?"linear":"ordinal"]().domain(p).range(s),g=e.scale[u?"linear":"ordinal"]().domain(p)[u?"range":"rangePoints"]([0,c]);if(u){var v=h.select(".legend-marks").append("defs").append("linearGradient").attr({id:"grad1",x1:"0%",y1:"0%",x2:"0%",y2:"100%"}).selectAll("stop").data(s);v.enter().append("stop"),v.attr({offset:function(t,e){return e/(s.length-1)*100+"%"}}).style({"stop-color":function(t,e){return t}}),h.append("rect").classed("legend-mark",!0).attr({height:r.height,width:r.colorBandWidth,fill:"url(#grad1)"})}else{var m=h.select(".legend-marks").selectAll("path.legend-mark").data(a);m.enter().append("path").classed("legend-mark",!0),m.attr({transform:function(t,e){return"translate("+[l/2,g(e)+l/2]+")"},d:function(t,r){var n,i,a,o=t.symbol;return a=3*(i=l),"line"===(n=o)?"M"+[[-i/2,-i/12],[i/2,-i/12],[i/2,i/12],[-i/2,i/12]]+"Z":-1!=e.svg.symbolTypes.indexOf(n)?e.svg.symbol().type(n).size(a)():e.svg.symbol().type("square").size(a)()},fill:function(t,e){return d(e)}}),m.exit().remove()}var y=e.svg.axis().scale(g).orient("right"),x=h.select("g.legend-axis").attr({transform:"translate("+[u?r.colorBandWidth:l,l/2]+")"}).call(y);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 a[e].name}),n}return n.config=function(e){return arguments.length?(Qm(t,e),this):t},e.rebind(n,r,"on"),n},ty.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}}},ty.tooltipPanel=function(){var t,r,n,i={container:null,hasTick:!1,fontSize:12,color:"white",padding:5},a="tooltip-"+ty.tooltipPanel.uid++,o=10,s=function(){var e=(t=i.container.selectAll("g."+a).data([0])).enter().append("g").classed(a,!0).style({"pointer-events":"none",display:"none"});return n=e.append("path").style({fill:"white","fill-opacity":.9}).attr({d:"M0 0"}),r=e.append("text").attr({dx:i.padding+o,dy:.3*+i.fontSize}),s};return s.text=function(a){var l=e.hsl(i.color).l,u=l>=.5?"#aaa":"white",c=l>=.5?"black":"white",h=a||"";r.style({fill:c,"font-size":i.fontSize+"px"}).text(h);var f=i.padding,p=r.node().getBBox(),d={fill:i.color,stroke:u,"stroke-width":"2px"},g=p.width+2*f+o,v=p.height+2*f;return n.attr({d:"M"+[[o,-v/2],[o,-v/4],[i.hasTick?0:o,0],[o,v/4],[o,v/2],[g,v/2],[g,-v/2]].join("L")+"Z"}).style(d),t.attr({transform:"translate("+[o,-v/2+2*f]+")"}),t.style({display:"block"}),s},s.move=function(e){if(t)return t.attr({transform:"translate("+[e[0],e[1]]+")"}).style({display:"block"}),s},s.hide=function(){if(t)return t.style({display:"none"}),s},s.show=function(){if(t)return t.style({display:"block"}),s},s.config=function(t){return Qm(i,t),s},s},ty.tooltipPanel.uid=1,ty.adapter={},ty.adapter.plotly=function(){var t={convert:function(t,r){var n={};if(t.data&&(n.data=t.data.map(function(t,e){var n=Qm({},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,e){ty.util.translator.apply(null,t.concat(r))}),r||delete n.marker,r&&delete n.groupId,r?("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}),!r&&t.layout&&"stack"===t.layout.barmode)){var i=ty.util.duplicates(n.data.map(function(t,e){return t.geometry}));n.data.forEach(function(t,e){var r=i.indexOf(t.geometry);-1!=r&&(n.data[e].groupId=r)})}if(t.layout){var a=Qm({},t.layout);if([[a,["plot_bgcolor"],["backgroundColor"]],[a,["showlegend"],["showLegend"]],[a,["radialaxis"],["radialAxis"]],[a,["angularaxis"],["angularAxis"]],[a.angularaxis,["showline"],["gridLinesVisible"]],[a.angularaxis,["showticklabels"],["labelsVisible"]],[a.angularaxis,["nticks"],["ticksCount"]],[a.angularaxis,["tickorientation"],["tickOrientation"]],[a.angularaxis,["ticksuffix"],["ticksSuffix"]],[a.angularaxis,["range"],["domain"]],[a.angularaxis,["endpadding"],["endPadding"]],[a.radialaxis,["showline"],["gridLinesVisible"]],[a.radialaxis,["tickorientation"],["tickOrientation"]],[a.radialaxis,["ticksuffix"],["ticksSuffix"]],[a.radialaxis,["range"],["domain"]],[a.angularAxis,["showline"],["gridLinesVisible"]],[a.angularAxis,["showticklabels"],["labelsVisible"]],[a.angularAxis,["nticks"],["ticksCount"]],[a.angularAxis,["tickorientation"],["tickOrientation"]],[a.angularAxis,["ticksuffix"],["ticksSuffix"]],[a.angularAxis,["range"],["domain"]],[a.angularAxis,["endpadding"],["endPadding"]],[a.radialAxis,["showline"],["gridLinesVisible"]],[a.radialAxis,["tickorientation"],["tickOrientation"]],[a.radialAxis,["ticksuffix"],["ticksSuffix"]],[a.radialAxis,["range"],["domain"]],[a.font,["outlinecolor"],["outlineColor"]],[a.legend,["traceorder"],["reverseOrder"]],[a,["labeloffset"],["labelOffset"]],[a,["defaultcolorrange"],["defaultColorRange"]]].forEach(function(t,e){ty.util.translator.apply(null,t.concat(r))}),r?(void 0!==a.tickLength&&(a.angularaxis.ticklen=a.tickLength,delete a.tickLength),a.tickColor&&(a.angularaxis.tickcolor=a.tickColor,delete a.tickColor)):(a.angularAxis&&void 0!==a.angularAxis.ticklen&&(a.tickLength=a.angularAxis.ticklen),a.angularAxis&&void 0!==a.angularAxis.tickcolor&&(a.tickColor=a.angularAxis.tickcolor)),a.legend&&"boolean"!=typeof a.legend.reverseOrder&&(a.legend.reverseOrder="normal"!=a.legend.reverseOrder),a.legend&&"boolean"==typeof a.legend.traceorder&&(a.legend.traceorder=a.legend.traceorder?"reversed":"normal",delete a.legend.reverseOrder),a.margin&&void 0!==a.margin.t){var o=["t","r","b","l","pad"],s=["top","right","bottom","left","pad"],l={};e.entries(a.margin).forEach(function(t,e){l[s[o.indexOf(t.key)]]=t.value}),a.margin=l}r&&(delete a.needsEndSpacing,delete a.minorTickColor,delete a.minorTicks,delete a.angularaxis.ticksCount,delete a.angularaxis.ticksCount,delete a.angularaxis.ticksStep,delete a.angularaxis.rewriteTicks,delete a.angularaxis.nticks,delete a.radialaxis.ticksCount,delete a.radialaxis.ticksCount,delete a.radialaxis.ticksStep,delete a.radialaxis.rewriteTicks,delete a.radialaxis.nticks),n.layout=a}return n}};return t};var ey,ry=ne.extendDeepAll,ny=ey={};ny.framework=function(t){var r,n,i,a,o,s=new function(){var t,e=[],r=-1,n=!1;function i(t,e){return t?(n=!0,t[e](),n=!1,this):this}return{add:function(t){return n?this:(e.splice(r+1,e.length-r),e.push(t),r=e.length-1,this)},setCallback:function(e){t=e},undo:function(){var n=e[r];return n?(i(n,"undo"),r-=1,t&&t(n.undo),this):this},redo:function(){var n=e[r+1];return n?(i(n,"redo"),r+=1,t&&t(n.redo),this):this},clear:function(){e=[],r=-1},hasUndo:function(){return-1!==r},hasRedo:function(){return r*:not(.chart-root)").remove(),r=r?ry(r,n):n,i||(i=Km.Axis()),a=Km.adapter.plotly().convert(r),i.config(a).render(o),t.data=r.data,t.layout=r.layout,ny.fillLayout(t),r}return l.isPolar=!0,l.svg=function(){return i.svg()},l.getConfig=function(){return r},l.getLiveConfig=function(){return Km.adapter.plotly().convert(i.getLiveConfig(),!0)},l.getLiveScales=function(){return{t:i.angularScale(),r:i.radialScale()}},l.setUndoPoint=function(){var t,e,i=this,a=Km.util.cloneJson(r);t=a,e=n,s.add({undo:function(){e&&i(e)},redo:function(){i(t)}}),n=Km.util.cloneJson(a)},l.undo=function(){s.undo()},l.redo=function(){s.redo()},l},ny.fillLayout=function(t){var r=e.select(t).selectAll(".plot-container"),n=r.selectAll(".svg-container"),i=t.framework&&t.framework.svg&&t.framework.svg(),a={width:800,height:600,paper_bgcolor:Oe.background,_container:r,_paperdiv:n,_paper:i};t._fullLayout=ry(a,t.layout)};var iy={};(iy=Km).manager=ey;var ay={},oy=Gm.enforce,sy=Gm.clean,ly=Nn,uy=0;function cy(t,e){try{t._fullLayout._paper.style("background",e)}catch(t){ne.error(t)}}function hy(t,e){cy(t,Oe.combine(e,"white"))}function fy(t,e){t._context||(t._context=ne.extendDeep({},b));var r,n,i,a=t._context;if(e){for(n=Object.keys(e),r=0;r=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 gy(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]),dy(t,e,"currentIndices"),void 0===r||Array.isArray(r)||(r=[r]),void 0!==r&&dy(t,r,"newIndices"),void 0!==r&&e.length!==r.length)throw new Error("current and new indices must be of equal length.")}function vy(t,e,n,i,a){!function(t,e,r,n){var i=ne.isPlainObject(n);if(!Array.isArray(t.data))throw new Error("gd.data must be an array");if(!ne.isPlainObject(e))throw new Error("update must be a key:value object");if(void 0===r)throw new Error("indices must be an integer or array of integers");for(var a in dy(t,r,"indices"),e){if(!Array.isArray(e[a])||e[a].length!==r.length)throw new Error("attribute "+a+" must be an array of length equal to indices array length");if(i&&(!(a in n)||!Array.isArray(n[a])||n[a].length!==e[a].length))throw new Error("when maxPoints is set as a key:value object it must contain a 1:1 corrispondence with the keys and number of traces in the update object")}}(t,e,n,i);for(var o=function(t,e,n,i){var a,o,s,l,u,c=ne.isPlainObject(i),h=[];for(var f in Array.isArray(n)||(n=[n]),n=py(n,t.data.length-1),e)for(var p=0;p0&&"string"!=typeof _.parts[M-1];)A--;var k=_.parts[A],T=_.parts[A-1]+"."+k,S=_.parts.slice(0,A).join("."),E=ne.nestedProperty(t.layout,S).get(),C=ne.nestedProperty(o,S).get(),L=_.get();if(void 0!==w){d[b]=w,g[b]="reverse"===k?w:yy(L);var z=nn.getLayoutValObject(o,_.parts);if(z&&z.impliedEdits&&null!==w)for(var I in z.impliedEdits)v(ne.relativeAttr(b,I),z.impliedEdits[I]);if(-1!==["width","height"].indexOf(b)&&null===w)o[b]=t._initialAutoSize[b];else if(T.match(/^[xyz]axis[0-9]*\.range(\[[0|1]\])?$/))x(T),ne.nestedProperty(o,S+"._inputRange").set(null);else if(T.match(/^[xyz]axis[0-9]*\.autorange$/)){x(T),ne.nestedProperty(o,S+"._inputRange").set(null);var D=ne.nestedProperty(o,S).get();D._inputDomain&&(D._input.domain=D._inputDomain.slice())}else T.match(/^[xyz]axis[0-9]*\.domain(\[[0|1]\])?$/)&&ne.nestedProperty(o,S+"._inputDomain").set(null);if("type"===k){var O=E,R="linear"===C.type&&"log"===w,F="log"===C.type&&"linear"===w;if(R||F){if(O&&O.range)if(C.autorange)R&&(O.range=O.range[1]>O.range[0]?[1,2]:[2,1]);else{var B=O.range[0],N=O.range[1];R?(B<=0&&N<=0&&v(S+".autorange",!0),B<=0?B=N/1e6:N<=0&&(N=B/1e6),v(S+".range[0]",Math.log(B)/Math.LN10),v(S+".range[1]",Math.log(N)/Math.LN10)):(v(S+".range[0]",Math.pow(10,B)),v(S+".range[1]",Math.pow(10,N)))}else v(S+".autorange",!0);Array.isArray(o._subplots.polar)&&o._subplots.polar.length&&o[_.parts[0]]&&"radialaxis"===_.parts[1]&&delete o[_.parts[0]]._subplot.viewInitial["radialaxis.range"],P.getComponentMethod("annotations","convertCoords")(t,C,w,v),P.getComponentMethod("images","convertCoords")(t,C,w,v)}else v(S+".autorange",!0),v(S+".range",null);ne.nestedProperty(o,S+"._inputRange").set(null)}else if(k.match(Te.AX_NAME_PATTERN)){var j=ne.nestedProperty(o,b).get(),V=(w||{}).type;V&&"-"!==V||(V="linear"),P.getComponentMethod("annotations","convertCoords")(t,j,V,v),P.getComponentMethod("images","convertCoords")(t,j,V,v)}var U=Jv.containerArrayMatch(b);if(U){r=U.array,n=U.index;var q=U.property,H=(ne.nestedProperty(a,r)||[])[n]||{},G=H,W=z||{editType:"calc"},Y=-1!==W.editType.indexOf("calcIfAutorange");""===n?(Y?p.calc=!0:ye.update(p,W),Y=!1):""===q&&(G=w,Jv.isAddVal(w)?g[b]=null:Jv.isRemoveVal(w)?(g[b]=H,G=H):ne.warn("unrecognized full object value",e)),Y&&(wy(t,G,"x")||wy(t,G,"y"))?p.calc=!0:ye.update(p,W),u[r]||(u[r]={});var X=u[r][n];X||(X=u[r][n]={}),X[q]=w,delete e[b]}else"reverse"===k?(E.range?E.range.reverse():(v(S+".autorange",!0),E.range=[1,0]),C.autorange?p.calc=!0:p.plot=!0):(o._has("scatter-like")&&o._has("regl")&&"dragmode"===b&&("lasso"===w||"select"===w)&&"lasso"!==L&&"select"!==L?p.plot=!0:z?ye.update(p,z):p.calc=!0,_.set(w))}}for(r in u){Jv.applyContainerArrayChanges(t,ne.nestedProperty(a,r),u[r],p)||(p.plot=!0)}var Z=o._axisConstraintGroups||[];for(m in y)for(n=0;n=0&&r=0&&r=i.length?i[0]:i[t]:i}function s(t){return Array.isArray(a)?t>=a.length?a[0]:a[t]:a}function l(t,e){var r=0;return function(){if(t&&++r===e)return t()}}return void 0===n._frameWaitingCnt&&(n._frameWaitingCnt=0),new Promise(function(a,u){function c(){n._currentFrame&&n._currentFrame.onComplete&&n._currentFrame.onComplete();var e=n._currentFrame=n._frameQueue.shift();if(e){var r=e.name?e.name.toString():null;t._fullLayout._currentFrame=r,n._lastFrameAt=Date.now(),n._timeToNext=e.frameOpts.duration,_n.transition(t,e.frame.data,e.frame.layout,Vv.coerceTraceIndices(t,e.frame.traces),e.frameOpts,e.transitionOpts).then(function(){e.onComplete&&e.onComplete()}),t.emit("plotly_animatingframe",{name:r,frame:e.frame,animation:{frame:e.frameOpts,transition:e.transitionOpts}})}else t.emit("plotly_animated"),window.cancelAnimationFrame(n._animationRaf),n._animationRaf=null}function h(){t.emit("plotly_animating"),n._lastFrameAt=-1/0,n._timeToNext=0,n._runningTransitions=0,n._currentFrame=null;var e=function(){n._animationRaf=window.requestAnimationFrame(e),Date.now()-n._lastFrameAt>n._timeToNext&&c()};e()}var f,p,d=0;function g(t){return Array.isArray(i)?d>=i.length?t.transitionOpts=i[d]:t.transitionOpts=i[0]:t.transitionOpts=i,d++,t}var v=[],m=void 0===e||null===e,y=Array.isArray(e);if(!m&&!y&&ne.isPlainObject(e))v.push({type:"object",data:g(ne.extendFlat({},e))});else if(m||-1!==["string","number"].indexOf(typeof e))for(f=0;f0&&__)&&w.push(p);v=w}}v.length>0?function(e){if(0!==e.length){for(var i=0;i=0;n--)if(ne.isPlainObject(e[n])){var f=e[n].name,p=(l[f]||h[f]||{}).name,d=e[n].name,g=l[p]||h[p];p&&d&&"number"==typeof d&&g&&uy<5&&(uy++,ne.warn('addFrames: overwriting frame "'+(l[p]||h[p]).name+'" with a frame whose name of type "number" also equates to "'+p+'". This is valid but may potentially lead to unexpected behavior since all plotly.js frame names are stored internally as strings.'),5===uy&&ne.warn("addFrames: This API call has yielded too many of these warnings. For the rest of this call, further warnings about numeric frame names will be suppressed.")),h[f]={name:f},c.push({frame:_n.supplyFrameDefaults(e[n]),index:r&&void 0!==r[n]&&null!==r[n]?r[n]:u+n})}c.sort(function(t,e){return t.index>e.index?-1:t.index=0;n--){if("number"==typeof(i=c[n].frame).name&&ne.warn("Warning: addFrames accepts frames with numeric names, but the numbers areimplicitly cast to strings"),!i.name)for(;l[i.name="frame "+t._transitionData._counter++];);if(l[i.name]){for(a=0;a=0;r--)n=e[r],a.push({type:"delete",index:n}),o.unshift({type:"insert",index:n,value:i[n]});var s=_n.modifyFrames,l=_n.modifyFrames,u=[t,o],c=[t,a];return Nv&&Nv.add(t,s,u,l,c),_n.modifyFrames(t,a)},ay.purge=function(t){var e=(t=ne.getGraphDiv(t))._fullLayout||{},r=t._fullData||[];return _n.cleanPlot([],{},r,e),_n.purge(t),ja.purge(t),e._container&&e._container.remove(),delete t._context,t};var ky={getDelay:function(t){return t._has&&(t._has("gl3d")||t._has("gl2d")||t._has("mapbox"))?500:0},getRedrawFunc:function(t){var e=t._fullLayout||{};if(!(!(e._has&&e._has("polar"))&&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()})}}},Ty=Da.EventEmitter;var Sy=function(t){var e=t.emitter||new Ty,r=new Promise(function(n,i){var a=window.Image,o=t.svg,s=t.format||"png";if(ne.isIE()&&"svg"!==s){var l=new Error("Sorry IE does not support downloading from canvas. Try {format:'svg'} instead.");return i(l),t.promise?r:e.emit("error",l)}var u=t.canvas,c=t.scale||1,h=c*(t.width||300),f=c*(t.height||150),p=u.getContext("2d"),d=new a,g="data:image/svg+xml,"+encodeURIComponent(o);u.width=h,u.height=f,d.onload=function(){var r;switch("svg"!==s&&p.drawImage(d,0,0,h,f),s){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 a="Image format is not jpeg, png, svg or webp.";if(i(new Error(a)),!t.promise)return e.emit("error",a)}n(r),t.promise||e.emit("success",r)},d.onerror=function(r){if(i(r),!t.promise)return e.emit("error",r)},d.src=g});return t.promise?r:e},Ey=/"/g,Cy=new RegExp('("TOBESTRIPPED)|(TOBESTRIPPED")',"g");var Ly=function(t,r,n){var i,a=t._fullLayout,o=a._paper,s=a._toppaper,l=a.width,u=a.height;o.insert("rect",":first-child").call(Sr.setRect,0,0,l,u).call(Oe.fill,a.paper_bgcolor);var c=a._basePlotModules||[];for(i=0;i")?"":r.html(t).text()});return r.remove(),n}(g),g=(g=g.replace(/&(?!\w+;|\#[0-9]+;| \#x[0-9A-F]+;)/g,"&")).replace(Cy,"'"),ne.isIE()&&(g=(g=(g=g.replace(/"/gi,"'")).replace(/(\('#)([^']*)('\))/gi,'("#$2")')).replace(/(\\')/gi,'"')),g},zy={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}},Py=/^data:image\/\w+;base64,/;var Iy=function(t,e){var r,n,i;function a(t){return!(t in e)||ne.validate(e[t],zy[t])}if(e=e||{},ne.isPlainObject(t)?(r=t.data||[],n=t.layout||{},i=t.config||{}):(t=ne.getGraphDiv(t),r=ne.extendDeep([],t.data),n=ne.extendDeep({},t.layout),i=t._context),!a("width")||!a("height"))throw new Error("Height and width should be pixel values.");if(!a("format"))throw new Error("Image format is not jpeg, png, svg or webp.");var o={};function s(t,r){return ne.coerce(e,o,zy,t,r)}var l=s("format"),u=s("width"),c=s("height"),h=s("scale"),f=s("setBackground"),p=s("imageDataOnly"),d=document.createElement("div");d.style.position="absolute",d.style.left="-5000px",document.body.appendChild(d);var g=ne.extendFlat({},n);u&&(g.width=u),c&&(g.height=c);var v=ne.extendFlat({},i,{staticPlot:!0,setBackground:f}),m=ky.getRedrawFunc(d);function y(){return new Promise(function(t){setTimeout(t,ky.getDelay(d._fullLayout))})}function x(){return new Promise(function(t,e){var r=Ly(d,l,h),n=d._fullLayout.width,i=d._fullLayout.height;if(ay.purge(d),document.body.removeChild(d),"svg"===l)return t(p?r:"data:image/svg+xml,"+encodeURIComponent(r));var a=document.createElement("canvas");a.id=ne.randstr(),Sy({format:l,width:n,height:i,scale:h,canvas:a,svg:r,promise:!0}).then(t).catch(e)})}return new Promise(function(t,e){ay.plot(d,r,g,v).then(m).then(y).then(x).then(function(e){t(function(t){return p?t.replace(Py,""):t}(e))}).catch(function(t){e(t)})})},Dy=ne.isPlainObject,Oy=Array.isArray,Ry=ne.isArrayOrTypedArray;function Fy(t,e,r,n,i,a){a=a||[];for(var o=Object.keys(t),s=0;sh.length&&n.push(jy("unused",i,u.concat(h.length)));var v,m,y,x,b,_=h.length,w=Array.isArray(g);if(w&&(_=Math.min(_,g.length)),2===f.dimensions)for(m=0;m<_;m++)if(Oy(c[m])){c[m].length>h[m].length&&n.push(jy("unused",i,u.concat(m,h[m].length)));var M=h[m].length;for(v=0;v<(w?Math.min(M,g[m].length):M);v++)y=w?g[m][v]:g,x=c[m][v],b=h[m][v],ne.validate(x,y)?b!==x&&b!==+x&&n.push(jy("dynamic",i,u.concat(m,v),x,b)):n.push(jy("value",i,u.concat(m,v),x))}else n.push(jy("array",i,u.concat(m),c[m]));else for(m=0;m<_;m++)y=w?g[m]:g,x=c[m],b=h[m],ne.validate(x,y)?b!==x&&b!==+x&&n.push(jy("dynamic",i,u.concat(m),x,b)):n.push(jy("value",i,u.concat(m),x))}else if(f.items&&!p&&Oy(c)){var A,k,T=g[Object.keys(g)[0]],S=[];for(A=0;A1&&a.push(jy("object","layout"))),_n.supplyDefaults(o);for(var s=o._fullData,l=r.length,u=0;u-1&&(s[u[r]].title="");for(r=0;r=0;i--){var a=t[i];if("scatter"===a.type&&a.xaxis===r.xaxis&&a.yaxis===r.yaxis){a.opacity=void 0;break}}}}},cx=ne.isArrayOrTypedArray,hx=function(t,e,r,n){var i=!1;if(e.marker){var a=e.marker.color,o=(e.marker.line||{}).color;a&&!cx(a)?i=a:o&&!cx(o)&&(i=o)}n("fillcolor",Oe.addOpacity((e.line||{}).color||i||r,.5))},fx=ne.isArrayOrTypedArray,px=function(t,e,r,n,i,a){var o=(t.marker||{}).color;(i("line.color",r),Xe(t,"line"))?Ye(t,e,n,i,{prefix:"line.",cLetter:"c"}):i("line.color",!fx(o)&&o||r);i("line.width"),(a||{}).noDash||i("line.dash")},dx=function(t,e,r){"spline"===r("line.shape")&&r("line.smoothing")},gx=function(t,e,r,n,i,a){var o=Tr.isBubble(t),s=(t.line||{}).color;(a=a||{},s&&(r=s),i("marker.symbol"),i("marker.opacity",o?.7:1),i("marker.size"),i("marker.color",r),Xe(t,"marker")&&Ye(t,e,n,i,{prefix:"marker.",cLetter:"c"}),a.noSelect||(i("selected.marker.color"),i("unselected.marker.color"),i("selected.marker.size"),i("unselected.marker.size")),a.noLine||(i("marker.line.color",s&&!Array.isArray(s)&&e.marker.color!==s?s:o?Oe.background:Oe.defaultLine),Xe(t,"marker.line")&&Ye(t,e,n,i,{prefix:"marker.line.",cLetter:"c"}),i("marker.line.width",o?1:0)),o&&(i("marker.sizeref"),i("marker.sizemin"),i("marker.sizemode")),a.gradient)&&("none"!==i("marker.gradient.type")&&i("marker.gradient.color"))},vx=function(t,e,r,n,i){i=i||{},n("textposition"),ne.coerceFont(n,"textfont",r.font),i.noSelect||(n("selected.textfont.color"),n("unselected.textfont.color"))},mx=function(t,e){var r,n;if("lines"===t.mode)return(r=t.line.color)&&Oe.opacity(r)?r:t.fillcolor;if("none"===t.mode)return t.fill?t.fillcolor:"";var i=e.mcc||(t.marker||{}).color,a=e.mlcc||((t.marker||{}).line||{}).color;return(n=i&&Oe.opacity(i)?i:a&&Oe.opacity(a)&&(e.mlw||((t.marker||{}).line||{}).width)?a:"")?Oe.opacity(n)<.3?Oe.addOpacity(n,.3):n:(r=(t.line||{}).color)&&Oe.opacity(r)&&Tr.hasLines(t)&&t.line.width?r:t.fillcolor},yx=function(t,e,r,n){var i=t.cd,a=i[0].trace,o=t.xa,s=t.ya,l=o.c2p(e),u=s.c2p(r),c=[l,u],h=a.hoveron||"",f=-1!==a.mode.indexOf("markers")?3:.5;if(-1!==h.indexOf("points")){var p=function(t){var e=Math.max(f,t.mrc||0),r=o.c2p(t.x)-l,n=s.c2p(t.y)-u;return Math.max(Math.sqrt(r*r+n*n)-e,1-f/e)},d=yo.getDistanceFunction(n,function(t){var e=Math.max(3,t.mrc||0),r=1-1/e,n=Math.abs(o.c2p(t.x)-l);return nR!=(S=w[b][1])>=R&&(A=w[b-1][0],k=w[b][0],S-T&&(M=A+(k-A)*(R-T)/(S-T),z=Math.min(z,M),I=Math.max(I,M)));z=Math.max(z,0),I=Math.min(I,o._length);var F=Oe.defaultLine;return Oe.opacity(a.fillcolor)?F=a.fillcolor:Oe.opacity((a.line||{}).color)&&(F=a.line.color),ne.extendFlat(t,{distance:t.maxHoverDistance,x0:z,x1:I,y0:R,y1:R,color:F}),delete t.index,a.text&&!Array.isArray(a.text)?t.text=String(a.text):t.text=a.name,[t]}}},xx=t.BADNUM,bx=ne.segmentsIntersect,_x=ne.constrain,wx=function(t,e){var r,n,i,a,o,s,l,u,c,h,f,p,d,g,v,m,y=e.xaxis,x=e.yaxis,b=e.simplify,_=e.connectGaps,w=e.baseTolerance,M=e.shape,A="linear"===M,k=[],T=Wr.minTolerance,S=new Array(t.length),E=0;function C(e){var r=t[e],n=y.c2p(r.x),i=x.c2p(r.y);return n===xx||i===xx?r.intoCenter||!1:[n,i]}function L(t){var e=t[0]/y._length,r=t[1]/x._length;return(1+Wr.toleranceGrowth*Math.max(0,-e,e-1,-r,r-1))*w}function z(t,e){var r=t[0]-e[0],n=t[1]-e[1];return Math.sqrt(r*r+n*n)}b||(w=T=-1);var P,I,D,O,R,F,B,N=Wr.maxScreensAway,j=-y._length*N,V=y._length*(1+N),U=-x._length*N,q=x._length*(1+N),H=[[j,U,V,U],[V,U,V,q],[V,q,j,q],[j,q,j,U]];function G(t){if(t[0]V||t[1]q)return[_x(t[0],j,V),_x(t[1],U,q)]}function W(t,e){return t[0]===e[0]&&(t[0]===j||t[0]===V)||(t[1]===e[1]&&(t[1]===U||t[1]===q)||void 0)}function Y(t,e,r){return function(n,i){var a=G(n),o=G(i),s=[];if(a&&o&&W(a,o))return s;a&&s.push(a),o&&s.push(o);var l=2*ne.constrain((n[t]+i[t])/2,e,r)-((a||n)[t]+(o||i)[t]);l&&((a&&o?l>0==a[t]>o[t]?a:o:a||o)[t]+=l);return s}}function X(t){var e=t[0],r=t[1],n=e===S[E-1][0],i=r===S[E-1][1];if(!n||!i)if(E>1){var a=e===S[E-2][0],o=r===S[E-2][1];n&&(e===j||e===V)&&a?o?E--:S[E-1]=t:i&&(r===U||r===q)&&o?a?E--:S[E-1]=t:S[E++]=t}else S[E++]=t}function Z(t){S[E-1][0]!==t[0]&&S[E-1][1]!==t[1]&&X([D,O]),X(t),R=null,D=O=0}function J(t){if(P=t[0]V?V:0,I=t[1]q?q:0,P||I){if(E)if(R){var e=B(R,t);e.length>1&&(Z(e[0]),S[E++]=e[1])}else F=B(S[E-1],t)[0],S[E++]=F;else S[E++]=[P||t[0],I||t[1]];var r=S[E-1];P&&I&&(r[0]!==P||r[1]!==I)?(R&&(D!==P&&O!==I?X(D&&O?(n=R,a=(i=t)[0]-n[0],o=(i[1]-n[1])/a,(n[1]*i[0]-i[1]*n[0])/a>0?[o>0?j:V,q]:[o>0?V:j,U]):[D||P,O||I]):D&&O&&X([D,O])),X([P,I])):D-P&&O-I&&X([P||D,I||O]),R=t,D=P,O=I}else R&&Z(B(R,t)[0]),S[E++]=t;var n,i,a,o}for("linear"===M||"spline"===M?B=function(t,e){for(var r=[],n=0,i=0;i<4;i++){var a=H[i],o=bx(t[0],t[1],e[0],e[1],a[0],a[1],a[2],a[3]);o&&(!n||Math.abs(o.x-r[0][0])>1||Math.abs(o.y-r[0][1])>1)&&(o=[o.x,o.y],n&&z(o,t)L(s))break;i=s,(d=c[0]*u[0]+c[1]*u[1])>f?(f=d,a=s,l=!1):d=t.length||!s)break;J(s),n=s}}else J(a)}R&&X([D||R[0],O||R[1]]),k.push(S.slice(0,E))}return k},Mx=function(t,e,r){var n,i,a=null;for(i=0;i0;for((l=c.selectAll("g.trace").data(n,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),Mx(t,r,n),function(t,r,n){var i;r.selectAll("g.trace").each(function(t){var r=e.select(this);if((i=t[0].trace)._nexttrace){if(i._nextFill=r.select(".js-fill.js-tonext"),!i._nextFill.size()){var a=":first-child";r.select(".js-fill.js-tozero").size()&&(a+=" + *"),i._nextFill=r.insert("path",a).attr("class","js-fill js-tonext")}}else r.selectAll(".js-fill.js-tonext").remove(),i._nextFill=null;i.fill&&("tozero"===i.fill.substr(0,6)||"toself"===i.fill||"to"===i.fill.substr(0,2)&&!i._prevtrace)?(i._ownFill=r.select(".js-fill.js-tozero"),i._ownFill.size()||(i._ownFill=r.insert("path",":first-child").attr("class","js-fill js-tozero"))):(r.selectAll(".js-fill.js-tozero").remove(),i._ownFill=null),r.selectAll(".js-fill").call(Sr.setClipUrl,n.layerClipId)})}(0,c,r),o=0,s={};os[e[0].trace.uid]?1:-1}),f)?(a&&(u=a()),e.transition().duration(i.duration).ease(i.easing).each("end",function(){u&&u()}).each("interrupt",function(){u&&u()}).each(function(){c.selectAll("g.trace").each(function(e,a){Tx(t,a,r,e,n,this,i)})})):c.selectAll("g.trace").each(function(e,a){Tx(t,a,r,e,n,this,i)});h&&l.exit().remove(),c.selectAll("path:not([d])").remove()};function Tx(t,r,n,i,a,o,s){var l,u;!function(t,r,n,i,a){var o=n.xaxis,s=n.yaxis,l=e.extent(ne.simpleMap(o.range,o.r2c)),u=e.extent(ne.simpleMap(s.range,s.r2c)),c=i[0].trace;if(!Tr.hasMarkers(c))return;var h=c.marker.maxdisplayed;if(0===h)return;var f=i.filter(function(t){return t.x>=l[0]&&t.x<=l[1]&&t.y>=u[0]&&t.y<=u[1]}),p=Math.ceil(f.length/h),d=0;a.forEach(function(t,e){var n=t[0].trace;Tr.hasMarkers(n)&&n.marker.maxdisplayed>0&&e0;function h(t){return c?t.transition():t}var f=n.xaxis,p=n.yaxis,d=i[0].trace,g=d.line,v=e.select(o);if(P.getComponentMethod("errorbars","plot")(v,n,s),!0===d.visible){var m,y;h(v).style("opacity",d.opacity);var x=d.fill.charAt(d.fill.length-1);"x"!==x&&"y"!==x&&(x=""),i[0].node3=v;var b="",_=[],w=d._prevtrace;w&&(b=w._prevRevpath||"",y=w._nextFill,_=w._polygons);var M,A,k,T,S,E,C,L,z,I="",D="",O=[],R=ne.noop;if(m=d._ownFill,Tr.hasLines(d)||"none"!==d.fill){for(y&&y.datum(i),-1!==["hv","vh","hvh","vhv"].indexOf(g.shape)?(k=Sr.steps(g.shape),T=Sr.steps(g.shape.split("").reverse().join(""))):k=T="spline"===g.shape?function(t){var e=t[t.length-1];return t.length>1&&t[0][0]===e[0]&&t[0][1]===e[1]?Sr.smoothclosed(t.slice(1),g.smoothing):Sr.smoothopen(t,g.smoothing)}:function(t){return"M"+t.join("L")},S=function(t){return T(t.reverse())},O=wx(i,{xaxis:f,yaxis:p,connectGaps:d.connectgaps,baseTolerance:Math.max(g.width||1,3)/4,shape:g.shape,simplify:g.simplify}),z=d._polygons=new Array(O.length),u=0;u1){var n=e.select(this);if(n.datum(i),t)h(n.style("opacity",0).attr("d",M).call(Sr.lineGroupStyle)).style("opacity",1);else{var a=h(n);a.attr("d",M),Sr.singleLineStyle(i,a)}}}}}var F=v.selectAll(".js-line").data(O);h(F.exit()).style("opacity",0).remove(),F.each(R(!1)),F.enter().append("path").classed("js-line",!0).style("vector-effect","non-scaling-stroke").call(Sr.lineGroupStyle).each(R(!0)),Sr.setClipUrl(F,n.layerClipId),O.length?(m?E&&L&&(x?("y"===x?E[1]=L[1]=p.c2p(0,!0):"x"===x&&(E[0]=L[0]=f.c2p(0,!0)),h(m).attr("d","M"+L+"L"+E+"L"+I.substr(1)).call(Sr.singleFillStyle)):h(m).attr("d",I+"Z").call(Sr.singleFillStyle)):y&&("tonext"===d.fill.substr(0,6)&&I&&b?("tonext"===d.fill?h(y).attr("d",I+"Z"+b+"Z").call(Sr.singleFillStyle):h(y).attr("d",I+"L"+b.substr(1)+"Z").call(Sr.singleFillStyle),d._polygons=d._polygons.concat(_)):(N(y),d._polygons=null)),d._prevRevpath=D,d._prevPolygons=z):(m?N(m):y&&N(y),d._polygons=d._prevRevpath=d._prevPolygons=null);var B=v.selectAll(".points");l=B.data([i]),B.each(H),l.enter().append("g").classed("points",!0).each(H),l.exit().remove(),l.each(function(t){var r=!1===t[0].trace.cliponaxis;Sr.setClipUrl(e.select(this),r?null:n.layerClipId)})}function N(t){h(t).attr("d","M0,0Z")}function j(t){return t.filter(function(t){return t.vis})}function V(t){return t.id}function U(t){if(t.ids)return V}function q(){return!1}function H(r){var i,a=r[0].trace,o=e.select(this),s=Tr.hasMarkers(a),l=Tr.hasText(a),u=U(a),d=q,g=q;s&&(d=a.marker.maxdisplayed||a._needsCull?j:ne.identity),l&&(g=a.marker.maxdisplayed||a._needsCull?j:ne.identity);var v=(i=o.selectAll("path.point").data(d,u)).enter().append("path").classed("point",!0);c&&v.call(Sr.pointStyle,a,t).call(Sr.translatePoints,f,p).style("opacity",0).transition().style("opacity",1);var m=s&&Sr.tryColorscale(a.marker,""),y=s&&Sr.tryColorscale(a.marker,"line");i.order(),i.each(function(r){var i=e.select(this),o=h(i);Sr.translatePoint(r,o,f,p)?(Sr.singlePointStyle(r,o,a,m,y,t),n.layerClipId&&Sr.hideOutsideRangePoint(r,o,f,p,a.xcalendar,a.ycalendar),a.customdata&&i.classed("plotly-customdata",null!==r.data&&void 0!==r.data)):o.remove()}),c?i.exit().transition().style("opacity",0).remove():i.exit().remove(),(i=o.selectAll("g").data(g,u)).enter().append("g").classed("textpoint",!0).append("text"),i.order(),i.each(function(t){var r=e.select(this),i=h(r.select("text"));Sr.translatePoint(t,i,f,p)?n.layerClipId&&Sr.hideOutsideRangePoint(t,r,f,p,a.xcalendar,a.ycalendar):r.remove()}),i.selectAll("text").call(Sr.textPointStyle,a,t).each(function(t){var r=f.c2p(t.x),n=p.c2p(t.y);e.select(this).selectAll("tspan.line").each(function(){h(e.select(this)).attr({x:r,y:n})})}),i.exit().remove()}}var Sx=function(t,e){var r,n,i,a,o=t.cd,s=t.xaxis,l=t.yaxis,u=[],c=o[0].trace;if(!Tr.hasMarkers(c)&&!Tr.hasText(c))return[];if(!1===e)for(r=0;r":return function(t){return u(t)>s};case">=":return function(t){return u(t)>=s};case"[]":return function(t){var e=u(t);return e>=s[0]&&e<=s[1]};case"()":return function(t){var e=u(t);return e>s[0]&&e=s[0]&&es[0]&&e<=s[1]};case"][":return function(t){var e=u(t);return e<=s[0]||e>=s[1]};case")(":return function(t){var e=u(t);return es[1]};case"](":return function(t){var e=u(t);return e<=s[0]||e>s[1]};case")[":return function(t){var e=u(t);return e=s[1]};case"{}":return function(t){return-1!==s.indexOf(u(t))};case"}{":return function(t){return-1===s.indexOf(u(t))}}}(r,ri.getDataToCoordFunc(t,e,i,n),o),f={},p={},d=0;r.preservegaps?(u=function(t){f[t.astr]=ne.extendDeep([],t.get()),t.set(new Array(a))},c=function(t,e){var r=f[t.astr][e];t.get()[e]=r}):(u=function(t){f[t.astr]=ne.extendDeep([],t.get()),t.set([])},c=function(t,e){var r=f[t.astr][e];t.get().push(r)}),m(u);for(var g=Nx(e.transforms,r),v=0;v1?"%{group} (%{trace})":"%{group}");var o=t.styles,s=i.styles=[];if(o)for(n=0;n0,l=[],u=[],c=0,h=0;for(n=0;n0&&l.push("var "+u.join(",")),n=a-1;n>=0;--n)c=t[n],l.push(["for(i",n,"=0;i",n,"0&&l.push(["index[",h,"]-=s",h].join("")),l.push(["++index[",c,"]"].join(""))),l.push("}")}return l.join("\n")}function tb(t,e,r){for(var n=t.body,i=[],a=[],o=0;o0&&g.push("shape=SS.slice(0)"),t.indexArgs.length>0){var v=new Array(r);for(a=0;a0&&d.push("var "+g.join(",")),a=0;a3&&d.push(tb(t.pre,t,i));var b=tb(t.body,t,i),_=function(t){for(var e=0,r=t[0].length;e0,l=[],u=0;u0;){"].join("")),l.push(["if(j",u,"<",o,"){"].join("")),l.push(["s",e[u],"=j",u].join("")),l.push(["j",u,"=0"].join("")),l.push(["}else{s",e[u],"=",o].join("")),l.push(["j",u,"-=",o,"}"].join("")),s&&l.push(["index[",e[u],"]=j",u].join(""));for(u=0;u3&&d.push(tb(t.post,t,i)),t.debug&&console.log("-----Generated cwise routine for ",e,":\n"+d.join("\n")+"\n----------");var w=[t.funcName||"unnamed","_cwise_loop_",n[0].join("s"),"m",_,function(t){for(var e=new Array(t.length),r=!0,n=0;n0&&(r=r&&e[n]===e[n-1])}return r?e[0]:e.join("")}(i)].join("");return new Function(["function ",w,"(",p.join(","),"){",d.join("\n"),"} return ",w].join(""))()};var rb=function(t){var e=["'use strict'","var CACHED={}"],r=[],n=t.funcName+"_cwise_thunk";e.push(["return function ",n,"(",t.shimArgs.join(","),"){"].join(""));for(var i=[],a=[],o=[["array",t.arrayArgs[0],".shape.slice(",Math.max(0,t.arrayBlockIndices[0]),t.arrayBlockIndices[0]<0?","+t.arrayBlockIndices[0]+")":")"].join("")],s=[],l=[],u=0;u0&&(s.push("array"+t.arrayArgs[0]+".shape.length===array"+c+".shape.length+"+(Math.abs(t.arrayBlockIndices[0])-Math.abs(t.arrayBlockIndices[u]))),l.push("array"+t.arrayArgs[0]+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[0])+"]===array"+c+".shape[shapeIndex+"+Math.max(0,t.arrayBlockIndices[u])+"]"))}for(t.arrayArgs.length>1&&(e.push("if (!("+s.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 (!("+l.join(" && ")+")) throw new Error('cwise: Arrays do not all have the same shape!')"),e.push("}")),u=0;u0)throw new Error("cwise: pre() block may not reference array args");if(n0)throw new Error("cwise: post() block may not reference array args")}else if("scalar"===i)e.scalarArgs.push(n),e.shimArgs.push("scalar"+n);else if("index"===i){if(e.indexArgs.push(n),n0)throw new Error("cwise: pre() block may not reference array index");if(n0)throw new Error("cwise: post() block may not reference array index")}else if("shape"===i){if(e.shapeArgs.push(n),nr.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,rb(e)},ib={},ab={body:"",args:[],thisVars:[],localVars:[]};function ob(t){if(!t)return ab;for(var e=0;e>",rrshift:">>>"};!function(){for(var t in lb){var e=lb[t];ib[t]=sb({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),ib[t+"eq"]=sb({args:["array","array"],body:{args:["a","b"],body:"a"+e+"=b"},rvalue:!0,funcName:t+"eq"}),ib[t+"s"]=sb({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),ib[t+"seq"]=sb({args:["array","scalar"],body:{args:["a","s"],body:"a"+e+"=s"},rvalue:!0,funcName:t+"seq"})}}();var ub={not:"!",bnot:"~",neg:"-",recip:"1.0/"};!function(){for(var t in ub){var e=ub[t];ib[t]=sb({args:["array","array"],body:{args:["a","b"],body:"a="+e+"b"},funcName:t}),ib[t+"eq"]=sb({args:["array"],body:{args:["a"],body:"a="+e+"a"},rvalue:!0,count:2,funcName:t+"eq"})}}();var cb={and:"&&",or:"||",eq:"===",neq:"!==",lt:"<",gt:">",leq:"<=",geq:">="};!function(){for(var t in cb){var e=cb[t];ib[t]=sb({args:["array","array","array"],body:{args:["a","b","c"],body:"a=b"+e+"c"},funcName:t}),ib[t+"s"]=sb({args:["array","array","scalar"],body:{args:["a","b","s"],body:"a=b"+e+"s"},funcName:t+"s"}),ib[t+"eq"]=sb({args:["array","array"],body:{args:["a","b"],body:"a=a"+e+"b"},rvalue:!0,count:2,funcName:t+"eq"}),ib[t+"seq"]=sb({args:["array","scalar"],body:{args:["a","s"],body:"a=a"+e+"s"},rvalue:!0,count:2,funcName:t+"seq"})}}();var hb=["abs","acos","asin","atan","ceil","cos","exp","floor","log","round","sin","sqrt","tan"];!function(){for(var t=0;tthis_s){this_s=-a}else if(a>this_s){this_s=a}",localVars:[],thisVars:["this_s"]},post:{args:[],localVars:[],thisVars:["this_s"],body:"return this_s"},funcName:"norminf"}),ib.norm1=nb({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"}),ib.sup=nb({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:[]}}),ib.inf=nb({args:["array"],pre:{body:"this_h=Infinity",args:[],thisVars:["this_h"],localVars:[]},body:{body:"if(_inline_1_arg0_this_v){this_v=_inline_1_arg1_;for(var _inline_1_k=0;_inline_1_k<_inline_1_arg0_.length;++_inline_1_k){this_i[_inline_1_k]=_inline_1_arg0_[_inline_1_k]}}}",args:[{name:"_inline_1_arg0_",lvalue:!1,rvalue:!0,count:2},{name:"_inline_1_arg1_",lvalue:!1,rvalue:!0,count:2}],thisVars:["this_i","this_v"],localVars:["_inline_1_k"]},post:{body:"{return this_i}",args:[],thisVars:["this_i"],localVars:[]}}),ib.random=sb({args:["array"],pre:{args:[],body:"this_f=Math.random",thisVars:["this_f"]},body:{args:["a"],body:"a=this_f()",thisVars:["this_f"]},funcName:"random"}),ib.assign=sb({args:["array","array"],body:{args:["a","b"],body:"a=b"},funcName:"assign"}),ib.assigns=sb({args:["array","scalar"],body:{args:["a","b"],body:"a=b"},funcName:"assigns"}),ib.equals=nb({args:["array","array"],pre:ab,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"});var db=function(t){for(var e=new Array(t),r=0;rMath.abs(this.stride[1]))?[1,0]:[0,1]}})"):3===e&&i.push("var s0=Math.abs(this.stride[0]),s1=Math.abs(this.stride[1]),s2=Math.abs(this.stride[2]);if(s0>s1){if(s1>s2){return [2,1,0];}else if(s0>s2){return [1,2,0];}else{return [1,0,2];}}else if(s0>s2){return [2,0,1];}else if(s2>s1){return [0,1,2];}else{return [0,2,1];}}})")):i.push("ORDER})")),i.push("proto.set=function "+r+"_set("+o.join(",")+",v){"),n?i.push("return this.data.set("+s+",v)}"):i.push("return this.data["+s+"]=v}"),i.push("proto.get=function "+r+"_get("+o.join(",")+"){"),n?i.push("return this.data.get("+s+")}"):i.push("return this.data["+s+"]}"),i.push("proto.index=function "+r+"_index(",o.join(),"){return "+s+"}"),i.push("proto.hi=function "+r+"_hi("+o.join(",")+"){return new "+r+"(this.data,"+a.map(function(t){return["(typeof i",t,"!=='number'||i",t,"<0)?this.shape[",t,"]:i",t,"|0"].join("")}).join(",")+","+a.map(function(t){return"this.stride["+t+"]"}).join(",")+",this.offset)}");var c=a.map(function(t){return"a"+t+"=this.shape["+t+"]"}),h=a.map(function(t){return"c"+t+"=this.stride["+t+"]"});i.push("proto.lo=function "+r+"_lo("+o.join(",")+"){var b=this.offset,d=0,"+c.join(",")+","+h.join(","));for(var f=0;f=0){d=i"+f+"|0;b+=c"+f+"*d;a"+f+"-=d}");i.push("return new "+r+"(this.data,"+a.map(function(t){return"a"+t}).join(",")+","+a.map(function(t){return"c"+t}).join(",")+",b)}"),i.push("proto.step=function "+r+"_step("+o.join(",")+"){var "+a.map(function(t){return"a"+t+"=this.shape["+t+"]"}).join(",")+","+a.map(function(t){return"b"+t+"=this.stride["+t+"]"}).join(",")+",c=this.offset,d=0,ceil=Math.ceil");for(f=0;f=0){c=(c+this.stride["+f+"]*i"+f+")|0}else{a.push(this.shape["+f+"]);b.push(this.stride["+f+"])}");return i.push("var ctor=CTOR_LIST[a.length+1];return ctor(this.data,a,b,c)}"),i.push("return function construct_"+r+"(data,shape,stride,offset){return new "+r+"(data,"+a.map(function(t){return"shape["+t+"]"}).join(",")+","+a.map(function(t){return"stride["+t+"]"}).join(",")+",offset)}"),new Function("CTOR_LIST","ORDER",i.join("\n"))(_b[t],xb)}var _b={float32:[],float64:[],int8:[],int16:[],int32:[],uint8:[],uint16:[],uint32:[],array:[],uint8_clamped:[],buffer:[],generic:[]};var wb=function(t,e,r,n){if(void 0===t)return(0,_b.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 a=i-1,o=1;a>=0;--a)r[a]=o,o*=e[a]}if(void 0===n)for(n=0,a=0;a0)-(t<0)},Mb.abs=function(t){var e=t>>31;return(t^e)-e},Mb.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1},Mb.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},Mb.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},Mb.countTrailingZeros=Ab,Mb.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},Mb.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},Mb.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var kb=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|kb[t>>>16&255]<<8|kb[t>>>24&255]},Mb.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},Mb.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},Mb.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},Mb.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},Mb.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>Ab(t)+1};for(var Tb={byteLength:function(t){return 3*t.length/4-Ib(t)},toByteArray:function(t){var e,r,n,i,a,o=t.length;i=Ib(t),a=new Cb(3*o/4-i),r=i>0?o-4:o;var s=0;for(e=0;e>16&255,a[s++]=n>>8&255,a[s++]=255&n;2===i?(n=Eb[t.charCodeAt(e)]<<2|Eb[t.charCodeAt(e+1)]>>4,a[s++]=255&n):1===i&&(n=Eb[t.charCodeAt(e)]<<10|Eb[t.charCodeAt(e+1)]<<4|Eb[t.charCodeAt(e+2)]>>2,a[s++]=n>>8&255,a[s++]=255&n);return a},fromByteArray:function(t){for(var e,r=t.length,n=r%3,i="",a=[],o=0,s=r-n;os?s:o+16383));1===n?(e=t[r-1],i+=Sb[e>>2],i+=Sb[e<<4&63],i+="=="):2===n&&(e=(t[r-2]<<8)+t[r-1],i+=Sb[e>>10],i+=Sb[e>>4&63],i+=Sb[e<<2&63],i+="=");return a.push(i),a.join("")}},Sb=[],Eb=[],Cb="undefined"!=typeof Uint8Array?Uint8Array:Array,Lb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",zb=0,Pb=Lb.length;zb0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function Db(t,e,r){for(var n,i,a=[],o=e;o>18&63]+Sb[i>>12&63]+Sb[i>>6&63]+Sb[63&i]);return a.join("")}Eb["-".charCodeAt(0)]=62,Eb["_".charCodeAt(0)]=63;var Ob={read:function(t,e,r,n,i){var a,o,s=8*i-n-1,l=(1<>1,c=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=u}return(p?-1:1)*o*Math.pow(2,a-n)},write:function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(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>=c?(s=0,o=c):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+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,u-=8);t[r+p-d]|=128*g}},Rb={};Rb.Buffer=Nb,Rb.SlowBuffer=function(t){+t!=t&&(t=0);return Nb.alloc(+t)},Rb.INSPECT_MAX_BYTES=50;var Fb=2147483647;function Bb(t){if(t>Fb)throw new RangeError("Invalid typed array length");var e=new Uint8Array(t);return e.__proto__=Nb.prototype,e}function Nb(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 Ub(t)}return jb(t,e,r)}function jb(t,e,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return y_(t)||t&&y_(t.buffer)?function(t,e,r){if(e<0||t.byteLength=Fb)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Fb.toString(16)+" bytes");return 0|t}function Gb(t,e){if(Nb.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||y_(t))return t.byteLength;"string"!=typeof t&&(t=""+t);var r=t.length;if(0===r)return 0;for(var n=!1;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return g_(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return v_(t).length;default:if(n)return g_(t).length;e=(""+e).toLowerCase(),n=!0}}function Wb(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function Yb(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),x_(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=Nb.from(e,n)),Nb.isBuffer(e))return 0===e.length?-1:Xb(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):Xb(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Xb(t,e,r,n,i){var a,o=1,s=t.length,l=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;o=2,s/=2,l/=2,r/=2}function u(t,e){return 1===o?t[e]:t.readUInt16BE(e*o)}if(i){var c=-1;for(a=r;as&&(r=s-l),a=r;a>=0;a--){for(var h=!0,f=0;fi&&(n=i):n=i;var a=e.length;n>a/2&&(n=a/2);for(var o=0;o>8,i=r%256,a.push(i),a.push(n);return a}(e,t.length-r),t,r,n)}function e_(t,e,r){return 0===e&&r===t.length?Tb.fromByteArray(t):Tb.fromByteArray(t.slice(e,r))}function r_(t,e,r){r=Math.min(t.length,r);for(var n=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(a=t[i+1]))&&(l=(31&u)<<6|63&a)>127&&(c=l);break;case 3:a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&(l=(15&u)<<12|(63&a)<<6|63&o)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&(l=(15&u)<<18|(63&a)<<12|(63&o)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}return function(t){var e=t.length;if(e<=n_)return String.fromCharCode.apply(String,t);var r="",n=0;for(;nthis.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return o_(this,e,r);case"utf8":case"utf-8":return r_(this,e,r);case"ascii":return i_(this,e,r);case"latin1":case"binary":return a_(this,e,r);case"base64":return e_(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return s_(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}.apply(this,arguments)},Nb.prototype.toLocaleString=Nb.prototype.toString,Nb.prototype.equals=function(t){if(!Nb.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===Nb.compare(this,t)},Nb.prototype.inspect=function(){var t="",e=Rb.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),""},Nb.prototype.compare=function(t,e,r,n,i){if(!Nb.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(e>>>=0,r>>>=0,n>>>=0,i>>>=0,this===t)return 0;for(var a=i-n,o=r-e,s=Math.min(a,o),l=this.slice(n,i),u=t.slice(e,r),c=0;c>>=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 Zb(this,t,e,r);case"utf8":case"utf-8":return Jb(this,t,e,r);case"ascii":return Kb(this,t,e,r);case"latin1":case"binary":return Qb(this,t,e,r);case"base64":return $b(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t_(this,t,e,r);default:if(a)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),a=!0}},Nb.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var n_=4096;function i_(t,e,r){var n="";r=Math.min(t.length,r);for(var i=e;in)&&(r=n);for(var i="",a=e;ar)throw new RangeError("Trying to access beyond buffer length")}function u_(t,e,r,n,i,a){if(!Nb.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function c_(t,e,r,n,i,a){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function h_(t,e,r,n,i){return e=+e,r>>>=0,i||c_(t,0,r,4),Ob.write(t,e,r,n,23,4),r+4}function f_(t,e,r,n,i){return e=+e,r>>>=0,i||c_(t,0,r,8),Ob.write(t,e,r,n,52,8),r+8}Nb.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>>=0,e>>>=0,r||l_(t,e,this.length);for(var n=this[t],i=1,a=0;++a>>=0,e>>>=0,r||l_(t,e,this.length);for(var n=this[t+--e],i=1;e>0&&(i*=256);)n+=this[t+--e]*i;return n},Nb.prototype.readUInt8=function(t,e){return t>>>=0,e||l_(t,1,this.length),this[t]},Nb.prototype.readUInt16LE=function(t,e){return t>>>=0,e||l_(t,2,this.length),this[t]|this[t+1]<<8},Nb.prototype.readUInt16BE=function(t,e){return t>>>=0,e||l_(t,2,this.length),this[t]<<8|this[t+1]},Nb.prototype.readUInt32LE=function(t,e){return t>>>=0,e||l_(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},Nb.prototype.readUInt32BE=function(t,e){return t>>>=0,e||l_(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},Nb.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||l_(t,e,this.length);for(var n=this[t],i=1,a=0;++a=(i*=128)&&(n-=Math.pow(2,8*e)),n},Nb.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||l_(t,e,this.length);for(var n=e,i=1,a=this[t+--n];n>0&&(i*=256);)a+=this[t+--n]*i;return a>=(i*=128)&&(a-=Math.pow(2,8*e)),a},Nb.prototype.readInt8=function(t,e){return t>>>=0,e||l_(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},Nb.prototype.readInt16LE=function(t,e){t>>>=0,e||l_(t,2,this.length);var r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},Nb.prototype.readInt16BE=function(t,e){t>>>=0,e||l_(t,2,this.length);var r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},Nb.prototype.readInt32LE=function(t,e){return t>>>=0,e||l_(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},Nb.prototype.readInt32BE=function(t,e){return t>>>=0,e||l_(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},Nb.prototype.readFloatLE=function(t,e){return t>>>=0,e||l_(t,4,this.length),Ob.read(this,t,!0,23,4)},Nb.prototype.readFloatBE=function(t,e){return t>>>=0,e||l_(t,4,this.length),Ob.read(this,t,!1,23,4)},Nb.prototype.readDoubleLE=function(t,e){return t>>>=0,e||l_(t,8,this.length),Ob.read(this,t,!0,52,8)},Nb.prototype.readDoubleBE=function(t,e){return t>>>=0,e||l_(t,8,this.length),Ob.read(this,t,!1,52,8)},Nb.prototype.writeUIntLE=function(t,e,r,n){(t=+t,e>>>=0,r>>>=0,n)||u_(this,t,e,r,Math.pow(2,8*r)-1,0);var i=1,a=0;for(this[e]=255&t;++a>>=0,r>>>=0,n)||u_(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},Nb.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||u_(this,t,e,1,255,0),this[e]=255&t,e+1},Nb.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||u_(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},Nb.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||u_(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},Nb.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||u_(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},Nb.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||u_(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},Nb.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);u_(this,t,e,r,i-1,-i)}var a=0,o=1,s=0;for(this[e]=255&t;++a>0)-s&255;return e+r},Nb.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){var i=Math.pow(2,8*r-1);u_(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},Nb.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||u_(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},Nb.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||u_(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},Nb.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||u_(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},Nb.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||u_(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},Nb.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||u_(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},Nb.prototype.writeFloatLE=function(t,e,r){return h_(this,t,e,!0,r)},Nb.prototype.writeFloatBE=function(t,e,r){return h_(this,t,e,!1,r)},Nb.prototype.writeDoubleLE=function(t,e,r){return f_(this,t,e,!0,r)},Nb.prototype.writeDoubleBE=function(t,e,r){return f_(this,t,e,!1,r)},Nb.prototype.copy=function(t,e,r,n){if(!Nb.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--a)t[a+e]=this[a+r];else Uint8Array.prototype.set.call(t,this.subarray(r,n),e);return i},Nb.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!Nb.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){var i=t.charCodeAt(0);("utf8"===n&&i<128||"latin1"===n)&&(t=i)}}else"number"==typeof t&&(t&=255);if(e<0||this.length>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(a=e;a55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&a.push(239,191,189);continue}if(o+1===n){(e-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&a.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&a.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;a.push(r)}else if(r<2048){if((e-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function v_(t){return Tb.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(p_,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function m_(t,e,r,n){for(var i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function y_(t){return t instanceof ArrayBuffer||null!=t&&null!=t.constructor&&"ArrayBuffer"===t.constructor.name&&"number"==typeof t.byteLength}function x_(t){return t!=t}var b_=function(t,e){switch(void 0===e&&(e=0),typeof t){case"number":if(t>0)return function(t,e){var r,n;for(r=new Array(t),n=0;n0?r.pop():new ArrayBuffer(t)}function l(t){return new Uint8Array(s(t),0,t)}function u(t){return new Uint16Array(s(2*t),0,t)}function c(t){return new Uint32Array(s(4*t),0,t)}function h(t){return new Int8Array(s(t),0,t)}function f(t){return new Int16Array(s(2*t),0,t)}function p(t){return new Int32Array(s(4*t),0,t)}function d(t){return new Float32Array(s(4*t),0,t)}function g(t){return new Float64Array(s(8*t),0,t)}function v(t){return r?new Uint8ClampedArray(s(t),0,t):l(t)}function m(t){return new DataView(s(t),0,t)}function y(t){t=Mb.nextPow2(t);var r=Mb.log2(t),n=a[r];return n.length>0?n.pop():new e(t)}__.free=function(t){if(e.isBuffer(t))a[Mb.log2(t.length)].push(t);else{if("[object ArrayBuffer]"!==Object.prototype.toString.call(t)&&(t=t.buffer),!t)return;var r=t.length||t.byteLength,n=0|Mb.log2(r);i[n].push(t)}},__.freeUint8=__.freeUint16=__.freeUint32=__.freeInt8=__.freeInt16=__.freeInt32=__.freeFloat32=__.freeFloat=__.freeFloat64=__.freeDouble=__.freeUint8Clamped=__.freeDataView=function(t){o(t.buffer)},__.freeArrayBuffer=o,__.freeBuffer=function(t){a[Mb.log2(t.length)].push(t)},__.malloc=function(t,e){if(void 0===e||"arraybuffer"===e)return s(t);switch(e){case"uint8":return l(t);case"uint16":return u(t);case"uint32":return c(t);case"int8":return h(t);case"int16":return f(t);case"int32":return p(t);case"float":case"float32":return d(t);case"double":case"float64":return g(t);case"uint8_clamped":return v(t);case"buffer":return y(t);case"data":case"dataview":return m(t);default:return null}return null},__.mallocArrayBuffer=s,__.mallocUint8=l,__.mallocUint16=u,__.mallocUint32=c,__.mallocInt8=h,__.mallocInt16=f,__.mallocInt32=p,__.mallocFloat32=__.mallocFloat=d,__.mallocFloat64=__.mallocDouble=g,__.mallocUint8Clamped=v,__.mallocDataView=m,__.mallocBuffer=y,__.clearCache=function(){for(var t=0;t<32;++t)n.UINT8[t].length=0,n.UINT16[t].length=0,n.UINT32[t].length=0,n.INT8[t].length=0,n.INT16[t].length=0,n.INT32[t].length=0,n.FLOAT[t].length=0,n.DOUBLE[t].length=0,n.UINT8C[t].length=0,i[t].length=0,a[t].length=0}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},Rb.Buffer);var w_=["uint8","uint8_clamped","uint16","uint32","int8","int16","int32","float32"];function M_(t,e,r,n,i){this.gl=t,this.type=e,this.handle=r,this.length=n,this.usage=i}var A_=M_.prototype;function k_(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 T_(t,e){for(var r=__.malloc(t.length,e),n=t.length,i=0;i=0;--n){if(e[n]!==r)return!1;r*=t[n]}return!0}(t.shape,t.stride))0===t.offset&&t.data.length===t.shape[0]?this.length=k_(this.gl,this.type,this.length,this.usage,t.data,e):this.length=k_(this.gl,this.type,this.length,this.usage,t.data.subarray(t.offset,t.shape[0]),e);else{var n=__.malloc(t.size,r),i=wb(n,t.shape);ib.assign(i,t),this.length=k_(this.gl,this.type,this.length,this.usage,e<0?n:n.subarray(0,t.size),e),__.free(n)}}else if(Array.isArray(t)){var a;a=this.type===this.gl.ELEMENT_ARRAY_BUFFER?T_(t,"uint16"):T_(t,"float32"),this.length=k_(this.gl,this.type,this.length,this.usage,e<0?a:a.subarray(0,t.length),e),__.free(a)}else if("object"==typeof t&&"number"==typeof t.length)this.length=k_(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}};var S_=function(t,e,r,n){if(r=r||t.ARRAY_BUFFER,n=n||t.DYNAMIC_DRAW,r!==t.ARRAY_BUFFER&&r!==t.ELEMENT_ARRAY_BUFFER)throw new Error("gl-buffer: Invalid type for webgl buffer, must be either gl.ARRAY_BUFFER or gl.ELEMENT_ARRAY_BUFFER");if(n!==t.DYNAMIC_DRAW&&n!==t.STATIC_DRAW&&n!==t.STREAM_DRAW)throw new Error("gl-buffer: Invalid usage for buffer, must be either gl.DYNAMIC_DRAW, gl.STATIC_DRAW or gl.STREAM_DRAW");var i=new M_(t,r,t.createBuffer(),0,n);return i.update(e),i},E_=function(t){"string"==typeof t&&(t=[t]);for(var e=[].slice.call(arguments,1),r=[],n=0;n=0){var h=u.charCodeAt(u.length-1)-48;if(h<2||h>4)throw new P_("","Invalid data type for attribute "+l+": "+u);R_(t,e,c[0],n,h,i,l)}else{if(!(u.indexOf("mat")>=0))throw new P_("","Unknown data type for attribute "+l+": "+u);var h=u.charCodeAt(u.length-1)-48;if(h<2||h>4)throw new P_("","Invalid data type for attribute "+l+": "+u);F_(t,e,c,n,h,i,l)}}}return i};function D_(t,e,r,n,i,a){this._gl=t,this._wrapper=e,this._index=r,this._locations=n,this._dimension=i,this._constFunc=a}var O_=D_.prototype;function R_(t,e,r,n,i,a,o){for(var s=["gl","v"],l=[],u=0;u1){l[0]in o||(o[l[0]]=[]),o=o[l[0]];for(var u=1;u4)throw new P_("","Invalid uniform dimension type for matrix "+Rd+": "+r);return"gl.uniformMatrix"+i+"fv(locations["+e+"],false,obj"+t+")"}throw new P_("","Unknown uniform data type for "+Rd+": "+r)}var i=r.charCodeAt(r.length-1)-48;if(i<2||i>4)throw new P_("","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 P_("","Unrecognized data type for vector "+Rd+": "+r)}}}function a(e){for(var a=["return function updateProperty(obj){"],o=function t(e,r){if("object"!=typeof r)return[[e,r]];var n=[];for(var i in r){var a=r[i],o=e;parseInt(i)+""===i?o+="["+i+"]":o+="."+i,"object"==typeof a?n.push.apply(n,t(o,a)):n.push([o,a])}return n}("",e),s=0;s4)throw new P_("","Invalid data type");return"b"===t.charAt(0)?V_(r,!1):V_(r,0)}if(0===t.indexOf("mat")&&4===t.length){var r=t.charCodeAt(t.length-1)-48;if(r<2||r>4)throw new P_("","Invalid uniform dimension type for matrix "+Rd+": "+t);return V_(r*r,0)}throw new P_("","Unknown uniform data type for "+Rd+": "+t)}}(r[l].type);var c}function s(t){var e;if(Array.isArray(t)){e=new Array(t.length);for(var r=0;r1)for(var s=0;s=r)return Y_.substr(0,r);for(;r>Y_.length&&e>1;)1&e&&(Y_+=t),e>>=1,t+=t;return Y_=(Y_+=t).substr(0,r)};var Z_=function(t,e,r){return X_(r=void 0!==r?r+"":" ",e)+t},J_=function(t,e,r){e="number"==typeof e?e:1,r=r||": ";var n=t.split(/\r?\n/),i=String(n.length+e-1).length;return n.map(function(t,n){var a=n+e,o=String(a).length,s=Z_(a,i-o);return s+r+t}).join("\n")};var K_={0:"NONE",1:"ONE",2:"LINE_LOOP",3:"LINE_STRIP",4:"TRIANGLES",5:"TRIANGLE_STRIP",6:"TRIANGLE_FAN",256:"DEPTH_BUFFER_BIT",512:"NEVER",513:"LESS",514:"EQUAL",515:"LEQUAL",516:"GREATER",517:"NOTEQUAL",518:"GEQUAL",519:"ALWAYS",768:"SRC_COLOR",769:"ONE_MINUS_SRC_COLOR",770:"SRC_ALPHA",771:"ONE_MINUS_SRC_ALPHA",772:"DST_ALPHA",773:"ONE_MINUS_DST_ALPHA",774:"DST_COLOR",775:"ONE_MINUS_DST_COLOR",776:"SRC_ALPHA_SATURATE",1024:"STENCIL_BUFFER_BIT",1028:"FRONT",1029:"BACK",1032:"FRONT_AND_BACK",1280:"INVALID_ENUM",1281:"INVALID_VALUE",1282:"INVALID_OPERATION",1285:"OUT_OF_MEMORY",1286:"INVALID_FRAMEBUFFER_OPERATION",2304:"CW",2305:"CCW",2849:"LINE_WIDTH",2884:"CULL_FACE",2885:"CULL_FACE_MODE",2886:"FRONT_FACE",2928:"DEPTH_RANGE",2929:"DEPTH_TEST",2930:"DEPTH_WRITEMASK",2931:"DEPTH_CLEAR_VALUE",2932:"DEPTH_FUNC",2960:"STENCIL_TEST",2961:"STENCIL_CLEAR_VALUE",2962:"STENCIL_FUNC",2963:"STENCIL_VALUE_MASK",2964:"STENCIL_FAIL",2965:"STENCIL_PASS_DEPTH_FAIL",2966:"STENCIL_PASS_DEPTH_PASS",2967:"STENCIL_REF",2968:"STENCIL_WRITEMASK",2978:"VIEWPORT",3024:"DITHER",3042:"BLEND",3088:"SCISSOR_BOX",3089:"SCISSOR_TEST",3106:"COLOR_CLEAR_VALUE",3107:"COLOR_WRITEMASK",3317:"UNPACK_ALIGNMENT",3333:"PACK_ALIGNMENT",3379:"MAX_TEXTURE_SIZE",3386:"MAX_VIEWPORT_DIMS",3408:"SUBPIXEL_BITS",3410:"RED_BITS",3411:"GREEN_BITS",3412:"BLUE_BITS",3413:"ALPHA_BITS",3414:"DEPTH_BITS",3415:"STENCIL_BITS",3553:"TEXTURE_2D",4352:"DONT_CARE",4353:"FASTEST",4354:"NICEST",5120:"BYTE",5121:"UNSIGNED_BYTE",5122:"SHORT",5123:"UNSIGNED_SHORT",5124:"INT",5125:"UNSIGNED_INT",5126:"FLOAT",5386:"INVERT",5890:"TEXTURE",6401:"STENCIL_INDEX",6402:"DEPTH_COMPONENT",6406:"ALPHA",6407:"RGB",6408:"RGBA",6409:"LUMINANCE",6410:"LUMINANCE_ALPHA",7680:"KEEP",7681:"REPLACE",7682:"INCR",7683:"DECR",7936:"VENDOR",7937:"RENDERER",7938:"VERSION",9728:"NEAREST",9729:"LINEAR",9984:"NEAREST_MIPMAP_NEAREST",9985:"LINEAR_MIPMAP_NEAREST",9986:"NEAREST_MIPMAP_LINEAR",9987:"LINEAR_MIPMAP_LINEAR",10240:"TEXTURE_MAG_FILTER",10241:"TEXTURE_MIN_FILTER",10242:"TEXTURE_WRAP_S",10243:"TEXTURE_WRAP_T",10497:"REPEAT",10752:"POLYGON_OFFSET_UNITS",16384:"COLOR_BUFFER_BIT",32769:"CONSTANT_COLOR",32770:"ONE_MINUS_CONSTANT_COLOR",32771:"CONSTANT_ALPHA",32772:"ONE_MINUS_CONSTANT_ALPHA",32773:"BLEND_COLOR",32774:"FUNC_ADD",32777:"BLEND_EQUATION_RGB",32778:"FUNC_SUBTRACT",32779:"FUNC_REVERSE_SUBTRACT",32819:"UNSIGNED_SHORT_4_4_4_4",32820:"UNSIGNED_SHORT_5_5_5_1",32823:"POLYGON_OFFSET_FILL",32824:"POLYGON_OFFSET_FACTOR",32854:"RGBA4",32855:"RGB5_A1",32873:"TEXTURE_BINDING_2D",32926:"SAMPLE_ALPHA_TO_COVERAGE",32928:"SAMPLE_COVERAGE",32936:"SAMPLE_BUFFERS",32937:"SAMPLES",32938:"SAMPLE_COVERAGE_VALUE",32939:"SAMPLE_COVERAGE_INVERT",32968:"BLEND_DST_RGB",32969:"BLEND_SRC_RGB",32970:"BLEND_DST_ALPHA",32971:"BLEND_SRC_ALPHA",33071:"CLAMP_TO_EDGE",33170:"GENERATE_MIPMAP_HINT",33189:"DEPTH_COMPONENT16",33306:"DEPTH_STENCIL_ATTACHMENT",33635:"UNSIGNED_SHORT_5_6_5",33648:"MIRRORED_REPEAT",33901:"ALIASED_POINT_SIZE_RANGE",33902:"ALIASED_LINE_WIDTH_RANGE",33984:"TEXTURE0",33985:"TEXTURE1",33986:"TEXTURE2",33987:"TEXTURE3",33988:"TEXTURE4",33989:"TEXTURE5",33990:"TEXTURE6",33991:"TEXTURE7",33992:"TEXTURE8",33993:"TEXTURE9",33994:"TEXTURE10",33995:"TEXTURE11",33996:"TEXTURE12",33997:"TEXTURE13",33998:"TEXTURE14",33999:"TEXTURE15",34000:"TEXTURE16",34001:"TEXTURE17",34002:"TEXTURE18",34003:"TEXTURE19",34004:"TEXTURE20",34005:"TEXTURE21",34006:"TEXTURE22",34007:"TEXTURE23",34008:"TEXTURE24",34009:"TEXTURE25",34010:"TEXTURE26",34011:"TEXTURE27",34012:"TEXTURE28",34013:"TEXTURE29",34014:"TEXTURE30",34015:"TEXTURE31",34016:"ACTIVE_TEXTURE",34024:"MAX_RENDERBUFFER_SIZE",34041:"DEPTH_STENCIL",34055:"INCR_WRAP",34056:"DECR_WRAP",34067:"TEXTURE_CUBE_MAP",34068:"TEXTURE_BINDING_CUBE_MAP",34069:"TEXTURE_CUBE_MAP_POSITIVE_X",34070:"TEXTURE_CUBE_MAP_NEGATIVE_X",34071:"TEXTURE_CUBE_MAP_POSITIVE_Y",34072:"TEXTURE_CUBE_MAP_NEGATIVE_Y",34073:"TEXTURE_CUBE_MAP_POSITIVE_Z",34074:"TEXTURE_CUBE_MAP_NEGATIVE_Z",34076:"MAX_CUBE_MAP_TEXTURE_SIZE",34338:"VERTEX_ATTRIB_ARRAY_ENABLED",34339:"VERTEX_ATTRIB_ARRAY_SIZE",34340:"VERTEX_ATTRIB_ARRAY_STRIDE",34341:"VERTEX_ATTRIB_ARRAY_TYPE",34342:"CURRENT_VERTEX_ATTRIB",34373:"VERTEX_ATTRIB_ARRAY_POINTER",34466:"NUM_COMPRESSED_TEXTURE_FORMATS",34467:"COMPRESSED_TEXTURE_FORMATS",34660:"BUFFER_SIZE",34661:"BUFFER_USAGE",34816:"STENCIL_BACK_FUNC",34817:"STENCIL_BACK_FAIL",34818:"STENCIL_BACK_PASS_DEPTH_FAIL",34819:"STENCIL_BACK_PASS_DEPTH_PASS",34877:"BLEND_EQUATION_ALPHA",34921:"MAX_VERTEX_ATTRIBS",34922:"VERTEX_ATTRIB_ARRAY_NORMALIZED",34930:"MAX_TEXTURE_IMAGE_UNITS",34962:"ARRAY_BUFFER",34963:"ELEMENT_ARRAY_BUFFER",34964:"ARRAY_BUFFER_BINDING",34965:"ELEMENT_ARRAY_BUFFER_BINDING",34975:"VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",35040:"STREAM_DRAW",35044:"STATIC_DRAW",35048:"DYNAMIC_DRAW",35632:"FRAGMENT_SHADER",35633:"VERTEX_SHADER",35660:"MAX_VERTEX_TEXTURE_IMAGE_UNITS",35661:"MAX_COMBINED_TEXTURE_IMAGE_UNITS",35663:"SHADER_TYPE",35664:"FLOAT_VEC2",35665:"FLOAT_VEC3",35666:"FLOAT_VEC4",35667:"INT_VEC2",35668:"INT_VEC3",35669:"INT_VEC4",35670:"BOOL",35671:"BOOL_VEC2",35672:"BOOL_VEC3",35673:"BOOL_VEC4",35674:"FLOAT_MAT2",35675:"FLOAT_MAT3",35676:"FLOAT_MAT4",35678:"SAMPLER_2D",35680:"SAMPLER_CUBE",35712:"DELETE_STATUS",35713:"COMPILE_STATUS",35714:"LINK_STATUS",35715:"VALIDATE_STATUS",35716:"INFO_LOG_LENGTH",35717:"ATTACHED_SHADERS",35718:"ACTIVE_UNIFORMS",35719:"ACTIVE_UNIFORM_MAX_LENGTH",35720:"SHADER_SOURCE_LENGTH",35721:"ACTIVE_ATTRIBUTES",35722:"ACTIVE_ATTRIBUTE_MAX_LENGTH",35724:"SHADING_LANGUAGE_VERSION",35725:"CURRENT_PROGRAM",36003:"STENCIL_BACK_REF",36004:"STENCIL_BACK_VALUE_MASK",36005:"STENCIL_BACK_WRITEMASK",36006:"FRAMEBUFFER_BINDING",36007:"RENDERBUFFER_BINDING",36048:"FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",36049:"FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",36050:"FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",36051:"FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",36053:"FRAMEBUFFER_COMPLETE",36054:"FRAMEBUFFER_INCOMPLETE_ATTACHMENT",36055:"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",36057:"FRAMEBUFFER_INCOMPLETE_DIMENSIONS",36061:"FRAMEBUFFER_UNSUPPORTED",36064:"COLOR_ATTACHMENT0",36096:"DEPTH_ATTACHMENT",36128:"STENCIL_ATTACHMENT",36160:"FRAMEBUFFER",36161:"RENDERBUFFER",36162:"RENDERBUFFER_WIDTH",36163:"RENDERBUFFER_HEIGHT",36164:"RENDERBUFFER_INTERNAL_FORMAT",36168:"STENCIL_INDEX8",36176:"RENDERBUFFER_RED_SIZE",36177:"RENDERBUFFER_GREEN_SIZE",36178:"RENDERBUFFER_BLUE_SIZE",36179:"RENDERBUFFER_ALPHA_SIZE",36180:"RENDERBUFFER_DEPTH_SIZE",36181:"RENDERBUFFER_STENCIL_SIZE",36194:"RGB565",36336:"LOW_FLOAT",36337:"MEDIUM_FLOAT",36338:"HIGH_FLOAT",36339:"LOW_INT",36340:"MEDIUM_INT",36341:"HIGH_INT",36346:"SHADER_COMPILER",36347:"MAX_VERTEX_UNIFORM_VECTORS",36348:"MAX_VARYING_VECTORS",36349:"MAX_FRAGMENT_UNIFORM_VECTORS",37440:"UNPACK_FLIP_Y_WEBGL",37441:"UNPACK_PREMULTIPLY_ALPHA_WEBGL",37442:"CONTEXT_LOST_WEBGL",37443:"UNPACK_COLORSPACE_CONVERSION_WEBGL",37444:"BROWSER_DEFAULT_WEBGL"},Q_=function(t){return K_[t]},$_=function(t){return atob(t)},tw=["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"],ew=(tw=tw.slice().filter(function(t){return!/^(gl\_|texture)/.test(t)})).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"]),rw=["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"],nw=rw.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"]),iw=["<<=",">>=","++","--","<<",">>","<=",">=","==","!=","&&","||","+=","-=","*=","/=","%=","&=","^^","^=","|=","(",")","[","]",".","!","~","*","/","%","+","-","<",">","&","^","|","?",":","=",",",";","{","}"],aw=function(t){var e,r,n,i=0,a=0,o=ow,s=[],l=[],u=1,c=0,h=0,f=!1,p=!1,d="",g=tw,v=rw;"300 es"===(t=t||{}).version&&(g=ew,v=nw);return function(t){return l=[],null!==t?function(t){var r;i=0,n=(d+=t).length;for(;e=d[i],i0)continue;r=t.slice(0,1).join("")}return m(r),h+=r.length,(s=s.slice(r.length)).length}}function A(){return/[^a-fA-F0-9]/.test(e)?(m(s.join("")),o=ow,i):(s.push(e),r=e,i+1)}function k(){return"."===e?(s.push(e),o=pw,r=e,i+1):/[eE]/.test(e)?(s.push(e),o=pw,r=e,i+1):"x"===e&&1===s.length&&"0"===s[0]?(o=xw,s.push(e),r=e,i+1):/[^\d]/.test(e)?(m(s.join("")),o=ow,i):(s.push(e),r=e,i+1)}function T(){return"f"===e&&(s.push(e),r=e,i+=1),/[eE]/.test(e)?(s.push(e),r=e,i+1):"-"===e&&/[eE]/.test(r)?(s.push(e),r=e,i+1):/[^\d]/.test(e)?(m(s.join("")),o=ow,i):(s.push(e),r=e,i+1)}function S(){if(/[^\d\w_]/.test(e)){var t=s.join("");return o=v.indexOf(t)>-1?vw:g.indexOf(t)>-1?gw:dw,m(s.join("")),o=ow,i}return s.push(e),r=e,i+1}},ow=999,sw=9999,lw=0,uw=1,cw=2,hw=3,fw=4,pw=5,dw=6,gw=7,vw=8,mw=9,yw=10,xw=11,bw=["block-comment","line-comment","preprocessor","operator","integer","float","ident","builtin","keyword","whitespace","eof","integer"];var _w=function(t,e){var r=aw(e),n=[];return n=(n=n.concat(r(t))).concat(r(null))};var ww=function(t){for(var e=Array.isArray(t)?t:_w(t),r=0;r=0),s[8]){case"b":i=parseInt(i,10).toString(2);break;case"c":i=String.fromCharCode(parseInt(i,10));break;case"d":case"i":i=parseInt(i,10);break;case"j":i=JSON.stringify(i,null,s[6]?parseInt(s[6]):0);break;case"e":i=s[7]?parseFloat(i).toExponential(s[7]):parseFloat(i).toExponential();break;case"f":i=s[7]?parseFloat(i).toFixed(s[7]):parseFloat(i);break;case"g":i=s[7]?String(Number(i.toPrecision(s[7]))):parseFloat(i);break;case"o":i=(parseInt(i,10)>>>0).toString(8);break;case"s":i=String(i),i=s[7]?i.substring(0,s[7]):i;break;case"t":i=String(!!i),i=s[7]?i.substring(0,s[7]):i;break;case"T":i=Object.prototype.toString.call(i).slice(8,-1).toLowerCase(),i=s[7]?i.substring(0,s[7]):i;break;case"u":i=parseInt(i,10)>>>0;break;case"v":i=i.valueOf(),i=s[7]?i.substring(0,s[7]):i;break;case"x":i=(parseInt(i,10)>>>0).toString(16);break;case"X":i=(parseInt(i,10)>>>0).toString(16).toUpperCase()}t.json.test(s[8])?g+=i:(!t.number.test(s[8])||h&&!s[3]?f="":(f=h?"+":"-",i=i.toString().replace(t.sign,"")),u=s[4]?"0"===s[4]?"0":s[4].charAt(1):" ",c=s[6]-(f+i).length,l=s[6]&&c>0?u.repeat(c):"",g+=s[5]?f+i+l:"0"===u?f+l+i:l+f+i)}return g}(function(e){if(n[e])return n[e];var r,i=e,a=[],o=0;for(;i;){if(null!==(r=t.text.exec(i)))a.push(r[0]);else if(null!==(r=t.modulo.exec(i)))a.push("%");else{if(null===(r=t.placeholder.exec(i)))throw new SyntaxError("[sprintf] unexpected placeholder");if(r[2]){o|=1;var s=[],l=r[2],u=[];if(null===(u=t.key.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(s.push(u[1]);""!==(l=l.substring(u[0].length));)if(null!==(u=t.key_access.exec(l)))s.push(u[1]);else{if(null===(u=t.index_access.exec(l)))throw new SyntaxError("[sprintf] failed to parse named argument key");s.push(u[1])}r[2]=s}else o|=2;if(3===o)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");a.push(r)}i=i.substring(r[0].length)}return n[e]=a}(r),arguments)}function r(t,r){return e.apply(null,[t].concat(r||[]))}var n=Object.create(null);void 0!==Mw&&(Mw.sprintf=e,Mw.vsprintf=r),"undefined"!=typeof window&&(window.sprintf=e,window.vsprintf=r)}();var Aw=Mw.sprintf,kw=function(t,e,r){"use strict";var n=ww(e)||"of unknown name (see npm glsl-shader-name)",i="unknown type";void 0!==r&&(i=r===Q_.FRAGMENT_SHADER?"fragment":"vertex");for(var a=Aw("Error compiling %s shader %s:\n",i,n),o=Aw("%s%s",a,t),s=t.split("\n"),l={},u=0;ur)for(t=r;te)for(t=e;t=0){for(var v=0|g.type.charAt(g.type.length-1),m=new Array(v),y=0;y=0;)x+=1;d[h]=x}var b=new Array(r.length);function _(){a.program=Ew.program(o,a._vref,a._fref,p,d);for(var t=0;t>>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 Gw(t,e,r,n){return new Function([Hw("A","x"+t+"y",e,["y"],n),Hw("P","c(x,y)"+t+"0",e,["y","c"],n),"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(""))()}qw.bind=function(){var t=this.shader;this.vbo.bind(),this.shader.bind(),t.attributes.coord.pointer(),t.uniforms.screenBox=this.plot.screenBox},qw.drawBox=(Vw=[0,0],Uw=[0,0],function(t,e,r,n,i){var a=this.plot,o=this.shader,s=a.gl;Vw[0]=t,Vw[1]=e,Uw[0]=r,Uw[1]=n,o.uniforms.lo=Vw,o.uniforms.hi=Uw,o.uniforms.color=i,s.drawArrays(s.TRIANGLE_STRIP,0,4)}),qw.dispose=function(){this.vbo.dispose(),this.shader.dispose()};var Ww={ge:Gw(">=",!1,"GE"),gt:Gw(">",!1,"GT"),lt:Gw("<",!0,"LT"),le:Gw("<=",!0,"LE"),eq:Gw("-",!0,"EQ",!0)};function Yw(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 Xw(t,e,r,n){return new Function([Yw("A","x"+t+"y",e,["y"],n),Yw("P","c(x,y)"+t+"0",e,["y","c"],n),"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(""))()}var Zw={ge:Xw(">=",!1,"GE"),gt:Xw(">",!1,"GT"),lt:Xw("<",!0,"LT"),le:Xw("<=",!0,"LE"),eq:Xw("-",!0,"EQ",!0)},Jw=function(t){var e=t.gl,r=S_(e),n=Bw(e,L_.gridVert,L_.gridFrag),i=Bw(e,L_.tickVert,L_.gridFrag);return new Kw(t,r,n,i)};function Kw(t,e,r,n){this.plot=t,this.vbo=e,this.shader=r,this.tickShader=n,this.ticks=[[],[]]}function Qw(t,e){return t-e}var $w,tM,eM,rM,nM,iM=Kw.prototype;iM.draw=($w=[0,0],tM=[0,0],eM=[0,0],function(){for(var t=this.plot,e=this.vbo,r=this.shader,n=this.ticks,i=t.gl,a=t._tickBounds,o=t.dataBox,s=t.viewBox,l=t.gridLineWidth,u=t.gridLineColor,c=t.gridLineEnable,h=t.pixelRatio,f=0;f<2;++f){var p=a[f],d=a[f+2]-p,g=.5*(o[f+2]+o[f]),v=o[f+2]-o[f];tM[f]=2*d/v,$w[f]=2*(p-g)/v}r.bind(),e.bind(),r.attributes.dataCoord.pointer(),r.uniforms.dataShift=$w,r.uniforms.dataScale=tM;var m=0;for(f=0;f<2;++f){eM[0]=eM[1]=0,eM[f]=1,r.uniforms.dataAxis=eM,r.uniforms.lineWidth=l[f]/(s[f+2]-s[f])*h,r.uniforms.color=u[f];var y=6*n[f].length;c[f]&&y&&i.drawArrays(i.TRIANGLES,m,y),m+=y}}),iM.drawTickMarks=function(){var t=[0,0],e=[0,0],r=[1,0],n=[0,1],i=[0,0],a=[0,0];return function(){for(var o=this.plot,s=this.vbo,l=this.tickShader,u=this.ticks,c=o.gl,h=o._tickBounds,f=o.dataBox,p=o.viewBox,d=o.pixelRatio,g=o.screenBox,v=g[2]-g[0],m=g[3]-g[1],y=p[2]-p[0],x=p[3]-p[1],b=0;b<2;++b){var _=h[b],w=h[b+2]-_,M=.5*(f[b+2]+f[b]),A=f[b+2]-f[b];e[b]=2*w/A,t[b]=2*(_-M)/A}e[0]*=y/v,t[0]*=y/v,e[1]*=x/m,t[1]*=x/m,l.bind(),s.bind(),l.attributes.dataCoord.pointer();var k=l.uniforms;k.dataShift=t,k.dataScale=e;var T=o.tickMarkLength,S=o.tickMarkWidth,E=o.tickMarkColor,C=6*u[0].length,L=Math.min(Zw.ge(u[0],(f[0]-h[0])/(h[2]-h[0]),Qw),u[0].length),z=Math.min(Zw.gt(u[0],(f[2]-h[0])/(h[2]-h[0]),Qw),u[0].length),P=0+6*L,I=6*Math.max(0,z-L),D=Math.min(Zw.ge(u[1],(f[1]-h[1])/(h[3]-h[1]),Qw),u[1].length),O=Math.min(Zw.gt(u[1],(f[3]-h[1])/(h[3]-h[1]),Qw),u[1].length),R=C+6*D,F=6*Math.max(0,O-D);i[0]=2*(p[0]-T[1])/v-1,i[1]=(p[3]+p[1])/m-1,a[0]=T[1]*d/v,a[1]=S[1]*d/m,F&&(k.color=E[1],k.tickScale=a,k.dataAxis=n,k.screenOffset=i,c.drawArrays(c.TRIANGLES,R,F)),i[0]=(p[2]+p[0])/v-1,i[1]=2*(p[1]-T[0])/m-1,a[0]=S[0]*d/v,a[1]=T[0]*d/m,I&&(k.color=E[0],k.tickScale=a,k.dataAxis=r,k.screenOffset=i,c.drawArrays(c.TRIANGLES,P,I)),i[0]=2*(p[2]+T[3])/v-1,i[1]=(p[3]+p[1])/m-1,a[0]=T[3]*d/v,a[1]=S[3]*d/m,F&&(k.color=E[3],k.tickScale=a,k.dataAxis=n,k.screenOffset=i,c.drawArrays(c.TRIANGLES,R,F)),i[0]=(p[2]+p[0])/v-1,i[1]=2*(p[3]+T[2])/m-1,a[0]=S[2]*d/v,a[1]=T[2]*d/m,I&&(k.color=E[2],k.tickScale=a,k.dataAxis=r,k.screenOffset=i,c.drawArrays(c.TRIANGLES,P,I))}}(),iM.update=(rM=[1,1,-1,-1,1,-1],nM=[1,-1,1,1,-1,-1],function(t){for(var e=t.ticks,r=t.bounds,n=new Float32Array(18*(e[0].length+e[1].length)),i=(this.plot.zeroLineEnable,0),a=[[],[]],o=0;o<2;++o)for(var s=a[o],l=e[o],u=r[o],c=r[o+2],h=0;h=n?(i=h,(l+=1)=n?(i=h,(l+=1)>1;return["sum(",xM(t.slice(0,e)),",",xM(t.slice(e)),")"].join("")}function bM(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 bM(e,t)}function _M(t){if(2===t.length)return[["diff(",bM(t[0][0],t[1][1]),",",bM(t[1][0],t[0][1]),")"].join("")];for(var e=[],r=0;r0;){for(var l=r.pop(),a=r.pop(),u=-1,c=-1,o=i[a],f=1;f=0||(e.flip(a,l),SM(t,e,r,u,a,c),SM(t,e,r,a,c,u),SM(t,e,r,c,l,u),SM(t,e,r,l,u,c)))}};function SM(t,e,r,n,i,a){var o=e.opposite(n,i);if(!(o<0)){if(i0||o.length>0;){for(;a.length>0;){var h=a.pop();if(s[h]!==-i){s[h]=i;l[h];for(var f=0;f<3;++f){var p=c[3*h+f];p>=0&&0===s[p]&&(u[3*h+f]?o.push(p):(a.push(p),s[p]=i))}}}var d=o;o=a,a=d,o.length=0,i=-i}var g=function(t,e,r){for(var n=0,i=0;i>1;return["sum(",OM(t.slice(0,e)),",",OM(t.slice(e)),")"].join("")}function RM(t){if(2===t.length)return[["sum(prod(",t[0][0],",",t[1][1],"),prod(-",t[0][1],",",t[1][0],"))"].join("")];for(var e=[],r=0;r0){if(a<=0)return o;n=i+a}else{if(!(i<0))return o;if(a>=0)return o;n=-(i+a)}var s=3.3306690738754716e-16*n;return o>=s||o<=-s?o:BM(t,e,r)},function(t,e,r,n){var i=t[0]-n[0],a=e[0]-n[0],o=r[0]-n[0],s=t[1]-n[1],l=e[1]-n[1],u=r[1]-n[1],c=t[2]-n[2],h=e[2]-n[2],f=r[2]-n[2],p=a*u,d=o*l,g=o*s,v=i*u,m=i*l,y=a*s,x=c*(p-d)+h*(g-v)+f*(m-y),b=7.771561172376103e-16*((Math.abs(p)+Math.abs(d))*Math.abs(c)+(Math.abs(g)+Math.abs(v))*Math.abs(h)+(Math.abs(m)+Math.abs(y))*Math.abs(f));return x>b||-x>b?x:NM(t,e,r,n)}];!function(){for(;jM.length<=IM;)jM.push(FM(jM.length));for(var t=[],e=["slow"],r=0;r<=IM;++r)t.push("a"+r),e.push("o"+r);var n=["function getOrientation(",t.join(),"){switch(arguments.length){case 0:case 1:return 0;"];for(r=2;r<=IM;++r)n.push("case ",r,":return o",r,"(",t.slice(0,r).join(),");");n.push("}var s=new Array(arguments.length);for(var i=0;il[0]&&i.push(new YM(l,s,HM,a),new YM(s,l,qM,a))}i.sort(XM);for(var u=i[0].a[0]-(1+Math.abs(i[0].a[0]))*Math.pow(2,-52),c=[new WM([u,1],[u,0],-1,[],[],[],[])],h=[],a=0,f=i.length;a1&&VM(r[u[c-2]],r[u[c-1]],n)>0;)t.push([u[c-1],u[c-2],i]),c-=1;u.length=c,u.push(i);var h=l.upperIds;for(c=h.length;c>1&&VM(r[h[c-2]],r[h[c-1]],n)<0;)t.push([h[c-2],h[c-1],i]),c-=1;h.length=c,h.push(i)}}function KM(t,e){var r;return(r=t.a[0]=0}}(),rA.removeTriangle=function(t,e,r){var n=this.stars;nA(n[t],e,r),nA(n[e],r,t),nA(n[r],t,e)},rA.addTriangle=function(t,e,r){var n=this.stars;n[t].push(e,r),n[e].push(r,t),n[r].push(t,e)},rA.opposite=function(t,e){for(var r=this.stars[e],n=1,i=r.length;n=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=49?s-49+10:s>=17?s-17+10:s}return i}i.isBN=function(t){return t instanceof i||null!==t&&"object"==typeof t&&t.constructor.wordSize===i.wordSize&&Array.isArray(t.words)},i.max=function(t,e){return t.cmp(e)>0?t:e},i.min=function(t,e){return t.cmp(e)<0?t:e},i.prototype._init=function(t,e,n){if("number"==typeof t)return this._initNumber(t,e,n);if("object"==typeof t)return this._initArray(t,e,n);"hex"===e&&(e=16),r(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"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initNumber=function(t,e,n){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):(r(t<9007199254740992),this.words=[67108863&t,t/67108864&67108863,1],this.length=3),"le"===n&&this._initArray(this.toArray(),e,n)},i.prototype._initArray=function(t,e,n){if(r("number"==typeof t.length),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var i=0;i=0;i-=3)o=t[i]|t[i-1]<<8|t[i-2]<<16,this.words[a]|=o<>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);else if("le"===n)for(i=0,a=0;i>>26-s&67108863,(s+=24)>=26&&(s-=26,a++);return this.strip()},i.prototype._parseHex=function(t,e){this.length=Math.ceil((t.length-e)/6),this.words=new Array(this.length);for(var r=0;r=e;r-=6)i=o(t,r,r+6),this.words[n]|=i<>>26-a&4194303,(a+=24)>=26&&(a-=26,n++);r+6!==e&&(i=o(t,e,r+6),this.words[n]|=i<>>26-a&4194303),this.strip()},i.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,u=0,c=r;c1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var l=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],u=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],c=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function h(t,e,r){r.negative=e.negative^t.negative;var n=t.length+e.length|0;r.length=n,n=n-1|0;var i=0|t.words[0],a=0|e.words[0],o=i*a,s=67108863&o,l=o/67108864|0;r.words[0]=s;for(var u=1;u>>26,h=67108863&l,f=Math.min(u,e.length-1),p=Math.max(0,u-t.length+1);p<=f;p++){var d=u-p|0;c+=(o=(i=0|t.words[d])*(a=0|e.words[p])+h)/67108864|0,h=67108863&o}r.words[u]=0|h,l=0|c}return 0!==l?r.words[u]=0|l:r.length--,r.strip()}i.prototype.toString=function(t,e){var n;if(t=t||10,e=0|e||1,16===t||"hex"===t){n="";for(var i=0,a=0,o=0;o>>24-i&16777215)||o!==this.length-1?l[6-h.length]+h+n:h+n,(i+=2)>=26&&(i-=26,o--)}for(0!==a&&(n=a.toString(16)+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}if(t===(0|t)&&t>=2&&t<=36){var f=u[t],p=c[t];n="";var d=this.clone();for(d.negative=0;!d.isZero();){var g=d.modn(p).toString(t);n=(d=d.idivn(p)).isZero()?g+n:l[f-g.length]+g+n}for(this.isZero()&&(n="0"+n);n.length%e!=0;)n="0"+n;return 0!==this.negative&&(n="-"+n),n}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var t=this.words[0];return 2===this.length?t+=67108864*this.words[1]:3===this.length&&1===this.words[2]?t+=4503599627370496+67108864*this.words[1]:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-t:t},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(t,e){return r(void 0!==a),this.toArrayLike(a,t,e)},i.prototype.toArray=function(t,e){return this.toArrayLike(Array,t,e)},i.prototype.toArrayLike=function(t,e,n){var i=this.byteLength(),a=n||Math.max(1,i);r(i<=a,"byte array longer than desired length"),r(a>0,"Requested array length <= 0"),this.strip();var o,s,l="le"===e,u=new t(a),c=this.clone();if(l){for(s=0;!c.isZero();s++)o=c.andln(255),c.iushrn(8),u[s]=o;for(;s=4096&&(r+=13,e>>>=13),e>=64&&(r+=7,e>>>=7),e>=8&&(r+=4,e>>>=4),e>=2&&(r+=2,e>>>=2),r+e},i.prototype._zeroBits=function(t){if(0===t)return 26;var e=t,r=0;return 0==(8191&e)&&(r+=13,e>>>=13),0==(127&e)&&(r+=7,e>>>=7),0==(15&e)&&(r+=4,e>>>=4),0==(3&e)&&(r+=2,e>>>=2),0==(1&e)&&r++,r},i.prototype.bitLength=function(){var t=this.words[this.length-1],e=this._countBits(t);return 26*(this.length-1)+e},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,e=0;et.length?this.clone().ior(t):t.clone().ior(this)},i.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},i.prototype.iuand=function(t){var e;e=this.length>t.length?t:this;for(var r=0;rt.length?this.clone().iand(t):t.clone().iand(this)},i.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},i.prototype.iuxor=function(t){var e,r;this.length>t.length?(e=this,r=t):(e=t,r=this);for(var n=0;nt.length?this.clone().ixor(t):t.clone().ixor(this)},i.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},i.prototype.inotn=function(t){r("number"==typeof t&&t>=0);var e=0|Math.ceil(t/26),n=t%26;this._expand(e),n>0&&e--;for(var i=0;i0&&(this.words[i]=~this.words[i]&67108863>>26-n),this.strip()},i.prototype.notn=function(t){return this.clone().inotn(t)},i.prototype.setn=function(t,e){r("number"==typeof t&&t>=0);var n=t/26|0,i=t%26;return this._expand(n+1),this.words[n]=e?this.words[n]|1<t.length?(r=this,n=t):(r=t,n=this);for(var i=0,a=0;a>>26;for(;0!==i&&a>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;at.length?this.clone().iadd(t):t.clone().iadd(this)},i.prototype.isub=function(t){if(0!==t.negative){t.negative=0;var e=this.iadd(t);return t.negative=1,e._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var r,n,i=this.cmp(t);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(r=this,n=t):(r=t,n=this);for(var a=0,o=0;o>26,this.words[o]=67108863&e;for(;0!==a&&o>26,this.words[o]=67108863&e;if(0===a&&o>>13,p=0|o[1],d=8191&p,g=p>>>13,v=0|o[2],m=8191&v,y=v>>>13,x=0|o[3],b=8191&x,_=x>>>13,w=0|o[4],M=8191&w,A=w>>>13,k=0|o[5],T=8191&k,S=k>>>13,E=0|o[6],C=8191&E,L=E>>>13,z=0|o[7],P=8191&z,I=z>>>13,D=0|o[8],O=8191&D,R=D>>>13,F=0|o[9],B=8191&F,N=F>>>13,j=0|s[0],V=8191&j,U=j>>>13,q=0|s[1],H=8191&q,G=q>>>13,W=0|s[2],Y=8191&W,X=W>>>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,ut=st>>>13,ct=0|s[8],ht=8191&ct,ft=ct>>>13,pt=0|s[9],dt=8191&pt,gt=pt>>>13;r.negative=t.negative^e.negative,r.length=19;var vt=(u+(n=Math.imul(h,V))|0)+((8191&(i=(i=Math.imul(h,U))+Math.imul(f,V)|0))<<13)|0;u=((a=Math.imul(f,U))+(i>>>13)|0)+(vt>>>26)|0,vt&=67108863,n=Math.imul(d,V),i=(i=Math.imul(d,U))+Math.imul(g,V)|0,a=Math.imul(g,U);var mt=(u+(n=n+Math.imul(h,H)|0)|0)+((8191&(i=(i=i+Math.imul(h,G)|0)+Math.imul(f,H)|0))<<13)|0;u=((a=a+Math.imul(f,G)|0)+(i>>>13)|0)+(mt>>>26)|0,mt&=67108863,n=Math.imul(m,V),i=(i=Math.imul(m,U))+Math.imul(y,V)|0,a=Math.imul(y,U),n=n+Math.imul(d,H)|0,i=(i=i+Math.imul(d,G)|0)+Math.imul(g,H)|0,a=a+Math.imul(g,G)|0;var yt=(u+(n=n+Math.imul(h,Y)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(f,Y)|0))<<13)|0;u=((a=a+Math.imul(f,X)|0)+(i>>>13)|0)+(yt>>>26)|0,yt&=67108863,n=Math.imul(b,V),i=(i=Math.imul(b,U))+Math.imul(_,V)|0,a=Math.imul(_,U),n=n+Math.imul(m,H)|0,i=(i=i+Math.imul(m,G)|0)+Math.imul(y,H)|0,a=a+Math.imul(y,G)|0,n=n+Math.imul(d,Y)|0,i=(i=i+Math.imul(d,X)|0)+Math.imul(g,Y)|0,a=a+Math.imul(g,X)|0;var xt=(u+(n=n+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,K)|0)+Math.imul(f,J)|0))<<13)|0;u=((a=a+Math.imul(f,K)|0)+(i>>>13)|0)+(xt>>>26)|0,xt&=67108863,n=Math.imul(M,V),i=(i=Math.imul(M,U))+Math.imul(A,V)|0,a=Math.imul(A,U),n=n+Math.imul(b,H)|0,i=(i=i+Math.imul(b,G)|0)+Math.imul(_,H)|0,a=a+Math.imul(_,G)|0,n=n+Math.imul(m,Y)|0,i=(i=i+Math.imul(m,X)|0)+Math.imul(y,Y)|0,a=a+Math.imul(y,X)|0,n=n+Math.imul(d,J)|0,i=(i=i+Math.imul(d,K)|0)+Math.imul(g,J)|0,a=a+Math.imul(g,K)|0;var bt=(u+(n=n+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,tt)|0)+Math.imul(f,$)|0))<<13)|0;u=((a=a+Math.imul(f,tt)|0)+(i>>>13)|0)+(bt>>>26)|0,bt&=67108863,n=Math.imul(T,V),i=(i=Math.imul(T,U))+Math.imul(S,V)|0,a=Math.imul(S,U),n=n+Math.imul(M,H)|0,i=(i=i+Math.imul(M,G)|0)+Math.imul(A,H)|0,a=a+Math.imul(A,G)|0,n=n+Math.imul(b,Y)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(_,Y)|0,a=a+Math.imul(_,X)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,K)|0)+Math.imul(y,J)|0,a=a+Math.imul(y,K)|0,n=n+Math.imul(d,$)|0,i=(i=i+Math.imul(d,tt)|0)+Math.imul(g,$)|0,a=a+Math.imul(g,tt)|0;var _t=(u+(n=n+Math.imul(h,rt)|0)|0)+((8191&(i=(i=i+Math.imul(h,nt)|0)+Math.imul(f,rt)|0))<<13)|0;u=((a=a+Math.imul(f,nt)|0)+(i>>>13)|0)+(_t>>>26)|0,_t&=67108863,n=Math.imul(C,V),i=(i=Math.imul(C,U))+Math.imul(L,V)|0,a=Math.imul(L,U),n=n+Math.imul(T,H)|0,i=(i=i+Math.imul(T,G)|0)+Math.imul(S,H)|0,a=a+Math.imul(S,G)|0,n=n+Math.imul(M,Y)|0,i=(i=i+Math.imul(M,X)|0)+Math.imul(A,Y)|0,a=a+Math.imul(A,X)|0,n=n+Math.imul(b,J)|0,i=(i=i+Math.imul(b,K)|0)+Math.imul(_,J)|0,a=a+Math.imul(_,K)|0,n=n+Math.imul(m,$)|0,i=(i=i+Math.imul(m,tt)|0)+Math.imul(y,$)|0,a=a+Math.imul(y,tt)|0,n=n+Math.imul(d,rt)|0,i=(i=i+Math.imul(d,nt)|0)+Math.imul(g,rt)|0,a=a+Math.imul(g,nt)|0;var wt=(u+(n=n+Math.imul(h,at)|0)|0)+((8191&(i=(i=i+Math.imul(h,ot)|0)+Math.imul(f,at)|0))<<13)|0;u=((a=a+Math.imul(f,ot)|0)+(i>>>13)|0)+(wt>>>26)|0,wt&=67108863,n=Math.imul(P,V),i=(i=Math.imul(P,U))+Math.imul(I,V)|0,a=Math.imul(I,U),n=n+Math.imul(C,H)|0,i=(i=i+Math.imul(C,G)|0)+Math.imul(L,H)|0,a=a+Math.imul(L,G)|0,n=n+Math.imul(T,Y)|0,i=(i=i+Math.imul(T,X)|0)+Math.imul(S,Y)|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(A,J)|0,a=a+Math.imul(A,K)|0,n=n+Math.imul(b,$)|0,i=(i=i+Math.imul(b,tt)|0)+Math.imul(_,$)|0,a=a+Math.imul(_,tt)|0,n=n+Math.imul(m,rt)|0,i=(i=i+Math.imul(m,nt)|0)+Math.imul(y,rt)|0,a=a+Math.imul(y,nt)|0,n=n+Math.imul(d,at)|0,i=(i=i+Math.imul(d,ot)|0)+Math.imul(g,at)|0,a=a+Math.imul(g,ot)|0;var Mt=(u+(n=n+Math.imul(h,lt)|0)|0)+((8191&(i=(i=i+Math.imul(h,ut)|0)+Math.imul(f,lt)|0))<<13)|0;u=((a=a+Math.imul(f,ut)|0)+(i>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,n=Math.imul(O,V),i=(i=Math.imul(O,U))+Math.imul(R,V)|0,a=Math.imul(R,U),n=n+Math.imul(P,H)|0,i=(i=i+Math.imul(P,G)|0)+Math.imul(I,H)|0,a=a+Math.imul(I,G)|0,n=n+Math.imul(C,Y)|0,i=(i=i+Math.imul(C,X)|0)+Math.imul(L,Y)|0,a=a+Math.imul(L,X)|0,n=n+Math.imul(T,J)|0,i=(i=i+Math.imul(T,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(A,$)|0,a=a+Math.imul(A,tt)|0,n=n+Math.imul(b,rt)|0,i=(i=i+Math.imul(b,nt)|0)+Math.imul(_,rt)|0,a=a+Math.imul(_,nt)|0,n=n+Math.imul(m,at)|0,i=(i=i+Math.imul(m,ot)|0)+Math.imul(y,at)|0,a=a+Math.imul(y,ot)|0,n=n+Math.imul(d,lt)|0,i=(i=i+Math.imul(d,ut)|0)+Math.imul(g,lt)|0,a=a+Math.imul(g,ut)|0;var At=(u+(n=n+Math.imul(h,ht)|0)|0)+((8191&(i=(i=i+Math.imul(h,ft)|0)+Math.imul(f,ht)|0))<<13)|0;u=((a=a+Math.imul(f,ft)|0)+(i>>>13)|0)+(At>>>26)|0,At&=67108863,n=Math.imul(B,V),i=(i=Math.imul(B,U))+Math.imul(N,V)|0,a=Math.imul(N,U),n=n+Math.imul(O,H)|0,i=(i=i+Math.imul(O,G)|0)+Math.imul(R,H)|0,a=a+Math.imul(R,G)|0,n=n+Math.imul(P,Y)|0,i=(i=i+Math.imul(P,X)|0)+Math.imul(I,Y)|0,a=a+Math.imul(I,X)|0,n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(L,J)|0,a=a+Math.imul(L,K)|0,n=n+Math.imul(T,$)|0,i=(i=i+Math.imul(T,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(A,rt)|0,a=a+Math.imul(A,nt)|0,n=n+Math.imul(b,at)|0,i=(i=i+Math.imul(b,ot)|0)+Math.imul(_,at)|0,a=a+Math.imul(_,ot)|0,n=n+Math.imul(m,lt)|0,i=(i=i+Math.imul(m,ut)|0)+Math.imul(y,lt)|0,a=a+Math.imul(y,ut)|0,n=n+Math.imul(d,ht)|0,i=(i=i+Math.imul(d,ft)|0)+Math.imul(g,ht)|0,a=a+Math.imul(g,ft)|0;var kt=(u+(n=n+Math.imul(h,dt)|0)|0)+((8191&(i=(i=i+Math.imul(h,gt)|0)+Math.imul(f,dt)|0))<<13)|0;u=((a=a+Math.imul(f,gt)|0)+(i>>>13)|0)+(kt>>>26)|0,kt&=67108863,n=Math.imul(B,H),i=(i=Math.imul(B,G))+Math.imul(N,H)|0,a=Math.imul(N,G),n=n+Math.imul(O,Y)|0,i=(i=i+Math.imul(O,X)|0)+Math.imul(R,Y)|0,a=a+Math.imul(R,X)|0,n=n+Math.imul(P,J)|0,i=(i=i+Math.imul(P,K)|0)+Math.imul(I,J)|0,a=a+Math.imul(I,K)|0,n=n+Math.imul(C,$)|0,i=(i=i+Math.imul(C,tt)|0)+Math.imul(L,$)|0,a=a+Math.imul(L,tt)|0,n=n+Math.imul(T,rt)|0,i=(i=i+Math.imul(T,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(A,at)|0,a=a+Math.imul(A,ot)|0,n=n+Math.imul(b,lt)|0,i=(i=i+Math.imul(b,ut)|0)+Math.imul(_,lt)|0,a=a+Math.imul(_,ut)|0,n=n+Math.imul(m,ht)|0,i=(i=i+Math.imul(m,ft)|0)+Math.imul(y,ht)|0,a=a+Math.imul(y,ft)|0;var Tt=(u+(n=n+Math.imul(d,dt)|0)|0)+((8191&(i=(i=i+Math.imul(d,gt)|0)+Math.imul(g,dt)|0))<<13)|0;u=((a=a+Math.imul(g,gt)|0)+(i>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,n=Math.imul(B,Y),i=(i=Math.imul(B,X))+Math.imul(N,Y)|0,a=Math.imul(N,X),n=n+Math.imul(O,J)|0,i=(i=i+Math.imul(O,K)|0)+Math.imul(R,J)|0,a=a+Math.imul(R,K)|0,n=n+Math.imul(P,$)|0,i=(i=i+Math.imul(P,tt)|0)+Math.imul(I,$)|0,a=a+Math.imul(I,tt)|0,n=n+Math.imul(C,rt)|0,i=(i=i+Math.imul(C,nt)|0)+Math.imul(L,rt)|0,a=a+Math.imul(L,nt)|0,n=n+Math.imul(T,at)|0,i=(i=i+Math.imul(T,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,ut)|0)+Math.imul(A,lt)|0,a=a+Math.imul(A,ut)|0,n=n+Math.imul(b,ht)|0,i=(i=i+Math.imul(b,ft)|0)+Math.imul(_,ht)|0,a=a+Math.imul(_,ft)|0;var St=(u+(n=n+Math.imul(m,dt)|0)|0)+((8191&(i=(i=i+Math.imul(m,gt)|0)+Math.imul(y,dt)|0))<<13)|0;u=((a=a+Math.imul(y,gt)|0)+(i>>>13)|0)+(St>>>26)|0,St&=67108863,n=Math.imul(B,J),i=(i=Math.imul(B,K))+Math.imul(N,J)|0,a=Math.imul(N,K),n=n+Math.imul(O,$)|0,i=(i=i+Math.imul(O,tt)|0)+Math.imul(R,$)|0,a=a+Math.imul(R,tt)|0,n=n+Math.imul(P,rt)|0,i=(i=i+Math.imul(P,nt)|0)+Math.imul(I,rt)|0,a=a+Math.imul(I,nt)|0,n=n+Math.imul(C,at)|0,i=(i=i+Math.imul(C,ot)|0)+Math.imul(L,at)|0,a=a+Math.imul(L,ot)|0,n=n+Math.imul(T,lt)|0,i=(i=i+Math.imul(T,ut)|0)+Math.imul(S,lt)|0,a=a+Math.imul(S,ut)|0,n=n+Math.imul(M,ht)|0,i=(i=i+Math.imul(M,ft)|0)+Math.imul(A,ht)|0,a=a+Math.imul(A,ft)|0;var Et=(u+(n=n+Math.imul(b,dt)|0)|0)+((8191&(i=(i=i+Math.imul(b,gt)|0)+Math.imul(_,dt)|0))<<13)|0;u=((a=a+Math.imul(_,gt)|0)+(i>>>13)|0)+(Et>>>26)|0,Et&=67108863,n=Math.imul(B,$),i=(i=Math.imul(B,tt))+Math.imul(N,$)|0,a=Math.imul(N,tt),n=n+Math.imul(O,rt)|0,i=(i=i+Math.imul(O,nt)|0)+Math.imul(R,rt)|0,a=a+Math.imul(R,nt)|0,n=n+Math.imul(P,at)|0,i=(i=i+Math.imul(P,ot)|0)+Math.imul(I,at)|0,a=a+Math.imul(I,ot)|0,n=n+Math.imul(C,lt)|0,i=(i=i+Math.imul(C,ut)|0)+Math.imul(L,lt)|0,a=a+Math.imul(L,ut)|0,n=n+Math.imul(T,ht)|0,i=(i=i+Math.imul(T,ft)|0)+Math.imul(S,ht)|0,a=a+Math.imul(S,ft)|0;var Ct=(u+(n=n+Math.imul(M,dt)|0)|0)+((8191&(i=(i=i+Math.imul(M,gt)|0)+Math.imul(A,dt)|0))<<13)|0;u=((a=a+Math.imul(A,gt)|0)+(i>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,n=Math.imul(B,rt),i=(i=Math.imul(B,nt))+Math.imul(N,rt)|0,a=Math.imul(N,nt),n=n+Math.imul(O,at)|0,i=(i=i+Math.imul(O,ot)|0)+Math.imul(R,at)|0,a=a+Math.imul(R,ot)|0,n=n+Math.imul(P,lt)|0,i=(i=i+Math.imul(P,ut)|0)+Math.imul(I,lt)|0,a=a+Math.imul(I,ut)|0,n=n+Math.imul(C,ht)|0,i=(i=i+Math.imul(C,ft)|0)+Math.imul(L,ht)|0,a=a+Math.imul(L,ft)|0;var Lt=(u+(n=n+Math.imul(T,dt)|0)|0)+((8191&(i=(i=i+Math.imul(T,gt)|0)+Math.imul(S,dt)|0))<<13)|0;u=((a=a+Math.imul(S,gt)|0)+(i>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,n=Math.imul(B,at),i=(i=Math.imul(B,ot))+Math.imul(N,at)|0,a=Math.imul(N,ot),n=n+Math.imul(O,lt)|0,i=(i=i+Math.imul(O,ut)|0)+Math.imul(R,lt)|0,a=a+Math.imul(R,ut)|0,n=n+Math.imul(P,ht)|0,i=(i=i+Math.imul(P,ft)|0)+Math.imul(I,ht)|0,a=a+Math.imul(I,ft)|0;var zt=(u+(n=n+Math.imul(C,dt)|0)|0)+((8191&(i=(i=i+Math.imul(C,gt)|0)+Math.imul(L,dt)|0))<<13)|0;u=((a=a+Math.imul(L,gt)|0)+(i>>>13)|0)+(zt>>>26)|0,zt&=67108863,n=Math.imul(B,lt),i=(i=Math.imul(B,ut))+Math.imul(N,lt)|0,a=Math.imul(N,ut),n=n+Math.imul(O,ht)|0,i=(i=i+Math.imul(O,ft)|0)+Math.imul(R,ht)|0,a=a+Math.imul(R,ft)|0;var Pt=(u+(n=n+Math.imul(P,dt)|0)|0)+((8191&(i=(i=i+Math.imul(P,gt)|0)+Math.imul(I,dt)|0))<<13)|0;u=((a=a+Math.imul(I,gt)|0)+(i>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,n=Math.imul(B,ht),i=(i=Math.imul(B,ft))+Math.imul(N,ht)|0,a=Math.imul(N,ft);var It=(u+(n=n+Math.imul(O,dt)|0)|0)+((8191&(i=(i=i+Math.imul(O,gt)|0)+Math.imul(R,dt)|0))<<13)|0;u=((a=a+Math.imul(R,gt)|0)+(i>>>13)|0)+(It>>>26)|0,It&=67108863;var Dt=(u+(n=Math.imul(B,dt))|0)+((8191&(i=(i=Math.imul(B,gt))+Math.imul(N,dt)|0))<<13)|0;return u=((a=Math.imul(N,gt))+(i>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,l[0]=vt,l[1]=mt,l[2]=yt,l[3]=xt,l[4]=bt,l[5]=_t,l[6]=wt,l[7]=Mt,l[8]=At,l[9]=kt,l[10]=Tt,l[11]=St,l[12]=Et,l[13]=Ct,l[14]=Lt,l[15]=zt,l[16]=Pt,l[17]=It,l[18]=Dt,0!==u&&(l[19]=u,r.length++),r};function p(t,e,r){return(new d).mulp(t,e,r)}function d(t,e){this.x=t,this.y=e}Math.imul||(f=h),i.prototype.mulTo=function(t,e){var r=this.length+t.length;return 10===this.length&&10===t.length?f(this,t,e):r<63?h(this,t,e):r<1024?function(t,e,r){r.negative=e.negative^t.negative,r.length=t.length+e.length;for(var n=0,i=0,a=0;a>>26)|0)>>>26,o&=67108863}r.words[a]=s,n=o,o=i}return 0!==n?r.words[a]=n:r.length--,r.strip()}(this,t,e):p(this,t,e)},d.prototype.makeRBT=function(t){for(var e=new Array(t),r=i.prototype._countBits(t)-1,n=0;n>=1;return n},d.prototype.permute=function(t,e,r,n,i,a){for(var o=0;o>>=1)i++;return 1<>>=13,n[2*o+1]=8191&a,a>>>=13;for(o=2*e;o>=26,e+=i/67108864|0,e+=a>>>26,this.words[n]=67108863&a}return 0!==e&&(this.words[n]=e,this.length++),this},i.prototype.muln=function(t){return this.clone().imuln(t)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(t){var e=function(t){for(var e=new Array(t.bitLength()),r=0;r>>i}return e}(t);if(0===e.length)return new i(1);for(var r=this,n=0;n=0);var e,n=t%26,i=(t-n)/26,a=67108863>>>26-n<<26-n;if(0!==n){var o=0;for(e=0;e>>26-n}o&&(this.words[e]=o,this.length++)}if(0!==i){for(e=this.length-1;e>=0;e--)this.words[e+i]=this.words[e];for(e=0;e=0),i=e?(e-e%26)/26:0;var a=t%26,o=Math.min((t-a)/26,this.length),s=67108863^67108863>>>a<o)for(this.length-=o,u=0;u=0&&(0!==c||u>=i);u--){var h=0|this.words[u];this.words[u]=c<<26-a|h>>>a,c=h&s}return l&&0!==c&&(l.words[l.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(t,e,n){return r(0===this.negative),this.iushrn(t,e,n)},i.prototype.shln=function(t){return this.clone().ishln(t)},i.prototype.ushln=function(t){return this.clone().iushln(t)},i.prototype.shrn=function(t){return this.clone().ishrn(t)},i.prototype.ushrn=function(t){return this.clone().iushrn(t)},i.prototype.testn=function(t){r("number"==typeof t&&t>=0);var e=t%26,n=(t-e)/26,i=1<=0);var e=t%26,n=(t-e)/26;if(r(0===this.negative,"imaskn works only with positive numbers"),this.length<=n)return this;if(0!==e&&n++,this.length=Math.min(n,this.length),0!==e){var i=67108863^67108863>>>e<=67108864;e++)this.words[e]-=67108864,e===this.length-1?this.words[e+1]=1:this.words[e+1]++;return this.length=Math.max(this.length,e+1),this},i.prototype.isubn=function(t){if(r("number"==typeof t),r(t<67108864),t<0)return this.iaddn(-t);if(0!==this.negative)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var e=0;e>26)-(l/67108864|0),this.words[i+n]=67108863&a}for(;i>26,this.words[i+n]=67108863&a;if(0===s)return this.strip();for(r(-1===s),s=0,i=0;i>26,this.words[i]=67108863&a;return this.negative=1,this.strip()},i.prototype._wordDiv=function(t,e){var r=(this.length,t.length),n=this.clone(),a=t,o=0|a.words[a.length-1];0!==(r=26-this._countBits(o))&&(a=a.ushln(r),n.iushln(r),o=0|a.words[a.length-1]);var s,l=n.length-a.length;if("mod"!==e){(s=new i(null)).length=l+1,s.words=new Array(s.length);for(var u=0;u=0;h--){var f=67108864*(0|n.words[a.length+h])+(0|n.words[a.length+h-1]);for(f=Math.min(f/o|0,67108863),n._ishlnsubmul(a,f,h);0!==n.negative;)f--,n.negative=0,n._ishlnsubmul(a,1,h),n.isZero()||(n.negative^=1);s&&(s.words[h]=f)}return s&&s.strip(),n.strip(),"div"!==e&&0!==r&&n.iushrn(r),{div:s||null,mod:n}},i.prototype.divmod=function(t,e,n){return r(!t.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===t.negative?(s=this.neg().divmod(t,e),"mod"!==e&&(a=s.div.neg()),"div"!==e&&(o=s.mod.neg(),n&&0!==o.negative&&o.iadd(t)),{div:a,mod:o}):0===this.negative&&0!==t.negative?(s=this.divmod(t.neg(),e),"mod"!==e&&(a=s.div.neg()),{div:a,mod:s.mod}):0!=(this.negative&t.negative)?(s=this.neg().divmod(t.neg(),e),"div"!==e&&(o=s.mod.neg(),n&&0!==o.negative&&o.isub(t)),{div:s.div,mod:o}):t.length>this.length||this.cmp(t)<0?{div:new i(0),mod:this}:1===t.length?"div"===e?{div:this.divn(t.words[0]),mod:null}:"mod"===e?{div:null,mod:new i(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new i(this.modn(t.words[0]))}:this._wordDiv(t,e);var a,o,s},i.prototype.div=function(t){return this.divmod(t,"div",!1).div},i.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},i.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},i.prototype.divRound=function(t){var e=this.divmod(t);if(e.mod.isZero())return e.div;var r=0!==e.div.negative?e.mod.isub(t):e.mod,n=t.ushrn(1),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)},i.prototype.modn=function(t){r(t<=67108863);for(var e=(1<<26)%t,n=0,i=this.length-1;i>=0;i--)n=(e*n+(0|this.words[i]))%t;return n},i.prototype.idivn=function(t){r(t<=67108863);for(var e=0,n=this.length-1;n>=0;n--){var i=(0|this.words[n])+67108864*e;this.words[n]=i/t|0,e=i%t}return this.strip()},i.prototype.divn=function(t){return this.clone().idivn(t)},i.prototype.egcd=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a=new i(1),o=new i(0),s=new i(0),l=new i(1),u=0;e.isEven()&&n.isEven();)e.iushrn(1),n.iushrn(1),++u;for(var c=n.clone(),h=e.clone();!e.isZero();){for(var f=0,p=1;0==(e.words[0]&p)&&f<26;++f,p<<=1);if(f>0)for(e.iushrn(f);f-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(c),o.isub(h)),a.iushrn(1),o.iushrn(1);for(var d=0,g=1;0==(n.words[0]&g)&&d<26;++d,g<<=1);if(d>0)for(n.iushrn(d);d-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(c),l.isub(h)),s.iushrn(1),l.iushrn(1);e.cmp(n)>=0?(e.isub(n),a.isub(s),o.isub(l)):(n.isub(e),s.isub(a),l.isub(o))}return{a:s,b:l,gcd:n.iushln(u)}},i.prototype._invmp=function(t){r(0===t.negative),r(!t.isZero());var e=this,n=t.clone();e=0!==e.negative?e.umod(t):e.clone();for(var a,o=new i(1),s=new i(0),l=n.clone();e.cmpn(1)>0&&n.cmpn(1)>0;){for(var u=0,c=1;0==(e.words[0]&c)&&u<26;++u,c<<=1);if(u>0)for(e.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var h=0,f=1;0==(n.words[0]&f)&&h<26;++h,f<<=1);if(h>0)for(n.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(l),s.iushrn(1);e.cmp(n)>=0?(e.isub(n),o.isub(s)):(n.isub(e),s.isub(o))}return(a=0===e.cmpn(1)?o:s).cmpn(0)<0&&a.iadd(t),a},i.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var e=this.clone(),r=t.clone();e.negative=0,r.negative=0;for(var n=0;e.isEven()&&r.isEven();n++)e.iushrn(1),r.iushrn(1);for(;;){for(;e.isEven();)e.iushrn(1);for(;r.isEven();)r.iushrn(1);var 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)},i.prototype.invm=function(t){return this.egcd(t).a.umod(t)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(t){return this.words[0]&t},i.prototype.bincn=function(t){r("number"==typeof t);var e=t%26,n=(t-e)/26,i=1<>>26,s&=67108863,this.words[o]=s}return 0!==a&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(t){var e,n=t<0;if(0!==this.negative&&!n)return-1;if(0===this.negative&&n)return 1;if(this.strip(),this.length>1)e=1;else{n&&(t=-t),r(t<=67108863,"Number is too big");var i=0|this.words[0];e=i===t?0:it.length)return 1;if(this.length=0;r--){var n=0|this.words[r],i=0|t.words[r];if(n!==i){ni&&(e=1);break}}return e},i.prototype.gtn=function(t){return 1===this.cmpn(t)},i.prototype.gt=function(t){return 1===this.cmp(t)},i.prototype.gten=function(t){return this.cmpn(t)>=0},i.prototype.gte=function(t){return this.cmp(t)>=0},i.prototype.ltn=function(t){return-1===this.cmpn(t)},i.prototype.lt=function(t){return-1===this.cmp(t)},i.prototype.lten=function(t){return this.cmpn(t)<=0},i.prototype.lte=function(t){return this.cmp(t)<=0},i.prototype.eqn=function(t){return 0===this.cmpn(t)},i.prototype.eq=function(t){return 0===this.cmp(t)},i.red=function(t){return new _(t)},i.prototype.toRed=function(t){return r(!this.red,"Already a number in reduction context"),r(0===this.negative,"red works only with positives"),t.convertTo(this)._forceRed(t)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(t){return this.red=t,this},i.prototype.forceRed=function(t){return r(!this.red,"Already a number in reduction context"),this._forceRed(t)},i.prototype.redAdd=function(t){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},i.prototype.redIAdd=function(t){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},i.prototype.redSub=function(t){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},i.prototype.redISub=function(t){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},i.prototype.redShl=function(t){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},i.prototype.redMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},i.prototype.redIMul=function(t){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(t){return r(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var g={k256:null,p224:null,p192:null,p25519:null};function v(t,e){this.name=t,this.p=new i(e,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function m(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function y(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function x(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function b(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function _(t){if("string"==typeof t){var e=i._prime(t);this.m=e.p,this.prime=e}else r(t.gtn(1),"modulus must be greater than 1"),this.m=t,this.prime=null}function w(t){_.call(this,t),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var t=new i(null);return t.words=new Array(Math.ceil(this.n/13)),t},v.prototype.ireduce=function(t){var e,r=t;do{this.split(r,this.tmp),e=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength()}while(e>this.n);var n=e0?r.isub(this.p):r.strip(),r},v.prototype.split=function(t,e){t.iushrn(this.n,0,e)},v.prototype.imulK=function(t){return t.imul(this.k)},n(m,v),m.prototype.split=function(t,e){for(var r=Math.min(t.length,9),n=0;n>>22,i=a}i>>>=22,t.words[n-10]=i,0===i&&t.length>10?t.length-=10:t.length-=9},m.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var e=0,r=0;r>>=26,t.words[r]=i,e=n}return 0!==e&&(t.words[t.length++]=e),t},i._prime=function(t){if(g[t])return g[t];var e;if("k256"===t)e=new m;else if("p224"===t)e=new y;else if("p192"===t)e=new x;else{if("p25519"!==t)throw new Error("Unknown prime "+t);e=new b}return g[t]=e,e},_.prototype._verify1=function(t){r(0===t.negative,"red works only with positives"),r(t.red,"red works only with red numbers")},_.prototype._verify2=function(t,e){r(0==(t.negative|e.negative),"red works only with positives"),r(t.red&&t.red===e.red,"red works only with red numbers")},_.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},_.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},_.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)},_.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},_.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)},_.prototype.isub=function(t,e){this._verify2(t,e);var r=t.isub(e);return r.cmpn(0)<0&&r.iadd(this.m),r},_.prototype.shl=function(t,e){return this._verify1(t),this.imod(t.ushln(e))},_.prototype.imul=function(t,e){return this._verify2(t,e),this.imod(t.imul(e))},_.prototype.mul=function(t,e){return this._verify2(t,e),this.imod(t.mul(e))},_.prototype.isqr=function(t){return this.imul(t,t.clone())},_.prototype.sqr=function(t){return this.mul(t,t)},_.prototype.sqrt=function(t){if(t.isZero())return t.clone();var e=this.m.andln(3);if(r(e%2==1),3===e){var n=this.m.add(new i(1)).iushrn(2);return this.pow(t,n)}for(var a=this.m.subn(1),o=0;!a.isZero()&&0===a.andln(1);)o++,a.iushrn(1);r(!a.isZero());var s=new i(1).toRed(this),l=s.redNeg(),u=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);0!==this.pow(c,u).cmp(l);)c.redIAdd(l);for(var h=this.pow(c,a),f=this.pow(t,a.addn(1).iushrn(1)),p=this.pow(t,a),d=o;0!==p.cmp(s);){for(var g=p,v=0;0!==g.cmp(s);v++)g=g.redSqr();r(v=0;n--){for(var u=e.words[n],c=l-1;c>=0;c--){var h=u>>c&1;a!==r[0]&&(a=this.sqr(a)),0!==h||0!==o?(o<<=1,o|=h,(4===++s||0===n&&0===c)&&(a=this.mul(a,r[o]),s=0,o=0)):s=0}l=26}return a},_.prototype.convertTo=function(t){var e=t.umod(this.m);return e===t?e.clone():e},_.prototype.convertFrom=function(t){var e=t.clone();return e.red=null,e},i.mont=function(t){return new w(t)},n(w,_),w.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},w.prototype.convertFrom=function(t){var e=this.imod(t.mul(this.rinv));return e.red=null,e},w.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)},w.prototype.mul=function(t,e){if(t.isZero()||e.isZero())return new i(0)._forceRed(this);var r=t.mul(e),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=r.isub(n).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},w.prototype.invm=function(t){return this.imod(t._invmp(this.m).mul(this.r2))._forceRed(this)}}(cA,this),cA=cA.exports;var hA=function(t){return t.cmp(new cA(0))};var fA={};(function(t){var e=!1;if("undefined"!=typeof Float64Array){var r=new Float64Array(1),n=new Uint32Array(r.buffer);if(r[0]=1,e=!0,1072693248===n[1]){(fA=function(t){return r[0]=t,[n[0],n[1]]}).pack=function(t,e){return n[0]=t,n[1]=e,r[0]},fA.lo=function(t){return r[0]=t,n[0]},fA.hi=function(t){return r[0]=t,n[1]}}else if(1072693248===n[0]){(fA=function(t){return r[0]=t,[n[1],n[0]]}).pack=function(t,e){return n[1]=t,n[0]=e,r[0]},fA.lo=function(t){return r[0]=t,n[1]},fA.hi=function(t){return r[0]=t,n[0]}}else e=!1}if(!e){var i=new t(8);(fA=function(t){return i.writeDoubleLE(t,0,!0),[i.readUInt32LE(0,!0),i.readUInt32LE(4,!0)]}).pack=function(t,e){return i.writeUInt32LE(t,0,!0),i.writeUInt32LE(e,4,!0),i.readDoubleLE(0,!0)},fA.lo=function(t){return i.writeDoubleLE(t,0,!0),i.readUInt32LE(0,!0)},fA.hi=function(t){return i.writeDoubleLE(t,0,!0),i.readUInt32LE(4,!0)}}fA.sign=function(t){return fA.hi(t)>>>31},fA.exponent=function(t){return(fA.hi(t)<<1>>>21)-1023},fA.fraction=function(t){var e=fA.lo(t),r=fA.hi(t),n=1048575&r;return 2146435072&r&&(n+=1<<20),[e,n]},fA.denormalized=function(t){return!(2146435072&fA.hi(t))}}).call(this,Rb.Buffer);var pA=function(t){var e=fA.exponent(t);return e<52?new cA(t):new cA(t*Math.pow(2,52-e)).ushln(e-52)};var dA=function(t,e){var r=hA(t),n=hA(e);if(0===r)return[pA(0),pA(1)];if(0===n)return[pA(0),pA(0)];n<0&&(t=t.neg(),e=e.neg());var i=t.gcd(e);if(i.cmpn(1))return[t.div(i),e.div(i)];return[t,e]};var gA=function(t,e){return dA(t[0].mul(e[1]),t[1].mul(e[0]))};var vA=function(t){return t&&"object"==typeof t&&Boolean(t.words)};var mA=function(t){return Array.isArray(t)&&2===t.length&&vA(t[0])&&vA(t[1])};var yA=function(t){return new cA(t)};var xA=function t(e,r){if(mA(e))return r?gA(e,t(r)):[e[0].clone(),e[1].clone()];var n=0;var i,a;if(vA(e))i=e.clone();else if("string"==typeof e)i=yA(e);else{if(0===e)return[pA(0),pA(1)];if(e===Math.floor(e))i=pA(e);else{for(;e!==Math.floor(e);)e*=Math.pow(2,256),n-=256;i=pA(e)}}if(mA(r))i.mul(r[1]),a=r[0].clone();else if(vA(r))a=r.clone();else if("string"==typeof r)a=yA(r);else if(r)if(r===Math.floor(r))a=pA(r);else{for(;r!==Math.floor(r);)r*=Math.pow(2,256),n+=256;a=pA(r)}else a=pA(1);n>0?i=i.ushln(n):n<0&&(a=a.ushln(-n));return dA(i,a)};var bA=function(t){var e=t.length,r=t.words,n=0;if(1===e)n=r[0];else if(2===e)n=r[0]+67108864*r[1];else for(var i=0;i20)return 52;return r+32};var MA=function(t){var e=t[0],r=t[1];if(0===e.cmpn(0))return 0;var n=e.abs().divmod(r.abs()),i=n.div,a=bA(i),o=n.mod,s=e.negative!==r.negative?-1:1;if(0===o.cmpn(0))return s*a;if(a){var l=wA(a)+4,u=bA(o.ushln(l).divRound(r));return s*(a+u*Math.pow(2,-l))}var c=r.bitLength()-o.bitLength()+53,u=bA(o.ushln(c).divRound(r));return c<1023?s*u*Math.pow(2,-c):(u*=Math.pow(2,-1023),s*u*Math.pow(2,1023-c))};var AA={},kA="d",TA="ax",SA="vv",EA="fp",CA="es",LA="rs",zA="re",PA="rb",IA="ri",DA="rp",OA="bs",RA="be",FA="bb",BA="bi",NA="bp",jA="rv",VA="Q",UA=[kA,TA,SA,LA,zA,PA,IA,OA,RA,FA,BA];function qA(t){var e="bruteForce"+(t?"Full":"Partial"),r=[],n=UA.slice();t||n.splice(3,0,EA);var i=["function "+e+"("+n.join()+"){"];function a(e,n){var a=function(t,e,r){var n="bruteForce"+(t?"Red":"Blue")+(e?"Flip":"")+(r?"Full":""),i=["function ",n,"(",UA.join(),"){","var ",CA,"=2*",kA,";"],a="for(var i="+LA+","+DA+"="+CA+"*"+LA+";i<"+zA+";++i,"+DA+"+="+CA+"){var x0="+PA+"["+TA+"+"+DA+"],x1="+PA+"["+TA+"+"+DA+"+"+kA+"],xi="+IA+"[i];",o="for(var j="+OA+","+NA+"="+CA+"*"+OA+";j<"+RA+";++j,"+NA+"+="+CA+"){var y0="+FA+"["+TA+"+"+NA+"],"+(r?"y1="+FA+"["+TA+"+"+NA+"+"+kA+"],":"")+"yi="+BA+"[j];";return t?i.push(a,VA,":",o):i.push(o,VA,":",a),r?i.push("if(y1"+RA+"-"+OA+"){"),t?(a(!0,!1),i.push("}else{"),a(!1,!1)):(i.push("if("+EA+"){"),a(!0,!0),i.push("}else{"),a(!0,!1),i.push("}}else{if("+EA+"){"),a(!1,!0),i.push("}else{"),a(!1,!1),i.push("}")),i.push("}}return "+e);var o=r.join("")+i.join("");return new Function(o)()}AA.partial=qA(!1),AA.full=qA(!0);var HA=function(t,e){var r="abcdef".split("").concat(e),n=[];t.indexOf("lo")>=0&&n.push("lo=e[k+n]");t.indexOf("hi")>=0&&n.push("hi=e[k+o]");return r.push(GA.replace("_",n.join()).replace("$",t)),Function.apply(void 0,r)},GA="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";var WA=function(t,e,r,n,i,a){if(n<=r+1)return r;var o=r,s=n,l=n+r>>>1,u=2*t,c=l,h=i[u*l+e];for(;o=v?(c=g,h=v):d>=y?(c=p,h=d):(c=m,h=y):v>=y?(c=g,h=v):y>=d?(c=p,h=d):(c=m,h=y);for(var x=u*(s-1),b=u*c,_=0;_r&&i[h+e]>u;--c,h-=o){for(var f=h,p=h+o,d=0;d>1,l=s-i,u=s+i,c=a,h=l,f=s,p=u,d=o,g=e+1,v=r-1,m=0;nk(c,h,n)&&(m=c,c=h,h=m);nk(p,d,n)&&(m=p,p=d,d=m);nk(c,f,n)&&(m=c,c=f,f=m);nk(h,f,n)&&(m=h,h=f,f=m);nk(c,p,n)&&(m=c,c=p,p=m);nk(f,p,n)&&(m=f,f=p,p=m);nk(h,d,n)&&(m=h,h=d,d=m);nk(h,f,n)&&(m=h,h=f,f=m);nk(p,d,n)&&(m=p,p=d,d=m);var y=n[2*h];var x=n[2*h+1];var b=n[2*p];var _=n[2*p+1];var w=2*c;var M=2*f;var A=2*d;var k=2*a;var T=2*s;var S=2*o;for(var E=0;E<2;++E){var C=n[w+E],L=n[M+E],z=n[A+E];n[k+E]=C,n[T+E]=L,n[S+E]=z}tk(l,e,n);tk(u,r,n);for(var P=g;P<=v;++P)if(ik(P,y,x,n))P!==g&&$A(P,g,n),++g;else if(!ik(P,b,_,n))for(;;){if(ik(v,b,_,n)){ik(v,y,x,n)?(ek(P,g,v,n),++g,--v):($A(P,v,n),--v);break}if(--vt;){var u=r[l-2],c=r[l-1];if(ur[e+1])}function ik(t,e,r,n){var i=n[t*=2];return i>>1;JA(pk,y);for(var x=0,b=0,d=0;d=ok)dk(uk,ck,b--,_=_-ok|0);else if(_>=0)dk(sk,lk,x--,_);else if(_<=-ok){_=-_-ok|0;for(var w=0;w>>1;JA(pk,y);for(var x=0,b=0,_=0,d=0;d>1==pk[2*d+3]>>1&&(M=2,d+=1),w<0){for(var A=-(w>>1)-1,k=0;k<_;++k){var T=e(hk[k],A);if(void 0!==T)return T}if(0!==M)for(var k=0;k>1)-1;0===M?dk(sk,lk,x--,A):1===M?dk(uk,ck,b--,A):2===M&&dk(hk,fk,_--,A)}}},scanBipartite:function(t,e,r,n,i,a,o,s,l,u,c,h){var f=0,p=2*t,d=e,g=e+t,v=1,m=1;n?m=ok:v=ok;for(var y=i;y>>1;JA(pk,w);for(var M=0,y=0;y=ok?(k=!n,x-=ok):(k=!!n,x-=1),k)gk(sk,lk,M++,x);else{var T=h[x],S=p*x,E=c[S+e+1],C=c[S+e+1+t];t:for(var L=0;L>>1;JA(pk,x);for(var b=0,g=0;g=ok)sk[b++]=v-ok;else{var w=c[v-=1],M=f*v,A=u[M+e+1],k=u[M+e+1+t];t:for(var T=0;T=0;--T)if(sk[T]===v){for(var L=T+1;L0;){var f=(c-=1)*Ek,p=Lk[f],d=Lk[f+1],g=Lk[f+2],v=Lk[f+3],m=Lk[f+4],y=Lk[f+5],x=c*Ck,b=zk[x],_=zk[x+1],w=1&y,M=!!(16&y),A=i,k=a,T=s,S=l;if(w&&(A=s,k=l,T=i,S=a),!(2&y&&(g=Ak(t,p,d,g,A,k,_),d>=g)||4&y&&(d=kk(t,p,d,g,A,k,b))>=g)){var E=g-d,C=m-v;if(M){if(t*E*(E+C)<_k){if(void 0!==(u=ak.scanComplete(t,p,e,d,g,A,k,v,m,T,S)))return u;continue}}else{if(t*Math.min(E,C)=p0)&&!(p1>=hi)",["p0","p1"]),Mk=HA("lo===p0",["p0"]),Ak=HA("lo>>1;if(!(o<=0)){var s,l=__.mallocDouble(2*o*i),u=__.mallocInt32(i);if((i=Bk(t,o,l,u))>0){if(1===o&&n)ak.init(i),s=ak.sweepComplete(o,r,0,i,l,u,0,i,l,u);else{var c=__.mallocDouble(2*o*a),h=__.mallocInt32(a);(a=Bk(e,o,c,h))>0&&(ak.init(i+a),s=1===o?ak.sweepBipartite(o,r,0,i,l,u,0,a,c,h):vk(o,r,n,i,l,u,a,c,h),__.free(c),__.free(h))}__.free(l),__.free(u)}return s}}}function jk(t,e){Ok.push([t,e])}var Vk=function(t,e){return dA(t[0].mul(e[0]),t[1].mul(e[1]))};var Uk=function(t){return hA(t[0])*hA(t[1])};var qk=function(t,e){return dA(t[0].mul(e[1]).sub(t[1].mul(e[0])),t[1].mul(e[1]))};var Hk=function(t,e){return dA(t[0].mul(e[1]).add(e[0].mul(t[1])),t[1].mul(e[1]))};var Gk=function(t,e){for(var r=t.length,n=new Array(r),i=0;i>>0,Qk=function(t,e){if(isNaN(t)||isNaN(e))return NaN;if(t===e)return t;if(0===t)return e<0?-Jk:Jk;var r=fA.hi(t),n=fA.lo(t);e>t==t>0?n===Kk?(r+=1,n=0):n+=1:0===n?(n=Kk,r-=1):n-=1;return fA.pack(n,r)};var $k=function(t){for(var e=new Array(t.length),r=0;r0&&a>0||i<0&&a<0)return!1;var o=eT(r,t,e),s=eT(n,t,e);if(o>0&&s>0||o<0&&s<0)return!1;if(0===i&&0===a&&0===o&&0===s)return function(t,e,r,n){for(var i=0;i<2;++i){var a=t[i],o=e[i],s=Math.min(a,o),l=Math.max(a,o),u=r[i],c=n[i],h=Math.min(u,c),f=Math.max(u,c);if(fe[2]?1:0)}function hT(t,e,r){if(0!==t.length){if(e)for(var n=0;n=0;--a){var d=e[o=(w=n[a])[0]],g=d[0],v=d[1],m=t[g],y=t[v];if((m[0]-y[0]||m[1]-y[1])<0){var x=g;g=v,v=x}d[0]=g;var b,_=d[1]=w[1];for(i&&(b=d[2]);a>0&&n[a-1][0]===o;){var w,M=(w=n[--a])[1];i?e.push([_,M,b]):e.push([_,M]),_=M}i?e.push([_,v,b]):e.push([_,v])}return s}(t,e,i,o,r));return hT(e,s,r),!!s||(i.length>0||o.length>0)}var pT=function(t,e){var r=t.length;if("number"!=typeof e){e=0;for(var n=0;n0?1:0},vT=function(t,e,r,n){var i=PM(e,r,n);if(0===i){var a=gT(PM(t,e,r)),o=gT(PM(t,e,n));if(a===o){if(0===a){var s=mT(t,e,r),l=mT(t,e,n);return s===l?0:s?1:-1}return 0}return 0===o?a>0?-1:mT(t,e,n)?-1:1:0===a?o>0?1:mT(t,e,r)?1:-1:gT(o-a)}var u=PM(t,e,r);if(u>0)return i>0&&PM(t,e,n)>0?1:-1;if(u<0)return i>0||PM(t,e,n)>0?1:-1;var c=PM(t,e,n);return c>0?1:mT(t,e,r)?1:-1};function mT(t,e,r){var n=fM(t[0],-e[0]),i=fM(t[1],-e[1]),a=fM(r[0],-e[0]),o=fM(r[1],-e[1]),s=gM(dT(n,a),dT(i,o));return s[s.length-1]>=0}var yT=function(t,e){for(var r=0|e.length,n=t.length,i=[new Array(r),new Array(r)],a=0;a0){a=i[u][r][0],s=u;break}o=a[1^s];for(var c=0;c<2;++c)for(var h=i[c][r],f=0;f0&&(a=p,o=d,s=c)}return n?o:(a&&l(a,s),o)}function c(t,r){var n=i[r][t][0],a=[t];l(n,r);for(var o=n[1^r];;){for(;o!==t;)a.push(o),o=u(a[a.length-2],o,!1);if(i[0][t].length+i[1][t].length===0)break;var s=a[a.length-1],c=t,h=a[1],f=u(s,c,!0);if(vT(e[s],e[c],e[h],e[f])<0)break;a.push(t),o=u(s,c)}return a}function h(t,e){return e[1]===e[e.length-1]}for(var a=0;a0;){i[0][a].length;var d=c(a,f);h(p,d)?p.push.apply(p,d):(p.length>0&&s.push(p),p=d)}p.length>0&&s.push(p)}return s};var xT=function(t,e){for(var r=pT(t,e.length),n=new Array(e.length),i=new Array(e.length),a=[],o=0;o0;){var l=a.pop();n[l]=!1;for(var u=r[l],o=0;o>>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 _T(t,e,r,n){return new Function([bT("A","x"+t+"y",e,["y"],!1,n),bT("B","x"+t+"y",e,["y"],!0,n),bT("P","c(x,y)"+t+"0",e,["y","c"],!1,n),bT("Q","c(x,y)"+t+"0",e,["y","c"],!0,n),"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(""))()}var wT={ge:_T(">=",!1,"GE"),gt:_T(">",!1,"GT"),lt:_T("<",!0,"LT"),le:_T("<=",!0,"LE"),eq:_T("-",!0,"EQ",!0)},MT=0,AT=1,kT=function(t){if(!t||0===t.length)return new NT(null);return new NT(BT(t))};function TT(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}var ST=TT.prototype;function ET(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 CT(t,e){var r=BT(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 LT(t,e){var r=t.intervals([]);r.push(e),CT(t,r)}function zT(t,e){var r=t.intervals([]),n=r.indexOf(e);return n<0?MT:(r.splice(n,1),CT(t,r),AT)}function PT(t,e,r){for(var n=0;n=0&&t[n][1]>=e;--n){var i=r(t[n]);if(i)return i}}function DT(t,e){for(var r=0;r>1],i=[],a=[],o=[];for(r=0;r3*(e+1)?LT(this,t):this.left.insert(t):this.left=BT([t]);else if(t[0]>this.mid)this.right?4*(this.right.count+1)>3*(e+1)?LT(this,t):this.right.insert(t):this.right=BT([t]);else{var r=wT.ge(this.leftPoints,t,RT),n=wT.ge(this.rightPoints,t,FT);this.leftPoints.splice(r,0,t),this.rightPoints.splice(n,0,t)}},ST.remove=function(t){var e=this.count-this.leftPoints;if(t[1]3*(e-1)?zT(this,t):2===(a=this.left.remove(t))?(this.left=null,this.count-=1,AT):(a===AT&&(this.count-=1),a):MT}else{if(!(t[0]>this.mid)){if(1===this.count)return this.leftPoints[0]===t?2:MT;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 i=this.left;a=this.right;r.count-=n.count,r.right=n.left,n.left=i,n.right=a}ET(this,n),this.count=(this.left?this.left.count:0)+(this.right?this.right.count:0)+this.leftPoints.length}else this.left?ET(this,this.left):ET(this,this.right);return AT}for(i=wT.ge(this.leftPoints,t,RT);i3*(e-1)?zT(this,t):2===(a=this.right.remove(t))?(this.right=null,this.count-=1,AT):(a===AT&&(this.count-=1),a):MT;var a}},ST.queryPoint=function(t,e){if(tthis.mid){var r;if(this.right)if(r=this.right.queryPoint(t,e))return r;return IT(this.rightPoints,t,e)}return DT(this.leftPoints,e)},ST.queryInterval=function(t,e,r){var n;if(tthis.mid&&this.right&&(n=this.right.queryInterval(t,e,r)))return n;return ethis.mid?IT(this.rightPoints,t,r):DT(this.leftPoints,r)};var jT=NT.prototype;jT.insert=function(t){this.root?this.root.insert(t):this.root=new TT(t[0],null,null,[t],[t])},jT.remove=function(t){if(this.root){var e=this.root.remove(t);return 2===e&&(this.root=null),e!==MT}return!1},jT.queryPoint=function(t,e){if(this.root)return this.root.queryPoint(t,e)},jT.queryInterval=function(t,e,r){if(t<=e&&this.root)return this.root.queryInterval(t,e,r)},Object.defineProperty(jT,"count",{get:function(){return this.root?this.root.count:0}}),Object.defineProperty(jT,"intervals",{get:function(){return this.root?this.root.intervals([]):[]}});var VT=function(t){return new XT(t||$T,null)},UT=0,qT=1;function HT(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 GT(t){return new HT(t._color,t.key,t.value,t.left,t.right,t._count)}function WT(t,e){return new HT(t,e.key,e.value,e.left,e.right,e._count)}function YT(t){t._count=1+(t.left?t.left._count:0)+(t.right?t.right._count:0)}function XT(t,e){this._compare=t,this.root=e}var ZT=XT.prototype;function JT(t,e){this.tree=t,this._stack=e}Object.defineProperty(ZT,"keys",{get:function(){var t=[];return this.forEach(function(e,r){t.push(e)}),t}}),Object.defineProperty(ZT,"values",{get:function(){var t=[];return this.forEach(function(e,r){t.push(r)}),t}}),Object.defineProperty(ZT,"length",{get:function(){return this.root?this.root._count:0}}),ZT.insert=function(t,e){for(var r=this._compare,n=this.root,i=[],a=[];n;){var o=r(t,n.key);i.push(n),a.push(o),n=o<=0?n.left:n.right}i.push(new HT(UT,t,e,null,null,1));for(var s=i.length-2;s>=0;--s){n=i[s];a[s]<=0?i[s]=new HT(n._color,n.key,n.value,i[s+1],n.right,n._count+1):i[s]=new HT(n._color,n.key,n.value,n.left,i[s+1],n._count+1)}for(s=i.length-1;s>1;--s){var l=i[s-1];n=i[s];if(l._color===qT||n._color===qT)break;var u=i[s-2];if(u.left===l)if(l.left===n){if(!(c=u.right)||c._color!==UT){if(u._color=UT,u.left=l.right,l._color=qT,l.right=u,i[s-2]=l,i[s-1]=n,YT(u),YT(l),s>=3)(h=i[s-3]).left===u?h.left=l:h.right=l;break}l._color=qT,u.right=WT(qT,c),u._color=UT,s-=1}else{if(!(c=u.right)||c._color!==UT){if(l.right=n.left,u._color=UT,u.left=n.right,n._color=qT,n.left=l,n.right=u,i[s-2]=n,i[s-1]=l,YT(u),YT(l),YT(n),s>=3)(h=i[s-3]).left===u?h.left=n:h.right=n;break}l._color=qT,u.right=WT(qT,c),u._color=UT,s-=1}else if(l.right===n){if(!(c=u.left)||c._color!==UT){if(u._color=UT,u.right=l.left,l._color=qT,l.left=u,i[s-2]=l,i[s-1]=n,YT(u),YT(l),s>=3)(h=i[s-3]).right===u?h.right=l:h.left=l;break}l._color=qT,u.left=WT(qT,c),u._color=UT,s-=1}else{var c;if(!(c=u.left)||c._color!==UT){var h;if(l.left=n.right,u._color=UT,u.right=n.left,n._color=qT,n.right=l,n.left=u,i[s-2]=n,i[s-1]=l,YT(u),YT(l),YT(n),s>=3)(h=i[s-3]).right===u?h.right=n:h.left=n;break}l._color=qT,u.left=WT(qT,c),u._color=UT,s-=1}}return i[0]._color=qT,new XT(r,i[0])},ZT.forEach=function(t,e,r){if(this.root)switch(arguments.length){case 1:return function t(e,r){var n;if(r.left&&(n=t(e,r.left)))return n;return(n=e(r.key,r.value))||(r.right?t(e,r.right):void 0)}(t,this.root);case 2:return function t(e,r,n,i){if(r(e,i.key)<=0){var a;if(i.left&&(a=t(e,r,n,i.left)))return a;if(a=n(i.key,i.value))return a}if(i.right)return t(e,r,n,i.right)}(e,this._compare,t,this.root);case 3:if(this._compare(e,r)>=0)return;return function t(e,r,n,i,a){var o,s=n(e,a.key),l=n(r,a.key);if(s<=0){if(a.left&&(o=t(e,r,n,i,a.left)))return o;if(l>0&&(o=i(a.key,a.value)))return o}if(l>0&&a.right)return t(e,r,n,i,a.right)}(e,r,this._compare,t,this.root)}},Object.defineProperty(ZT,"begin",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.left;return new JT(this,t)}}),Object.defineProperty(ZT,"end",{get:function(){for(var t=[],e=this.root;e;)t.push(e),e=e.right;return new JT(this,t)}}),ZT.at=function(t){if(t<0)return new JT(this,[]);for(var e=this.root,r=[];;){if(r.push(e),e.left){if(t=e.right._count)break;e=e.right}return new JT(this,[])},ZT.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 JT(this,n)},ZT.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 JT(this,n)},ZT.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 JT(this,n)},ZT.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 JT(this,n)},ZT.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 JT(this,n);r=i<=0?r.left:r.right}return new JT(this,[])},ZT.remove=function(t){var e=this.find(t);return e?e.remove():this},ZT.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 KT=JT.prototype;function QT(t,e){t.key=e.key,t.value=e.value,t.left=e.left,t.right=e.right,t._color=e._color,t._count=e._count}function $T(t,e){return te?1:0}Object.defineProperty(KT,"valid",{get:function(){return this._stack.length>0}}),Object.defineProperty(KT,"node",{get:function(){return this._stack.length>0?this._stack[this._stack.length-1]:null},enumerable:!0}),KT.clone=function(){return new JT(this.tree,this._stack.slice())},KT.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 HT(r._color,r.key,r.value,r.left,r.right,r._count);for(var n=t.length-2;n>=0;--n){(r=t[n]).left===t[n+1]?e[n]=new HT(r._color,r.key,r.value,e[n+1],r.right,r._count):e[n]=new HT(r._color,r.key,r.value,r.left,e[n+1],r._count)}if((r=e[e.length-1]).left&&r.right){var i=e.length;for(r=r.left;r.right;)e.push(r),r=r.right;var a=e[i-1];e.push(new HT(r._color,a.key,a.value,r.left,r.right,r._count)),e[i-1].key=r.key,e[i-1].value=r.value;for(n=e.length-2;n>=i;--n)r=e[n],e[n]=new HT(r._color,r.key,r.value,r.left,e[n+1],r._count);e[i-1].left=e[i]}if((r=e[e.length-1])._color===UT){var o=e[e.length-2];o.left===r?o.left=null:o.right===r&&(o.right=null),e.pop();for(n=0;n=0;--a){if(e=t[a],0===a)return void(e._color=qT);if((r=t[a-1]).left===e){if((n=r.right).right&&n.right._color===UT)return i=(n=r.right=GT(n)).right=GT(n.right),r.right=n.left,n.left=r,n.right=i,n._color=r._color,e._color=qT,r._color=qT,i._color=qT,YT(r),YT(n),a>1&&((o=t[a-2]).left===r?o.left=n:o.right=n),void(t[a-1]=n);if(n.left&&n.left._color===UT)return i=(n=r.right=GT(n)).left=GT(n.left),r.right=i.left,n.left=i.right,i.left=r,i.right=n,i._color=r._color,r._color=qT,n._color=qT,e._color=qT,YT(r),YT(n),YT(i),a>1&&((o=t[a-2]).left===r?o.left=i:o.right=i),void(t[a-1]=i);if(n._color===qT){if(r._color===UT)return r._color=qT,void(r.right=WT(UT,n));r.right=WT(UT,n);continue}n=GT(n),r.right=n.left,n.left=r,n._color=r._color,r._color=UT,YT(r),YT(n),a>1&&((o=t[a-2]).left===r?o.left=n:o.right=n),t[a-1]=n,t[a]=r,a+11&&((o=t[a-2]).right===r?o.right=n:o.left=n),void(t[a-1]=n);if(n.right&&n.right._color===UT)return i=(n=r.left=GT(n)).right=GT(n.right),r.left=i.right,n.right=i.left,i.right=r,i.left=n,i._color=r._color,r._color=qT,n._color=qT,e._color=qT,YT(r),YT(n),YT(i),a>1&&((o=t[a-2]).right===r?o.right=i:o.left=i),void(t[a-1]=i);if(n._color===qT){if(r._color===UT)return r._color=qT,void(r.left=WT(UT,n));r.left=WT(UT,n);continue}var o;n=GT(n),r.left=n.right,n.right=r,n._color=r._color,r._color=UT,YT(r),YT(n),a>1&&((o=t[a-2]).right===r?o.right=n:o.left=n),t[a-1]=n,t[a]=r,a+10)return this._stack[this._stack.length-1].key},enumerable:!0}),Object.defineProperty(KT,"value",{get:function(){if(this._stack.length>0)return this._stack[this._stack.length-1].value},enumerable:!0}),Object.defineProperty(KT,"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}),KT.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(KT,"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}}),KT.update=function(t){var e=this._stack;if(0===e.length)throw new Error("Can't update empty node!");var r=new Array(e.length),n=e[e.length-1];r[r.length-1]=new HT(n._color,n.key,t,n.left,n.right,n._count);for(var i=e.length-2;i>=0;--i)(n=e[i]).left===e[i+1]?r[i]=new HT(n._color,n.key,n.value,r[i+1],n.right,n._count):r[i]=new HT(n._color,n.key,n.value,n.left,r[i+1],n._count);return new XT(this.tree._compare,r[0])},KT.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(KT,"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}});var tS=function(t,e){var r,n,i,a;if(e[0][0]e[1][0]))return eS(e,t);r=e[1],n=e[0]}if(t[0][0]t[1][0]))return-eS(t,e);i=t[1],a=t[0]}var o=PM(r,n,a),s=PM(r,n,i);if(o<0){if(s<=0)return o}else if(o>0){if(s>=0)return o}else if(s)return s;if(o=PM(a,i,n),s=PM(a,i,r),o<0){if(s<=0)return o}else if(o>0){if(s>=0)return o}else if(s)return s;return n[0]-a[0]};function eS(t,e){var r,n,i,a;if(e[0][0]e[1][0])){var o=Math.min(t[0][1],t[1][1]),s=Math.max(t[0][1],t[1][1]),l=Math.min(e[0][1],e[1][1]),u=Math.max(e[0][1],e[1][1]);return su?o-u:s-u}r=e[1],n=e[0]}t[0][1]0)if(e[0]!==a[1][0])r=t,t=t.right;else{if(s=aS(t.right,e))return s;t=t.left}else{if(e[0]!==a[1][0])return t;var s;if(s=aS(t.right,e))return s;t=t.left}}return r}function oS(t,e,r,n){this.y=t,this.index=e,this.start=r,this.closed=n}function sS(t,e,r,n){this.x=t,this.segment=e,this.create=r,this.index=n}nS.prototype.castUp=function(t){var e=wT.le(this.coordinates,t[0]);if(e<0)return-1;this.slabs[e];var r=aS(this.slabs[e],t),n=-1;if(r&&(n=r.value),this.coordinates[e]===t[0]){var i=null;if(r&&(i=r.key),e>0){var a=aS(this.slabs[e-1],t);a&&(i?tS(a.key,i)>0&&(i=a.key,n=a.value):(n=a.value,i=a.key))}var o=this.horizontal[e];if(o.length>0){var s=wT.ge(o,t[1],iS);if(s=o.length)return n;l=o[s]}}if(l.start)if(i){var u=PM(i[0],i[1],[t[0],l.y]);i[0][0]>i[1][0]&&(u=-u),u>0&&(n=l.index)}else n=l.index;else l.y!==t[1]&&(n=l.index)}}}return n};var lS=function(t){for(var e=t.length,r=[],n=[],i=0;i0&&e[n]===r[0]))return 1;i=t[n-1]}for(var a=1;i;){var o=i.key,s=uS(r,o[0],o[1]);if(o[0][0]0))return 0;a=-1,i=i.right}else if(s>0)i=i.left;else{if(!(s<0))return 0;a=1,i=i.right}}return a}}(f.slabs,f.coordinates);return 0===n.length?p:function(t,e){return function(r){return t(r[0],r[1])?0:e(r)}}(hS(n),p)},uS=PM[3];function cS(){return!0}function hS(t){for(var e={},r=0;r0})).length,l=new Array(s),u=new Array(s),a=0;a0;){var z=C.pop(),P=_[z];Qx(P,function(t,e){return t-e});var I,D=P.length,O=L[z];if(0===O){var g=o[z];I=[g]}for(var a=0;a=0)&&(L[R]=1^O,C.push(R),0===O)){var g=o[R];E(g)||(g.reverse(),I.push(g))}}0===O&&r.push(I)}return r};function dS(t,e){for(var r=new Array(t),n=0;n>1,o=vS(t[a],e);o<=0?(0===o&&(i=a),r=a+1):o>0&&(n=a-1)}return i}function _S(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==vS(t[p],a)););}return r}function wS(t,e){if(e<0)return[];for(var r=[],n=(1<>>u&1&&l.push(i[u]);e.push(l)}return yS(e)},gS.skeleton=wS,gS.boundary=function(t){for(var e=[],r=0,n=t.length;r0)-(t<0)},MS.abs=function(t){var e=t>>31;return(t^e)-e},MS.min=function(t,e){return e^(t^e)&-(t65535)<<4,e|=r=((t>>>=e)>255)<<3,e|=r=((t>>>=r)>15)<<2,(e|=r=((t>>>=r)>3)<<1)|(t>>>=r)>>1},MS.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},MS.popCount=function(t){return 16843009*((t=(858993459&(t-=t>>>1&1431655765))+(t>>>2&858993459))+(t>>>4)&252645135)>>>24},MS.countTrailingZeros=AS,MS.nextPow2=function(t){return t+=0===t,--t,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)+1},MS.prevPow2=function(t){return t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,(t|=t>>>16)-(t>>>1)},MS.parity=function(t){return t^=t>>>16,t^=t>>>8,t^=t>>>4,27030>>>(t&=15)&1};var kS=new Array(256);!function(t){for(var e=0;e<256;++e){var r=e,n=e,i=7;for(r>>>=1;r;r>>>=1)n<<=1,n|=1&r,--i;t[e]=n<>>8&255]<<16|kS[t>>>16&255]<<8|kS[t>>>24&255]},MS.interleave2=function(t,e){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t&=65535)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e&=65535)|e<<8))|e<<4))|e<<2))|e<<1))<<1},MS.deinterleave2=function(t,e){return(t=65535&((t=16711935&((t=252645135&((t=858993459&((t=t>>>e&1431655765)|t>>>1))|t>>>2))|t>>>4))|t>>>16))<<16>>16},MS.interleave3=function(t,e,r){return t=1227133513&((t=3272356035&((t=251719695&((t=4278190335&((t&=1023)|t<<16))|t<<8))|t<<4))|t<<2),(t|=(e=1227133513&((e=3272356035&((e=251719695&((e=4278190335&((e&=1023)|e<<16))|e<<8))|e<<4))|e<<2))<<1)|(r=1227133513&((r=3272356035&((r=251719695&((r=4278190335&((r&=1023)|r<<16))|r<<8))|r<<4))|r<<2))<<2},MS.deinterleave3=function(t,e){return(t=1023&((t=4278190335&((t=251719695&((t=3272356035&((t=t>>>e&1227133513)|t>>>2))|t>>>4))|t>>>8))|t>>>16))<<22>>22},MS.nextCombination=function(t){var e=t|t-1;return e+1|(~e&-~e)-1>>>AS(t)+1};var TS=SS;function SS(t){this.roots=new Array(t),this.ranks=new Array(t);for(var e=0;e>1,o=CS(t[a],e);o<=0?(0===o&&(i=a),r=a+1):o>0&&(n=a-1)}return i}function DS(t,e){for(var r=new Array(t.length),n=0,i=r.length;n=t.length||0!==CS(t[p],a)););}return r}function OS(t,e){if(e<0)return[];for(var r=[],n=(1<>>u&1&&l.push(i[u]);e.push(l)}return zS(e)},ES.skeleton=OS,ES.boundary=function(t){for(var e=[],r=0,n=t.length;r>1:(t>>1)-1}function m(t){for(var e=g(t);;){var r=e,n=2*t+1,i=2*(t+1),a=t;if(n0;){var r=v(t);if(r>=0){var n=g(r);if(e0){var t=w[0];return d(0,k-1),k-=1,m(0),t}return-1}function b(t,e){var r=w[t];return s[r]===e?t:(s[r]=-1/0,y(t),x(),s[r]=e,y((k+=1)-1))}function _(t){if(!l[t]){l[t]=!0;var e=a[t],r=o[t];a[r]>=0&&(a[r]=e),o[e]>=0&&(o[e]=r),M[e]>=0&&b(M[e],p(e)),M[r]>=0&&b(M[r],p(r))}}for(var w=[],M=new Array(n),u=0;u>1;u>=0;--u)m(u);for(;;){var T=x();if(T<0||s[T]>r)break;_(T)}for(var S=[],u=0;u=0&&r>=0&&e!==r){var n=M[e],i=M[r];n!==i&&C.push([n,i])}}),ES.unique(ES.normalize(C)),{positions:S,edges:C}};var FS=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=0?o[s]=!0:o[s]=!1;return function(t,e,r,n,i,a){var o=a.length,s=i.length;if(s<2)throw new Error("ndarray-extract-contour: Dimension must be at least 2");for(var l="extractContour"+i.join("_"),u=[],c=[],h=[],f=0;f0&&v.push(US(f,i[p-1])+"*"+VS(i[p-1])),c.push(XS(f,i[p])+"=("+v.join("-")+")|0")}for(var f=0;f=0;--f)m.push(VS(i[f]));c.push(rE+"=("+m.join("*")+")|0",tE+"=mallocUint32("+rE+")",$S+"=mallocUint32("+rE+")",nE+"=0"),c.push(ZS(0)+"=0");for(var p=1;p<1<0;v=v-1&p)g.push($S+"["+nE+"+"+KS(v)+"]");g.push(QS(0));for(var v=0;v=0;--e)w(e,0);for(var r=[],e=0;e0){",YS(i[e]),"=1;");t(e-1,r|1<0;--r)e+=uE[r]/(t+r);var n=t+lE+.5;return.5*Math.log(2*Math.PI)+(t+.5)*Math.log(n)-n+Math.log(e)-Math.log(t)}(oE=function t(e){if(e<.5)return Math.PI/(Math.sin(Math.PI*e)*t(1-e));if(e>100)return Math.exp(cE(e));e-=1;for(var r=sE[0],n=1;n<9;n++)r+=sE[n]/(e+n);var i=e+7+.5;return Math.sqrt(2*Math.PI)*Math.pow(i,e+.5)*Math.exp(-i)*r}).log=cE;var hE=function(t){var e=t.length;if(e0;--i)n=o[i],r=a[i],a[i]=a[n],a[n]=r,o[i]=o[r],o[r]=n,s=(s+r)*i;return __.freeUint32(o),__.freeUint32(a),s},dE.unrank=function(t,e,r){switch(t){case 0:return r||[];case 1:return r?(r[0]=0,r):[0];case 2:return r?(e?(r[0]=0,r[1]=1):(r[0]=1,r[1]=0),r):e?[0,1]:[1,0]}var n,i,a,o=1;for((r=r||new Array(t))[0]=0,a=1;a0;--a)e=e-(n=e/o|0)*o|0,o=o/a|0,i=0|r[a],r[a]=0|r[n],r[n]=0|i;return r};var gE=function(t){if(t<0)return[];if(0===t)return[[0]];for(var e=0|Math.round(oE(t+1)),r=[],n=0;n= 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"}),mE=function(t,e){var r=[];return e=+e||0,vE(t.hi(t.shape[0]-1),r,e),r};var yE=function(t,e){if(t.dimension<=0)return{positions:[],cells:[]};if(1===t.dimension)return function(t,e){for(var r=mE(t,e),n=r.length,i=new Array(n),a=new Array(n),o=0;o c)|0 },"),"generic"===e&&n.push("getters:[0],");for(var a=[],o=[],s=0;s>>7){");for(var s=0;s<1<<(1<128&&s%128==0){u.length>0&&c.push("}}");var h="vExtra"+u.length;n.push("case ",s>>>7,":",h,"(m&0x7f,",o.join(),");break;"),c=["function ",h,"(m,",o.join(),"){switch(m){"],u.push(c)}c.push("case ",127&s,":");for(var f=new Array(r),p=new Array(r),d=new Array(r),g=new Array(r),v=0,m=0;mm)&&!(s&1<0&&(M="+"+d[y]+"*c");var A=f[y].length/v*.5,k=.5+g[y]/v*.5;w.push("d"+y+"-"+k+"-"+A+"*("+f[y].join("+")+M+")/("+p[y].join("+")+")")}c.push("a.push([",w.join(),"]);","break;")}n.push("}},"),u.length>0&&c.push("}}");for(var T=[],s=0;s<1<8192)throw new Error("vectorize-text: String too long (sorry, this will get fixed later)");var a=3*n;t.height0&&(c+=.02);for(var f=new Float32Array(u),p=0,d=-.5*c,h=0;hs[M]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n],a.uniforms.angle=v[n],l.drawArrays(l.TRIANGLES,s[M],s[A]-s[M]))),m[n]&&w&&(e[1^n]-=k*f*y[n],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n],a.uniforms.angle=b[n],l.drawArrays(l.TRIANGLES,_,w)),e[1^n]=k*u[2+(1^n)]-1,p[n+2]&&(e[1^n]+=k*f*d[n+2],Ms[M]&&(a.uniforms.dataAxis=t,a.uniforms.screenOffset=e,a.uniforms.color=g[n+2],a.uniforms.angle=v[n+2],l.drawArrays(l.TRIANGLES,s[M],s[A]-s[M]))),m[n+2]&&w&&(e[1^n]+=k*f*y[n+2],a.uniforms.dataAxis=r,a.uniforms.screenOffset=e,a.uniforms.color=x[n+2],a.uniforms.angle=b[n+2],l.drawArrays(l.TRIANGLES,_,w))}}(),CE.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,u=r.pixelRatio;if(this.titleCount){for(var c=0;c<2;++c)e[c]=2*(o[c]*u-a[c])/(a[2+c]-a[c])-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)}}}(),CE.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 u=0;u<2;++u){var c=a[u],h=a[u+2]-c,f=.5*(o[u+2]+o[u]),p=o[u+2]-o[u],d=l[u],g=l[u+2]-d,v=s[u],m=s[u+2]-v;e[u]=2*h/p*g/m,t[u]=2*(c-f)/p*g/m}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()}}(),CE.update=function(t){var e,r,n,i,a,o=[],s=t.ticks,l=t.bounds;for(a=0;a<2;++a){var u=[Math.floor(o.length/3)],c=[-1/0],h=s[a];for(e=0;ei||n[1]<0||n[1]>i)throw new Error("gl-texture2d: Invalid texture size");var a=jE(n,e.stride.slice()),o=0;"float32"===r?o=t.FLOAT:"float64"===r?(o=t.FLOAT,a=!1,r="float32"):"uint8"===r?o=t.UNSIGNED_BYTE:(o=t.UNSIGNED_BYTE,a=!1,r="uint8");var s,l,u=0;if(2===n.length)u=t.LUMINANCE,n=[n[0],n[1],1],e=wb(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])u=t.ALPHA;else if(2===n[2])u=t.LUMINANCE_ALPHA;else if(3===n[2])u=t.RGB;else{if(4!==n[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");u=t.RGBA}}o!==t.FLOAT||t.getExtension("OES_texture_float")||(o=t.UNSIGNED_BYTE,a=!1);var c=e.size;if(a)s=0===e.offset&&e.data.length===c?e.data:e.data.subarray(e.offset,e.offset+c);else{var h=[n[2],n[2]*n[0],1];l=__.malloc(c,r);var f=wb(l,n,h,0);"float32"!==r&&"float64"!==r||o!==t.UNSIGNED_BYTE?ib.assign(f,e):RE(f,e),s=l.subarray(0,c)}var p=VE(t);t.texImage2D(t.TEXTURE_2D,0,u,n[0],n[1],0,u,o,s),a||__.free(l);return new BE(t,p,n[0],n[1],u,o)}(t,e)}throw new Error("gl-texture2d: Invalid arguments for texture2d constructor")},PE=null,IE=null,DE=null;function OE(t){return"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement||"undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement||"undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement||"undefined"!=typeof ImageData&&t instanceof ImageData}var RE=function(t,e){ib.muls(t,e,255)};function FE(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 BE(t,e,r,n,i,a){this.gl=t,this.handle=e,this.format=i,this.type=a,this._shape=[r,n],this._mipLevels=[0],this._magFilter=t.NEAREST,this._minFilter=t.NEAREST,this._wrapS=t.CLAMP_TO_EDGE,this._wrapT=t.CLAMP_TO_EDGE,this._anisoSamples=1;var o=this,s=[this._wrapS,this._wrapT];Object.defineProperties(s,[{get:function(){return o._wrapS},set:function(t){return o.wrapS=t}},{get:function(){return o._wrapT},set:function(t){return o.wrapT=t}}]),this._wrapVector=s;var l=[this._shape[0],this._shape[1]];Object.defineProperties(l,[{get:function(){return o._shape[0]},set:function(t){return o.width=t}},{get:function(){return o._shape[1]},set:function(t){return o.height=t}}]),this._shapeVector=l}var NE=BE.prototype;function jE(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 VE(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 UE(t,e,r,n,i){var a=t.getParameter(t.MAX_TEXTURE_SIZE);if(e<0||e>a||r<0||r>a)throw new Error("gl-texture2d: Invalid texture shape");if(i===t.FLOAT&&!t.getExtension("OES_texture_float"))throw new Error("gl-texture2d: Floating point textures not supported on this platform");var o=VE(t);return t.texImage2D(t.TEXTURE_2D,0,n,e,r,0,n,i,null),new BE(t,o,e,r,n,i)}Object.defineProperties(NE,{minFilter:{get:function(){return this._minFilter},set:function(t){this.bind();var e=this.gl;if(this.type===e.FLOAT&&PE.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),IE.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&&PE.indexOf(t)>=0&&(e.getExtension("OES_texture_float_linear")||(t=e.NEAREST)),IE.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(),DE.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(),DE.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(DE.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 FE(this,0|t[0],0|t[1]),[0|t[0],0|t[1]]}},width:{get:function(){return this._shape[0]},set:function(t){return FE(this,t|=0,this._shape[1]),t}},height:{get:function(){return this._shape[1]},set:function(t){return t|=0,FE(this,this._shape[0],t),t}}}),NE.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},NE.dispose=function(){this.gl.deleteTexture(this.handle)},NE.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)},NE.setPixels=function(t,e,r,n){var i=this.gl;this.bind(),Array.isArray(e)?(n=r,r=0|e[1],e=0|e[0]):(e=e||0,r=r||0),n=n||0;var a=OE(t)?t:t.raw;if(a){this._mipLevels.indexOf(n)<0?(i.texImage2D(i.TEXTURE_2D,0,this.format,this.format,this.type,a),this._mipLevels.push(n)):i.texSubImage2D(i.TEXTURE_2D,n,e,r,this.format,this.type,a)}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]>>>n||r+t.shape[0]>this._shape[0]>>>n||e<0||r<0)throw new Error("gl-texture2d: Texture dimensions are out of bounds");!function(t,e,r,n,i,a,o,s){var l=s.dtype,u=s.shape.slice();if(u.length<2||u.length>3)throw new Error("gl-texture2d: Invalid ndarray, must be 2d or 3d");var c=0,h=0,f=jE(u,s.stride.slice());"float32"===l?c=t.FLOAT:"float64"===l?(c=t.FLOAT,f=!1,l="float32"):"uint8"===l?c=t.UNSIGNED_BYTE:(c=t.UNSIGNED_BYTE,f=!1,l="uint8");if(2===u.length)h=t.LUMINANCE,u=[u[0],u[1],1],s=wb(s.data,u,[s.stride[0],s.stride[1],1],s.offset);else{if(3!==u.length)throw new Error("gl-texture2d: Invalid shape for texture");if(1===u[2])h=t.ALPHA;else if(2===u[2])h=t.LUMINANCE_ALPHA;else if(3===u[2])h=t.RGB;else{if(4!==u[2])throw new Error("gl-texture2d: Invalid shape for pixel coords");h=t.RGBA}u[2]}h!==t.LUMINANCE&&h!==t.ALPHA||i!==t.LUMINANCE&&i!==t.ALPHA||(h=i);if(h!==i)throw new Error("gl-texture2d: Incompatible texture format for setPixels");var p=s.size,d=o.indexOf(n)<0;d&&o.push(n);if(c===a&&f)0===s.offset&&s.data.length===p?d?t.texImage2D(t.TEXTURE_2D,n,i,u[0],u[1],0,i,a,s.data):t.texSubImage2D(t.TEXTURE_2D,n,e,r,u[0],u[1],i,a,s.data):d?t.texImage2D(t.TEXTURE_2D,n,i,u[0],u[1],0,i,a,s.data.subarray(s.offset,s.offset+p)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,u[0],u[1],i,a,s.data.subarray(s.offset,s.offset+p));else{var g;g=a===t.FLOAT?__.mallocFloat32(p):__.mallocUint8(p);var v=wb(g,u,[u[2],u[2]*u[0],1]);c===t.FLOAT&&a===t.UNSIGNED_BYTE?RE(v,s):ib.assign(v,s),d?t.texImage2D(t.TEXTURE_2D,n,i,u[0],u[1],0,i,a,g.subarray(0,p)):t.texSubImage2D(t.TEXTURE_2D,n,e,r,u[0],u[1],i,a,g.subarray(0,p)),a===t.FLOAT?__.freeFloat32(g):__.freeUint8(g)}}(i,e,r,n,this.format,this.type,this._mipLevels,t)}};var qE,HE,GE,WE,YE=function(t,e,r,n){qE||(qE=t.FRAMEBUFFER_UNSUPPORTED,HE=t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT,GE=t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS,WE=t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT);var i=t.getExtension("WEBGL_draw_buffers");!XE&&i&&function(t,e){var r=t.getParameter(e.MAX_COLOR_ATTACHMENTS_WEBGL);XE=new Array(r+1);for(var n=0;n<=r;++n){for(var i=new Array(r),a=0;aa||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,l=t.getExtension("OES_texture_float");if(n.float&&o>0){if(!l)throw new Error("gl-fbo: Context does not support floating point textures");s=t.FLOAT}else n.preferFloat&&o>0&&l&&(s=t.FLOAT);var u=!0;"depth"in n&&(u=!!n.depth);var c=!1;"stencil"in n&&(c=!!n.stencil);return new tC(t,e,r,s,o,u,c,i)},XE=null;function ZE(t){return[t.getParameter(t.FRAMEBUFFER_BINDING),t.getParameter(t.RENDERBUFFER_BINDING),t.getParameter(t.TEXTURE_BINDING_2D)]}function JE(t,e){t.bindFramebuffer(t.FRAMEBUFFER,e[0]),t.bindRenderbuffer(t.RENDERBUFFER,e[1]),t.bindTexture(t.TEXTURE_2D,e[2])}function KE(t){switch(t){case qE:throw new Error("gl-fbo: Framebuffer unsupported");case HE:throw new Error("gl-fbo: Framebuffer incomplete attachment");case GE:throw new Error("gl-fbo: Framebuffer incomplete dimensions");case WE:throw new Error("gl-fbo: Framebuffer incomplete missing attachment");default:throw new Error("gl-fbo: Framebuffer failed for unspecified reason")}}function QE(t,e,r,n,i,a){if(!n)return null;var o=zE(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 $E(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 tC(t,e,r,n,i,a,o,s){this.gl=t,this._shape=[0|e,0|r],this._destroyed=!1,this._ext=s,this.color=new Array(i);for(var l=0;l1&&s.drawBuffersWEBGL(XE[o]);var f=r.getExtension("WEBGL_depth_texture");f?l?t.depth=QE(r,i,a,f.UNSIGNED_INT_24_8_WEBGL,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):u&&(t.depth=QE(r,i,a,r.UNSIGNED_SHORT,r.DEPTH_COMPONENT,r.DEPTH_ATTACHMENT)):u&&l?t._depth_rb=$E(r,i,a,r.DEPTH_STENCIL,r.DEPTH_STENCIL_ATTACHMENT):u?t._depth_rb=$E(r,i,a,r.DEPTH_COMPONENT16,r.DEPTH_ATTACHMENT):l&&(t._depth_rb=$E(r,i,a,r.STENCIL_INDEX,r.STENCIL_ATTACHMENT));var p=r.checkFramebufferStatus(r.FRAMEBUFFER);if(p!==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),h=0;hi||r<0||r>i)throw new Error("gl-fbo: Can't resize FBO, invalid dimensions");t._shape[0]=e,t._shape[1]=r;for(var a=ZE(n),o=0;othis.buffer.length){__.free(this.buffer);for(var n=this.buffer=__.mallocUint8(iC(r*e*4)),i=0;i=0){var g=e[d]-n[d]*(e[d+2]-e[d])/(n[d+2]-n[d]);0===d?o.drawLine(g,e[1],g,e[3],p[d],f[d]):o.drawLine(e[0],g,e[2],g,p[d],f[d])}}for(d=0;d=0;--t)this.objects[t].dispose();this.objects.length=0;for(t=this.overlays.length-1;t>=0;--t)this.overlays[t].dispose();this.overlays.length=0,this.gl=null},cC.addObject=function(t){this.objects.indexOf(t)<0&&(this.objects.push(t),this.setDirty())},cC.removeObject=function(t){for(var e=this.objects,r=0;r0){var m=r*c;o.drawBox(h-m,f-m,p+m,f+m,a),o.drawBox(h-m,d-m,p+m,d+m,a),o.drawBox(h-m,f-m,h+m,d+m,a),o.drawBox(p-m,f-m,p+m,d+m,a)}}}},vC.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()},vC.dispose=function(){this.boxBuffer.dispose(),this.boxShader.dispose(),this.plot.removeOverlay(this)};var mC=function(t,e){var r=new yC(t);return r.update(e),t.addOverlay(r),r};function yC(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]}var xC=yC.prototype;xC.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()},xC.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]),u=s[1]+(n[1]-o[1])/(o[3]-o[1])*(s[3]-s[1]);t[0]&&a.drawLine(l,u,s[0],u,e[0],r[0]),t[1]&&a.drawLine(l,u,l,s[1],e[1],r[1]),t[2]&&a.drawLine(l,u,s[2],u,e[2],r[2]),t[3]&&a.drawLine(l,u,l,s[3],e[3],r[3])}},xC.dispose=function(){this.plot.removeOverlay(this)};var bC=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=0;){var n=t.indexOf(";",r);if(n/g,"")}(function(t){for(var e=0;(e=t.indexOf("",e))>=0;){var r=t.indexOf("",e);if(r/g,"\n"))))},kC=function(){},TC=function(t){for(var e in t)"function"==typeof t[e]&&(t[e]=kC);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=Oe.defaults[0],t.container.appendChild(r),t.container.style.background="#FFFFFF",t.container.onclick=function(){window.open("http://get.webgl.org")},!1},SC={};function EC(t){return t.target||t.srcElement||window}SC.buttons=function(t){if("object"==typeof t){if("buttons"in t)return t.buttons;if("which"in t){if(2===(e=t.which))return 4;if(3===e)return 2;if(e>0)return 1<=0)return 1<Math.abs(l)?(n.boxEnd[1]=n.boxStart[1]+Math.abs(s)*b*(l>=0?1:-1),n.boxEnd[1]u[3]&&(n.boxEnd[1]=u[3],n.boxEnd[0]=n.boxStart[0]+(u[3]-n.boxStart[1])/Math.abs(b))):(n.boxEnd[0]=n.boxStart[0]+Math.abs(l)/b*(s>=0?1:-1),n.boxEnd[0]u[2]&&(n.boxEnd[0]=u[2],n.boxEnd[1]=n.boxStart[1]+(u[2]-n.boxStart[0])*Math.abs(b)))}}else n.boxEnabled?(s=n.boxStart[0]!==n.boxEnd[0],l=n.boxStart[1]!==n.boxEnd[1],s||l?(s&&(g(0,n.boxStart[0],n.boxEnd[0]),t.xaxis.autorange=!1),l&&(g(1,n.boxStart[1],n.boxEnd[1]),t.yaxis.autorange=!1),t.relayoutCallback()):t.glplot.setDirty(),n.boxEnabled=!1,n.boxInited=!1):n.boxInited&&(n.boxInited=!1);break;case"pan":n.boxEnabled=!1,n.boxInited=!1,e?(n.panning||(n.dragStart[0]=a,n.dragStart[1]=o),Math.abs(n.dragStart[0]-a)r?r:t:te?e:t};var BC={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]},NC=function(){for(var t=0;t10&&/[0-9](?:\s|\/)/.test(r)&&(a=r.match(/([0-9]+)/g).map(function(t){return parseFloat(t)}),i=r.match(/([a-z])/gi).join("").toLowerCase());else if("number"==typeof r)i="rgb",a=[r>>>16,(65280&r)>>>8,255&r];else if(VC(r)){var h=NC(r.r,r.red,r.R,null);null!==h?(i="rgb",a=[h,NC(r.g,r.green,r.G),NC(r.b,r.blue,r.B)]):(i="hsl",a=[NC(r.h,r.hue,r.H),NC(r.s,r.saturation,r.S),NC(r.l,r.lightness,r.L,r.b,r.brightness)]),o=NC(r.a,r.alpha,r.opacity,1),null!=r.opacity&&(o/=100)}else(Array.isArray(r)||t.ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(r))&&(a=[r[0],r[1],r[2]],i="rgb",o=4===r.length?r[3]:1);return{space:i,values:a,alpha:o}};var e={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:{});var qC=function(t){var e,r,n,i,a,o=t[0]/360,s=t[1]/100,l=t[2]/100;if(0===s)return[a=255*l,a,a];e=2*l-(r=l<.5?l*(1+s):l+s-l*s),i=[0,0,0];for(var u=0;u<3;u++)(n=o+1/3*-(u-1))<0?n++:n>1&&n--,a=6*n<1?e+6*(r-e)*n:2*n<1?r:3*n<2?e+(r-e)*(2/3-n)*6:e,i[u]=255*a;return i},HC=function(t){switch(t){case"int8":return Int8Array;case"int16":return Int16Array;case"int32":return Int32Array;case"uint8":return Uint8Array;case"uint16":return Uint16Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;case"array":return Array;case"uint8_clamped":return Uint8ClampedArray}},GC=function(t,e){"float"!==e&&e||(e="array"),"uint"===e&&(e="uint8"),"uint_clamped"===e&&(e="uint8_clamped");var r=HC(e),n=new r(4);if(t instanceof r)return Array.isArray(t)?t.slice():(n.set(t),n);var i="uint8"!==e&&"uint8_clamped"!==e;return t instanceof Uint8Array||t instanceof Uint8ClampedArray?(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=null!=t[3]?t[3]:255,i&&(n[0]/=255,n[1]/=255,n[2]/=255,n[3]/=255),n):(t.length&&"string"!=typeof t||((t=function(t){var e;if("string"!=typeof t)throw Error("Argument should be a string");var r=UC(t);return r.space?((e=Array(3))[0]=FC(r.values[0],0,255),e[1]=FC(r.values[1],0,255),e[2]=FC(r.values[2],0,255),"h"===r.space[0]&&(e=qC(e)),e.push(FC(r.alpha,0,1)),e):[]}(t))[0]/=255,t[1]/=255,t[2]/=255),i?(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=null!=t[3]?t[3]:1):(n[0]=FC(Math.round(255*t[0]),0,255),n[1]=FC(Math.round(255*t[1]),0,255),n[2]=FC(Math.round(255*t[2]),0,255),n[3]=null==t[3]?255:FC(Math.floor(255*t[3]),0,255)),n)};var WC=function(t){return t?GC(t):[0,0,0,1]};function YC(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 XC=YC.prototype,ZC=["xaxis","yaxis"];XC.merge=function(t){var e,r,n,i,a,o,s,l,u,c,h;for(this.titleEnable=!1,this.backgroundColor=WC(t.plot_bgcolor),c=0;c<2;++c){var f=(e=ZC[c]).charAt(0);for(n=(r=t[this.scene[e]._name]).title===this.scene.fullLayout._dfltTitle[f]?"":r.title,h=0;h<=2;h+=2)this.labelEnable[c+h]=!1,this.labels[c+h]=AC(n),this.labelColor[c+h]=WC(r.titlefont.color),this.labelFont[c+h]=r.titlefont.family,this.labelSize[c+h]=r.titlefont.size,this.labelPad[c+h]=this.getLabelPad(e,r),this.tickEnable[c+h]=!1,this.tickColor[c+h]=WC((r.tickfont||{}).color),this.tickAngle[c+h]="auto"===r.tickangle?0:Math.PI*-r.tickangle/180,this.tickPad[c+h]=this.getTickPad(r),this.tickMarkLength[c+h]=0,this.tickMarkWidth[c+h]=r.tickwidth||0,this.tickMarkColor[c+h]=WC(r.tickcolor),this.borderLineEnable[c+h]=!1,this.borderLineColor[c+h]=WC(r.linecolor),this.borderLineWidth[c+h]=r.linewidth||0;s=this.hasSharedAxis(r),a=this.hasAxisInDfltPos(e,r)&&!s,o=this.hasAxisInAltrPos(e,r)&&!s,i=r.mirror||!1,l=s?-1!==String(i).indexOf("all"):!!i,u=s?"allticks"===i:-1!==String(i).indexOf("ticks"),a?this.labelEnable[c]=!0:o&&(this.labelEnable[c+2]=!0),a?this.tickEnable[c]=r.showticklabels:o&&(this.tickEnable[c+2]=r.showticklabels),(a||l)&&(this.borderLineEnable[c]=r.showline),(o||l)&&(this.borderLineEnable[c+2]=r.showline),(a||u)&&(this.tickMarkLength[c]=this.getTickMarkLength(r)),(o||u)&&(this.tickMarkLength[c+2]=this.getTickMarkLength(r)),this.gridLineEnable[c]=r.showgrid,this.gridLineColor[c]=WC(r.gridcolor),this.gridLineWidth[c]=r.gridwidth,this.zeroLineEnable[c]=r.zeroline,this.zeroLineColor[c]=WC(r.zerolinecolor),this.zeroLineWidth[c]=r.zerolinewidth}},XC.hasSharedAxis=function(t){var e=this.scene,r=e.fullLayout._subplots.gl2d;return 0!==ri.findSubplotsWithAxis(r,t).indexOf(e.id)},XC.hasAxisInDfltPos=function(t,e){var r=e.side;return"xaxis"===t?"bottom"===r:"yaxis"===t?"left"===r:void 0},XC.hasAxisInAltrPos=function(t,e){var r=e.side;return"xaxis"===t?"top"===r:"yaxis"===t?"right"===r:void 0},XC.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},XC.getTickPad=function(t){return"outside"===t.ticks?10+t.ticklen:15},XC.getTickMarkLength=function(t){if(!t.ticks)return 0;var e=t.ticklen;return"inside"===t.ticks?-e:e};var JC,KC,QC=function(t){return new YC(t)},$C=Gm.enforce,tL=Gm.clean,eL=Nn,rL=["xaxis","yaxis"],nL=Te.SUBPLOT_PATTERN;function iL(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=QC(this),this.glplotOptions.merge(e),this.glplot=lC(this.glplotOptions),this.camera=RC(this),this.traces={},this.spikes=mC(this.glplot),this.selectBox=dC(this.glplot,{innerFill:!1,outerFill:!0}),this.lastButtonState=0,this.pickResult=null,this.isMouseOver=!0,this.stopped=!1,this.redraw=this.draw.bind(this),this.redraw()}var aL=iL,oL=iL.prototype;oL.makeFramework=function(){if(this.staticPlot){if(!(KC||(JC=document.createElement("canvas"),KC=_C({canvas:JC,preserveDrawingBuffer:!1,premultipliedAlpha:!0,antialias:!0}))))throw new Error("Error creating static canvas/context for image server");this.canvas=JC,this.gl=KC}else{var t=this.container.querySelector(".gl-canvas-focus"),e=_C({canvas:t,preserveDrawingBuffer:!0,premultipliedAlpha:!0});e||TC(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 i=this.mouseContainer=document.createElement("div");i.style.position="absolute",i.style["pointer-events"]="auto",this.pickCanvas=this.container.querySelector(".gl-canvas-pick");var a=this.container;a.appendChild(n),a.appendChild(i);var o=this;i.addEventListener("mouseout",function(){o.isMouseOver=!1,o.unhover()}),i.addEventListener("mouseover",function(){o.isMouseOver=!0})},oL.toImage=function(t){t||(t="png"),this.stopped=!0,this.staticPlot&&this.container.appendChild(JC),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 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>>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 xL(t,e,r,n){return new Function([yL("A","x"+t+"y",e,["y"],n),yL("P","c(x,y)"+t+"0",e,["y","c"],n),"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(""))()}var bL={ge:xL(">=",!1,"GE"),gt:xL(">",!1,"GT"),lt:xL("<",!0,"LT"),le:xL("<=",!0,"LE"),eq:xL("-",!0,"EQ",!0)},_L=function(t,e){var r=t.gl,n=Bw(r,mL.vertex,mL.fragment),i=Bw(r,mL.pickVertex,mL.pickFragment),a=S_(r),o=S_(r),s=S_(r),l=S_(r),u=new wL(t,n,i,a,o,s,l);return u.update(e),t.addObject(u),u};function wL(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}var ML,AL=wL.prototype,kL=[0,0,1,0,0,1,1,0,1,1,0,1];function TL(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=_L(t.glplot,this.options),this.heatmap._trace=this}AL.draw=(ML=[1,0,0,0,1,0,0,0,1],function(){var t=this.plot,e=this.shader,r=this.bounds,n=this.numVertices;if(!(n<=0)){var i=t.gl,a=t.dataBox,o=r[2]-r[0],s=r[3]-r[1],l=a[2]-a[0],u=a[3]-a[1];ML[0]=2*o/l,ML[4]=2*s/u,ML[6]=2*(r[0]-a[0])/l-1,ML[7]=2*(r[1]-a[1])/u-1,e.bind();var c=e.uniforms;c.viewTransform=ML,c.shape=this.shape;var h=e.attributes;this.positionBuffer.bind(),h.position.pointer(),this.weightBuffer.bind(),h.weight.pointer(i.UNSIGNED_BYTE,!1),this.colorBuffer.bind(),h.color.pointer(i.UNSIGNED_BYTE,!0),i.drawArrays(i.TRIANGLES,0,n)}}),AL.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,u=a[2]-a[0],c=a[3]-a[1],h=l[2]-l[0],f=l[3]-l[1];t[0]=2*u/h,t[4]=2*c/f,t[6]=2*(a[0]-l[0])/h-1,t[7]=2*(a[1]-l[1])/f-1;for(var p=0;p<4;++p)e[p]=r>>8*p&255;this.pickOffset=r,i.bind();var d=i.uniforms;d.viewTransform=t,d.pickOffset=e,d.shape=this.shape;var g=i.attributes;return this.positionBuffer.bind(),g.position.pointer(),this.weightBuffer.bind(),g.weight.pointer(s.UNSIGNED_BYTE,!1),this.idBuffer.bind(),g.pickId.pointer(s.UNSIGNED_BYTE,!1),s.drawArrays(s.TRIANGLES,0,o),r+this.shape[0]*this.shape[1]}}}(),AL.pick=function(t,e,r){var n=this.pickOffset,i=this.shape[0]*this.shape[1];if(r=n+i)return null;var a=r-n,o=this.xData,s=this.yData;return{object:this,pointId:a,dataCoord:[o[a%this.shape[0]],s[a/this.shape[0]|0]]}},AL.update=function(t){var e=(t=t||{}).shape||[0,0],r=t.x||db(e[0]),n=t.y||db(e[1]),i=t.z||new Float32Array(e[0]*e[1]);this.xData=r,this.yData=n;var a=t.colorLevels||[0],o=t.colorValues||[0,0,0,1],s=a.length,l=this.bounds,u=l[0]=r[0],c=l[1]=n[0],h=1/((l[2]=r[r.length-1])-u),f=1/((l[3]=n[n.length-1])-c),p=e[0],d=e[1];this.shape=[p,d];var g=(p-1)*(d-1)*(kL.length>>>1);this.numVertices=g;for(var v=__.mallocUint8(4*g),m=__.mallocFloat32(2*g),y=__.mallocUint8(2*g),x=__.mallocUint32(g),b=0,_=0;_u.size/1.9?u.size:u.size/Math.ceil(u.size/g);var _=u.start+(u.size-g)/2;v=_-g*Math.ceil((_-v)/g)}for(o=0;o=0&&p=0;n--)s(n);else if("increasing"===e){for(n=1;n=0;n--)t[n]+=t[n+1];"exclude"===r&&(t.push(0),t.shift())}}(a,c.direction,c.currentbin);var j=Math.min(i.length,a.length),V=[],U=0,q=j-1;for(n=0;n=U;n--)if(a[n]){q=n;break}for(n=U;n<=q;n++)if(r(i[n])&&r(a[n])){var H={p:i[n],s:a[n],b:0};c.enabled||(H.pts=w[n],O?H.p0=H.p1=w[n].length?v[w[n][0]]:i[n]:(H.p0=I(y[n]),H.p1=I(y[n+1],!0))),V.push(H)}return 1===V.length&&(V[0].width1=ri.tickIncrement(V[0].p,g.size,!1,u)-V[0].p),ma(V,e),ne.isArrayOrTypedArray(e.selectedpoints)&&ne.tagSelected(V,e,B),V}},UL.setPositions=Vo,UL.plot=Lo,UL.style=$o,UL.colorbar=is,UL.hoverPoints=function(t,e,r,n){var i=_o(t,e,r,n);if(i){var a=(t=i[0]).cd[t.index],o=t.cd[0].trace;if(!o.cumulative.enabled){var s="h"===o.orientation?"y":"x";t[s+"Label"]=VL(t[s+"a"],a.p0,a.p1)}return i}},UL.selectPoints=Oo,UL.eventData=jL,UL.moduleType="trace",UL.name="histogram",UL.basePlotModule=ua,UL.categories=["cartesian","bar","histogram","oriented","errorBarsOK","showLegend"],UL.meta={};var qL=UL,HL=m.extendFlat,GL=HL({},{x:zL.x,y:zL.y,z:{valType:"data_array",editType:"calc"},marker:{color:{valType:"data_array",editType:"calc"},editType:"calc"},histnorm:zL.histnorm,histfunc:zL.histfunc,autobinx:zL.autobinx,nbinsx:zL.nbinsx,xbins:zL.xbins,autobiny:zL.autobiny,nbinsy:zL.nbinsy,ybins:zL.ybins,xgap:Lh.xgap,ygap:Lh.ygap,zsmooth:Lh.zsmooth,zhoverformat:Lh.zhoverformat},Pe,{autocolorscale:HL({},Pe.autocolorscale,{dflt:!1})},{colorbar:ze}),WL=function(t,e,r,n){var i=r("x"),a=r("y");if(i&&i.length&&a&&a.length){P.getComponentMethod("calendars","handleTraceDefaults")(t,e,["x","y"],n),(r("z")||r("marker.color"))&&r("histfunc");NL(0,e,r,["x","y"])}else e.visible=!1},YL=ri.hoverLabelText,XL={};XL.attributes=GL,XL.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,GL,r,n)}WL(t,e,i,n),!1!==e.visible&&(Xx(0,0,i),Ye(t,e,n,i,{prefix:"",cLetter:"z"}))},XL.calc=bf,XL.plot=$f,XL.colorbar=kh,XL.style=up,XL.hoverPoints=function(t,e,r,n,i,a){var o=Rf(t,e,r,0,0,a);if(o){var s=(t=o[0]).index,l=s[0],u=s[1],c=t.cd[0],h=c.xRanges[u],f=c.yRanges[l];return t.xLabel=YL(t.xa,h[0],h[1]),t.yLabel=YL(t.ya,f[0],f[1]),o}},XL.eventData=jL,XL.moduleType="trace",XL.name="histogram2d",XL.basePlotModule=ua,XL.categories=["cartesian","2dMap","histogram"],XL.meta={};var ZL=XL,JL=m.extendFlat,KL=JL({x:GL.x,y:GL.y,z:GL.z,marker:GL.marker,histnorm:GL.histnorm,histfunc:GL.histfunc,autobinx:GL.autobinx,nbinsx:GL.nbinsx,xbins:GL.xbins,autobiny:GL.autobiny,nbinsy:GL.nbinsy,ybins:GL.ybins,autocontour:Rh.autocontour,ncontours:Rh.ncontours,contours:Rh.contours,line:Rh.line,zhoverformat:GL.zhoverformat},Pe,{zmin:JL({},Pe.zmin,{editType:"calc"}),zmax:JL({},Pe.zmax,{editType:"calc"})},{colorbar:ze}),QL={};QL.attributes=KL,QL.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,KL,r,n)}WL(t,e,i,n),!1!==e.visible&&(zf(0,e,i,function(r){return ne.coerce2(t,e,KL,r)}),Pf(t,e,i,n))},QL.calc=_f,QL.plot=ip.plot,QL.style=cp,QL.colorbar=Af,QL.hoverPoints=Ff,QL.moduleType="trace",QL.name="histogram2dcontour",QL.basePlotModule=ua,QL.categories=["cartesian","2dMap","contour","histogram"],QL.meta={};var $L=QL,tz=m.extendFlat,ez=(0,ye.overrideAll)({visible:Ce.visible,showspikes:{valType:"boolean",dflt:!0},spikesides:{valType:"boolean",dflt:!0},spikethickness:{valType:"number",min:0,dflt:2},spikecolor:{valType:"color",dflt:Oe.defaultLine},showbackground:{valType:"boolean",dflt:!1},backgroundcolor:{valType:"color",dflt:"rgba(204, 204, 204, 0.5)"},showaxeslabels:{valType:"boolean",dflt:!0},color:Ce.color,categoryorder:Ce.categoryorder,categoryarray:Ce.categoryarray,title:Ce.title,titlefont:Ce.titlefont,type:Ce.type,autorange:Ce.autorange,rangemode:Ce.rangemode,range:Ce.range,tickmode:Ce.tickmode,nticks:Ce.nticks,tick0:Ce.tick0,dtick:Ce.dtick,tickvals:Ce.tickvals,ticktext:Ce.ticktext,ticks:Ce.ticks,mirror:Ce.mirror,ticklen:Ce.ticklen,tickwidth:Ce.tickwidth,tickcolor:Ce.tickcolor,showticklabels:Ce.showticklabels,tickfont:Ce.tickfont,tickangle:Ce.tickangle,tickprefix:Ce.tickprefix,showtickprefix:Ce.showtickprefix,ticksuffix:Ce.ticksuffix,showticksuffix:Ce.showticksuffix,showexponent:Ce.showexponent,exponentformat:Ce.exponentformat,separatethousands:Ce.separatethousands,tickformat:Ce.tickformat,tickformatstops:Ce.tickformatstops,hoverformat:Ce.hoverformat,showline:Ce.showline,linecolor:Ce.linecolor,linewidth:Ce.linewidth,showgrid:Ce.showgrid,gridcolor:tz({},Ce.gridcolor,{dflt:"rgb(204, 204, 204)"}),gridwidth:Ce.gridwidth,zeroline:Ce.zeroline,zerolinecolor:Ce.zerolinecolor,zerolinewidth:Ce.zerolinewidth},"plot","from-root"),rz=s.mix,nz=["xaxis","yaxis","zaxis"],iz=function(t,e,r){var n,i;function a(t,e){return ne.coerce(n,i,ez,t,e)}for(var o=0;o0&&(a=1/Math.sqrt(a),t[0]=e[0]*a,t[1]=e[1]*a,t[2]=e[2]*a);return t};var xz=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],u=t[8],c=t[9],h=t[10],f=t[11],p=t[12],d=t[13],g=t[14],v=t[15];return(e*o-r*a)*(h*v-f*g)-(e*s-n*a)*(c*v-f*d)+(e*l-i*a)*(c*g-h*d)+(r*s-n*o)*(u*v-f*p)-(r*l-i*o)*(u*g-h*p)+(n*l-i*s)*(u*d-c*p)};var bz=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};var _z=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};var wz=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};var Mz=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};var Az=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};var kz=function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]};var Tz={length:function(t){var e=t[0],r=t[1],n=t[2];return Math.sqrt(e*e+r*r+n*n)},normalize:yz,dot:kz,cross:Az},Sz=wz(),Ez=wz(),Cz=[0,0,0,0],Lz=[[0,0,0],[0,0,0],[0,0,0]],zz=[0,0,0],Pz=function(t,e,r,n,i,a){if(e||(e=[0,0,0]),r||(r=[0,0,0]),n||(n=[0,0,0]),i||(i=[0,0,0,1]),a||(a=[0,0,0,1]),!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}(Sz,t))return!1;if(_z(Ez,Sz),Ez[3]=0,Ez[7]=0,Ez[11]=0,Ez[15]=1,Math.abs(xz(Ez)<1e-8))return!1;var o,s,l,u,c,h,f,p=Sz[3],d=Sz[7],g=Sz[11],v=Sz[12],m=Sz[13],y=Sz[14],x=Sz[15];if(0!==p||0!==d||0!==g){if(Cz[0]=p,Cz[1]=d,Cz[2]=g,Cz[3]=x,!cz(Ez,Ez))return!1;Mz(Ez,Ez),o=i,l=Ez,u=(s=Cz)[0],c=s[1],h=s[2],f=s[3],o[0]=l[0]*u+l[4]*c+l[8]*h+l[12]*f,o[1]=l[1]*u+l[5]*c+l[9]*h+l[13]*f,o[2]=l[2]*u+l[6]*c+l[10]*h+l[14]*f,o[3]=l[3]*u+l[7]*c+l[11]*h+l[15]*f}else i[0]=i[1]=i[2]=0,i[3]=1;if(e[0]=v,e[1]=m,e[2]=y,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]}(Lz,Sz),r[0]=Tz.length(Lz[0]),Tz.normalize(Lz[0],Lz[0]),n[0]=Tz.dot(Lz[0],Lz[1]),Iz(Lz[1],Lz[1],Lz[0],1,-n[0]),r[1]=Tz.length(Lz[1]),Tz.normalize(Lz[1],Lz[1]),n[0]/=r[1],n[1]=Tz.dot(Lz[0],Lz[2]),Iz(Lz[2],Lz[2],Lz[0],1,-n[1]),n[2]=Tz.dot(Lz[1],Lz[2]),Iz(Lz[2],Lz[2],Lz[1],1,-n[2]),r[2]=Tz.length(Lz[2]),Tz.normalize(Lz[2],Lz[2]),n[1]/=r[2],n[2]/=r[2],Tz.cross(zz,Lz[1],Lz[2]),Tz.dot(Lz[0],zz)<0)for(var b=0;b<3;b++)r[b]*=-1,Lz[b][0]*=-1,Lz[b][1]*=-1,Lz[b][2]*=-1;return a[0]=.5*Math.sqrt(Math.max(1+Lz[0][0]-Lz[1][1]-Lz[2][2],0)),a[1]=.5*Math.sqrt(Math.max(1-Lz[0][0]+Lz[1][1]-Lz[2][2],0)),a[2]=.5*Math.sqrt(Math.max(1-Lz[0][0]-Lz[1][1]+Lz[2][2],0)),a[3]=.5*Math.sqrt(Math.max(1+Lz[0][0]+Lz[1][1]+Lz[2][2],0)),Lz[2][1]>Lz[1][2]&&(a[0]=-a[0]),Lz[0][2]>Lz[2][0]&&(a[1]=-a[1]),Lz[1][0]>Lz[0][1]&&(a[2]=-a[2]),!0};function Iz(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 Dz=function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=e[4],l=e[5],u=e[6],c=e[7],h=e[8],f=e[9],p=e[10],d=e[11],g=e[12],v=e[13],m=e[14],y=e[15],x=r[0],b=r[1],_=r[2],w=r[3];return t[0]=x*n+b*s+_*h+w*g,t[1]=x*i+b*l+_*f+w*v,t[2]=x*a+b*u+_*p+w*m,t[3]=x*o+b*c+_*d+w*y,x=r[4],b=r[5],_=r[6],w=r[7],t[4]=x*n+b*s+_*h+w*g,t[5]=x*i+b*l+_*f+w*v,t[6]=x*a+b*u+_*p+w*m,t[7]=x*o+b*c+_*d+w*y,x=r[8],b=r[9],_=r[10],w=r[11],t[8]=x*n+b*s+_*h+w*g,t[9]=x*i+b*l+_*f+w*v,t[10]=x*a+b*u+_*p+w*m,t[11]=x*o+b*c+_*d+w*y,x=r[12],b=r[13],_=r[14],w=r[15],t[12]=x*n+b*s+_*h+w*g,t[13]=x*i+b*l+_*f+w*v,t[14]=x*a+b*u+_*p+w*m,t[15]=x*o+b*c+_*d+w*y,t};var Oz={identity:hz,translate:mz,multiply:Dz,create:wz,scale:vz,fromRotationTranslation:function(t,e,r){var n=e[0],i=e[1],a=e[2],o=e[3],s=n+n,l=i+i,u=a+a,c=n*s,h=n*l,f=n*u,p=i*l,d=i*u,g=a*u,v=o*s,m=o*l,y=o*u;return t[0]=1-(p+g),t[1]=h+y,t[2]=f-m,t[3]=0,t[4]=h-y,t[5]=1-(c+g),t[6]=d+v,t[7]=0,t[8]=f+m,t[9]=d-v,t[10]=1-(c+p),t[11]=0,t[12]=r[0],t[13]=r[1],t[14]=r[2],t[15]=1,t}},Rz=(Oz.create(),Oz.create()),Fz=function(t,e,r,n,i,a){return Oz.identity(t),Oz.fromRotationTranslation(t,a,e),t[3]=i[0],t[7]=i[1],t[11]=i[2],t[15]=i[3],Oz.identity(Rz),0!==n[2]&&(Rz[9]=n[2],Oz.multiply(t,t,Rz)),0!==n[1]&&(Rz[9]=0,Rz[8]=n[1],Oz.multiply(t,t,Rz)),0!==n[0]&&(Rz[8]=0,Rz[4]=n[0],Oz.multiply(t,t,Rz)),Oz.scale(t,t,r),t};var Bz=function(t,e,r,n){var i,a,o,s,l,u=e[0],c=e[1],h=e[2],f=e[3],p=r[0],d=r[1],g=r[2],v=r[3];(a=u*p+c*d+h*g+f*v)<0&&(a=-a,p=-p,d=-d,g=-g,v=-v);1-a>1e-6?(i=Math.acos(a),o=Math.sin(i),s=Math.sin((1-n)*i)/o,l=Math.sin(n*i)/o):(s=1-n,l=n);return t[0]=s*u+l*p,t[1]=s*c+l*d,t[2]=s*h+l*g,t[3]=s*f+l*v,t},Nz=qz(),jz=qz(),Vz=qz(),Uz=function(t,e,r,n){if(0===xz(e)||0===xz(r))return!1;var i=Pz(e,Nz.translate,Nz.scale,Nz.skew,Nz.perspective,Nz.quaternion),a=Pz(r,jz.translate,jz.scale,jz.skew,jz.perspective,jz.quaternion);return!(!i||!a||(bz(Vz.translate,Nz.translate,jz.translate,n),bz(Vz.skew,Nz.skew,jz.skew,n),bz(Vz.scale,Nz.scale,jz.scale,n),bz(Vz.perspective,Nz.perspective,jz.perspective,n),Bz(Vz.quaternion,Nz.quaternion,jz.quaternion,n),Fz(t,Vz.translate,Vz.scale,Vz.skew,Vz.perspective,Vz.quaternion),0))};function qz(){return{translate:Hz(),scale:Hz(1),skew:Hz(),perspective:[0,0,0,1],quaternion:[0,0,0,1]}}function Hz(t){return[t||0,t||0,t||0]}var Gz=[0,0,0],Wz=function(t){return new Yz((t=t||{}).matrix||[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])};function Yz(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 Xz=Yz.prototype;Xz.recalcMatrix=function(t){var e=this._time,r=wT.le(e,t),n=this.computedMatrix;if(!(r<0)){var i=this._components;if(r===e.length-1)for(var a=16*r,o=0;o<16;++o)n[o]=i[a++];else{var s=e[r+1]-e[r],l=(a=16*r,this.prevMatrix),u=!0;for(o=0;o<16;++o)l[o]=i[a++];var c=this.nextMatrix;for(o=0;o<16;++o)c[o]=i[a++],u=u&&l[o]===c[o];if(s<1e-6||u)for(o=0;o<16;++o)n[o]=l[o];else Uz(n,l,c,(t-e[r])/s)}var h=this.computedUp;h[0]=n[1],h[1]=n[5],h[2]=n[9],yz(h,h);var f=this.computedInverse;cz(f,n);var p=this.computedEye,d=f[15];p[0]=f[12]/d,p[1]=f[13]/d,p[2]=f[14]/d;var g=this.computedCenter,v=Math.exp(this.computedRadius[0]);for(o=0;o<3;++o)g[o]=p[o]-n[2+4*o]*v}},Xz.idle=function(t){if(!(t=0;--p)a[p]=u*t[p]+c*e[p]+h*r[p]+f*n[p];return a}return u*t+c*e+h*r+f*n}).derivative=function(t,e,r,n,i,a){var o=6*i*i-6*i,s=3*i*i-4*i+1,l=-6*i*i+6*i,u=3*i*i-2*i;if(t.length){a||(a=new Array(t.length));for(var c=t.length-1;c>=0;--c)a[c]=o*t[c]+s*e[c]+l*r[c]+u*n[c];return a}return o*t+s*e+l*r[c]+u*n};var Kz=function(t,e,r){switch(arguments.length){case 0:return new $z([0],[0],0);case 1:if("number"==typeof t){var n=eP(t);return new $z(n,n,0)}return new $z(t,eP(t.length),0);case 2:if("number"==typeof e){var n=eP(t.length);return new $z(t,n,+e)}r=0;case 3:if(t.length!==e.length)throw new Error("state and velocity lengths must match");return new $z(t,e,r)}};function Qz(t,e,r){return Math.min(e,Math.max(t,r))}function $z(t,e,r){this.dimension=t.length,this.bounds=[new Array(this.dimension),new Array(this.dimension)];for(var n=0;n=r-1){u=a.length-1;var h=t-e[r-1];for(c=0;c=r-1)for(var l=a.length-1,u=(e[r-1],0);u=0;--r)if(t[--e])return!1;return!0},tP.jump=function(t){var e=this.lastT(),r=this.dimension;if(!(t0;--c)n.push(Qz(s[c-1],l[c-1],arguments[c])),i.push(0)}},tP.push=function(t){var e=this.lastT(),r=this.dimension;if(!(t1e-6?1/o:0;this._time.push(t);for(var h=r;h>0;--h){var f=Qz(l[h-1],u[h-1],arguments[h]);n.push(f),i.push((f-n[a++])*c)}}},tP.set=function(t){var e=this.dimension;if(!(t0;--s)r.push(Qz(a[s-1],o[s-1],arguments[s])),n.push(0)}},tP.move=function(t){var e=this.lastT(),r=this.dimension;if(!(t<=e||arguments.length!==r+1)){var n=this._state,i=this._velocity,a=n.length-this.dimension,o=this.bounds,s=o[0],l=o[1],u=t-e,c=u>1e-6?1/u:0;this._time.push(t);for(var h=r;h>0;--h){var f=arguments[h];n.push(Qz(s[h-1],l[h-1],n[a++]+f)),i.push(f*c)}}},tP.idle=function(t){var e=this.lastT();if(!(t=0;--c)n.push(Qz(s[c],l[c],n[a]+u*i[a])),i.push(0),a+=1}};var rP=function(t,e,r,n,i,a,o,s,l,u){var c=e+a+u;if(h>0){var h=Math.sqrt(c+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,u),h=Math.sqrt(2*f-c+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};var nP=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),oP(r=[].slice.call(r,0,4),r);var i=new sP(r,e,Math.log(n));i.setDistanceLimits(t.zoomMin,t.zoomMax),("eye"in t||"up"in t)&&i.lookAt(0,t.eye,t.center,t.up);return i};function iP(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function aP(t,e,r,n){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2)+Math.pow(n,2))}function oP(t,e){var r=e[0],n=e[1],i=e[2],a=e[3],o=aP(r,n,i,a);o>1e-6?(t[0]=r/o,t[1]=n/o,t[2]=i/o,t[3]=a/o):(t[0]=t[1]=t[2]=0,t[3]=1)}function sP(t,e,r){this.radius=Kz([r]),this.center=Kz(e),this.rotation=Kz(t),this.computedRadius=this.radius.curve(0),this.computedCenter=this.center.curve(0),this.computedRotation=this.rotation.curve(0),this.computedUp=[.1,0,0],this.computedEye=[.1,0,0],this.computedMatrix=[.1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.recalcMatrix(0)}var lP=sP.prototype;lP.lastT=function(){return Math.max(this.radius.lastT(),this.center.lastT(),this.rotation.lastT())},lP.recalcMatrix=function(t){this.radius.curve(t),this.center.curve(t),this.rotation.curve(t);var e=this.computedRotation;oP(e,e);var r=this.computedMatrix;jv(r,e);var n=this.computedCenter,i=this.computedEye,a=this.computedUp,o=Math.exp(this.computedRadius[0]);i[0]=n[0]+o*r[2],i[1]=n[1]+o*r[6],i[2]=n[2]+o*r[10],a[0]=r[1],a[1]=r[5],a[2]=r[9];for(var s=0;s<3;++s){for(var l=0,u=0;u<3;++u)l+=r[s+4*u]*i[u];r[12+s]=-l}},lP.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},lP.idle=function(t){this.center.idle(t),this.radius.idle(t),this.rotation.idle(t)},lP.flush=function(t){this.center.flush(t),this.radius.flush(t),this.rotation.flush(t)},lP.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=i[1],o=i[5],s=i[9],l=iP(a,o,s);a/=l,o/=l,s/=l;var u=i[0],c=i[4],h=i[8],f=u*a+c*o+h*s,p=iP(u-=a*f,c-=o*f,h-=s*f);u/=p,c/=p,h/=p;var d=i[2],g=i[6],v=i[10],m=d*a+g*o+v*s,y=d*u+g*c+v*h,x=iP(d-=m*a+y*u,g-=m*o+y*c,v-=m*s+y*h);d/=x,g/=x,v/=x;var b=u*e+a*r,_=c*e+o*r,w=h*e+s*r;this.center.move(t,b,_,w);var M=Math.exp(this.computedRadius[0]);M=Math.max(1e-4,M+n),this.radius.set(t,Math.log(M))},lP.rotate=function(t,e,r,n){this.recalcMatrix(t),e=e||0,r=r||0;var i=this.computedMatrix,a=i[0],o=i[4],s=i[8],l=i[1],u=i[5],c=i[9],h=i[2],f=i[6],p=i[10],d=e*a+r*l,g=e*o+r*u,v=e*s+r*c,m=-(f*v-p*g),y=-(p*d-h*v),x=-(h*g-f*d),b=Math.sqrt(Math.max(0,1-Math.pow(m,2)-Math.pow(y,2)-Math.pow(x,2))),_=aP(m,y,x,b);_>1e-6?(m/=_,y/=_,x/=_,b/=_):(m=y=x=0,b=1);var w=this.computedRotation,M=w[0],A=w[1],k=w[2],T=w[3],S=M*b+T*m+A*x-k*y,E=A*b+T*y+k*m-M*x,C=k*b+T*x+M*y-A*m,L=T*b-M*m-A*y-k*x;if(n){m=h,y=f,x=p;var z=Math.sin(n)/iP(m,y,x);m*=z,y*=z,x*=z,L=L*(b=Math.cos(e))-(S=S*b+L*m+E*x-C*y)*m-(E=E*b+L*y+C*m-S*x)*y-(C=C*b+L*x+S*y-E*m)*x}var P=aP(S,E,C,L);P>1e-6?(S/=P,E/=P,C/=P,L/=P):(S=E=C=0,L=1),this.rotation.set(t,S,E,C,L)},lP.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;fz(i,e,r,n);var a=this.computedRotation;rP(a,i[0],i[1],i[2],i[4],i[5],i[6],i[8],i[9],i[10]),oP(a,a),this.rotation.set(t,a[0],a[1],a[2],a[3]);for(var o=0,s=0;s<3;++s)o+=Math.pow(r[s]-e[s],2);this.radius.set(t,.5*Math.log(Math.max(o,1e-6))),this.center.set(t,r[0],r[1],r[2])},lP.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},lP.setMatrix=function(t,e){var r=this.computedRotation;rP(r,e[0],e[1],e[2],e[4],e[5],e[6],e[8],e[9],e[10]),oP(r,r),this.rotation.set(t,r[0],r[1],r[2],r[3]);var n=this.computedMatrix;cz(n,e);var i=n[15];if(Math.abs(i)>1e-6){var a=n[12]/i,o=n[13]/i,s=n[14]/i;this.recalcMatrix(t);var l=Math.exp(this.computedRadius[0]);this.center.set(t,a-n[2]*l,o-n[6]*l,s-n[10]*l),this.radius.idle(t)}else this.center.idle(t),this.radius.idle(t)},lP.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},lP.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},lP.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])]},lP.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]}},lP.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)};var uP=function(t,e,r,n){var i,a,o,s,l,u,c,h,f,p,d,g,v,m,y,x,b,_,w,M,A,k,T,S,E=n[0],C=n[1],L=n[2],z=Math.sqrt(E*E+C*C+L*L);if(Math.abs(z)<1e-6)return null;E*=z=1/z,C*=z,L*=z,i=Math.sin(r),a=Math.cos(r),o=1-a,s=e[0],l=e[1],u=e[2],c=e[3],h=e[4],f=e[5],p=e[6],d=e[7],g=e[8],v=e[9],m=e[10],y=e[11],x=E*E*o+a,b=C*E*o+L*i,_=L*E*o-C*i,w=E*C*o-L*i,M=C*C*o+a,A=L*C*o+E*i,k=E*L*o+C*i,T=C*L*o-E*i,S=L*L*o+a,t[0]=s*x+h*b+g*_,t[1]=l*x+f*b+v*_,t[2]=u*x+p*b+m*_,t[3]=c*x+d*b+y*_,t[4]=s*w+h*M+g*A,t[5]=l*w+f*M+v*A,t[6]=u*w+p*M+m*A,t[7]=c*w+d*M+y*A,t[8]=s*k+h*T+g*S,t[9]=l*k+f*T+v*S,t[10]=u*k+p*T+m*S,t[11]=c*k+d*T+y*S,e!==t&&(t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]);return t};var cP=function(t){var e=(t=t||{}).center||[0,0,0],r=t.up||[0,1,0],n=t.right||pP(r),i=t.radius||1,a=t.theta||0,o=t.phi||0;if(e=[].slice.call(e,0,3),r=[].slice.call(r,0,3),yz(r,r),n=[].slice.call(n,0,3),yz(n,n),"eye"in t){var s=t.eye,l=[s[0]-e[0],s[1]-e[1],s[2]-e[2]];Az(n,l,r),hP(n[0],n[1],n[2])<1e-6?n=pP(r):yz(n,n),i=hP(l[0],l[1],l[2]);var u=kz(r,l)/i,c=kz(n,l)/i;o=Math.acos(u),a=Math.acos(c)}return i=Math.log(i),new dP(t.zoomMin,t.zoomMax,e,r,n,i,a,o)};function hP(t,e,r){return Math.sqrt(Math.pow(t,2)+Math.pow(e,2)+Math.pow(r,2))}function fP(t){return Math.min(1,Math.max(-1,t))}function pP(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 yz(i,i),i}function dP(t,e,r,n,i,a,o,s){this.center=Kz(r),this.up=Kz(n),this.right=Kz(i),this.radius=Kz([a]),this.angle=Kz([o,s]),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 l=0;l<16;++l)this.computedMatrix[l]=.5;this.recalcMatrix(0)}var gP=dP.prototype;gP.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},gP.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])]},gP.recalcMatrix=function(t){this.center.curve(t),this.up.curve(t),this.right.curve(t),this.radius.curve(t),this.angle.curve(t);for(var e=this.computedUp,r=this.computedRight,n=0,i=0,a=0;a<3;++a)i+=e[a]*r[a],n+=e[a]*e[a];var o=Math.sqrt(n),s=0;for(a=0;a<3;++a)r[a]-=e[a]*i/n,s+=r[a]*r[a],e[a]/=o;var l=Math.sqrt(s);for(a=0;a<3;++a)r[a]/=l;var u=this.computedToward;Az(u,e,r),yz(u,u);var c=Math.exp(this.computedRadius[0]),h=this.computedAngle[0],f=this.computedAngle[1],p=Math.cos(h),d=Math.sin(h),g=Math.cos(f),v=Math.sin(f),m=this.computedCenter,y=p*g,x=d*g,b=v,_=-p*v,w=-d*v,M=g,A=this.computedEye,k=this.computedMatrix;for(a=0;a<3;++a){var T=y*r[a]+x*u[a]+b*e[a];k[4*a+1]=_*r[a]+w*u[a]+M*e[a],k[4*a+2]=T,k[4*a+3]=0}var S=k[1],E=k[5],C=k[9],L=k[2],z=k[6],P=k[10],I=E*P-C*z,D=C*L-S*P,O=S*z-E*L,R=hP(I,D,O);I/=R,D/=R,O/=R,k[0]=I,k[4]=D,k[8]=O;for(a=0;a<3;++a)A[a]=m[a]+k[2+4*a]*c;for(a=0;a<3;++a){s=0;for(var F=0;F<3;++F)s+=k[a+4*F]*A[F];k[12+a]=-s}k[15]=1},gP.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 vP=[0,0,0];gP.rotate=function(t,e,r,n){if(this.angle.move(t,e,r),n){this.recalcMatrix(t);var i=this.computedMatrix;vP[0]=i[2],vP[1]=i[6],vP[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];uP(i,i,n,vP);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])}},gP.pan=function(t,e,r,n){e=e||0,r=r||0,n=n||0,this.recalcMatrix(t);var i=this.computedMatrix,a=(Math.exp(this.computedRadius[0]),i[1]),o=i[5],s=i[9],l=hP(a,o,s);a/=l,o/=l,s/=l;var u=i[0],c=i[4],h=i[8],f=u*a+c*o+h*s,p=hP(u-=a*f,c-=o*f,h-=s*f),d=(u/=p)*e+a*r,g=(c/=p)*e+o*r,v=(h/=p)*e+s*r;this.center.move(t,d,g,v);var m=Math.exp(this.computedRadius[0]);m=Math.max(1e-4,m+n),this.radius.set(t,Math.log(m))},gP.translate=function(t,e,r,n){this.center.move(t,e||0,r||0,n||0)},gP.setMatrix=function(t,e,r,n){var i=1;"number"==typeof r&&(i=0|r),(i<0||i>3)&&(i=1);var a=(i+2)%3;e||(this.recalcMatrix(t),e=this.computedMatrix);var o=e[i],s=e[i+4],l=e[i+8];if(n){var u=Math.abs(o),c=Math.abs(s),h=Math.abs(l),f=Math.max(u,c,h);u===f?(o=o<0?-1:1,s=l=0):h===f?(l=l<0?-1:1,o=s=0):(s=s<0?-1:1,o=l=0)}else{var p=hP(o,s,l);o/=p,s/=p,l/=p}var d,g,v=e[a],m=e[a+4],y=e[a+8],x=v*o+m*s+y*l,b=hP(v-=o*x,m-=s*x,y-=l*x),_=s*(y/=b)-l*(m/=b),w=l*(v/=b)-o*y,M=o*m-s*v,A=hP(_,w,M);if(_/=A,w/=A,M/=A,this.center.jump(t,V,U,q),this.radius.idle(t),this.up.jump(t,o,s,l),this.right.jump(t,v,m,y),2===i){var k=e[1],T=e[5],S=e[9],E=k*v+T*m+S*y,C=k*_+T*w+S*M;d=I<0?-Math.PI/2:Math.PI/2,g=Math.atan2(C,E)}else{var L=e[2],z=e[6],P=e[10],I=L*o+z*s+P*l,D=L*v+z*m+P*y,O=L*_+z*w+P*M;d=Math.asin(fP(I)),g=Math.atan2(O,D)}this.angle.jump(t,g,d),this.recalcMatrix(t);var R=e[2],F=e[6],B=e[10],N=this.computedMatrix;cz(N,e);var j=N[15],V=N[12]/j,U=N[13]/j,q=N[14]/j,H=Math.exp(this.computedRadius[0]);this.center.jump(t,V-R*H,U-F*H,q-B*H)},gP.lastT=function(){return Math.max(this.center.lastT(),this.up.lastT(),this.right.lastT(),this.radius.lastT(),this.angle.lastT())},gP.idle=function(t){this.center.idle(t),this.up.idle(t),this.right.idle(t),this.radius.idle(t),this.angle.idle(t)},gP.flush=function(t){this.center.flush(t),this.up.flush(t),this.right.flush(t),this.radius.flush(t),this.angle.flush(t)},gP.setDistance=function(t,e){e>0&&this.radius.set(t,Math.log(e))},gP.lookAt=function(t,e,r,n){this.recalcMatrix(t),e=e||this.computedEye,r=r||this.computedCenter;var i=(n=n||this.computedUp)[0],a=n[1],o=n[2],s=hP(i,a,o);if(!(s<1e-6)){i/=s,a/=s,o/=s;var l=e[0]-r[0],u=e[1]-r[1],c=e[2]-r[2],h=hP(l,u,c);if(!(h<1e-6)){l/=h,u/=h,c/=h;var f=this.computedRight,p=f[0],d=f[1],g=f[2],v=i*p+a*d+o*g,m=hP(p-=v*i,d-=v*a,g-=v*o);if(!(m<.01&&(m=hP(p=a*c-o*u,d=o*l-i*c,g=i*u-a*l))<1e-6)){p/=m,d/=m,g/=m,this.up.set(t,i,a,o),this.right.set(t,p,d,g),this.center.set(t,r[0],r[1],r[2]),this.radius.set(t,Math.log(h));var y=a*g-o*d,x=o*p-i*g,b=i*d-a*p,_=hP(y,x,b),w=i*l+a*u+o*c,M=p*l+d*u+g*c,A=(y/=_)*l+(x/=_)*u+(b/=_)*c,k=Math.asin(fP(w)),T=Math.atan2(A,M),S=this.angle._state,E=S[S.length-1],C=S[S.length-2];E%=2*Math.PI;var L=Math.abs(E+2*Math.PI-T),z=Math.abs(E-T),P=Math.abs(E-2*Math.PI-T);LMath.abs(e))n.rotate(s,0,0,-t*i*Math.PI*l.rotateSpeed/window.innerWidth);else{var u=l.zoomSpeed*o*e/window.innerHeight*(s-n.lastT())/100;n.pan(s,0,0,a*(Math.exp(u)-1))}},!0),l};var wP=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=0?e[a]:i})},has___:{value:y(function(e){var n=m(e);return n?r in n:t.indexOf(e)>=0})},set___:{value:y(function(n,i){var a,o=m(n);return o?o[r]=i:(a=t.indexOf(n))>=0?e[a]=i:(a=t.length,e[a]=i,t[a]=n),this})},delete___:{value:y(function(n){var i,a,o=m(n);return o?r in o&&delete o[r]:!((i=t.indexOf(n))<0||(a=t.length-1,t[i]=void 0,e[i]=e[a],t[i]=t[a],t.length=a,e.length=a,0))})}})};d.prototype=Object.create(Object.prototype,{get:{value:function(t,e){return this.get___(t,e)},writable:!0,configurable:!0},has:{value:function(t){return this.has___(t)},writable:!0,configurable:!0},set:{value:function(t,e){return this.set___(t,e)},writable:!0,configurable:!0},delete:{value:function(t){return this.delete___(t)},writable:!0,configurable:!0}}),"function"==typeof e?function(){function r(){this instanceof d||x();var r,n=new e,i=void 0,a=!1;return r=t?function(t,e){return n.set(t,e),n.has(t)||(i||(i=new d),i.set(t,e)),this}:function(t,e){if(a)try{n.set(t,e)}catch(r){i||(i=new d),i.set___(t,e)}else n.set(t,e);return this},Object.create(d.prototype,{get___:{value:y(function(t,e){return i?n.has(t)?n.get(t):i.get___(t,e):n.get(t,e)})},has___:{value:y(function(t){return n.has(t)||!!i&&i.has___(t)})},set___:{value:y(r)},delete___:{value:y(function(t){var e=!!n.delete(t);return i&&i.delete___(t)||e})},permitHostObjects___:{value:y(function(t){if(t!==g)throw new Error("bogus call to permitHostObjects___");a=!0})}})}t&&"undefined"!=typeof Proxy&&(Proxy=void 0),r.prototype=d.prototype,CP=r,Object.defineProperty(WeakMap.prototype,"constructor",{value:WeakMap,enumerable:!1,configurable:!0,writable:!0})}():("undefined"!=typeof Proxy&&(Proxy=void 0),CP=d)}function g(t){t.permitHostObjects___&&t.permitHostObjects___(g)}function v(t){return!(t.substr(0,s.length)==s&&"___"===t.substr(t.length-3))}function m(t){if(t!==Object(t))throw new TypeError("Not an object: "+t);var e=t[l];if(e&&e.key===t)return e;if(o(t)){e={key:t};try{return a(t,l,{value:e,writable:!1,enumerable:!1,configurable:!1}),e}catch(t){return}}}function y(t){return t.prototype=null,Object.freeze(t)}function x(){f||"undefined"==typeof console||(f=!0,console.warn("WeakMap should be invoked as new WeakMap(), not WeakMap(). This will be an error in the future."))}}();var LP=new("undefined"==typeof WeakMap?CP:WeakMap);var zP=function(t){var e=LP.get(t),r=e&&(e._triangleBuffer.handle||e._triangleBuffer.buffer);if(!r||!t.isBuffer(r)){var n=S_(t,new Float32Array([-1,-1,-1,4,4,-1]));(e=EP(t,[{buffer:n,type:t.FLOAT,size:2}]))._triangleBuffer=n,LP.set(t,e)}e.bind(),t.drawArrays(t.TRIANGLES,0,3),e.unbind()},PP={},IP=E_(["#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"]),DP=E_(["precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"]);PP.line=function(t){return Bw(t,IP,DP,null,[{name:"position",type:"vec3"}])};var OP=E_(["#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}"]),RP=E_(["precision mediump float;\n#define GLSLIFY 1\nuniform vec4 color;\nvoid main() {\n gl_FragColor = color;\n}"]);PP.text=function(t){return Bw(t,OP,RP,null,[{name:"position",type:"vec3"}])};var FP=E_(["#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}"]),BP=E_(["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}"]);PP.bg=function(t){return Bw(t,FP,BP,null,[{name:"position",type:"vec3"},{name:"normal",type:"vec3"}])};var NP=function(t){for(var e=[],r=[],n=0,i=0;i<3;++i)for(var a=(i+1)%3,o=(i+2)%3,s=[0,0,0],l=[0,0,0],u=-1;u<=1;u+=2){r.push(n,n+2,n+1,n+1,n+2,n+3),s[i]=u,l[i]=u;for(var c=-1;c<=1;c+=2){s[a]=c;for(var h=-1;h<=1;h+=2)s[o]=h,e.push(s[0],s[1],s[2],l[0],l[1],l[2]),n+=1}var f=a;a=o,o=f}var p=S_(t,new Float32Array(e)),d=S_(t,new Uint16Array(r),t.ELEMENT_ARRAY_BUFFER),g=EP(t,[{buffer:p,type:t.FLOAT,size:3,offset:0,stride:24},{buffer:p,type:t.FLOAT,size:3,offset:12,stride:24}],d),v=jP(t);return v.attributes.position.location=0,v.attributes.normal.location=1,new VP(t,p,g,v)},jP=PP.bg;function VP(t,e,r,n){this.gl=t,this.buffer=e,this.vao=r,this.shader=n}var UP=VP.prototype;UP.draw=function(t,e,r,n,i,a){for(var o=!1,s=0;s<3;++s)o=o||i[s];if(o){var l=this.gl;l.enable(l.POLYGON_OFFSET_FILL),l.polygonOffset(1,2),this.shader.bind(),this.shader.uniforms={model:t,view:e,projection:r,bounds:n,enable:i,colors:a},this.vao.bind(),this.vao.draw(this.gl.TRIANGLES,36),this.vao.unbind(),l.disable(l.POLYGON_OFFSET_FILL)}},UP.dispose=function(){this.vao.dispose(),this.buffer.dispose(),this.shader.dispose()};var qP=function(t,e){for(var r=cM(t[0],e[0]),n=1;n1&&(i=1);for(var a=1-i,o=t.length,s=new Array(o),l=0;l0||i>0&&l<0){var u=WP(a,l,o,i);r.push(u),n.push(u.slice())}l<0?n.push(o.slice()):l>0?r.push(o.slice()):(r.push(o.slice()),n.push(o.slice())),i=l}return{positive:r,negative:n}}).positive=function(t,e){for(var r=[],n=GP(t[t.length-1],e),i=t[t.length-1],a=t[0],o=0;o0||n>0&&s<0)&&r.push(WP(i,s,a,n)),s>=0&&r.push(a.slice()),n=s}return r},HP.negative=function(t,e){for(var r=[],n=GP(t[t.length-1],e),i=t[t.length-1],a=t[0],o=0;o0||n>0&&s<0)&&r.push(WP(i,s,a,n)),s<=0&&r.push(a.slice()),n=s}return r};var YP=function(t,e,r,n){Dz(XP,e,t),Dz(XP,r,XP);for(var i=0,a=0;a<2;++a){KP[2]=n[a][2];for(var o=0;o<2;++o){KP[1]=n[o][1];for(var s=0;s<2;++s)KP[0]=n[s][0],$P(ZP[i],KP,XP),i+=1}}for(var l=-1,a=0;a<8;++a){for(var u=ZP[a][3],c=0;c<3;++c)JP[a][c]=ZP[a][c]/u;u<0&&(l<0?l=a:JP[a][2]d&&(l|=1<d&&(l|=1<JP[a][1]&&(w=a));for(var M=-1,a=0;a<3;++a){var A=w^1<JP[k][0]&&(k=A)}}var T=rI;T[0]=T[1]=T[2]=0,T[Mb.log2(M^w)]=w&M,T[Mb.log2(w^k)]=w&k;var S=7^k;S===l||S===_?(S=7^M,T[Mb.log2(k^S)]=S&k):T[Mb.log2(M^S)]=S&M;for(var E=nI,C=l,h=0;h<3;++h)E[h]=C&1<=0;--d){var g=u[p[d]];o.push(l*g[0],-l*g[1],t)}}for(var l=[0,0,0],u=[0,0,0],c=[0,0,0],h=[0,0,0],f=0;f<3;++f){c[f]=o.length/3|0,s(.5*(t[0][f]+t[1][f]),e[f],r),h[f]=(o.length/3|0)-c[f],l[f]=o.length/3|0;for(var p=0;p=0&&(i=r.length-n-1);var a=Math.pow(10,i),o=Math.round(t*e*a),s=o+"";if(s.indexOf("e")>=0)return s;var l=o/a,u=o%a;o<0?(l=0|-Math.ceil(l),u=0|-u):(l=0|Math.floor(l),u|=0);var c=""+l;if(o<0&&(c="-"+c),i){for(var h=""+u;h.length=t[0][n];--a)i.push({x:a*e[n],text:yI(e[n],a)});r.push(i)}return r},mI.equal=function(t,e){for(var r=0;r<3;++r){if(t[r].length!==e[r].length)return!1;for(var n=0;n0?(p[c]=-1,d[c]=0):(p[c]=0,d[c]=1)}}var SI=[0,0,0],EI={model:bI,view:bI,projection:bI};MI.isOpaque=function(){return!0},MI.isTransparent=function(){return!1},MI.drawTransparent=function(t){};var CI=[0,0,0],LI=[0,0,0],zI=[0,0,0];MI.draw=function(t){t=t||EI;for(var e=this.gl,r=t.model||bI,n=t.view||bI,i=t.projection||bI,a=this.bounds,o=YP(r,n,i,a),s=o.cubeEdges,l=o.axis,u=n[12],c=n[13],h=n[14],f=n[15],p=this.pixelRatio*(i[3]*u+i[7]*c+i[11]*h+i[15]*f)/e.drawingBufferHeight,d=0;d<3;++d)this.lastCubeProps.cubeEdges[d]=s[d],this.lastCubeProps.axis[d]=l[d];var g=kI;for(d=0;d<3;++d)TI(kI[d],d,this.bounds,s,l);e=this.gl;var v=SI;for(d=0;d<3;++d)this.backgroundEnable[d]?v[d]=l[d]:v[d]=0;this._background.draw(r,n,i,a,v,this.backgroundColor),this._lines.bind(r,n,i,this);for(d=0;d<3;++d){var m=[0,0,0];l[d]>0?m[d]=a[1][d]:m[d]=a[0][d];for(var y=0;y<2;++y){var x=(d+1+y)%3,b=(d+1+(1^y))%3;this.gridEnable[x]&&this._lines.drawGrid(x,b,this.bounds,m,this.gridColor[x],this.gridWidth[x]*this.pixelRatio)}for(y=0;y<2;++y){x=(d+1+y)%3,b=(d+1+(1^y))%3;this.zeroEnable[b]&&a[0][b]<=0&&a[1][b]>=0&&this._lines.drawZero(x,b,this.bounds,m,this.zeroLineColor[b],this.zeroLineWidth[b]*this.pixelRatio)}}for(d=0;d<3;++d){this.lineEnable[d]&&this._lines.drawAxisLine(d,this.bounds,g[d].primalOffset,this.lineColor[d],this.lineWidth[d]*this.pixelRatio),this.lineMirror[d]&&this._lines.drawAxisLine(d,this.bounds,g[d].mirrorOffset,this.lineColor[d],this.lineWidth[d]*this.pixelRatio);var _=_I(CI,g[d].primalMinor),w=_I(LI,g[d].mirrorMinor),M=this.lineTickLength;for(y=0;y<3;++y){var A=p/r[5*y];_[y]*=M[y]*A,w[y]*=M[y]*A}this.lineTickEnable[d]&&this._lines.drawAxisTicks(d,g[d].primalOffset,_,this.lineTickColor[d],this.lineTickWidth[d]*this.pixelRatio),this.lineTickMirror[d]&&this._lines.drawAxisTicks(d,g[d].mirrorOffset,w,this.lineTickColor[d],this.lineTickWidth[d]*this.pixelRatio)}this._lines.unbind(),this._text.bind(r,n,i,this.pixelRatio);for(d=0;d<3;++d){var k=g[d].primalMinor,T=_I(zI,g[d].primalOffset);for(y=0;y<3;++y)this.lineTickEnable[d]&&(T[y]+=p*k[y]*Math.max(this.lineTickLength[y],0)/r[5*y]);if(this.tickEnable[d]){for(y=0;y<3;++y)T[y]+=p*k[y]*this.tickPad[y]/r[5*y];this._text.drawTicks(d,this.tickSize[d],this.tickAngle[d],T,this.tickColor[d])}if(this.labelEnable[d]){for(y=0;y<3;++y)T[y]+=p*k[y]*this.labelPad[y]/r[5*y];T[d]+=.5*(a[0][d]+a[1][d]),this._text.drawLabel(d,this.labelSize[d],this.labelAngle[d],T,this.labelColor[d])}}this._text.unbind()},MI.dispose=function(){this._text.dispose(),this._lines.dispose(),this._background.dispose(),this._lines=null,this._text=null,this._background=null,this.gl=null};var PI=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]]]};var II=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};var DI=function(t,e,r,n,i){var a=e.model||OI,o=e.view||OI,s=e.projection||OI,l=t.bounds,u=(i=i||YP(a,o,s,l)).axis;i.edges;Dz(RI,o,a),Dz(RI,s,RI);for(var c=VI,h=0;h<3;++h)c[h].lo=1/0,c[h].hi=-1/0,c[h].pixelsPerDataUnit=1/0;var f=PI(Mz(RI,RI));Mz(RI,RI);for(var p=0;p<3;++p){var d=(p+1)%3,g=(p+2)%3,v=UI;t:for(var h=0;h<2;++h){var m=[];if(u[p]<0!=!!h){v[p]=l[h][p];for(var y=0;y<2;++y){v[d]=l[y^h][d];for(var x=0;x<2;++x)v[g]=l[x^y^h][g],m.push(v.slice())}for(var y=0;y0&&0===v[e-1];)v.pop(),m.pop().dispose()}window.addEventListener("resize",T),A.update=function(t){e||(t=t||{},y=!0,x=!0)},A.add=function(t){e||(t.axes=h,d.push(t),g.push(-1),y=!0,x=!0,S())},A.remove=function(t){if(!e){var r=d.indexOf(t);r<0||(d.splice(r,1),g.pop(),y=!0,x=!0,S())}},A.dispose=function(){if(!e&&(e=!0,window.removeEventListener("resize",T),r.removeEventListener("webglcontextlost",L),A.mouseListener.enabled=!1,!A.contextLost)){h.dispose(),p.dispose();for(var t=0;to.distance)continue;for(var h=0;h0){r=Math.round(Math.pow(10,e));return Math.ceil(t/r)*r}return Math.ceil(t)}function oD(t){return"boolean"!=typeof t||t}var sD=function(t,e){t=t||document.body,e=e||{};var r=[.01,1/0];"distanceLimits"in e&&(r[0]=e.distanceLimits[0],r[1]=e.distanceLimits[1]);"zoomMin"in e&&(r[0]=e.zoomMin);"zoomMax"in e&&(r[1]=e.zoomMax);var n=mP({center:e.center||[0,0,0],up:e.up||[0,1,0],eye:e.eye||[0,0,10],mode:e.mode||"orbit",distanceLimits:r}),i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a=0,o=t.clientWidth,s=t.clientHeight,l={keyBindingMode:"rotate",view:n,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:n.modes,tick:function(){var e=bP(),r=this.delay,l=e-2*r;n.idle(e-r),n.recalcMatrix(l),n.flush(e-(100+2*r));for(var u=!0,c=n.computedMatrix,h=0;h<16;++h)u=u&&i[h]===c[h],i[h]=c[h];var f=t.clientWidth===o&&t.clientHeight===s;return o=t.clientWidth,s=t.clientHeight,u?!f:(a=Math.exp(n.computedRadius[0]),!0)},lookAt:function(t,e,r){n.lookAt(n.lastT(),t,e,r)},rotate:function(t,e,r){n.rotate(n.lastT(),t,e,r)},pan:function(t,e,r){n.pan(n.lastT(),t,e,r)},translate:function(t,e,r){n.translate(n.lastT(),t,e,r)}};Object.defineProperties(l,{matrix:{get:function(){return n.computedMatrix},set:function(t){return n.setMatrix(n.lastT(),t),n.computedMatrix},enumerable:!0},mode:{get:function(){return n.getMode()},set:function(t){var e=n.computedUp.slice(),r=n.computedEye.slice(),i=n.computedCenter.slice();if(n.setMode(t),"turntable"===t){var a=bP();n._active.lookAt(a,r,i,e),n._active.lookAt(a+500,r,i,[0,0,1]),n._active.flush(a)}return n.getMode()},enumerable:!0},center:{get:function(){return n.computedCenter},set:function(t){return n.lookAt(n.lastT(),null,t),n.computedCenter},enumerable:!0},eye:{get:function(){return n.computedEye},set:function(t){return n.lookAt(n.lastT(),t),n.computedEye},enumerable:!0},up:{get:function(){return n.computedUp},set:function(t){return n.lookAt(n.lastT(),null,null,t),n.computedUp},enumerable:!0},distance:{get:function(){return a},set:function(t){return n.setDistance(n.lastT(),t),t},enumerable:!0},distanceLimits:{get:function(){return n.getDistanceLimits(r)},set:function(t){return n.setDistanceLimits(t),t},enumerable:!0}}),t.addEventListener("contextmenu",function(t){return t.preventDefault(),!1});var u=0,c=0,h={shift:!1,control:!1,alt:!1,meta:!1};function f(e,r,i,o){var s=l.keyBindingMode;if(!1!==s){var f="rotate"===s,p="pan"===s,d="zoom"===s,g=!!o.control,v=!!o.alt,m=!!o.shift,y=!!(1&e),x=!!(2&e),b=!!(4&e),_=1/t.clientHeight,w=_*(r-u),M=_*(i-c),A=l.flipX?1:-1,k=l.flipY?1:-1,T=bP(),S=Math.PI*l.rotateSpeed;if((f&&y&&!g&&!v&&!m||y&&!g&&!v&&m)&&n.rotate(T,A*S*w,-k*S*M,0),(p&&y&&!g&&!v&&!m||x||y&&g&&!v&&!m)&&n.pan(T,-l.translateSpeed*w*a,l.translateSpeed*M*a,0),d&&y&&!g&&!v&&!m||b||y&&!g&&v&&!m){var E=-l.zoomSpeed*M/window.innerHeight*(T-n.lastT())*100;n.pan(T,0,0,a*(Math.exp(E)-1))}return u=r,c=i,h=o,!0}}return l.mouseListener=CC(t,f),t.addEventListener("touchstart",function(e){var r=La(e.changedTouches[0],t);f(0,r[0],r[1],h),f(1,r[0],r[1],h),e.preventDefault()},!!Ea&&{passive:!1}),t.addEventListener("touchmove",function(e){var r=La(e.changedTouches[0],t);f(1,r[0],r[1],h),e.preventDefault()},!!Ea&&{passive:!1}),t.addEventListener("touchend",function(t){f(0,u,c,h),t.preventDefault()},!!Ea&&{passive:!1}),l.wheelListener=OC(t,function(t,e){if(!1!==l.keyBindingMode){var r=l.flipX?1:-1,i=l.flipY?1:-1,o=bP();if(Math.abs(t)>Math.abs(e))n.rotate(o,0,0,-t*r*Math.PI*l.rotateSpeed/window.innerWidth);else{var s=-l.zoomSpeed*i*e/window.innerHeight*(o-n.lastT())/20;n.pan(o,0,0,a*(Math.exp(s)-1))}}},!0),l};var lD=["xaxis","yaxis","zaxis"];function uD(){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()}uD.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[lD[e]];r.visible?(this.labels[e]=AC(r.title),"titlefont"in r&&(r.titlefont.color&&(this.labelColor[e]=WC(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]=WC(r.linecolor)),"linewidth"in r&&(this.lineWidth[e]=r.linewidth),"showgrid"in r&&(this.gridEnable[e]=r.showgrid),"gridcolor"in r&&(this.gridColor[e]=WC(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]=WC(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]=WC(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]=WC(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]=WC(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)}};var cD=function(t){var e=new uD;return e.merge(t),e},hD=["xaxis","yaxis","zaxis"];function fD(){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]}fD.prototype.merge=function(t){for(var e=0;e<3;++e){var r=t[hD[e]];r.visible?(this.enabled[e]=r.showspikes,this.colors[e]=WC(r.spikecolor),this.drawSides[e]=r.spikesides,this.lineWidth[e]=r.spikethickness):(this.enabled[e]=!1,this.drawSides[e]=!1)}};var pD,dD,gD=function(t){var e=new fD;return e.merge(t),e},vD=function(t){for(var e=t.axesOptions,r=t.glplot.axesPixels,n=t.fullSceneLayout,i=[[],[],[]],a=0;a<3;++a){var o=n[mD[a]];if(o._length=(r[a].hi-r[a].lo)*r[a].pixelsPerDataUnit/t.dataScale[a],Math.abs(o._length)===1/0)i[a]=[];else{o._input_range=o.range.slice(),o.range[0]=r[a].lo/t.dataScale[a],o.range[1]=r[a].hi/t.dataScale[a],o._m=1/(t.dataScale[a]*r[a].pixelsPerDataUnit),o.range[0]===o.range[1]&&(o.range[0]-=1,o.range[1]+=1);var s=o.tickmode;if("auto"===o.tickmode){o.tickmode="linear";var l=o.nticks||ne.constrain(o._length/40,4,9);ri.autoTicks(o,Math.abs(o.range[1]-o.range[0])/l)}for(var u=ri.calcTicks(o),c=0;ch[1][o]?f[o]=1:h[1][o]===h[0][o]?f[o]=1:f[o]=1/(h[1][o]-h[0][o]);for(this.dataScale=f,this.convertAnnotations(this),a=0;ad[1][a])d[0][a]=-1,d[1][a]=1;else{var M=d[1][a]-d[0][a];d[0][a]-=M/32,d[1][a]+=M/32}}else{var A=s.range;d[0][a]=s.r2l(A[0]),d[1][a]=s.r2l(A[1])}d[0][a]===d[1][a]&&(d[0][a]-=1,d[1][a]+=1),g[a]=d[1][a]-d[0][a],this.glplot.bounds[0][a]=d[0][a]*f[a],this.glplot.bounds[1][a]=d[1][a]*f[a]}var k=[1,1,1];for(a=0;a<3;++a){var T=v[l=(s=u[wD[a]]).type];k[a]=Math.pow(T.acc,1/T.count)/f[a]}var S;if("auto"===u.aspectmode)S=Math.max.apply(null,k)/Math.min.apply(null,k)<=4?k:[1,1,1];else if("cube"===u.aspectmode)S=[1,1,1];else if("data"===u.aspectmode)S=k;else{if("manual"!==u.aspectmode)throw new Error("scene.js aspectRatio was not one of the enumerated types");var E=u.aspectratio;S=[E.x,E.y,E.z]}u.aspectratio.x=c.aspectratio.x=S[0],u.aspectratio.y=c.aspectratio.y=S[1],u.aspectratio.z=c.aspectratio.z=S[2],this.glplot.aspect=S;var C=u.domain||null,L=e._size||null;if(C&&L){var z=this.container.style;z.position="absolute",z.left=L.l+C.x[0]*L.w+"px",z.top=L.t+(1-C.y[1])*L.h+"px",z.width=L.w*(C.x[1]-C.x[0])+"px",z.height=L.h*(C.y[1]-C.y[0])+"px"}this.glplot.redraw()}},_D.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)},_D.getCamera=function(){return this.glplot.camera.view.recalcMatrix(this.camera.view.lastT()),kD(this.glplot.camera)},_D.setCamera=function(t){var e;this.glplot.camera.lookAt.apply(this,[[(e=t).eye.x,e.eye.y,e.eye.z],[e.center.x,e.center.y,e.center.z],[e.up.x,e.up.y,e.up.z]])},_D.saveCamera=function(t){var e=this.getCamera(),r=ne.nestedProperty(t,this.id+".camera"),n=r.get(),i=!1;function a(t,e,r,n){var i=["up","center","eye"],a=["x","y","z"];return e[i[r]]&&t[i[r]][a[n]]===e[i[r]][a[n]]}if(void 0===n)i=!0;else for(var o=0;o<3;o++)for(var s=0;s<3;s++)if(!a(e,n,o,s)){i=!0;break}return i&&r.set(e),i},_D.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},_D.toImage=function(t){t||(t="png"),this.staticMode&&this.container.appendChild(pD),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;a1;Jc(t,e,0,{type:"gl3d",attributes:lz,handleDefaults:uz,fullLayout:e,font:e.font,fullData:r,getDfltFromLayout:function(e){if(!n)return ne.validate(t[e],lz[e])?t[e]:void 0},paper_bgcolor:e.paper_bgcolor,calendar:e.calendar})},SD.plot=function(t){for(var e=t._fullLayout,r=t._fullData,n=e._subplots.gl3d,i=0;i=0;--i){var a=r,o=t[i],s=(r=a+o)-a,l=o-s;l&&(t[--n]=r,r=l)}for(var u=0,i=n;i>1;return["sum(",t(e.slice(0,r)),",",t(e.slice(r)),")"].join("")}(e);var n}function UD(t){return new Function("sum","scale","prod","compress",["function robustDeterminant",t,"(m){return compress(",VD(function(t){for(var e=new Array(t),r=0;r0&&r.push(","),r.push("[");for(var a=0;a0&&r.push(","),a===n?r.push("+b[",i,"]"):r.push("+A[",i,"][",a,"]");r.push("]")}r.push("]),")}r.push("det(A)]}return ",e);var o=new Function("det",r.join(""));return o(t<6?BD[t]:BD)}var YD=[function(){return[0]},function(t,e){return[[e[0]],[t[0][0]]]}];function XD(t,e){for(var r=0,n=t.length,i=0;i0&&e.push(","),e.push("tuple[",r,"]");e.push(")}return orient");var n=new Function("test",e.join("")),i=PM[t+1];return i||(i=PM),n(i)}(t)),this.orient=i}var oO=aO.prototype;oO.handleBoundaryDegeneracy=function(t,e){var r=this.dimension,n=this.vertices.length-1,i=this.tuple,a=this.vertices,o=[t];for(t.lastVisited=-n;o.length>0;){(t=o.pop()).vertices;for(var s=t.adjacent,l=0;l<=r;++l){var u=s[l];if(u.boundary&&!(u.lastVisited<=-n)){for(var c=u.vertices,h=0;h<=r;++h){var f=c[h];i[h]=f<0?e:a[f]}var p=this.orient();if(p>0)return u;u.lastVisited=-n,0===p&&o.push(u)}}}return null},oO.walk=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=e?this.interior.length*Math.random()|0:this.interior.length-1,s=this.interior[o];t:for(;!s.boundary;){for(var l=s.vertices,u=s.adjacent,c=0;c<=n;++c)a[c]=i[l[c]];s.lastVisited=r;for(c=0;c<=n;++c){var h=u[c];if(!(h.lastVisited>=r)){var f=a[c];a[c]=t;var p=this.orient();if(a[c]=f,p<0){s=h;continue t}h.boundary?h.lastVisited=-r:h.lastVisited=r}}return}return s},oO.addPeaks=function(t,e){var r=this.vertices.length-1,n=this.dimension,i=this.vertices,a=this.tuple,o=this.interior,s=this.simplices,l=[e];e.lastVisited=r,e.vertices[e.vertices.indexOf(-1)]=r,e.boundary=!1,o.push(e);for(var u=[];l.length>0;){var c=(e=l.pop()).vertices,h=e.adjacent,f=c.indexOf(r);if(!(f<0))for(var p=0;p<=n;++p)if(p!==f){var d=h[p];if(d.boundary&&!(d.lastVisited>=r)){var g=d.vertices;if(d.lastVisited!==-r){for(var v=0,m=0;m<=n;++m)g[m]<0?(v=m,a[m]=t):a[m]=i[g[m]];if(this.orient()>0){g[v]=r,d.boundary=!1,o.push(d),l.push(d),d.lastVisited=r;continue}d.lastVisited=-r}var y=d.adjacent,x=c.slice(),b=h.slice(),_=new eO(x,b,!0);s.push(_);var w=y.indexOf(e);if(!(w<0)){y[w]=_,b[f]=d,x[p]=-1,b[p]=e,h[p]=_,_.flip();for(m=0;m<=n;++m){var M=x[m];if(!(M<0||M===r)){for(var A=new Array(n-1),k=0,T=0;T<=n;++T){var S=x[T];S<0||T===m||(A[k++]=S)}u.push(new rO(A,_,m))}}}}}}u.sort(nO);for(p=0;p+1=0?o[l++]=s[c]:u=1&c;if(u===(1&t)){var h=o[0];o[0]=o[1],o[1]=h}e.push(o)}}return e};var sO=function(t,e){var r=t.length;if(0===r)return[];var n=t[0].length;if(n<1)return[];if(1===n)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=2)return!1;t[r]=i}return!0}):m.filter(function(t){for(var e=0;e<=n;++e){var r=p[t[e]];if(r<0)return!1;t[e]=r}return!0});if(1&n)for(var o=0;o0){var o=t[r-1];if(0===pO(i,o)&&fO(o)!==a){r-=1;continue}}t[r++]=i}}return t.length=r,t};var yO=function(t){return mO(hO(t))};var xO=function(t,e){return yO(cO(t,e))};var bO=function(t){for(var e=0,r=0,n=1;nt[r][0]&&(r=n);return er?[[r],[e]]:[[e]]};var _O=function(t){var e=t.length;if(e<3){for(var r=new Array(e),n=0;n1&&wO(t[a[u-2]],t[a[u-1]],l)<=0;)u-=1,a.pop();for(a.push(s),u=o.length;u>1&&wO(t[o[u-2]],t[o[u-1]],l)>=0;)u-=1,o.pop();o.push(s)}for(var r=new Array(o.length+a.length-2),c=0,n=0,h=a.length;n0;--f)r[c++]=o[f];return r},wO=PM[3];var MO=function(t){var e=_O(t),r=e.length;if(r<=2)return[];for(var n=new Array(r),i=e[r-1],a=0;a=e[l]&&(s+=1);a[o]=s}}return t}(i,r)}};var SO=function(t){var e=t.length;if(0===e)return[];if(1===e)return[[0]];var r=t[0].length;if(0===r)return[];if(1===r)return bO(t);if(2===r)return MO(t);return TO(t,r)};var EO={jet:[{index:0,rgb:[0,0,131]},{index:.125,rgb:[0,60,170]},{index:.375,rgb:[5,255,255]},{index:.625,rgb:[255,255,0]},{index:.875,rgb:[250,0,0]},{index:1,rgb:[128,0,0]}],hsv:[{index:0,rgb:[255,0,0]},{index:.169,rgb:[253,255,2]},{index:.173,rgb:[247,255,2]},{index:.337,rgb:[0,252,4]},{index:.341,rgb:[0,252,10]},{index:.506,rgb:[1,249,255]},{index:.671,rgb:[2,0,253]},{index:.675,rgb:[8,0,253]},{index:.839,rgb:[255,0,251]},{index:.843,rgb:[255,0,245]},{index:1,rgb:[255,0,6]}],hot:[{index:0,rgb:[0,0,0]},{index:.3,rgb:[230,0,0]},{index:.6,rgb:[255,210,0]},{index:1,rgb:[255,255,255]}],cool:[{index:0,rgb:[0,255,255]},{index:1,rgb:[255,0,255]}],spring:[{index:0,rgb:[255,0,255]},{index:1,rgb:[255,255,0]}],summer:[{index:0,rgb:[0,128,102]},{index:1,rgb:[255,255,102]}],autumn:[{index:0,rgb:[255,0,0]},{index:1,rgb:[255,255,0]}],winter:[{index:0,rgb:[0,0,255]},{index:1,rgb:[0,255,128]}],bone:[{index:0,rgb:[0,0,0]},{index:.376,rgb:[84,84,116]},{index:.753,rgb:[169,200,200]},{index:1,rgb:[255,255,255]}],copper:[{index:0,rgb:[0,0,0]},{index:.804,rgb:[255,160,102]},{index:1,rgb:[255,199,127]}],greys:[{index:0,rgb:[0,0,0]},{index:1,rgb:[255,255,255]}],yignbu:[{index:0,rgb:[8,29,88]},{index:.125,rgb:[37,52,148]},{index:.25,rgb:[34,94,168]},{index:.375,rgb:[29,145,192]},{index:.5,rgb:[65,182,196]},{index:.625,rgb:[127,205,187]},{index:.75,rgb:[199,233,180]},{index:.875,rgb:[237,248,217]},{index:1,rgb:[255,255,217]}],greens:[{index:0,rgb:[0,68,27]},{index:.125,rgb:[0,109,44]},{index:.25,rgb:[35,139,69]},{index:.375,rgb:[65,171,93]},{index:.5,rgb:[116,196,118]},{index:.625,rgb:[161,217,155]},{index:.75,rgb:[199,233,192]},{index:.875,rgb:[229,245,224]},{index:1,rgb:[247,252,245]}],yiorrd:[{index:0,rgb:[128,0,38]},{index:.125,rgb:[189,0,38]},{index:.25,rgb:[227,26,28]},{index:.375,rgb:[252,78,42]},{index:.5,rgb:[253,141,60]},{index:.625,rgb:[254,178,76]},{index:.75,rgb:[254,217,118]},{index:.875,rgb:[255,237,160]},{index:1,rgb:[255,255,204]}],bluered:[{index:0,rgb:[0,0,255]},{index:1,rgb:[255,0,0]}],rdbu:[{index:0,rgb:[5,10,172]},{index:.35,rgb:[106,137,247]},{index:.5,rgb:[190,190,190]},{index:.6,rgb:[220,170,132]},{index:.7,rgb:[230,145,90]},{index:1,rgb:[178,10,28]}],picnic:[{index:0,rgb:[0,0,255]},{index:.1,rgb:[51,153,255]},{index:.2,rgb:[102,204,255]},{index:.3,rgb:[153,204,255]},{index:.4,rgb:[204,204,255]},{index:.5,rgb:[255,255,255]},{index:.6,rgb:[255,204,255]},{index:.7,rgb:[255,153,255]},{index:.8,rgb:[255,102,204]},{index:.9,rgb:[255,102,102]},{index:1,rgb:[255,0,0]}],rainbow:[{index:0,rgb:[150,0,90]},{index:.125,rgb:[0,0,200]},{index:.25,rgb:[0,25,255]},{index:.375,rgb:[0,152,255]},{index:.5,rgb:[44,255,150]},{index:.625,rgb:[151,255,0]},{index:.75,rgb:[255,234,0]},{index:.875,rgb:[255,111,0]},{index:1,rgb:[255,0,0]}],portland:[{index:0,rgb:[12,51,131]},{index:.25,rgb:[10,136,186]},{index:.5,rgb:[242,211,56]},{index:.75,rgb:[242,143,56]},{index:1,rgb:[217,30,30]}],blackbody:[{index:0,rgb:[0,0,0]},{index:.2,rgb:[230,0,0]},{index:.4,rgb:[230,210,0]},{index:.7,rgb:[255,255,255]},{index:1,rgb:[160,200,255]}],earth:[{index:0,rgb:[0,0,130]},{index:.1,rgb:[0,180,180]},{index:.2,rgb:[40,210,40]},{index:.4,rgb:[230,230,50]},{index:.6,rgb:[120,70,20]},{index:1,rgb:[255,255,255]}],electric:[{index:0,rgb:[0,0,0]},{index:.15,rgb:[30,0,100]},{index:.4,rgb:[120,0,100]},{index:.6,rgb:[160,90,0]},{index:.8,rgb:[230,200,0]},{index:1,rgb:[255,250,220]}],alpha:[{index:0,rgb:[255,255,255,0]},{index:1,rgb:[255,255,255,1]}],viridis:[{index:0,rgb:[68,1,84]},{index:.13,rgb:[71,44,122]},{index:.25,rgb:[59,81,139]},{index:.38,rgb:[44,113,142]},{index:.5,rgb:[33,144,141]},{index:.63,rgb:[39,173,129]},{index:.75,rgb:[92,200,99]},{index:.88,rgb:[170,220,50]},{index:1,rgb:[253,231,37]}],inferno:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[31,12,72]},{index:.25,rgb:[85,15,109]},{index:.38,rgb:[136,34,106]},{index:.5,rgb:[186,54,85]},{index:.63,rgb:[227,89,51]},{index:.75,rgb:[249,140,10]},{index:.88,rgb:[249,201,50]},{index:1,rgb:[252,255,164]}],magma:[{index:0,rgb:[0,0,4]},{index:.13,rgb:[28,16,68]},{index:.25,rgb:[79,18,123]},{index:.38,rgb:[129,37,129]},{index:.5,rgb:[181,54,122]},{index:.63,rgb:[229,80,100]},{index:.75,rgb:[251,135,97]},{index:.88,rgb:[254,194,135]},{index:1,rgb:[252,253,191]}],plasma:[{index:0,rgb:[13,8,135]},{index:.13,rgb:[75,3,161]},{index:.25,rgb:[125,3,168]},{index:.38,rgb:[168,34,150]},{index:.5,rgb:[203,70,121]},{index:.63,rgb:[229,107,93]},{index:.75,rgb:[248,148,65]},{index:.88,rgb:[253,195,40]},{index:1,rgb:[240,249,33]}],warm:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[172,0,187]},{index:.25,rgb:[219,0,170]},{index:.38,rgb:[255,0,130]},{index:.5,rgb:[255,63,74]},{index:.63,rgb:[255,123,0]},{index:.75,rgb:[234,176,0]},{index:.88,rgb:[190,228,0]},{index:1,rgb:[147,255,0]}],cool:[{index:0,rgb:[125,0,179]},{index:.13,rgb:[116,0,218]},{index:.25,rgb:[98,74,237]},{index:.38,rgb:[68,146,231]},{index:.5,rgb:[0,204,197]},{index:.63,rgb:[0,247,146]},{index:.75,rgb:[0,255,88]},{index:.88,rgb:[40,255,8]},{index:1,rgb:[147,255,0]}],"rainbow-soft":[{index:0,rgb:[125,0,179]},{index:.1,rgb:[199,0,180]},{index:.2,rgb:[255,0,121]},{index:.3,rgb:[255,108,0]},{index:.4,rgb:[222,194,0]},{index:.5,rgb:[150,255,0]},{index:.6,rgb:[0,255,55]},{index:.7,rgb:[0,246,150]},{index:.8,rgb:[50,167,222]},{index:.9,rgb:[103,51,235]},{index:1,rgb:[124,0,186]}],bathymetry:[{index:0,rgb:[40,26,44]},{index:.13,rgb:[59,49,90]},{index:.25,rgb:[64,76,139]},{index:.38,rgb:[63,110,151]},{index:.5,rgb:[72,142,158]},{index:.63,rgb:[85,174,163]},{index:.75,rgb:[120,206,163]},{index:.88,rgb:[187,230,172]},{index:1,rgb:[253,254,204]}],cdom:[{index:0,rgb:[47,15,62]},{index:.13,rgb:[87,23,86]},{index:.25,rgb:[130,28,99]},{index:.38,rgb:[171,41,96]},{index:.5,rgb:[206,67,86]},{index:.63,rgb:[230,106,84]},{index:.75,rgb:[242,149,103]},{index:.88,rgb:[249,193,135]},{index:1,rgb:[254,237,176]}],chlorophyll:[{index:0,rgb:[18,36,20]},{index:.13,rgb:[25,63,41]},{index:.25,rgb:[24,91,59]},{index:.38,rgb:[13,119,72]},{index:.5,rgb:[18,148,80]},{index:.63,rgb:[80,173,89]},{index:.75,rgb:[132,196,122]},{index:.88,rgb:[175,221,162]},{index:1,rgb:[215,249,208]}],density:[{index:0,rgb:[54,14,36]},{index:.13,rgb:[89,23,80]},{index:.25,rgb:[110,45,132]},{index:.38,rgb:[120,77,178]},{index:.5,rgb:[120,113,213]},{index:.63,rgb:[115,151,228]},{index:.75,rgb:[134,185,227]},{index:.88,rgb:[177,214,227]},{index:1,rgb:[230,241,241]}],"freesurface-blue":[{index:0,rgb:[30,4,110]},{index:.13,rgb:[47,14,176]},{index:.25,rgb:[41,45,236]},{index:.38,rgb:[25,99,212]},{index:.5,rgb:[68,131,200]},{index:.63,rgb:[114,156,197]},{index:.75,rgb:[157,181,203]},{index:.88,rgb:[200,208,216]},{index:1,rgb:[241,237,236]}],"freesurface-red":[{index:0,rgb:[60,9,18]},{index:.13,rgb:[100,17,27]},{index:.25,rgb:[142,20,29]},{index:.38,rgb:[177,43,27]},{index:.5,rgb:[192,87,63]},{index:.63,rgb:[205,125,105]},{index:.75,rgb:[216,162,148]},{index:.88,rgb:[227,199,193]},{index:1,rgb:[241,237,236]}],oxygen:[{index:0,rgb:[64,5,5]},{index:.13,rgb:[106,6,15]},{index:.25,rgb:[144,26,7]},{index:.38,rgb:[168,64,3]},{index:.5,rgb:[188,100,4]},{index:.63,rgb:[206,136,11]},{index:.75,rgb:[220,174,25]},{index:.88,rgb:[231,215,44]},{index:1,rgb:[248,254,105]}],par:[{index:0,rgb:[51,20,24]},{index:.13,rgb:[90,32,35]},{index:.25,rgb:[129,44,34]},{index:.38,rgb:[159,68,25]},{index:.5,rgb:[182,99,19]},{index:.63,rgb:[199,134,22]},{index:.75,rgb:[212,171,35]},{index:.88,rgb:[221,210,54]},{index:1,rgb:[225,253,75]}],phase:[{index:0,rgb:[145,105,18]},{index:.13,rgb:[184,71,38]},{index:.25,rgb:[186,58,115]},{index:.38,rgb:[160,71,185]},{index:.5,rgb:[110,97,218]},{index:.63,rgb:[50,123,164]},{index:.75,rgb:[31,131,110]},{index:.88,rgb:[77,129,34]},{index:1,rgb:[145,105,18]}],salinity:[{index:0,rgb:[42,24,108]},{index:.13,rgb:[33,50,162]},{index:.25,rgb:[15,90,145]},{index:.38,rgb:[40,118,137]},{index:.5,rgb:[59,146,135]},{index:.63,rgb:[79,175,126]},{index:.75,rgb:[120,203,104]},{index:.88,rgb:[193,221,100]},{index:1,rgb:[253,239,154]}],temperature:[{index:0,rgb:[4,35,51]},{index:.13,rgb:[23,51,122]},{index:.25,rgb:[85,59,157]},{index:.38,rgb:[129,79,143]},{index:.5,rgb:[175,95,130]},{index:.63,rgb:[222,112,101]},{index:.75,rgb:[249,146,66]},{index:.88,rgb:[249,196,65]},{index:1,rgb:[232,250,91]}],turbidity:[{index:0,rgb:[34,31,27]},{index:.13,rgb:[65,50,41]},{index:.25,rgb:[98,69,52]},{index:.38,rgb:[131,89,57]},{index:.5,rgb:[161,112,59]},{index:.63,rgb:[185,140,66]},{index:.75,rgb:[202,174,88]},{index:.88,rgb:[216,209,126]},{index:1,rgb:[233,246,171]}],"velocity-blue":[{index:0,rgb:[17,32,64]},{index:.13,rgb:[35,52,116]},{index:.25,rgb:[29,81,156]},{index:.38,rgb:[31,113,162]},{index:.5,rgb:[50,144,169]},{index:.63,rgb:[87,173,176]},{index:.75,rgb:[149,196,189]},{index:.88,rgb:[203,221,211]},{index:1,rgb:[254,251,230]}],"velocity-green":[{index:0,rgb:[23,35,19]},{index:.13,rgb:[24,64,38]},{index:.25,rgb:[11,95,45]},{index:.38,rgb:[39,123,35]},{index:.5,rgb:[95,146,12]},{index:.63,rgb:[152,165,18]},{index:.75,rgb:[201,186,69]},{index:.88,rgb:[233,216,137]},{index:1,rgb:[255,253,205]}],cubehelix:[{index:0,rgb:[0,0,0]},{index:.07,rgb:[22,5,59]},{index:.13,rgb:[60,4,105]},{index:.2,rgb:[109,1,135]},{index:.27,rgb:[161,0,147]},{index:.33,rgb:[210,2,142]},{index:.4,rgb:[251,11,123]},{index:.47,rgb:[255,29,97]},{index:.53,rgb:[255,54,69]},{index:.6,rgb:[255,85,46]},{index:.67,rgb:[255,120,34]},{index:.73,rgb:[255,157,37]},{index:.8,rgb:[241,191,57]},{index:.87,rgb:[224,220,93]},{index:.93,rgb:[218,241,142]},{index:1,rgb:[227,253,198]}]};var CO=function(t,e,r){return t*(1-r)+e*r},LO=function(t){var e,r,n,i,a,o,s,l,u,c;t||(t={});l=(t.nshades||72)-1,s=t.format||"hex",(o=t.colormap)||(o="jet");if("string"==typeof o){if(o=o.toLowerCase(),!EO[o])throw Error(o+" not a supported colorscale");a=EO[o]}else{if(!Array.isArray(o))throw Error("unsupported colormap option",o);a=o.slice()}if(a.length>l)throw new Error(o+" map requires nshades to be at least size "+a.length);u=Array.isArray(t.alpha)?2!==t.alpha.length?[1,1]:t.alpha.slice():"number"==typeof t.alpha?[t.alpha,t.alpha]:[1,1];e=a.map(function(t){return Math.round(t.index*l)}),u[0]=Math.min(Math.max(u[0],0),1),u[1]=Math.min(Math.max(u[1],0),1);var h=a.map(function(t,e){var r=a[e].index,n=a[e].rgb.slice();return 4===n.length&&n[3]>=0&&n[3]<=1?n:(n[3]=u[0]+(u[1]-u[0])*r,n)}),f=[];for(c=0;c=o?(_=1,g=o+2*u+h):g=u*(_=-u/o)+h):(_=0,c>=0?(w=0,g=h):-c>=l?(w=1,g=l+2*c+h):g=c*(w=-c/l)+h);else if(w<0)w=0,u>=0?(_=0,g=h):-u>=o?(_=1,g=o+2*u+h):g=u*(_=-u/o)+h;else{var M=1/b;g=(_*=M)*(o*_+s*(w*=M)+2*u)+w*(s*_+l*w+2*c)+h}else _<0?(m=l+c)>(v=s+u)?(y=m-v)>=(x=o-2*s+l)?(_=1,w=0,g=o+2*u+h):g=(_=y/x)*(o*_+s*(w=1-_)+2*u)+w*(s*_+l*w+2*c)+h:(_=0,m<=0?(w=1,g=l+2*c+h):c>=0?(w=0,g=h):g=c*(w=-c/l)+h):w<0?(m=o+u)>(v=s+c)?(y=m-v)>=(x=o-2*s+l)?(w=1,_=0,g=l+2*c+h):g=(_=1-(w=y/x))*(o*_+s*w+2*u)+w*(s*_+l*w+2*c)+h:(w=0,m<=0?(_=1,g=o+2*u+h):u>=0?(_=0,g=h):g=u*(_=-u/o)+h):(y=l+c-s-u)<=0?(_=0,w=1,g=l+2*c+h):y>=(x=o-2*s+l)?(_=1,w=0,g=o+2*u+h):g=(_=y/x)*(o*_+s*(w=1-_)+2*u)+w*(s*_+l*w+2*c)+h;var A=1-_-w;for(a=0;a1.0001)return null;p+=f[s]}if(Math.abs(p-1)>.001)return null;return[l,function(t,e){for(var r=[0,0,0],n=0;n 0.25) {\n discard;\n }\n gl_FragColor = f_color * texture2D(texture, f_uv) * opacity;\n}"]),JO=E_(["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}"]),KO=E_(["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}"]),QO=E_(["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}"]),$O=E_(["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}"]),tR=E_(["precision mediump float;\n#define GLSLIFY 1\n\nuniform vec3 contourColor;\n\nvoid main() {\n gl_FragColor = vec4(contourColor,1);\n}\n"]);qO.meshShader={vertex:HO,fragment:GO,attributes:[{name:"position",type:"vec3"},{name:"normal",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},qO.wireShader={vertex:WO,fragment:YO,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"}]},qO.pointShader={vertex:XO,fragment:ZO,attributes:[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"uv",type:"vec2"},{name:"pointSize",type:"float"}]},qO.pickShader={vertex:JO,fragment:KO,attributes:[{name:"position",type:"vec3"},{name:"id",type:"vec4"}]},qO.pointPickShader={vertex:QO,fragment:KO,attributes:[{name:"position",type:"vec3"},{name:"pointSize",type:"float"},{name:"id",type:"vec4"}]},qO.contourShader={vertex:$O,fragment:tR,attributes:[{name:"position",type:"vec3"}]};var eR={};eR.vertexNormals=function(t,e,r){for(var n=e.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa){var b=i[u],_=1/Math.sqrt(v*y);for(x=0;x<3;++x){var w=(x+1)%3,M=(x+2)%3;b[x]+=_*(m[w]*g[M]-m[M]*g[w])}}}for(o=0;oa)for(_=1/Math.sqrt(A),x=0;x<3;++x)b[x]*=_;else for(x=0;x<3;++x)b[x]=0}return i},eR.faceNormals=function(t,e,r){for(var n=t.length,i=new Array(n),a=void 0===r?1e-6:r,o=0;oa?1/Math.sqrt(p):0;for(u=0;u<3;++u)f[u]*=p;i[o]=f}return i};var rR=32;function nR(t){switch(t){case"uint8":return[__.mallocUint8,__.freeUint8];case"uint16":return[__.mallocUint16,__.freeUint16];case"uint32":return[__.mallocUint32,__.freeUint32];case"int8":return[__.mallocInt8,__.freeInt8];case"int16":return[__.mallocInt16,__.freeInt16];case"int32":return[__.mallocInt32,__.freeInt32];case"float32":return[__.mallocFloat,__.freeFloat];case"float64":return[__.mallocDouble,__.freeDouble];default:return null}}function iR(t){for(var e=[],r=0;r0?i.push(["d",h,"=s",h,"-d",l,"*n",l].join("")):i.push(["d",h,"=s",h].join("")),l=h),0!=(c=t.length-1-a)&&(u>0?i.push(["e",c,"=s",c,"-e",u,"*n",u,",f",c,"=",o[c],"-f",u,"*n",u].join("")):i.push(["e",c,"=s",c,",f",c,"=",o[c]].join("")),u=c)}r.push("var "+i.join(","));var f=["0","n0-1","data","offset"].concat(iR(t.length));r.push(["if(n0<=",rR,"){","insertionSort(",f.join(","),")}else{","quickSort(",f.join(","),")}"].join("")),r.push("}return "+n);var p=new Function("insertionSort","quickSort",r.join("\n")),d=function(t,e){var r=["'use strict'"],n=["ndarrayInsertionSort",t.join("d"),e].join(""),i=["left","right","data","offset"].concat(iR(t.length)),a=nR(e),o=["i,j,cptr,ptr=left*s0+offset"];if(t.length>1){for(var s=[],l=1;l1){for(r.push("dptr=0;sptr=ptr"),l=t.length-1;l>=0;--l)0!==(h=t[l])&&r.push(["for(i",h,"=0;i",h,"b){break __l}"].join("")),l=t.length-1;l>=1;--l)r.push("sptr+=e"+l,"dptr+=f"+l,"}");for(r.push("dptr=cptr;sptr=cptr-s0"),l=t.length-1;l>=0;--l)0!==(h=t[l])&&r.push(["for(i",h,"=0;i",h,"=0;--l)0!==(h=t[l])&&r.push(["for(i",h,"=0;i",h,"scratch)){",c("cptr",u("cptr-s0")),"cptr-=s0","}",c("cptr","scratch"));return r.push("}"),t.length>1&&a&&r.push("free(scratch)"),r.push("} return "+n),a?new Function("malloc","free",r.join("\n"))(a[0],a[1]):new Function(r.join("\n"))()}(t,e);return p(d,function(t,e,r){var n=["'use strict'"],i=["ndarrayQuickSort",t.join("d"),e].join(""),a=["left","right","data","offset"].concat(iR(t.length)),o=nR(e),s=0;n.push(["function ",i,"(",a.join(","),"){"].join(""));var l=["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 u=[],c=1;c=0;--a)0!==(o=t[a])&&n.push(["for(i",o,"=0;i",o,"1)for(a=0;a1?n.push("ptr_shift+=d"+o):n.push("ptr0+=d"+o),n.push("}"))}}function g(e,r,i,a){if(1===r.length)n.push("ptr0="+h(r[0]));else{for(var o=0;o1)for(o=0;o=1;--o)i&&n.push("pivot_ptr+=f"+o),r.length>1?n.push("ptr_shift+=e"+o):n.push("ptr0+=e"+o),n.push("}")}function v(){t.length>1&&o&&n.push("free(pivot1)","free(pivot2)")}function m(e,r){var i="el"+e,a="el"+r;if(t.length>1){var o="__l"+ ++s;g(o,[i,a],!1,["comp=",f("ptr0"),"-",f("ptr1"),"\n","if(comp>0){tmp0=",i,";",i,"=",a,";",a,"=tmp0;break ",o,"}\n","if(comp<0){break ",o,"}"].join(""))}else n.push(["if(",f(h(i)),">",f(h(a)),"){tmp0=",i,";",i,"=",a,";",a,"=tmp0}"].join(""))}function y(e,r){t.length>1?d([e,r],!1,p("ptr0",f("ptr1"))):n.push(p(h(e),f(h(r))))}function x(e,r,i){if(t.length>1){var a="__l"+ ++s;g(a,[r],!0,[e,"=",f("ptr0"),"-pivot",i,"[pivot_ptr]\n","if(",e,"!==0){break ",a,"}"].join(""))}else n.push([e,"=",f(h(r)),"-pivot",i].join(""))}function b(e,r){t.length>1?d([e,r],!1,["tmp=",f("ptr0"),"\n",p("ptr0",f("ptr1")),"\n",p("ptr1","tmp")].join("")):n.push(["ptr0=",h(e),"\n","ptr1=",h(r),"\n","tmp=",f("ptr0"),"\n",p("ptr0",f("ptr1")),"\n",p("ptr1","tmp")].join(""))}function _(e,r,i){t.length>1?(d([e,r,i],!1,["tmp=",f("ptr0"),"\n",p("ptr0",f("ptr1")),"\n",p("ptr1",f("ptr2")),"\n",p("ptr2","tmp")].join("")),n.push("++"+r,"--"+i)):n.push(["ptr0=",h(e),"\n","ptr1=",h(r),"\n","ptr2=",h(i),"\n","++",r,"\n","--",i,"\n","tmp=",f("ptr0"),"\n",p("ptr0",f("ptr1")),"\n",p("ptr1",f("ptr2")),"\n",p("ptr2","tmp")].join(""))}function w(t,e){b(t,e),n.push("--"+e)}function M(e,r,i){t.length>1?d([e,r],!0,[p("ptr0",f("ptr1")),"\n",p("ptr1",["pivot",i,"[pivot_ptr]"].join(""))].join("")):n.push(p(h(e),f(h(r))),p(h(r),"pivot"+i))}function A(e,r){n.push(["if((",r,"-",e,")<=",rR,"){\n","insertionSort(",e,",",r,",data,offset,",iR(t.length).join(","),")\n","}else{\n",i,"(",e,",",r,",data,offset,",iR(t.length).join(","),")\n","}"].join(""))}function k(e,r,i){t.length>1?(n.push(["__l",++s,":while(true){"].join("")),d([e],!0,["if(",f("ptr0"),"!==pivot",r,"[pivot_ptr]){break __l",s,"}"].join("")),n.push(i,"}")):n.push(["while(",f(h(e)),"===pivot",r,"){",i,"}"].join(""))}return n.push("var "+l.join(",")),m(1,2),m(4,5),m(1,3),m(2,3),m(1,4),m(3,4),m(2,5),m(2,3),m(4,5),t.length>1?d(["el1","el2","el3","el4","el5","index1","index3","index5"],!0,["pivot1[pivot_ptr]=",f("ptr1"),"\n","pivot2[pivot_ptr]=",f("ptr3"),"\n","pivots_are_equal=pivots_are_equal&&(pivot1[pivot_ptr]===pivot2[pivot_ptr])\n","x=",f("ptr0"),"\n","y=",f("ptr2"),"\n","z=",f("ptr4"),"\n",p("ptr5","x"),"\n",p("ptr6","y"),"\n",p("ptr7","z")].join("")):n.push(["pivot1=",f(h("el2")),"\n","pivot2=",f(h("el4")),"\n","pivots_are_equal=pivot1===pivot2\n","x=",f(h("el1")),"\n","y=",f(h("el3")),"\n","z=",f(h("el5")),"\n",p(h("index1"),"x"),"\n",p(h("index3"),"y"),"\n",p(h("index5"),"z")].join("")),y("index2","left"),y("index4","right"),n.push("if(pivots_are_equal){"),n.push("for(k=less;k<=great;++k){"),x("comp","k",1),n.push("if(comp===0){continue}"),n.push("if(comp<0){"),n.push("if(k!==less){"),b("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),n.push("while(true){"),x("comp","great",1),n.push("if(comp>0){"),n.push("great--"),n.push("}else if(comp<0){"),_("k","less","great"),n.push("break"),n.push("}else{"),w("k","great"),n.push("break"),n.push("}"),n.push("}"),n.push("}"),n.push("}"),n.push("}else{"),n.push("for(k=less;k<=great;++k){"),x("comp_pivot1","k",1),n.push("if(comp_pivot1<0){"),n.push("if(k!==less){"),b("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),x("comp_pivot2","k",2),n.push("if(comp_pivot2>0){"),n.push("while(true){"),x("comp","great",2),n.push("if(comp>0){"),n.push("if(--greatindex5){"),k("less",1,"++less"),k("great",2,"--great"),n.push("for(k=less;k<=great;++k){"),x("comp_pivot1","k",1),n.push("if(comp_pivot1===0){"),n.push("if(k!==less){"),b("k","less"),n.push("}"),n.push("++less"),n.push("}else{"),x("comp_pivot2","k",2),n.push("if(comp_pivot2===0){"),n.push("while(true){"),x("comp","great",2),n.push("if(comp===0){"),n.push("if(--great1&&o?new Function("insertionSort","malloc","free",n.join("\n"))(r,o[0],o[1]):new Function("insertionSort",n.join("\n"))(r)}(t,e,d))},oR={};var sR=function(t){var e=t.order,r=t.dtype,n=[e,r].join(":"),i=oR[n];return i||(oR[n]=i=aR(e,r)),i(t),t},lR=function(t){for(var e=1<>1,v=E[2*m+1];","if(v===b){return m}","if(b0&&o.push(","),o.push("[");for(var n=0;n0&&o.push(","),o.push("B(C,E,c[",i[0],"],c[",i[1],"])")}o.push("]")}o.push(");")}}for(var n=t+1;n>1;--n){n=1},wR.isTransparent=function(){return this.opacity<1},wR.pickSlots=1,wR.setPickBase=function(t){this.pickId=t},wR.highlight=function(t){if(t&&this.contourEnable){for(var e=pR(this.cells,this.intensity,t.intensity),r=e.cells,n=e.vertexIds,i=e.vertexWeights,a=r.length,o=__.mallocFloat32(6*a),s=0,l=0;l0&&((u=this.triShader).bind(),u.uniforms=s,this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind());this.edgeCount>0&&this.lineWidth>0&&((u=this.lineShader).bind(),u.uniforms=s,this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind());this.pointCount>0&&((u=this.pointShader).bind(),u.uniforms=s,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind());this.contourEnable&&this.contourCount>0&&this.contourLineWidth>0&&((u=this.contourShader).bind(),u.uniforms=s,this.contourVAO.bind(),e.drawArrays(e.LINES,0,this.contourCount),this.contourVAO.unbind())},wR.drawPick=function(t){t=t||{};for(var e=this.gl,r=t.model||bR,n=t.view||bR,i=t.projection||bR,a=[[-1e6,-1e6,-1e6],[1e6,1e6,1e6]],o=0;o<3;++o)a[0][o]=Math.max(a[0][o],this.clipBounds[0][o]),a[1][o]=Math.min(a[1][o],this.clipBounds[1][o]);this._model=[].slice.call(r),this._view=[].slice.call(n),this._projection=[].slice.call(i),this._resolution=[e.drawingBufferWidth,e.drawingBufferHeight];var s,l={model:r,view:n,projection:i,clipBounds:a,pickId:this.pickId/255};((s=this.pickShader).bind(),s.uniforms=l,this.triangleCount>0&&(this.triangleVAO.bind(),e.drawArrays(e.TRIANGLES,0,3*this.triangleCount),this.triangleVAO.unbind()),this.edgeCount>0&&(this.edgeVAO.bind(),e.lineWidth(this.lineWidth),e.drawArrays(e.LINES,0,2*this.edgeCount),this.edgeVAO.unbind()),this.pointCount>0)&&((s=this.pointPickShader).bind(),s.uniforms=l,this.pointVAO.bind(),e.drawArrays(e.POINTS,0,this.pointCount),this.pointVAO.unbind())},wR.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;for(var e=t.value[0]+256*t.value[1]+65536*t.value[2],r=this.cells[e],n=this.positions,i=new Array(r.length),a=0;a0)i=xO(t.alphahull,a);else{var o=["x","y","z"].indexOf(t.delaunayaxis);i=sO(a.map(function(t){return[t[(o+1)%3],t[(o+2)%3]]}))}var l={positions:a,cells:i,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:WC(t.contour.color).slice(0,3),contourWidth:t.contour.width,useFacetNormals:t.flatshading};t.intensity?(this.color="#fff",l.vertexIntensity=t.intensity,l.vertexIntensityBounds=[t.cmin,t.cmax],l.colormap=t.colorscale.map(function(t){var e=t[0],r=s(t[1]).toRgb();return{index:e,rgb:[r.r,r.g,r.b,1]}})):t.vertexcolor?(this.color=t.vertexcolor[0],l.vertexColors=LR(t.vertexcolor)):t.facecolor?(this.color=t.facecolor[0],l.cellColors=LR(t.facecolor)):(this.color=t.color,l.meshColor=WC(t.color)),this.mesh.update(l)},CR.dispose=function(){this.scene.glplot.remove(this.mesh),this.mesh.dispose()};var PR=function(t,e){var r=t.glplot.gl,n=SR({gl:r}),i=new ER(t,n,e.uid);return n._trace=i,i.update(e),t.glplot.add(n),i},IR={};IR.attributes=RD,IR.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,RD,r,n)}function a(t){var e=t.map(function(t){var e=i(t);return e&&ne.isArrayOrTypedArray(e)?e:null});return e.every(function(t){return t&&t.length===e[0].length})&&e}var o=a(["x","y","z"]),s=a(["i","j","k"]);o?(s&&s.forEach(function(t){for(var e=0;e1)){var c=ne.simpleMap(u.x,e.d2c,0,r.xcalendar),h=ne.distinctVals(c).minDiff;a=Math.min(a,h)}}for(a===1/0&&(a=1),o=0;o");w.push(o,o,o,o,o,o,null)},O=0;O>>=e))<<3,(e|=r=(15<(t>>>=r))<<2)|(r=(3<(t>>>=r))<<1)|t>>>r>>1}function l(t){t:{for(var e=16;268435456>=e;e*=16)if(t<=e){t=e;break t}t=0}return 0<(e=Y[s(t)>>2]).length?e.pop():new ArrayBuffer(t)}function u(t){Y[s(t.byteLength)>>2].push(t)}function c(t,e,r,n,i,a){for(var o=0;o(i=l)&&(i=n.buffer.byteLength,5123===h?i>>=1:5125===h&&(i>>=2)),n.vertCount=i,i=s,0>s&&(i=4,1===(s=n.buffer.dimension)&&(i=0),2===s&&(i=1),3===s&&(i=4)),n.primType=i}function s(t){n.elementsCount--,delete l[t.id],t.buffer.destroy(),t.buffer=null}var l={},u=0,c={uint8:5121,uint16:5123};e.oes_element_index_uint&&(c.uint32=5125),i.prototype.bind=function(){this.buffer.bind()};var h=[];return{create:function(t,e){function l(t){if(t)if("number"==typeof t)u(t),h.primType=4,h.vertCount=0|t,h.type=5121;else{var e=null,r=35044,n=-1,i=-1,s=0,f=0;Array.isArray(t)||G(t)||a(t)?e=t:("data"in t&&(e=t.data),"usage"in t&&(r=Q[t.usage]),"primitive"in t&&(n=rt[t.primitive]),"count"in t&&(i=0|t.count),"type"in t&&(f=c[t.type]),"length"in t?s=0|t.length:(s=i,5123===f||5122===f?s*=2:5125!==f&&5124!==f||(s*=4))),o(h,e,r,n,i,s,f)}else u(),h.primType=4,h.vertCount=0,h.type=5121;return l}var u=r.create(null,34963,!0),h=new i(u._buffer);return n.elementsCount++,l(t),l._reglType="elements",l._elements=h,l.subdata=function(t,e){return u.subdata(t,e),l},l.destroy=function(){s(h)},l},createStream:function(t){var e=h.pop();return e||(e=new i(r.create(null,34963,!0,!1)._buffer)),o(e,t,35040,-1,-1,0,0),e},destroyStream:function(t){h.push(t)},getElements:function(t){return"function"==typeof t&&t._elements instanceof i?t._elements:null},clear:function(){W(l).forEach(s)}}}function v(t){for(var e=X.allocType(5123,t.length),r=0;r>>31<<15,i=(a<<1>>>24)-127,a=a>>13&1023;e[r]=-24>i?n:-14>i?n+(a+1024>>-14-i):15>=i,r.height>>=i,p(r,n[i]),t.mipmask|=1<e;++e)t.images[e]=null;return t}function C(t){for(var e=t.images,r=0;re){for(var r=0;r=--this.refCount&&R(this)}}),s.profile&&(o.getTotalTextureSize=function(){var t=0;return Object.keys(ht).forEach(function(e){t+=ht[e].stats.size}),t}),{create2D:function(e,r){function n(t,e){var r=i.texInfo;L.call(r);var a=E();return"number"==typeof t?k(a,0|t,"number"==typeof e?0|e:0|t):t?(z(r,t),T(a,t)):k(a,1,1),r.genMipmaps&&(a.mipmask=(a.width<<1)-1),i.mipmask=a.mipmask,u(i,a),i.internalformat=a.internalformat,n.width=a.width,n.height=a.height,D(i),S(a,3553),P(r,3553),O(),C(a),s.profile&&(i.stats.size=M(i.internalformat,i.type,a.width,a.height,r.genMipmaps,!1)),n.format=$[i.internalformat],n.type=tt[i.type],n.mag=et[r.magFilter],n.min=rt[r.minFilter],n.wrapS=nt[r.wrapS],n.wrapT=nt[r.wrapT],n}var i=new I(3553);return ht[i.id]=i,o.textureCount++,n(e,r),n.subimage=function(t,e,r,a){e|=0,r|=0,a|=0;var o=g();return u(o,i),o.width=0,o.height=0,p(o,t),o.width=o.width||(i.width>>a)-e,o.height=o.height||(i.height>>a)-r,D(i),d(o,3553,e,r,a),O(),A(o),n},n.resize=function(e,r){var a=0|e,o=0|r||a;if(a===i.width&&o===i.height)return n;n.width=i.width=a,n.height=i.height=o,D(i);for(var l=0;i.mipmask>>l;++l)t.texImage2D(3553,l,i.format,a>>l,o>>l,0,i.format,i.type,null);return O(),s.profile&&(i.stats.size=M(i.internalformat,i.type,a,o,!1,!1)),n},n._reglType="texture2d",n._texture=i,s.profile&&(n.stats=i.stats),n.destroy=function(){i.decRef()},n},createCube:function(e,r,n,i,a,l){function h(t,e,r,n,i,a){var o,l=f.texInfo;for(L.call(l),o=0;6>o;++o)v[o]=E();if("number"!=typeof t&&t){if("object"==typeof t)if(e)T(v[0],t),T(v[1],e),T(v[2],r),T(v[3],n),T(v[4],i),T(v[5],a);else if(z(l,t),c(f,t),"faces"in t)for(t=t.faces,o=0;6>o;++o)u(v[o],f),T(v[o],t[o]);else for(o=0;6>o;++o)T(v[o],t)}else for(t=0|t||1,o=0;6>o;++o)k(v[o],t,t);for(u(f,v[0]),f.mipmask=l.genMipmaps?(v[0].width<<1)-1:v[0].mipmask,f.internalformat=v[0].internalformat,h.width=v[0].width,h.height=v[0].height,D(f),o=0;6>o;++o)S(v[o],34069+o);for(P(l,34067),O(),s.profile&&(f.stats.size=M(f.internalformat,f.type,h.width,h.height,l.genMipmaps,!0)),h.format=$[f.internalformat],h.type=tt[f.type],h.mag=et[l.magFilter],h.min=rt[l.minFilter],h.wrapS=nt[l.wrapS],h.wrapT=nt[l.wrapT],o=0;6>o;++o)C(v[o]);return h}var f=new I(34067);ht[f.id]=f,o.cubeCount++;var v=Array(6);return h(e,r,n,i,a,l),h.subimage=function(t,e,r,n,i){r|=0,n|=0,i|=0;var a=g();return u(a,f),a.width=0,a.height=0,p(a,e),a.width=a.width||(f.width>>i)-r,a.height=a.height||(f.height>>i)-n,D(f),d(a,34069+t,r,n,i),O(),A(a),h},h.resize=function(e){if((e|=0)!==f.width){h.width=f.width=e,h.height=f.height=e,D(f);for(var r=0;6>r;++r)for(var n=0;f.mipmask>>n;++n)t.texImage2D(34069+r,n,f.format,e>>n,e>>n,0,f.format,f.type,null);return O(),s.profile&&(f.stats.size=M(f.internalformat,f.type,h.width,h.height,!1,!0)),h}},h._reglType="textureCube",h._texture=f,s.profile&&(h.stats=f.stats),h.destroy=function(){f.decRef()},h},clear:function(){for(var e=0;er;++r)if(0!=(e.mipmask&1<>r,e.height>>r,0,e.internalformat,e.type,null);else for(var n=0;6>n;++n)t.texImage2D(34069+n,r,e.internalformat,e.width>>r,e.height>>r,0,e.internalformat,e.type,null);P(e.texInfo,e.target)})}}}function k(t,e,r,n,i,a){function o(t,e,r){this.target=t,this.texture=e,this.renderbuffer=r;var n=t=0;e?(t=e.width,n=e.height):r&&(t=r.width,n=r.height),this.width=t,this.height=n}function s(t){t&&(t.texture&&t.texture._texture.decRef(),t.renderbuffer&&t.renderbuffer._renderbuffer.decRef())}function l(t,e,r){t&&(t.texture?t.texture._texture.refCount+=1:t.renderbuffer._renderbuffer.refCount+=1)}function u(e,r){r&&(r.texture?t.framebufferTexture2D(36160,e,r.target,r.texture._texture.texture,0):t.framebufferRenderbuffer(36160,e,36161,r.renderbuffer._renderbuffer.renderbuffer))}function c(t){var e=3553,r=null,n=null,i=t;return"object"==typeof t&&(i=t.data,"target"in t&&(e=0|t.target)),"texture2d"===(t=i._reglType)?r=i:"textureCube"===t?r=i:"renderbuffer"===t&&(n=i,e=36161),new o(e,r,n)}function h(t,e,r,a,s){return r?((t=n.create2D({width:t,height:e,format:a,type:s}))._texture.refCount=0,new o(3553,t,null)):((t=i.create({width:t,height:e,format:a}))._renderbuffer.refCount=0,new o(36161,null,t))}function f(t){return t&&(t.texture||t.renderbuffer)}function p(t,e,r){t&&(t.texture?t.texture.resize(e,r):t.renderbuffer&&t.renderbuffer.resize(e,r))}function d(){this.id=M++,A[this.id]=this,this.framebuffer=t.createFramebuffer(),this.height=this.width=0,this.colorAttachments=[],this.depthStencilAttachment=this.stencilAttachment=this.depthAttachment=null}function g(t){t.colorAttachments.forEach(s),s(t.depthAttachment),s(t.stencilAttachment),s(t.depthStencilAttachment)}function v(e){t.deleteFramebuffer(e.framebuffer),e.framebuffer=null,a.framebufferCount--,delete A[e.id]}function m(e){var n;t.bindFramebuffer(36160,e.framebuffer);var i=e.colorAttachments;for(n=0;ni;++i){for(u=0;ut;++t)r[t].resize(n);return e.width=e.height=n,e},_reglType:"framebufferCube",destroy:function(){r.forEach(function(t){t.destroy()})}})},clear:function(){W(A).forEach(v)},restore:function(){W(A).forEach(function(e){e.framebuffer=t.createFramebuffer(),m(e)})}})}function T(){this.w=this.z=this.y=this.x=this.state=0,this.buffer=null,this.size=0,this.normalized=!1,this.type=5126,this.divisor=this.stride=this.offset=0}function S(t,e,r,n){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;rt&&(t=e.stats.uniformsCount)}),t},r.getMaxAttributesCount=function(){var t=0;return f.forEach(function(e){e.stats.attributesCount>t&&(t=e.stats.attributesCount)}),t}),{clear:function(){var e=t.deleteShader.bind(t);W(u).forEach(e),u={},W(c).forEach(e),c={},f.forEach(function(e){t.deleteProgram(e.program)}),f.length=0,h={},r.shaderCount=0},program:function(t,e,n){var i=h[e];i||(i=h[e]={});var a=i[t];return a||(a=new s(e,t),r.shaderCount++,l(a),i[t]=a,f.push(a)),a},restore:function(){u={},c={};for(var t=0;t="+e+"?"+i+".constant["+e+"]:0;"}).join(""),"}}else{","if(",o,"(",i,".buffer)){",c,"=",s,".createStream(",34962,",",i,".buffer);","}else{",c,"=",s,".getBuffer(",i,".buffer);","}",h,'="type" in ',i,"?",a.glTypes,"[",i,".type]:",c,".dtype;",l.normalized,"=!!",i,".normalized;"),n("size"),n("offset"),n("stride"),n("divisor"),r("}}"),r.exit("if(",l.isStream,"){",s,".destroyStream(",c,");","}"),l})}),o}function k(t,e,r,n,i){var a=_(t),s=function(t,e,r){function n(t){if(t in i){var r=i[t];t=!0;var n,o,s=0|r.x,l=0|r.y;return"width"in r?n=0|r.width:t=!1,"height"in r?o=0|r.height:t=!1,new D(!t&&e&&e.thisDep,!t&&e&&e.contextDep,!t&&e&&e.propDep,function(t,e){var i=t.shared.context,a=n;"width"in r||(a=e.def(i,".","framebufferWidth","-",s));var u=o;return"height"in r||(u=e.def(i,".","framebufferHeight","-",l)),[s,l,a,u]})}if(t in a){var u=a[t];return t=F(u,function(t,e){var r=t.invoke(e,u),n=t.shared.context,i=e.def(r,".x|0"),a=e.def(r,".y|0");return[i,a,e.def('"width" in ',r,"?",r,".width|0:","(",n,".","framebufferWidth","-",i,")"),r=e.def('"height" in ',r,"?",r,".height|0:","(",n,".","framebufferHeight","-",a,")")]}),e&&(t.thisDep=t.thisDep||e.thisDep,t.contextDep=t.contextDep||e.contextDep,t.propDep=t.propDep||e.propDep),t}return e?new D(e.thisDep,e.contextDep,e.propDep,function(t,e){var r=t.shared.context;return[0,0,e.def(r,".","framebufferWidth"),e.def(r,".","framebufferHeight")]}):null}var i=t.static,a=t.dynamic;if(t=n("viewport")){var o=t;t=new D(t.thisDep,t.contextDep,t.propDep,function(t,e){var r=o.append(t,e),n=t.shared.context;return e.set(n,".viewportWidth",r[2]),e.set(n,".viewportHeight",r[3]),r})}return{viewport:t,scissor_box:n("scissor.box")}}(t,a),l=M(t),u=function(t,e){var r=t.static,n=t.dynamic,i={};return nt.forEach(function(t){function e(e,o){if(t in r){var s=e(r[t]);i[a]=R(function(){return s})}else if(t in n){var l=n[t];i[a]=F(l,function(t,e){return o(t,e,t.invoke(e,l))})}}var a=v(t);switch(t){case"cull.enable":case"blend.enable":case"dither":case"stencil.enable":case"depth.enable":case"scissor.enable":case"polygonOffset.enable":case"sample.alpha":case"sample.enable":case"depth.mask":return e(function(t){return t},function(t,e,r){return r});case"depth.func":return e(function(t){return yt[t]},function(t,e,r){return e.def(t.constants.compareFuncs,"[",r,"]")});case"depth.range":return e(function(t){return t},function(t,e,r){return[e.def("+",r,"[0]"),e=e.def("+",r,"[1]")]});case"blend.func":return e(function(t){return[mt["srcRGB"in t?t.srcRGB:t.src],mt["dstRGB"in t?t.dstRGB:t.dst],mt["srcAlpha"in t?t.srcAlpha:t.src],mt["dstAlpha"in t?t.dstAlpha:t.dst]]},function(t,e,r){function n(t,n){return e.def('"',t,n,'" in ',r,"?",r,".",t,n,":",r,".",t)}t=t.constants.blendFuncs;var i=n("src","RGB"),a=n("dst","RGB"),o=(i=e.def(t,"[",i,"]"),e.def(t,"[",n("src","Alpha"),"]"));return[i,a=e.def(t,"[",a,"]"),o,t=e.def(t,"[",n("dst","Alpha"),"]")]});case"blend.equation":return e(function(t){return"string"==typeof t?[J[t],J[t]]:"object"==typeof t?[J[t.rgb],J[t.alpha]]:void 0},function(t,e,r){var n=t.constants.blendEquations,i=e.def(),a=e.def();return(t=t.cond("typeof ",r,'==="string"')).then(i,"=",a,"=",n,"[",r,"];"),t.else(i,"=",n,"[",r,".rgb];",a,"=",n,"[",r,".alpha];"),e(t),[i,a]});case"blend.color":return e(function(t){return o(4,function(e){return+t[e]})},function(t,e,r){return o(4,function(t){return e.def("+",r,"[",t,"]")})});case"stencil.mask":return e(function(t){return 0|t},function(t,e,r){return e.def(r,"|0")});case"stencil.func":return e(function(t){return[yt[t.cmp||"keep"],t.ref||0,"mask"in t?t.mask:-1]},function(t,e,r){return[t=e.def('"cmp" in ',r,"?",t.constants.compareFuncs,"[",r,".cmp]",":",7680),e.def(r,".ref|0"),e=e.def('"mask" in ',r,"?",r,".mask|0:-1")]});case"stencil.opFront":case"stencil.opBack":return e(function(e){return["stencil.opBack"===t?1029:1028,xt[e.fail||"keep"],xt[e.zfail||"keep"],xt[e.zpass||"keep"]]},function(e,r,n){function i(t){return r.def('"',t,'" in ',n,"?",a,"[",n,".",t,"]:",7680)}var a=e.constants.stencilOps;return["stencil.opBack"===t?1029:1028,i("fail"),i("zfail"),i("zpass")]});case"polygonOffset.offset":return e(function(t){return[0|t.factor,0|t.units]},function(t,e,r){return[e.def(r,".factor|0"),e=e.def(r,".units|0")]});case"cull.face":return e(function(t){var e=0;return"front"===t?e=1028:"back"===t&&(e=1029),e},function(t,e,r){return e.def(r,'==="front"?',1028,":",1029)});case"lineWidth":return e(function(t){return t},function(t,e,r){return r});case"frontFace":return e(function(t){return bt[t]},function(t,e,r){return e.def(r+'==="cw"?2304:2305')});case"colorMask":return e(function(t){return t.map(function(t){return!!t})},function(t,e,r){return o(4,function(t){return"!!"+r+"["+t+"]"})});case"sample.coverage":return e(function(t){return["value"in t?t.value:1,!!t.invert]},function(t,e,r){return[e.def('"value" in ',r,"?+",r,".value:1"),e=e.def("!!",r,".invert")]})}}),i}(t),c=w(t),h=s.viewport;return h&&(u.viewport=h),(s=s[h=v("scissor.box")])&&(u[h]=s),(a={framebuffer:a,draw:l,shader:c,state:u,dirty:s=0>1)",s],");")}function e(){r(l,".drawArraysInstancedANGLE(",[d,g,v,s],");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}function o(){function t(){r(c+".drawElements("+[d,v,m,g+"<<(("+m+"-5121)>>1)"]+");")}function e(){r(c+".drawArrays("+[d,g,v]+");")}p?y?t():(r("if(",p,"){"),t(),r("}else{"),e(),r("}")):e()}var s,l,u=t.shared,c=u.gl,h=u.draw,f=n.draw,p=function(){var i=f.elements,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(h,".","elements"),i&&a("if("+i+")"+c+".bindBuffer(34963,"+i+".buffer.buffer);"),i}(),d=i("primitive"),g=i("offset"),v=function(){var i=f.count,a=e;return i?((i.contextDep&&n.contextDynamic||i.propDep)&&(a=r),i=i.append(t,a)):i=a.def(h,".","count"),i}();if("number"==typeof v){if(0===v)return}else r("if(",v,"){"),r.exit("}");Q&&(s=i("instances"),l=t.instancing);var m=p+".type",y=f.elements&&O(f.elements);Q&&("number"!=typeof s||0<=s)?"string"==typeof s?(r("if(",s,">0){"),a(),r("}else if(",s,"<0){"),o(),r("}")):a():o()}function q(t,e,r,n,i){return i=(e=b()).proc("body",i),Q&&(e.instancing=i.def(e.shared.extensions,".angle_instanced_arrays")),t(e,i,r,n),e.compile().body}function H(t,e,r,n){L(t,e),N(t,e,r,n.attributes,function(){return!0}),j(t,e,r,n.uniforms,function(){return!0}),V(t,e,e,r)}function G(t,e,r,n){function i(){return!0}t.batchId="a1",L(t,e),N(t,e,r,n.attributes,i),j(t,e,r,n.uniforms,i),V(t,e,e,r)}function W(t,e,r,n){function i(t){return t.contextDep&&o||t.propDep}function a(t){return!i(t)}L(t,e);var o=r.contextDep,s=e.def(),l=e.def();t.shared.props=l,t.batchId=s;var u=t.scope(),c=t.scope();e(u.entry,"for(",s,"=0;",s,"<","a1",";++",s,"){",l,"=","a0","[",s,"];",c,"}",u.exit),r.needsContext&&T(t,c,r.context),r.needsFramebuffer&&S(t,c,r.framebuffer),C(t,c,r.state,i),r.profile&&i(r.profile)&&B(t,c,r,!1,!0),n?(N(t,u,r,n.attributes,a),N(t,c,r,n.attributes,i),j(t,u,r,n.uniforms,a),j(t,c,r,n.uniforms,i),V(t,u,c,r)):(e=t.global.def("{}"),n=r.shader.progVar.append(t,c),l=c.def(n,".id"),u=c.def(e,"[",l,"]"),c(t.shared.gl,".useProgram(",n,".program);","if(!",u,"){",u,"=",e,"[",l,"]=",t.link(function(e){return q(G,t,r,e,2)}),"(",n,");}",u,".call(this,a0[",s,"],",s,");"))}function Y(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;T(t,i,r.context),r.framebuffer&&r.framebuffer.append(t,i),I(Object.keys(r.state)).forEach(function(e){var n=r.state[e].append(t,i);m(n)?n.forEach(function(r,n){i.set(t.next[e],"["+n+"]",r)}):i.set(a.next,"."+e,n)}),B(t,i,r,!0,!0),["elements","offset","count","instances","primitive"].forEach(function(e){var n=r.draw[e];n&&i.set(a.draw,"."+e,""+n.append(t,i))}),Object.keys(r.uniforms).forEach(function(n){i.set(a.uniforms,"["+e.id(n)+"]",r.uniforms[n].append(t,i))}),Object.keys(r.attributes).forEach(function(e){var n=r.attributes[e].append(t,i),a=t.scopeAttrib(e);Object.keys(new Z).forEach(function(t){i.set(a,"."+t,n[t])})}),n("vert"),n("frag"),0=--this.refCount&&o(this)},i.profile&&(n.getTotalRenderbufferSize=function(){var t=0;return Object.keys(c).forEach(function(e){t+=c[e].stats.size}),t}),{create:function(e,r){function o(e,r){var n=0,a=0,c=32854;if("object"==typeof e&&e?("shape"in e?(n=0|(a=e.shape)[0],a=0|a[1]):("radius"in e&&(n=a=0|e.radius),"width"in e&&(n=0|e.width),"height"in e&&(a=0|e.height)),"format"in e&&(c=s[e.format])):"number"==typeof e?(n=0|e,a="number"==typeof r?0|r:n):e||(n=a=1),n!==u.width||a!==u.height||c!==u.format)return o.width=u.width=n,o.height=u.height=a,u.format=c,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,c,n,a),i.profile&&(u.stats.size=ht[u.format]*u.width*u.height),o.format=l[u.format],o}var u=new a(t.createRenderbuffer());return c[u.id]=u,n.renderbufferCount++,o(e,r),o.resize=function(e,r){var n=0|e,a=0|r||n;return n===u.width&&a===u.height?o:(o.width=u.width=n,o.height=u.height=a,t.bindRenderbuffer(36161,u.renderbuffer),t.renderbufferStorage(36161,u.format,n,a),i.profile&&(u.stats.size=ht[u.format]*u.width*u.height),o)},o._reglType="renderbuffer",o._renderbuffer=u,i.profile&&(o.stats=u.stats),o.destroy=function(){u.decRef()},o},clear:function(){W(c).forEach(o)},restore:function(){W(c).forEach(function(e){e.renderbuffer=t.createRenderbuffer(),t.bindRenderbuffer(36161,e.renderbuffer),t.renderbufferStorage(36161,e.format,e.width,e.height)}),t.bindRenderbuffer(36161,null)}}},pt=[];pt[6408]=4;var dt=[];dt[5121]=1,dt[5126]=4,dt[36193]=2;var gt=["x","y","z","w"],vt="blend.func blend.equation stencil.func stencil.opFront stencil.opBack sample.coverage viewport scissor.box polygonOffset.offset".split(" "),mt={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},yt={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},xt={0:0,zero:0,keep:7680,replace:7681,increment:7682,decrement:7683,"increment wrap":34055,"decrement wrap":34056,invert:5386},bt={cw:2304,ccw:2305},_t=new D(!1,!1,!1,function(){});return function(t){function e(){if(0===X.length)w&&w.update(),Q=null;else{Q=q.next(e),h();for(var t=X.length-1;0<=t;--t){var r=X[t];r&&r(z,null,0)}v.flush(),w&&w.update()}}function r(){!Q&&0=X.length&&n()}}}}function c(){var t=W.viewport,e=W.scissor_box;t[0]=t[1]=e[0]=e[1]=0,z.viewportWidth=z.framebufferWidth=z.drawingBufferWidth=t[2]=e[2]=v.drawingBufferWidth,z.viewportHeight=z.framebufferHeight=z.drawingBufferHeight=t[3]=e[3]=v.drawingBufferHeight}function h(){z.tick+=1,z.time=p(),c(),G.procs.poll()}function f(){c(),G.procs.refresh(),w&&w.update()}function p(){return(H()-M)/1e3}if(!(t=i(t)))return null;var v=t.gl,m=v.getContextAttributes();v.isContextLost();var y=function(t,e){function r(e){var r;e=e.toLowerCase();try{r=n[e]=t.getExtension(e)}catch(t){}return!!r}for(var n={},i=0;ie;++e)$(j({framebuffer:t.framebuffer.faces[e]},t),l);else $(t,l);else l(0,t)},prop:U.define.bind(null,1),context:U.define.bind(null,2),this:U.define.bind(null,3),draw:s({}),buffer:function(t){return I.create(t,34962,!1,!1)},elements:function(t){return D.create(t,!1)},texture:R.create2D,cube:R.createCube,renderbuffer:F.create,framebuffer:V.create,framebufferCube:V.createCube,attributes:m,frame:u,on:function(t,e){var r;switch(t){case"frame":return u(e);case"lost":r=Z;break;case"restore":r=J;break;case"destroy":r=K}return r.push(e),{cancel:function(){for(var t=0;t>>8*e)%256/255}function cF(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=eF-4?uF(o,eF-2-s):.5);return a}(m,v,g,x),A=cF(m,M),k=e.regl,T=k.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?iF:a).concat(r))}return n}(h,f,Math.round(255*(f?b:1)))}),S=k({profile:!1,blend:{enable:y,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:!y,mask:!0,func:"less",range:[0,1]},cull:{enable:!0,face:"back"},scissor:{enable:!0,box:{x:k.prop("scissorX"),y:k.prop("scissorY"),width:k.prop("scissorWidth"),height:k.prop("scissorHeight")}},viewport:{x:k.prop("viewportX"),y:k.prop("viewportY"),width:k.prop("viewportWidth"),height:k.prop("viewportHeight")},dither:!1,vert:p?QR:KR,frag:$R,primitive:"lines",lineWidth:1,attributes:A,uniforms:{resolution:k.prop("resolution"),viewBoxPosition:k.prop("viewBoxPosition"),viewBoxSize:k.prop("viewBoxSize"),dim1A:k.prop("dim1A"),dim2A:k.prop("dim2A"),dim1B:k.prop("dim1B"),dim2B:k.prop("dim2B"),dim1C:k.prop("dim1C"),dim2C:k.prop("dim2C"),dim1D:k.prop("dim1D"),dim2D:k.prop("dim2D"),loA:k.prop("loA"),hiA:k.prop("hiA"),loB:k.prop("loB"),hiB:k.prop("hiB"),loC:k.prop("loC"),hiC:k.prop("hiC"),loD:k.prop("loD"),hiD:k.prop("hiD"),palette:T,colorClamp:k.prop("colorClamp"),scatter:k.prop("scatter")},offset:k.prop("offset"),count:k.prop("count")}),E=[0,1];var C=[];function L(t,e,r,i,o,u,c,h,p,d,v){var m,y,x,b,M=[t,e],A=JR.verticalPadding/u,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(m=0;m<2;m++)for(b=M[m],y=0;y<4;y++)for(x=0;x<16;x++){var S=x+16*y;k[m][y][x]=x+16*y===b?1:0,T[m][y][x]=(!f&&hF(x,16*y,w)?g[0===S?0:1+(S-1)%(g.length-1)].filter[m]:m)+(2*m-1)*A}return{key:c,resolution:[s,l],viewBoxPosition:[r+_,i],viewBoxSize:[o,u],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:E,scatter:h||0,scissorX:(p===d?0:r+_)+(n.pad.l-_)+n.layoutWidth*a.x[0],scissorWidth:(p===v?s-r+_:o+.5)+(p===d?r+_:0),scissorY:i+n.pad.b+n.layoutHeight*a.y[0],scissorHeight:u,viewportX:n.pad.l-_+n.layoutWidth*a.x[0],viewportY:n.pad.b+n.layoutHeight*a.y[0],viewportWidth:s,viewportHeight:l}}return{setColorDomain:function(t){E[0]=t[0],E[1]=t[1]},render:function(t,e,n){var i,a,u,c=1/0,h=-1/0;for(i=0;ih&&(h=t[i].dim2.canvasX,u=i),t[i].dim1.canvasXi)return a;i=o,a=n[r]}return n[n.length-1]}function xF(t){return e.scale.linear().domain(mF(t))}function bF(t,r,n){var i=gF(r),a=i.trace,o=i.lineColor,s=i.cscale,l=a.line,u=a.domain,c=a.dimensions,h=t.width,f=a.labelfont,p=a.tickfont,d=a.rangefont,g=ne.extendDeep({},l,{color:o.map(xF({values:o,range:[l.cmin,l.cmax],_length:a._commonLength})),blockLineCount:JR.blockLineCount,canvasOverdrag:JR.overdrag*JR.canvasPixelRatio}),v=Math.floor(h*(u.x[1]-u.x[0])),m=Math.floor(t.height*(u.y[1]-u.y[0])),y=t.margin||{l:80,r:80,t:100,b:80},x=v,b=m;return{key:n,colCount:c.filter(vF).length,dimensions:c,tickDistance:JR.tickDistance,unitToColor:function(t){var r=t.map(function(t){return t[0]}),n=t.map(function(t){return t[1]}).map(function(t){return e.rgb(t)}),i="rgb".split("").map(function(t){return e.scale.linear().clamp(!0).domain(r).range(n.map((i=t,function(t){return t[i]})));var i});return function(t){return i.map(function(e){return e(t)})}}(s),lines:g,labelFont:f,tickFont:p,rangeFont:d,layoutWidth:h,layoutHeight:t.height,domain:u,translateX:u.x[0]*h,translateY:t.height-u.y[1]*t.height,pad:y,canvasWidth:x*JR.canvasPixelRatio+2*g.canvasOverdrag,canvasHeight:b*JR.canvasPixelRatio,width:x,height:b,canvasPixelRatio:JR.canvasPixelRatio}}function _F(t){var r=t.width,n=t.height,i=t.dimensions,a=t.canvasPixelRatio,o=function(e){return r*e/Math.max(1,t.colCount-1)},s=JR.verticalPadding/(n*a),l=1-2*s,u=function(t){return s+l*t},c={key:t.key,xScale:o,model:t},h={};return c.dimensions=i.filter(vF).map(function(r,i){var s=xF(r),l=h[r.label];h[r.label]=(l||0)+1;var f=r.label+(l?"__"+l:""),p=r.values;return p.length>r._length&&(p=p.slice(0,r._length)),{key:f,label:r.label,tickFormat:r.tickformat,tickvals:r.tickvals,ticktext:r.ticktext,ordinal:!!r.tickvals,scatter:JR.scatter||r.scatter,xIndex:i,crossfilterDimensionIndex:i,visibleIndex:r._index,height:n,values:p,paddedUnitValues:p.map(s).map(u),xScale:o,x:o(i),canvasX:o(i)*a,unitScale:function(t,r){return e.scale.linear().range([t-r,r])}(n,JR.verticalPadding),domainScale:function(t,r,n){var i=mF(n),a=n.ticktext;return n.tickvals?e.scale.ordinal().domain(n.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)}}(e.format(n.tickformat),a))).range(n.tickvals.map(function(t){return(t-i[0])/(i[1]-i[0])}).map(function(e){return t-r+e*(r-(t-r))})):e.scale.linear().domain(i).range([t-r,r])}(n,JR.verticalPadding,r),ordinalScale:function(t){var r=mF(t);return t.tickvals&&e.scale.ordinal().domain(t.tickvals).range(t.tickvals.map(function(t){return(t-r[0])/(r[1]-r[0])}))}(r),domainToUnitScale:s,filter:r.constraintrange?r.constraintrange.map(s):[0,1],parent:c,model:t}}),c}function wF(t){t.classed(JR.cn.axisExtentText,!0).attr("text-anchor","middle").style("cursor","default").style("user-select","none")}var MF={};(function(t){"use strict";MF=function(r,n){var i=r._fullLayout,a=i._toppaper,o=(i._paperdiv,i._glcontainer);i._glcanvas.each(function(e){e.regl||(e.regl=YR({canvas:this,attributes:{antialias:!e.pick,preserveDrawingBuffer:!0},pixelRatio:r._context.plotGlPixelRatio||t.devicePixelRatio}))});var s={},l={},u=i._size;n.forEach(function(t,e){s[e]=r.data[e].dimensions,l[e]=r.data[e].dimensions.slice()});!function(t,r,n,i,a,o){var s=!1,l=!0;var u=i.filter(function(t){return gF(t).trace.visible}).map(bF.bind(0,a)).map(_F);n.each(function(t,e){return ne.extendFlat(t,u[e])});var c=n.selectAll(".gl-canvas").each(function(t){t.viewModel=u[0],t.model=t.viewModel?t.viewModel.model:null}),h={renderers:[],dimensions:[]},f=null;c.filter(function(t){return t.pick}).style("pointer-events","auto").on("mousemove",function(t){if(l&&t.lineLayer&&o&&o.hover){var r=e.event,n=this.width,i=this.height,a=e.mouse(this),s=a[0],u=a[1];if(s<0||u<0||s>=n||u>=i)return;var c=t.lineLayer.readPixel(s,i-1-u),h=0!==c[3],p=h?c[2]+256*(c[1]+256*c[0]):null,d={x:s,y:u,clientX:r.clientX,clientY:r.clientY,dataIndex:t.model.key,curveNumber:p};p!==f&&(h?o.hover(d):o.unhover&&o.unhover(d),f=p)}}),c.style("opacity",function(t){return t.pick?.01:1}),r.style("background","rgba(255, 255, 255, 0)");var p=r.selectAll("."+JR.cn.parcoords).data(u,pF);p.exit().remove(),p.enter().append("g").classed(JR.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(dF,pF);e.enter().append("defs");var r=e.selectAll("#"+JR.id.filterBarPattern).data(dF,pF);r.enter().append("pattern").attr("id",JR.id.filterBarPattern).attr("patternUnits","userSpaceOnUse"),r.attr("x",-JR.bar.width).attr("width",JR.bar.capturewidth).attr("height",function(t){return t.model.height});var n=r.selectAll("rect").data(dF,pF);n.enter().append("rect").attr("shape-rendering","crispEdges"),n.attr("height",function(t){return t.model.height}).attr("width",JR.bar.width).attr("x",JR.bar.width/2).attr("fill",JR.bar.fillcolor).attr("fill-opacity",JR.bar.fillopacity).attr("stroke",JR.bar.strokecolor).attr("stroke-opacity",JR.bar.strokeopacity).attr("stroke-width",JR.bar.strokewidth)}),p.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 d=p.selectAll("."+JR.cn.parcoordsControlView).data(dF,pF);d.enter().append("g").classed(JR.cn.parcoordsControlView,!0).style("box-sizing","content-box"),d.attr("transform",function(t){return"translate("+t.model.pad.l+","+t.model.pad.t+")"});var g=d.selectAll("."+JR.cn.yAxis).data(function(t){return t.dimensions},pF);function v(t){return t.dimensions.some(function(t){return 0!==t.filter[0]||1!==t.filter[1]})}function m(t,e){return(JR.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;oline").attr("fill","none").attr("stroke","black").attr("stroke-opacity",.25).attr("stroke-width","1px"),x.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 b=y.selectAll("."+JR.cn.axisHeading).data(dF,pF);b.enter().append("g").classed(JR.cn.axisHeading,!0);var _=b.selectAll("."+JR.cn.axisTitle).data(dF,pF);_.enter().append("text").classed(JR.cn.axisTitle,!0).attr("text-anchor","middle").style("cursor","ew-resize").style("user-select","none").style("pointer-events","auto"),_.attr("transform","translate(0,"+-JR.axisTitleOffset+")").text(function(t){return t.label}).each(function(t){Sr.font(_,t.model.labelFont)});var w=y.selectAll("."+JR.cn.axisExtent).data(dF,pF);w.enter().append("g").classed(JR.cn.axisExtent,!0);var M=w.selectAll("."+JR.cn.axisExtentTop).data(dF,pF);M.enter().append("g").classed(JR.cn.axisExtentTop,!0),M.attr("transform","translate(0,"+-JR.axisExtentOffset+")");var A=M.selectAll("."+JR.cn.axisExtentTopText).data(dF,pF);function k(t){return t.ordinal?function(){return""}:e.format(t.tickFormat)}A.enter().append("text").classed(JR.cn.axisExtentTopText,!0).call(wF),A.text(function(t){return k(t)(t.domainScale.domain().slice(-1)[0])}).each(function(t){Sr.font(A,t.model.rangeFont)});var T=w.selectAll("."+JR.cn.axisExtentBottom).data(dF,pF);T.enter().append("g").classed(JR.cn.axisExtentBottom,!0),T.attr("transform",function(t){return"translate(0,"+(t.model.height+JR.axisExtentOffset)+")"});var S=T.selectAll("."+JR.cn.axisExtentBottomText).data(dF,pF);S.enter().append("text").classed(JR.cn.axisExtentBottomText,!0).attr("dy","0.75em").call(wF),S.text(function(t){return k(t)(t.domainScale.domain()[0])}).each(function(t){Sr.font(S,t.model.rangeFont)});var E=y.selectAll("."+JR.cn.axisBrush).data(dF,pF),C=E.enter().append("g").classed(JR.cn.axisBrush,!0);E.each(function(t){t.brush||(t.brush=e.svg.brush().y(t.unitScale).on("brushstart",P).on("brush",I).on("brushend",D),0===t.filter[0]&&1===t.filter[1]||t.brush.extent(t.filter),e.select(this).call(t.brush))}),C.selectAll("rect").attr("x",-JR.bar.capturewidth/2).attr("width",JR.bar.capturewidth),C.selectAll("rect.extent").attr("fill","url(#"+JR.id.filterBarPattern+")").style("cursor","ns-resize").filter(function(t){return 0===t.filter[0]&&1===t.filter[1]}).attr("y",-100),C.selectAll(".resize rect").attr("height",JR.bar.handleheight).attr("opacity",0).style("visibility","visible"),C.selectAll(".resize.n rect").style("cursor","n-resize").attr("y",JR.bar.handleoverlap-JR.bar.handleheight),C.selectAll(".resize.s rect").style("cursor","s-resize").attr("y",JR.bar.handleoverlap);var L=!1,z=!1;function P(){L=!0,s=!0}function I(t){l=!1;var r=t.parent,n=t.brush.extent(),i=r.dimensions,a=i[t.xIndex].filter,o=L&&n[0]===n[1];o&&(t.brush.clear(),e.select(this).select("rect.extent").attr("y",-100));var s=o?[0,1]:n.slice();if(s[0]!==a[0]||s[1]!==a[1]){i[t.xIndex].filter=s,r.focusLayer&&r.focusLayer.render(r.panels,!0);var u=v(r);!z&&u?(r.contextLayer&&r.contextLayer.render(r.panels,!0),z=!0):z&&!u&&(r.contextLayer&&r.contextLayer.render(r.panels,!0,!0),z=!1)}L=!1}function D(t){var r=t.parent,n=t.brush.extent(),i=n[0]===n[1],a=r.dimensions[t.xIndex].filter;if(!i&&t.ordinal&&(a[0]=yF(t.ordinalScale,a[0]),a[1]=yF(t.ordinalScale,a[1]),a[0]===a[1]&&(a[0]=Math.max(0,a[0]-.05),a[1]=Math.min(1,a[1]+.05)),e.select(this).transition().duration(150).call(t.brush.extent(a)),r.focusLayer.render(r.panels,!0)),r.pickLayer&&r.pickLayer.render(r.panels,!0),l=!0,s="ending",o&&o.filterChanged){var u=t.domainToUnitScale.invert,c=a.map(u);o.filterChanged(r.key,t.visibleIndex,c)}}}(0,a,o,n,{width:u.w,height:u.h,margin:{t:u.t,r:u.r,b:u.b,l:u.l}},{filterChanged:function(t,e,n){var i=l[t][e],a=i.constraintrange;a&&2===a.length||(a=i.constraintrange=[]),a[0]=n[0],a[1]=n[1],r.emit("plotly_restyle")},hover:function(t){r.emit("plotly_hover",t)},unhover:function(t){r.emit("plotly_unhover",t)},axesMoved:function(t,e){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(r,n){return i(e,t,r)-i(e,t,n)}}(l[t].filter(n));s[t].sort(a),l[t].filter(function(t){return!n(t)}).sort(function(e){return l[t].indexOf(e)}).forEach(function(e){s[t].splice(s[t].indexOf(e),1),s[t].splice(l[t].indexOf(e),0,e)}),r.emit("plotly_restyle")}})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var AF={},kF=sa.getModuleCalcData;AF.name="parcoords",AF.plot=function(t){var e=kF(t.calcdata,"parcoords");e.length&&MF(t,e)},AF.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())},AF.toSVG=function(t){var r=t._fullLayout._glimages,n=e.select(t).selectAll(".svg-container");n.filter(function(t,e){return e===n.size()-1}).selectAll(".gl-canvas-context, .gl-canvas-focus").each(function(){var t=this.toDataURL("image/png");r.append("svg:image").attr({xmlns:$e.svg,"xlink:href":t,preserveAspectRatio:"none",x:0,y:0,width:this.width,height:this.height})}),window.setTimeout(function(){e.selectAll("#filterBarPattern").attr("id","filterBarPattern")},60)};var TF=ZR.wrap;var SF=JR.maxDimensionCount,EF=qc.defaults;var CF={};CF.attributes=WR,CF.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,WR,r,n)}var a=function(t,e){var r,n,i,a=t.dimensions||[],o=e.dimensions=[],s=1/0;function l(t,e){return ne.coerce(r,n,WR.dimensions,t,e)}for(a.length>SF&&(ne.log("parcoords traces support up to "+SF+" dimensions at the moment"),a.splice(SF)),i=0;i0?1:-1)/2,y:a/(1+r*r/(n*n)),outside:!0}}var WF={};WF.attributes=DF,WF.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,DF,r,n)}var a=ne.coerceFont,o=i("values"),s=i("labels");if(!Array.isArray(s)){if(!ne.isArrayOrTypedArray(o)||!o.length)return void(e.visible=!1);i("label0"),i("dlabel")}i("marker.line.width")&&i("marker.line.color"),i("marker.colors"),i("scalegroup");var l=i("text"),u=i("textinfo",Array.isArray(l)?"text+percent":"percent");if(i("hovertext"),u&&"none"!==u){var c=i("textposition"),h=Array.isArray(c)||"auto"===c,f=h||"inside"===c,p=h||"outside"===c;if(f||p){var d=a(i,"textfont",n.font);f&&a(i,"insidetextfont",d),p&&a(i,"outsidetextfont",d)}}jF(e,n,i),i("hole"),i("sort"),i("direction"),i("rotation"),i("pull")},WF.supplyLayoutDefaults=function(t,e){var r,n;r="hiddenlabels",ne.coerce(t,e,VF,r,n)},WF.layoutAttributes=VF,WF.calc=function(t,e){var n,i,a,o,l,u=e.values,c=FF(u)&&u.length,h=e.labels,f=e.marker.colors||[],p=[],d=t._fullLayout,g=d.colorway,v=d._piecolormap,m={},y=0,x=d.hiddenlabels||[];if(d._piecolorway||g===Oe.defaults||(d._piecolorway=NF(g)),e.dlabel)for(h=new Array(u.length),n=0;n")}}return p},WF.plot=function(t,r){var n=t._fullLayout;!function(t,e){var r,n,i,a,o,s,l,u,c,h=[];for(i=0;il&&(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;ai.vTotal/2?1:0)}(r),i.each(function(){var i=e.select(this).selectAll("g.slice").data(r);i.enter().append("g").classed("slice",!0),i.exit().remove();var s=[[[],[]],[[],[]]],l=!1;i.each(function(r){if(r.hidden)e.select(this).selectAll("path,g").remove();else{r.pointNumber=r.i,r.curveNumber=o.index,s[r.pxmid[1]<0?0:1][r.pxmid[0]<0?0:1].push(r);var i=a.cx,u=a.cy,c=e.select(this),h=c.selectAll("path.surface").data([r]),f=!1,p=!1;if(h.enter().append("path").classed("surface",!0).style({"pointer-events":"all"}),c.select("path.textline").remove(),c.on("mouseover",function(){var s=t._fullLayout,l=t._fullData[o.index];if(!t._dragging&&!1!==s.hovermode){var c=l.hoverinfo;if(Array.isArray(c)&&(c=yo.castHoverinfo({hoverinfo:[Gd.castOption(c,r.pts)],_module:o._module},s,0)),"all"===c&&(c="label+text+value+percent+name"),"none"!==c&&"skip"!==c&&c){var h=HF(r,a),d=i+r.pxmid[0]*(1-h),g=u+r.pxmid[1]*(1-h),v=n.separators,m=[];if(-1!==c.indexOf("label")&&m.push(r.label),-1!==c.indexOf("text")){var y=Gd.castOption(l.hovertext||l.text,r.pts);y&&m.push(y)}-1!==c.indexOf("value")&&m.push(Gd.formatPieValue(r.v,v)),-1!==c.indexOf("percent")&&m.push(Gd.formatPiePercent(r.v/a.vTotal,v));var x=o.hoverlabel,b=x.font;yo.loneHover({x0:d-h*a.r,x1:d+h*a.r,y:g,text:m.join("
"),name:-1!==c.indexOf("name")?l.name:void 0,idealAlign:r.pxmid[0]<0?"left":"right",color:Gd.castOption(x.bgcolor,r.pts)||r.color,borderColor:Gd.castOption(x.bordercolor,r.pts),fontFamily:Gd.castOption(b.family,r.pts),fontSize:Gd.castOption(b.size,r.pts),fontColor:Gd.castOption(b.color,r.pts)},{container:s._hoverlayer.node(),outerContainer:s._paper.node(),gd:t}),f=!0}t.emit("plotly_hover",{points:[qF(r,l)],event:e.event}),p=!0}}).on("mouseout",function(n){var i=t._fullLayout,a=t._fullData[o.index];p&&(n.originalEvent=e.event,t.emit("plotly_unhover",{points:[qF(r,a)],event:e.event}),p=!1),f&&(yo.loneUnhover(i._hoverlayer.node()),f=!1)}).on("click",function(){var n=t._fullLayout,i=t._fullData[o.index];t._dragging||!1===n.hovermode||(t._hoverdata=[qF(r,i)],yo.click(t,e.event))}),o.pull){var d=+Gd.castOption(o.pull,r.pts)||0;d>0&&(i+=d*r.pxmid[0],u+=d*r.pxmid[1])}r.cxFinal=i,r.cyFinal=u;var g=o.hole;if(r.v===a.vTotal){var v="M"+(i+r.px0[0])+","+(u+r.px0[1])+_(r.px0,r.pxmid,!0,1)+_(r.pxmid,r.px0,!0,1)+"Z";g?h.attr("d","M"+(i+g*r.px0[0])+","+(u+g*r.px0[1])+_(r.px0,r.pxmid,!1,g)+_(r.pxmid,r.px0,!1,g)+"Z"+v):h.attr("d",v)}else{var m=_(r.px0,r.px1,!0,1);if(g){var y=1-g;h.attr("d","M"+(i+g*r.px1[0])+","+(u+g*r.px1[1])+_(r.px1,r.px0,!1,g)+"l"+y*r.px0[0]+","+y*r.px0[1]+m+"Z")}else h.attr("d","M"+i+","+u+"l"+r.px0[0]+","+r.px0[1]+m+"Z")}var x=Gd.castOption(o.textposition,r.pts),b=c.selectAll("g.slicetext").data(r.text&&"none"!==x?[0]:[]);b.enter().append("g").classed("slicetext",!0),b.exit().remove(),b.each(function(){var n=e.select(this).selectAll("text").data([0]);n.enter().append("text").attr("data-notex",1),n.exit().remove(),n.text(r.text).attr({class:"slicetext",transform:"","text-anchor":"middle"}).call(Sr.font,"outside"===x?o.outsidetextfont:o.insidetextfont).call(er.convertToTspans,t);var s,c=Sr.bBox(n.node());"outside"===x?s=GF(c,r):(s=function(t,e,r){var n=Math.sqrt(t.width*t.width+t.height*t.height),i=t.width/t.height,a=Math.PI*Math.min(e.v/r.vTotal,.5),o=1-r.trace.hole,s=HF(e,r),l={scale:s*r.r*2/n,rCenter:1-s,rotate:0};if(l.scale>=1)return l;var u=i+1/(2*Math.tan(a)),c=r.r*Math.min(1/(Math.sqrt(u*u+.5)+u),o/(Math.sqrt(i*i+o/2)+i)),h={scale:2*c/t.height,rCenter:Math.cos(c/r.r)-c*i/r.r,rotate:(180/Math.PI*e.midangle+720)%180-90},f=1/i,p=f+1/(2*Math.tan(a)),d=r.r*Math.min(1/(Math.sqrt(p*p+.5)+p),o/(Math.sqrt(f*f+o/2)+f)),g={scale:2*d/t.width,rCenter:Math.cos(d/r.r)-d/i/r.r,rotate:(180/Math.PI*e.midangle+810)%180-90},v=g.scale>h.scale?g:h;return l.scale<1&&v.scale>l.scale?v:l}(c,r,a),"auto"===x&&s.scale<1&&(n.call(Sr.font,o.outsidetextfont),o.outsidetextfont.family===o.insidetextfont.family&&o.outsidetextfont.size===o.insidetextfont.size||(c=Sr.bBox(n.node())),s=GF(c,r)));var h=i+r.pxmid[0]*s.rCenter+(s.x||0),f=u+r.pxmid[1]*s.rCenter+(s.y||0);s.outside&&(r.yLabelMin=f-c.height/2,r.yLabelMid=f,r.yLabelMax=f+c.height/2,r.labelExtraX=0,r.labelExtraY=0,l=!0),n.attr("transform","translate("+h+","+f+")"+(s.scale<1?"scale("+s.scale+")":"")+(s.rotate?"rotate("+s.rotate+")":"")+"translate("+-(c.left+c.right)/2+","+-(c.top+c.bottom)/2+")")})}function _(t,e,n,i){return"a"+i*a.r+","+i*a.r+" 0 "+r.largeArc+(n?" 1 ":" 0 ")+i*(e[0]-t[0])+","+i*(e[1]-t[1])}}),l&&function(t,e){var r,n,i,a,o,s,l,u,c,h,f,p,d;function g(t,e){return t.pxmid[1]-e.pxmid[1]}function v(t,e){return e.pxmid[1]-t.pxmid[1]}function m(t,r){r||(r={});var i,u,c,f,p,d,g=r.labelExtraY+(n?r.yLabelMax:r.yLabelMin),v=n?t.yLabelMin:t.yLabelMax,m=n?t.yLabelMax:t.yLabelMin,y=t.cyFinal+o(t.px0[1],t.px1[1]),x=g-v;if(x*l>0&&(t.labelExtraY=x),Array.isArray(e.pull))for(u=0;u=(Gd.castOption(e.pull,c.pts)||0)||((t.pxmid[1]-c.pxmid[1])*l>0?(f=c.cyFinal+o(c.px0[1],c.px1[1]),(x=f-v-t.labelExtraY)*l>0&&(t.labelExtraY+=x)):(m+t.labelExtraY-y)*l>0&&(i=3*s*Math.abs(u-h.indexOf(t)),p=c.cxFinal+a(c.px0[0],c.px1[0]),(d=p+i-(t.cxFinal+t.pxmid[0])-t.labelExtraX)*s>0&&(t.labelExtraX+=d)))}for(n=0;n<2;n++)for(i=n?g:v,o=n?Math.max:Math.min,l=n?1:-1,r=0;r<2;r++){for(a=r?Math.max:Math.min,s=r?1:-1,(u=t[n][r]).sort(i),c=t[1-n][r],h=c.concat(u),p=[],f=0;fMath.abs(u)?a+="l"+u*t.pxmid[0]/t.pxmid[1]+","+u+"H"+(i+t.labelExtraX+s):a+="l"+t.labelExtraX+","+l+"v"+(u-l)+"h"+s}else a+="V"+(t.yLabelMid+t.labelExtraY)+"h"+s;r.append("path").classed("textline",!0).call(Oe.stroke,o.outsidetextfont.color).attr({"stroke-width":Math.min(2,o.outsidetextfont.size/8),d:a,fill:"none"})}})})}),setTimeout(function(){i.selectAll("tspan").each(function(){var t=e.select(this);t.attr("dy")&&t.attr("dy",t.attr("dy"))})},0)},WF.style=function(t){t._fullLayout._pielayer.selectAll(".trace").each(function(t){var r=t[0].trace,n=e.select(this);n.style({opacity:r.opacity}),n.selectAll("path.surface").each(function(t){e.select(this).call(Yd,t,r)})})},WF.styleOne=Yd,WF.moduleType="trace",WF.name="pie",WF.basePlotModule=OF,WF.categories=["pie","showLegend"],WF.meta={};var YF=WF,XF={x:Zr.x,y:Zr.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:Zr.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"}},ZF={};ZF.pointVertex=E_(["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}"]),ZF.pointFragment=E_(["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"]),ZF.pickVertex=E_(["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"]),ZF.pickFragment=E_(["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"]);var JF=function(t,e){var r=t.gl,n=S_(r),i=S_(r),a=Bw(r,ZF.pointVertex,ZF.pointFragment),o=Bw(r,ZF.pickVertex,ZF.pickFragment),s=new KF(t,n,i,a,o);return s.update(e),t.addObject(s),s};function KF(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 QF=KF.prototype;QF.dispose=function(){this.shader.dispose(),this.pickShader.dispose(),this.offsetBuffer.dispose(),this.pickBuffer.dispose(),this.plot.removeObject(this)},QF.update=function(t){var e;function r(e,r){return e in t?t[e]:r}t=t||{},this.sizeMin=r("sizeMin",.5),this.sizeMax=r("sizeMax",20),this.color=r("color",[1,0,0,1]).slice(),this.areaRatio=r("areaRatio",1),this.borderColor=r("borderColor",[0,0,0,1]).slice(),this.blend=r("blend",!1);var n=t.positions.length>>>1,i=t.positions instanceof Float32Array,a=t.idToIndex instanceof Int32Array&&t.idToIndex.length>=n,o=t.positions,s=i?o:__.mallocFloat32(o.length),l=a?t.idToIndex:__.mallocInt32(n);if(i||s.set(o),!a)for(s.set(o),e=0;e>>1;for(r=0;r=e[0]&&a<=e[2]&&o>=e[1]&&o<=e[3]&&n++}return n}(this.points,o),c=this.plot.pickPixelRatio*Math.max(Math.min(this.sizeMinCap,this.sizeMin),Math.min(this.sizeMax,this.sizeMax/Math.pow(u,.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=c<5,i.uniforms.pointSize=c,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}}(),QF.draw=QF.unifiedDraw,QF.drawPick=QF.unifiedDraw,QF.pick=function(t,e,r){var n=this.pickOffset,i=this.pointCount;if(r=n+i)return null;var a=r-n,o=this.points;return{object:this,pointId:a,dataCoord:[o[2*a],o[2*a+1]]}};var $F=jn;function tB(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=JF(t.glplot,this.pointcloudOptions),this.pointcloud._trace=this}var eB=tB.prototype;eB.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}},eB.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=mx(t,{})},eB.updateFast=function(t){var e,r,n,i,a,o,s=this.xData=this.pickXData=t.x,l=this.yData=this.pickYData=t.y,u=this.pickXYData=t.xy,c=t.xbounds&&t.ybounds,h=t.indices,f=this.bounds;if(u){if(n=u,e=u.length>>>1,c)f[0]=t.xbounds[0],f[2]=t.xbounds[1],f[1]=t.ybounds[0],f[3]=t.ybounds[1];else for(o=0;of[2]&&(f[2]=i),af[3]&&(f[3]=a);if(h)r=h;else for(r=new Int32Array(e),o=0;of[2]&&(f[2]=i),af[3]&&(f[3]=a);this.idToIndex=r,this.pointcloudOptions.idToIndex=r,this.pointcloudOptions.positions=n;var p=WC(t.marker.color),d=WC(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=s.length<100||l.length<100}this.pointcloudOptions.blend=v,d[3]*=g,this.pointcloudOptions.borderColor=d;var m=t.marker.sizemin,y=Math.max(t.marker.sizemax,t.marker.sizemin);this.pointcloudOptions.sizeMin=m,this.pointcloudOptions.sizeMax=y,this.pointcloudOptions.areaRatio=t.marker.border.arearatio,this.pointcloud.update(this.pointcloudOptions),this.expandAxesFast(f,y/2)},eB.expandAxesFast=function(t,e){var r=e||.5;$F(this.scene.xaxis,[t[0],t[2]],{ppad:r}),$F(this.scene.yaxis,[t[1],t[3]],{ppad:r})},eB.dispose=function(){this.pointcloud.dispose()};var rB=function(t,e){var r=new tB(t,e.uid);return r.update(e),r},nB=function(t,e){var r=[{x:!1,y:!1,trace:e,t:{}}];return dh(r,e),ex(e),r},iB={};iB.attributes=XF,iB.supplyDefaults=function(t,e,r){function n(r,n){return ne.coerce(t,e,XF,r,n)}n("x"),n("y"),n("xbounds"),n("ybounds"),t.xy&&t.xy instanceof Float32Array&&(e.xy=t.xy),t.indices&&t.indices instanceof Int32Array&&(e.indices=t.indices),n("text"),n("marker.color",r),n("marker.opacity"),n("marker.blend"),n("marker.sizemin"),n("marker.sizemax"),n("marker.border.color",r),n("marker.border.arearatio")},iB.calc=nB,iB.plot=rB,iB.moduleType="trace",iB.name="pointcloud",iB.basePlotModule=sL,iB.categories=["gl","gl2d","showLegend"],iB.meta={};var aB=iB,oB=qc.attributes,sB=m.extendFlat,lB=(0,ye.overrideAll)({hoverinfo:sB({},E.hoverinfo,{flags:["label","text","value","percent","name"]}),hoverlabel:S.hoverlabel,domain:oB({name:"sankey",trace:!0}),orientation:{valType:"enumerated",values:["v","h"],dflt:"h"},valueformat:{valType:"string",dflt:".3s"},valuesuffix:{valType:"string",dflt:""},arrangement:{valType:"enumerated",values:["snap","perpendicular","freeform","fixed"],dflt:"snap"},textfont:T({}),node:{label:{valType:"data_array",dflt:[]},color:{valType:"color",arrayOk:!0},line:{color:{valType:"color",dflt:C.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:C.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"),uB={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"}},cB={exports:{}};!function(t,e){"object"==typeof cB.exports?e(cB.exports):e(t.d3=t.d3||{})}(this,function(t){"use strict";var e=function(t,e){return te?1:t>=e?0:NaN},r=function(t){var r;return 1===t.length&&(r=t,t=function(t,n){return e(r(t),n)}),{left:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)<0?n=a+1:i=a}return n},right:function(e,r,n,i){for(null==n&&(n=0),null==i&&(i=e.length);n>>1;t(e[a],r)>0?i=a:n=a+1}return n}}};var n=r(e),i=n.right,a=n.left;function o(t,e){return[t,e]}var s=function(t){return null===t?NaN:+t},l=function(t,e){var r,n,i=t.length,a=0,o=-1,l=0,u=0;if(null==e)for(;++o1)return u/(a-1)},u=function(t,e){var r=l(t,e);return r?Math.sqrt(r):r},c=function(t,e){var r,n,i,a=t.length,o=-1;if(null==e){for(;++o=r)for(n=i=r;++or&&(n=r),i=r)for(n=i=r;++or&&(n=r),i=0?(a>=m?10:a>=y?5:a>=x?2:1)*Math.pow(10,i):-Math.pow(10,-i)/(a>=m?10:a>=y?5:a>=x?2:1)}function _(t,e,r){var n=Math.abs(e-t)/Math.max(0,r),i=Math.pow(10,Math.floor(Math.log(n)/Math.LN10)),a=n/i;return a>=m?i*=10:a>=y?i*=5:a>=x&&(i*=2),e=1)return+r(t[n-1],n-1,t);var n,i=(n-1)*e,a=Math.floor(i),o=+r(t[a],a,t);return o+(+r(t[a+1],a+1,t)-o)*(i-a)}},A=function(t,e){var r,n,i=t.length,a=-1;if(null==e){for(;++a=r)for(n=r;++ar&&(n=r)}else for(;++a=r)for(n=r;++ar&&(n=r);return n},k=function(t){if(!(i=t.length))return[];for(var e=-1,r=A(t,T),n=new Array(r);++et?1:e>=t?0:NaN},t.deviation=u,t.extent=c,t.histogram=function(){var t=g,e=c,r=w;function n(n){var a,o,s=n.length,l=new Array(s);for(a=0;ah;)f.pop(),--p;var d,g=new Array(p+1);for(a=0;a<=p;++a)(d=g[a]=[]).x0=a>0?f[a-1]:c,d.x1=a=r)for(n=r;++an&&(n=r)}else for(;++a=r)for(n=r;++an&&(n=r);return n},t.mean=function(t,e){var r,n=t.length,i=n,a=-1,o=0;if(null==e)for(;++a=0;)for(e=(n=t[i]).length;--e>=0;)r[--o]=n[e];return r},t.min=A,t.pairs=function(t,e){null==e&&(e=o);for(var r=0,n=t.length-1,i=t[0],a=new Array(n<0?0:n);r0)return[t];if((n=e0)for(t=Math.ceil(t/o),e=Math.floor(e/o),a=new Array(i=Math.ceil(e-t+1));++s=l.length)return null!=t&&n.sort(t),null!=e?e(n):n;for(var s,u,h,f=-1,p=n.length,d=l[i++],g=r(),v=a();++fl.length)return r;var i,a=u[n-1];return null!=e&&n>=l.length?i=r.entries():(i=[],r.each(function(e,r){i.push({key:r,values:t(e,n)})})),null!=a?i.sort(function(t,e){return a(t.key,e.key)}):i}(c(t,0,a,o),0)},key:function(t){return l.push(t),s},sortKeys:function(t){return u[l.length-1]=t,s},sortValues:function(e){return t=e,s},rollup:function(t){return e=t,s}}},t.set=u,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})}),hB=hB.exports;var fB={exports:{}};!function(t,e){"object"==typeof fB.exports?e(fB.exports):e(t.d3=t.d3||{})}(this,function(t){"use strict";var e=function(t,e,r){t.prototype=e.prototype=r,r.constructor=t};function r(t,e){var r=Object.create(t.prototype);for(var n in e)r[n]=e[n];return r}function n(){}var i="\\s*([+-]?\\d+)\\s*",a="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*",s=/^#([0-9a-f]{3})$/,l=/^#([0-9a-f]{6})$/,u=new RegExp("^rgb\\("+[i,i,i]+"\\)$"),c=new RegExp("^rgb\\("+[o,o,o]+"\\)$"),h=new RegExp("^rgba\\("+[i,i,i,a]+"\\)$"),f=new RegExp("^rgba\\("+[o,o,o,a]+"\\)$"),p=new RegExp("^hsl\\("+[a,o,o]+"\\)$"),d=new RegExp("^hsla\\("+[a,o,o,a]+"\\)$"),g={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};function v(t){var e;return t=(t+"").trim().toLowerCase(),(e=s.exec(t))?new _((e=parseInt(e[1],16))>>8&15|e>>4&240,e>>4&15|240&e,(15&e)<<4|15&e,1):(e=l.exec(t))?m(parseInt(e[1],16)):(e=u.exec(t))?new _(e[1],e[2],e[3],1):(e=c.exec(t))?new _(255*e[1]/100,255*e[2]/100,255*e[3]/100,1):(e=h.exec(t))?y(e[1],e[2],e[3],e[4]):(e=f.exec(t))?y(255*e[1]/100,255*e[2]/100,255*e[3]/100,e[4]):(e=p.exec(t))?w(e[1],e[2]/100,e[3]/100,1):(e=d.exec(t))?w(e[1],e[2]/100,e[3]/100,e[4]):g.hasOwnProperty(t)?m(g[t]):"transparent"===t?new _(NaN,NaN,NaN,0):null}function m(t){return new _(t>>16&255,t>>8&255,255&t,1)}function y(t,e,r,n){return n<=0&&(t=e=r=NaN),new _(t,e,r,n)}function x(t){return t instanceof n||(t=v(t)),t?new _((t=t.rgb()).r,t.g,t.b,t.opacity):new _}function b(t,e,r,n){return 1===arguments.length?x(t):new _(t,e,r,null==n?1:n)}function _(t,e,r,n){this.r=+t,this.g=+e,this.b=+r,this.opacity=+n}function w(t,e,r,n){return n<=0?t=e=r=NaN:r<=0||r>=1?t=e=NaN:e<=0&&(t=NaN),new A(t,e,r,n)}function M(t,e,r,i){return 1===arguments.length?function(t){if(t instanceof A)return new A(t.h,t.s,t.l,t.opacity);if(t instanceof n||(t=v(t)),!t)return new A;if(t instanceof A)return t;var e=(t=t.rgb()).r/255,r=t.g/255,i=t.b/255,a=Math.min(e,r,i),o=Math.max(e,r,i),s=NaN,l=o-a,u=(o+a)/2;return l?(s=e===o?(r-i)/l+6*(r0&&u<1?0:s,new A(s,l,u,t.opacity)}(t):new A(t,e,r,null==i?1:i)}function A(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}function k(t,e,r){return 255*(t<60?e+(r-e)*t/60:t<180?r:t<240?e+(r-e)*(240-t)/60:e)}e(n,v,{displayable:function(){return this.rgb().displayable()},toString:function(){return this.rgb()+""}}),e(_,b,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new _(this.r*t,this.g*t,this.b*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new _(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+")")}})),e(A,M,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new A(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new A(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 _(k(t>=240?t-240:t+120,i,n),k(t,i,n),k(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 T=Math.PI/180,S=180/Math.PI,E=.95047,C=1,L=1.08883,z=4/29,P=6/29,I=3*P*P,D=P*P*P;function O(t){if(t instanceof F)return new F(t.l,t.a,t.b,t.opacity);if(t instanceof q){var e=t.h*T;return new F(t.l,Math.cos(e)*t.c,Math.sin(e)*t.c,t.opacity)}t instanceof _||(t=x(t));var r=V(t.r),n=V(t.g),i=V(t.b),a=B((.4124564*r+.3575761*n+.1804375*i)/E),o=B((.2126729*r+.7151522*n+.072175*i)/C);return new F(116*o-16,500*(a-o),200*(o-B((.0193339*r+.119192*n+.9503041*i)/L)),t.opacity)}function R(t,e,r,n){return 1===arguments.length?O(t):new F(t,e,r,null==n?1:n)}function F(t,e,r,n){this.l=+t,this.a=+e,this.b=+r,this.opacity=+n}function B(t){return t>D?Math.pow(t,1/3):t/I+z}function N(t){return t>P?t*t*t:I*(t-z)}function j(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function V(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function U(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof q)return new q(t.h,t.c,t.l,t.opacity);t instanceof F||(t=O(t));var e=Math.atan2(t.b,t.a)*S;return new q(e<0?e+360:e,Math.sqrt(t.a*t.a+t.b*t.b),t.l,t.opacity)}(t):new q(t,e,r,null==n?1:n)}function q(t,e,r,n){this.h=+t,this.c=+e,this.l=+r,this.opacity=+n}e(F,R,r(n,{brighter:function(t){return new F(this.l+18*(null==t?1:t),this.a,this.b,this.opacity)},darker:function(t){return new F(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=C*N(t),new _(j(3.2404542*(e=E*N(e))-1.5371385*t-.4985314*(r=L*N(r))),j(-.969266*e+1.8760108*t+.041556*r),j(.0556434*e-.2040259*t+1.0572252*r),this.opacity)}})),e(q,U,r(n,{brighter:function(t){return new q(this.h,this.c,this.l+18*(null==t?1:t),this.opacity)},darker:function(t){return new q(this.h,this.c,this.l-18*(null==t?1:t),this.opacity)},rgb:function(){return O(this).rgb()}}));var H=-.14861,G=1.78277,W=-.29227,Y=-.90649,X=1.97294,Z=X*Y,J=X*G,K=G*W-Y*H;function Q(t,e,r,n){return 1===arguments.length?function(t){if(t instanceof $)return new $(t.h,t.s,t.l,t.opacity);t instanceof _||(t=x(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,o=(X*(r-i)-W*a)/Y,s=Math.sqrt(o*o+a*a)/(X*i*(1-i)),l=s?Math.atan2(o,a)*S-120:NaN;return new $(l<0?l+360:l,s,i,t.opacity)}(t):new $(t,e,r,null==n?1:n)}function $(t,e,r,n){this.h=+t,this.s=+e,this.l=+r,this.opacity=+n}e($,Q,r(n,{brighter:function(t){return t=null==t?1/.7:Math.pow(1/.7,t),new $(this.h,this.s,this.l*t,this.opacity)},darker:function(t){return t=null==t?.7:Math.pow(.7,t),new $(this.h,this.s,this.l*t,this.opacity)},rgb:function(){var t=isNaN(this.h)?0:(this.h+120)*T,e=+this.l,r=isNaN(this.s)?0:this.s*e*(1-e),n=Math.cos(t),i=Math.sin(t);return new _(255*(e+r*(H*n+G*i)),255*(e+r*(W*n+Y*i)),255*(e+r*(X*n)),this.opacity)}})),t.color=v,t.rgb=b,t.hsl=M,t.lab=R,t.hcl=U,t.cubehelix=Q,Object.defineProperty(t,"__esModule",{value:!0})}),fB=fB.exports;var pB={exports:{}};!function(t,e){"object"==typeof pB.exports?e(pB.exports,fB):e(t.d3=t.d3||{},t.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}var n=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=i180||r<-180?r-360*Math.round(r/360):r):a(isNaN(t)?e:t)}function l(t){return 1==(t=+t)?u:function(e,r){return r-e?function(t,e,r){return t=Math.pow(t,r),e=Math.pow(e,r)-t,r=1/r,function(n){return Math.pow(t+n*e,r)}}(e,r,t):a(isNaN(e)?r:e)}}function u(t,e){var r=e-t;return r?o(t,r):a(isNaN(t)?e:t)}var c=function t(r){var n=l(r);function i(t,r){var i=n((t=e.rgb(t)).r,(r=e.rgb(r)).r),a=n(t.g,r.g),o=n(t.b,r.b),s=u(t.opacity,r.opacity);return function(e){return t.r=i(e),t.g=a(e),t.b=o(e),t.opacity=s(e),t+""}}return i.gamma=t,i}(1);function h(t){return function(r){var n,i,a=r.length,o=new Array(a),s=new Array(a),l=new Array(a);for(n=0;na&&(i=e.slice(a,i),s[o]?s[o]+=i:s[++o]=i),(r=r[0])===(n=n[0])?s[o]?s[o]+=n:s[++o]=n:(s[++o]=null,l.push({i:o,x:v(r,n)})),a=x.lastIndex;return a180?e+=360:e-t>180&&(t+=360),a.push({i:r.push(i(r)+"rotate(",null,n)-2,x:v(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:v(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:v(t,r)},{i:s-2,x:v(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;++r0;--t)p(u*=.99),d(),f(u),d();function f(t){function r(t){return c(t.source)*t.value}i.forEach(function(n){n.forEach(function(n){if(n.targetLinks.length){var i=e.sum(n.targetLinks,r)/e.sum(n.targetLinks,h);n.y+=(i-c(n))*t}})})}function p(t){function r(t){return c(t.target)*t.value}i.slice().reverse().forEach(function(n){n.forEach(function(n){if(n.sourceLinks.length){var i=e.sum(n.sourceLinks,r)/e.sum(n.sourceLinks,h);n.y+=(i-c(n))*t}})})}function d(){i.forEach(function(t){var e,r,n,i=0,s=t.length;for(t.sort(g),n=0;n0&&(e.y+=r),i=e.y+e.dy+a;if((r=i-a-o[1])>0)for(i=e.y-=r,n=s-2;n>=0;--n)e=t[n],(r=e.y+e.dy+a-i)>0&&(e.y-=r),i=e.y})}function g(t,e){return t.y-e.y}}(n),u(),t},t.relayout=function(){return u(),t},t.link=function(){var t=.5;function e(e){var r=e.source.x+e.source.dx,i=e.target.x,a=n.interpolateNumber(r,i),o=a(t),s=a(1-t),l=e.source.y+e.sy,u=l+e.dy,c=e.target.y+e.ty,h=c+e.dy;return"M"+r+","+l+"C"+o+","+l+" "+s+","+c+" "+i+","+c+"L"+i+","+h+"C"+s+","+h+" "+o+","+u+" "+r+","+u+"Z"}return e.curvature=function(r){return arguments.length?(t=+r,e):t},e},t},Object.defineProperty(t,"__esModule",{value:!0})}),dB=dB.exports;var gB={exports:{}};!function(t,e){"object"==typeof gB.exports?e(gB.exports):e(t.d3=t.d3||{})}(this,function(t){"use strict";var e={value:function(){}};function r(){for(var t,e=0,r=arguments.length,i={};e=0&&(e=t.slice(r+1),t=t.slice(0,r)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:e}})),l=-1,u=s.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++l0)for(var r,n,i=new Array(r),a=0;a=(a=(g+m)/2))?g=a:m=a,(c=r>=(o=(v+y)/2))?v=o:y=o,i=p,!(p=p[h=c<<1|u]))return i[h]=d,t;if(s=+t._x.call(null,p.data),l=+t._y.call(null,p.data),e===s&&r===l)return d.next=p,i?i[h]=d:t._root=d,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(u=e>=(a=(g+m)/2))?g=a:m=a,(c=r>=(o=(v+y)/2))?v=o:y=o}while((h=c<<1|u)==(f=(l>=o)<<1|s>=a));return i[f]=p,i[h]=d,t}var r=function(t,e,r,n,i){this.node=t,this.x0=e,this.y0=r,this.x1=n,this.y1=i};function n(t){return t[0]}function i(t){return t[1]}function a(t,e,r){var a=new o(null==e?n:e,null==r?i:r,NaN,NaN,NaN,NaN);return null==t?a:a.addAll(t)}function o(t,e,r,n,i,a){this._x=t,this._y=e,this._x0=r,this._y0=n,this._x1=i,this._y1=a,this._root=void 0}function s(t){for(var e={data:t.data},r=e;t=t.next;)r=r.next={data:t.data};return e}var l=a.prototype=o.prototype;l.copy=function(){var t,e,r=new o(this._x,this._y,this._x0,this._y0,this._x1,this._y1),n=this._root;if(!n)return r;if(!n.length)return r._root=s(n),r;for(t=[{source:n,target:r._root=new Array(4)}];n=t.pop();)for(var i=0;i<4;++i)(e=n.source[i])&&(e.length?t.push({source:e,target:n.target[i]=new Array(4)}):n.target[i]=s(e));return r},l.add=function(t){var r=+this._x.call(null,t),n=+this._y.call(null,t);return e(this.cover(r,n),r,n,t)},l.addAll=function(t){var r,n,i,a,o=t.length,s=new Array(o),l=new Array(o),u=1/0,c=1/0,h=-1/0,f=-1/0;for(n=0;nh&&(h=i),af&&(f=a));for(ht||t>i||n>e||e>a))return this;var o,s,l=i-r,u=this._root;switch(s=(e<(n+a)/2)<<1|t<(r+i)/2){case 0:do{(o=new Array(4))[s]=u,u=o}while(a=n+(l*=2),t>(i=r+l)||e>a);break;case 1:do{(o=new Array(4))[s]=u,u=o}while(a=n+(l*=2),(r=i-l)>t||e>a);break;case 2:do{(o=new Array(4))[s]=u,u=o}while(n=a-(l*=2),t>(i=r+l)||n>e);break;case 3:do{(o=new Array(4))[s]=u,u=o}while(n=a-(l*=2),(r=i-l)>t||n>e)}this._root&&this._root.length&&(this._root=u)}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,n){var i,a,o,s,l,u,c,h=this._x0,f=this._y0,p=this._x1,d=this._y1,g=[],v=this._root;for(v&&g.push(new r(v,h,f,p,d)),null==n?n=1/0:(h=t-n,f=e-n,p=t+n,d=e+n,n*=n);u=g.pop();)if(!(!(v=u.node)||(a=u.x0)>p||(o=u.y0)>d||(s=u.x1)=y)<<1|t>=m)&&(u=g[g.length-1],g[g.length-1]=g[g.length-1-c],g[g.length-1-c]=u)}else{var x=t-+this._x.call(null,v.data),b=e-+this._y.call(null,v.data),_=x*x+b*b;if(_=(s=(d+v)/2))?d=s:v=s,(c=o>=(l=(g+m)/2))?g=l:m=l,e=p,!(p=p[h=c<<1|u]))return this;if(!p.length)break;(e[h+1&3]||e[h+2&3]||e[h+3&3])&&(r=e,f=h)}for(;p.data!==t;)if(n=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,n?(i?n.next=i:delete n.next,this):e?(i?e[h]=i:delete e[h],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(r?r[f]=p:this._root=p),this):(this._root=i,this)},l.removeAll=function(t){for(var e=0,r=t.length;e=0&&r._call.call(null,t),r=r._next;--n}function m(){l=(s=c.now())+u,n=i=0;try{v()}finally{n=0,function(){var t,n,i=e,a=1/0;for(;i;)i._call?(a>i._time&&(a=i._time),t=i,i=i._next):(n=i._next,i._next=null,i=t?t._next=n:e=n);r=t,x(a)}(),l=0}}function y(){var t=c.now(),e=t-s;e>o&&(u-=e,s=t)}function x(t){n||(i&&(i=clearTimeout(i)),t-l>24?(t<1/0&&(i=setTimeout(m,t-c.now()-u)),a&&(a=clearInterval(a))):(a||(s=c.now(),a=setInterval(y,o)),n=1,h(m)))}d.prototype=g.prototype={constructor:d,restart:function(t,n,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?f():+i)+(null==n?0:+n),this._next||r===this||(r?r._next=this:e=this,r=this),this._call=t,this._time=i,x()},stop:function(){this._call&&(this._call=null,this._time=1/0,x())}};t.now=f,t.timer=g,t.timerFlush=v,t.timeout=function(t,e,r){var n=new d;return e=null==e?0:+e,n.restart(function(r){n.stop(),t(r+e)},e,r),n},t.interval=function(t,e,r){var n=new d,i=e;return null==e?(n.restart(t,e,r),n):(e=+e,r=null==r?f():+r,n.restart(function a(o){o+=i,n.restart(a,i+=e,r),t(o)},e,r),n)},Object.defineProperty(t,"__esModule",{value:!0})}),mB=mB.exports;var yB={exports:{}};!function(t,e){"object"==typeof yB.exports?e(yB.exports,vB,hB,gB,mB):e(t.d3=t.d3||{},t.d3,t.d3,t.d3,t.d3)}(this,function(t,e,r,n,i){"use strict";var a=function(t){return function(){return t}},o=function(){return 1e-6*(Math.random()-.5)};function s(t){return t.x+t.vx}function l(t){return t.y+t.vy}function u(t){return t.index}function c(t,e){var r=t.get(e);if(!r)throw new Error("missing: "+e);return r}function h(t){return t.x}function f(t){return t.y}var p=10,d=Math.PI*(3-Math.sqrt(5));t.forceCenter=function(t,e){var r;function n(){var n,i,a=r.length,o=0,s=0;for(n=0;nf+u||np+u||ac.index){var h=f-s.x-s.vx,v=p-s.y-s.vy,m=h*h+v*v;mt.r&&(t.r=t[e].r)}function f(){if(r){var e,i,a=r.length;for(n=new Array(a),e=0;e=u)){(t.data!==r||t.next)&&(0===h&&(d+=(h=o())*h),0===f&&(d+=(f=o())*f),d1?(null==r?c.remove(t):c.set(t,y(r)),e):c.get(t)},find:function(e,r,n){var i,a,o,s,l,u=0,c=t.length;for(null==n?n=1/0:n*=n,u=0;u1?(f.on(t,r),e):f.on(t)}}},t.forceX=function(t){var e,r,n,i=a(.1);function o(t){for(var i,a=0,o=e.length;a1||t.linkLineWidth>0}function PB(t){return"translate("+t.translateX+","+t.translateY+")"+(t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)")}function IB(t){return"translate("+(t.horizontal?0:t.labelY)+" "+(t.horizontal?t.labelY:0)+")"}function DB(t){return e.svg.line()([[t.horizontal?t.left?-t.sizeAcross:t.visibleWidth+uB.nodeTextOffsetHorizontal:uB.nodeTextOffsetHorizontal,0],[t.horizontal?t.left?-uB.nodeTextOffsetHorizontal:t.sizeAcross:t.visibleHeight-uB.nodeTextOffsetHorizontal,0]])}function OB(t){return t.horizontal?"matrix(1 0 0 1 0 0)":"matrix(0 1 1 0 0 0)"}function RB(t){return t.horizontal?"scale(1 1)":"scale(-1 1)"}function FB(t){return t.darkBackground&&!t.horizontal?"rgb(255,255,255)":"rgb(0,0,0)"}function BB(t){return t.horizontal&&t.left?"100%":"0%"}function NB(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 jB(t,r,n){var i=e.behavior.drag().origin(function(t){return t.node}).on("dragstart",function(e){if("fixed"!==e.arrangement&&(ne.raiseToTop(this),e.interactionState.dragInProgress=e.node,MB(e.node),e.interactionState.hovered&&(n.nodeEvents.unhover.apply(0,e.interactionState.hovered),e.interactionState.hovered=!1),"snap"===e.arrangement)){var i=e.traceId+"|"+Math.floor(e.node.originalX);e.forceLayouts[i]?e.forceLayouts[i].alpha(1):function(t,e,r){var n=r.sankey.nodes().filter(function(t){return t.originalX===r.node.originalX});r.forceLayouts[e]=yB.forceSimulation(n).alphaDecay(0).force("collide",yB.forceCollide().radius(function(t){return t.dy/2+r.nodePad/2}).strength(1).iterations(uB.forceIterations)).force("constrain",function(t,e,r,n){return function(){for(var t=0,i=0;i0&&n.forceLayouts[e].alpha(0)}}(0,e,n,r)).stop()}(0,i,e),function(t,e,r,n){window.requestAnimationFrame(function i(){for(var a=0;a0&&window.requestAnimationFrame(i)})}(t,r,e,i)}}).on("drag",function(n){if("fixed"!==n.arrangement){var i=e.event.x,a=e.event.y;"snap"===n.arrangement?(n.node.x=i,n.node.y=a):("freeform"===n.arrangement&&(n.node.x=i),n.node.y=Math.max(n.node.dy/2,Math.min(n.size-n.node.dy/2,a))),MB(n.node),"snap"!==n.arrangement&&(n.sankey.relayout(),CB(t.filter(AB(n)),r))}}).on("dragend",function(t){t.interactionState.dragInProgress=!1});t.on(".drag",null).call(i)}var VB=function(t,e,r,n){var i=t.selectAll("."+uB.cn.sankey).data(e.filter(function(t){return wB(t).trace.visible}).map(function(t,e,r){for(var n,i=wB(e).trace,a=i.domain,o=i.node,s=i.link,l=i.arrangement,u="h"===i.orientation,c=i.node.pad,h=i.node.thickness,f=i.node.line.color,p=i.node.line.width,d=i.link.line.color,g=i.link.line.width,v=i.valueformat,m=i.valuesuffix,y=i.textfont,x=t.width*(a.x[1]-a.x[0]),b=t.height*(a.y[1]-a.y[0]),_=o.label.map(function(t,e){return{pointNumber:e,label:t,color:ne.isArrayOrTypedArray(o.color)?o.color[e]:o.color}}),w=s.value.map(function(t,e){return{pointNumber:e,label:s.label[e],color:ne.isArrayOrTypedArray(s.color)?s.color[e]:s.color,source:s.source[e],target:s.target[e],value:t}}),M=xB().size(u?[x,b]:[b,x]).nodeWidth(h).nodePadding(c).nodes(_).links(w).layout(uB.sankeyIterations),A=M.nodes(),k=0;k5?t.node.label:""}).attr("text-anchor",function(t){return t.horizontal&&t.left?"end":"start"}),g.transition().ease(uB.ease).duration(uB.duration).attr("startOffset",BB).style("fill",FB)},UB=uB.cn,qB=ne._;function HB(t){return""!==t}function GB(t,e){return t.filter(function(t){return t.key===e.traceId})}function WB(t,r){e.select(t).select("path").style("fill-opacity",r),e.select(t).select("rect").style("fill-opacity",r)}function YB(t){e.select(t).select("text.name").style("fill","black")}function XB(t){return function(e){return-1!==t.node.sourceLinks.indexOf(e.link)||-1!==t.node.targetLinks.indexOf(e.link)}}function ZB(t){return function(e){return-1!==e.node.sourceLinks.indexOf(t.link)||-1!==e.node.targetLinks.indexOf(t.link)}}function JB(t,e,r){e&&r&&GB(r,e).selectAll("."+UB.sankeyLink).filter(XB(e)).call(QB.bind(0,e,r,!1))}function KB(t,e,r){e&&r&&GB(r,e).selectAll("."+UB.sankeyLink).filter(XB(e)).call($B.bind(0,e,r,!1))}function QB(t,e,r,n){var i=n.datum().link.label;n.style("fill-opacity",.4),i&&GB(e,t).selectAll("."+UB.sankeyLink).filter(function(t){return t.link.label===i}).style("fill-opacity",.4),r&&GB(e,t).selectAll("."+UB.sankeyNode).filter(ZB(t)).call(JB)}function $B(t,e,r,n){var i=n.datum().link.label;n.style("fill-opacity",function(t){return t.tinyColorAlpha}),i&&GB(e,t).selectAll("."+UB.sankeyLink).filter(function(t){return t.link.label===i}).style("fill-opacity",function(t){return t.tinyColorAlpha}),r&&GB(e,t).selectAll(UB.sankeyNode).filter(ZB(t)).call(KB)}function tN(t,e){var r=t.hoverlabel||{},n=ne.nestedProperty(r,e).get();return!Array.isArray(n)&&n}var eN=function(t,r){var n=t._fullLayout,i=n._paper,a=n._size,o=qB(t,"source:")+" ",s=qB(t,"target:")+" ",l=qB(t,"incoming flow count:")+" ",u=qB(t,"outgoing flow count:")+" ";VB(i,r,{width:a.w,height:a.h,margin:{t:a.t,r:a.r,b:a.b,l:a.l}},{linkEvents:{hover:function(r,n,i){e.select(r).call(QB.bind(0,n,i,!0)),t.emit("plotly_hover",{event:e.event,points:[n.link]})},follow:function(r,i){var a=i.link.trace,l=t._fullLayout._paperdiv.node().getBoundingClientRect(),u=r.getBoundingClientRect(),c=u.left+u.width/2,h=u.top+u.height/2,f=yo.loneHover({x:c-l.left,y:h-l.top,name:e.format(i.valueFormat)(i.link.value)+i.valueSuffix,text:[i.link.label||"",o+i.link.source.label,s+i.link.target.label].filter(HB).join("
"),color:tN(a,"bgcolor")||Oe.addOpacity(i.tinyColorHue,1),borderColor:tN(a,"bordercolor"),fontFamily:tN(a,"font.family"),fontSize:tN(a,"font.size"),fontColor:tN(a,"font.color"),idealAlign:e.event.x"),color:tN(a,"bgcolor")||i.tinyColorHue,borderColor:tN(a,"bordercolor"),fontFamily:tN(a,"font.family"),fontSize:tN(a,"font.size"),fontColor:tN(a,"font.color"),idealAlign:"left"},{container:n._hoverlayer.node(),outerContainer:n._paper.node(),gd:t});WB(d,.85),YB(d)},unhover:function(r,i,a){e.select(r).call(KB,i,a),t.emit("plotly_unhover",{event:e.event,points:[i.node]}),yo.loneUnhover(n._hoverlayer.node())},select:function(r,n,i){var a=n.node;a.originalEvent=e.event,t._hoverdata=[a],e.select(r).call(KB,n,i),yo.click(t,{target:!0})}}})},rN={},nN=ye.overrideAll,iN=sa.getModuleCalcData;rN.name="sankey",rN.baseLayoutAttrOverrides=nN({hoverlabel:mo.hoverlabel},"plot","nested"),rN.plot=function(t){var e=iN(t.calcdata,"sankey");eN(t,e)},rN.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()};var aN=function(t){for(var e=t.length,r=new Array(e),n=new Array(e),i=new Array(e),a=new Array(e),o=new Array(e),s=new Array(e),l=0;l0;){e=u[u.length-1];var p=t[e];if(a[e]=0&&s[e].push(o[g])}a[e]=d}else{if(n[e]===r[e]){for(var v=[],m=[],y=0,d=l.length-1;d>=0;--d){var x=l[d];if(i[x]=!1,v.push(x),m.push(s[x]),y+=s[x].length,o[x]=h.length,x===e){l.length=d;break}}h.push(v);for(var b=new Array(y),d=0;d1})}(e.node.label,e.link.source,e.link.target)&&(ne.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=[]),oN({link:e.link,node:e.node})},lN.plot=eN,lN.moduleType="trace",lN.name="sankey",lN.basePlotModule=rN,lN.categories=["noOpacity"],lN.meta={};var uN=lN,cN={circle:"\u25cf","circle-open":"\u25cb",square:"\u25a0","square-open":"\u25a1",diamond:"\u25c6","diamond-open":"\u25c7",cross:"+",x:"\u274c"},hN={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]},fN={},pN=m.extendFlat,dN=ye.overrideAll,gN=Zr.line,vN=Zr.marker,mN=vN.line;var yN=fN=dN({x:Zr.x,y:Zr.y,z:{valType:"data_array"},text:pN({},Zr.text,{}),hovertext:pN({},Zr.hovertext,{}),mode:pN({},Zr.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:Zr.connectgaps,line:pN({width:gN.width,dash:{valType:"enumerated",values:Object.keys(hN),dflt:"solid"},showscale:{valType:"boolean",dflt:!1}},De()),marker:pN({symbol:{valType:"enumerated",values:Object.keys(cN),dflt:"circle",arrayOk:!0},size:pN({},vN.size,{dflt:8}),sizeref:vN.sizeref,sizemin:vN.sizemin,sizemode:vN.sizemode,opacity:pN({},vN.opacity,{arrayOk:!1}),showscale:vN.showscale,colorbar:vN.colorbar,line:pN({width:pN({},mN.width,{arrayOk:!1})},De())},De()),textposition:pN({},Zr.textposition,{dflt:"top center"}),textfont:Zr.textfont,hoverinfo:pN({},E.hoverinfo)},"calc","nested");yN.x.editType=yN.y.editType=yN.z.editType="calc+clearAxisTypes";var xN=E_(["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}"]),bN=E_(["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}"]),_N=function(t){return Bw(t,xN,bN,null,[{name:"position",type:"vec3"},{name:"color",type:"vec4"},{name:"offset",type:"vec3"}])},wN=function(t){var e=t.gl,r=S_(e),n=EP(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}]),i=_N(e);i.attributes.position.location=0,i.attributes.color.location=1,i.attributes.offset.location=2;var a=new AN(e,r,n,i);return a.update(t),a},MN=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function AN(t,e,r,n){this.gl=t,this.shader=n,this.buffer=e,this.vao=r,this.pixelRatio=1,this.bounds=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.lineWidth=[1,1,1],this.capSize=[10,10,10],this.lineCount=[0,0,0],this.lineOffset=[0,0,0],this.opacity=1}var kN=AN.prototype;function TN(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])}kN.isOpaque=function(){return this.opacity>=1},kN.isTransparent=function(){return this.opacity<1},kN.drawTransparent=kN.draw=function(t){var e=this.gl,r=this.shader.uniforms;this.shader.bind();var n=r.view=t.view||MN,i=r.projection=t.projection||MN;r.model=t.model||MN,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 c=0;c<3;++c)e.lineWidth(this.lineWidth[c]),r.capSize=this.capSize[c]*u,this.lineCount[c]&&e.drawArrays(e.LINES,this.lineOffset[c],this.lineCount[c]);this.vao.unbind()};var SN=function(){for(var t=new Array(3),e=0;e<3;++e){for(var r=[],n=1;n<=2;++n)for(var i=-1;i<=1;i+=2){var a=[0,0,0];a[(n+e)%3]=i,r.push(a)}t[e]=r}return t}();function EN(t,e,r,n){for(var i=SN[n],a=0;a0)(p=u.slice())[s]+=h[1][s],i.push(u[0],u[1],u[2],f[0],f[1],f[2],f[3],0,0,0,p[0],p[1],p[2],f[0],f[1],f[2],f[3],0,0,0),TN(this.bounds,p),o+=2+EN(i,p,f,s)}}this.lineCount[s]=o-this.lineOffset[s]}this.buffer.update(i)}},kN.dispose=function(){this.shader.dispose(),this.buffer.dispose(),this.vao.dispose()};var CN={},LN=E_(["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"]),zN=E_(["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"]),PN=E_(["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_1540259130(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\nuniform float pickId;\nuniform vec3 clipBounds[2];\n\nvarying vec3 worldPosition;\nvarying float pixelArcLength;\nvarying vec4 fragColor;\n\nvoid main() {\n if(any(lessThan(worldPosition, clipBounds[0])) || any(greaterThan(worldPosition, clipBounds[1]))) {\n discard;\n }\n gl_FragColor = vec4(pickId/255.0, encode_float_1540259130(pixelArcLength).xyz);\n}"]),IN=[{name:"position",type:"vec3"},{name:"nextPosition",type:"vec3"},{name:"arcLength",type:"float"},{name:"lineWidth",type:"float"},{name:"color",type:"vec4"}];CN.createShader=function(t){return Bw(t,LN,zN,null,IN)},CN.createPickShader=function(t){return Bw(t,LN,PN,null,IN)};var DN=function(t,e,r,n){return ON[0]=n,ON[1]=r,ON[2]=e,ON[3]=t,RN[0]},ON=new Uint8Array(4),RN=new Float32Array(ON.buffer);var FN=function(t){var e=t.gl||t.scene&&t.scene.gl,r=BN(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=NN(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=EP(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}]),o=wb(new Array(1024),[256,1,4]),s=0;s<1024;++s)o.data[s]=255;var l=zE(e,o);l.wrap=e.REPEAT;var u=new HN(e,r,n,i,a,l);return u.update(t),u},BN=CN.createShader,NN=CN.createPickShader,jN=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function VN(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 UN(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 qN(t,e,r,n){this.arcLength=t,this.position=e,this.index=r,this.dataCoordinate=n}function HN(t,e,r,n,i,a){this.gl=t,this.shader=e,this.pickShader=r,this.buffer=n,this.vao=i,this.clipBounds=[[-1/0,-1/0,-1/0],[1/0,1/0,1/0]],this.points=[],this.arcLength=[],this.vertexCount=0,this.bounds=[[0,0,0],[0,0,0]],this.pickId=0,this.lineWidth=1,this.texture=a,this.dashScale=1,this.opacity=1,this.dirty=!0,this.pixelRatio=1}var GN=HN.prototype;GN.isTransparent=function(){return this.opacity<1},GN.isOpaque=function(){return this.opacity>=1},GN.pickSlots=1,GN.setPickBase=function(t){this.pickId=t},GN.drawTransparent=GN.draw=function(t){var e=this.gl,r=this.shader,n=this.vao;r.bind(),r.uniforms={model:t.model||jN,view:t.view||jN,projection:t.projection||jN,clipBounds:UN(this.clipBounds),dashTexture:this.texture.bind(),dashScale:this.dashScale/this.arcLength[this.arcLength.length-1],opacity:this.opacity,screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()},GN.drawPick=function(t){var e=this.gl,r=this.pickShader,n=this.vao;r.bind(),r.uniforms={model:t.model||jN,view:t.view||jN,projection:t.projection||jN,pickId:this.pickId,clipBounds:UN(this.clipBounds),screenShape:[e.drawingBufferWidth,e.drawingBufferHeight],pixelRatio:this.pixelRatio},n.bind(),n.draw(e.TRIANGLE_STRIP,this.vertexCount),n.unbind()},GN.update=function(t){var e,r;this.dirty=!0;var n=!!t.connectGaps;"dashScale"in t&&(this.dashScale=t.dashScale),"opacity"in t&&(this.opacity=+t.opacity);var i=t.position||t.positions;if(i){var a=t.color||t.colors||[0,0,0,1],o=t.lineWidth||1,s=[],l=[],u=[],c=0,h=0,f=[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]],p=!1;t:for(e=1;e0){for(var x=0;x<24;++x)s.push(s[s.length-12]);h+=2,p=!0}continue t}f[0][r]=Math.min(f[0][r],m[r],y[r]),f[1][r]=Math.max(f[1][r],m[r],y[r])}Array.isArray(a[0])?(d=a[e-1],g=a[e]):d=g=a,3===d.length&&(d=[d[0],d[1],d[2],1]),3===g.length&&(g=[g[0],g[1],g[2],1]),v=Array.isArray(o)?o[e-1]:o;var b=c;if(c+=VN(m,y),p){for(r=0;r<2;++r)s.push(m[0],m[1],m[2],y[0],y[1],y[2],b,v,d[0],d[1],d[2],d[3]);h+=2,p=!1}s.push(m[0],m[1],m[2],y[0],y[1],y[2],b,v,d[0],d[1],d[2],d[3],m[0],m[1],m[2],y[0],y[1],y[2],b,-v,d[0],d[1],d[2],d[3],y[0],y[1],y[2],m[0],m[1],m[2],c,-v,g[0],g[1],g[2],g[3],y[0],y[1],y[2],m[0],m[1],m[2],c,v,g[0],g[1],g[2],g[3]),h+=4}if(this.buffer.update(s),l.push(c),u.push(i[i.length-1].slice()),this.bounds=f,this.vertexCount=h,this.points=u,this.arcLength=l,"dashes"in t){var _=t.dashes.slice();for(_.unshift(0),e=1;e<_.length;++e)_[e]=_[e-1]+_[e];var w=wb(new Array(1024),[256,1,4]);for(e=0;e<256;++e){for(r=0;r<4;++r)w.set(e,0,r,0);1&wT.le(_,_[_.length-1]*e/255)?w.set(e,0,0,0):w.set(e,0,0,255)}this.texture.setPixels(w)}}},GN.dispose=function(){this.shader.dispose(),this.vao.dispose(),this.buffer.dispose()},GN.pick=function(t){if(!t)return null;if(t.id!==this.pickId)return null;var e=DN(t.value[0],t.value[1],t.value[2],0),r=wT.le(this.arcLength,e);if(r<0)return null;if(r===this.arcLength.length-1)return new qN(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)],a=(e-this.arcLength[r])/(this.arcLength[r+1]-this.arcLength[r]),o=1-a,s=[0,0,0],l=0;l<3;++l)s[l]=o*n[l]+a*i[l];var u=Math.min(a<.5?r:r+1,this.points.length-1);return new qN(e,s,u,this.points[u])};var WN=function(t,e){var r=YN[e];r||(r=YN[e]={});if(t in r)return r[t];for(var n=ME(t,{textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),i=ME(t,{triangles:!0,textAlign:"center",textBaseline:"middle",lineHeight:1,font:e}),a=[[1/0,1/0],[-1/0,-1/0]],o=0;o=1)return!0;for(var t=0;t<3;++t)if(this.axesProject[t]&&this.projectOpacity[t]>=1)return!0;return!1};var dj=[0,0],gj=[0,0,0],vj=[0,0,0],mj=[0,0,0,1],yj=[0,0,0,1],xj=lj.slice(),bj=[0,0,0],_j=[[0,0,0],[0,0,0]];function wj(t){return t[0]=t[1]=t[2]=0,t}function Mj(t,e){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=1,t}function Aj(t,e,r,n){return t[0]=e[0],t[1]=e[1],t[2]=e[2],t[r]=n,t}function kj(t,e,r,n,i){var a,o=e.axesProject,s=e.gl,l=t.uniforms,u=r.model||lj,c=r.view||lj,h=r.projection||lj,f=e.axesBounds,p=function(t){for(var e=_j,r=0;r<2;++r)for(var n=0;n<3;++n)e[r][n]=Math.max(Math.min(t[r][n],1e8),-1e8);return e}(e.clipBounds);a=e.axes&&e.axes.lastCubeProps?e.axes.lastCubeProps.axis:[1,1,1],dj[0]=2/s.drawingBufferWidth,dj[1]=2/s.drawingBufferHeight,t.bind(),l.view=c,l.projection=h,l.screenSize=dj,l.highlightId=e.highlightId,l.highlightScale=e.highlightScale,l.clipBounds=p,l.pickGroup=e.pickId/255,l.pixelRatio=e.pixelRatio;for(var d=0;d<3;++d)if(o[d]&&e.projectOpacity[d]<1===n){l.scale=e.projectScale[d],l.opacity=e.projectOpacity[d];for(var g=xj,v=0;v<16;++v)g[v]=0;for(v=0;v<4;++v)g[5*v]=1;g[5*d]=0,a[d]<0?g[12+d]=f[0][d]:g[12+d]=f[1][d],Dz(g,u,g),l.model=g;var m=(d+1)%3,y=(d+2)%3,x=wj(gj),b=wj(vj);x[m]=1,b[y]=1;var _=hj(0,0,0,Mj(mj,x)),w=hj(0,0,0,Mj(yj,b));if(Math.abs(_[1])>Math.abs(w[1])){var M=_;_=w,w=M,M=x,x=b,b=M;var A=m;m=y,y=A}_[0]<0&&(x[m]=-1),w[1]>0&&(b[y]=-1);var k=0,T=0;for(v=0;v<4;++v)k+=Math.pow(u[4*m+v],2),T+=Math.pow(u[4*y+v],2);x[m]/=Math.sqrt(k),b[y]/=Math.sqrt(T),l.axes[0]=x,l.axes[1]=b,l.fragClipBounds[0]=Aj(bj,p[0],d,-1e8),l.fragClipBounds[1]=Aj(bj,p[1],d,1e8),e.vao.draw(s.TRIANGLES,e.vertexCount),e.lineWidth>0&&(s.lineWidth(e.lineWidth),e.vao.draw(s.LINES,e.lineVertexCount,e.vertexCount))}}var Tj=[[-1e8,-1e8,-1e8],[1e8,1e8,1e8]];function Sj(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||lj,s.view=n.view||lj,s.projection=n.projection||lj,dj[0]=2/o.drawingBufferWidth,dj[1]=2/o.drawingBufferHeight,s.screenSize=dj,s.highlightId=r.highlightId,s.highlightScale=r.highlightScale,s.fragClipBounds=Tj,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))}kj(e,r,n,i),r.vao.unbind()}pj.draw=function(t){Sj(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!1,!1)},pj.drawTransparent=function(t){Sj(this.useOrtho?this.orthoShader:this.shader,this.projectShader,this,t,!0,!1)},pj.drawPick=function(t){Sj(this.useOrtho?this.pickOrthoShader:this.pickPerspectiveShader,this.pickProjectShader,this,t,!1,!0)},pj.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},pj.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]},pj.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,u=t.color,c=t.size,h=t.angle,f=t.lineColor,p=0,d=0,g=0,v=n.length;t:for(var m=0;m0&&(E[0]=-a[0]*(1+w[0][0]));var V=b.cells,U=b.positions;for(x=0;x=0&&(u[1]+=1),l.indexOf("top")>=0&&(u[1]-=1),l.indexOf("left")>=0&&(u[0]-=1),l.indexOf("right")>=0&&(u[0]+=1),u)),r.textColor=Dj(e.textfont,1,_),r.textSize=Vj(e.textfont.size,_,ne.identity,12),r.textFont=e.textfont.family,r.textAngle=0);var T=["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 S=e.projection[T[n]];(r.project[n]=S.show)&&(r.projectOpacity[n]=S.opacity,r.projectScale[n]=S.scale)}r.errorBounds=Rj(e,f);var E=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]=WC(a.color),n=a.thickness)}return{capSize:e,color:r,lineWidth:n}}([e.error_x,e.error_y,e.error_z]);return r.errorColor=E.color,r.errorLineWidth=E.lineWidth,r.errorCapSize=E.capSize,r.delaunayAxis=e.surfaceaxis,r.delaunayColor=WC(e.surfacecolor),r}function qj(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}Bj.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}},Bj.update=function(t){var e,r,n,i,a=this.scene.glplot.gl,o=hN.solid;this.data=t;var s=Uj(this.scene,t);"mode"in s&&(this.mode=s.mode),"lineDashes"in s&&s.lineDashes in hN&&(o=hN[s.lineDashes]),this.color=qj(s.scatterColor)||qj(s.lineColor),this.dataPoints=s.position,e={gl:a,position:s.position,color:s.lineColor,lineWidth:s.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=FN(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 l=t.opacity;if(t.marker&&t.marker.opacity&&(l*=t.marker.opacity),r={gl:a,position:s.position,color:s.scatterColor,size:s.scatterSize,glyph:s.scatterMarker,opacity:l,orthographic:!0,lineWidth:s.scatterLineWidth,lineColor:s.scatterLineColor,project:s.project,projectScale:s.projectScale,projectOpacity:s.projectOpacity},-1!==this.mode.indexOf("markers")?this.scatterPlot?this.scatterPlot.update(r):(this.scatterPlot=uj(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:s.position,glyph:s.text,color:s.textColor,size:s.textSize,angle:s.textAngle,alignment:s.textOffset,font:s.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=uj(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:s.position,color:s.errorColor,error:s.errorBounds,lineWidth:s.errorLineWidth,capSize:s.errorCapSize,opacity:t.opacity},this.errorBars?s.errorBounds?this.errorBars.update(n):(this.scene.glplot.remove(this.errorBars),this.errorBars.dispose(),this.errorBars=null):s.errorBounds&&(this.errorBars=wN(n),this.errorBars._trace=this,this.scene.glplot.add(this.errorBars)),s.delaunayAxis>=0){var u=function(t,e,r){var n,i=(r+1)%3,a=(r+2)%3,o=[],s=[];for(n=0;n=0&&i("surfacecolor",a||o);for(var s=["x","y","z"],l=0;l<3;++l){var u="projection."+s[l];i(u+".show")&&(i(u+".opacity"),i(u+".scale"))}var c=P.getComponentMethod("errorbars","supplyDefaults");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},Gj.colorbar=is,Gj.calc=nB,Gj.moduleType="trace",Gj.name="scatter3d",Gj.basePlotModule=SD,Gj.categories=["gl3d","symbols","markerColorscale","showLegend"],Gj.meta={};var Wj=Gj,Yj=m.extendFlat,Xj=Zr.marker,Zj=Zr.line,Jj=Xj.line,Kj={carpet:{valType:"string",editType:"calc"},a:{valType:"data_array",editType:"calc"},b:{valType:"data_array",editType:"calc"},mode:Yj({},Zr.mode,{dflt:"markers"}),text:Yj({},Zr.text,{}),line:{color:Zj.color,width:Zj.width,dash:Zj.dash,shape:Yj({},Zj.shape,{values:["linear","spline"]}),smoothing:Zj.smoothing,editType:"calc"},connectgaps:Zr.connectgaps,fill:Yj({},Zr.fill,{values:["none","toself","tonext"]}),fillcolor:Zr.fillcolor,marker:Yj({symbol:Xj.symbol,opacity:Xj.opacity,maxdisplayed:Xj.maxdisplayed,size:Xj.size,sizeref:Xj.sizeref,sizemin:Xj.sizemin,sizemode:Xj.sizemode,line:Yj({width:Jj.width,editType:"calc"},De()),gradient:Xj.gradient,editType:"calc"},De(),{showscale:Xj.showscale,colorbar:ze}),textfont:Zr.textfont,textposition:Zr.textposition,selected:Zr.selected,unselected:Zr.unselected,hoverinfo:Yj({},E.hoverinfo,{flags:["a","b","text","name"]}),hoveron:Zr.hoveron},Qj=sx,$j={};$j.attributes=Kj,$j.supplyDefaults=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,Kj,r,n)}i("carpet"),e.xaxis="x",e.yaxis="y";var a,o=i("a"),s=i("b");if(a=Math.min(o.length,s.length)){o&&a"),i}function _(t,e){var r;r=t.labelprefix&&t.labelprefix.length>0?t.labelprefix.replace(/ = $/,""):t._hovertitle,d.push(r+": "+e.toFixed(3)+t.labelsuffix)}},$j.selectPoints=Sx,$j.eventData=function(t,e,r,n,i){var a=n[i];return t.a=a.a,t.b=a.b,t},$j.moduleType="trace",$j.name="scattercarpet",$j.basePlotModule=ua,$j.categories=["carpet","symbols","markerColorscale","showLegend","carpetDependent"],$j.meta={};var tV=$j,eV=t.BADNUM,rV=ne._,nV=function(t,e){for(var n=Array.isArray(e.locations),i=n?e.locations.length:e._length,a=new Array(i),o=0;o0&&(r.push(n),n=[])}return n.length>0&&r.push(n),r},aV.makeLine=function(t){return 1===t.length?{type:"LineString",coordinates:t[0]}:{type:"MultiLineString",coordinates:t}},aV.makePolygon=function(t){if(1===t.length)return{type:"Polygon",coordinates:t};for(var e=new Array(t.length),r=0;r")}(i,c,s.mockAxis,n[0].t.labels),[t]}},pV.eventData=function(t,e){return t.lon=e.lon,t.lat=e.lat,t.location=e.loc?e.loc:null,t},pV.selectPoints=function(t,e){var r,n,i,a,o,s=t.cd,l=t.xaxis,u=t.yaxis,c=[],h=s[0].trace;if(!Tr.hasMarkers(h)&&!Tr.hasText(h))return[];if(!1===e)for(o=0;oi;){if(a-i>600){var s=a-i+1,l=n-i+1,u=Math.log(s),c=.5*Math.exp(2*u/3),h=.5*Math.sqrt(u*c*(s-c)/s)*(l-s/2<0?-1:1),f=Math.max(i,Math.floor(n-l*c/s+h)),p=Math.min(a,Math.floor(n+(s-l)*c/s+h));t(e,r,n,f,p,o)}var d=r[2*n+o],g=i,v=a;for(xV(e,r,i,n),r[2*a+o]>d&&xV(e,r,i,a);gd;)v--}r[2*i+o]===d?xV(e,r,i,v):xV(e,r,++v,a),v<=n&&(i=v+1),n<=v&&(a=v-1)}}(e,r,s,i,a,o%2);t(e,r,n,i,s-1,o+1);t(e,r,n,s+1,a,o+1)}(this.ids,this.coords,this.nodeSize,0,this.ids.length-1,0)}function yV(t,e,r,n){var i=t-r,a=e-n;return i*i+a*a}function xV(t,e,r,n){bV(t,r,n),bV(e,2*r,2*n),bV(e,2*r+1,2*n+1)}function bV(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}mV.prototype.range=function(t,e,r,n){for(var i,a,o=this.ids,s=this.coords,l=this.nodeSize,u=[0,o.length-1,0],c=[];u.length;){var h=u.pop(),f=u.pop(),p=u.pop();if(f-p<=l)for(var d=p;d<=f;d++)i=s[2*d],a=s[2*d+1],i>=t&&i<=r&&a>=e&&a<=n&&c.push(o[d]);else{var g=Math.floor((p+f)/2);i=s[2*g],a=s[2*g+1],i>=t&&i<=r&&a>=e&&a<=n&&c.push(o[g]);var v=(h+1)%2;(0===h?t<=i:e<=a)&&(u.push(p),u.push(g-1),u.push(v)),(0===h?r>=i:n>=a)&&(u.push(g+1),u.push(f),u.push(v))}}return c},mV.prototype.within=function(t,e,r){for(var n=this.ids,i=this.coords,a=this.nodeSize,o=[0,n.length-1,0],s=[],l=r*r;o.length;){var u=o.pop(),c=o.pop(),h=o.pop();if(c-h<=a)for(var f=h;f<=c;f++)yV(i[2*f],i[2*f+1],t,e)<=l&&s.push(n[f]);else{var p=Math.floor((h+c)/2),d=i[2*p],g=i[2*p+1];yV(d,g,t,e)<=l&&s.push(n[p]);var v=(u+1)%2;(0===u?t-r<=d:e-r<=g)&&(o.push(h),o.push(p-1),o.push(v)),(0===u?t+r>=d:e+r>=g)&&(o.push(p+1),o.push(c),o.push(v))}}return s};var _V=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;ni&&(i=t[o]),t[o]1&&(t.scaleRatio=[t.scale[0]*t.viewport.width,t.scale[1]*t.viewport.height],r(t),t.after&&t.after(t))}function d(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0,r=0;if(c=t.map(function(t,n){var i=c[n];return t?("function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),t=MV(t,{color:"color colors fill",capSize:"capSize cap capsize cap-size",lineWidth:"lineWidth line-width width line thickness",opacity:"opacity alpha",range:"range dataBox",viewport:"viewport viewBox",errors:"errors error",positions:"positions position data points"}),i||(c[n]=i={id:n,scale:null,translate:null,scaleFract:null,translateFract:null,draw:!0},t=Us({},u,t)),EV(i,t,[{lineWidth:function(t){return.5*+t},capSize:function(t){return.5*+t},opacity:parseFloat,errors:function(t){return t=wV(t),r+=t.length,t},positions:function(t,r){return t=wV(t,"float64"),r.count=Math.floor(t.length/2),r.bounds=_V(t,2),r.offset=e,e+=r.count,t}},{color:function(t,e){var r=e.count;if(t||(t="transparent"),!Array.isArray(t)||"number"==typeof t[0]){var n=t;t=Array(r);for(var i=0;i80*r){n=a=t[0],i=o=t[1];for(var d=r;da&&(a=s),l>o&&(o=l);u=0!==(u=Math.max(a-n,o-i))?1/u:0}return BV(f,p,r,n,i,u),p}function RV(t,e,r,n,i){var a,o;if(i===nU(t,e,r,n)>0)for(a=e;a=e;a-=n)o=tU(a,t[a],t[a+1],o);return o&&JV(o,o.next)&&(eU(o),o=o.next),o}function FV(t,e){if(!t)return t;e||(e=t);var r,n=t;do{if(r=!1,n.steiner||!JV(n,n.next)&&0!==ZV(n.prev,n,n.next))n=n.next;else{if(eU(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function BV(t,e,r,n,i,a,o){if(t){!o&&a&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=GV(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,u=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1)}(i)}(t,n,i,a);for(var s,l,u=t;t.prev!==t.next;)if(s=t.prev,l=t.next,a?jV(t,n,i,a):NV(t))e.push(s.i/r),e.push(t.i/r),e.push(l.i/r),eU(t),t=l.next,u=l.next;else if((t=l)===u){o?1===o?BV(t=VV(t,e,r),e,r,n,i,a,2):2===o&&UV(t,e,r,n,i,a):BV(FV(t),e,r,n,i,a,1);break}}}function NV(t){var e=t.prev,r=t,n=t.next;if(ZV(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(YV(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&ZV(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function jV(t,e,r,n){var i=t.prev,a=t,o=t.next;if(ZV(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=GV(s,l,e,r,n),f=GV(u,c,e,r,n),p=t.prevZ,d=t.nextZ;p&&p.z>=h&&d&&d.z<=f;){if(p!==t.prev&&p!==t.next&&YV(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ZV(p.prev,p,p.next)>=0)return!1;if(p=p.prevZ,d!==t.prev&&d!==t.next&&YV(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&ZV(d.prev,d,d.next)>=0)return!1;d=d.nextZ}for(;p&&p.z>=h;){if(p!==t.prev&&p!==t.next&&YV(i.x,i.y,a.x,a.y,o.x,o.y,p.x,p.y)&&ZV(p.prev,p,p.next)>=0)return!1;p=p.prevZ}for(;d&&d.z<=f;){if(d!==t.prev&&d!==t.next&&YV(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&ZV(d.prev,d,d.next)>=0)return!1;d=d.nextZ}return!0}function VV(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!JV(i,a)&&KV(i,n,n.next,a)&&QV(i,a)&&QV(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),eU(n),eU(n.next),n=t=a),n=n.next}while(n!==t);return n}function UV(t,e,r,n,i,a){var o=t;do{for(var s=o.next.next;s!==o.prev;){if(o.i!==s.i&&XV(o,s)){var l=$V(o,s);return o=FV(o,o.next),l=FV(l,l.next),BV(o,e,r,n,i,a),void BV(l,e,r,n,i,a)}s=s.next}o=o.next}while(o!==t)}function qV(t,e){return t.x-e.x}function HV(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&YV(ar.x)&&QV(n,t)&&(r=n,f=l),n=n.next;return r}(t,e)){var r=$V(e,t);FV(r,r.next)}}function GV(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function WV(t){var e=t,r=t;do{e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function XV(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&&KV(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&QV(t,e)&&QV(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function ZV(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function JV(t,e){return t.x===e.x&&t.y===e.y}function KV(t,e,r,n){return!!(JV(t,e)&&JV(r,n)||JV(t,n)&&JV(r,e))||ZV(t,e,r)>0!=ZV(t,e,n)>0&&ZV(r,n,t)>0!=ZV(r,n,e)>0}function QV(t,e){return ZV(t.prev,t,t.next)<0?ZV(t,e,t.next)>=0&&ZV(t,t.prev,e)>=0:ZV(t,e,t.prev)<0||ZV(t,t.next,e)<0}function $V(t,e){var r=new rU(t.i,t.x,t.y),n=new rU(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 tU(t,e,r,n){var i=new rU(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 eU(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 rU(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 nU(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r};var iU=function(t,e){"function"==typeof t?(e||(e={}),e.regl=t):e=t;e.length&&(e.positions=e);if(!(t=e.regl).hasExtension("ANGLE_instanced_arrays"))throw Error("regl-error2d: `ANGLE_instanced_arrays` extension should be enabled");var r,n,i,a,o,s,l,u,c=t._gl,h={positions:[],dashes:null,join:null,miterLimit:1,thickness:10,cap:"square",color:"black",opacity:1,overlay:!1,viewport:null,range:null,close:null,fill:null},f=[],p=2,d=3e6,g=1e4;a=t.buffer({usage:"dynamic",type:"uint8",data:null}),o=t.buffer({usage:"static",type:"float",data:[0,1,0,0,1,1,1,0]}),s=t.buffer({usage:"dynamic",type:"float",data:null}),l=t.buffer({usage:"dynamic",type:"float",data:null}),u=t.texture({channels:1,data:new Uint8Array(524288),width:256,height:2048,mag:"linear",min:"linear"}),b(e);var v={primitive:"triangle strip",instances:t.prop("count"),count:4,offset:0,uniforms:{miterMode:function(t,e){return"round"===e.join?2:1},miterLimit:t.prop("miterLimit"),scale:t.prop("scale"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),thickness:t.prop("thickness"),dashPattern:u,dashLength:t.prop("dashLength"),dashShape:[256,2048],opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),scaleRatio:t.prop("scaleRatio"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},blend:{enable:!0,color:[0,0,0,0],equation:{rgb:"add",alpha:"add"},func:{srcRGB:"src alpha",dstRGB:"one minus src alpha",srcAlpha:"one minus dst alpha",dstAlpha:"one"}},depth:{enable:function(t,e){return!e.overlay}},scissor:{enable:!0,box:t.prop("viewport")},stencil:!1,viewport:t.prop("viewport")};function m(t){t?b(t):null===t&&_(),y()}function y(t){if("number"==typeof t)return x(t);t&&!Array.isArray(t)&&(t=[t]),f.forEach(function(t,e){x(e)})}function x(e){"number"==typeof e&&(e=f[e]),e&&e.count&&e.opacity&&e.positions&&e.positions.length>2&&(t._refresh(),e.fill&&e.triangles&&e.triangles.length>2&&i(e),e.thickness&&e.color&&(e.scaleRatio=[e.scale[0]*e.viewport.width,e.scale[1]*e.viewport.height],e.scaleRatio[0]>d||e.scaleRatio[1]>d?n(e):"rect"===e.join||!e.join&&(e.thickness<=2||e.positions.length>=g)?n(e):r(e),e.after&&e.after(e)))}function b(t){if(t){null!=t.length?"number"==typeof t[0]&&(t=[{positions:t}]):Array.isArray(t)||(t=[t]);var e=0;if(m.lines=f=t.map(function(t,r){var n=f[r];return void 0===t?n:(null===t?t={positions:null}:"function"==typeof t?t={after:t}:"number"==typeof t[0]&&(t={positions:t}),null===(t=MV(t,{positions:"positions points data coords",thickness:"thickness lineWidth lineWidths line-width linewidth width stroke-width strokewidth strokeWidth",join:"lineJoin linejoin join type mode",miterLimit:"miterlimit miterLimit",dashes:"dash dashes dasharray dash-array dashArray",color:"color stroke colors stroke-color strokeColor",fill:"fill fill-color fillColor",opacity:"alpha opacity",overlay:"overlay crease overlap intersect",close:"closed close closed-path closePath",range:"range dataBox",viewport:"viewport viewBox",hole:"holes hole hollow",after:"after callback done pass"})).positions&&(t.positions=[]),n||(f[r]=n={id:r,scale:null,scaleFract:null,translate:null,translateFract:null,count:0,offset:0,dashLength:0,hole:!0},t=Us({},h,t)),EV(n,t,[{thickness:parseFloat,opacity:parseFloat,miterLimit:parseFloat,overlay:Boolean,join:function(t){return t},after:function(t){return t},hole:function(t){return t||[]},positions:function(t,r,n){t=wV(t,"float64");var i=Math.floor(t.length/2),a=_V(t,2);return r.range||n.range||(n.range=a),r.count=i,r.bounds=a,e+=i,t},fill:function(t){return t?GC(t,"uint8"):null},dashes:function(t,e,r){var n,i=e.dashLength;if(!t||t.length<2)i=1,n=new Uint8Array([255,255,255,255,255,255,255,255]);else{i=0;for(var a=0;a=4&&e.positions[0]===e.positions[e.positions.length-2]&&e.positions[1]===e.positions[e.positions.length-1]},positions:function(t,e,r){if(e.fill&&t.length){for(var n=[],i={},a=0,o=0,s=0,l=e.count;o 0. && baClipping < length(normalWidth * endBotJoin)) {\n\t\t//handle miter clipping\n\t\tbTopCoord -= normalWidth * endTopJoin;\n\t\tbTopCoord += normalize(endTopJoin * normalWidth) * baClipping;\n\t}\n\n\tif (nextReverse) {\n\t\t//make join rectangular\n\t\tvec2 miterShift = normalWidth * endJoinDirection * miterLimit * .5;\n\t\tfloat normalAdjust = 1. - min(miterLimit / endMiterRatio, 1.);\n\t\tbBotCoord = bCoord + miterShift - normalAdjust * normalWidth * currNormal * .5;\n\t\tbTopCoord = bCoord + miterShift + normalAdjust * normalWidth * currNormal * .5;\n\t}\n\telse if (!prevReverse && abClipping > 0. && abClipping < length(normalWidth * startBotJoin)) {\n\t\t//handle miter clipping\n\t\taBotCoord -= normalWidth * startBotJoin;\n\t\taBotCoord += normalize(startBotJoin * normalWidth) * abClipping;\n\t}\n\n\tvec2 aTopPosition = (aTopCoord) * scale + translate;\n\tvec2 aBotPosition = (aBotCoord) * scale + translate;\n\n\tvec2 bTopPosition = (bTopCoord) * scale + translate;\n\tvec2 bBotPosition = (bBotCoord) * scale + translate;\n\n\t//position is normalized 0..1 coord on the screen\n\tvec2 position = (aTopPosition * lineTop + aBotPosition * lineBot) * lineStart + (bTopPosition * lineTop + bBotPosition * lineBot) * lineEnd;\n\n\tstartCoord = aCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\tendCoord = bCoord * scaleRatio + translate * viewport.zw + viewport.xy;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tenableStartMiter = step(dot(currTangent, prevTangent), .5);\n\tenableEndMiter = step(dot(currTangent, nextTangent), .5);\n\n\t//bevel miter cutoffs\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * miterLimit * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * miterLimit * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n\n\t//round miter cutoffs\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tvec2 startMiterWidth = vec2(startJoinDirection) * thickness * abs(dot(startJoinDirection, currNormal)) * .5;\n\t\t\tstartCutoff = vec4(aCoord, aCoord);\n\t\t\tstartCutoff.zw += vec2(-startJoinDirection.y, startJoinDirection.x) / scaleRatio;\n\t\t\tstartCutoff = startCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tstartCutoff += viewport.xyxy;\n\t\t\tstartCutoff += startMiterWidth.xyxy;\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tvec2 endMiterWidth = vec2(endJoinDirection) * thickness * abs(dot(endJoinDirection, currNormal)) * .5;\n\t\t\tendCutoff = vec4(bCoord, bCoord);\n\t\t\tendCutoff.zw += vec2(-endJoinDirection.y, endJoinDirection.x) / scaleRatio;\n\t\t\tendCutoff = endCutoff * scaleRatio.xyxy + translate.xyxy * viewport.zwzw;\n\t\t\tendCutoff += viewport.xyxy;\n\t\t\tendCutoff += endMiterWidth.xyxy;\n\t\t}\n\t}\n}\n"]),frag:E_(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform vec2 dashShape;\nuniform float dashLength, pixelRatio, thickness, opacity, id, miterMode;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\nvarying vec4 startCutoff, endCutoff;\nvarying vec2 startCoord, endCoord;\nvarying float enableStartMiter, enableEndMiter;\n\nfloat distToLine(vec2 p, vec2 a, vec2 b) {\n\tvec2 diff = b - a;\n\tvec2 perp = normalize(vec2(-diff.y, diff.x));\n\treturn dot(p - a, perp);\n}\n\nvoid main() {\n\tfloat alpha = 1., distToStart, distToEnd;\n\tfloat cutoff = thickness * .5;\n\n\t//bevel miter\n\tif (miterMode == 1.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToStart + 1., 0.), 1.);\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < -1.) {\n\t\t\t\tdiscard;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\talpha *= min(max(distToEnd + 1., 0.), 1.);\n\t\t}\n\t}\n\n\t// round miter\n\telse if (miterMode == 2.) {\n\t\tif (enableStartMiter == 1.) {\n\t\t\tdistToStart = distToLine(gl_FragCoord.xy, startCutoff.xy, startCutoff.zw);\n\t\t\tif (distToStart < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - startCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\n\t\tif (enableEndMiter == 1.) {\n\t\t\tdistToEnd = distToLine(gl_FragCoord.xy, endCutoff.xy, endCutoff.zw);\n\t\t\tif (distToEnd < 0.) {\n\t\t\t\tfloat radius = length(gl_FragCoord.xy - endCoord);\n\n\t\t\t\tif(radius > cutoff + .5) {\n\t\t\t\t\tdiscard;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\talpha -= smoothstep(cutoff - .5, cutoff + .5, radius);\n\t\t\t}\n\t\t}\n\t}\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t * dashLength * 2. / dashShape.x, (id + .5) / dashShape.y)).r;\n\n\tgl_FragColor = fragColor * dash;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:o,divisor:0,stride:8,offset:0},lineTop:{buffer:o,divisor:0,stride:8,offset:4},aColor:{buffer:a,stride:4,offset:function(t,e){return 4*e.offset},divisor:1},bColor:{buffer:a,stride:4,offset:function(t,e){return 4*e.offset+4},divisor:1},prevCoord:{buffer:s,stride:8,offset:function(t,e){return 8*e.offset},divisor:1},aCoord:{buffer:s,stride:8,offset:function(t,e){return 8+8*e.offset},divisor:1},bCoord:{buffer:s,stride:8,offset:function(t,e){return 16+8*e.offset},divisor:1},nextCoord:{buffer:s,stride:8,offset:function(t,e){return 24+8*e.offset},divisor:1}}},v)),n=t(Us({vert:E_(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 aCoord, bCoord, aCoordFract, bCoordFract;\nattribute vec4 color;\nattribute float lineEnd, lineTop;\n\nuniform vec2 scale, scaleFract, translate, translateFract, scaleRatio;\nuniform float thickness, pixelRatio, id;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nconst float MAX_LINES = 256.;\n\nvec2 project(vec2 position, vec2 positionFract, vec2 scale, vec2 scaleFract, vec2 translate, vec2 translateFract) {\n\t// the order is important\n\treturn position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n}\n\nvoid main() {\n\t// vec2 scaleRatio = scale * viewport.zw;\n\tvec2 normalWidth = thickness / scaleRatio;\n\n\tfloat lineStart = 1. - lineEnd;\n\tfloat lineOffset = lineTop * 2. - 1.;\n\tfloat depth = (MAX_LINES - 1. - id) / (MAX_LINES);\n\n\tvec2 diff = (bCoord + bCoordFract - aCoord - aCoordFract);\n\ttangent = normalize(diff * scaleRatio);\n\tvec2 normal = vec2(-tangent.y, tangent.x);\n\n\tvec2 position = project(aCoord, aCoordFract, scale, scaleFract, translate, translateFract) * lineStart\n\t\t+ project(bCoord, bCoordFract, scale, scaleFract, translate, translateFract) * lineEnd\n\n\t\t+ thickness * normal * .5 * lineOffset / viewport.zw;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]),frag:E_(["precision highp float;\n#define GLSLIFY 1\n\nuniform sampler2D dashPattern;\nuniform vec2 dashShape;\nuniform float dashLength, pixelRatio, thickness, opacity, id;\n\nvarying vec4 fragColor;\nvarying vec2 tangent;\n\nvoid main() {\n\tfloat alpha = 1.;\n\n\tfloat t = fract(dot(tangent, gl_FragCoord.xy) / dashLength) * .5 + .25;\n\tfloat dash = texture2D(dashPattern, vec2(t * dashLength * 2. / dashShape.x, (id + .5) / dashShape.y)).r;\n\n\tgl_FragColor = fragColor * dash;\n\tgl_FragColor.a *= alpha * opacity * dash;\n}\n"]),attributes:{lineEnd:{buffer:o,divisor:0,stride:8,offset:0},lineTop:{buffer:o,divisor:0,stride:8,offset:4},aCoord:{buffer:s,stride:8,offset:function(t,e){return 8+8*e.offset},divisor:1},bCoord:{buffer:s,stride:8,offset:function(t,e){return 16+8*e.offset},divisor:1},aCoordFract:{buffer:l,stride:8,offset:function(t,e){return 8+8*e.offset},divisor:1},bCoordFract:{buffer:l,stride:8,offset:function(t,e){return 16+8*e.offset},divisor:1},color:{buffer:a,stride:4,offset:function(t,e){return 4*e.offset},divisor:1}}},v)),i=t({primitive:"triangle",elements:function(t,e){return e.triangles},offset:0,vert:E_(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\n\nuniform vec4 color;\nuniform vec2 scale, scaleFract, translate, translateFract, scaleRatio;\nuniform float pixelRatio, id;\nuniform vec4 viewport;\n\nvarying vec4 fragColor;\n\nconst float MAX_LINES = 256.;\n\nvoid main() {\n\tfloat depth = (MAX_LINES - 4. - id) / (MAX_LINES);\n\n\tvec2 position = position * scale + translate\n + positionFract * scale + translateFract\n + position * scaleFract\n + positionFract * scaleFract;\n\n\tgl_Position = vec4(position * 2.0 - 1.0, depth, 1);\n\n\tfragColor = color / 255.;\n}\n"]),frag:E_(["precision highp float;\n#define GLSLIFY 1\n\nuniform float opacity;\n\nvarying vec4 fragColor;\n\nvoid main() {\n\tgl_FragColor = fragColor;\n\tgl_FragColor.a *= opacity;\n}\n"]),uniforms:{scale:t.prop("scale"),color:t.prop("fill"),scaleFract:t.prop("scaleFract"),translateFract:t.prop("translateFract"),translate:t.prop("translate"),opacity:t.prop("opacity"),pixelRatio:t.context("pixelRatio"),id:t.prop("id"),viewport:function(t,e){return[e.viewport.x,e.viewport.y,t.viewportWidth,t.viewportHeight]}},attributes:{position:{buffer:s,stride:8,offset:function(t,e){return 8+8*e.offset}},positionFract:{buffer:l,stride:8,offset:function(t,e){return 8+8*e.offset}}},blend:v.blend,depth:{enable:!1},scissor:v.scissor,stencil:v.stencil,viewport:v.viewport}),Us(m,{update:b,draw:y,destroy:_,regl:t,gl:c,canvas:c.canvas,lines:f}),m};function aU(t){var e=new Float32Array(t.length);e.set(t);for(var r=0,n=e.length;r>>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]};var lU="undefined"!=typeof navigator&&(/MSIE/.test(navigator.userAgent)||/Trident\//.test(navigator.appVersion)),uU=function(t){var e;arguments.length>1&&(t=arguments);"string"==typeof t&&(t=t.split(/\s/).map(parseFloat));t.length&&"number"==typeof t[0]?e=2===t.length?{width:t[0],height:t[1],x:0,y:0}:{x:t[0],y:t[1],width:t[2]-t[0]||0,height:t[3]-t[1]||0}:t&&(t=MV(t,{left:"x l left Left",top:"y t top Top",width:"w width",height:"h height",bottom:"b bottom",right:"r right"}),e={x:t.left||0,y:t.top||0},null==t.width?t.right?e.width=t.right-e.x:e.width=0:e.width=t.width,null==t.height?t.bottom?e.height=t.bottom-e.y:e.height=0:e.height=t.height);return e};function cU(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 hU(t,e,r,n){return new Function([cU("A","x"+t+"y",e,["y"],n),cU("P","c(x,y)"+t+"0",e,["y","c"],n),"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(""))()}var fU={ge:hU(">=",!1,"GE"),gt:hU(">",!1,"GT"),lt:hU("<",!0,"LT"),le:hU("<=",!0,"LE"),eq:hU("-",!0,"EQ",!0)},pU=function(t,e,r,n,i){i<=4*dU?gU(0,i-1,t,e,r,n):function t(e,r,n,i,a,o){var s=(r-e+1)/6|0,l=e+s,u=r-s,c=e+r>>1,h=c-s,f=c+s,p=l,d=h,g=c,v=f,m=u,y=e+1,x=r-1,b=0;bU(p,d,n,i,a)&&(b=p,p=d,d=b);bU(v,m,n,i,a)&&(b=v,v=m,m=b);bU(p,g,n,i,a)&&(b=p,p=g,g=b);bU(d,g,n,i,a)&&(b=d,d=g,g=b);bU(p,v,n,i,a)&&(b=p,p=v,v=b);bU(g,v,n,i,a)&&(b=g,g=v,v=b);bU(d,m,n,i,a)&&(b=d,d=m,m=b);bU(d,g,n,i,a)&&(b=d,d=g,g=b);bU(v,m,n,i,a)&&(b=v,v=m,m=b);var _=n[d];var w=i[2*d];var M=i[2*d+1];var A=a[d];var k=o[d];var T=n[v];var S=i[2*v];var E=i[2*v+1];var C=a[v];var L=o[v];var z=p;var P=g;var I=m;var D=l;var O=c;var R=u;var F=n[z];var B=n[P];var N=n[I];n[D]=F;n[O]=B;n[R]=N;for(var j=0;j<2;++j){var V=i[2*z+j],U=i[2*P+j],q=i[2*I+j];i[2*D+j]=V,i[2*O+j]=U,i[2*R+j]=q}var H=a[z];var G=a[P];var W=a[I];a[D]=H;a[O]=G;a[R]=W;var Y=o[z];var X=o[P];var Z=o[I];o[D]=Y;o[O]=X;o[R]=Z;mU(h,e,n,i,a,o);mU(f,r,n,i,a,o);for(var J=y;J<=x;++J)if(_U(J,_,w,M,A,n,i,a))J!==y&&vU(J,y,n,i,a,o),++y;else if(!_U(J,T,S,E,C,n,i,a))for(;;){if(_U(x,T,S,E,C,n,i,a)){_U(x,_,w,M,A,n,i,a)?(yU(J,y,x,n,i,a,o),++y,--x):(vU(J,x,n,i,a,o),--x);break}if(--xt;){var p=r[f-1],d=n[2*(f-1)];if((p-s||l-d)>=0)break;r[f]=p,n[2*f]=d,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]=u,i[f]=c,a[f]=h}}function vU(t,e,r,n,i,a){var o=r[t],s=n[2*t],l=n[2*t+1],u=i[t],c=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]=u,a[e]=c}function mU(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 yU(t,e,r,n,i,a,o){var s=n[t],l=i[2*t],u=i[2*t+1],c=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]=u,a[r]=c,o[r]=h}function xU(t,e,r,n,i,a,o,s,l,u,c){s[t]=s[e],l[2*t]=l[2*e],l[2*t+1]=l[2*e+1],u[t]=u[e],c[t]=c[e],s[e]=r,l[2*e]=n,l[2*e+1]=i,u[e]=a,c[e]=o}function bU(t,e,r,n,i){return(r[t]-r[e]||n[2*e]-n[2*t]||i[t]-i[e])<0}function _U(t,e,r,n,i,a,o,s){return(e-a[t]||o[2*t]-r||i-s[t])<0}var wU=function(t,e,r,n){var i=t.length>>>1;if(i<1)return[];e||(e=Array(i));r||(r=Array(i));n||(n=[]);for(var a=0;a=n[2]||n[1]>=n[3]){var o=_V(t,2);o[0]===o[2]&&(o[2]+=1),o[1]===o[3]&&(o[3]+=1),n[0]=o[0],n[1]=o[1],n[2]=o[2],n[3]=o[3]}var s=n[0],l=n[1],u=n[2],c=n[3],h=1/(u-s),f=1/(c-l),p=Math.max(u-s,c-l),d=new Int32Array(i),g=0;(function n(i,a,o,s,l,u){var c=.5*o;var h=s+1;var f=l-s;r[g]=f;d[g++]=u;for(var p=0;p<2;++p)for(var v=0;v<2;++v){var m=i+p*c,y=a+v*c,x=MU(t,e,h,l,m,y,m+c,y+c);if(x!==h){if(x-h>=Math.max(.9*f,32)){var b=l+s>>>1;n(m,y,c,h,b,u+1),h=b}n(m,y,c,h,x,u+1),h=x}}})(s,l,p,0,i,0),pU(d,t,e,r,i);for(var v=[],m=0,y=i,g=i-1;g>=0;--g){t[2*g]=(t[2*g]-s)*h,t[2*g+1]=(t[2*g+1]-l)*f;var x=d[g];x!==m&&(v.push(new AU(p*Math.pow(.5,x),g+1,y-(g+1))),y=g+1,m=x)}return v.push(new AU(p*Math.pow(.5,x+1),0,y)),v};function MU(t,e,r,n,i,a,o,s){for(var l=r,u=r;u 1.0) {\n discard;\n }\n\n float centerFraction = fragBorderSize == 0. ? 2. : fragSize / (fragSize + fragBorderSize + 1.25);\n\n vec4 baseColor = mix(borderColor, color, smoothStep(radius, centerFraction));\n float alpha = 1.0 - pow(1.0 - baseColor.a, 1.);\n gl_FragColor = vec4(baseColor.rgb * alpha, alpha);\n}\n"]),vert:E_(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\nattribute float size, borderSize;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth, fragBorderSize, fragSize;\n\nvoid main() {\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n fragBorderSize = borderSize;\n fragSize = size;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t+ (position + translate) * scaleFract\n\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = borderSize == 0. ? 2. : 1. - 2. * borderSize / (size + borderSize);\n fragWidth = 1. / gl_PointSize;\n}\n"]),uniforms:{color:function(t,e){var r=e.color.length?e.color[0]:e.color;return c.slice(4*r,4*r+4).map(function(t){return t/255})},borderColor:function(t,e){var r=e.borderColor.length?e.borderColor[0]:e.borderColor;return c.slice(4*r,4*r+4).map(function(t){return t/255})},pixelRatio:t.context("pixelRatio"),palette:l,paletteSize:function(t,e){return[v,l.height]},scale:t.prop("scale"),scaleFract:t.prop("scaleFract"),translate:t.prop("translate"),translateFract:t.prop("translateFract"),opacity:t.prop("opacity"),marker:t.prop("marker")},attributes:{position:a,positionFract:o,size:y.attributes.size,borderSize:y.attributes.borderSize}}));else{var x=Us({},y);x.frag=E_(["precision mediump float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragWidth, fragBorderColorLevel, fragColorLevel;\n\nuniform sampler2D marker;\nuniform float pixelRatio, opacity;\n\nfloat smoothStep(float x, float y) {\n return 1.0 / (1.0 + exp(50.0*(x - y)));\n}\n\nvoid main() {\n float dist = texture2D(marker, gl_PointCoord).r, delta = fragWidth;\n\n //max-distance alpha\n if (dist < 0.003) discard;\n\n //null-border case\n if (fragBorderColorLevel == fragColorLevel || fragBorderColor.a == 0.) {\n float colorAmt = smoothstep(.5 - delta, .5 + delta, dist);\n gl_FragColor = vec4(fragColor.rgb, colorAmt * fragColor.a);\n return;\n }\n\n float borderColorAmt = smoothstep(fragBorderColorLevel - delta, fragBorderColorLevel + delta, dist);\n float colorAmt = smoothstep(fragColorLevel - delta, fragColorLevel + delta, dist);\n\n vec4 color = fragBorderColor;\n color.a *= borderColorAmt;\n color = mix(color, fragColor, colorAmt);\n color.a *= opacity;\n\n gl_FragColor = color;\n}\n"]),x.vert=E_(["precision mediump float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\nattribute float size, borderSize;\nattribute vec2 colorId, borderColorId;\n\nuniform vec2 scale, scaleFract, translate, translateFract, paletteSize;\nuniform float pixelRatio;\nuniform sampler2D palette;\n\nconst float maxSize = 100.;\nconst float borderLevel = .5;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragPointSize, fragBorderRadius,\n\t\tfragWidth, fragBorderColorLevel, fragColorLevel;\n\nvec2 paletteCoord(float id) {\n return vec2(\n (mod(id, paletteSize.x) + .5) / paletteSize.x,\n (floor(id / paletteSize.x) + .5) / paletteSize.y\n );\n}\nvec2 paletteCoord(vec2 id) {\n return vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n );\n}\n\nvoid main() {\n vec4 color = texture2D(palette, paletteCoord(colorId));\n vec4 borderColor = texture2D(palette, paletteCoord(borderColorId));\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = 2. * size * pixelRatio;\n fragPointSize = size * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n + (positionFract + translateFract) * scale\n + (position + translate) * scaleFract\n + (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragColor = color;\n fragBorderColor = borderColor;\n fragWidth = 1. / gl_PointSize;\n\n fragBorderColorLevel = clamp(borderLevel - borderLevel * borderSize / size, 0., 1.);\n fragColorLevel = clamp(borderLevel + (1. - borderLevel) * borderSize / size, 0., 1.);\n}\n"]),r=t(x);var b=Us({},y);b.frag=E_(["precision highp float;\n#define GLSLIFY 1\n\nvarying vec4 fragColor, fragBorderColor;\n\nuniform float opacity;\nvarying float fragBorderRadius, fragWidth;\n\nvoid main() {\n\tfloat radius, alpha = 1.0, delta = fragWidth;\n\n\tradius = length(2.0 * gl_PointCoord.xy - 1.0);\n\n\tif(radius > 1.0 + delta) {\n\t\tdiscard;\n\t\treturn;\n\t}\n\n\talpha -= smoothstep(1.0 - delta, 1.0 + delta, radius);\n\n\tfloat borderRadius = fragBorderRadius;\n\tfloat ratio = smoothstep(borderRadius - delta, borderRadius + delta, radius);\n\tvec4 color = mix(fragColor, fragBorderColor, ratio);\n\tcolor.a *= alpha * opacity;\n\tgl_FragColor = color;\n}\n"]),b.vert=E_(["precision highp float;\n#define GLSLIFY 1\n\nattribute vec2 position, positionFract;\nattribute float size, borderSize;\nattribute vec2 colorId, borderColorId;\n\nuniform vec2 scale, scaleFract, translate, translateFract;\nuniform float pixelRatio;\nuniform sampler2D palette;\nuniform vec2 paletteSize;\n\nconst float maxSize = 100.;\n\nvarying vec4 fragColor, fragBorderColor;\nvarying float fragBorderRadius, fragWidth;\n\nvec2 paletteCoord(float id) {\n return vec2(\n (mod(id, paletteSize.x) + .5) / paletteSize.x,\n (floor(id / paletteSize.x) + .5) / paletteSize.y\n );\n}\nvec2 paletteCoord(vec2 id) {\n return vec2(\n (id.x + .5) / paletteSize.x,\n (id.y + .5) / paletteSize.y\n );\n}\n\nvoid main() {\n vec4 color = texture2D(palette, paletteCoord(colorId));\n vec4 borderColor = texture2D(palette, paletteCoord(borderColorId));\n\n float size = size * maxSize / 255.;\n float borderSize = borderSize * maxSize / 255.;\n\n gl_PointSize = (size + borderSize) * pixelRatio;\n\n vec2 pos = (position + translate) * scale\n\t\t\t+ (positionFract + translateFract) * scale\n\t\t\t+ (position + translate) * scaleFract\n\t\t\t+ (positionFract + translateFract) * scaleFract;\n\n gl_Position = vec4(pos * 2. - 1., 0, 1);\n\n fragBorderRadius = borderSize == 0. ? 2. : 1. - 2. * borderSize / (size + borderSize);\n fragColor = color;\n fragBorderColor = borderColor;\n fragWidth = 1. / gl_PointSize;\n}\n"]),n=t(b)}function _(t){t?k(t):null===t&&L(),w()}function w(t){if("number"==typeof t)return M(t);Array.isArray(t)?t.forEach(function(t,e){if(null!=t)return t.length?M(t,e):M(t)}):p.forEach(function(t,e){t&&M(e)})}function M(e,i){var a;if("number"==typeof e&&(e=p[e]),Array.isArray(e)&&(a=e,e=p[i]),e&&e.count&&e.opacity){var o;if(a){o=Array(e.count);for(var s=0;s1)){var p=f.offset,g=f.count+p,v=fU.ge(l,n[0],p,g-1),m=fU.lt(l,n[2],v,g-1)+1;if(!(m<=v))if(r){var y=x(t.data.subarray(v,m),r);o.push(Us({},e,{elements:y,marker:d[u],offset:0,count:y.length}))}else o.push(Us({},e,{elements:t.elements,marker:d[u],offset:v,count:m-v}))}}function x(t,e){for(var r=[],n=0,a=t.length;ni)){l.snap=!0;var h=l.x=Array(u),f=l.w=Array(u),p=void 0;if(n.length>1){p=Array(2*u);for(var d=0;d=0)return n;if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)r=e;else{r=new Uint8Array(e.length);for(var i=0,a=e.length;i1)for(var r=.25*(t=t.slice()).length%v;r7&&(r.push(p.splice(0,7)),p.unshift("C"));break;case"S":var g=u,v=c;"C"!=e&&"S"!=e||(g+=g-n,v+=v-i),p=["C",g,v,p[1],p[2],p[3],p[4]];break;case"T":"Q"==e||"T"==e?(s=2*u-s,l=2*c-l):(s=u,l=c),p=FU(u,c,s,l,p[1],p[2]);break;case"Q":s=p[1],l=p[2],p=FU(u,c,p[1],p[2],p[3],p[4]);break;case"L":p=RU(u,c,p[1],p[2]);break;case"H":p=RU(u,c,p[1],c);break;case"V":p=RU(u,c,u,p[1]);break;case"Z":p=RU(u,c,a,o)}e=d,u=p[p.length-2],c=p[p.length-1],p.length>4?(n=p[p.length-4],i=p[p.length-3]):(n=u,i=c),r.push(p)}return r};function RU(t,e,r,n){return["C",t,e,r,n,r,n]}function FU(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}function BU(t,e,r,n,i,a,o,s,l,u){if(u)x=u[0],b=u[1],m=u[2],y=u[3];else{var c=NU(t,e,-i);t=c.x,e=c.y;var h=(t-(s=(c=NU(s,l,-i)).x))/2,f=(e-(l=c.y))/2,p=h*h/(r*r)+f*f/(n*n);p>1&&(r*=p=Math.sqrt(p),n*=p);var d=r*r,g=n*n,v=(a==o?-1:1)*Math.sqrt(Math.abs((d*g-d*f*f-g*h*h)/(d*f*f+g*h*h)));v==1/0&&(v=1);var m=v*r*f/n+(t+s)/2,y=v*-n*h/r+(e+l)/2,x=Math.asin(((e-y)/n).toFixed(9)),b=Math.asin(((l-y)/n).toFixed(9));x=tb&&(x-=2*IU),!o&&b>x&&(b-=2*IU)}if(Math.abs(b-x)>DU){var _=b,w=s,M=l;b=x+DU*(o&&b>x?1:-1);var A=BU(s=m+r*Math.cos(b),l=y+n*Math.sin(b),r,n,i,0,o,w,M,[b,_,m,y])}var k=Math.tan((b-x)/4),T=4/3*r*k,S=4/3*n*k,E=[2*t-(t+T*Math.sin(x)),2*e-(e-S*Math.cos(x)),s+T*Math.sin(b),l-S*Math.cos(b),s,l];if(u)return E;A&&(E=E.concat(A));for(var C=0;C4))},HU=function(t){var e=[];return t.replace(WU,function(t,r,n){var i=r.toLowerCase();for(n=function(t){var e=t.match(YU);return e?e.map(Number):[]}(n),"m"==i&&n.length>2&&(e.push([r].concat(n.splice(0,2))),i="l",r="m"==r?"l":"L");;){if(n.length==GU[i])return n.unshift(r),e.push(n);if(n.length=o)return t;switch(t){case"%s":return String(i[n++]);case"%d":return Number(i[n++]);case"%j":try{return JSON.stringify(i[n++])}catch(t){return"[Circular]"}default:return t}}),l=i[n];n=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),f(e)?r.showHidden=e:e&&JU._extend(r,e),v(r.showHidden)&&(r.showHidden=!1),v(r.depth)&&(r.depth=2),v(r.colors)&&(r.colors=!1),v(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=o),l(r,t,r.depth)}function o(t,e){var r=a.styles[e];return r?"\x1b["+a.colors[r][0]+"m"+t+"\x1b["+a.colors[r][1]+"m":t}function s(t,e){return t}function l(t,e,r){if(t.customInspect&&e&&_(e.inspect)&&e.inspect!==JU.inspect&&(!e.constructor||e.constructor.prototype!==e)){var n=e.inspect(r,t);return g(n)||(n=l(t,n,r)),n}var i=function(t,e){if(v(e))return t.stylize("undefined","undefined");if(g(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(f(e))return t.stylize(""+e,"boolean");if(p(e))return t.stylize("null","null")}(t,e);if(i)return i;var a=Object.keys(e),o=function(t){var e={};return t.forEach(function(t,r){e[t]=!0}),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),b(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return u(e);if(0===a.length){if(_(e)){var s=e.name?": "+e.name:"";return t.stylize("[Function"+s+"]","special")}if(m(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(x(e))return t.stylize(Date.prototype.toString.call(e),"date");if(b(e))return u(e)}var y,w="",M=!1,A=["{","}"];(h(e)&&(M=!0,A=["[","]"]),_(e))&&(w=" [Function"+(e.name?": "+e.name:"")+"]");return m(e)&&(w=" "+RegExp.prototype.toString.call(e)),x(e)&&(w=" "+Date.prototype.toUTCString.call(e)),b(e)&&(w=" "+u(e)),0!==a.length||M&&0!=e.length?r<0?m(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),y=M?function(t,e,r,n,i){for(var a=[],o=0,s=e.length;o=0&&0,t+e.replace(/\u001b\[\d\d?m/g,"").length+1},0)>60)return r[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+r[1];return r[0]+e+" "+t.join(", ")+" "+r[1]}(y,w,A)):A[0]+w+A[1]}function u(t){return"["+Error.prototype.toString.call(t)+"]"}function c(t,e,r,n,i,a){var o,s,u;if((u=Object.getOwnPropertyDescriptor(e,i)||{value:e[i]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),k(n,i)||(o="["+i+"]"),s||(t.seen.indexOf(u.value)<0?(s=p(r)?l(t,u.value,null):l(t,u.value,r-1)).indexOf("\n")>-1&&(s=a?s.split("\n").map(function(t){return" "+t}).join("\n").substr(2):"\n"+s.split("\n").map(function(t){return" "+t}).join("\n")):s=t.stylize("[Circular]","special")),v(o)){if(a&&i.match(/^\d+$/))return s;(o=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=t.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=t.stylize(o,"string"))}return o+": "+s}function h(t){return Array.isArray(t)}function f(t){return"boolean"==typeof t}function p(t){return null===t}function d(t){return"number"==typeof t}function g(t){return"string"==typeof t}function v(t){return void 0===t}function m(t){return y(t)&&"[object RegExp]"===w(t)}function y(t){return"object"==typeof t&&null!==t}function x(t){return y(t)&&"[object Date]"===w(t)}function b(t){return y(t)&&("[object Error]"===w(t)||t instanceof Error)}function _(t){return"function"==typeof t}function w(t){return Object.prototype.toString.call(t)}function M(t){return t<10?"0"+t.toString(10):t.toString(10)}JU.debuglog=function(e){if(v(n)&&(n=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!i[e])if(new RegExp("\\b"+e+"\\b","i").test(n)){var r=t.pid;i[e]=function(){var t=JU.format.apply(JU,arguments);console.error("%s %d: %s",e,r,t)}}else i[e]=function(){};return i[e]},JU.inspect=a,a.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]},a.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},JU.isArray=h,JU.isBoolean=f,JU.isNull=p,JU.isNullOrUndefined=function(t){return null==t},JU.isNumber=d,JU.isString=g,JU.isSymbol=function(t){return"symbol"==typeof t},JU.isUndefined=v,JU.isRegExp=m,JU.isObject=y,JU.isDate=x,JU.isError=b,JU.isFunction=_,JU.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},JU.isBuffer=ZU;var A=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function k(t,e){return Object.prototype.hasOwnProperty.call(t,e)}JU.log=function(){var t,e;console.log("%s - %s",(t=new Date,e=[M(t.getHours()),M(t.getMinutes()),M(t.getSeconds())].join(":"),[t.getDate(),A[t.getMonth()],e].join(" ")),JU.format.apply(JU,arguments))},JU.inherits=XU,JU._extend=function(t,e){if(!e||!y(e))return t;for(var r=Object.keys(e),n=r.length;n--;)t[r[n]]=e[r[n]];return t}}).call(this,Pp,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var KU={};(function(t){"use strict";function e(t,e){if(t===e)return 0;for(var r=t.length,n=e.length,i=0,a=Math.min(r,n);i=0;l--)if(u[l]!==c[l])return!1;for(l=u.length-1;l>=0;l--)if(s=u[l],!g(t[s],e[s],r,n))return!1;return!0}(t,n,a,l))}return a?t===n:t==n}function v(t){return"[object Arguments]"==Object.prototype.toString.call(t)}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 y(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&&p(i,r,"Missing expected exception"+n);var a="string"==typeof n,o=!t&&JU.isError(i),s=!t&&i&&!r;if((o&&a&&m(i,r)||s)&&p(i,r,"Got unwanted exception"+n),t&&i&&r&&!m(i,r)||!t&&i)throw i}l.AssertionError=function(t){var e;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=h(f((e=this).actual),128)+" "+e.operator+" "+h(f(e.expected),128),this.generatedMessage=!0);var r=t.stackStartFunction||p;if(Error.captureStackTrace)Error.captureStackTrace(this,r);else{var n=new Error;if(n.stack){var i=n.stack,a=c(r),o=i.indexOf("\n"+a);if(o>=0){var s=i.indexOf("\n",o+1);i=i.substring(s+1)}this.stack=i}}},JU.inherits(l.AssertionError,Error),l.fail=p,l.ok=d,l.equal=function(t,e,r){t!=e&&p(t,e,r,"==",l.equal)},l.notEqual=function(t,e,r){t==e&&p(t,e,r,"!=",l.notEqual)},l.deepEqual=function(t,e,r){g(t,e,!1)||p(t,e,r,"deepEqual",l.deepEqual)},l.deepStrictEqual=function(t,e,r){g(t,e,!0)||p(t,e,r,"deepStrictEqual",l.deepStrictEqual)},l.notDeepEqual=function(t,e,r){g(t,e,!1)&&p(t,e,r,"notDeepEqual",l.notDeepEqual)},l.notDeepStrictEqual=function t(e,r,n){g(e,r,!0)&&p(e,r,n,"notDeepStrictEqual",t)},l.strictEqual=function(t,e,r){t!==e&&p(t,e,r,"===",l.strictEqual)},l.notStrictEqual=function(t,e,r){t===e&&p(t,e,r,"!==",l.notStrictEqual)},l.throws=function(t,e,r){y(!0,t,e,r)},l.doesNotThrow=function(t,e,r){y(!1,t,e,r)},l.ifError=function(t){if(t)throw t};var x=Object.keys||function(t){var e=[];for(var r in t)n.call(t,r)&&e.push(r);return e}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var QU={};Object.defineProperty(QU,"__esModule",{value:!0});var $U=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var r=[],n=!0,i=!1,a=void 0;try{for(var o,s=t[Symbol.iterator]();!(n=(o=s.next()).done)&&(r.push(o.value),!e||r.length!==e);n=!0);}catch(t){i=!0,a=t}finally{try{!n&&s.return&&s.return()}finally{if(i)throw a}}return r}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),tq=2*Math.PI,eq=function(t,e,r,n,i,a,o){var s=t.x,l=t.y;return{x:n*(s*=e)-i*(l*=r)+a,y:i*s+n*l+o}},rq=function(t,e){var r=4/3*Math.tan(e/4),n=Math.cos(t),i=Math.sin(t),a=Math.cos(t+e),o=Math.sin(t+e);return[{x:n-i*r,y:i+n*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]},nq=function(t,e,r,n){var i=t*n-e*r<0?-1:1,a=(t*r+e*n)/(Math.sqrt(t*t+e*e)*Math.sqrt(t*t+e*e));return a>1&&(a=1),a<-1&&(a=-1),i*Math.acos(a)};QU.default=function(t){var e=t.px,r=t.py,n=t.cx,i=t.cy,a=t.rx,o=t.ry,s=t.xAxisRotation,l=void 0===s?0:s,u=t.largeArcFlag,c=void 0===u?0:u,h=t.sweepFlag,f=void 0===h?0:h,p=[];if(0===a||0===o)return[];var d=Math.sin(l*tq/360),g=Math.cos(l*tq/360),v=g*(e-n)/2+d*(r-i)/2,m=-d*(e-n)/2+g*(r-i)/2;if(0===v&&0===m)return[];a=Math.abs(a),o=Math.abs(o);var y=Math.pow(v,2)/Math.pow(a,2)+Math.pow(m,2)/Math.pow(o,2);y>1&&(a*=Math.sqrt(y),o*=Math.sqrt(y));var x=function(t,e,r,n,i,a,o,s,l,u,c,h){var f=Math.pow(i,2),p=Math.pow(a,2),d=Math.pow(c,2),g=Math.pow(h,2),v=f*p-f*g-p*d;v<0&&(v=0),v/=f*g+p*d;var m=(v=Math.sqrt(v)*(o===s?-1:1))*i/a*h,y=v*-a/i*c,x=u*m-l*y+(t+r)/2,b=l*m+u*y+(e+n)/2,_=(c-m)/i,w=(h-y)/a,M=(-c-m)/i,A=(-h-y)/a,k=nq(1,0,_,w),T=nq(_,w,M,A);return 0===s&&T>0&&(T-=tq),1===s&&T<0&&(T+=tq),[x,b,k,T]}(e,r,n,i,a,o,c,f,d,g,v,m),b=$U(x,4),_=b[0],w=b[1],M=b[2],A=b[3],k=Math.max(Math.ceil(Math.abs(A)/(tq/4)),1);A/=k;for(var T=0;T4?(n=p[p.length-4],i=p[p.length-3]):(n=u,i=c),r.push(p)}return r};function aq(t,e,r,n){return["C",t,e,r,n,r,n]}function oq(t,e,r,n,i,a){return["C",t/3+2/3*r,e/3+2/3*n,i/3+2/3*r,a/3+2/3*n,i,a]}var sq=function(t){Array.isArray(t)&&1===t.length&&"string"==typeof t[0]&&(t=t[0]);"string"==typeof t&&(KU(qU(t),"String is not an SVG path."),t=HU(t));if(KU(Array.isArray(t),"Argument should be a string or an array of path segments."),t=PU(t),!(t=iq(t)).length)return[0,0,0,0];for(var e=[1/0,1/0,-1/0,-1/0],r=0,n=t.length;re[2]&&(e[2]=i[a+0]),i[a+1]>e[3]&&(e[3]=i[a+1]);return e};var lq={};(function(t){"use strict";var e=document.createElement("canvas"),r=e.getContext("2d");lq=function(n,i){if(!qU(n))throw Error("Argument should be valid svg path string");i||(i={});var a,o;i.shape?(a=i.shape[0],o=i.shape[1]):(a=e.width=i.w||i.width||200,o=e.height=i.h||i.height||200);var s=Math.min(a,o),l=i.stroke||0,u=i.viewbox||i.viewBox||sq(n),c=[a/(u[2]-u[0]),o/(u[3]-u[1])],h=Math.min(c[0]||0,c[1]||0)/2;r.fillStyle="black",r.fillRect(0,0,a,o),r.fillStyle="white",l&&("number"!=typeof l&&(l=1),r.strokeStyle=l>0?"white":"black",r.lineWidth=Math.abs(l));if(r.translate(.5*a,.5*o),r.scale(h,h),t.Path2D){var f=new Path2D(n);r.fill(f),l&&r.stroke(f)}else{var p=HU(n);UU(r,p),r.fill(),l&&r.stroke()}return r.setTransform(1,0,0,1,0,0),EU(r,{cutoff:null!=i.cutoff?i.cutoff:.5,radius:null!=i.radius?i.radius:.5*s})}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var uq={solid:[1],dot:[1,1],dash:[4,1],longdash:[8,1],dashdot:[4,1,1,1],longdashdot:[8,1,1,1]},cq={},hq=m.extendFlat,fq=ye.overrideAll,pq=Zr.line,dq=Zr.marker,gq=dq.line,vq=cq=fq({x:Zr.x,x0:Zr.x0,dx:Zr.dx,y:Zr.y,y0:Zr.y0,dy:Zr.dy,text:hq({},Zr.text,{}),mode:{valType:"flaglist",flags:["lines","markers"],extras:["none"]},line:{color:pq.color,width:pq.width,dash:{valType:"enumerated",values:Object.keys(uq),dflt:"solid"}},marker:hq({},De(),{symbol:dq.symbol,size:dq.size,sizeref:dq.sizeref,sizemin:dq.sizemin,sizemode:dq.sizemode,opacity:dq.opacity,showscale:dq.showscale,colorbar:dq.colorbar,line:hq({},De(),{width:gq.width})}),connectgaps:Zr.connectgaps,fill:Zr.fill,fillcolor:Zr.fillcolor,hoveron:Zr.hoveron,selected:{marker:Zr.selected.marker},unselected:{marker:Zr.unselected.marker},opacity:E.opacity},"calc","nested");vq.x.editType=vq.y.editType=vq.x0.editType=vq.y0.editType="calc+clearAxisTypes";var mq=function(t,e,r,n){function i(r,n){return ne.coerce(t,e,cq,r,n)}var a=!!t.marker&&/-open/.test(t.marker.symbol),o=Tr.isBubble(t),s=Ta(t,e,n,i);if(s){i("text"),i("mode",s1,o=r.error_x&&!0===r.error_x.visible,s=r.error_y&&!0===r.error_y.visible,l=Tr.hasMarkers(r),u=!!r.fill&&"none"!==r.fill),o||s){var A=P.getComponentMethod("errorbars","calcFromTrace")(r,_);o&&(v=C("x",r.error_x,A)),s&&(m=C("y",r.error_y,A))}if(a){(h={}).thickness=r.line.width,h.color=r.line.color,h.opacity=r.opacity,h.overlay=!0;var k=(uq[r.line.dash]||[1]).slice();for(i=0;ic?"rect":l?"rect":"round",T&&r.connectgaps){var S=b[0],E=b[1];for(i=0;i0){e+=Math.abs(i(t[0]));for(var r=1;r2){for(l=0;li.maxh||t>i.maxw||r<=i.maxh&&t<=i.maxw&&(o=i.maxw*i.maxh-t*r)a.free)){if(r===a.h)return this.allocShelf(s,t,r,n);r>a.h||rc)&&(h=2*Math.max(t,c)),(ll)&&(u=2*Math.max(r,l)),this.resize(h,u),this.packOne(t,r,n)):null},t.prototype.allocFreebin=function(t,e,r,n){var i=this.freebins.splice(t,1)[0];return i.id=n,i.w=e,i.h=r,i.refcount=0,this.bins[n]=i,this.ref(i),i},t.prototype.allocShelf=function(t,e,r,n){var i=this.shelves[t].alloc(e,r,n);return this.bins[n]=i,this.ref(i),i},t.prototype.shrink=function(){if(this.shelves.length>0){for(var t=0,e=0,r=0;rthis.free||e>this.h)return null;var n=this.x;return this.x+=t,this.free-=t,new function(t,e,r,n,i,a,o){this.id=t,this.x=e,this.y=r,this.w=n,this.h=i,this.maxw=a||n,this.maxh=o||i,this.refcount=0}(r,n,this.y,t,e,t,this.h)},e.prototype.resize=function(t){return this.free+=t-this.w,this.w=t,!0},t},"object"==typeof r&&void 0!==e?e.exports=i():n.ShelfPack=i()},{}],6:[function(t,e,r){function n(t,e,r,n,i,a){this.fontSize=t||24,this.buffer=void 0===e?3:e,this.cutoff=n||.25,this.fontFamily=i||"sans-serif",this.fontWeight=a||"normal",this.radius=r||8;var o=this.size=this.fontSize+2*this.buffer;this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=o,this.ctx=this.canvas.getContext("2d"),this.ctx.font=this.fontWeight+" "+this.fontSize+"px "+this.fontFamily,this.ctx.textBaseline="middle",this.ctx.fillStyle="black",this.gridOuter=new Float64Array(o*o),this.gridInner=new Float64Array(o*o),this.f=new Float64Array(o),this.d=new Float64Array(o),this.z=new Float64Array(o+1),this.v=new Int16Array(o),this.middle=Math.round(o/2*(navigator.userAgent.indexOf("Gecko/")>=0?1.2:1))}function i(t,e,r,n,i,o,s){for(var l=0;ln)return n;for(;ra?r=i:n=i,i=.5*(n-r)+r}return i},n.prototype.solve=function(t,e){return this.sampleCurveY(this.solveCurveX(t,e))}},{}],8:[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":9,"./lib/vectortilefeature.js":10,"./lib/vectortilelayer.js":11}],9:[function(t,e,r){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":11}],10:[function(t,e,r){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){for(var r=t.readVarint()+t.pos;t.pos>3}if(i--,1===n||2===n)a+=t.readSVarint(),s+=t.readSVarint(),1===n&&(e&&l.push(e),e=[]),e.push(new o(a,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,u=-1/0;t.pos>3}if(n--,1===r||2===r)i+=t.readSVarint(),a+=t.readSVarint(),is&&(s=i),au&&(u=a);else if(7!==r)throw new Error("unknown command "+r)}return[o,l,s,u]},n.prototype.toGeoJSON=function(t,e,r){function i(t){for(var e=0;e>3;e=1===n?t.readString():2===n?t.readFloat():3===n?t.readDouble():4===n?t.readVarint64():5===n?t.readVarint():6===n?t.readSVarint():7===n?t.readBoolean():null}return e}(r))}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":10}],12:[function(t,e,r){var n;n=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})}("object"==typeof r&&void 0!==e?r:n.WhooTS=n.WhooTS||{})},{}],13:[function(t,e,r){function n(t){return(t=Math.round(t))<0?0:t>255?255:t}function i(t){return n("%"===t[t.length-1]?parseFloat(t)/100*255:parseInt(t))}function a(t){return function(t){return t<0?0:t>1?1:t}("%"===t[t.length-1]?parseFloat(t)/100:parseFloat(t))}function o(t,e,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?t+(e-t)*r*6:2*r<1?e:3*r<2?t+(e-t)*(2/3-r)*6:t}var s={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=function(t){var e,r=t.replace(/ /g,"").toLowerCase();if(r in s)return s[r].slice();if("#"===r[0])return 4===r.length?(e=parseInt(r.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:7===r.length&&(e=parseInt(r.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var l=r.indexOf("("),u=r.indexOf(")");if(-1!==l&&u+1===r.length){var c=r.substr(0,l),h=r.substr(l+1,u-(l+1)).split(","),f=1;switch(c){case"rgba":if(4!==h.length)return null;f=a(h.pop());case"rgb":return 3!==h.length?null:[i(h[0]),i(h[1]),i(h[2]),f];case"hsla":if(4!==h.length)return null;f=a(h.pop());case"hsl":if(3!==h.length)return null;var p=(parseFloat(h[0])%360+360)%360/360,d=a(h[1]),g=a(h[2]),v=g<=.5?g*(d+1):g+d-g*d,m=2*g-v;return[n(255*o(m,v,p+1/3)),n(255*o(m,v,p)),n(255*o(m,v,p-1/3)),f];default:return null}}return null}}catch(t){}},{}],14:[function(t,e,r){function n(t,e,r){r=r||2;var n,s,l,u,c,p,g,v=e&&e.length,m=v?e[0]*r:t.length,y=i(t,0,m,r,!0),x=[];if(!y)return x;if(v&&(y=function(t,e,r,n){var o,s,l,u,c,p=[];for(o=0,s=e.length;o80*r){n=l=t[0],s=u=t[1];for(var b=r;bl&&(l=c),p>u&&(u=p);g=0!==(g=Math.max(l-n,u-s))?1/g:0}return o(y,x,r,n,s,g),x}function i(t,e,r,n,i){var a,o;if(i===k(t,e,r,n)>0)for(a=e;a=e;a-=n)o=w(a,t[a],t[a+1],o);return o&&y(o,o.next)&&(M(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||!y(n,n.next)&&0!==m(n.prev,n,n.next))n=n.next;else{if(M(n),(n=e=n.prev)===n.next)break;r=!0}}while(r||n!==e);return e}function o(t,e,r,n,i,h,f){if(t){!f&&h&&function(t,e,r,n){var i=t;do{null===i.z&&(i.z=p(i.x,i.y,e,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,r,n,i,a,o,s,l,u=1;do{for(r=t,t=null,a=null,o=0;r;){for(o++,n=r,s=0,e=0;e0||l>0&&n;)0!==s&&(0===l||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),a?a.nextZ=i:t=i,i.prevZ=a,a=i;r=n}a.nextZ=null,u*=2}while(o>1)}(i)}(t,n,i,h);for(var d,g,v=t;t.prev!==t.next;)if(d=t.prev,g=t.next,h?l(t,n,i,h):s(t))e.push(d.i/r),e.push(t.i/r),e.push(g.i/r),M(t),t=g.next,v=g.next;else if((t=g)===v){f?1===f?o(t=u(t,e,r),e,r,n,i,h,2):2===f&&c(t,e,r,n,i,h):o(a(t),e,r,n,i,h,1);break}}}function s(t){var e=t.prev,r=t,n=t.next;if(m(e,r,n)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(g(e.x,e.y,r.x,r.y,n.x,n.y,i.x,i.y)&&m(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function l(t,e,r,n){var i=t.prev,a=t,o=t.next;if(m(i,a,o)>=0)return!1;for(var s=i.xa.x?i.x>o.x?i.x:o.x:a.x>o.x?a.x:o.x,c=i.y>a.y?i.y>o.y?i.y:o.y:a.y>o.y?a.y:o.y,h=p(s,l,e,r,n),f=p(u,c,e,r,n),d=t.prevZ,v=t.nextZ;d&&d.z>=h&&v&&v.z<=f;){if(d!==t.prev&&d!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&m(d.prev,d,d.next)>=0)return!1;if(d=d.prevZ,v!==t.prev&&v!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,v.x,v.y)&&m(v.prev,v,v.next)>=0)return!1;v=v.nextZ}for(;d&&d.z>=h;){if(d!==t.prev&&d!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,d.x,d.y)&&m(d.prev,d,d.next)>=0)return!1;d=d.prevZ}for(;v&&v.z<=f;){if(v!==t.prev&&v!==t.next&&g(i.x,i.y,a.x,a.y,o.x,o.y,v.x,v.y)&&m(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function u(t,e,r){var n=t;do{var i=n.prev,a=n.next.next;!y(i,a)&&x(i,n,n.next,a)&&b(i,a)&&b(a,i)&&(e.push(i.i/r),e.push(n.i/r),e.push(a.i/r),M(n),M(n.next),n=t=a),n=n.next}while(n!==t);return n}function c(t,e,r,n,i,s){var l=t;do{for(var u=l.next.next;u!==l.prev;){if(l.i!==u.i&&v(l,u)){var c=_(l,u);return l=a(l,l.next),c=a(c,c.next),o(l,e,r,n,i,s),void o(c,e,r,n,i,s)}u=u.next}l=l.next}while(l!==t)}function h(t,e){return t.x-e.x}function f(t,e){if(e=function(t,e){var r,n=e,i=t.x,a=t.y,o=-1/0;do{if(a<=n.y&&a>=n.next.y&&n.next.y!==n.y){var s=n.x+(a-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=i&&s>o){if(o=s,s===i){if(a===n.y)return n;if(a===n.next.y)return n.next}r=n.x=n.x&&n.x>=c&&i!==n.x&&g(ar.x)&&b(n,t)&&(r=n,f=l),n=n.next;return r}(t,e)){var r=_(e,t);a(r,r.next)}}function p(t,e,r,n,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-r)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-n)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function d(t){var e=t,r=t;do{e.x=0&&(t-o)*(n-s)-(r-o)*(e-s)>=0&&(r-o)*(a-s)-(i-o)*(n-s)>=0}function v(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&x(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&b(t,e)&&b(e,t)&&function(t,e){var r=t,n=!1,i=(t.x+e.x)/2,a=(t.y+e.y)/2;do{r.y>a!=r.next.y>a&&r.next.y!==r.y&&i<(r.next.x-r.x)*(a-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==t);return n}(t,e)}function m(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function y(t,e){return t.x===e.x&&t.y===e.y}function x(t,e,r,n){return!!(y(t,e)&&y(r,n)||y(t,n)&&y(r,e))||m(t,e,r)>0!=m(t,e,n)>0&&m(r,n,t)>0!=m(r,n,e)>0}function b(t,e){return m(t.prev,t,t.next)<0?m(t,e,t.next)>=0&&m(t,t.prev,e)>=0:m(t,e,t.prev)<0||m(t,t.next,e)<0}function _(t,e){var r=new A(t.i,t.x,t.y),n=new A(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 w(t,e,r,n){var i=new A(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 M(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function A(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 k(t,e,r,n){for(var i=0,a=e,o=r-n;a0&&(n+=t[i-1].length,r.holes.push(n))}return r}},{}],15:[function(t,e,r){function n(t,e){return function(r){return t(r,e)}}function i(t,e){e=!!e,t[0]=a(t[0],e);for(var r=1;r=0}(t)===e?t:t.reverse()}var o=t("@mapbox/geojson-area");e.exports=function t(e,r){switch(e&&e.type||null){case"FeatureCollection":return e.features=e.features.map(n(t,r)),e;case"Feature":return e.geometry=t(e.geometry,r),e;case"Polygon":case"MultiPolygon":return function(t,e){return"Polygon"===t.type?t.coordinates=i(t.coordinates,e):"MultiPolygon"===t.type&&(t.coordinates=t.coordinates.map(n(i,e))),t}(e,r);default:return e}}},{"@mapbox/geojson-area":1}],16:[function(t,e,r){function n(t,e,r,n,i){for(var a=0;a=r&&o<=n&&(e.push(t[a]),e.push(t[a+1]),e.push(t[a+2]))}}function i(t,e,r,n,i,a){for(var u=[],c=0===i?s:l,h=0;h=r&&c(u,f,p,g,v,r):m>n?y<=n&&c(u,f,p,g,v,n):o(u,f,p,d),y=r&&(c(u,f,p,g,v,r),x=!0),y>n&&m<=n&&(c(u,f,p,g,v,n),x=!0),!a&&x&&(u.size=t.size,e.push(u),u=[])}var b=t.length-3;f=t[b],p=t[b+1],d=t[b+2],(m=0===i?f:p)>=r&&m<=n&&o(u,f,p,d),b=u.length-3,a&&b>=3&&(u[b]!==u[0]||u[b+1]!==u[1])&&o(u,u[0],u[1],u[2]),u.length&&(u.size=t.size,e.push(u))}function a(t,e,r,n,a,o){for(var s=0;s=(r/=e)&&c<=o)return t;if(l>o||c=r&&m<=o)h.push(p);else if(!(v>o||m0&&(o+=n?(i*f-h*a)/2:Math.sqrt(Math.pow(h-i,2)+Math.pow(f-a,2))),i=h,a=f}var p=e.length-3;e[2]=1,u(e,0,p,r),e[p+2]=1,e.size=Math.abs(o)}function o(t,e,r,n){for(var i=0;i1?1:r}e.exports=function(t,e){var r=[];if("FeatureCollection"===t.type)for(var i=0;i24)throw new Error("maxZoom should be in the 0-24 range");var n=1<1&&console.time("creation"),g=this.tiles[d]=u(t,p,r,n,v,e===h.maxZoom),this.tileCoords.push({z:e,x:r,y:n}),f)){f>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",e,r,n,g.numFeatures,g.numPoints,g.numSimplified),console.timeEnd("creation"));var m="z"+e;this.stats[m]=(this.stats[m]||0)+1,this.total++}if(g.source=t,a){if(e===h.maxZoom||e===a)continue;var y=1<1&&console.time("clipping");var x,b,_,w,M,A,k=.5*h.buffer/h.extent,T=.5-k,S=.5+k,E=1+k;x=b=_=w=null,M=s(t,p,r-k,r+S,0,g.minX,g.maxX),A=s(t,p,r+T,r+E,0,g.minX,g.maxX),t=null,M&&(x=s(M,p,n-k,n+S,1,g.minY,g.maxY),b=s(M,p,n+T,n+E,1,g.minY,g.maxY),M=null),A&&(_=s(A,p,n-k,n+S,1,g.minY,g.maxY),w=s(A,p,n+T,n+E,1,g.minY,g.maxY),A=null),f>1&&console.timeEnd("clipping"),c.push(x||[],e+1,2*r,2*n),c.push(b||[],e+1,2*r,2*n+1),c.push(_||[],e+1,2*r+1,2*n),c.push(w||[],e+1,2*r+1,2*n+1)}}},n.prototype.getTile=function(t,e,r){var n=this.options,a=n.extent,s=n.debug;if(t<0||t>24)return null;var l=1<1&&console.log("drilling down to z%d-%d-%d",t,e,r);for(var c,h=t,f=e,p=r;!c&&h>0;)h--,f=Math.floor(f/2),p=Math.floor(p/2),c=this.tiles[i(h,f,p)];return c&&c.source?(s>1&&console.log("found parent tile z%d-%d-%d",h,f,p),s>1&&console.time("drilling down"),this.splitTile(c.source,h,f,p,t,e,r),s>1&&console.timeEnd("drilling down"),this.tiles[u]?o.tile(this.tiles[u],a):null):null}},{"./clip":16,"./convert":17,"./tile":21,"./transform":22,"./wrap":23}],20:[function(t,e,r){function n(t,e,r,n,i,a){var o=i-r,s=a-n;if(0!==o||0!==s){var l=((t-r)*o+(e-n)*s)/(o*o+s*s);l>1?(r=i,n=a):l>0&&(r+=o*l,n+=s*l)}return(o=t-r)*o+(s=e-n)*s}e.exports=function t(e,r,i,a){for(var o,s=a,l=e[r],u=e[r+1],c=e[i],h=e[i+1],f=r+3;fs&&(o=f,s=p)}s>a&&(o-r>3&&t(e,r,o,a),e[o+2]=s,i-o>3&&t(e,o,i,a))}},{}],21:[function(t,e,r){function n(t,e,r,n){var a=e.geometry,o=e.type,s=[];if("Point"===o||"MultiPoint"===o)for(var l=0;ls)&&(r.numSimplified++,l.push(e[u]),l.push(e[u+1])),r.numPoints++;a&&function(t,e){for(var r=0,n=0,i=t.length,a=i-2;n0===e)for(n=0,i=t.length;ns.maxX&&(s.maxX=h),f>s.maxY&&(s.maxY=f)}return s}},{}],22:[function(t,e,r){function n(t,e,r,n,i,a){return[Math.round(r*(t*n-i)),Math.round(r*(e*n-a))]}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=u[f+0]&&n>=u[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),u=this._convertToCellCoord(r),c=this._convertToCellCoord(n),h=s;h<=u;h++)for(var f=l;f<=c;f++){var p=this.d*f+h;if(i.call(this,t,e,r,n,p,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>1,c=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,a=p&(1<<-c)-1,p>>=-c,c+=s;c>0;a=256*a+t[e+h],h+=f,c-=8);for(o=a&(1<<-c)-1,a>>=-c,c+=n;c>0;o=256*o+t[e+h],h+=f,c-=8);if(0===a)a=1-u;else{if(a===l)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,n),a-=u}return(p?-1:1)*o*Math.pow(2,a-n)},r.write=function(t,e,r,n,i,a){var o,s,l,u=8*a-i-1,c=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:a-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,o=c):(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>=c?(s=0,o=c):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+p]=255&s,p+=d,s/=256,i-=8);for(o=o<0;t[r+p]=255&o,p+=d,o/=256,u-=8);t[r+p-d]|=128*g}},{}],26:[function(t,e,r){function n(t,e,r,n,s){e=e||i,r=r||a,s=s||Array,this.nodeSize=n||64,this.points=t,this.ids=new s(t.length),this.coords=new s(2*t.length);for(var l=0;l=r&&s<=i&&l>=n&&l<=a&&c.push(t[d]);else{var g=Math.floor((p+f)/2);s=e[2*g],l=e[2*g+1],s>=r&&s<=i&&l>=n&&l<=a&&c.push(t[g]);var v=(h+1)%2;(0===h?r<=s:n<=l)&&(u.push(p),u.push(g-1),u.push(v)),(0===h?i>=s:a>=l)&&(u.push(g+1),u.push(f),u.push(v))}}return c}},{}],28:[function(t,e,r){function n(t,e,r,n){i(t,r,n),i(e,2*r,2*n),i(e,2*r+1,2*n+1)}function i(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}e.exports=function t(e,r,i,a,o,s){if(!(o-a<=i)){var l=Math.floor((a+o)/2);(function t(e,r,i,a,o,s){for(;o>a;){if(o-a>600){var l=o-a+1,u=i-a+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1);t(e,r,i,Math.max(a,Math.floor(i-u*h/l+f)),Math.min(o,Math.floor(i+(l-u)*h/l+f)),s)}var p=r[2*i+s],d=a,g=o;for(n(e,r,a,i),r[2*o+s]>p&&n(e,r,a,o);dp;)g--}r[2*a+s]===p?n(e,r,a,g):n(e,r,++g,o),g<=i&&(a=g+1),i<=g&&(o=g-1)}})(e,r,l,a,o,s%2),t(e,r,i,a,l-1,s+1),t(e,r,i,l+1,o,s+1)}}},{}],29:[function(t,e,r){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=[],u=a*a;s.length;){var c=s.pop(),h=s.pop(),f=s.pop();if(h-f<=o)for(var p=f;p<=h;p++)n(e[2*p],e[2*p+1],r,i)<=u&&l.push(t[p]);else{var d=Math.floor((f+h)/2),g=e[2*d],v=e[2*d+1];n(g,v,r,i)<=u&&l.push(t[d]);var m=(c+1)%2;(0===c?r-a<=g:i-a<=v)&&(s.push(f),s.push(d-1),s.push(m)),(0===c?r+a>=g:i+a>=v)&&(s.push(d+1),s.push(h),s.push(m))}}return l}},{}],30:[function(t,e,r){function n(t){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(t)?t:new Uint8Array(t||0),this.pos=0,this.type=0,this.length=this.buf.length}function i(t){return t.type===n.Bytes?t.readVarint()+t.pos:t.pos+1}function a(t,e,r){return r?4294967296*e+(t>>>0):4294967296*(e>>>0)+(t>>>0)}function o(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]}function s(t,e){for(var r=0;r>>8,t[r+2]=e>>>16,t[r+3]=e>>>24}function y(t,e){return(t[e]|t[e+1]<<8|t[e+2]<<16)+(t[e+3]<<24)}e.exports=n;var x=t("ieee754");n.Varint=0,n.Fixed64=1,n.Bytes=2,n.Fixed32=5;n.prototype={destroy:function(){this.buf=null},readFields:function(t,e,r){for(r=r||this.length;this.pos>3,a=this.pos;this.type=7&n,t(i,e,this),this.pos===a&&this.skip(n)}return e},readMessage:function(t,e){return this.readFields(t,e,this.readVarint()+this.pos)},readFixed32:function(){var t=v(this.buf,this.pos);return this.pos+=4,t},readSFixed32:function(){var t=y(this.buf,this.pos);return this.pos+=4,t},readFixed64:function(){var t=v(this.buf,this.pos)+4294967296*v(this.buf,this.pos+4);return this.pos+=8,t},readSFixed64:function(){var t=v(this.buf,this.pos)+4294967296*y(this.buf,this.pos+4);return this.pos+=8,t},readFloat:function(){var t=x.read(this.buf,this.pos,!0,23,4);return this.pos+=4,t},readDouble:function(){var t=x.read(this.buf,this.pos,!0,52,8);return this.pos+=8,t},readVarint:function(t){var e,r,n=this.buf;return e=127&(r=n[this.pos++]),r<128?e:(e|=(127&(r=n[this.pos++]))<<7,r<128?e:(e|=(127&(r=n[this.pos++]))<<14,r<128?e:(e|=(127&(r=n[this.pos++]))<<21,r<128?e:function(t,e,r){var n,i,o=r.buf;if(n=(112&(i=o[r.pos++]))>>4,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<3,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<10,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<17,i<128)return a(t,n,e);if(n|=(127&(i=o[r.pos++]))<<24,i<128)return a(t,n,e);if(n|=(1&(i=o[r.pos++]))<<31,i<128)return a(t,n,e);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(r=n[this.pos]))<<28,t,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var t=this.readVarint();return t%2==1?(t+1)/-2:t/2},readBoolean:function(){return Boolean(this.readVarint())},readString:function(){var t=this.readVarint()+this.pos,e=function(t,e,r){for(var n="",i=e;i239?4:l>223?3:l>191?2:1;if(i+c>r)break;1===c?l<128&&(u=l):2===c?128==(192&(a=t[i+1]))&&(u=(31&l)<<6|63&a)<=127&&(u=null):3===c?(a=t[i+1],o=t[i+2],128==(192&a)&&128==(192&o)&&((u=(15&l)<<12|(63&a)<<6|63&o)<=2047||u>=55296&&u<=57343)&&(u=null)):4===c&&(a=t[i+1],o=t[i+2],s=t[i+3],128==(192&a)&&128==(192&o)&&128==(192&s)&&((u=(15&l)<<18|(63&a)<<12|(63&o)<<6|63&s)<=65535||u>=1114112)&&(u=null)),null===u?(u=65533,c=1):u>65535&&(u-=65536,n+=String.fromCharCode(u>>>10&1023|55296),u=56320|1023&u),n+=String.fromCharCode(u),i+=c}return n}(this.buf,this.pos,t);return this.pos=t,e},readBytes:function(){var t=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,t);return this.pos=t,e},readPackedVarint:function(t,e){var r=i(this);for(t=t||[];this.pos127;);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;e268435455||t<0?function(t,e){var r,n;if(t>=0?(r=t%4294967296|0,n=t/4294967296|0):(n=~(-t/4294967296),4294967295^(r=~(-t%4294967296))?r=r+1|0:(r=0,n=n+1|0)),t>=0x10000000000000000||t<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");e.realloc(10),function(t,e,r){r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos++]=127&t|128,t>>>=7,r.buf[r.pos]=127&t}(r,0,e),function(t,e){var r=(7&t)<<4;e.buf[e.pos++]|=r|((t>>>=3)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t|((t>>>=7)?128:0),t&&(e.buf[e.pos++]=127&t)))))}(n,e)}(t,this):(this.realloc(4),this.buf[this.pos++]=127&t|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=127&(t>>>=7)|(t>127?128:0),t<=127||(this.buf[this.pos++]=t>>>7&127))))},writeSVarint:function(t){this.writeVarint(t<0?2*-t-1:2*t)},writeBoolean:function(t){this.writeVarint(Boolean(t))},writeString:function(t){t=String(t),this.realloc(4*t.length),this.pos++;var e=this.pos;this.pos=function(t,e,r){for(var n,i,a=0;a55295&&n<57344){if(!i){n>56319||a+1===e.length?(t[r++]=239,t[r++]=191,t[r++]=189):i=n;continue}if(n<56320){t[r++]=239,t[r++]=191,t[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(t[r++]=239,t[r++]=191,t[r++]=189,i=null);n<128?t[r++]=n:(n<2048?t[r++]=n>>6|192:(n<65536?t[r++]=n>>12|224:(t[r++]=n>>18|240,t[r++]=n>>12&63|128),t[r++]=n>>6&63|128),t[r++]=63&n|128)}return r}(this.buf,t,this.pos);var r=this.pos-e;r>=128&&o(e,r,this),this.pos=e-1,this.writeVarint(r),this.pos+=r},writeFloat:function(t){this.realloc(4),x.write(this.buf,t,this.pos,!0,23,4),this.pos+=4},writeDouble:function(t){this.realloc(8),x.write(this.buf,t,this.pos,!0,52,8),this.pos+=8},writeBytes:function(t){var e=t.length;this.writeVarint(e),this.realloc(e);for(var r=0;r=128&&o(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,s,e)},writePackedSVarint:function(t,e){this.writeMessage(t,l,e)},writePackedBoolean:function(t,e){this.writeMessage(t,h,e)},writePackedFloat:function(t,e){this.writeMessage(t,u,e)},writePackedDouble:function(t,e){this.writeMessage(t,c,e)},writePackedFixed32:function(t,e){this.writeMessage(t,f,e)},writePackedSFixed32:function(t,e){this.writeMessage(t,p,e)},writePackedFixed64:function(t,e){this.writeMessage(t,d,e)},writePackedSFixed64:function(t,e){this.writeMessage(t,g,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))}}},{ieee754:25}],31:[function(t,e,r){function n(t,e,r){var n=t[e];t[e]=t[r],t[r]=n}function i(t,e){return te?1:0}e.exports=function t(e,r,a,o,s){for(a=a||0,o=o||e.length-1,s=s||i;o>a;){if(o-a>600){var l=o-a+1,u=r-a+1,c=Math.log(l),h=.5*Math.exp(2*c/3),f=.5*Math.sqrt(c*h*(l-h)/l)*(u-l/2<0?-1:1);t(e,r,Math.max(a,Math.floor(r-u*h/l+f)),Math.min(o,Math.floor(r+(l-u)*h/l+f)),s)}var p=e[r],d=a,g=o;for(n(e,a,r),s(e[o],p)>0&&n(e,a,o);d0;)g--}0===s(e[a],p)?n(e,a,g):n(e,++g,o),g<=r&&(a=g+1),r<=g&&(o=g-1)}}},{}],32:[function(t,e,r){function n(t){this.options=c(Object.create(this.options),t),this.trees=new Array(this.options.maxZoom+1)}function i(t,e,r,n,i){return{x:t,y:e,zoom:1/0,id:n,properties:i,parentId:-1,numPoints:r}}function a(t,e){var r=t.geometry.coordinates;return{x:l(r[0]),y:u(r[1]),zoom:1/0,id:e,parentId:-1}}function o(t){return{type:"Feature",properties:s(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 s(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 l(t){return t/360+.5}function u(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 h(t){return t.x}function f(t){return t.y}var p=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(a);e&&console.timeEnd(r);for(var i=this.options.maxZoom;i>=this.options.minZoom;i--){var o=+Date.now();this.trees[i+1]=p(n,h,f,this.options.nodeSize,Float32Array),n=this._cluster(n,i),e&&console.log("z%d: %d clusters in %dms",i,n.length,+Date.now()-o)}return this.trees[this.options.minZoom]=p(n,h,f,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(l(t[0]),u(t[3]),l(t[2]),u(t[1])),i=[],a=0;a0)for(var r=this.length>>1;r>=0;r--)this._down(r)}function i(t,e){return te?1:0}e.exports=n,n.prototype={push:function(t){this.data.push(t),this.length++,this._up(this.length-1)},pop:function(){if(0!==this.length){var t=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),t}},peek:function(){return this.data[0]},_up:function(t){for(var e=this.data,r=this.compare,n=e[t];t>0;){var i=t-1>>1,a=e[i];if(r(n,a)>=0)break;e[t]=a,t=i}e[t]=n},_down:function(t){for(var e=this.data,r=this.compare,n=this.length,i=n>>1,a=e[t];t=0)break;e[t]=l,t=o}e[t]=a}}},{}],34:[function(t,e,r){function n(t){var e=new h;return function(t,e){for(var r in t.layers)e.writeMessage(3,i,t.layers[r])}(t,e),e.finish()}function i(t,e){e.writeVarintField(15,t.version||1),e.writeStringField(1,t.name||""),e.writeVarintField(5,t.extent||4096);var r,n={keys:[],values:[],keycache:{},valuecache:{}};for(r=0;r>31}function u(t,e){for(var r=t.loadGeometry(),n=t.type,i=0,a=0,o=r.length,u=0;u=c||h<0||h>=c)){var f=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),p=f.vertexLength;n(r.layoutVertexArray,u,h,-1,-1),n(r.layoutVertexArray,u,h,1,-1),n(r.layoutVertexArray,u,h,1,1),n(r.layoutVertexArray,u,h,-1,1),r.indexArray.emplaceBack(p,p+1,p+2),r.indexArray.emplaceBack(p,p+3,p+2),f.vertexLength+=4,f.primitiveLength+=2}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t)},h("CircleBucket",f,{omit:["layers"]}),e.exports=f},{"../../util/web_worker_transfer":278,"../array_types":39,"../extent":53,"../index_array_type":55,"../load_geometry":56,"../program_configuration":58,"../segment":60,"./circle_attributes":41}],43:[function(t,e,r){arguments[4][41][0].apply(r,arguments)},{"../../util/struct_array":271,dup:41}],44:[function(t,e,r){var n=t("../array_types").FillLayoutArray,i=t("./fill_attributes").members,a=t("../segment").SegmentVector,o=t("../program_configuration").ProgramConfigurationSet,s=t("../index_array_type"),l=s.LineIndexArray,u=s.TriangleIndexArray,c=t("../load_geometry"),h=t("earcut"),f=t("../../util/classify_rings"),p=t("../../util/web_worker_transfer").register,d=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new n,this.indexArray=new u,this.indexArray2=new l,this.programConfigurations=new o(i,t.layers,t.zoom),this.segments=new a,this.segments2=new a};d.prototype.populate=function(t,e){for(var r=this,n=0,i=t;nd)||t.y===e.y&&(t.y<0||t.y>d)}function a(t){return t.every(function(t){return t.x<0})||t.every(function(t){return t.x>d})||t.every(function(t){return t.y<0})||t.every(function(t){return t.y>d})}var o=t("../array_types").FillExtrusionLayoutArray,s=t("./fill_extrusion_attributes").members,l=t("../segment"),u=l.SegmentVector,c=l.MAX_VERTEX_ARRAY_LENGTH,h=t("../program_configuration").ProgramConfigurationSet,f=t("../index_array_type").TriangleIndexArray,p=t("../load_geometry"),d=t("../extent"),g=t("earcut"),v=t("../../util/classify_rings"),m=t("../../util/web_worker_transfer").register,y=Math.pow(2,13),x=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new o,this.indexArray=new f,this.programConfigurations=new h(s,t.layers,t.zoom),this.segments=new u};x.prototype.populate=function(t,e){for(var r=this,n=0,i=t;n=1){var w=y[b-1];if(!i(_,w)){p.vertexLength+4>c&&(p=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray));var M=_.sub(w)._perp()._unit(),A=w.dist(_);x+A>32768&&(x=0),n(r.layoutVertexArray,_.x,_.y,M.x,M.y,0,0,x),n(r.layoutVertexArray,_.x,_.y,M.x,M.y,0,1,x),x+=A,n(r.layoutVertexArray,w.x,w.y,M.x,M.y,0,0,x),n(r.layoutVertexArray,w.x,w.y,M.x,M.y,0,1,x);var k=p.vertexLength;r.indexArray.emplaceBack(k,k+1,k+2),r.indexArray.emplaceBack(k+1,k+2,k+3),p.vertexLength+=4,p.primitiveLength+=2}}}}p.vertexLength+u>c&&(p=r.segments.prepareSegment(u,r.layoutVertexArray,r.indexArray));for(var T=[],S=[],E=p.vertexLength,C=0,L=l;C>6)}var i=t("../array_types").LineLayoutArray,a=t("./line_attributes").members,o=t("../segment").SegmentVector,s=t("../program_configuration").ProgramConfigurationSet,l=t("../index_array_type").TriangleIndexArray,u=t("../load_geometry"),c=t("../extent"),h=t("@mapbox/vector-tile").VectorTileFeature.types,f=t("../../util/web_worker_transfer").register,p=63,d=Math.cos(Math.PI/180*37.5),g=.5,v=Math.pow(2,14)/g,m=function(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.layoutVertexArray=new i,this.indexArray=new l,this.programConfigurations=new s(a,t.layers,t.zoom),this.segments=new o};m.prototype.populate=function(t,e){for(var r=this,n=0,i=t;n=2&&t[l-1].equals(t[l-2]);)l--;for(var u=0;uu){var z=v.dist(w);if(z>2*f){var P=v.sub(v.sub(w)._mult(f/z)._round());o.distance+=P.dist(w),o.addCurrentVertex(P,o.distance,A.mult(1),0,0,!1,g),w=P}}var I=w&&M,D=I?r:M?x:b;if(I&&"round"===D&&(Ci&&(D="bevel"),"bevel"===D&&(C>2&&(D="flipbevel"),C100)S=k.clone().mult(-1);else{var O=A.x*k.y-A.y*k.x>0?-1:1,R=C*A.add(k).mag()/A.sub(k).mag();S._perp()._mult(R*O)}o.addCurrentVertex(v,o.distance,S,0,0,!1,g),o.addCurrentVertex(v,o.distance,S.mult(-1),0,0,!1,g)}else if("bevel"===D||"fakeround"===D){var F=A.x*k.y-A.y*k.x>0,B=-Math.sqrt(C*C-1);if(F?(y=0,m=B):(m=0,y=B),_||o.addCurrentVertex(v,o.distance,A,m,y,!1,g),"fakeround"===D){for(var N=Math.floor(8*(.5-(E-.5))),j=void 0,V=0;V=0;U--)j=A.mult((U+1)/(N+1))._add(k)._unit(),o.addPieSliceVertex(v,o.distance,j,F,g)}M&&o.addCurrentVertex(v,o.distance,k,-m,-y,!1,g)}else"butt"===D?(_||o.addCurrentVertex(v,o.distance,A,0,0,!1,g),M&&o.addCurrentVertex(v,o.distance,k,0,0,!1,g)):"square"===D?(_||(o.addCurrentVertex(v,o.distance,A,1,1,!1,g),o.e1=o.e2=-1),M&&o.addCurrentVertex(v,o.distance,k,-1,-1,!1,g)):"round"===D&&(_||(o.addCurrentVertex(v,o.distance,A,0,0,!1,g),o.addCurrentVertex(v,o.distance,A,1,1,!0,g),o.e1=o.e2=-1),M&&(o.addCurrentVertex(v,o.distance,k,-1,-1,!0,g),o.addCurrentVertex(v,o.distance,k,0,0,!1,g)));if(L&&T2*f){var H=v.add(M.sub(v)._mult(f/q)._round());o.distance+=H.dist(v),o.addCurrentVertex(H,o.distance,k.mult(1),0,0,!1,g),v=H}}_=!1}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e)}},m.prototype.addCurrentVertex=function(t,e,r,i,a,o,s){var l,u=this.layoutVertexArray,c=this.indexArray;l=r.clone(),i&&l._sub(r.perp()._mult(i)),n(u,t,l,o,!1,i,e),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,l=r.mult(-1),a&&l._sub(r.perp()._mult(a)),n(u,t,l,o,!0,-a,e),this.e3=s.vertexLength++,this.e1>=0&&this.e2>=0&&(c.emplaceBack(this.e1,this.e2,this.e3),s.primitiveLength++),this.e1=this.e2,this.e2=this.e3,e>v/2&&(this.distance=0,this.addCurrentVertex(t,this.distance,r,i,a,o,s))},m.prototype.addPieSliceVertex=function(t,e,r,i,a){r=r.mult(i?-1:1);var o=this.layoutVertexArray,s=this.indexArray;n(o,t,r,!1,i,0,e),this.e3=a.vertexLength++,this.e1>=0&&this.e2>=0&&(s.emplaceBack(this.e1,this.e2,this.e3),a.primitiveLength++),i?this.e2=this.e3:this.e1=this.e3},f("LineBucket",m,{omit:["layers"]}),e.exports=m},{"../../util/web_worker_transfer":278,"../array_types":39,"../extent":53,"../index_array_type":55,"../load_geometry":56,"../program_configuration":58,"../segment":60,"./line_attributes":48,"@mapbox/vector-tile":8}],50:[function(t,e,r){var n=t("../../util/struct_array").createLayout,i={symbolLayoutAttributes:n([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"}]),dynamicLayoutAttributes:n([{name:"a_projected_pos",components:3,type:"Float32"}],4),placementOpacityAttributes:n([{name:"a_fade_opacity",components:1,type:"Uint32"}],4),collisionVertexAttributes:n([{name:"a_placed",components:2,type:"Uint8"}],4),collisionBox:n([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"},{type:"Int16",name:"radius"},{type:"Int16",name:"signedDistanceFromAnchor"}]),collisionBoxLayout:n([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),collisionCircleLayout:n([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),placement:n([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"hidden"}]),glyphOffset:n([{type:"Float32",name:"offsetX"}]),lineVertex:n([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}])};e.exports=i},{"../../util/struct_array":271}],51:[function(t,e,r){function n(t,e,r,n,i,a,o,s){t.emplaceBack(e,r,Math.round(64*n),Math.round(64*i),a,o,s?s[0]:0,s?s[1]:0)}function i(t,e,r){t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r),t.emplaceBack(e.x,e.y,r)}var a=t("./symbol_attributes"),o=a.symbolLayoutAttributes,s=a.collisionVertexAttributes,l=a.collisionBoxLayout,u=a.collisionCircleLayout,c=a.dynamicLayoutAttributes,h=t("../array_types"),f=h.SymbolLayoutArray,p=h.SymbolDynamicLayoutArray,d=h.SymbolOpacityArray,g=h.CollisionBoxLayoutArray,v=h.CollisionCircleLayoutArray,m=h.CollisionVertexArray,y=h.PlacedSymbolArray,x=h.GlyphOffsetArray,b=h.SymbolLineVertexArray,_=t("@mapbox/point-geometry"),w=t("../segment").SegmentVector,M=t("../program_configuration").ProgramConfigurationSet,A=t("../index_array_type"),k=A.TriangleIndexArray,T=A.LineIndexArray,S=t("../../symbol/transform_text"),E=t("../../symbol/mergelines"),C=t("../../util/script_detection"),L=t("../load_geometry"),z=t("@mapbox/vector-tile").VectorTileFeature.types,P=t("../../util/verticalize_punctuation"),I=(t("../../symbol/anchor"),t("../../symbol/symbol_size").getSizeData),D=t("../../util/web_worker_transfer").register,O=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}],R=function(t){this.layoutVertexArray=new f,this.indexArray=new k,this.programConfigurations=t,this.segments=new w,this.dynamicLayoutVertexArray=new p,this.opacityVertexArray=new d,this.placedSymbolArray=new y};R.prototype.upload=function(t,e){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,o.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.programConfigurations.upload(t),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,c.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,O,!0),this.opacityVertexBuffer.itemSize=1},R.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())},D("SymbolBuffers",R);var F=function(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new w,this.collisionVertexArray=new m};F.prototype.upload=function(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,s.members,!0)},F.prototype.destroy=function(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())},D("CollisionBuffers",F);var B=function(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(function(t){return t.id}),this.index=t.index,this.pixelRatio=t.pixelRatio;var e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=I(this.zoom,e["text-size"]),this.iconSizeData=I(this.zoom,e["icon-size"]);var r=this.layers[0].layout;this.sortFeaturesByY=r.get("text-allow-overlap")||r.get("icon-allow-overlap")||r.get("text-ignore-placement")||r.get("icon-ignore-placement")};B.prototype.createArrays=function(){this.text=new R(new M(o.members,this.layers,this.zoom,function(t){return/^text/.test(t)})),this.icon=new R(new M(o.members,this.layers,this.zoom,function(t){return/^icon/.test(t)})),this.collisionBox=new F(g,l.members,T),this.collisionCircle=new F(v,u.members,k),this.glyphOffsetArray=new x,this.lineVertexArray=new b},B.prototype.populate=function(t,e){var r=this.layers[0],n=r.layout,i=n.get("text-font"),a=n.get("text-field"),o=n.get("icon-image"),s=("constant"!==a.value.kind||a.value.value.length>0)&&("constant"!==i.value.kind||i.value.value.length>0),l="constant"!==o.value.kind||o.value.value&&o.value.value.length>0;if(this.features=[],s||l){for(var u=e.iconDependencies,c=e.glyphDependencies,h={zoom:this.zoom},f=0,p=t;f=0;s--)a[s]={x:e[s].x,y:e[s].y,tileUnitDistanceFromAnchor:i},s>0&&(i+=e[s-1].dist(e[s]));for(var l=0;l0;t.addCollisionDebugVertices(l,u,c,h,f?t.collisionCircle:t.collisionBox,s.anchorPoint,n,f)}}}},B.prototype.deserializeCollisionBoxes=function(t,e,r,n,i){for(var a={},o=e;o0},B.prototype.hasIconData=function(){return this.icon.segments.get().length>0},B.prototype.hasCollisionBoxData=function(){return this.collisionBox.segments.get().length>0},B.prototype.hasCollisionCircleData=function(){return this.collisionCircle.segments.get().length>0},B.prototype.sortFeatures=function(t){var e=this;if(this.sortFeaturesByY&&this.sortedAngle!==t&&(this.sortedAngle=t,!(this.text.segments.get().length>1||this.icon.segments.get().length>1))){for(var r=[],n=0;n=this.dim+this.border||e<-this.border||e>=this.dim+this.border)throw new RangeError("out of range source coordinates for DEM data");return(e+this.border)*this.stride+(t+this.border)},a("Level",o);var s=function(t,e,r){this.uid=t,this.scale=e||1,this.level=r||new o(256,512),this.loaded=!!r};s.prototype.loadFromImage=function(t){if(t.height!==t.width)throw new RangeError("DEM tiles must be square");for(var e=this.level=new o(t.width,t.width/2),r=t.data,n=0;no.max||u.yo.max)&&i.warnOnce("Geometry exceeds allowed extent, reduce your vector tile buffer size")}return r}},{"../util/util":275,"./extent":53}],57:[function(t,e,r){var n=t("../util/struct_array").createLayout;e.exports=n([{name:"a_pos",type:"Int16",components:2}])},{"../util/struct_array":271}],58:[function(t,e,r){function n(t){return[a(255*t.r,255*t.g),a(255*t.b,255*t.a)]}function i(t,e){return{"text-opacity":"opacity","icon-opacity":"opacity","text-color":"fill_color","icon-color":"fill_color","text-halo-color":"halo_color","icon-halo-color":"halo_color","text-halo-blur":"halo_blur","icon-halo-blur":"halo_blur","text-halo-width":"halo_width","icon-halo-width":"halo_width","line-gap-width":"gapwidth"}[t]||t.replace(e+"-","").replace(/-/g,"_")}var a=t("../shaders/encode_attribute").packUint8ToFloat,o=(t("../style-spec/util/color"),t("../util/web_worker_transfer").register),s=t("../style/properties").PossiblyEvaluatedPropertyValue,l=t("./array_types"),u=l.StructArrayLayout1f4,c=l.StructArrayLayout2f8,h=l.StructArrayLayout4f16,f=function(t,e,r){this.value=t,this.name=e,this.type=r,this.statistics={max:-1/0}};f.prototype.defines=function(){return["#define HAS_UNIFORM_u_"+this.name]},f.prototype.populatePaintArray=function(){},f.prototype.upload=function(){},f.prototype.destroy=function(){},f.prototype.setUniforms=function(t,e,r,n){var i=n.constantOr(this.value),a=t.gl;"color"===this.type?a.uniform4f(e.uniforms["u_"+this.name],i.r,i.g,i.b,i.a):a.uniform1f(e.uniforms["u_"+this.name],i)};var p=function(t,e,r){this.expression=t,this.name=e,this.type=r,this.statistics={max:-1/0};var n="color"===r?c:u;this.paintVertexAttributes=[{name:"a_"+e,type:"Float32",components:"color"===r?2:1,offset:0}],this.paintVertexArray=new n};p.prototype.defines=function(){return[]},p.prototype.populatePaintArray=function(t,e){var r=this.paintVertexArray,i=r.length;r.reserve(t);var a=this.expression.evaluate({zoom:0},e);if("color"===this.type)for(var o=n(a),s=i;sa&&n("Max vertices per segment is "+a+": bucket requested "+t),(!o||o.vertexLength+t>e.exports.MAX_VERTEX_ARRAY_LENGTH)&&(o={vertexOffset:r.length,primitiveOffset:i.length,vertexLength:0,primitiveLength:0},this.segments.push(o)),o},o.prototype.get=function(){return this.segments},o.prototype.destroy=function(){for(var t=0,e=this.segments;t90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")};i.prototype.wrap=function(){return new i(n(this.lng,-180,180),this.lat)},i.prototype.toArray=function(){return[this.lng,this.lat]},i.prototype.toString=function(){return"LngLat("+this.lng+", "+this.lat+")"},i.prototype.toBounds=function(e){var r=360*e/40075017,n=r/Math.cos(Math.PI/180*this.lat);return new(t("./lng_lat_bounds"))(new i(this.lng-n,this.lat-r),new i(this.lng+n,this.lat+r))},i.convert=function(t){if(t instanceof i)return t;if(Array.isArray(t)&&(2===t.length||3===t.length))return new i(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&"object"==typeof t&&null!==t)return new i(Number(t.lng),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, or an array of [, ]")},e.exports=i},{"../util/util":275,"./lng_lat_bounds":63}],63:[function(t,e,r){var n=t("./lng_lat"),i=function(t,e){t&&(e?this.setSouthWest(t).setNorthEast(e):4===t.length?this.setSouthWest([t[0],t[1]]).setNorthEast([t[2],t[3]]):this.setSouthWest(t[0]).setNorthEast(t[1]))};i.prototype.setNorthEast=function(t){return this._ne=t instanceof n?new n(t.lng,t.lat):n.convert(t),this},i.prototype.setSouthWest=function(t){return this._sw=t instanceof n?new n(t.lng,t.lat):n.convert(t),this},i.prototype.extend=function(t){var e,r,a=this._sw,o=this._ne;if(t instanceof n)e=t,r=t;else{if(!(t instanceof i))return Array.isArray(t)?t.every(Array.isArray)?this.extend(i.convert(t)):this.extend(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 n(e.lng,e.lat),this._ne=new n(r.lng,r.lat)),this},i.prototype.getCenter=function(){return new n((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)},i.prototype.getSouthWest=function(){return this._sw},i.prototype.getNorthEast=function(){return this._ne},i.prototype.getNorthWest=function(){return new n(this.getWest(),this.getNorth())},i.prototype.getSouthEast=function(){return new n(this.getEast(),this.getSouth())},i.prototype.getWest=function(){return this._sw.lng},i.prototype.getSouth=function(){return this._sw.lat},i.prototype.getEast=function(){return this._ne.lng},i.prototype.getNorth=function(){return this._ne.lat},i.prototype.toArray=function(){return[this._sw.toArray(),this._ne.toArray()]},i.prototype.toString=function(){return"LngLatBounds("+this._sw.toString()+", "+this._ne.toString()+")"},i.prototype.isEmpty=function(){return!(this._sw&&this._ne)},i.convert=function(t){return!t||t instanceof i?t:new i(t)},e.exports=i},{"./lng_lat":62}],64:[function(t,e,r){var n=t("./lng_lat"),i=t("@mapbox/point-geometry"),a=t("./coordinate"),o=t("../util/util"),s=t("../style-spec/util/interpolate").number,l=t("../util/tile_cover"),u=t("../source/tile_id"),c=(u.CanonicalTileID,u.UnwrappedTileID),h=t("../data/extent"),f=t("@mapbox/gl-matrix"),p=f.vec4,d=f.mat4,g=f.mat2,v=function(t,e,r){this.tileSize=512,this._renderWorldCopies=void 0===r||r,this._minZoom=t||0,this._maxZoom=e||22,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this._center=new n(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._posMatrixCache={},this._alignedPosMatrixCache={}},m={minZoom:{},maxZoom:{},renderWorldCopies:{},worldSize:{},centerPoint:{},size:{},bearing:{},pitch:{},fov:{},zoom:{},center:{},unmodified:{},x:{},y:{},point:{}};v.prototype.clone=function(){var t=new v(this._minZoom,this._maxZoom,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._calcMatrices(),t},m.minZoom.get=function(){return this._minZoom},m.minZoom.set=function(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))},m.maxZoom.get=function(){return this._maxZoom},m.maxZoom.set=function(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))},m.renderWorldCopies.get=function(){return this._renderWorldCopies},m.worldSize.get=function(){return this.tileSize*this.scale},m.centerPoint.get=function(){return this.size._div(2)},m.size.get=function(){return new i(this.width,this.height)},m.bearing.get=function(){return-this.angle/Math.PI*180},m.bearing.set=function(t){var e=-o.wrap(t,-180,180)*Math.PI/180;this.angle!==e&&(this._unmodified=!1,this.angle=e,this._calcMatrices(),this.rotationMatrix=g.create(),g.rotate(this.rotationMatrix,this.rotationMatrix,this.angle))},m.pitch.get=function(){return this._pitch/Math.PI*180},m.pitch.set=function(t){var e=o.clamp(t,0,60)/180*Math.PI;this._pitch!==e&&(this._unmodified=!1,this._pitch=e,this._calcMatrices())},m.fov.get=function(){return this._fov/Math.PI*180},m.fov.set=function(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())},m.zoom.get=function(){return this._zoom},m.zoom.set=function(t){var e=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==e&&(this._unmodified=!1,this._zoom=e,this.scale=this.zoomScale(e),this.tileZoom=Math.floor(e),this.zoomFraction=e-this.tileZoom,this._constrain(),this._calcMatrices())},m.center.get=function(){return this._center},m.center.set=function(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())},v.prototype.coveringZoomLevel=function(t){return(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize))},v.prototype.getVisibleUnwrappedCoordinates=function(t){var e=this.pointCoordinate(new i(0,0),0),r=this.pointCoordinate(new i(this.width,0),0),n=Math.floor(e.column),a=Math.floor(r.column),o=[new c(0,t)];if(this._renderWorldCopies)for(var s=n;s<=a;s++)0!==s&&o.push(new c(s,t));return o},v.prototype.coveringTiles=function(t){var e=this.coveringZoomLevel(t),r=e;if(void 0!==t.minzoom&&et.maxzoom&&(e=t.maxzoom);var n=this.pointCoordinate(this.centerPoint,e),a=new i(n.column-.5,n.row-.5),o=[this.pointCoordinate(new i(0,0),e),this.pointCoordinate(new i(this.width,0),e),this.pointCoordinate(new i(this.width,this.height),e),this.pointCoordinate(new i(0,this.height),e)];return l(e,o,t.reparseOverscaled?r:e,this._renderWorldCopies).sort(function(t,e){return a.dist(t.canonical)-a.dist(e.canonical)})},v.prototype.resize=function(t,e){this.width=t,this.height=e,this.pixelsToGLUnits=[2/t,-2/e],this._constrain(),this._calcMatrices()},m.unmodified.get=function(){return this._unmodified},v.prototype.zoomScale=function(t){return Math.pow(2,t)},v.prototype.scaleZoom=function(t){return Math.log(t)/Math.LN2},v.prototype.project=function(t){return new i(this.lngX(t.lng),this.latY(t.lat))},v.prototype.unproject=function(t){return new n(this.xLng(t.x),this.yLat(t.y))},m.x.get=function(){return this.lngX(this.center.lng)},m.y.get=function(){return this.latY(this.center.lat)},m.point.get=function(){return new i(this.x,this.y)},v.prototype.lngX=function(t){return(180+t)*this.worldSize/360},v.prototype.latY=function(t){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360)))*this.worldSize/360},v.prototype.xLng=function(t){return 360*t/this.worldSize-180},v.prototype.yLat=function(t){var e=180-360*t/this.worldSize;return 360/Math.PI*Math.atan(Math.exp(e*Math.PI/180))-90},v.prototype.setLocationAtPoint=function(t,e){var r=this.pointCoordinate(e)._sub(this.pointCoordinate(this.centerPoint));this.center=this.coordinateLocation(this.locationCoordinate(t)._sub(r)),this._renderWorldCopies&&(this.center=this.center.wrap())},v.prototype.locationPoint=function(t){return this.coordinatePoint(this.locationCoordinate(t))},v.prototype.pointLocation=function(t){return this.coordinateLocation(this.pointCoordinate(t))},v.prototype.locationCoordinate=function(t){return new a(this.lngX(t.lng)/this.tileSize,this.latY(t.lat)/this.tileSize,this.zoom).zoomTo(this.tileZoom)},v.prototype.coordinateLocation=function(t){var e=t.zoomTo(this.zoom);return new n(this.xLng(e.column*this.tileSize),this.yLat(e.row*this.tileSize))},v.prototype.pointCoordinate=function(t,e){void 0===e&&(e=this.tileZoom);var r=[t.x,t.y,0,1],n=[t.x,t.y,1,1];p.transformMat4(r,r,this.pixelMatrixInverse),p.transformMat4(n,n,this.pixelMatrixInverse);var i=r[3],o=n[3],l=r[1]/i,u=n[1]/o,c=r[2]/i,h=n[2]/o,f=c===h?0:(0-c)/(h-c);return new a(s(r[0]/i,n[0]/o,f)/this.tileSize,s(l,u,f)/this.tileSize,this.zoom)._zoomTo(e)},v.prototype.coordinatePoint=function(t){var e=t.zoomTo(this.zoom),r=[e.column*this.tileSize,e.row*this.tileSize,0,1];return p.transformMat4(r,r,this.pixelMatrix),new i(r[0]/r[3],r[1]/r[3])},v.prototype.calculatePosMatrix=function(t,e){void 0===e&&(e=!1);var r=t.key,n=e?this._alignedPosMatrixCache:this._posMatrixCache;if(n[r])return n[r];var i=t.canonical,a=this.worldSize/this.zoomScale(i.z),o=i.x+Math.pow(2,i.z)*t.wrap,s=d.identity(new Float64Array(16));return d.translate(s,s,[o*a,i.y*a,0]),d.scale(s,s,[a/h,a/h,1]),d.multiply(s,e?this.alignedProjMatrix:this.projMatrix,s),n[r]=new Float32Array(s),n[r]},v.prototype._constrain=function(){if(this.center&&this.width&&this.height&&!this._constraining){this._constraining=!0;var t,e,r,n,a=-90,o=90,s=-180,l=180,u=this.size,c=this._unmodified;if(this.latRange){var h=this.latRange;a=this.latY(h[1]),t=(o=this.latY(h[0]))-ao&&(n=o-g)}if(this.lngRange){var v=this.x,m=u.x/2;v-ml&&(r=l-m)}void 0===r&&void 0===n||(this.center=this.unproject(new i(void 0!==r?r:this.x,void 0!==n?n:this.y))),this._unmodified=c,this._constraining=!1}},v.prototype._calcMatrices=function(){if(this.height){this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height;var t=this._fov/2,e=Math.PI/2+this._pitch,r=Math.sin(t)*this.cameraToCenterDistance/Math.sin(Math.PI-e-t),n=this.x,i=this.y,a=1.01*(Math.cos(Math.PI/2-this._pitch)*r+this.cameraToCenterDistance),o=new Float64Array(16);d.perspective(o,this._fov,this.width/this.height,1,a),d.scale(o,o,[1,-1,1]),d.translate(o,o,[0,0,-this.cameraToCenterDistance]),d.rotateX(o,o,this._pitch),d.rotateZ(o,o,this.angle),d.translate(o,o,[-n,-i,0]);var s=this.worldSize/(2*Math.PI*6378137*Math.abs(Math.cos(this.center.lat*(Math.PI/180))));d.scale(o,o,[1,1,s,1]),this.projMatrix=o;var l=this.width%2/2,u=this.height%2/2,c=Math.cos(this.angle),h=Math.sin(this.angle),f=n-Math.round(n)+c*l+h*u,p=i-Math.round(i)+c*u+h*l,g=new Float64Array(o);if(d.translate(g,g,[f>.5?f-1:f,p>.5?p-1:p,0]),this.alignedProjMatrix=g,o=d.create(),d.scale(o,o,[this.width/2,-this.height/2,1]),d.translate(o,o,[1,-1,0]),this.pixelMatrix=d.multiply(new Float64Array(16),o,this.projMatrix),!(o=d.invert(new Float64Array(16),this.pixelMatrix)))throw new Error("failed to invert matrix");this.pixelMatrixInverse=o,this._posMatrixCache={},this._alignedPosMatrixCache={}}},Object.defineProperties(v.prototype,m),e.exports=v},{"../data/extent":53,"../source/tile_id":114,"../style-spec/util/interpolate":158,"../util/tile_cover":273,"../util/util":275,"./coordinate":61,"./lng_lat":62,"@mapbox/gl-matrix":2,"@mapbox/point-geometry":4}],65:[function(t,e,r){var n=t("../style-spec/util/color"),i=function(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r};i.disabled=new i(i.Replace=[1,0],n.transparent,[!1,!1,!1,!1]),i.unblended=new i(i.Replace,n.transparent,[!0,!0,!0,!0]),i.alphaBlended=new i([1,771],n.transparent,[!0,!0,!0,!0]),e.exports=i},{"../style-spec/util/color":153}],66:[function(t,e,r){var n=t("./index_buffer"),i=t("./vertex_buffer"),a=t("./framebuffer"),o=(t("./depth_mode"),t("./stencil_mode"),t("./color_mode")),s=t("../util/util"),l=t("./value"),u=l.ClearColor,c=l.ClearDepth,h=l.ClearStencil,f=l.ColorMask,p=l.DepthMask,d=l.StencilMask,g=l.StencilFunc,v=l.StencilOp,m=l.StencilTest,y=l.DepthRange,x=l.DepthTest,b=l.DepthFunc,_=l.Blend,w=l.BlendFunc,M=l.BlendColor,A=l.Program,k=l.LineWidth,T=l.ActiveTextureUnit,S=l.Viewport,E=l.BindFramebuffer,C=l.BindRenderbuffer,L=l.BindTexture,z=l.BindVertexBuffer,P=l.BindElementBuffer,I=l.BindVertexArrayOES,D=l.PixelStoreUnpack,O=l.PixelStoreUnpackPremultiplyAlpha,R=function(t){this.gl=t,this.extVertexArrayObject=this.gl.getExtension("OES_vertex_array_object"),this.lineWidthRange=t.getParameter(t.ALIASED_LINE_WIDTH_RANGE),this.clearColor=new u(this),this.clearDepth=new c(this),this.clearStencil=new h(this),this.colorMask=new f(this),this.depthMask=new p(this),this.stencilMask=new d(this),this.stencilFunc=new g(this),this.stencilOp=new v(this),this.stencilTest=new m(this),this.depthRange=new y(this),this.depthTest=new x(this),this.depthFunc=new b(this),this.blend=new _(this),this.blendFunc=new w(this),this.blendColor=new M(this),this.program=new A(this),this.lineWidth=new k(this),this.activeTexture=new T(this),this.viewport=new S(this),this.bindFramebuffer=new E(this),this.bindRenderbuffer=new C(this),this.bindTexture=new L(this),this.bindVertexBuffer=new z(this),this.bindElementBuffer=new P(this),this.bindVertexArrayOES=this.extVertexArrayObject&&new I(this),this.pixelStoreUnpack=new D(this),this.pixelStoreUnpackPremultiplyAlpha=new O(this),this.extTextureFilterAnisotropic=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=t.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.extTextureHalfFloat=t.getExtension("OES_texture_half_float"),this.extTextureHalfFloat&&t.getExtension("OES_texture_half_float_linear")};R.prototype.createIndexBuffer=function(t,e){return new n(this,t,e)},R.prototype.createVertexBuffer=function(t,e,r){return new i(this,t,e,r)},R.prototype.createRenderbuffer=function(t,e,r){var n=this.gl,i=n.createRenderbuffer();return this.bindRenderbuffer.set(i),n.renderbufferStorage(n.RENDERBUFFER,t,e,r),this.bindRenderbuffer.set(null),i},R.prototype.createFramebuffer=function(t,e){return new a(this,t,e)},R.prototype.clear=function(t){var e=t.color,r=t.depth,n=this.gl,i=0;e&&(i|=n.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),void 0!==r&&(i|=n.DEPTH_BUFFER_BIT,this.clearDepth.set(r),this.depthMask.set(!0)),n.clear(i)},R.prototype.setDepthMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.depthTest.set(!0),this.depthFunc.set(t.func),this.depthMask.set(t.mask),this.depthRange.set(t.range)):this.depthTest.set(!1)},R.prototype.setStencilMode=function(t){t.func!==this.gl.ALWAYS||t.mask?(this.stencilTest.set(!0),this.stencilMask.set(t.mask),this.stencilOp.set([t.fail,t.depthFail,t.pass]),this.stencilFunc.set({func:t.test.func,ref:t.ref,mask:t.test.mask})):this.stencilTest.set(!1)},R.prototype.setColorMode=function(t){s.deepEqual(t.blendFunction,o.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(t.blendFunction),this.blendColor.set(t.blendColor)),this.colorMask.set(t.mask)},e.exports=R},{"../util/util":275,"./color_mode":65,"./depth_mode":67,"./framebuffer":68,"./index_buffer":69,"./stencil_mode":70,"./value":71,"./vertex_buffer":72}],67:[function(t,e,r){var n=function(t,e,r){this.func=t,this.mask=e,this.range=r};n.ReadOnly=!1,n.ReadWrite=!0,n.disabled=new n(519,n.ReadOnly,[0,1]),e.exports=n},{}],68:[function(t,e,r){var n=t("./value"),i=n.ColorAttachment,a=n.DepthAttachment,o=function(t,e,r){this.context=t,this.width=e,this.height=r;var n=t.gl,o=this.framebuffer=n.createFramebuffer();this.colorAttachment=new i(t,o),this.depthAttachment=new a(t,o)};o.prototype.destroy=function(){var t=this.context.gl,e=this.colorAttachment.get();e&&t.deleteTexture(e);var r=this.depthAttachment.get();r&&t.deleteRenderbuffer(r),t.deleteFramebuffer(this.framebuffer)},e.exports=o},{"./value":71}],69:[function(t,e,r){var n=function(t,e,r){this.context=t;var n=t.gl;this.buffer=n.createBuffer(),this.dynamicDraw=Boolean(r),this.unbindVAO(),t.bindElementBuffer.set(this.buffer),n.bufferData(n.ELEMENT_ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?n.DYNAMIC_DRAW:n.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};n.prototype.unbindVAO=function(){this.context.extVertexArrayObject&&this.context.bindVertexArrayOES.set(null)},n.prototype.bind=function(){this.context.bindElementBuffer.set(this.buffer)},n.prototype.updateData=function(t){var e=this.context.gl;this.unbindVAO(),this.bind(),e.bufferSubData(e.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)},n.prototype.destroy=function(){var t=this.context.gl;this.buffer&&(t.deleteBuffer(this.buffer),delete this.buffer)},e.exports=n},{}],70:[function(t,e,r){var n=function(t,e,r,n,i,a){this.test=t,this.ref=e,this.mask=r,this.fail=n,this.depthFail=i,this.pass=a};n.disabled=new n({func:519,mask:0},0,0,7680,7680,7680),e.exports=n},{}],71:[function(t,e,r){var n=t("../style-spec/util/color"),i=t("../util/util"),a=function(t){this.context=t,this.current=n.transparent};a.prototype.get=function(){return this.current},a.prototype.set=function(t){var e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a||(this.context.gl.clearColor(t.r,t.g,t.b,t.a),this.current=t)};var o=function(t){this.context=t,this.current=1};o.prototype.get=function(){return this.current},o.prototype.set=function(t){this.current!==t&&(this.context.gl.clearDepth(t),this.current=t)};var s=function(t){this.context=t,this.current=0};s.prototype.get=function(){return this.current},s.prototype.set=function(t){this.current!==t&&(this.context.gl.clearStencil(t),this.current=t)};var l=function(t){this.context=t,this.current=[!0,!0,!0,!0]};l.prototype.get=function(){return this.current},l.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]||(this.context.gl.colorMask(t[0],t[1],t[2],t[3]),this.current=t)};var u=function(t){this.context=t,this.current=!0};u.prototype.get=function(){return this.current},u.prototype.set=function(t){this.current!==t&&(this.context.gl.depthMask(t),this.current=t)};var c=function(t){this.context=t,this.current=255};c.prototype.get=function(){return this.current},c.prototype.set=function(t){this.current!==t&&(this.context.gl.stencilMask(t),this.current=t)};var h=function(t){this.context=t,this.current={func:t.gl.ALWAYS,ref:0,mask:255}};h.prototype.get=function(){return this.current},h.prototype.set=function(t){var e=this.current;t.func===e.func&&t.ref===e.ref&&t.mask===e.mask||(this.context.gl.stencilFunc(t.func,t.ref,t.mask),this.current=t)};var f=function(t){this.context=t;var e=this.context.gl;this.current=[e.KEEP,e.KEEP,e.KEEP]};f.prototype.get=function(){return this.current},f.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]||(this.context.gl.stencilOp(t[0],t[1],t[2]),this.current=t)};var p=function(t){this.context=t,this.current=!1};p.prototype.get=function(){return this.current},p.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;t?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this.current=t}};var d=function(t){this.context=t,this.current=[0,1]};d.prototype.get=function(){return this.current},d.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]||(this.context.gl.depthRange(t[0],t[1]),this.current=t)};var g=function(t){this.context=t,this.current=!1};g.prototype.get=function(){return this.current},g.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;t?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this.current=t}};var v=function(t){this.context=t,this.current=t.gl.LESS};v.prototype.get=function(){return this.current},v.prototype.set=function(t){this.current!==t&&(this.context.gl.depthFunc(t),this.current=t)};var m=function(t){this.context=t,this.current=!1};m.prototype.get=function(){return this.current},m.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;t?e.enable(e.BLEND):e.disable(e.BLEND),this.current=t}};var y=function(t){this.context=t;var e=this.context.gl;this.current=[e.ONE,e.ZERO]};y.prototype.get=function(){return this.current},y.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]||(this.context.gl.blendFunc(t[0],t[1]),this.current=t)};var x=function(t){this.context=t,this.current=n.transparent};x.prototype.get=function(){return this.current},x.prototype.set=function(t){var e=this.current;t.r===e.r&&t.g===e.g&&t.b===e.b&&t.a===e.a||(this.context.gl.blendColor(t.r,t.g,t.b,t.a),this.current=t)};var b=function(t){this.context=t,this.current=null};b.prototype.get=function(){return this.current},b.prototype.set=function(t){this.current!==t&&(this.context.gl.useProgram(t),this.current=t)};var _=function(t){this.context=t,this.current=1};_.prototype.get=function(){return this.current},_.prototype.set=function(t){var e=this.context.lineWidthRange,r=i.clamp(t,e[0],e[1]);this.current!==r&&(this.context.gl.lineWidth(r),this.current=t)};var w=function(t){this.context=t,this.current=t.gl.TEXTURE0};w.prototype.get=function(){return this.current},w.prototype.set=function(t){this.current!==t&&(this.context.gl.activeTexture(t),this.current=t)};var M=function(t){this.context=t;var e=this.context.gl;this.current=[0,0,e.drawingBufferWidth,e.drawingBufferHeight]};M.prototype.get=function(){return this.current},M.prototype.set=function(t){var e=this.current;t[0]===e[0]&&t[1]===e[1]&&t[2]===e[2]&&t[3]===e[3]||(this.context.gl.viewport(t[0],t[1],t[2],t[3]),this.current=t)};var A=function(t){this.context=t,this.current=null};A.prototype.get=function(){return this.current},A.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindFramebuffer(e.FRAMEBUFFER,t),this.current=t}};var k=function(t){this.context=t,this.current=null};k.prototype.get=function(){return this.current},k.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindRenderbuffer(e.RENDERBUFFER,t),this.current=t}};var T=function(t){this.context=t,this.current=null};T.prototype.get=function(){return this.current},T.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindTexture(e.TEXTURE_2D,t),this.current=t}};var S=function(t){this.context=t,this.current=null};S.prototype.get=function(){return this.current},S.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.bindBuffer(e.ARRAY_BUFFER,t),this.current=t}};var E=function(t){this.context=t,this.current=null};E.prototype.get=function(){return this.current},E.prototype.set=function(t){var e=this.context.gl;e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t),this.current=t};var C=function(t){this.context=t,this.current=null};C.prototype.get=function(){return this.current},C.prototype.set=function(t){this.current!==t&&this.context.extVertexArrayObject&&(this.context.extVertexArrayObject.bindVertexArrayOES(t),this.current=t)};var L=function(t){this.context=t,this.current=4};L.prototype.get=function(){return this.current},L.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.pixelStorei(e.UNPACK_ALIGNMENT,t),this.current=t}};var z=function(t){this.context=t,this.current=!1};z.prototype.get=function(){return this.current},z.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t),this.current=t}};var P=function(t,e){this.context=t,this.current=null,this.parent=e};P.prototype.get=function(){return this.current};var I=function(t){function e(e,r){t.call(this,e,r),this.dirty=!1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(this.dirty||this.current!==t){var e=this.context.gl;this.context.bindFramebuffer.set(this.parent),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,t,0),this.current=t,this.dirty=!1}},e.prototype.setDirty=function(){this.dirty=!0},e}(P),D=function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.set=function(t){if(this.current!==t){var e=this.context.gl;this.context.bindFramebuffer.set(this.parent),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_ATTACHMENT,e.RENDERBUFFER,t),this.current=t}},e}(P);e.exports={ClearColor:a,ClearDepth:o,ClearStencil:s,ColorMask:l,DepthMask:u,StencilMask:c,StencilFunc:h,StencilOp:f,StencilTest:p,DepthRange:d,DepthTest:g,DepthFunc:v,Blend:m,BlendFunc:y,BlendColor:x,Program:b,LineWidth:_,ActiveTextureUnit:w,Viewport:M,BindFramebuffer:A,BindRenderbuffer:k,BindTexture:T,BindVertexBuffer:S,BindElementBuffer:E,BindVertexArrayOES:C,PixelStoreUnpack:L,PixelStoreUnpackPremultiplyAlpha:z,ColorAttachment:I,DepthAttachment:D}},{"../style-spec/util/color":153,"../util/util":275}],72:[function(t,e,r){var n={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"},i=function(t,e,r,n){this.length=e.length,this.attributes=r,this.itemSize=e.bytesPerElement,this.dynamicDraw=n,this.context=t;var i=t.gl;this.buffer=i.createBuffer(),t.bindVertexBuffer.set(this.buffer),i.bufferData(i.ARRAY_BUFFER,e.arrayBuffer,this.dynamicDraw?i.DYNAMIC_DRAW:i.STATIC_DRAW),this.dynamicDraw||delete e.arrayBuffer};i.prototype.bind=function(){this.context.bindVertexBuffer.set(this.buffer)},i.prototype.updateData=function(t){var e=this.context.gl;this.bind(),e.bufferSubData(e.ARRAY_BUFFER,0,t.arrayBuffer)},i.prototype.enableAttributes=function(t,e){for(var r=0;r":[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]]}},{"../data/array_types":39,"../data/extent":53,"../data/pos_attributes":57,"../gl/depth_mode":67,"../gl/stencil_mode":70,"../util/browser":252,"./vertex_array_object":95,"@mapbox/gl-matrix":2}],78:[function(t,e,r){function n(t,e,r,n,i){if(!s.isPatternMissing(r.paint.get("fill-pattern"),t))for(var a=!0,o=0,l=n;o0){var l=o.now(),u=(l-t.timeAdded)/s,c=e?(l-e.timeAdded)/s:-1,h=r.getSource(),f=a.coveringZoomLevel({tileSize:h.tileSize,roundZoom:h.roundZoom}),p=!e||Math.abs(e.tileID.overscaledZ-f)>Math.abs(t.tileID.overscaledZ-f),d=p&&t.refreshedUponExpiration?1:i.clamp(p?u:1-c,0,1);return t.refreshedUponExpiration&&u>=1&&(t.refreshedUponExpiration=!1),e?{opacity:1,mix:1-d}:{opacity:d,mix:0}}return{opacity:1,mix:0}}var i=t("../util/util"),a=t("../source/image_source"),o=t("../util/browser"),s=t("../gl/stencil_mode"),l=t("../gl/depth_mode");e.exports=function(t,e,r,i){if("translucent"===t.renderPass&&0!==r.paint.get("raster-opacity")){var o=t.context,u=o.gl,c=e.getSource(),h=t.useProgram("raster");o.setStencilMode(s.disabled),o.setColorMode(t.colorModeForRenderPass()),u.uniform1f(h.uniforms.u_brightness_low,r.paint.get("raster-brightness-min")),u.uniform1f(h.uniforms.u_brightness_high,r.paint.get("raster-brightness-max")),u.uniform1f(h.uniforms.u_saturation_factor,function(t){return t>0?1-1/(1.001-t):-t}(r.paint.get("raster-saturation"))),u.uniform1f(h.uniforms.u_contrast_factor,function(t){return t>0?1/(1-t):1+t}(r.paint.get("raster-contrast"))),u.uniform3fv(h.uniforms.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.get("raster-hue-rotate"))),u.uniform1f(h.uniforms.u_buffer_scale,1),u.uniform1i(h.uniforms.u_image0,0),u.uniform1i(h.uniforms.u_image1,1);for(var f=i.length&&i[0].overscaledZ,p=0,d=i;p65535)e(new Error("glyphs > 65535 not supported"));else{var u=o.requests[l];u||(u=o.requests[l]=[],n(i,l,r.url,r.requestTransform,function(t,e){if(e)for(var r in e)o.glyphs[+r]=e[+r];for(var n=0,i=u;nthis.height)return n.warnOnce("LineAtlas out of space"),null;for(var o=0,s=0;s=0;this.currentLayer--){var v=r.style._layers[o[r.currentLayer]];v.source!==(d&&d.id)&&(g=[],(d=r.style.sourceCaches[v.source])&&(r.clearStencil(),g=d.getVisibleCoordinates(),d.getSource().isTileClipped&&r._renderTileClippingMasks(g))),r.renderLayer(r,d,v,g)}this.renderPass="translucent";var m,y=[];for(this.currentLayer=0,this.currentLayer;this.currentLayer0?e.pop():null},T.prototype._createProgramCached=function(t,e){this.cache=this.cache||{};var r=""+t+(e.cacheKey||"")+(this._showOverdrawInspector?"/overdraw":"");return this.cache[r]||(this.cache[r]=new y(this.context,m[t],e,this._showOverdrawInspector)),this.cache[r]},T.prototype.useProgram=function(t,e){var r=this._createProgramCached(t,e||this.emptyProgramConfiguration);return this.context.program.set(r.program),r},e.exports=T},{"../data/array_types":39,"../data/extent":53,"../data/pos_attributes":57,"../data/program_configuration":58,"../data/raster_bounds_attributes":59,"../gl/color_mode":65,"../gl/context":66,"../gl/depth_mode":67,"../gl/stencil_mode":70,"../shaders":97,"../source/pixels_to_tile_units":104,"../source/source_cache":111,"../style-spec/util/color":153,"../symbol/cross_tile_symbol_index":218,"../util/browser":252,"../util/util":275,"./draw_background":74,"./draw_circle":75,"./draw_debug":77,"./draw_fill":78,"./draw_fill_extrusion":79,"./draw_heatmap":80,"./draw_hillshade":81,"./draw_line":82,"./draw_raster":83,"./draw_symbol":84,"./program":92,"./texture":93,"./tile_mask":94,"./vertex_array_object":95,"@mapbox/gl-matrix":2}],91:[function(t,e,r){var n=t("../source/pixels_to_tile_units");r.isPatternMissing=function(t,e){if(!t)return!1;var r=e.imageManager.getPattern(t.from),n=e.imageManager.getPattern(t.to);return!r||!n},r.prepare=function(t,e,r){var n=e.context,i=n.gl,a=e.imageManager.getPattern(t.from),o=e.imageManager.getPattern(t.to);i.uniform1i(r.uniforms.u_image,0),i.uniform2fv(r.uniforms.u_pattern_tl_a,a.tl),i.uniform2fv(r.uniforms.u_pattern_br_a,a.br),i.uniform2fv(r.uniforms.u_pattern_tl_b,o.tl),i.uniform2fv(r.uniforms.u_pattern_br_b,o.br);var s=e.imageManager.getPixelSize(),l=s.width,u=s.height;i.uniform2fv(r.uniforms.u_texsize,[l,u]),i.uniform1f(r.uniforms.u_mix,t.t),i.uniform2fv(r.uniforms.u_pattern_size_a,a.displaySize),i.uniform2fv(r.uniforms.u_pattern_size_b,o.displaySize),i.uniform1f(r.uniforms.u_scale_a,t.fromScale),i.uniform1f(r.uniforms.u_scale_b,t.toScale),n.activeTexture.set(i.TEXTURE0),e.imageManager.bind(e.context)},r.setTile=function(t,e,r){var i=e.context.gl;i.uniform1f(r.uniforms.u_tile_units_to_pixels,1/n(t,1,e.transform.tileZoom));var a=Math.pow(2,t.tileID.overscaledZ),o=t.tileSize*Math.pow(2,e.transform.tileZoom)/a,s=o*(t.tileID.canonical.x+t.tileID.wrap*a),l=o*t.tileID.canonical.y;i.uniform2f(r.uniforms.u_pixel_coord_upper,s>>16,l>>16),i.uniform2f(r.uniforms.u_pixel_coord_lower,65535&s,65535&l)}},{"../source/pixels_to_tile_units":104}],92:[function(t,e,r){var n=t("../util/browser"),i=t("../shaders"),a=(t("../data/program_configuration").ProgramConfiguration,t("./vertex_array_object")),o=(t("../gl/context"),function(t,e,r,a){var o=this,s=t.gl;this.program=s.createProgram();var l=r.defines().concat("#define DEVICE_PIXEL_RATIO "+n.devicePixelRatio.toFixed(1));a&&l.push("#define OVERDRAW_INSPECTOR;");var u=l.concat(i.prelude.fragmentSource,e.fragmentSource).join("\n"),c=l.concat(i.prelude.vertexSource,e.vertexSource).join("\n"),h=s.createShader(s.FRAGMENT_SHADER);s.shaderSource(h,u),s.compileShader(h),s.attachShader(this.program,h);var f=s.createShader(s.VERTEX_SHADER);s.shaderSource(f,c),s.compileShader(f),s.attachShader(this.program,f);for(var p=r.layoutAttributes||[],d=0;d 0.5) {\n gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n gl_FragColor *= .1;\n }\n}",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n gl_Position.xy += a_extrude * u_extrude_scale * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n}\n"},collisionCircle:{fragmentSource:"\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n float alpha = 0.5;\n\n // Red = collision, hide label\n vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha;\n\n // Blue = no collision, label is showing\n if (v_placed > 0.5) {\n color = vec4(0.0, 0.0, 1.0, 0.5) * alpha;\n }\n\n if (v_notUsed > 0.5) {\n // This box not used, fade it out\n color *= .2;\n }\n\n float extrude_scale_length = length(v_extrude_scale);\n float extrude_length = length(v_extrude) * extrude_scale_length;\n float stroke_width = 15.0 * extrude_scale_length;\n float radius = v_radius * extrude_scale_length;\n\n float distance_to_edge = abs(extrude_length - radius);\n float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge);\n\n gl_FragColor = opacity_t * color;\n}\n",vertexSource:"attribute vec2 a_pos;\nattribute vec2 a_anchor_pos;\nattribute vec2 a_extrude;\nattribute vec2 a_placed;\n\nuniform mat4 u_matrix;\nuniform vec2 u_extrude_scale;\nuniform float u_camera_to_center_distance;\n\nvarying float v_placed;\nvarying float v_notUsed;\nvarying float v_radius;\n\nvarying vec2 v_extrude;\nvarying vec2 v_extrude_scale;\n\nvoid main() {\n vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n highp float collision_perspective_ratio = 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance);\n\n gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0);\n\n highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur\n gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio;\n\n v_placed = a_placed.x;\n v_notUsed = a_placed.y;\n v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius\n\n v_extrude = a_extrude * padding_factor;\n v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio;\n}\n"},debug:{fragmentSource:"uniform highp vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n}\n",vertexSource:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fill:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp 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:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n}\n"},fillOutline:{fragmentSource:"#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_pos;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 outline_color\n #pragma mapbox: initialize lowp float opacity\n\n float dist = length(v_pos - gl_FragCoord.xy);\n float alpha = 1.0 - smoothstep(0.0, 1.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:"attribute vec2 a_pos;\n\nuniform mat4 u_matrix;\nuniform vec2 u_world;\n\nvarying vec2 v_pos;\n\n#pragma mapbox: define highp vec4 outline_color\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize highp 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"},fillOutlinePattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\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\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, 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_texsize, u_pattern_br_b / u_texsize, 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 = 1.0 - smoothstep(0.0, 1.0, dist);\n\n\n gl_FragColor = mix(color1, color2, u_mix) * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\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;\nvarying vec2 v_pos;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n\n v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world;\n}\n"},fillPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\n\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, 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_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n gl_FragColor = mix(color1, color2, u_mix) * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform 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\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos);\n}\n"},fillExtrusion:{fragmentSource:"varying vec4 v_color;\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n gl_FragColor = v_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec4 v_color;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\n#pragma mapbox: define highp vec4 color\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n #pragma mapbox: initialize highp vec4 color\n\n vec3 normal = a_normal_ed.xyz;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n\n gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1);\n\n // Relative luminance (how dark/bright is the surface color?)\n float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722;\n\n v_color = vec4(0.0, 0.0, 0.0, 1.0);\n\n // Add slight ambient lighting so no extrusions are totally black\n vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0);\n color += ambientlight;\n\n // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray\n float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0);\n\n // Adjust directional so that\n // the range of values for highlight/shading is narrower\n // with lower light intensity\n // and with lighter/brighter surface colors\n directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional);\n\n // Add gradient along z axis of side surfaces\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n // Assign final color based on surface + ambient light color, diffuse light directional, and light color\n // with lower bounds adjusted to hue of light\n // so that shading is tinted with the complementary (opposite) color to the light color\n v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0);\n v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0);\n v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0);\n}\n"},fillExtrusionPattern:{fragmentSource:"uniform vec2 u_pattern_tl_a;\nuniform vec2 u_pattern_br_a;\nuniform vec2 u_pattern_tl_b;\nuniform vec2 u_pattern_br_b;\nuniform vec2 u_texsize;\nuniform float u_mix;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec2 imagecoord = mod(v_pos_a, 1.0);\n vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, 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_texsize, u_pattern_br_b / u_texsize, imagecoord_b);\n vec4 color2 = texture2D(u_image, pos2);\n\n vec4 mixedColor = mix(color1, color2, u_mix);\n\n gl_FragColor = mixedColor * v_lighting;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform 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;\nuniform float u_height_factor;\n\nuniform vec3 u_lightcolor;\nuniform lowp vec3 u_lightpos;\nuniform lowp float u_lightintensity;\n\nattribute vec2 a_pos;\nattribute vec4 a_normal_ed;\n\nvarying vec2 v_pos_a;\nvarying vec2 v_pos_b;\nvarying vec4 v_lighting;\nvarying float v_directional;\n\n#pragma mapbox: define lowp float base\n#pragma mapbox: define lowp float height\n\nvoid main() {\n #pragma mapbox: initialize lowp float base\n #pragma mapbox: initialize lowp float height\n\n vec3 normal = a_normal_ed.xyz;\n float edgedistance = a_normal_ed.w;\n\n base = max(0.0, base);\n height = max(0.0, height);\n\n float t = mod(normal.x, 2.0);\n float z = t > 0.0 ? height : base;\n\n gl_Position = u_matrix * vec4(a_pos, z, 1);\n\n vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0\n ? a_pos // extrusion top\n : vec2(edgedistance, z * u_height_factor); // extrusion side\n\n v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, pos);\n v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, pos);\n\n v_lighting = vec4(0.0, 0.0, 0.0, 1.0);\n float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0);\n directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional);\n\n if (normal.y != 0.0) {\n directional *= clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0);\n }\n\n v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0));\n}\n"},extrusionTexture:{fragmentSource:"uniform sampler2D u_image;\nuniform float u_opacity;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_FragColor = texture2D(u_image, v_pos) * u_opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(0.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\nuniform vec2 u_world;\nattribute vec2 a_pos;\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1);\n\n v_pos.x = a_pos.x;\n v_pos.y = 1.0 - a_pos.y;\n}\n"},hillshadePrepare:{fragmentSource:"#ifdef GL_ES\nprecision highp float;\n#endif\n\nuniform sampler2D u_image;\nvarying vec2 v_pos;\nuniform vec2 u_dimension;\nuniform float u_zoom;\n\nfloat getElevation(vec2 coord, float bias) {\n // Convert encoded elevation value to meters\n vec4 data = texture2D(u_image, coord) * 255.0;\n return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0;\n}\n\nvoid main() {\n vec2 epsilon = 1.0 / u_dimension;\n\n // queried pixels:\n // +-----------+\n // | | | |\n // | a | b | c |\n // | | | |\n // +-----------+\n // | | | |\n // | d | e | f |\n // | | | |\n // +-----------+\n // | | | |\n // | g | h | i |\n // | | | |\n // +-----------+\n\n float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0);\n float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0);\n float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0);\n float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0);\n float e = getElevation(v_pos, 0.0);\n float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0);\n float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0);\n float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0);\n float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0);\n\n // here we divide the x and y slopes by 8 * pixel size\n // where pixel size (aka meters/pixel) is:\n // circumference of the world / (pixels per tile * number of tiles)\n // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom))\n // which can be reduced to: pow(2, 19.25619978527 - u_zoom)\n // we want to vertically exaggerate the hillshading though, because otherwise\n // it is barely noticeable at low zooms. to do this, we multiply this by some\n // scale factor pow(2, (u_zoom - 14) * a) where a is an arbitrary value and 14 is the\n // maxzoom of the tile source. here we use a=0.3 which works out to the\n // expression below. see nickidlugash's awesome breakdown for more info\n // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556\n float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;\n\n vec2 deriv = vec2(\n (c + f + f + i) - (a + d + d + g),\n (g + h + h + i) - (a + b + b + c)\n ) / pow(2.0, (u_zoom - 14.0) * exaggeration + 19.2562 - u_zoom);\n\n gl_FragColor = clamp(vec4(\n deriv.x / 2.0 + 0.5,\n deriv.y / 2.0 + 0.5,\n 1.0,\n 1.0), 0.0, 1.0);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;\n}\n"},hillshade:{fragmentSource:"uniform sampler2D u_image;\nvarying vec2 v_pos;\n\nuniform vec2 u_latrange;\nuniform vec2 u_light;\nuniform vec4 u_shadow;\nuniform vec4 u_highlight;\nuniform vec4 u_accent;\n\n#define PI 3.141592653589793\n\nvoid main() {\n vec4 pixel = texture2D(u_image, v_pos);\n\n vec2 deriv = ((pixel.rg * 2.0) - 1.0);\n\n // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude\n // to account for mercator projection distortion. see #4807 for details\n float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1]));\n // We also multiply the slope by an arbitrary z-factor of 1.25\n float slope = atan(1.25 * length(deriv) / scaleFactor);\n float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0);\n\n float intensity = u_light.x;\n // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal\n // position property to account for 0deg corresponding to north/the top of the viewport in the style spec\n // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal.\n float azimuth = u_light.y + PI;\n\n // We scale the slope exponentially based on intensity, using a calculation similar to\n // the exponential interpolation function in the style spec:\n // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228\n // so that higher intensity values create more opaque hillshading.\n float base = 1.875 - intensity * 1.75;\n float maxValue = 0.5 * PI;\n float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope;\n\n // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine\n // so that the accent color's rate of change eases in while the shade color's eases out.\n float accent = cos(scaledSlope);\n // We multiply both the accent and shade color by a clamped intensity value\n // so that intensities >= 0.5 do not additionally affect the color values\n // while intensity values < 0.5 make the overall color more transparent.\n vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0);\n float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0);\n vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0);\n gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform mat4 u_matrix;\n\nattribute vec2 a_pos;\nattribute vec2 a_texture_pos;\n\nvarying vec2 v_pos;\n\nvoid main() {\n gl_Position = u_matrix * vec4(a_pos, 0, 1);\n v_pos = a_texture_pos / 8192.0;\n}\n"},line:{fragmentSource:"#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_width2;\nvarying vec2 v_normal;\nvarying float v_gamma_scale;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"\n\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\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 vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n\n vec2 a_extrude = a_data.xy - 128.0;\n float a_direction = mod(a_data.z, 4.0) - 1.0;\n\n vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + 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 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_width2 = vec2(outset, inset);\n}\n"},linePattern:{fragmentSource:"uniform 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 vec2 u_texsize;\nuniform float u_fade;\n\nuniform sampler2D u_image;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 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_width2.s / u_pattern_size_a.y);\n float y_b = 0.5 + (v_normal.y * v_width2.s / u_pattern_size_b.y);\n vec2 pos_a = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, vec2(x_a, y_a));\n vec2 pos_b = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, vec2(x_b, y_b));\n\n vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade);\n\n gl_FragColor = color * alpha * opacity;\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// 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\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying float v_linesofar;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define mediump float width\n\nvoid main() {\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize mediump float width\n\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 vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + 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 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_linesofar = a_linesofar;\n v_width2 = vec2(outset, inset);\n}\n"},lineSDF:{fragmentSource:"\nuniform sampler2D u_image;\nuniform float u_sdfgamma;\nuniform float u_mix;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\n // Calculate the distance of the pixel from the line in pixels.\n float dist = length(v_normal) * v_width2.s;\n\n // Calculate the antialiasing fade factor. This is either when fading in\n // the line in case of an offset line (v_width2.t) or when fading out\n // (v_width2.s)\n float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale;\n float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 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 / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist);\n\n gl_FragColor = color * (alpha * opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"// 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\n// the distance over which the line edge fades out.\n// Retina devices need a smaller distance to avoid aliasing.\n#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0\n\nattribute vec4 a_pos_normal;\nattribute vec4 a_data;\n\nuniform mat4 u_matrix;\nuniform mediump float u_ratio;\nuniform vec2 u_patternscale_a;\nuniform float u_tex_y_a;\nuniform vec2 u_patternscale_b;\nuniform float u_tex_y_b;\nuniform vec2 u_gl_units_to_pixels;\n\nvarying vec2 v_normal;\nvarying vec2 v_width2;\nvarying vec2 v_tex_a;\nvarying vec2 v_tex_b;\nvarying float v_gamma_scale;\n\n#pragma mapbox: define highp vec4 color\n#pragma mapbox: define lowp float blur\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define mediump float gapwidth\n#pragma mapbox: define lowp float offset\n#pragma mapbox: define mediump float width\n#pragma mapbox: define lowp float floorwidth\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 color\n #pragma mapbox: initialize lowp float blur\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize mediump float gapwidth\n #pragma mapbox: initialize lowp float offset\n #pragma mapbox: initialize mediump float width\n #pragma mapbox: initialize lowp float floorwidth\n\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 vec2 pos = a_pos_normal.xy;\n\n // x is 1 if it's a round cap, 0 otherwise\n // y is 1 if the normal points up, and -1 if it points down\n mediump vec2 normal = a_pos_normal.zw;\n v_normal = normal;\n\n // these transformations used to be applied in the JS and native code bases.\n // moved them into the shader for clarity and simplicity.\n gapwidth = gapwidth / 2.0;\n float halfwidth = width / 2.0;\n offset = -1.0 * offset;\n\n float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0);\n float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + 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 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t);\n\n vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0);\n gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude;\n\n // calculate how much the perspective view squishes or stretches the extrude\n float extrude_length_without_perspective = length(dist);\n float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels);\n v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective;\n\n v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a);\n v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b);\n\n v_width2 = vec2(outset, inset);\n}\n"},raster:{fragmentSource:"uniform float u_fade_t;\nuniform float u_opacity;\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 if (color0.a > 0.0) {\n color0.rgb = color0.rgb / color0.a;\n }\n if (color1.a > 0.0) {\n color1.rgb = color1.rgb / color1.a;\n }\n vec4 color = mix(color0, color1, u_fade_t);\n color.a *= u_opacity;\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, color.a);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"uniform 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 // We are using Int16 for texture position coordinates to give us enough precision for\n // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer\n // as an arbitrarily high number to preserve adequate precision when rendering.\n // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates,\n // so math for modifying either is consistent.\n v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5;\n v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent;\n}\n"},symbolIcon:{fragmentSource:"uniform sampler2D u_texture;\n\n#pragma mapbox: define lowp float opacity\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n lowp float alpha = opacity * v_fade_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:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\nuniform highp float u_camera_to_center_distance;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform float u_fade_change;\n\n#pragma mapbox: define lowp float opacity\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_tex;\nvarying float v_fade_opacity;\n\nvoid main() {\n #pragma mapbox: initialize lowp float opacity\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n\n float size;\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // See comments in symbol_sdf.vertex\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = 0.5 + 0.5 * distance_ratio;\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // See comments in symbol_sdf.vertex\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 64.0 * fontScale), 0.0, 1.0);\n\n v_tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n}\n"},symbolSDF:{fragmentSource:"#define SDF_PX 8.0\n#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO\n\nuniform bool u_is_halo;\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform sampler2D u_texture;\nuniform highp float u_gamma_scale;\nuniform bool u_is_text;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 tex = v_data0.xy;\n float gamma_scale = v_data1.x;\n float size = v_data1.y;\n float fade_opacity = v_data1[2];\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n lowp vec4 color = fill_color;\n highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale);\n lowp float buff = (256.0 - 64.0) / 256.0;\n if (u_is_halo) {\n color = halo_color;\n gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale);\n buff = (6.0 - halo_width / fontScale) / SDF_PX;\n }\n\n lowp float dist = texture2D(u_texture, tex).a;\n highp float gamma_scaled = gamma * gamma_scale;\n highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist);\n\n gl_FragColor = color * (alpha * opacity * fade_opacity);\n\n#ifdef OVERDRAW_INSPECTOR\n gl_FragColor = vec4(1.0);\n#endif\n}\n",vertexSource:"const float PI = 3.141592653589793;\n\nattribute vec4 a_pos_offset;\nattribute vec4 a_data;\nattribute vec3 a_projected_pos;\nattribute float a_fade_opacity;\n\n// contents of a_size vary based on the type of property value\n// used for {text,icon}-size.\n// For constants, a_size is disabled.\n// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature.\n// For composite functions:\n// [ text-size(lowerZoomStop, feature),\n// text-size(upperZoomStop, feature) ]\nuniform bool u_is_size_zoom_constant;\nuniform bool u_is_size_feature_constant;\nuniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function\nuniform highp float u_size; // used when size is both zoom and feature constant\n\n#pragma mapbox: define highp vec4 fill_color\n#pragma mapbox: define highp vec4 halo_color\n#pragma mapbox: define lowp float opacity\n#pragma mapbox: define lowp float halo_width\n#pragma mapbox: define lowp float halo_blur\n\nuniform mat4 u_matrix;\nuniform mat4 u_label_plane_matrix;\nuniform mat4 u_gl_coord_matrix;\n\nuniform bool u_is_text;\nuniform bool u_pitch_with_map;\nuniform highp float u_pitch;\nuniform bool u_rotate_symbol;\nuniform highp float u_aspect_ratio;\nuniform highp float u_camera_to_center_distance;\nuniform float u_fade_change;\n\nuniform vec2 u_texsize;\n\nvarying vec2 v_data0;\nvarying vec3 v_data1;\n\nvoid main() {\n #pragma mapbox: initialize highp vec4 fill_color\n #pragma mapbox: initialize highp vec4 halo_color\n #pragma mapbox: initialize lowp float opacity\n #pragma mapbox: initialize lowp float halo_width\n #pragma mapbox: initialize lowp float halo_blur\n\n vec2 a_pos = a_pos_offset.xy;\n vec2 a_offset = a_pos_offset.zw;\n\n vec2 a_tex = a_data.xy;\n vec2 a_size = a_data.zw;\n\n highp float segment_angle = -a_projected_pos[2];\n float size;\n\n if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = mix(a_size[0], a_size[1], u_size_t) / 10.0;\n } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {\n size = a_size[0] / 10.0;\n } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) {\n size = u_size;\n } else {\n size = u_size;\n }\n\n vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1);\n highp float camera_to_anchor_distance = projectedPoint.w;\n // If the label is pitched with the map, layout is done in pitched space,\n // which makes labels in the distance smaller relative to viewport space.\n // We counteract part of that effect by multiplying by the perspective ratio.\n // If the label isn't pitched with the map, we do layout in viewport space,\n // which makes labels in the distance larger relative to the features around\n // them. We counteract part of that effect by dividing by the perspective ratio.\n highp float distance_ratio = u_pitch_with_map ?\n camera_to_anchor_distance / u_camera_to_center_distance :\n u_camera_to_center_distance / camera_to_anchor_distance;\n highp float perspective_ratio = 0.5 + 0.5 * distance_ratio;\n\n size *= perspective_ratio;\n\n float fontScale = u_is_text ? size / 24.0 : size;\n\n highp float symbol_rotation = 0.0;\n if (u_rotate_symbol) {\n // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units\n // To figure out that angle in projected space, we draw a short horizontal line in tile\n // space, project it, and measure its angle in projected space.\n vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1);\n\n vec2 a = projectedPoint.xy / projectedPoint.w;\n vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w;\n\n symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x);\n }\n\n highp float angle_sin = sin(segment_angle + symbol_rotation);\n highp float angle_cos = cos(segment_angle + symbol_rotation);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n\n vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0);\n gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 64.0 * fontScale), 0.0, 1.0);\n float gamma_scale = gl_Position.w;\n\n vec2 tex = a_tex / u_texsize;\n vec2 fade_opacity = unpack_opacity(a_fade_opacity);\n float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change;\n float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change));\n\n v_data0 = vec2(tex.x, tex.y);\n v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity);\n}\n"}},i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,a=function(t){var e=n[t],r={};e.fragmentSource=e.fragmentSource.replace(i,function(t,e,n,i,a){return r[a]=!0,"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nvarying "+n+" "+i+" "+a+";\n#else\nuniform "+n+" "+i+" u_"+a+";\n#endif\n":"\n#ifdef HAS_UNIFORM_u_"+a+"\n "+n+" "+i+" "+a+" = u_"+a+";\n#endif\n"}),e.vertexSource=e.vertexSource.replace(i,function(t,e,n,i,a){var o="float"===i?"vec2":"vec4";return r[a]?"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float a_"+a+"_t;\nattribute "+n+" "+o+" a_"+a+";\nvarying "+n+" "+i+" "+a+";\n#else\nuniform "+n+" "+i+" u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+a+" = unpack_mix_"+o+"(a_"+a+", a_"+a+"_t);\n#else\n "+n+" "+i+" "+a+" = u_"+a+";\n#endif\n":"define"===e?"\n#ifndef HAS_UNIFORM_u_"+a+"\nuniform lowp float a_"+a+"_t;\nattribute "+n+" "+o+" a_"+a+";\n#else\nuniform "+n+" "+i+" u_"+a+";\n#endif\n":"\n#ifndef HAS_UNIFORM_u_"+a+"\n "+n+" "+i+" "+a+" = unpack_mix_"+o+"(a_"+a+", a_"+a+"_t);\n#else\n "+n+" "+i+" "+a+" = u_"+a+";\n#endif\n"})};for(var o in n)a(o);e.exports=n},{}],98:[function(t,e,r){var n=t("./image_source"),i=t("../util/window"),a=t("../data/raster_bounds_attributes"),o=t("../render/vertex_array_object"),s=t("../render/texture"),l=function(t){function e(e,r,n,i){t.call(this,e,r,n,i),this.options=r,this.animate=void 0===r.animate||r.animate}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.load=function(){this.canvas=this.canvas||i.document.getElementById(this.options.canvas),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire("error",new Error("Canvas dimensions cannot be less than or equal to zero.")):(this.play=function(){this._playing=!0,this.map._rerender()},this.pause=function(){this._playing=!1},this._finishLoading())},e.prototype.getCanvas=function(){return this.canvas},e.prototype.onAdd=function(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()},e.prototype.onRemove=function(){this.pause()},e.prototype.prepare=function(){var t=this,e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),!this._hasInvalidDimensions()&&0!==Object.keys(this.tiles).length){var r=this.map.painter.context,n=r.gl;for(var i in this.boundsBuffer||(this.boundsBuffer=r.createVertexBuffer(this._boundsArray,a.members)),this.boundsVAO||(this.boundsVAO=new o),this.texture?e?this.texture.update(this.canvas):this._playing&&(this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE),n.texSubImage2D(n.TEXTURE_2D,0,0,0,n.RGBA,n.UNSIGNED_BYTE,this.canvas)):(this.texture=new s(r,this.canvas,n.RGBA),this.texture.bind(n.LINEAR,n.CLAMP_TO_EDGE)),t.tiles){var l=t.tiles[i];"loaded"!==l.state&&(l.state="loaded",l.texture=t.texture)}}},e.prototype.serialize=function(){return{type:"canvas",canvas:this.canvas,coordinates:this.coordinates}},e.prototype.hasTransition=function(){return this._playing},e.prototype._hasInvalidDimensions=function(){for(var t=0,e=[this.canvas.width,this.canvas.height];t0&&(r.resourceTiming=t._resourceTiming,t._resourceTiming=[]),t.fire("data",r)}})},e.prototype.onAdd=function(t){this.map=t,this.load()},e.prototype.setData=function(t){var e=this;return this._data=t,this.fire("dataloading",{dataType:"source"}),this._updateWorkerData(function(t){if(t)return e.fire("error",{error:t});var r={dataType:"source",sourceDataType:"content"};e._collectResourceTiming&&e._resourceTiming&&e._resourceTiming.length>0&&(r.resourceTiming=e._resourceTiming,e._resourceTiming=[]),e.fire("data",r)}),this},e.prototype._updateWorkerData=function(t){var e=this,r=i.extend({},this.workerOptions),n=this._data;"string"==typeof n?(r.request=this.map._transformRequest(function(t){var e=a.document.createElement("a");return e.href=t,e.href}(n),s.Source),r.request.collectResourceTiming=this._collectResourceTiming):r.data=JSON.stringify(n),this.workerID=this.dispatcher.send(this.type+".loadData",r,function(r,n){e._loaded=!0,n&&n.resourceTiming&&n.resourceTiming[e.id]&&(e._resourceTiming=n.resourceTiming[e.id].slice(0)),t(r)},this.workerID)},e.prototype.loadTile=function(t,e){var r=this,n=void 0===t.workerID||"expired"===t.state?"loadTile":"reloadTile",i={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:l.devicePixelRatio,overscaling:t.tileID.overscaleFactor(),showCollisionBoxes:this.map.showCollisionBoxes};t.workerID=this.dispatcher.send(n,i,function(i,a){return t.unloadVectorData(),t.aborted?e(null):i?e(i):(t.loadVectorData(a,r.map.painter,"reloadTile"===n),e(null))},this.workerID)},e.prototype.abortTile=function(t){t.aborted=!0},e.prototype.unloadTile=function(t){t.unloadVectorData(),this.dispatcher.send("removeTile",{uid:t.uid,type:this.type,source:this.id},null,t.workerID)},e.prototype.onRemove=function(){this.dispatcher.broadcast("removeSource",{type:this.type,source:this.id})},e.prototype.serialize=function(){return i.extend({},this._options,{type:this.type,data:this._data})},e.prototype.hasTransition=function(){return!1},e}(n);e.exports=u},{"../data/extent":53,"../util/ajax":251,"../util/browser":252,"../util/evented":260,"../util/util":275,"../util/window":254}],100:[function(t,e,r){function n(t,e){var r=t.source,n=t.tileID.canonical;if(!this._geoJSONIndexes[r])return e(null,null);var i=this._geoJSONIndexes[r].getTile(n.z,n.x,n.y);if(!i)return e(null,null);var a=new s(i.features),o=l(a);0===o.byteOffset&&o.byteLength===o.buffer.byteLength||(o=new Uint8Array(o)),e(null,{vectorTile:a,rawData:o.buffer})}var i=t("../util/ajax"),a=t("../util/performance"),o=t("geojson-rewind"),s=t("./geojson_wrapper"),l=t("vt-pbf"),u=t("supercluster"),c=t("geojson-vt"),h=function(t){function e(e,r,i){t.call(this,e,r,n),i&&(this.loadGeoJSON=i),this._geoJSONIndexes={}}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.loadData=function(t,e){var r=this;this.loadGeoJSON(t,function(n,i){if(n||!i)return e(n);if("object"!=typeof i)return e(new Error("Input data is not a valid GeoJSON object."));o(i,!0);try{r._geoJSONIndexes[t.source]=t.cluster?u(t.superclusterOptions).load(i.features):c(i,t.geojsonVtOptions)}catch(n){return e(n)}r.loaded[t.source]={};var s={};if(t.request&&t.request.collectResourceTiming){var l=a.getEntriesByName(t.request.url);l&&(s.resourceTiming={},s.resourceTiming[t.source]=JSON.parse(JSON.stringify(l)))}e(null,s)})},e.prototype.reloadTile=function(e,r){var n=this.loaded[e.source],i=e.uid;return n&&n[i]?t.prototype.reloadTile.call(this,e,r):this.loadTile(e,r)},e.prototype.loadGeoJSON=function(t,e){if(t.request)i.getJSON(t.request,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."))}}},e.prototype.removeSource=function(t,e){this._geoJSONIndexes[t.source]&&delete this._geoJSONIndexes[t.source],e()},e}(t("./vector_tile_worker_source"));e.exports=h},{"../util/ajax":251,"../util/performance":268,"./geojson_wrapper":101,"./vector_tile_worker_source":116,"geojson-rewind":15,"geojson-vt":19,supercluster:32,"vt-pbf":34}],101:[function(t,e,r){var n=t("@mapbox/point-geometry"),i=t("@mapbox/vector-tile").VectorTileFeature.prototype.toGeoJSON,a=t("../data/extent"),o=function(t){this._feature=t,this.extent=a,this.type=t.type,this.properties=t.tags,"id"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10))};o.prototype.loadGeometry=function(){if(1===this._feature.type){for(var t=[],e=0,r=this._feature.geometry;e0&&(l[new s(t.overscaledZ,i,e.z,n,e.y-1).key]={backfilled:!1},l[new s(t.overscaledZ,t.wrap,e.z,e.x,e.y-1).key]={backfilled:!1},l[new s(t.overscaledZ,o,e.z,a,e.y-1).key]={backfilled:!1}),e.y+11||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[a]&&(t.neighboringTiles[a].backfilled=!0)))}for(var r=this.getRenderableIds(),n=0;ne)){var s=Math.pow(2,o.tileID.canonical.z-t.canonical.z);if(Math.floor(o.tileID.canonical.x/s)===t.canonical.x&&Math.floor(o.tileID.canonical.y/s)===t.canonical.y)for(r[a]=o.tileID,i=!0;o&&o.tileID.overscaledZ-1>t.overscaledZ;){var l=o.tileID.scaledTo(o.tileID.overscaledZ-1);if(!l)break;(o=n._tiles[l.key])&&o.hasData()&&(delete r[a],r[l.key]=l)}}}return i},e.prototype.findLoadedParent=function(t,e,r){for(var n=this,i=t.overscaledZ-1;i>=e;i--){var a=t.scaledTo(i);if(!a)return;var o=String(a.key),s=n._tiles[o];if(s&&s.hasData())return r[o]=a,s;if(n._cache.has(o))return r[o]=a,n._cache.get(o)}},e.prototype.updateCacheSize=function(t){var e=(Math.ceil(t.width/this._source.tileSize)+1)*(Math.ceil(t.height/this._source.tileSize)+1),r=Math.floor(5*e),n="number"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,r):r;this._cache.setMaxSize(n)},e.prototype.update=function(t){var r=this;if(this.transform=t,this._sourceLoaded&&!this._paused){var n;this.updateCacheSize(t),this._coveredTiles={},this.used?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(function(t){return new d(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y)}):(n=t.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}),this._source.hasTile&&(n=n.filter(function(t){return r._source.hasTile(t)}))):n=[];var a,o=(this._source.roundZoom?Math.round:Math.floor)(this.getZoom(t)),s=Math.max(o-e.maxOverzooming,this._source.minzoom),l=Math.max(o+e.maxUnderzooming,this._source.minzoom),u=this._updateRetainedTiles(n,o),h={};if(i(this._source.type))for(var f=Object.keys(u),g=0;g=p.now())){r._findLoadedChildren(m,l,u)&&(u[v]=m);var x=r.findLoadedParent(m,s,h);x&&r._addTile(x.tileID)}}for(a in h)u[a]||(r._coveredTiles[a]=!0);for(a in h)u[a]=h[a];for(var b=c.keysDifference(this._tiles,u),_=0;_n._source.maxzoom){var p=u.children(n._source.maxzoom)[0],d=n.getTile(p);d&&d.hasData()?i[p.key]=p:f=!1}else{n._findLoadedChildren(u,s,i);for(var g=u.children(n._source.maxzoom),v=0;v=o;--m){var y=u.scaledTo(m);if(a[y.key])break;if(a[y.key]=!0,!(c=n.getTile(y))&&h&&(c=n._addTile(y)),c&&(i[y.key]=y,h=c.wasRequested(),c.hasData()))break}}}return i},e.prototype._addTile=function(t){var e=this._tiles[t.key];if(e)return e;(e=this._cache.getAndRemove(t.key))&&this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e));var r=Boolean(e);return r||(e=new o(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state))),e?(e.uses++,this._tiles[t.key]=e,r||this._source.fire("dataloading",{tile:e,coord:e.tileID,dataType:"source"}),e):null},e.prototype._setTileReloadTimer=function(t,e){var r=this;t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);var n=e.getExpiryTimeout();n&&(this._timers[t]=setTimeout(function(){r._reloadTile(t,"expired"),delete r._timers[t]},n))},e.prototype._setCacheInvalidationTimer=function(t,e){var r=this;t in this._cacheTimers&&(clearTimeout(this._cacheTimers[t]),delete this._cacheTimers[t]);var n=e.getExpiryTimeout();n&&(this._cacheTimers[t]=setTimeout(function(){r._cache.remove(t),delete r._cacheTimers[t]},n))},e.prototype._removeTile=function(t){var e=this._tiles[t];if(e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),!(e.uses>0)))if(e.hasData()){e.tileID=e.tileID.wrapped();var r=e.tileID.key;this._cache.add(r,e),this._setCacheInvalidationTimer(r,e)}else e.aborted=!0,this._abortTile(e),this._unloadTile(e)},e.prototype.clearTiles=function(){for(var t in this._shouldReloadOnResume=!1,this._paused=!1,this._tiles)this._removeTile(t);this._resetCache()},e.prototype._resetCache=function(){for(var t in this._cacheTimers)clearTimeout(this._cacheTimers[t]);this._cacheTimers={},this._cache.reset()},e.prototype.tilesIn=function(t){for(var e=[],r=this.getIds(),i=1/0,a=1/0,o=-1/0,s=-1/0,l=t[0].zoom,c=0;c=0&&v[1].y>=0){for(var m=[],y=0;y=p.now())return!0}return!1},e}(s);g.maxOverzooming=10,g.maxUnderzooming=3,e.exports=g},{"../data/extent":53,"../geo/coordinate":61,"../gl/context":66,"../util/browser":252,"../util/evented":260,"../util/lru_cache":266,"../util/util":275,"./source":110,"./tile":112,"./tile_id":114,"@mapbox/point-geometry":4}],112:[function(t,e,r){var n=t("../util/util"),i=t("../data/bucket").deserialize,a=(t("../data/feature_index"),t("@mapbox/vector-tile")),o=t("pbf"),s=t("../util/vectortile_to_geojson"),l=t("../style-spec/feature_filter"),u=(t("../symbol/collision_index"),t("../data/bucket/symbol_bucket")),c=t("../data/array_types"),h=c.RasterBoundsArray,f=c.CollisionBoxArray,p=t("../data/raster_bounds_attributes"),d=t("../data/extent"),g=t("@mapbox/point-geometry"),v=t("../render/texture"),m=t("../data/segment").SegmentVector,y=t("../data/index_array_type").TriangleIndexArray,x=t("../util/browser"),b=function(t,e){this.tileID=t,this.uid=n.uniqueId(),this.uses=0,this.tileSize=e,this.buckets={},this.expirationTime=null,this.expiredRequestCount=0,this.state="loading"};b.prototype.registerFadeDuration=function(t){var e=t+this.timeAdded;e>s.z,u=new g(s.x*l,s.y*l),c=new g(u.x+l,u.y+l),f=this.segments.prepareSegment(4,r,i);r.emplaceBack(u.x,u.y,u.x,u.y),r.emplaceBack(c.x,u.y,c.x,u.y),r.emplaceBack(u.x,c.y,u.x,c.y),r.emplaceBack(c.x,c.y,c.x,c.y);var v=f.vertexLength;i.emplaceBack(v,v+1,v+2),i.emplaceBack(v+1,v+2,v+3),f.vertexLength+=4,f.primitiveLength+=2}this.maskedBoundsBuffer=e.createVertexBuffer(r,p.members),this.maskedIndexBuffer=e.createIndexBuffer(i)}},b.prototype.hasData=function(){return"loaded"===this.state||"reloading"===this.state||"expired"===this.state},b.prototype.setExpiryData=function(t){var e=this.expirationTime;if(t.cacheControl){var r=n.parseCacheControl(t.cacheControl);r["max-age"]&&(this.expirationTime=Date.now()+1e3*r["max-age"])}else t.expires&&(this.expirationTime=new Date(t.expires).getTime());if(this.expirationTime){var i=Date.now(),a=!1;if(this.expirationTime>i)a=!1;else if(e)if(this.expirationTime=e&&t.x=r&&t.y0;a--)i+=(e&(n=1<this.canonical.z?new u(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new u(t,this.wrap,t,this.canonical.x>>e,this.canonical.y>>e)},u.prototype.isChildOf=function(t){var e=this.canonical.z-t.canonical.z;return 0===t.overscaledZ||t.overscaledZ>e&&t.canonical.y===this.canonical.y>>e},u.prototype.children=function(t){if(this.overscaledZ>=t)return[new u(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];var e=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new u(e,this.wrap,e,r,n),new u(e,this.wrap,e,r+1,n),new u(e,this.wrap,e,r,n+1),new u(e,this.wrap,e,r+1,n+1)]},u.prototype.isLessThan=function(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.y=C.maxzoom||"none"===C.visibility||(n(E,d.zoom),(m[C.id]=C.createBucket({index:v.bucketLayerIDs.length,layers:E,zoom:d.zoom,pixelRatio:d.pixelRatio,overscaling:d.overscaling,collisionBoxArray:d.collisionBoxArray})).populate(M,y),v.bucketLayerIDs.push(E.map(function(t){return t.id})))}}}var L,z,P,I=u.mapObject(y.glyphDependencies,function(t){return Object.keys(t).map(Number)});Object.keys(I).length?r.send("getGlyphs",{uid:this.uid,stacks:I},function(t,e){L||(L=t,z=e,p.call(d))}):z={};var D=Object.keys(y.iconDependencies);D.length?r.send("getImages",{icons:D},function(t,e){L||(L=t,P=e,p.call(d))}):P={},p.call(this)},e.exports=d},{"../data/array_types":39,"../data/bucket/symbol_bucket":51,"../data/feature_index":54,"../render/glyph_atlas":85,"../render/image_atlas":87,"../style/evaluation_parameters":182,"../symbol/symbol_layout":227,"../util/dictionary_coder":257,"../util/util":275,"./tile_id":114}],120:[function(t,e,r){function n(t,e){var r={};for(var n in t)"ref"!==n&&(r[n]=t[n]);return i.forEach(function(t){t in e&&(r[t]=e[t])}),r}var i=t("./util/ref_properties");e.exports=function(t){t=t.slice();for(var e=Object.create(null),r=0;r4)return e.error("Expected 1, 2, or 3 arguments, but found "+(t.length-1)+" instead.");var r,n;if(t.length>2){var i=t[1];if("string"!=typeof i||!(i in p))return e.error('The item type argument of "array" must be one of string, number, boolean',1);r=p[i]}else r=o;if(t.length>3){if("number"!=typeof t[2]||t[2]<0||t[2]!==Math.floor(t[2]))return e.error('The length argument to "array" must be a positive integer literal',2);n=t[2]}var s=a(r,n),l=e.parse(t[t.length-1],t.length-1,o);return l?new d(s,l):null},d.prototype.evaluate=function(t){var e=this.input.evaluate(t);if(c(this.type,h(e)))throw new f("Expected value to be of type "+i(this.type)+", but found "+i(h(e))+" instead.");return e},d.prototype.eachChild=function(t){t(this.input)},d.prototype.possibleOutputs=function(){return this.input.possibleOutputs()},e.exports=d},{"../runtime_error":143,"../types":146,"../values":147}],125:[function(t,e,r){var n=t("../types"),i=n.ObjectType,a=n.ValueType,o=n.StringType,s=n.NumberType,l=n.BooleanType,u=t("../runtime_error"),c=t("../types"),h=c.checkSubtype,f=c.toString,p=t("../values").typeOf,d={string:o,number:s,boolean:l,object:i},g=function(t,e){this.type=t,this.args=e};g.parse=function(t,e){if(t.length<2)return e.error("Expected at least one argument.");for(var r=t[0],n=d[r],i=[],o=1;o=r.length)throw new s("Array index out of bounds: "+e+" > "+r.length+".");if(e!==Math.floor(e))throw new s("Array index must be an integer, but found "+e+" instead.");return r[e]},l.prototype.eachChild=function(t){t(this.index),t(this.input)},l.prototype.possibleOutputs=function(){return[void 0]},e.exports=l},{"../runtime_error":143,"../types":146}],127:[function(t,e,r){var n=t("../types").BooleanType,i=function(t,e,r){this.type=t,this.branches=e,this.otherwise=r};i.parse=function(t,e){if(t.length<4)return e.error("Expected at least 3 arguments, but found only "+(t.length-1)+".");if(t.length%2!=0)return e.error("Expected an odd number of arguments.");var r;e.expectedType&&"value"!==e.expectedType.kind&&(r=e.expectedType);for(var a=[],o=1;o4?"Invalid rbga value "+JSON.stringify(e)+": expected an array containing either three or four numeric values.":u(e[0],e[1],e[2],e[3])))return new l(e[0]/255,e[1]/255,e[2]/255,e[3]);throw new c(r||"Could not parse color from value '"+("string"==typeof e?e:JSON.stringify(e))+"'")}for(var o=null,s=0,h=this.args;sn.evaluate(t)}function u(t,e){var r=e[0],n=e[1];return r.evaluate(t)<=n.evaluate(t)}function c(t,e){var r=e[0],n=e[1];return r.evaluate(t)>=n.evaluate(t)}var h=t("../types"),f=h.NumberType,p=h.StringType,d=h.BooleanType,g=h.ColorType,v=h.ObjectType,m=h.ValueType,y=h.ErrorType,x=h.array,b=h.toString,_=t("../values"),w=_.typeOf,M=_.Color,A=_.validateRGBA,k=t("../compound_expression"),T=k.CompoundExpression,S=k.varargs,E=t("../runtime_error"),C=t("./let"),L=t("./var"),z=t("./literal"),P=t("./assertion"),I=t("./array"),D=t("./coercion"),O=t("./at"),R=t("./match"),F=t("./case"),B=t("./step"),N=t("./interpolate"),j=t("./coalesce"),V=t("./equals"),U={"==":V.Equals,"!=":V.NotEquals,array:I,at:O,boolean:P,case:F,coalesce:j,interpolate:N,let:C,literal:z,match:R,number:P,object:P,step:B,string:P,"to-color":D,"to-number":D,var:L};T.register(U,{error:[y,[p],function(t,e){var r=e[0];throw new E(r.evaluate(t))}],typeof:[p,[m],function(t,e){var r=e[0];return b(w(r.evaluate(t)))}],"to-string":[p,[m],function(t,e){var r=e[0],n=typeof(r=r.evaluate(t));return null===r||"string"===n||"number"===n||"boolean"===n?String(r):r instanceof M?r.toString():JSON.stringify(r)}],"to-boolean":[d,[m],function(t,e){var r=e[0];return Boolean(r.evaluate(t))}],"to-rgba":[x(f,4),[g],function(t,e){var r=e[0].evaluate(t),n=r.r,i=r.g,a=r.b,o=r.a;return[255*n/o,255*i/o,255*a/o,o]}],rgb:[g,[f,f,f],n],rgba:[g,[f,f,f,f],n],length:{type:f,overloads:[[[p],o],[[x(m)],o]]},has:{type:d,overloads:[[[p],function(t,e){return i(e[0].evaluate(t),t.properties())}],[[p,v],function(t,e){var r=e[0],n=e[1];return i(r.evaluate(t),n.evaluate(t))}]]},get:{type:m,overloads:[[[p],function(t,e){return a(e[0].evaluate(t),t.properties())}],[[p,v],function(t,e){var r=e[0],n=e[1];return a(r.evaluate(t),n.evaluate(t))}]]},properties:[v,[],function(t){return t.properties()}],"geometry-type":[p,[],function(t){return t.geometryType()}],id:[m,[],function(t){return t.id()}],zoom:[f,[],function(t){return t.globals.zoom}],"heatmap-density":[f,[],function(t){return t.globals.heatmapDensity||0}],"+":[f,S(f),function(t,e){for(var r=0,n=0,i=e;n":[d,[p,m],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>a}],"filter-id->":[d,[m],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>i}],"filter-<=":[d,[p,m],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i<=a}],"filter-id-<=":[d,[m],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n<=i}],"filter->=":[d,[p,m],function(t,e){var r=e[0],n=e[1],i=t.properties()[r.value],a=n.value;return typeof i==typeof a&&i>=a}],"filter-id->=":[d,[m],function(t,e){var r=e[0],n=t.id(),i=r.value;return typeof n==typeof i&&n>=i}],"filter-has":[d,[m],function(t,e){return e[0].value in t.properties()}],"filter-has-id":[d,[],function(t){return null!==t.id()}],"filter-type-in":[d,[x(p)],function(t,e){return e[0].value.indexOf(t.geometryType())>=0}],"filter-id-in":[d,[x(m)],function(t,e){return e[0].value.indexOf(t.id())>=0}],"filter-in-small":[d,[p,x(m)],function(t,e){var r=e[0];return e[1].value.indexOf(t.properties()[r.value])>=0}],"filter-in-large":[d,[p,x(m)],function(t,e){var r=e[0],n=e[1];return function(t,e,r,n){for(;r<=n;){var i=r+n>>1;if(e[i]===t)return!0;e[i]>t?n=i-1:r=i+1}return!1}(t.properties()[r.value],n.value,0,n.value.length-1)}],">":{type:d,overloads:[[[f,f],l],[[p,p],l]]},"<":{type:d,overloads:[[[f,f],s],[[p,p],s]]},">=":{type:d,overloads:[[[f,f],c],[[p,p],c]]},"<=":{type:d,overloads:[[[f,f],u],[[p,p],u]]},all:{type:d,overloads:[[[d,d],function(t,e){var r=e[0],n=e[1];return r.evaluate(t)&&n.evaluate(t)}],[S(d),function(t,e){for(var r=0,n=e;r1}))return e.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);r={name:"cubic-bezier",controlPoints:o}}if(t.length-1<4)return e.error("Expected at least 4 arguments, but found only "+(t.length-1)+".");if((t.length-1)%2!=0)return e.error("Expected an even number of arguments.");if(!(n=e.parse(n,2,l)))return null;var u=[],h=null;e.expectedType&&"value"!==e.expectedType.kind&&(h=e.expectedType);for(var f=0;f=p)return e.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',g);var m=e.parse(d,v,h);if(!m)return null;h=h||m.type,u.push([p,m])}return"number"===h.kind||"color"===h.kind||"array"===h.kind&&"number"===h.itemType.kind&&"number"==typeof h.N?new c(h,r,n,u):e.error("Type "+s(h)+" is not interpolatable.")},c.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var i=e.length;if(n>=e[i-1])return r[i-1].evaluate(t);var o=u(e,n),s=e[o],l=e[o+1],h=c.interpolationFactor(this.interpolation,n,s,l),f=r[o].evaluate(t),p=r[o+1].evaluate(t);return a[this.type.kind.toLowerCase()](f,p,h)},c.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;eNumber.MAX_SAFE_INTEGER)return h.error("Branch labels must be integers no larger than "+Number.MAX_SAFE_INTEGER+".");if("number"==typeof d&&Math.floor(d)!==d)return h.error("Numeric branch labels must be integer values.");if(r){if(h.checkSubtype(r,n(d)))return null}else r=n(d);if(void 0!==o[String(d)])return h.error("Branch labels must be unique.");o[String(d)]=s.length}var g=e.parse(c,l,a);if(!g)return null;a=a||g.type,s.push(g)}var v=e.parse(t[1],1,r);if(!v)return null;var m=e.parse(t[t.length-1],t.length-1,a);return m?new i(r,a,v,o,s,m):null},i.prototype.evaluate=function(t){var e=this.input.evaluate(t);return(this.outputs[this.cases[e]]||this.otherwise).evaluate(t)},i.prototype.eachChild=function(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)},i.prototype.possibleOutputs=function(){return(t=[]).concat.apply(t,this.outputs.map(function(t){return t.possibleOutputs()})).concat(this.otherwise.possibleOutputs());var t},e.exports=i},{"../values":147}],136:[function(t,e,r){var n=t("../types").NumberType,i=t("../stops").findStopLessThanOrEqualTo,a=function(t,e,r){this.type=t,this.input=e,this.labels=[],this.outputs=[];for(var n=0,i=r;n=u)return e.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',h);var p=e.parse(c,f,s);if(!p)return null;s=s||p.type,o.push([u,p])}return new a(s,r,o)},a.prototype.evaluate=function(t){var e=this.labels,r=this.outputs;if(1===e.length)return r[0].evaluate(t);var n=this.input.evaluate(t);if(n<=e[0])return r[0].evaluate(t);var a=e.length;return n>=e[a-1]?r[a-1].evaluate(t):r[i(e,n)].evaluate(t)},a.prototype.eachChild=function(t){t(this.input);for(var e=0,r=this.outputs;e0&&"string"==typeof t[0]&&t[0]in g}function i(t,e,r){void 0===r&&(r={});var n=new l(g,[],function(t){var e={color:z,string:P,number:I,enum:P,boolean:D};return"array"===t.type?R(e[t.value]||O,t.length):e[t.type]||null}(e)),i=n.parse(t);return i?x(!1===r.handleErrors?new _(i):new w(i,e)):b(n.errors)}function a(t,e,r){if(void 0===r&&(r={}),"error"===(t=i(t,e,r)).result)return t;var n=t.value.expression,a=v.isFeatureConstant(n);if(!a&&!e["property-function"])return b([new s("","property expressions not supported")]);var o=v.isGlobalPropertyConstant(n,["zoom"]);if(!o&&!1===e["zoom-function"])return b([new s("","zoom expressions not supported")]);var l=function t(e){var r=null;if(e instanceof d)r=t(e.result);else if(e instanceof p)for(var n=0,i=e.args;n=0)return!1;var i=!0;return e.eachChild(function(e){i&&!t(e,r)&&(i=!1)}),i}}},{"./compound_expression":123}],141:[function(t,e,r){var n=t("./scope"),i=t("./types").checkSubtype,a=t("./parsing_error"),o=t("./definitions/literal"),s=t("./definitions/assertion"),l=t("./definitions/array"),u=t("./definitions/coercion"),c=function(t,e,r,i,a){void 0===e&&(e=[]),void 0===i&&(i=new n),void 0===a&&(a=[]),this.registry=t,this.path=e,this.key=e.map(function(t){return"["+t+"]"}).join(""),this.scope=i,this.errors=a,this.expectedType=r};c.prototype.parse=function(e,r,n,i,a){void 0===a&&(a={});var c=this;if(r&&(c=c.concat(r,n,i)),null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return c.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');var h=e[0];if("string"!=typeof h)return c.error("Expression name must be a string, but found "+typeof h+' instead. If you wanted a literal array, use ["literal", [...]].',0),null;var f=c.registry[h];if(f){var p=f.parse(e,c);if(!p)return null;if(c.expectedType){var d=c.expectedType,g=p.type;if("string"!==d.kind&&"number"!==d.kind&&"boolean"!==d.kind||"value"!==g.kind)if("array"===d.kind&&"value"===g.kind)a.omitTypeAnnotations||(p=new l(d,p));else if("color"!==d.kind||"value"!==g.kind&&"string"!==g.kind){if(c.checkSubtype(c.expectedType,p.type))return null}else a.omitTypeAnnotations||(p=new u(d,[p]));else a.omitTypeAnnotations||(p=new s(d,[p]))}if(!(p instanceof o)&&function(e){var r=t("./compound_expression").CompoundExpression,n=t("./is_constant"),i=n.isGlobalPropertyConstant,a=n.isFeatureConstant;if(e instanceof t("./definitions/var"))return!1;if(e instanceof r&&"error"===e.name)return!1;var s=!0;return e.eachChild(function(t){t instanceof o||(s=!1)}),!!s&&a(e)&&i(e,["zoom","heatmap-density"])}(p)){var v=new(t("./evaluation_context"));try{p=new o(p.type,p.evaluate(v))}catch(e){return c.error(e.message),null}}return p}return c.error('Unknown expression "'+h+'". If you wanted a literal array, use ["literal", [...]].',0)}return void 0===e?c.error("'undefined' value invalid. Use null instead."):"object"==typeof e?c.error('Bare objects invalid. Use ["literal", {...}] instead.'):c.error("Expected an array, but found "+typeof e+" instead.")},c.prototype.concat=function(t,e,r){var n="number"==typeof t?this.path.concat(t):this.path,i=r?this.scope.concat(r):this.scope;return new c(this.registry,n,e||null,i,this.errors)},c.prototype.error=function(t){for(var e=arguments,r=[],n=arguments.length-1;n-- >0;)r[n]=e[n+1];var i=""+this.key+r.map(function(t){return"["+t+"]"}).join("");this.errors.push(new a(i,t))},c.prototype.checkSubtype=function(t,e){var r=i(t,e);return r&&this.error(r),r},e.exports=c},{"./compound_expression":123,"./definitions/array":124,"./definitions/assertion":125,"./definitions/coercion":129,"./definitions/literal":134,"./definitions/var":137,"./evaluation_context":138,"./is_constant":140,"./parsing_error":142,"./scope":144,"./types":146}],142:[function(t,e,r){var n=function(t){function e(e,r){t.call(this,r),this.message=r,this.key=e}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);e.exports=n},{}],143:[function(t,e,r){var n=function(t){this.name="ExpressionEvaluationError",this.message=t};n.prototype.toJSON=function(){return this.message},e.exports=n},{}],144:[function(t,e,r){var n=function(t,e){void 0===e&&(e=[]),this.parent=t,this.bindings={};for(var r=0,n=e;rr&&ee))throw new n("Input is not a number.");o=s-1}}return Math.max(s-1,0)}}},{"./runtime_error":143}],146:[function(t,e,r){function n(t,e){return{kind:"array",itemType:t,N:e}}function i(t){if("array"===t.kind){var e=i(t.itemType);return"number"==typeof t.N?"array<"+e+", "+t.N+">":"value"===t.itemType.kind?"array":"array<"+e+">"}return t.kind}var a={kind:"null"},o={kind:"number"},s={kind:"string"},l={kind:"boolean"},u={kind:"color"},c={kind:"object"},h={kind:"value"},f=[a,o,s,l,u,c,n(h)];e.exports={NullType:a,NumberType:o,StringType:s,BooleanType:l,ColorType:u,ObjectType:c,ValueType:h,array:n,ErrorType:{kind:"error"},toString:i,checkSubtype:function t(e,r){if("error"===r.kind)return null;if("array"===e.kind){if("array"===r.kind&&!t(e.itemType,r.itemType)&&("number"!=typeof e.N||e.N===r.N))return null}else{if(e.kind===r.kind)return null;if("value"===e.kind)for(var n=0,a=f;n=0&&t<=255&&"number"==typeof e&&e>=0&&e<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:"Invalid rgba value ["+[t,e,r,n].join(", ")+"]: 'a' must be between 0 and 1.":"Invalid rgba value ["+("number"==typeof n?[t,e,r,n]:[t,e,r]).join(", ")+"]: 'r', 'g', and 'b' must be between 0 and 255."},isValue:function t(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof n)return!0;if(Array.isArray(e)){for(var r=0,i=e;r=2&&"$id"!==t[1]&&"$type"!==t[1];case"in":case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3===t.length&&(Array.isArray(t[1])||Array.isArray(t[2]));case"any":case"all":for(var e=0,r=t.slice(1);ee?1:0}function a(t){if(!t)return!0;var e=t[0];return t.length<=1?"any"!==e:"=="===e?o(t[1],t[2],"=="):"!="===e?u(o(t[1],t[2],"==")):"<"===e||">"===e||"<="===e||">="===e?o(t[1],t[2],e):"any"===e?function(t){return["any"].concat(t.map(a))}(t.slice(1)):"all"===e?["all"].concat(t.slice(1).map(a)):"none"===e?["all"].concat(t.slice(1).map(a).map(u)):"in"===e?s(t[1],t.slice(2)):"!in"===e?u(s(t[1],t.slice(2))):"has"===e?l(t[1]):"!has"!==e||u(l(t[1]))}function o(t,e,r){switch(t){case"$type":return["filter-type-"+r,e];case"$id":return["filter-id-"+r,e];default:return["filter-"+r,t,e]}}function s(t,e){if(0===e.length)return!1;switch(t){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(function(t){return typeof t!=typeof e[0]})?["filter-in-large",t,["literal",e.sort(i)]]:["filter-in-small",t,["literal",e]]}}function l(t){switch(t){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",t]}}function u(t){return["!",t]}var c=t("../expression").createExpression;e.exports=function(t){if(!t)return function(){return!0};n(t)||(t=a(t));var e=c(t,h);if("error"===e.result)throw new Error(e.value.map(function(t){return t.key+": "+t.message}).join(", "));return function(t,r){return e.value.evaluate(t,r)}},e.exports.isExpressionFilter=n;var h={type:"boolean",default:!1,function:!0,"property-function":!0,"zoom-function":!0}},{"../expression":139}],149:[function(t,e,r){function n(t){return t}function i(t,e,r){return void 0!==t?t:void 0!==e?e:void 0!==r?r:void 0}function a(t,e,r,n,a){return i(typeof r===a?n[r]:void 0,t.default,e.default)}function o(t,e,r){if("number"!==p(r))return i(t.default,e.default);var n=t.stops.length;if(1===n)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[n-1][0])return t.stops[n-1][1];var a=u(t.stops,r);return t.stops[a][1]}function s(t,e,r){var a=void 0!==t.base?t.base:1;if("number"!==p(r))return i(t.default,e.default);var o=t.stops.length;if(1===o)return t.stops[0][1];if(r<=t.stops[0][0])return t.stops[0][1];if(r>=t.stops[o-1][0])return t.stops[o-1][1];var s=u(t.stops,r),l=function(t,e,r,n){var i=n-r,a=t-r;return 0===i?0:1===e?a/i:(Math.pow(e,a)-1)/(Math.pow(e,i)-1)}(r,a,t.stops[s][0],t.stops[s+1][0]),h=t.stops[s][1],f=t.stops[s+1][1],g=d[e.type]||n;if(t.colorSpace&&"rgb"!==t.colorSpace){var v=c[t.colorSpace];g=function(t,e){return v.reverse(v.interpolate(v.forward(t),v.forward(e),l))}}return"function"==typeof h.evaluate?{evaluate:function(){for(var t=arguments,e=[],r=arguments.length;r--;)e[r]=t[r];var n=h.evaluate.apply(void 0,e),i=f.evaluate.apply(void 0,e);if(void 0!==n&&void 0!==i)return g(n,i,l)}}:g(h,f,l)}function l(t,e,r){return"color"===e.type?r=h.parse(r):p(r)===e.type||"enum"===e.type&&e.values[r]||(r=void 0),i(r,t.default,e.default)}function u(t,e){for(var r,n,i=0,a=t.length-1,o=0;i<=a;){if(r=t[o=Math.floor((i+a)/2)][0],n=t[o+1][0],e===r||e>r&&ee&&(a=o-1)}return Math.max(o-1,0)}var c=t("../util/color_spaces"),h=t("../util/color"),f=t("../util/extend"),p=t("../util/get_type"),d=t("../util/interpolate"),g=t("../expression/definitions/interpolate");e.exports={createFunction:function t(e,r){var n,u,p,d="color"===r.type,v=e.stops&&"object"==typeof e.stops[0][0],m=v||void 0!==e.property,y=v||!m,x=e.type||("interpolated"===r.function?"exponential":"interval");if(d&&((e=f({},e)).stops&&(e.stops=e.stops.map(function(t){return[t[0],h.parse(t[1])]})),e.default?e.default=h.parse(e.default):e.default=h.parse(r.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!c[e.colorSpace])throw new Error("Unknown color space: "+e.colorSpace);if("exponential"===x)n=s;else if("interval"===x)n=o;else if("categorical"===x){n=a,u=Object.create(null);for(var b=0,_=e.stops;b<_.length;b+=1){var w=_[b];u[w[0]]=w[1]}p=typeof e.stops[0][0]}else{if("identity"!==x)throw new Error('Unknown function type "'+x+'"');n=l}if(v){for(var M={},A=[],k=0;k":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:22,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},expression_name:{type:"enum",values:{let:{group:"Variable binding"},var:{group:"Variable binding"},literal:{group:"Types"},array:{group:"Types"},at:{group:"Lookup"},case:{group:"Decision"},match:{group:"Decision"},coalesce:{group:"Decision"},step:{group:"Ramps, scales, curves"},interpolate:{group:"Ramps, scales, curves"},ln2:{group:"Math"},pi:{group:"Math"},e:{group:"Math"},typeof:{group:"Types"},string:{group:"Types"},number:{group:"Types"},boolean:{group:"Types"},object:{group:"Types"},"to-string":{group:"Types"},"to-number":{group:"Types"},"to-boolean":{group:"Types"},"to-rgba":{group:"Color"},"to-color":{group:"Types"},rgb:{group:"Color"},rgba:{group:"Color"},get:{group:"Lookup"},has:{group:"Lookup"},length:{group:"Lookup"},properties:{group:"Feature data"},"geometry-type":{group:"Feature data"},id:{group:"Feature data"},zoom:{group:"Zoom"},"heatmap-density":{group:"Heatmap"},"+":{group:"Math"},"*":{group:"Math"},"-":{group:"Math"},"/":{group:"Math"},"%":{group:"Math"},"^":{group:"Math"},sqrt:{group:"Math"},log10:{group:"Math"},ln:{group:"Math"},log2:{group:"Math"},sin:{group:"Math"},cos:{group:"Math"},tan:{group:"Math"},asin:{group:"Math"},acos:{group:"Math"},atan:{group:"Math"},min:{group:"Math"},max:{group:"Math"},"==":{group:"Decision"},"!=":{group:"Decision"},">":{group:"Decision"},"<":{group:"Decision"},">=":{group:"Decision"},"<=":{group:"Decision"},all:{group:"Decision"},any:{group:"Decision"},"!":{group:"Decision"},upcase:{group:"String"},downcase:{group:"String"},concat:{group:"String"}}},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},transition:!1,"zoom-function":!0,"property-function":!1,function:"piecewise-constant"},position:{type:"array",default:[1.15,210,30],length:3,value:"number",transition:!0,function:"interpolated","zoom-function":!0,"property-function":!1},color:{type:"color",default:"#ffffff",function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},intensity:{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",function:"piecewise-constant","zoom-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,transition:!0,units:"pixels"},"fill-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-translate"]},"fill-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!1,default:1,minimum:0,maximum:1,transition:!0},"fill-extrusion-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,requires:[{"!":"fill-extrusion-pattern"}]},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],function:"interpolated","zoom-function":!0,transition:!0,units:"pixels"},"fill-extrusion-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"]},"fill-extrusion-pattern":{type:"string",function:"piecewise-constant","zoom-function":!0,transition:!0},"fill-extrusion-height":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0},"fill-extrusion-base":{type:"number",function:"interpolated","zoom-function":!0,"property-function":!0,default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"]}},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,transition:!0,units:"pixels"},"line-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-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,minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}]},"line-pattern":{type:"string",function:"piecewise-constant","zoom-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,transition:!0,units:"pixels"},"circle-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map",requires:["circle-translate"]},"circle-pitch-scale":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"map"},"circle-pitch-alignment":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"circle-stroke-width":{type:"number",default:0,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"circle-stroke-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!0,units:"pixels"},"heatmap-weight":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!0,transition:!1},"heatmap-intensity":{type:"number",default:1,minimum:0,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],function:"interpolated","zoom-function":!1,"property-function":!1,transition:!1},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,"property-function":!1,transition:!0}},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,transition:!0,units:"pixels",requires:["icon-image"]},"icon-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-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,transition:!0,units:"pixels",requires:["text-field"]},"text-translate-anchor":{type:"enum",function:"piecewise-constant","zoom-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:!1,units:"milliseconds"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,function:"interpolated","zoom-function":!0,transition:!1},"hillshade-illumination-anchor":{type:"enum",function:"piecewise-constant","zoom-function":!0,values:{map:{},viewport:{}},default:"viewport"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,function:"interpolated","zoom-function":!0,transition:!0},"hillshade-shadow-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",function:"interpolated","zoom-function":!0,transition:!0},"hillshade-accent-color":{type:"color",default:"#000000",function:"interpolated","zoom-function":!0,transition:!0}},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"}}}},{}],153:[function(t,e,r){var n=t("csscolorparser").parseCSSColor,i=function(t,e,r,n){void 0===n&&(n=1),this.r=t,this.g=e,this.b=r,this.a=n};i.parse=function(t){if(t){if(t instanceof i)return t;if("string"==typeof t){var e=n(t);if(e)return new i(e[0]/255*e[3],e[1]/255*e[3],e[2]/255*e[3],e[3])}}},i.prototype.toString=function(){var t=this;return"rgba("+[this.r,this.g,this.b].map(function(e){return Math.round(255*e/t.a)}).concat(this.a).join(",")+")"},i.black=new i(0,0,0,1),i.white=new i(1,1,1,1),i.transparent=new i(0,0,0,0),e.exports=i},{csscolorparser:13}],154:[function(t,e,r){function n(t){return t>m?Math.pow(t,1/3):t/v+d}function i(t){return t>g?t*t*t:v*(t-d)}function a(t){return 255*(t<=.0031308?12.92*t:1.055*Math.pow(t,1/2.4)-.055)}function o(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function s(t){var e=o(t.r),r=o(t.g),i=o(t.b),a=n((.4124564*e+.3575761*r+.1804375*i)/h),s=n((.2126729*e+.7151522*r+.072175*i)/f);return{l:116*s-16,a:500*(a-s),b:200*(s-n((.0193339*e+.119192*r+.9503041*i)/p)),alpha:t.a}}function l(t){var e=(t.l+16)/116,r=isNaN(t.a)?e:e+t.a/500,n=isNaN(t.b)?e:e-t.b/200;return e=f*i(e),r=h*i(r),n=p*i(n),new u(a(3.2404542*r-1.5371385*e-.4985314*n),a(-.969266*r+1.8760108*e+.041556*n),a(.0556434*r-.2040259*e+1.0572252*n),t.alpha)}var u=t("./color"),c=t("./interpolate").number,h=.95047,f=1,p=1.08883,d=4/29,g=6/29,v=3*g*g,m=g*g*g,y=Math.PI/180,x=180/Math.PI;e.exports={lab:{forward:s,reverse:l,interpolate:function(t,e,r){return{l:c(t.l,e.l,r),a:c(t.a,e.a,r),b:c(t.b,e.b,r),alpha:c(t.alpha,e.alpha,r)}}},hcl:{forward:function(t){var e=s(t),r=e.l,n=e.a,i=e.b,a=Math.atan2(i,n)*x;return{h:a<0?a+360:a,c:Math.sqrt(n*n+i*i),l:r,alpha:t.a}},reverse:function(t){var e=t.h*y,r=t.c;return l({l:t.l,a:Math.cos(e)*r,b:Math.sin(e)*r,alpha:t.alpha})},interpolate:function(t,e,r){return{h:function(t,e,r){var n=e-t;return t+r*(n>180||n<-180?n-360*Math.round(n/360):n)}(t.h,e.h,r),c:c(t.c,e.c,r),l:c(t.l,e.l,r),alpha:c(t.alpha,e.alpha,r)}}}}},{"./color":153,"./interpolate":158}],155:[function(t,e,r){e.exports=function t(e,r){if(Array.isArray(e)){if(!Array.isArray(r)||e.length!==r.length)return!1;for(var n=0;n0;)r[n]=e[n+1];for(var i=0,a=r;i":case">=":r.length>=2&&"$type"===s(r[1])&&c.push(new n(i,r,'"$type" cannot be use with operator "'+r[0]+'"'));case"==":case"!=":3!==r.length&&c.push(new n(i,r,'filter array for operator "'+r[0]+'" must have 3 elements'));case"in":case"!in":r.length>=2&&"string"!==(l=o(r[1]))&&c.push(new n(i+"[1]",r[1],"string expected, "+l+" found"));for(var h=2;hu(s[0].zoom))return[new n(c,s[0].zoom,"stop zoom values must appear in ascending order")];u(s[0].zoom)!==f&&(f=u(s[0].zoom),h=void 0,g={}),e=e.concat(o({key:c+"[0]",value:s[0],valueSpec:{zoom:{}},style:t.style,styleSpec:t.styleSpec,objectElementValidators:{zoom:l,value:r}}))}else e=e.concat(r({key:c+"[0]",value:s[0],valueSpec:{},style:t.style,styleSpec:t.styleSpec},s));return e.concat(a({key:c+"[1]",value:s[1],valueSpec:p,style:t.style,styleSpec:t.styleSpec}))}function r(t,e){var r=i(t.value),a=u(t.value),o=null!==t.value?t.value:e;if(c){if(r!==c)return[new n(t.key,o,r+" stop domain type must match previous stop domain type "+c)]}else c=r;if("number"!==r&&"string"!==r&&"boolean"!==r)return[new n(t.key,o,"stop domain value must be a number, string, or boolean")];if("number"!==r&&"categorical"!==d){var s="number expected, "+r+" found";return p["property-function"]&&void 0===d&&(s+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new n(t.key,o,s)]}return"categorical"!==d||"number"!==r||isFinite(a)&&Math.floor(a)===a?"categorical"!==d&&"number"===r&&void 0!==h&&a=8&&(m&&!t.valueSpec["property-function"]?x.push(new n(t.key,t.value,"property functions not supported")):v&&!t.valueSpec["zoom-function"]&&"heatmap-color"!==t.objectKey&&x.push(new n(t.key,t.value,"zoom functions not supported"))),"categorical"!==d&&!y||void 0!==t.value.property||x.push(new n(t.key,t.value,'"property" property is required')),x}},{"../error/validation_error":122,"../util/get_type":157,"../util/unbundle_jsonlint":161,"./validate":162,"./validate_array":163,"./validate_number":175,"./validate_object":176}],171:[function(t,e,r){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":122,"./validate_string":180}],172:[function(t,e,r){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"),u=t("./validate"),c=t("../util/extend");e.exports=function(t){var e=[],r=t.value,h=t.key,f=t.style,p=t.styleSpec;r.type||r.ref||e.push(new n(h,r,'either "type" or "ref" is required'));var d,g=i(r.type),v=i(r.ref);if(r.id)for(var m=i(r.id),y=0;ya.maximum?[new i(e,r,r+" is greater than the maximum value "+a.maximum)]:[]}},{"../error/validation_error":122,"../util/get_type":157}],176:[function(t,e,r){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,u=t.styleSpec,c=[],h=i(r);if("object"!==h)return[new n(e,r,"object expected, "+h+" found")];for(var f in r){var p=f.split(".")[0],d=o[p]||o["*"],g=void 0;if(s[p])g=s[p];else if(o[p])g=a;else if(s["*"])g=s["*"];else{if(!o["*"]){c.push(new n(e,r[f],'unknown property "'+f+'"'));continue}g=a}c=c.concat(g({key:(e?e+".":e)+f,value:r[f],valueSpec:d,style:l,styleSpec:u,object:r,objectKey:f},r))}for(var v in o)s[v]||o[v].required&&void 0===o[v].default&&void 0===r[v]&&c.push(new n(e,r,'missing required property "'+v+'"'));return c}},{"../error/validation_error":122,"../util/get_type":157,"./validate":162}],177:[function(t,e,r){var n=t("./validate_property");e.exports=function(t){return n(t,"paint")}},{"./validate_property":178}],178:[function(t,e,r){var n=t("./validate"),i=t("../error/validation_error"),a=t("../util/get_type"),o=t("../function").isFunction,s=t("../util/unbundle_jsonlint");e.exports=function(t,e){var r=t.key,l=t.style,u=t.styleSpec,c=t.value,h=t.objectKey,f=u[e+"_"+t.layerType];if(!f)return[];var p=h.match(/^(.*)-transition$/);if("paint"===e&&p&&f[p[1]]&&f[p[1]].transition)return n({key:r,value:c,valueSpec:u.transition,style:l,styleSpec:u});var d,g=t.valueSpec||f[h];if(!g)return[new i(r,c,'unknown property "'+h+'"')];if("string"===a(c)&&g["property-function"]&&!g.tokens&&(d=/^{([^}]+)}$/.exec(c)))return[new i(r,c,'"'+h+'" does not support interpolation syntax\nUse an identity property function instead: `{ "type": "identity", "property": '+JSON.stringify(d[1])+" }`.")];var v=[];return"symbol"===t.layerType&&("text-field"===h&&l&&!l.glyphs&&v.push(new i(r,c,'use of "text-field" requires a style "glyphs" property')),"text-font"===h&&o(s.deep(c))&&"identity"===s(c.type)&&v.push(new i(r,c,'"text-font" does not support identity functions'))),v.concat(n({key:t.key,value:c,valueSpec:g,style:l,styleSpec:u,expressionContext:"property",propertyKey:h}))}},{"../error/validation_error":122,"../function":149,"../util/get_type":157,"../util/unbundle_jsonlint":161,"./validate":162}],179:[function(t,e,r){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')];var u=i(e.type),c=[];switch(u){case"vector":case"raster":case"raster-dem":if(c=c.concat(a({key:r,value:e,valueSpec:s["source_"+u.replace("-","_")],style:t.style,styleSpec:s})),"url"in e)for(var h in e)["type","url","tileSize"].indexOf(h)<0&&c.push(new n(r+"."+h,e[h],'a source with a "url" property may not include a "'+h+'" property'));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});case"canvas":return a({key:r,value:e,valueSpec:s.source_canvas,style:l,styleSpec:s});default:return o({key:r+".type",value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image","canvas"]},style:l,styleSpec:s})}}},{"../error/validation_error":122,"../util/unbundle_jsonlint":161,"./validate_enum":167,"./validate_object":176}],180:[function(t,e,r){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, "+a+" found")]:[]}},{"../error/validation_error":122,"../util/get_type":157}],181:[function(t,e,r){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:u,"*":function(){return[]}}})),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"),u=t("./validate/validate_glyphs_url");n.source=a(t("./validate/validate_source")),n.light=a(t("./validate/validate_light")),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":151,"./validate/validate":162,"./validate/validate_constants":166,"./validate/validate_filter":169,"./validate/validate_glyphs_url":171,"./validate/validate_layer":172,"./validate/validate_layout_property":173,"./validate/validate_light":174,"./validate/validate_paint_property":177,"./validate/validate_source":179}],182:[function(t,e,r){var n=t("./zoom_history"),i=function(t,e){this.zoom=t,e?(this.now=e.now,this.fadeDuration=e.fadeDuration,this.zoomHistory=e.zoomHistory,this.transition=e.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new n,this.transition={})};i.prototype.crossFadingFactor=function(){return 0===this.fadeDuration?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)},e.exports=i},{"./zoom_history":212}],183:[function(t,e,r){var n=t("../style-spec/reference/latest"),i=t("../util/util"),a=t("../util/evented"),o=t("./validate_style"),s=t("../util/util").sphericalToCartesian,l=(t("../style-spec/util/color"),t("../style-spec/util/interpolate")),u=t("./properties"),c=u.Properties,h=u.Transitionable,f=(u.Transitioning,u.PossiblyEvaluated,u.DataConstantProperty),p=function(){this.specification=n.light.position};p.prototype.possiblyEvaluate=function(t,e){return s(t.expression.evaluate(e))},p.prototype.interpolate=function(t,e,r){return{x:l.number(t.x,e.x,r),y:l.number(t.y,e.y,r),z:l.number(t.z,e.z,r)}};var d=new c({anchor:new f(n.light.anchor),position:new p,color:new f(n.light.color),intensity:new f(n.light.intensity)}),g=function(t){function e(e){t.call(this),this._transitionable=new h(d),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getLight=function(){return this._transitionable.serialize()},e.prototype.setLight=function(t){if(!this._validate(o.light,t))for(var e in t){var r=t[e];i.endsWith(e,"-transition")?this._transitionable.setTransition(e.slice(0,-"-transition".length),r):this._transitionable.setValue(e,r)}},e.prototype.updateTransitions=function(t){this._transitioning=this._transitionable.transitioned(t,this._transitioning)},e.prototype.hasTransition=function(){return this._transitioning.hasTransition()},e.prototype.recalculate=function(t){this.properties=this._transitioning.possiblyEvaluate(t)},e.prototype._validate=function(t,e){return o.emitErrors(this,t.call(o,i.extend({value:e,style:{glyphs:!0,sprite:!0},styleSpec:n})))},e}(a);e.exports=g},{"../style-spec/reference/latest":151,"../style-spec/util/color":153,"../style-spec/util/interpolate":158,"../util/evented":260,"../util/util":275,"./properties":188,"./validate_style":211}],184:[function(t,e,r){var n=t("../util/mapbox").normalizeGlyphsURL,i=t("../util/ajax"),a=t("./parse_glyph_pbf");e.exports=function(t,e,r,o,s){var l=256*e,u=l+255,c=o(n(r).replace("{fontstack}",t).replace("{range}",l+"-"+u),i.ResourceType.Glyphs);i.getArrayBuffer(c,function(t,e){if(t)s(t);else if(e){for(var r={},n=0,i=a(e.data);n1?"@2x":"";n.getJSON(e(a(t,h,".json"),n.ResourceType.SpriteJSON),function(t,e){c||(c=t,l=e,s())}),n.getImage(e(a(t,h,".png"),n.ResourceType.SpriteImage),function(t,e){c||(c=t,u=e,s())})}},{"../util/ajax":251,"../util/browser":252,"../util/image":263,"../util/mapbox":267}],186:[function(t,e,r){function n(t,e,r){1===t&&r.readMessage(i,e)}function i(t,e,r){if(3===t){var n=r.readMessage(a,{}),i=n.id,s=n.bitmap,u=n.width,c=n.height,h=n.left,f=n.top,p=n.advance;e.push({id:i,bitmap:new o({width:u+2*l,height:c+2*l},s),metrics:{width:u,height:c,left:h,top:f,advance:p}})}}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())}var o=t("../util/image").AlphaImage,s=t("pbf"),l=3;e.exports=function(t){return new s(t).readFields(n,[])},e.exports.GLYPH_PBF_BORDER=l},{"../util/image":263,pbf:30}],187:[function(t,e,r){var n=t("../util/browser"),i=t("../symbol/placement"),a=function(){this._currentTileIndex=0,this._seenCrossTileIDs={}};a.prototype.continuePlacement=function(t,e,r,n,i){for(var a=this;this._currentTileIndex2};this._currentPlacementIndex>=0;){var l=e[t[i._currentPlacementIndex]],u=i.placement.collisionIndex.transform.zoom;if("symbol"===l.type&&(!l.minzoom||l.minzoom<=u)&&(!l.maxzoom||l.maxzoom>u)){if(i._inProgressLayer||(i._inProgressLayer=new a),i._inProgressLayer.continuePlacement(r[l.source],i.placement,i._showCollisionBoxes,l,s))return;delete i._inProgressLayer}i._currentPlacementIndex--}this._done=!0},o.prototype.commit=function(t,e){return this.placement.commit(t,e),this.placement},e.exports=o},{"../symbol/placement":223,"../util/browser":252}],188:[function(t,e,r){var n=t("../util/util"),i=n.clone,a=n.extend,o=n.easeCubicInOut,s=t("../style-spec/util/interpolate"),l=t("../style-spec/expression").normalizePropertyExpression,u=(t("../style-spec/util/color"),t("../util/web_worker_transfer").register),c=function(t,e){this.property=t,this.value=e,this.expression=l(void 0===e?t.specification.default:e,t.specification)};c.prototype.isDataDriven=function(){return"source"===this.expression.kind||"composite"===this.expression.kind},c.prototype.possiblyEvaluate=function(t){return this.property.possiblyEvaluate(this,t)};var h=function(t){this.property=t,this.value=new c(t,void 0)};h.prototype.transitioned=function(t,e){return new p(this.property,this.value,e,a({},t.transition,this.transition),t.now)},h.prototype.untransitioned=function(){return new p(this.property,this.value,null,{},0)};var f=function(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)};f.prototype.getValue=function(t){return i(this._values[t].value.value)},f.prototype.setValue=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new h(this._values[t].property)),this._values[t].value=new c(this._values[t].property,null===e?void 0:i(e))},f.prototype.getTransition=function(t){return i(this._values[t].transition)},f.prototype.setTransition=function(t,e){this._values.hasOwnProperty(t)||(this._values[t]=new h(this._values[t].property)),this._values[t].transition=i(e)||void 0},f.prototype.serialize=function(){for(var t=this,e={},r=0,n=Object.keys(t._values);rthis.end)return this.prior=null,r;if(this.value.isDataDriven())return this.prior=null,r;if(en.zoomHistory.lastIntegerZoom?{from:t,to:e,fromScale:2,toScale:1,t:a+(1-a)*o}:{from:r,to:e,fromScale:.5,toScale:1,t:1-(1-o)*a}},b.prototype.interpolate=function(t){return t};var _=function(t){this.specification=t};_.prototype.possiblyEvaluate=function(){},_.prototype.interpolate=function(){};u("DataDrivenProperty",x),u("DataConstantProperty",y),u("CrossFadedProperty",b),u("HeatmapColorProperty",_),e.exports={PropertyValue:c,Transitionable:f,Transitioning:d,Layout:g,PossiblyEvaluatedPropertyValue:v,PossiblyEvaluated:m,DataConstantProperty:y,DataDrivenProperty:x,CrossFadedProperty:b,HeatmapColorProperty:_,Properties:function(t){var e=this;for(var r in this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},t){var n=t[r],i=e.defaultPropertyValues[r]=new c(n,void 0),a=e.defaultTransitionablePropertyValues[r]=new h(n);e.defaultTransitioningPropertyValues[r]=a.untransitioned(),e.defaultPossiblyEvaluatedValues[r]=i.possiblyEvaluate({})}}}},{"../style-spec/expression":139,"../style-spec/util/color":153,"../style-spec/util/interpolate":158,"../util/util":275,"../util/web_worker_transfer":278}],189:[function(t,e,r){var n=t("@mapbox/point-geometry");e.exports={getMaximumPaintValue:function(t,e,r){var n=e.paint.get(t).value;return"constant"===n.kind?n.value:r.programConfigurations.get(e.id).binders[t].statistics.max},translateDistance:function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1])},translate:function(t,e,r,i,a){if(!e[0]&&!e[1])return t;var o=n.convert(e);"viewport"===r&&o._rotate(-i);for(var s=[],l=0;l0)throw new Error("Unimplemented: "+n.map(function(t){return t.command}).join(", ")+".");return r.forEach(function(t){"setTransition"!==t.command&&e[t.command].apply(e,t.args)}),this.stylesheet=t,!0},e.prototype.addImage=function(t,e){if(this.getImage(t))return this.fire("error",{error:new Error("An image with this name already exists.")});this.imageManager.addImage(t,e),this.fire("data",{dataType:"style"})},e.prototype.getImage=function(t){return this.imageManager.getImage(t)},e.prototype.removeImage=function(t){if(!this.getImage(t))return this.fire("error",{error:new Error("No image with this name exists.")});this.imageManager.removeImage(t),this.fire("data",{dataType:"style"})},e.prototype.addSource=function(t,e,r){var n=this;if(this._checkLoaded(),void 0!==this.sourceCaches[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).join(", ")+".");if(!(["vector","raster","geojson","video","image","canvas"].indexOf(e.type)>=0&&this._validate(g.source,"sources."+t,e,null,r))){this.map&&this.map._collectResourceTiming&&(e.collectResourceTiming=!0);var i=this.sourceCaches[t]=new x(t,e,this.dispatcher);i.style=this,i.setEventedParent(this,function(){return{isSourceLoaded:n.loaded(),source:i.serialize(),sourceId:t}}),i.onAdd(this.map),this._changed=!0}},e.prototype.removeSource=function(t){var e=this;if(this._checkLoaded(),void 0===this.sourceCaches[t])throw new Error("There is no source with this ID");for(var r in e._layers)if(e._layers[r].source===t)return e.fire("error",{error:new Error('Source "'+t+'" cannot be removed while layer "'+r+'" is using it.')});var n=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],n.fire("data",{sourceDataType:"metadata",dataType:"source",sourceId:t}),n.setEventedParent(null),n.clearTiles(),n.onRemove&&n.onRemove(this.map),this._changed=!0},e.prototype.setGeoJSONSourceData=function(t,e){this._checkLoaded(),this.sourceCaches[t].getSource().setData(e),this._changed=!0},e.prototype.getSource=function(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()},e.prototype.addLayer=function(t,e,r){this._checkLoaded();var n=t.id;if("object"==typeof t.source&&(this.addSource(n,t.source),t=c.clone(t),t=c.extend(t,{source:n})),!this._validate(g.layer,"layers."+n,t,{arrayIndex:-1},r)){var a=i.create(t);this._validateLayer(a),a.setEventedParent(this,{layer:{id:n}});var o=e?this._order.indexOf(e):this._order.length;if(e&&-1===o)return void this.fire("error",{error:new Error('Layer with id "'+e+'" does not exist on this map.')});if(this._order.splice(o,0,n),this._layerOrderChanged=!0,this._layers[n]=a,this._removedLayers[n]&&a.source){var s=this._removedLayers[n];delete this._removedLayers[n],s.type!==a.type?this._updatedSources[a.source]="clear":(this._updatedSources[a.source]="reload",this.sourceCaches[a.source].pause())}this._updateLayer(a)}},e.prototype.moveLayer=function(t,e){if(this._checkLoaded(),this._changed=!0,this._layers[t]){var r=this._order.indexOf(t);this._order.splice(r,1);var n=e?this._order.indexOf(e):this._order.length;e&&-1===n?this.fire("error",{error:new Error('Layer with id "'+e+'" does not exist on this map.')}):(this._order.splice(n,0,t),this._layerOrderChanged=!0)}else this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be moved.")})},e.prototype.removeLayer=function(t){this._checkLoaded();var e=this._layers[t];if(e){e.setEventedParent(null);var r=this._order.indexOf(t);this._order.splice(r,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=e,delete this._layers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t]}else this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be removed.")})},e.prototype.getLayer=function(t){return this._layers[t]},e.prototype.setLayerZoomRange=function(t,e,r){this._checkLoaded();var n=this.getLayer(t);n?n.minzoom===e&&n.maxzoom===r||(null!=e&&(n.minzoom=e),null!=r&&(n.maxzoom=r),this._updateLayer(n)):this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot have zoom extent.")})},e.prototype.setFilter=function(t,e){this._checkLoaded();var r=this.getLayer(t);if(r)return c.deepEqual(r.filter,e)?void 0:null===e||void 0===e?(r.filter=void 0,void this._updateLayer(r)):void(this._validate(g.filter,"layers."+r.id+".filter",e)||(r.filter=c.clone(e),this._updateLayer(r)));this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be filtered.")})},e.prototype.getFilter=function(t){return c.clone(this.getLayer(t).filter)},e.prototype.setLayoutProperty=function(t,e,r){this._checkLoaded();var n=this.getLayer(t);n?c.deepEqual(n.getLayoutProperty(e),r)||(n.setLayoutProperty(e,r),this._updateLayer(n)):this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be styled.")})},e.prototype.getLayoutProperty=function(t,e){return this.getLayer(t).getLayoutProperty(e)},e.prototype.setPaintProperty=function(t,e,r){this._checkLoaded();var n=this.getLayer(t);if(n){if(!c.deepEqual(n.getPaintProperty(e),r)){var i=n._transitionablePaint._values[e].value.isDataDriven();n.setPaintProperty(e,r),(n._transitionablePaint._values[e].value.isDataDriven()||i)&&this._updateLayer(n),this._changed=!0,this._updatedPaintProps[t]=!0}}else this.fire("error",{error:new Error("The layer '"+t+"' does not exist in the map's style and cannot be styled.")})},e.prototype.getPaintProperty=function(t,e){return this.getLayer(t).getPaintProperty(e)},e.prototype.getTransition=function(){return c.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)},e.prototype.serialize=function(){var t=this;return c.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:c.mapObject(this.sourceCaches,function(t){return t.serialize()}),layers:this._order.map(function(e){return t._layers[e].serialize()})},function(t){return void 0!==t})},e.prototype._updateLayer=function(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0},e.prototype._flattenRenderedFeatures=function(t){for(var e=[],r=this._order.length-1;r>=0;r--)for(var n=this._order[r],i=0,a=t;i=this.maxzoom)||"none"===this.visibility},e.prototype.updateTransitions=function(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)},e.prototype.hasTransition=function(){return this._transitioningPaint.hasTransition()},e.prototype.recalculate=function(t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t)),this.paint=this._transitioningPaint.possiblyEvaluate(t)},e.prototype.serialize=function(){var t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return"none"===this.visibility&&(t.layout=t.layout||{},t.layout.visibility="none"),n.filterObject(t,function(t,e){return!(void 0===t||"layout"===e&&!Object.keys(t).length||"paint"===e&&!Object.keys(t).length)})},e.prototype._validate=function(t,e,r,n,o){return(!o||!1!==o.validate)&&a.emitErrors(this,t.call(a,{key:e,layerType:this.type,objectKey:r,value:n,styleSpec:i,style:{glyphs:!0,sprite:!0}}))},e.prototype.hasOffscreenPass=function(){return!1},e.prototype.resize=function(){},e}(o));e.exports=c;var h={circle:t("./style_layer/circle_style_layer"),heatmap:t("./style_layer/heatmap_style_layer"),hillshade:t("./style_layer/hillshade_style_layer"),fill:t("./style_layer/fill_style_layer"),"fill-extrusion":t("./style_layer/fill_extrusion_style_layer"),line:t("./style_layer/line_style_layer"),symbol:t("./style_layer/symbol_style_layer"),background:t("./style_layer/background_style_layer"),raster:t("./style_layer/raster_style_layer")};c.create=function(t){return new h[t.type](t)}},{"../style-spec/reference/latest":151,"../util/evented":260,"../util/util":275,"./properties":188,"./style_layer/background_style_layer":192,"./style_layer/circle_style_layer":194,"./style_layer/fill_extrusion_style_layer":196,"./style_layer/fill_style_layer":198,"./style_layer/heatmap_style_layer":200,"./style_layer/hillshade_style_layer":202,"./style_layer/line_style_layer":204,"./style_layer/raster_style_layer":206,"./style_layer/symbol_style_layer":208,"./validate_style":211}],192:[function(t,e,r){var n=t("../style_layer"),i=t("./background_style_layer_properties"),a=t("../properties"),o=(a.Transitionable,a.Transitioning,a.PossiblyEvaluated,function(t){function e(e){t.call(this,e,i)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(n));e.exports=o},{"../properties":188,"../style_layer":191,"./background_style_layer_properties":193}],193:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=(i.DataDrivenProperty,i.CrossFadedProperty),l=(i.HeatmapColorProperty,new a({"background-color":new o(n.paint_background["background-color"]),"background-pattern":new s(n.paint_background["background-pattern"]),"background-opacity":new o(n.paint_background["background-opacity"])}));e.exports={paint:l}},{"../../style-spec/reference/latest":151,"../properties":188}],194:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/circle_bucket"),a=t("../../util/intersection_tests").multiPolygonIntersectsBufferedMultiPoint,o=t("../query_utils"),s=o.getMaximumPaintValue,l=o.translateDistance,u=o.translate,c=t("./circle_style_layer_properties"),h=t("../properties"),f=(h.Transitionable,h.Transitioning,h.PossiblyEvaluated,function(t){function e(e){t.call(this,e,c)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new i(t)},e.prototype.queryRadius=function(t){var e=t;return s("circle-radius",this,e)+s("circle-stroke-width",this,e)+l(this.paint.get("circle-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var s=u(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),i,o),l=this.paint.get("circle-radius").evaluate(e)*o,c=this.paint.get("circle-stroke-width").evaluate(e)*o;return a(s,r,l+c)},e}(n));e.exports=f},{"../../data/bucket/circle_bucket":42,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./circle_style_layer_properties":195}],195:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=i.DataDrivenProperty,l=(i.CrossFadedProperty,i.HeatmapColorProperty,new a({"circle-radius":new s(n.paint_circle["circle-radius"]),"circle-color":new s(n.paint_circle["circle-color"]),"circle-blur":new s(n.paint_circle["circle-blur"]),"circle-opacity":new s(n.paint_circle["circle-opacity"]),"circle-translate":new o(n.paint_circle["circle-translate"]),"circle-translate-anchor":new o(n.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new o(n.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new o(n.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new s(n.paint_circle["circle-stroke-width"]),"circle-stroke-color":new s(n.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new s(n.paint_circle["circle-stroke-opacity"])}));e.exports={paint:l}},{"../../style-spec/reference/latest":151,"../properties":188}],196:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/fill_extrusion_bucket"),a=t("../../util/intersection_tests").multiPolygonIntersectsMultiPolygon,o=t("../query_utils"),s=o.translateDistance,l=o.translate,u=t("./fill_extrusion_style_layer_properties"),c=t("../properties"),h=(c.Transitionable,c.Transitioning,c.PossiblyEvaluated,function(t){function e(e){t.call(this,e,u)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new i(t)},e.prototype.queryRadius=function(){return s(this.paint.get("fill-extrusion-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var s=l(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),i,o);return a(s,r)},e.prototype.hasOffscreenPass=function(){return 0!==this.paint.get("fill-extrusion-opacity")&&"none"!==this.visibility},e.prototype.resize=function(){this.viewportFrame&&(this.viewportFrame.destroy(),this.viewportFrame=null)},e}(n));e.exports=h},{"../../data/bucket/fill_extrusion_bucket":46,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./fill_extrusion_style_layer_properties":197}],197:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=i.DataDrivenProperty,l=i.CrossFadedProperty,u=(i.HeatmapColorProperty,new a({"fill-extrusion-opacity":new o(n["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new s(n["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new o(n["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new o(n["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new l(n["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new s(n["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new s(n["paint_fill-extrusion"]["fill-extrusion-base"])}));e.exports={paint:u}},{"../../style-spec/reference/latest":151,"../properties":188}],198:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/fill_bucket"),a=t("../../util/intersection_tests").multiPolygonIntersectsMultiPolygon,o=t("../query_utils"),s=o.translateDistance,l=o.translate,u=t("./fill_style_layer_properties"),c=t("../properties"),h=(c.Transitionable,c.Transitioning,c.PossiblyEvaluated,function(t){function e(e){t.call(this,e,u)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(t){this.paint=this._transitioningPaint.possiblyEvaluate(t),void 0===this._transitionablePaint.getValue("fill-outline-color")&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])},e.prototype.createBucket=function(t){return new i(t)},e.prototype.queryRadius=function(){return s(this.paint.get("fill-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,n,i,o){var s=l(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),i,o);return a(s,r)},e}(n));e.exports=h},{"../../data/bucket/fill_bucket":44,"../../util/intersection_tests":264,"../properties":188,"../query_utils":189,"../style_layer":191,"./fill_style_layer_properties":199}],199:[function(t,e,r){var n=t("../../style-spec/reference/latest"),i=t("../properties"),a=i.Properties,o=i.DataConstantProperty,s=i.DataDrivenProperty,l=i.CrossFadedProperty,u=(i.HeatmapColorProperty,new a({"fill-antialias":new o(n.paint_fill["fill-antialias"]),"fill-opacity":new s(n.paint_fill["fill-opacity"]),"fill-color":new s(n.paint_fill["fill-color"]),"fill-outline-color":new s(n.paint_fill["fill-outline-color"]),"fill-translate":new o(n.paint_fill["fill-translate"]),"fill-translate-anchor":new o(n.paint_fill["fill-translate-anchor"]),"fill-pattern":new l(n.paint_fill["fill-pattern"])}));e.exports={paint:u}},{"../../style-spec/reference/latest":151,"../properties":188}],200:[function(t,e,r){var n=t("../style_layer"),i=t("../../data/bucket/heatmap_bucket"),a=t("../../util/image").RGBAImage,o=t("./heatmap_style_layer_properties"),s=t("../properties"),l=(s.Transitionable,s.Transitioning,s.PossiblyEvaluated,function(t){function e(e){t.call(this,e,o),this._updateColorRamp()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.createBucket=function(t){return new i(t)},e.prototype.setPaintProperty=function(e,r,n){t.prototype.setPaintProperty.call(this,e,r,n),"heatmap-color"===e&&this._updateColorRamp()},e.prototype._updateColorRamp=function(){for(var t=this._transitionablePaint._values["heatmap-color"].value.expression,e=new Uint8Array(1024),r=e.length,n=4;n0?e+2*t:t}var i=t("@mapbox/point-geometry"),a=t("../style_layer"),o=t("../../data/bucket/line_bucket"),s=t("../../util/intersection_tests").multiPolygonIntersectsBufferedMultiLine,l=t("../query_utils"),u=l.getMaximumPaintValue,c=l.translateDistance,h=l.translate,f=t("./line_style_layer_properties"),p=t("../../util/util").extend,d=t("../evaluation_parameters"),g=t("../properties"),v=(g.Transitionable,g.Transitioning,g.Layout,g.PossiblyEvaluated,new(function(t){function e(){t.apply(this,arguments)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.possiblyEvaluate=function(e,r){return r=new d(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),t.prototype.possiblyEvaluate.call(this,e,r)},e.prototype.evaluate=function(e,r,n){return r=p({},r,{zoom:Math.floor(r.zoom)}),t.prototype.evaluate.call(this,e,r,n)},e}(g.DataDrivenProperty))(f.paint.properties["line-width"].specification));v.useIntegerZoom=!0;var m=function(t){function e(e){t.call(this,e,f)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.recalculate=function(e){t.prototype.recalculate.call(this,e),this.paint._values["line-floorwidth"]=v.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)},e.prototype.createBucket=function(t){return new o(t)},e.prototype.queryRadius=function(t){var e=t,r=n(u("line-width",this,e),u("line-gap-width",this,e)),i=u("line-offset",this,e);return r/2+Math.abs(i)+c(this.paint.get("line-translate"))},e.prototype.queryIntersectsFeature=function(t,e,r,a,o,l){var u=h(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),o,l),c=l/2*n(this.paint.get("line-width").evaluate(e),this.paint.get("line-gap-width").evaluate(e)),f=this.paint.get("line-offset").evaluate(e);return f&&(r=function(t,e){for(var r=[],n=new i(0,0),a=0;ar?(this.lastIntegerZoom=r+1,this.lastIntegerZoomTime=e):this.lastFloorZoom-r/2;){if(--o<0)return!1;s-=t[o].dist(a),a=t[o]}s+=t[o].dist(t[o+1]),o++;for(var l=[],u=0;sn;)u-=l.shift().angleDelta;if(u>i)return!1;o++,s+=h.dist(f)}return!0}},{}],215:[function(t,e,r){var n=t("@mapbox/point-geometry");e.exports=function(t,e,r,i,a){for(var o=[],s=0;s=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()),u&&h.equals(u[u.length-1])||(u=[h],o.push(u)),u.push(f)))))}return o}},{"@mapbox/point-geometry":4}],216:[function(t,e,r){var n=function(t,e,r,n,i,a,o,s,l,u,c){var h=o.top*s-l,f=o.bottom*s+l,p=o.left*s-l,d=o.right*s+l;if(this.boxStartIndex=t.length,u){var g=f-h,v=d-p;g>0&&(g=Math.max(10*s,g),this._addLineCollisionCircles(t,e,r,r.segment,v,g,n,i,a,c))}else t.emplaceBack(r.x,r.y,p,h,d,f,n,i,a,0,0);this.boxEndIndex=t.length};n.prototype._addLineCollisionCircles=function(t,e,r,n,i,a,o,s,l,u){var c=a/2,h=Math.floor(i/c),f=1+.4*Math.log(u)/Math.LN2,p=Math.floor(h*f/2),d=-a/2,g=r,v=n+1,m=d,y=-i/2,x=y-i/4;do{if(--v<0){if(m>y)return;v=0;break}m-=e[v].dist(g),g=e[v]}while(m>x);for(var b=e[v].dist(e[v+1]),_=-p;_i&&(M+=w-i),!(M=e.length)return;b=e[v].dist(e[v+1])}var A=M-m,k=e[v],T=e[v+1].sub(k)._unit()._mult(A)._add(k)._round(),S=Math.abs(M-d)L)n(t,z,!1);else{var R=v.projectPoint(f,P,I),F=D*S;if(m.length>0){var B=R.x-m[m.length-4],N=R.y-m[m.length-3];if(F*F*2>B*B+N*N&&z+8-C&&j=this.screenRightBoundary||n<100||e>this.screenBottomBoundary},e.exports=l},{"../symbol/projection":224,"../util/intersection_tests":264,"./grid_index":220,"@mapbox/gl-matrix":2,"@mapbox/point-geometry":4}],218:[function(t,e,r){var n=t("../data/extent"),i=512/n/2,a=function(t,e,r){var n=this;this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=r;for(var i=0,a=e;it.overscaledZ)for(var u in l){var c=l[u];c.tileID.isChildOf(t)&&c.findMatches(e.symbolInstances,t,o)}else{var h=l[t.scaledTo(Number(s)).key];h&&h.findMatches(e.symbolInstances,t,o)}}for(var f=0,p=e.symbolInstances;f=0&&k=0&&T=0&&m+p<=d){var S=new i(k,T,M,x);S._round(),s&&!a(e,S,u,s,l)||y.push(S)}}v+=w}return h||y.length||c||(y=t(e,v/2,o,s,l,u,c,!0,f)),y}(t,d?e/2*c%e:(p/2+2*l)*u*c%e,e,f,r,p*u,d,!1,h)}},{"../style-spec/util/interpolate":158,"../symbol/anchor":213,"./check_max_angle":214}],220:[function(t,e,r){var n=function(t,e,r){var n=this.boxCells=[],i=this.circleCells=[];this.xCellCount=Math.ceil(t/r),this.yCellCount=Math.ceil(e/r);for(var a=0;athis.width||n<0||e>this.height)return!i&&[];var a=[];if(t<=0&&e<=0&&this.width<=r&&this.height<=n)a=Array.prototype.slice.call(this.boxKeys).concat(this.circleKeys);else{var o={hitTest:i,seenUids:{box:{},circle:{}}};this._forEachCell(t,e,r,n,this._queryCell,a,o)}return i?a.length>0:a},n.prototype._queryCircle=function(t,e,r,n){var i=t-r,a=t+r,o=e-r,s=e+r;if(a<0||i>this.width||s<0||o>this.height)return!n&&[];var l=[],u={hitTest:n,circle:{x:t,y:e,radius:r},seenUids:{box:{},circle:{}}};return this._forEachCell(i,o,a,s,this._queryCellCircle,l,u),n?l.length>0:l},n.prototype.query=function(t,e,r,n){return this._query(t,e,r,n,!1)},n.prototype.hitTest=function(t,e,r,n){return this._query(t,e,r,n,!0)},n.prototype.hitTestCircle=function(t,e,r){return this._queryCircle(t,e,r,!0)},n.prototype._queryCell=function(t,e,r,n,i,a,o){var s=this,l=o.seenUids,u=this.boxCells[i];if(null!==u)for(var c=this.bboxes,h=0,f=u;h=c[d+0]&&n>=c[d+1]){if(o.hitTest)return a.push(!0),!0;a.push(s.boxKeys[p])}}}var g=this.circleCells[i];if(null!==g)for(var v=this.circles,m=0,y=g;mo*o+s*s},n.prototype._circleAndRectCollide=function(t,e,r,n,i,a,o){var s=(a-n)/2,l=Math.abs(t-(n+s));if(l>s+r)return!1;var u=(o-i)/2,c=Math.abs(e-(i+u));if(c>u+r)return!1;if(l<=s||c<=u)return!0;var h=l-s,f=c-u;return h*h+f*f<=r*r},e.exports=n},{}],221:[function(t,e,r){e.exports=function(t){function e(e){s.push(t[e]),l++}function r(t,e,r){var n=o[t];return delete o[t],o[e]=n,s[n].geometry[0].pop(),s[n].geometry[0]=s[n].geometry[0].concat(r[0]),n}function n(t,e,r){var n=a[e];return delete a[e],a[t]=n,s[n].geometry[0].shift(),s[n].geometry[0]=r[0].concat(s[n].geometry[0]),n}function i(t,e,r){var n=r?e[0][e[0].length-1]:e[0][0];return t+":"+n.x+":"+n.y}for(var a={},o={},s=[],l=0,u=0;u0,A=A&&k.offscreen);var E=_.collisionArrays.textCircles;if(E){var C=t.text.placedSymbolArray.get(_.placedTextSymbolIndices[0]),L=s.evaluateSizeForFeature(t.textSizeData,v,C);T=d.collisionIndex.placeCollisionCircles(E,g.get("text-allow-overlap"),i,a,_.key,C,t.lineVertexArray,t.glyphOffsetArray,L,e,r,o,"map"===g.get("text-pitch-alignment")),w=g.get("text-allow-overlap")||T.circles.length>0,A=A&&T.offscreen}_.collisionArrays.iconBox&&(M=(S=d.collisionIndex.placeCollisionBox(_.collisionArrays.iconBox,g.get("icon-allow-overlap"),a,e)).box.length>0,A=A&&S.offscreen),m||y?y?m||(M=M&&w):w=M&&w:M=w=M&&w,w&&k&&d.collisionIndex.insertCollisionBox(k.box,g.get("text-ignore-placement"),h,f,t.bucketInstanceId,_.textBoxStartIndex),M&&S&&d.collisionIndex.insertCollisionBox(S.box,g.get("icon-ignore-placement"),h,f,t.bucketInstanceId,_.iconBoxStartIndex),w&&T&&d.collisionIndex.insertCollisionCircles(T.circles,g.get("text-ignore-placement"),h,f,t.bucketInstanceId,_.textBoxStartIndex),d.placements[_.crossTileID]=new p(w,M,A||t.justReloaded),l[_.crossTileID]=!0}}t.justReloaded=!1},d.prototype.commit=function(t,e){var r=this;this.commitTime=e;var n=!1,i=t&&0!==this.fadeDuration?(this.commitTime-t.commitTime)/this.fadeDuration:1,a=t?t.opacities:{};for(var o in r.placements){var s=r.placements[o],l=a[o];l?(r.opacities[o]=new f(l,i,s.text,s.icon),n=n||s.text!==l.text.placed||s.icon!==l.icon.placed):(r.opacities[o]=new f(null,i,s.text,s.icon,s.skipFade),n=n||s.text||s.icon)}for(var u in a){var c=a[u];if(!r.opacities[u]){var h=new f(c,i,!1,!1);h.isHidden()||(r.opacities[u]=h,n=n||c.text.placed||c.icon.placed)}}n?this.lastPlacementChangeTime=e:"number"!=typeof this.lastPlacementChangeTime&&(this.lastPlacementChangeTime=t?t.lastPlacementChangeTime:e)},d.prototype.updateLayerOpacities=function(t,e){for(var r={},n=0,i=e;n0||l.numVerticalGlyphVertices>0,p=l.numIconVertices>0;if(h){for(var d=i(c.text),g=(l.numGlyphVertices+l.numVerticalGlyphVertices)/4,v=0;vt},d.prototype.setStale=function(){this.stale=!0};var g=Math.pow(2,25),v=Math.pow(2,24),m=Math.pow(2,17),y=Math.pow(2,16),x=Math.pow(2,9),b=Math.pow(2,8),_=Math.pow(2,1);e.exports=d},{"../data/extent":53,"../source/pixels_to_tile_units":104,"../style/style_layer/symbol_style_layer_properties":209,"./collision_index":217,"./projection":224,"./symbol_size":228}],224:[function(t,e,r){function n(t,e){var r=[t.x,t.y,0,1];h(r,r,e);var n=r[3];return{point:new f(r[0]/n,r[1]/n),signedDistanceFromCamera:n}}function i(t,e){var r=t[0]/t[3],n=t[1]/t[3];return r>=-e[0]&&r<=e[0]&&n>=-e[1]&&n<=e[1]}function a(t,e,r,n,i,a,o,s,l,c,h,f){var p=s.glyphStartIndex+s.numGlyphs,d=s.lineStartIndex,g=s.lineStartIndex+s.lineLength,v=e.getoffsetX(s.glyphStartIndex),m=e.getoffsetX(p-1),y=u(t*v,r,n,i,a,o,s.segment,d,g,l,c,h,f);if(!y)return null;var x=u(t*m,r,n,i,a,o,s.segment,d,g,l,c,h,f);return x?{first:y,last:x}:null}function o(t,e,r,n){return t===x.horizontal&&Math.abs(r.y-e.y)>Math.abs(r.x-e.x)*n?{useVertical:!0}:(t===x.vertical?e.yr.x)?{needsFlipping:!0}:null}function s(t,e,r,i,s,c,h,p,d,g,v,y,x,b){var _,w=e/24,M=t.lineOffsetX*e,A=t.lineOffsetY*e;if(t.numGlyphs>1){var k=t.glyphStartIndex+t.numGlyphs,T=t.lineStartIndex,S=t.lineStartIndex+t.lineLength,E=a(w,p,M,A,r,v,y,t,d,c,x,!1);if(!E)return{notEnoughRoom:!0};var C=n(E.first.point,h).point,L=n(E.last.point,h).point;if(i&&!r){var z=o(t.writingMode,C,L,b);if(z)return z}_=[E.first];for(var P=t.glyphStartIndex+1;P0?R.point:l(y,O,I,1,s),B=o(t.writingMode,I,F,b);if(B)return B}var N=u(w*p.getoffsetX(t.glyphStartIndex),M,A,r,v,y,t.segment,t.lineStartIndex,t.lineStartIndex+t.lineLength,d,c,x,!1);if(!N)return{notEnoughRoom:!0};_=[N]}for(var j=0,V=_;j0?1:-1,y=0;i&&(m*=-1,y=Math.PI),m<0&&(y+=Math.PI);for(var x=m>0?u+s:u+s+1,b=x,_=a,w=a,M=0,A=0,k=Math.abs(v);M+A<=k;){if((x+=m)=c)return null;if(w=_,void 0===(_=d[x])){var T=new f(h.getx(x),h.gety(x)),S=n(T,p);if(S.signedDistanceFromCamera>0)_=d[x]=S.point;else{var E=x-m;_=l(0===M?o:new f(h.getx(E),h.gety(E)),T,w,k-M+1,p)}}M+=A,A=w.dist(_)}var C=(k-M)/A,L=_.sub(w),z=L.mult(C)._add(w);return z._add(L._unit()._perp()._mult(r*m)),{point:z,angle:y+Math.atan2(_.y-w.y,_.x-w.x),tileDistance:g?{prevTileDistance:x-m===b?0:h.gettileUnitDistanceFromAnchor(x-m),lastSegmentViewportDistance:k-M}:null}}function c(t,e){for(var r=0;r=w||o.y<0||o.y>=w||t.symbolInstances.push(function(t,e,r,n,a,o,s,l,c,h,f,d,g,x,b,_,w,A,k,T,S,E){var C,L,z=t.addToLineVertexArray(e,r),P=0,I=0,D=0,O=n.horizontal?n.horizontal.text:"",R=[];n.horizontal&&(C=new m(s,r,e,l,c,h,n.horizontal,f,d,g,t.overscaling),I+=i(t,e,n.horizontal,o,g,k,T,x,z,n.vertical?p.horizontal:p.horizontalOnly,R,S,E),n.vertical&&(D+=i(t,e,n.vertical,o,g,k,T,x,z,p.vertical,R,S,E)));var F=C?C.boxStartIndex:t.collisionBoxArray.length,B=C?C.boxEndIndex:t.collisionBoxArray.length;if(a){var N=v(e,a,o,w,n.horizontal,k,T);L=new m(s,r,e,l,c,h,a,b,_,!1,t.overscaling),P=4*N.length;var j=t.iconSizeData,V=null;"source"===j.functionType?V=[10*o.layout.get("icon-size").evaluate(T)]:"composite"===j.functionType&&(V=[10*E.compositeIconSizes[0].evaluate(T),10*E.compositeIconSizes[1].evaluate(T)]),t.addSymbols(t.icon,N,V,A,w,T,!1,e,z.lineStartIndex,z.lineLength)}var U=L?L.boxStartIndex:t.collisionBoxArray.length,q=L?L.boxEndIndex:t.collisionBoxArray.length;return t.glyphOffsetArray.length>=M.MAX_GLYPHS&&y.warnOnce("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),{key:O,textBoxStartIndex:F,textBoxEndIndex:B,iconBoxStartIndex:U,iconBoxEndIndex:q,textOffset:x,iconOffset:A,anchor:e,line:r,featureIndex:l,feature:T,numGlyphVertices:I,numVerticalGlyphVertices:D,numIconVertices:P,textOpacityState:new u,iconOpacityState:new u,isDuplicate:!1,placedTextSymbolIndices:R,crossTileID:0}}(t,o,a,r,n,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,S,z,D,A,C,P,O,k,{zoom:t.zoom},e,c,h))};if("line"===x.get("symbol-placement"))for(var B=0,N=l(e.geometry,0,0,w,w);B=0;o--)if(n.dist(a[o])1||(f?(clearTimeout(f),f=null,o("dblclick",e)):f=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(h)&&o("click",t)},!1),l.addEventListener("dblclick",function(t){o("dblclick",t),t.preventDefault()},!1),l.addEventListener("contextmenu",function(e){var r=t.dragRotate&&t.dragRotate.isActive();c||r?c&&(u=e):o("contextmenu",e),e.preventDefault()},!1)}},{"../util/dom":259,"./handler/box_zoom":239,"./handler/dblclick_zoom":240,"./handler/drag_pan":241,"./handler/drag_rotate":242,"./handler/keyboard":243,"./handler/scroll_zoom":244,"./handler/touch_zoom_rotate":245,"@mapbox/point-geometry":4}],231:[function(t,e,r){var n=t("../util/util"),i=t("../style-spec/util/interpolate").number,a=t("../util/browser"),o=t("../geo/lng_lat"),s=t("../geo/lng_lat_bounds"),l=t("@mapbox/point-geometry"),u=function(t){function e(e,r){t.call(this),this.moving=!1,this.transform=e,this._bearingSnap=r.bearingSnap}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.getCenter=function(){return this.transform.center},e.prototype.setCenter=function(t,e){return this.jumpTo({center:t},e)},e.prototype.panBy=function(t,e,r){return t=l.convert(t).mult(-1),this.panTo(this.transform.center,n.extend({offset:t},e),r)},e.prototype.panTo=function(t,e,r){return this.easeTo(n.extend({center:t},e),r)},e.prototype.getZoom=function(){return this.transform.zoom},e.prototype.setZoom=function(t,e){return this.jumpTo({zoom:t},e),this},e.prototype.zoomTo=function(t,e,r){return this.easeTo(n.extend({zoom:t},e),r)},e.prototype.zoomIn=function(t,e){return this.zoomTo(this.getZoom()+1,t,e),this},e.prototype.zoomOut=function(t,e){return this.zoomTo(this.getZoom()-1,t,e),this},e.prototype.getBearing=function(){return this.transform.bearing},e.prototype.setBearing=function(t,e){return this.jumpTo({bearing:t},e),this},e.prototype.rotateTo=function(t,e,r){return this.easeTo(n.extend({bearing:t},e),r)},e.prototype.resetNorth=function(t,e){return this.rotateTo(0,n.extend({duration:1e3},t),e),this},e.prototype.snapToNorth=function(t,e){return Math.abs(this.getBearing())e?1:0}),["bottom","left","right","top"]))return n.warnOnce("options.padding must be a positive number, or an Object with keys 'bottom', 'left', 'right', 'top'"),this;t=s.convert(t);var a=[(e.padding.left-e.padding.right)/2,(e.padding.top-e.padding.bottom)/2],o=Math.min(e.padding.right,e.padding.left),u=Math.min(e.padding.top,e.padding.bottom);e.offset=[e.offset[0]+a[0],e.offset[1]+a[1]];var c=l.convert(e.offset),h=this.transform,f=h.project(t.getNorthWest()),p=h.project(t.getSouthEast()),d=p.sub(f),g=(h.width-2*o-2*Math.abs(c.x))/d.x,v=(h.height-2*u-2*Math.abs(c.y))/d.y;return v<0||g<0?(n.warnOnce("Map cannot fit within canvas with the given bounds, padding, and/or offset."),this):(e.center=h.unproject(f.add(p).div(2)),e.zoom=Math.min(h.scaleZoom(h.scale*Math.min(g,v)),e.maxZoom),e.bearing=0,e.linear?this.easeTo(e,r):this.flyTo(e,r))},e.prototype.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),void 0!==t.center&&(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("pitchstart",e).fire("pitch",e).fire("pitchend",e),this.fire("moveend",e)},e.prototype.easeTo=function(t,e){var r=this;this.stop(),!1===(t=n.extend({offset:[0,0],duration:500,easing:n.ease},t)).animate&&(t.duration=0);var a=this.transform,s=this.getZoom(),u=this.getBearing(),c=this.getPitch(),h="zoom"in t?+t.zoom:s,f="bearing"in t?this._normalizeBearing(t.bearing,u):u,p="pitch"in t?+t.pitch:c,d=a.centerPoint.add(l.convert(t.offset)),g=a.pointLocation(d),v=o.convert(t.center||g);this._normalizeCenter(v);var m,y,x=a.project(g),b=a.project(v).sub(x),_=a.zoomScale(h-s);return t.around&&(m=o.convert(t.around),y=a.locationPoint(m)),this.zooming=h!==s,this.rotating=u!==f,this.pitching=p!==c,this._prepareEase(e,t.noMoveStart),clearTimeout(this._onEaseEnd),this._ease(function(t){if(r.zooming&&(a.zoom=i(s,h,t)),r.rotating&&(a.bearing=i(u,f,t)),r.pitching&&(a.pitch=i(c,p,t)),m)a.setLocationAtPoint(m,y);else{var n=a.zoomScale(a.zoom-s),o=h>s?Math.min(2,_):Math.max(.5,_),l=Math.pow(o,1-t),g=a.unproject(x.add(b.mult(t*l)).mult(n));a.setLocationAtPoint(a.renderWorldCopies?g.wrap():g,d)}r._fireMoveEvents(e)},function(){t.delayEndEvents?r._onEaseEnd=setTimeout(function(){return r._afterEase(e)},t.delayEndEvents):r._afterEase(e)},t),this},e.prototype._prepareEase=function(t,e){this.moving=!0,e||this.fire("movestart",t),this.zooming&&this.fire("zoomstart",t),this.pitching&&this.fire("pitchstart",t)},e.prototype._fireMoveEvents=function(t){this.fire("move",t),this.zooming&&this.fire("zoom",t),this.rotating&&this.fire("rotate",t),this.pitching&&this.fire("pitch",t)},e.prototype._afterEase=function(t){var e=this.zooming,r=this.pitching;this.moving=!1,this.zooming=!1,this.rotating=!1,this.pitching=!1,e&&this.fire("zoomend",t),r&&this.fire("pitchend",t),this.fire("moveend",t)},e.prototype.flyTo=function(t,e){function r(t){var e=(k*k-A*A+(t?-1:1)*C*C*T*T)/(2*(t?k:A)*C*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}var u=this;this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);var c=this.transform,h=this.getZoom(),f=this.getBearing(),p=this.getPitch(),d="zoom"in t?n.clamp(+t.zoom,c.minZoom,c.maxZoom):h,g="bearing"in t?this._normalizeBearing(t.bearing,f):f,v="pitch"in t?+t.pitch:p,m=c.zoomScale(d-h),y=c.centerPoint.add(l.convert(t.offset)),x=c.pointLocation(y),b=o.convert(t.center||x);this._normalizeCenter(b);var _=c.project(x),w=c.project(b).sub(_),M=t.curve,A=Math.max(c.width,c.height),k=A/m,T=w.mag();if("minZoom"in t){var S=n.clamp(Math.min(t.minZoom,h,d),c.minZoom,c.maxZoom),E=A/c.zoomScale(S-h);M=Math.sqrt(E/T*2)}var C=M*M,L=r(0),z=function(t){return s(L)/s(L+M*t)},P=function(t){return A*((s(L)*function(t){return a(t)/s(t)}(L+M*t)-a(L))/C)/T},I=(r(1)-L)/M;if(Math.abs(T)<1e-6||!isFinite(I)){if(Math.abs(A-k)<1e-6)return this.easeTo(t,e);var D=kt.maxDuration&&(t.duration=0),this.zooming=!0,this.rotating=f!==g,this.pitching=v!==p,this._prepareEase(e,!1),this._ease(function(t){var r=t*I,n=1/z(r);c.zoom=h+c.scaleZoom(n),u.rotating&&(c.bearing=i(f,g,t)),u.pitching&&(c.pitch=i(p,v,t));var a=c.unproject(_.add(w.mult(P(r))).mult(n));c.setLocationAtPoint(c.renderWorldCopies?a.wrap():a,y),u._fireMoveEvents(e)},function(){return u._afterEase(e)},t),this},e.prototype.isEasing=function(){return!!this._isEasing},e.prototype.isMoving=function(){return this.moving},e.prototype.stop=function(){return this._onFrame&&this._finishAnimation(),this},e.prototype._ease=function(t,e,r){var n=this;!1===r.animate||0===r.duration?(t(1),e()):(this._easeStart=a.now(),this._isEasing=!0,this._easeOptions=r,this._startAnimation(function(e){var r=Math.min((a.now()-n._easeStart)/n._easeOptions.duration,1);t(n._easeOptions.easing(r)),1===r&&n.stop()},function(){n._isEasing=!1,e()}))},e.prototype._updateCamera=function(){this._onFrame&&this._onFrame(this.transform)},e.prototype._startAnimation=function(t,e){return void 0===e&&(e=function(){}),this.stop(),this._onFrame=t,this._finishFn=e,this._update(),this},e.prototype._finishAnimation=function(){delete this._onFrame;var t=this._finishFn;delete this._finishFn,t.call(this)},e.prototype._normalizeBearing=function(t,e){t=n.wrap(t,-180,180);var r=Math.abs(t-e);return Math.abs(t-360-e)180?-360:r<-180?360:0}},e}(t("../util/evented"));e.exports=u},{"../geo/lng_lat":62,"../geo/lng_lat_bounds":63,"../style-spec/util/interpolate":158,"../util/browser":252,"../util/evented":260,"../util/util":275,"@mapbox/point-geometry":4}],232:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/config"),o=function(t){this.options=t,i.bindAll(["_updateEditLink","_updateData","_updateCompact"],this)};o.prototype.getDefaultPosition=function(){return"bottom-right"},o.prototype.onAdd=function(t){var e=this.options&&this.options.compact;return this._map=t,this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),e&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),void 0===e&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container},o.prototype.onRemove=function(){n.remove(this._container),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0},o.prototype._updateEditLink=function(){var t=this._editLink;t||(t=this._editLink=this._container.querySelector(".mapbox-improve-map"));var e=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:a.ACCESS_TOKEN}];if(t){var r=e.reduce(function(t,r,n){return r.value&&(t+=r.key+"="+r.value+(n=0)return!1;return!0})).length?(this._container.innerHTML=t.join(" | "),this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null}},o.prototype._updateCompact=function(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact")},e.exports=o},{"../../util/config":256,"../../util/dom":259,"../../util/util":275}],233:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=function(){this._fullscreen=!1,i.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in a.document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in a.document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in a.document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in a.document&&(this._fullscreenchange="MSFullscreenChange"),this._className="mapboxgl-ctrl"};o.prototype.onAdd=function(t){return this._map=t,this._mapContainer=this._map.getContainer(),this._container=n.create("div",this._className+" mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._container.style.display="none",i.warnOnce("This device does not support fullscreen mode.")),this._container},o.prototype.onRemove=function(){n.remove(this._container),this._map=null,a.document.removeEventListener(this._fullscreenchange,this._changeIcon)},o.prototype._checkFullscreenSupport=function(){return!!(a.document.fullscreenEnabled||a.document.mozFullScreenEnabled||a.document.msFullscreenEnabled||a.document.webkitFullscreenEnabled)},o.prototype._setupUI=function(){var t=this._fullscreenButton=n.create("button",this._className+"-icon "+this._className+"-fullscreen",this._container);t.setAttribute("aria-label","Toggle fullscreen"),t.type="button",this._fullscreenButton.addEventListener("click",this._onClickFullscreen),a.document.addEventListener(this._fullscreenchange,this._changeIcon)},o.prototype._isFullscreen=function(){return this._fullscreen},o.prototype._changeIcon=function(){(a.document.fullscreenElement||a.document.mozFullScreenElement||a.document.webkitFullscreenElement||a.document.msFullscreenElement)===this._mapContainer!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle(this._className+"-shrink"),this._fullscreenButton.classList.toggle(this._className+"-fullscreen"))},o.prototype._onClickFullscreen=function(){this._isFullscreen()?a.document.exitFullscreen?a.document.exitFullscreen():a.document.mozCancelFullScreen?a.document.mozCancelFullScreen():a.document.msExitFullscreen?a.document.msExitFullscreen():a.document.webkitCancelFullScreen&&a.document.webkitCancelFullScreen():this._mapContainer.requestFullscreen?this._mapContainer.requestFullscreen():this._mapContainer.mozRequestFullScreen?this._mapContainer.mozRequestFullScreen():this._mapContainer.msRequestFullscreen?this._mapContainer.msRequestFullscreen():this._mapContainer.webkitRequestFullscreen&&this._mapContainer.webkitRequestFullscreen()},e.exports=o},{"../../util/dom":259,"../../util/util":275,"../../util/window":254}],234:[function(t,e,r){var n,i=t("../../util/evented"),a=t("../../util/dom"),o=t("../../util/window"),s=t("../../util/util"),l=t("../../geo/lng_lat"),u=t("../marker"),c={positionOptions:{enableHighAccuracy:!1,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showUserLocation:!0},h=function(t){function e(e){t.call(this),this.options=s.extend({},c,e),s.bindAll(["_onSuccess","_onError","_finish","_setupUI","_updateCamera","_updateMarker","_onClickGeolocate"],this)}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),function(t){void 0!==n?t(n):void 0!==o.navigator.permissions?o.navigator.permissions.query({name:"geolocation"}).then(function(e){n="denied"!==e.state,t(n)}):(n=!!o.navigator.geolocation,t(n))}(this._setupUI),this._container},e.prototype.onRemove=function(){void 0!==this._geolocationWatchID&&(o.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker.remove(),a.remove(this._container),this._map=void 0},e.prototype._onSuccess=function(t){if(this.options.trackUserLocation)switch(this._lastKnownPosition=t,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&"OFF"!==this._watchState&&this._updateMarker(t),this.options.trackUserLocation&&"ACTIVE_LOCK"!==this._watchState||this._updateCamera(t),this.options.showUserLocation&&this._dotElement.classList.remove("mapboxgl-user-location-dot-stale"),this.fire("geolocate",t),this._finish()},e.prototype._updateCamera=function(t){var e=new l(t.coords.longitude,t.coords.latitude),r=t.coords.accuracy;this._map.fitBounds(e.toBounds(r),this.options.fitBoundsOptions,{geolocateSource:!0})},e.prototype._updateMarker=function(t){t?this._userLocationDotMarker.setLngLat([t.coords.longitude,t.coords.latitude]).addTo(this._map):this._userLocationDotMarker.remove()},e.prototype._onError=function(t){if(this.options.trackUserLocation)if(1===t.code)this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),void 0!==this._geolocationWatchID&&this._clearWatch();else switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting")}"OFF"!==this._watchState&&this.options.showUserLocation&&this._dotElement.classList.add("mapboxgl-user-location-dot-stale"),this.fire("error",t),this._finish()},e.prototype._finish=function(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},e.prototype._setupUI=function(t){var e=this;!1!==t&&(this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this._geolocateButton=a.create("button","mapboxgl-ctrl-icon mapboxgl-ctrl-geolocate",this._container),this._geolocateButton.type="button",this._geolocateButton.setAttribute("aria-label","Geolocate"),this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=a.create("div","mapboxgl-user-location-dot"),this._userLocationDotMarker=new u(this._dotElement),this.options.trackUserLocation&&(this._watchState="OFF")),this._geolocateButton.addEventListener("click",this._onClickGeolocate.bind(this)),this.options.trackUserLocation&&this._map.on("movestart",function(t){t.geolocateSource||"ACTIVE_LOCK"!==e._watchState||(e._watchState="BACKGROUND",e._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background"),e._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),e.fire("trackuserlocationend"))}))},e.prototype._onClickGeolocate=function(){if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire("trackuserlocationstart");break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this.fire("trackuserlocationend");break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire("trackuserlocationstart")}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active-error");break;case"BACKGROUND":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background");break;case"BACKGROUND_ERROR":this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background-error")}"OFF"===this._watchState&&void 0!==this._geolocationWatchID?this._clearWatch():void 0===this._geolocationWatchID&&(this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._geolocationWatchID=o.navigator.geolocation.watchPosition(this._onSuccess,this._onError,this.options.positionOptions))}else o.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4)},e.prototype._clearWatch=function(){o.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)},e}(i);e.exports=h},{"../../geo/lng_lat":62,"../../util/dom":259,"../../util/evented":260,"../../util/util":275,"../../util/window":254,"../marker":248}],235:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=function(){i.bindAll(["_updateLogo"],this)};a.prototype.onAdd=function(t){this._map=t,this._container=n.create("div","mapboxgl-ctrl");var e=n.create("a","mapboxgl-ctrl-logo");return e.target="_blank",e.href="https://www.mapbox.com/",e.setAttribute("aria-label","Mapbox logo"),this._container.appendChild(e),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._container},a.prototype.onRemove=function(){n.remove(this._container),this._map.off("sourcedata",this._updateLogo)},a.prototype.getDefaultPosition=function(){return"bottom-left"},a.prototype._updateLogo=function(t){t&&"metadata"!==t.sourceDataType||(this._container.style.display=this._logoRequired()?"block":"none")},a.prototype._logoRequired=function(){if(this._map.style){var t=this._map.style.sourceCaches;for(var e in t)if(t[e].getSource().mapbox_logo)return!0;return!1}},e.exports=a},{"../../util/dom":259,"../../util/util":275}],236:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../handler/drag_rotate"),o={showCompass:!0,showZoom:!0},s=function(t){var e=this;this.options=i.extend({},o,t),this._container=n.create("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",function(t){return t.preventDefault()}),this.options.showZoom&&(this._zoomInButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-in","Zoom In",function(){return e._map.zoomIn()}),this._zoomOutButton=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-zoom-out","Zoom Out",function(){return e._map.zoomOut()})),this.options.showCompass&&(i.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("mapboxgl-ctrl-icon mapboxgl-ctrl-compass","Reset North",function(){return e._map.resetNorth()}),this._compassArrow=n.create("span","mapboxgl-ctrl-compass-arrow",this._compass))};s.prototype._rotateCompassArrow=function(){var t="rotate("+this._map.transform.angle*(180/Math.PI)+"deg)";this._compassArrow.style.transform=t},s.prototype.onAdd=function(t){return this._map=t,this.options.showCompass&&(this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new a(t,{button:"left",element:this._compass}),this._handler.enable()),this._container},s.prototype.onRemove=function(){n.remove(this._container),this.options.showCompass&&(this._map.off("rotate",this._rotateCompassArrow),this._handler.disable(),delete this._handler),delete this._map},s.prototype._createButton=function(t,e,r){var i=n.create("button",t,this._container);return i.type="button",i.setAttribute("aria-label",e),i.addEventListener("click",r),i},e.exports=s},{"../../util/dom":259,"../../util/util":275,"../handler/drag_rotate":242}],237:[function(t,e,r){function n(t,e,r){var n=r&&r.maxWidth||100,a=t._container.clientHeight/2,o=function(t,e){var r=Math.PI/180,n=t.lat*r,i=e.lat*r,a=Math.sin(n)*Math.sin(i)+Math.cos(n)*Math.cos(i)*Math.cos((e.lng-t.lng)*r);return 6371e3*Math.acos(Math.min(a,1))}(t.unproject([0,a]),t.unproject([n,a]));if(r&&"imperial"===r.unit){var s=3.2808*o;s>5280?i(e,n,s/5280,"mi"):i(e,n,s,"ft")}else if(r&&"nautical"===r.unit){i(e,n,o/1852,"nm")}else i(e,n,o,"m")}function i(t,e,r,n){var i=function(t){var e=Math.pow(10,(""+Math.floor(t)).length-1),r=t/e;return e*(r=r>=10?10:r>=5?5:r>=3?3:r>=2?2:1)}(r),a=i/r;"m"===n&&i>=1e3&&(i/=1e3,n="km"),t.style.width=e*a+"px",t.innerHTML=i+n}var a=t("../../util/dom"),o=t("../../util/util"),s=function(t){this.options=t,o.bindAll(["_onMove"],this)};s.prototype.getDefaultPosition=function(){return"bottom-left"},s.prototype._onMove=function(){n(this._map,this._container,this.options)},s.prototype.onAdd=function(t){return this._map=t,this._container=a.create("div","mapboxgl-ctrl mapboxgl-ctrl-scale",t.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container},s.prototype.onRemove=function(){a.remove(this._container),this._map.off("move",this._onMove),this._map=void 0},e.exports=s},{"../../util/dom":259,"../../util/util":275}],238:[function(t,e,r){},{}],239:[function(t,e,r){var n=t("../../util/dom"),i=t("../../geo/lng_lat_bounds"),a=t("../../util/util"),o=t("../../util/window"),s=function(t){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),a.bindAll(["_onMouseDown","_onMouseMove","_onMouseUp","_onKeyDown"],this)};s.prototype.isEnabled=function(){return!!this._enabled},s.prototype.isActive=function(){return!!this._active},s.prototype.enable=function(){this.isEnabled()||(this._map.dragPan&&this._map.dragPan.disable(),this._el.addEventListener("mousedown",this._onMouseDown,!1),this._map.dragPan&&this._map.dragPan.enable(),this._enabled=!0)},s.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onMouseDown),this._enabled=!1)},s.prototype._onMouseDown=function(t){t.shiftKey&&0===t.button&&(o.document.addEventListener("mousemove",this._onMouseMove,!1),o.document.addEventListener("keydown",this._onKeyDown,!1),o.document.addEventListener("mouseup",this._onMouseUp,!1),n.disableDrag(),this._startPos=n.mousePos(this._el,t),this._active=!0)},s.prototype._onMouseMove=function(t){var e=this._startPos,r=n.mousePos(this._el,t);this._box||(this._box=n.create("div","mapboxgl-boxzoom",this._container),this._container.classList.add("mapboxgl-crosshair"),this._fireEvent("boxzoomstart",t));var i=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);n.setTransform(this._box,"translate("+i+"px,"+o+"px)"),this._box.style.width=a-i+"px",this._box.style.height=s-o+"px"},s.prototype._onMouseUp=function(t){if(0===t.button){var e=this._startPos,r=n.mousePos(this._el,t),a=(new i).extend(this._map.unproject(e)).extend(this._map.unproject(r));this._finish(),e.x===r.x&&e.y===r.y?this._fireEvent("boxzoomcancel",t):this._map.fitBounds(a,{linear:!0}).fire("boxzoomend",{originalEvent:t,boxZoomBounds:a})}},s.prototype._onKeyDown=function(t){27===t.keyCode&&(this._finish(),this._fireEvent("boxzoomcancel",t))},s.prototype._finish=function(){this._active=!1,o.document.removeEventListener("mousemove",this._onMouseMove,!1),o.document.removeEventListener("keydown",this._onKeyDown,!1),o.document.removeEventListener("mouseup",this._onMouseUp,!1),this._container.classList.remove("mapboxgl-crosshair"),this._box&&(n.remove(this._box),this._box=null),n.enableDrag()},s.prototype._fireEvent=function(t,e){return this._map.fire(t,{originalEvent:e})},e.exports=s},{"../../geo/lng_lat_bounds":63,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],240:[function(t,e,r){var n=t("../../util/util"),i=function(t){this._map=t,n.bindAll(["_onDblClick","_onZoomEnd"],this)};i.prototype.isEnabled=function(){return!!this._enabled},i.prototype.isActive=function(){return!!this._active},i.prototype.enable=function(){this.isEnabled()||(this._map.on("dblclick",this._onDblClick),this._enabled=!0)},i.prototype.disable=function(){this.isEnabled()&&(this._map.off("dblclick",this._onDblClick),this._enabled=!1)},i.prototype._onDblClick=function(t){this._active=!0,this._map.on("zoomend",this._onZoomEnd),this._map.zoomTo(this._map.getZoom()+(t.originalEvent.shiftKey?-1:1),{around:t.lngLat},t)},i.prototype._onZoomEnd=function(){this._active=!1,this._map.off("zoomend",this._onZoomEnd)},e.exports=i},{"../../util/util":275}],241:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=t("../../util/browser"),s=i.bezier(0,0,.3,1),l=function(t){this._map=t,this._el=t.getCanvasContainer(),i.bindAll(["_onDown","_onMove","_onUp","_onTouchEnd","_onMouseUp","_onDragFrame","_onDragFinished"],this)};l.prototype.isEnabled=function(){return!!this._enabled},l.prototype.isActive=function(){return!!this._active},l.prototype.enable=function(){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-drag-pan"),this._el.addEventListener("mousedown",this._onDown),this._el.addEventListener("touchstart",this._onDown),this._enabled=!0)},l.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-drag-pan"),this._el.removeEventListener("mousedown",this._onDown),this._el.removeEventListener("touchstart",this._onDown),this._enabled=!1)},l.prototype._onDown=function(t){this._ignoreEvent(t)||this.isActive()||(t.touches?(a.document.addEventListener("touchmove",this._onMove),a.document.addEventListener("touchend",this._onTouchEnd)):(a.document.addEventListener("mousemove",this._onMove),a.document.addEventListener("mouseup",this._onMouseUp)),a.addEventListener("blur",this._onMouseUp),this._active=!1,this._previousPos=n.mousePos(this._el,t),this._inertia=[[o.now(),this._previousPos]])},l.prototype._onMove=function(t){if(!this._ignoreEvent(t)){this._lastMoveEvent=t,t.preventDefault();var e=n.mousePos(this._el,t);if(this._drainInertiaBuffer(),this._inertia.push([o.now(),e]),!this._previousPos)return void(this._previousPos=e);this._pos=e,this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("dragstart",t),this._fireEvent("movestart",t),this._map._startAnimation(this._onDragFrame,this._onDragFinished)),this._map._update()}},l.prototype._onDragFrame=function(t){var e=this._lastMoveEvent;e&&(t.setLocationAtPoint(t.pointLocation(this._previousPos),this._pos),this._fireEvent("drag",e),this._fireEvent("move",e),this._previousPos=this._pos,delete this._lastMoveEvent)},l.prototype._onDragFinished=function(t){var e=this;if(this.isActive()){this._active=!1,delete this._lastMoveEvent,delete this._previousPos,delete this._pos,this._fireEvent("dragend",t),this._drainInertiaBuffer();var r=function(){e._map.moving=!1,e._fireEvent("moveend",t)},n=this._inertia;if(n.length<2)return void r();var i=n[n.length-1],a=n[0],o=i[1].sub(a[1]),l=(i[0]-a[0])/1e3;if(0===l||i[1].equals(a[1]))return void r();var u=o.mult(.3/l),c=u.mag();c>1400&&(c=1400,u._unit()._mult(c));var h=c/750,f=u.mult(-h/2);this._map.panBy(f,{duration:1e3*h,easing:s,noMoveStart:!0},{originalEvent:t})}},l.prototype._onUp=function(t){this._onDragFinished(t)},l.prototype._onMouseUp=function(t){this._ignoreEvent(t)||(this._onUp(t),a.document.removeEventListener("mousemove",this._onMove),a.document.removeEventListener("mouseup",this._onMouseUp),a.removeEventListener("blur",this._onMouseUp))},l.prototype._onTouchEnd=function(t){this._ignoreEvent(t)||(this._onUp(t),a.document.removeEventListener("touchmove",this._onMove),a.document.removeEventListener("touchend",this._onTouchEnd))},l.prototype._fireEvent=function(t,e){return this._map.fire(t,e?{originalEvent:e}:{})},l.prototype._ignoreEvent=function(t){var e=this._map;return!(!e.boxZoom||!e.boxZoom.isActive())||!(!e.dragRotate||!e.dragRotate.isActive())||(t.touches?t.touches.length>1:!!t.ctrlKey||"mousemove"!==t.type&&t.button&&0!==t.button)},l.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=o.now();t.length>0&&e-t[0][0]>160;)t.shift()},e.exports=l},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],242:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=t("../../util/browser"),s=i.bezier(0,0,.25,1),l=function(t,e){this._map=t,this._el=e.element||t.getCanvasContainer(),this._button=e.button||"right",this._bearingSnap=e.bearingSnap||0,this._pitchWithRotate=!1!==e.pitchWithRotate,i.bindAll(["_onDown","_onMove","_onUp","_onDragFrame","_onDragFinished"],this)};l.prototype.isEnabled=function(){return!!this._enabled},l.prototype.isActive=function(){return!!this._active},l.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("mousedown",this._onDown),this._enabled=!0)},l.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("mousedown",this._onDown),this._enabled=!1)},l.prototype._onDown=function(t){if(!(this._map.boxZoom&&this._map.boxZoom.isActive()||this._map.dragPan&&this._map.dragPan.isActive()||this.isActive())){if("right"===this._button){var e=t.ctrlKey?0:2,r=t.button;if(void 0!==a.InstallTrigger&&2===t.button&&t.ctrlKey&&a.navigator.platform.toUpperCase().indexOf("MAC")>=0&&(r=0),r!==e)return}else if(t.ctrlKey||0!==t.button)return;n.disableDrag(),a.document.addEventListener("mousemove",this._onMove,{capture:!0}),a.document.addEventListener("mouseup",this._onUp),a.addEventListener("blur",this._onUp),this._active=!1,this._inertia=[[o.now(),this._map.getBearing()]],this._previousPos=n.mousePos(this._el,t),this._center=this._map.transform.centerPoint,t.preventDefault()}},l.prototype._onMove=function(t){this._lastMoveEvent=t;var e=n.mousePos(this._el,t);this._previousPos?(this._pos=e,this.isActive()||(this._active=!0,this._map.moving=!0,this._fireEvent("rotatestart",t),this._fireEvent("movestart",t),this._pitchWithRotate&&this._fireEvent("pitchstart",t),this._map._startAnimation(this._onDragFrame,this._onDragFinished)),this._map._update()):this._previousPos=e},l.prototype._onUp=function(t){a.document.removeEventListener("mousemove",this._onMove,{capture:!0}),a.document.removeEventListener("mouseup",this._onUp),a.removeEventListener("blur",this._onUp),n.enableDrag(),this._onDragFinished(t)},l.prototype._onDragFrame=function(t){var e=this._lastMoveEvent;if(e){var r=this._previousPos,n=this._pos,i=.8*(r.x-n.x),a=-.5*(r.y-n.y),s=t.bearing-i,l=t.pitch-a,u=this._inertia,c=u[u.length-1];this._drainInertiaBuffer(),u.push([o.now(),this._map._normalizeBearing(s,c[1])]),t.bearing=s,this._pitchWithRotate&&(this._fireEvent("pitch",e),t.pitch=l),this._fireEvent("rotate",e),this._fireEvent("move",e),delete this._lastMoveEvent,this._previousPos=this._pos}},l.prototype._onDragFinished=function(t){var e=this;if(this.isActive()){this._active=!1,delete this._lastMoveEvent,delete this._previousPos,this._fireEvent("rotateend",t),this._drainInertiaBuffer();var r=this._map,n=r.getBearing(),i=this._inertia,a=function(){Math.abs(n)180&&(d=180);var g=d/180;c+=f*d*(g/2),Math.abs(r._normalizeBearing(c,0))0&&e-t[0][0]>160;)t.shift()},e.exports=l},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],243:[function(t,e,r){function n(t){return t*(2-t)}var i=t("../../util/util"),a=function(t){this._map=t,this._el=t.getCanvasContainer(),i.bindAll(["_onKeyDown"],this)};a.prototype.isEnabled=function(){return!!this._enabled},a.prototype.enable=function(){this.isEnabled()||(this._el.addEventListener("keydown",this._onKeyDown,!1),this._enabled=!0)},a.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("keydown",this._onKeyDown),this._enabled=!1)},a.prototype._onKeyDown=function(t){if(!(t.altKey||t.ctrlKey||t.metaKey)){var e=0,r=0,i=0,a=0,o=0;switch(t.keyCode){case 61:case 107:case 171:case 187:e=1;break;case 189:case 109:case 173:e=-1;break;case 37:t.shiftKey?r=-1:(t.preventDefault(),a=-1);break;case 39:t.shiftKey?r=1:(t.preventDefault(),a=1);break;case 38:t.shiftKey?i=1:(t.preventDefault(),o=-1);break;case 40:t.shiftKey?i=-1:(o=1,t.preventDefault());break;default:return}var s=this._map,l=s.getZoom(),u={duration:300,delayEndEvents:500,easing:n,zoom:e?Math.round(l)+e*(t.shiftKey?2:1):l,bearing:s.getBearing()+15*r,pitch:s.getPitch()+10*i,offset:[100*-a,100*-o],center:s.getCenter()};s.easeTo(u,{originalEvent:t})}},e.exports=a},{"../../util/util":275}],244:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/browser"),o=t("../../util/window"),s=t("../../style-spec/util/interpolate").number,l=t("../../geo/lng_lat"),u=o.navigator.userAgent.toLowerCase(),c=-1!==u.indexOf("firefox"),h=-1!==u.indexOf("safari")&&-1===u.indexOf("chrom"),f=function(t){this._map=t,this._el=t.getCanvasContainer(),this._delta=0,i.bindAll(["_onWheel","_onTimeout","_onScrollFrame","_onScrollFinished"],this)};f.prototype.isEnabled=function(){return!!this._enabled},f.prototype.isActive=function(){return!!this._active},f.prototype.enable=function(t){this.isEnabled()||(this._el.addEventListener("wheel",this._onWheel,!1),this._el.addEventListener("mousewheel",this._onWheel,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},f.prototype.disable=function(){this.isEnabled()&&(this._el.removeEventListener("wheel",this._onWheel),this._el.removeEventListener("mousewheel",this._onWheel),this._enabled=!1)},f.prototype._onWheel=function(t){var e=0;"wheel"===t.type?(e=t.deltaY,c&&t.deltaMode===o.WheelEvent.DOM_DELTA_PIXEL&&(e/=a.devicePixelRatio),t.deltaMode===o.WheelEvent.DOM_DELTA_LINE&&(e*=40)):"mousewheel"===t.type&&(e=-t.wheelDeltaY,h&&(e/=3));var r=a.now(),n=r-(this._lastWheelEventTime||0);this._lastWheelEventTime=r,0!==e&&e%4.000244140625==0?this._type="wheel":0!==e&&Math.abs(e)<4?this._type="trackpad":n>400?(this._type=null,this._lastValue=e,this._timeout=setTimeout(this._onTimeout,40,t)):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._lastWheelEvent=t,this._delta-=e,this.isActive()||this._start(t)),t.preventDefault()},f.prototype._onTimeout=function(t){this._type="wheel",this._delta-=this._lastValue,this.isActive()||this._start(t)},f.prototype._start=function(t){if(this._delta){this._active=!0,this._map.moving=!0,this._map.zooming=!0,this._map.fire("movestart",{originalEvent:t}),this._map.fire("zoomstart",{originalEvent:t}),clearTimeout(this._finishTimeout);var e=n.mousePos(this._el,t);this._around=l.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(e)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._map._startAnimation(this._onScrollFrame,this._onScrollFinished)}},f.prototype._onScrollFrame=function(t){if(this.isActive()){if(0!==this._delta){var e="wheel"===this._type&&Math.abs(this._delta)>4.000244140625?1/450:.01,r=2/(1+Math.exp(-Math.abs(this._delta*e)));this._delta<0&&0!==r&&(r=1/r);var n="number"==typeof this._targetZoom?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(n*r))),"wheel"===this._type&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}if("wheel"===this._type){var i=Math.min((a.now()-this._lastWheelEventTime)/200,1),o=this._easing(i);t.zoom=s(this._startZoom,this._targetZoom,o),1===i&&this._map.stop()}else t.zoom=this._targetZoom,this._map.stop();t.setLocationAtPoint(this._around,this._aroundPoint),this._map.fire("move",{originalEvent:this._lastWheelEvent}),this._map.fire("zoom",{originalEvent:this._lastWheelEvent})}},f.prototype._onScrollFinished=function(){var t=this;this.isActive()&&(this._active=!1,this._finishTimeout=setTimeout(function(){t._map.moving=!1,t._map.zooming=!1,t._map.fire("zoomend"),t._map.fire("moveend"),delete t._targetZoom},200))},f.prototype._smoothOutEasing=function(t){var e=i.ease;if(this._prevEase){var r=this._prevEase,n=(a.now()-r.start)/r.duration,o=r.easing(n+.01)-r.easing(n),s=.27/Math.sqrt(o*o+1e-4)*.01,l=Math.sqrt(.0729-s*s);e=i.bezier(s,l,.25,1)}return this._prevEase={start:a.now(),duration:t,easing:e},e},e.exports=f},{"../../geo/lng_lat":62,"../../style-spec/util/interpolate":158,"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],245:[function(t,e,r){var n=t("../../util/dom"),i=t("../../util/util"),a=t("../../util/window"),o=t("../../util/browser"),s=i.bezier(0,0,.15,1),l=function(t){this._map=t,this._el=t.getCanvasContainer(),i.bindAll(["_onStart","_onMove","_onEnd"],this)};l.prototype.isEnabled=function(){return!!this._enabled},l.prototype.enable=function(t){this.isEnabled()||(this._el.classList.add("mapboxgl-touch-zoom-rotate"),this._el.addEventListener("touchstart",this._onStart,!1),this._enabled=!0,this._aroundCenter=t&&"center"===t.around)},l.prototype.disable=function(){this.isEnabled()&&(this._el.classList.remove("mapboxgl-touch-zoom-rotate"),this._el.removeEventListener("touchstart",this._onStart),this._enabled=!1)},l.prototype.disableRotation=function(){this._rotationDisabled=!0},l.prototype.enableRotation=function(){this._rotationDisabled=!1},l.prototype._onStart=function(t){if(2===t.touches.length){var e=n.mousePos(this._el,t.touches[0]),r=n.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=[],a.document.addEventListener("touchmove",this._onMove,!1),a.document.addEventListener("touchend",this._onEnd,!1)}},l.prototype._onMove=function(t){if(2===t.touches.length){var e=n.mousePos(this._el,t.touches[0]),r=n.mousePos(this._el,t.touches[1]),i=e.add(r).div(2),a=e.sub(r),s=a.mag()/this._startVec.mag(),l=this._rotationDisabled?0:180*a.angleWith(this._startVec)/Math.PI,u=this._map;if(this._gestureIntent){var c={duration:0,around:u.unproject(i)};"rotate"===this._gestureIntent&&(c.bearing=this._startBearing+l),"zoom"!==this._gestureIntent&&"rotate"!==this._gestureIntent||(c.zoom=u.transform.scaleZoom(this._startScale*s)),u.stop(),this._drainInertiaBuffer(),this._inertia.push([o.now(),s,i]),u.easeTo(c,{originalEvent:t})}else{var h=Math.abs(1-s)>.15;Math.abs(l)>10?this._gestureIntent="rotate":h&&(this._gestureIntent="zoom"),this._gestureIntent&&(this._startVec=a,this._startScale=u.transform.scale,this._startBearing=u.transform.bearing)}t.preventDefault()}},l.prototype._onEnd=function(t){a.document.removeEventListener("touchmove",this._onMove),a.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],o=r.transform.scaleZoom(this._startScale*n[1]),l=r.transform.scaleZoom(this._startScale*i[1]),u=o-l,c=(n[0]-i[0])/1e3,h=n[2];if(0!==c&&o!==l){var f=.15*u/c;Math.abs(f)>2.5&&(f=f>0?2.5:-2.5);var p=1e3*Math.abs(f/(12*.15)),d=o+f*p/2e3;d<0&&(d=0),r.easeTo({zoom:d,duration:p,easing:s,around:this._aroundCenter?r.getCenter():r.unproject(h)},{originalEvent:t})}else r.snapToNorth({},{originalEvent:t})}},l.prototype._drainInertiaBuffer=function(){for(var t=this._inertia,e=o.now();t.length>2&&e-t[0][0]>160;)t.shift()},e.exports=l},{"../../util/browser":252,"../../util/dom":259,"../../util/util":275,"../../util/window":254}],246:[function(t,e,r){var n=t("../util/util"),i=t("../util/window"),a=t("../util/throttle"),o=function(){n.bindAll(["_onHashChange","_updateHash"],this),this._updateHash=a(this._updateHashUnthrottled.bind(this),300)};o.prototype.addTo=function(t){return this._map=t,i.addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this},o.prototype.remove=function(){return i.removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),delete this._map,this},o.prototype.getHashString=function(t){var e=this._map.getCenter(),r=Math.round(100*this._map.getZoom())/100,n=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),i=Math.pow(10,n),a=Math.round(e.lng*i)/i,o=Math.round(e.lat*i)/i,s=this._map.getBearing(),l=this._map.getPitch(),u="";return u+=t?"#/"+a+"/"+o+"/"+r:"#"+r+"/"+o+"/"+a,(s||l)&&(u+="/"+Math.round(10*s)/10),l&&(u+="/"+Math.round(l)),u},o.prototype._onHashChange=function(){var t=i.location.hash.replace("#","").split("/");return t.length>=3&&(this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:+(t[3]||0),pitch:+(t[4]||0)}),!0)},o.prototype._updateHashUnthrottled=function(){var t=this.getHashString();i.history.replaceState("","",t)},e.exports=o},{"../util/throttle":272,"../util/util":275,"../util/window":254}],247:[function(t,e,r){function n(t){t.parentNode&&t.parentNode.removeChild(t)}var i=t("../util/util"),a=t("../util/browser"),o=t("../util/window"),s=t("../util/window"),l=s.HTMLImageElement,u=s.HTMLElement,c=t("../util/dom"),h=t("../util/ajax"),f=t("../style/style"),p=t("../style/evaluation_parameters"),d=t("../render/painter"),g=t("../geo/transform"),v=t("./hash"),m=t("./bind_handlers"),y=t("./camera"),x=t("../geo/lng_lat"),b=t("../geo/lng_lat_bounds"),_=t("@mapbox/point-geometry"),w=t("./control/attribution_control"),M=t("./control/logo_control"),A=t("@mapbox/mapbox-gl-supported"),k=t("../util/image").RGBAImage;t("./events");var T={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:0,maxZoom:22,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,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,transformRequest:null,fadeDuration:300},S=function(t){function e(e){if(null!=(e=i.extend({},T,e)).minZoom&&null!=e.maxZoom&&e.minZoom>e.maxZoom)throw new Error("maxZoom must be greater than minZoom");var r=new g(e.minZoom,e.maxZoom,e.renderWorldCopies);t.call(this,r,e),this._interactive=e.interactive,this._maxTileCacheSize=e.maxTileCacheSize,this._failIfMajorPerformanceCaveat=e.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=e.preserveDrawingBuffer,this._trackResize=e.trackResize,this._bearingSnap=e.bearingSnap,this._refreshExpiredTiles=e.refreshExpiredTiles,this._fadeDuration=e.fadeDuration,this._crossFadingFactor=1,this._collectResourceTiming=e.collectResourceTiming;var n=e.transformRequest;if(this._transformRequest=n?function(t,e){return n(t,e)||{url:t}}:function(t){return{url:t}},"string"==typeof e.container){var a=o.document.getElementById(e.container);if(!a)throw new Error("Container '"+e.container+"' not found.");this._container=a}else{if(!(e.container instanceof u))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=e.container}e.maxBounds&&this.setMaxBounds(e.maxBounds),i.bindAll(["_onWindowOnline","_onWindowResize","_contextLost","_contextRestored","_update","_render","_onData","_onDataLoading"],this),this._setupContainer(),this._setupPainter(),this.on("move",this._update.bind(this,!1)),this.on("zoom",this._update.bind(this,!0)),void 0!==o&&(o.addEventListener("online",this._onWindowOnline,!1),o.addEventListener("resize",this._onWindowResize,!1)),m(this,e),this._hash=e.hash&&(new v).addTo(this),this._hash&&this._hash._onHashChange()||this.jumpTo({center:e.center,zoom:e.zoom,bearing:e.bearing,pitch:e.pitch}),this.resize(),e.style&&this.setStyle(e.style,{localIdeographFontFamily:e.localIdeographFontFamily}),e.attributionControl&&this.addControl(new w),this.addControl(new M,e.logoPosition),this.on("style.load",function(){this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",this._onData),this.on("dataloading",this._onDataLoading)}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var r={showTileBoundaries:{},showCollisionBoxes:{},showOverdrawInspector:{},repaint:{},vertices:{}};return e.prototype.addControl=function(t,e){void 0===e&&t.getDefaultPosition&&(e=t.getDefaultPosition()),void 0===e&&(e="top-right");var r=t.onAdd(this),n=this._controlPositions[e];return-1!==e.indexOf("bottom")?n.insertBefore(r,n.firstChild):n.appendChild(r),this},e.prototype.removeControl=function(t){return t.onRemove(this),this},e.prototype.resize=function(){var t=this._containerDimensions(),e=t[0],r=t[1];return this._resizeCanvas(e,r),this.transform.resize(e,r),this.painter.resize(e,r),this.fire("movestart").fire("move").fire("resize").fire("moveend")},e.prototype.getBounds=function(){var t=new b(this.transform.pointLocation(new _(0,this.transform.height)),this.transform.pointLocation(new _(this.transform.width,0)));return(this.transform.angle||this.transform.pitch)&&(t.extend(this.transform.pointLocation(new _(this.transform.size.x,0))),t.extend(this.transform.pointLocation(new _(0,this.transform.size.y)))),t},e.prototype.getMaxBounds=function(){return this.transform.latRange&&2===this.transform.latRange.length&&this.transform.lngRange&&2===this.transform.lngRange.length?new b([this.transform.lngRange[0],this.transform.latRange[0]],[this.transform.lngRange[1],this.transform.latRange[1]]):null},e.prototype.setMaxBounds=function(t){if(t){var e=b.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=null,this.transform.latRange=null,this._update());return this},e.prototype.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()=this.transform.minZoom)return this.transform.maxZoom=t,this._update(),this.getZoom()>t&&this.setZoom(t),this;throw new Error("maxZoom must be greater than the current minZoom")},e.prototype.getMaxZoom=function(){return this.transform.maxZoom},e.prototype.project=function(t){return this.transform.locationPoint(x.convert(t))},e.prototype.unproject=function(t){return this.transform.pointLocation(_.convert(t))},e.prototype.on=function(e,r,n){var a=this;if(void 0===n)return t.prototype.on.call(this,e,r);var o=function(){if("mouseenter"===e||"mouseover"===e){var t=!1;return{layer:r,listener:n,delegates:{mousemove:function(o){var s=a.getLayer(r)?a.queryRenderedFeatures(o.point,{layers:[r]}):[];s.length?t||(t=!0,n.call(a,i.extend({features:s},o,{type:e}))):t=!1},mouseout:function(){t=!1}}}}if("mouseleave"===e||"mouseout"===e){var o=!1;return{layer:r,listener:n,delegates:{mousemove:function(t){(a.getLayer(r)?a.queryRenderedFeatures(t.point,{layers:[r]}):[]).length?o=!0:o&&(o=!1,n.call(a,i.extend({},t,{type:e})))},mouseout:function(t){o&&(o=!1,n.call(a,i.extend({},t,{type:e})))}}}}var s;return{layer:r,listener:n,delegates:(s={},s[e]=function(t){var e=a.getLayer(r)?a.queryRenderedFeatures(t.point,{layers:[r]}):[];e.length&&n.call(a,i.extend({features:e},t))},s)}}();for(var s in this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[e]=this._delegatedListeners[e]||[],this._delegatedListeners[e].push(o),o.delegates)a.on(s,o.delegates[s]);return this},e.prototype.off=function(e,r,n){if(void 0===n)return t.prototype.off.call(this,e,r);if(this._delegatedListeners&&this._delegatedListeners[e])for(var i=this._delegatedListeners[e],a=0;athis._map.transform.height-i?["bottom"]:[],t.xthis._map.transform.width-n/2&&e.push("right"),e=0===e.length?"bottom":e.join("-")}var o=t.add(r[e]).round(),l={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%)"},c=this._container.classList;for(var h in l)c.remove("mapboxgl-popup-anchor-"+h);c.add("mapboxgl-popup-anchor-"+e),a.setTransform(this._container,l[e]+" translate("+o.x+"px,"+o.y+"px)")}},e.prototype._onClickClose=function(){this.remove()},e}(i);e.exports=h},{"../geo/lng_lat":62,"../util/dom":259,"../util/evented":260,"../util/smart_wrap":270,"../util/util":275,"../util/window":254,"@mapbox/point-geometry":4}],250:[function(t,e,r){var n=t("./util"),i=t("./web_worker_transfer"),a=i.serialize,o=i.deserialize,s=function(t,e,r){this.target=t,this.parent=e,this.mapId=r,this.callbacks={},this.callbackID=0,n.bindAll(["receive"],this),this.target.addEventListener("message",this.receive,!1)};s.prototype.send=function(t,e,r,n){var i=r?this.mapId+":"+this.callbackID++:null;r&&(this.callbacks[i]=r);var o=[];this.target.postMessage({targetMapId:n,sourceMapId:this.mapId,type:t,id:String(i),data:a(e,o)},o)},s.prototype.receive=function(t){var e,r=this,n=t.data,i=n.id;if(!n.targetMapId||this.mapId===n.targetMapId){var s=function(t,e){var n=[];r.target.postMessage({sourceMapId:r.mapId,type:"",id:String(i),error:t?String(t):null,data:a(e,n)},n)};if(""===n.type)e=this.callbacks[n.id],delete this.callbacks[n.id],e&&n.error?e(new Error(n.error)):e&&e(null,o(n.data));else if(void 0!==n.id&&this.parent[n.type])this.parent[n.type](n.sourceMapId,o(n.data),s);else if(void 0!==n.id&&this.parent.getWorkerSource){var l=n.type.split(".");this.parent.getWorkerSource(n.sourceMapId,l[0])[l[1]](o(n.data),s)}else this.parent[n.type](o(n.data))}},s.prototype.remove=function(){this.target.removeEventListener("message",this.receive,!1)},e.exports=s},{"./util":275,"./web_worker_transfer":278}],251:[function(t,e,r){function n(t){var e=new a.XMLHttpRequest;for(var r in e.open("GET",t.url,!0),t.headers)e.setRequestHeader(r,t.headers[r]);return e.withCredentials="include"===t.credentials,e}function i(t){var e=a.document.createElement("a");return e.href=t,e.protocol===a.document.location.protocol&&e.host===a.document.location.host}var a=t("./window"),o={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};r.ResourceType=o,"function"==typeof Object.freeze&&Object.freeze(o);var s=function(t){function e(e,r){t.call(this,e),this.status=r}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e}(Error);r.getJSON=function(t,e){var r=n(t);return r.setRequestHeader("Accept","application/json"),r.onerror=function(){e(new Error(r.statusText))},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 s(r.statusText,r.status))},r.send(),r},r.getArrayBuffer=function(t,e){var r=n(t);return r.responseType="arraybuffer",r.onerror=function(){e(new Error(r.statusText))},r.onload=function(){var t=r.response;if(0===t.byteLength&&200===r.status)return e(new Error("http status 200 returned without content."));r.status>=200&&r.status<300&&r.response?e(null,{data:t,cacheControl:r.getResponseHeader("Cache-Control"),expires:r.getResponseHeader("Expires")}):e(new s(r.statusText,r.status))},r.send(),r};r.getImage=function(t,e){return r.getArrayBuffer(t,function(t,r){if(t)e(t);else if(r){var n=new a.Image,i=a.URL||a.webkitURL;n.onload=function(){e(null,n),i.revokeObjectURL(n.src)};var o=new a.Blob([new Uint8Array(r.data)],{type:"image/png"});n.cacheControl=r.cacheControl,n.expires=r.expires,n.src=r.data.byteLength?i.createObjectURL(o):"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII="}})},r.getVideo=function(t,e){var r=a.document.createElement("video");r.onloadstart=function(){e(null,r)};for(var n=0;n1)for(var h=0;h0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)},o.prototype.setEventedParent=function(t,e){return this._eventedParent=t,this._eventedParentData=e,this},e.exports=o},{"./util":275}],261:[function(t,e,r){function n(t,e){return e.max-t.max}function i(t,e,r,n){this.p=new o(t,e),this.h=r,this.d=function(t,e){for(var r=!1,n=1/0,i=0;it.y!=h.y>t.y&&t.x<(h.x-c.x)*(t.y-c.y)/(h.y-c.y)+c.x&&(r=!r),n=Math.min(n,s(t,c,h))}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}var a=t("tinyqueue"),o=t("@mapbox/point-geometry"),s=t("./intersection_tests").distToSegmentSquared;e.exports=function(t,e,r){void 0===e&&(e=1),void 0===r&&(r=!1);for(var s=1/0,l=1/0,u=-1/0,c=-1/0,h=t[0],f=0;fu)&&(u=p.x),(!f||p.y>c)&&(c=p.y)}var d=u-s,g=c-l,v=Math.min(d,g),m=v/2,y=new a(null,n);if(0===v)return new o(s,l);for(var x=s;x_.d||!_.d)&&(_=M,r&&console.log("found best %d after %d probes",Math.round(1e4*M.d)/1e4,w)),M.max-_.d<=e||(m=M.h/2,y.push(new i(M.p.x-m,M.p.y-m,m,t)),y.push(new i(M.p.x+m,M.p.y-m,m,t)),y.push(new i(M.p.x-m,M.p.y+m,m,t)),y.push(new i(M.p.x+m,M.p.y+m,m,t)),w+=4)}return r&&(console.log("num probes: "+w),console.log("best distance: "+_.d)),_.p}},{"./intersection_tests":264,"@mapbox/point-geometry":4,tinyqueue:33}],262:[function(t,e,r){var n,i=t("./worker_pool");e.exports=function(){return n||(n=new i),n}},{"./worker_pool":279}],263:[function(t,e,r){function n(t,e,r,n){var i=e.width,a=e.height;if(n){if(n.length!==i*a*r)throw new RangeError("mismatched image size")}else n=new Uint8Array(i*a*r);return t.width=i,t.height=a,t.data=n,t}function i(t,e,r){var i=e.width,o=e.height;if(i!==t.width||o!==t.height){var s=n({},{width:i,height:o},r);a(t,s,{x:0,y:0},{x:0,y:0},{width:Math.min(t.width,i),height:Math.min(t.height,o)},r),t.width=i,t.height=o,t.data=s.data}}function a(t,e,r,n,i,a){if(0===i.width||0===i.height)return e;if(i.width>t.width||i.height>t.height||r.x>t.width-i.width||r.y>t.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>e.width||i.height>e.height||n.x>e.width-i.width||n.y>e.height-i.height)throw new RangeError("out of range destination coordinates for image copy");for(var o=t.data,s=e.data,l=0;l1){if(i(t,e))return!0;for(var n=0;n1?t.distSqr(r):t.distSqr(r.sub(e)._mult(i)._add(e))}function l(t,e){for(var r,n,i,a=!1,o=0;oe.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 u(t,e){for(var r=!1,n=0,i=t.length-1;ne.y!=o.y>e.y&&e.x<(o.x-a.x)*(e.y-a.y)/(o.y-a.y)+a.x&&(r=!r)}return r}var c=t("./util").isCounterClockwise;e.exports={multiPolygonIntersectsBufferedMultiPoint:function(t,e,r){for(var n=0;n=3)for(var l=0;l=128&&t<=255},Arabic:function(t){return t>=1536&&t<=1791},"Arabic Supplement":function(t){return t>=1872&&t<=1919},"Arabic Extended-A":function(t){return t>=2208&&t<=2303},"Hangul Jamo":function(t){return t>=4352&&t<=4607},"Unified Canadian Aboriginal Syllabics":function(t){return t>=5120&&t<=5759},"Unified Canadian Aboriginal Syllabics Extended":function(t){return t>=6320&&t<=6399},"General Punctuation":function(t){return t>=8192&&t<=8303},"Letterlike Symbols":function(t){return t>=8448&&t<=8527},"Number Forms":function(t){return t>=8528&&t<=8591},"Miscellaneous Technical":function(t){return t>=8960&&t<=9215},"Control Pictures":function(t){return t>=9216&&t<=9279},"Optical Character Recognition":function(t){return t>=9280&&t<=9311},"Enclosed Alphanumerics":function(t){return t>=9312&&t<=9471},"Geometric Shapes":function(t){return t>=9632&&t<=9727},"Miscellaneous Symbols":function(t){return t>=9728&&t<=9983},"Miscellaneous Symbols and Arrows":function(t){return t>=11008&&t<=11263},"CJK Radicals Supplement":function(t){return t>=11904&&t<=12031},"Kangxi Radicals":function(t){return t>=12032&&t<=12255},"Ideographic Description Characters":function(t){return t>=12272&&t<=12287},"CJK Symbols and Punctuation":function(t){return t>=12288&&t<=12351},Hiragana:function(t){return t>=12352&&t<=12447},Katakana:function(t){return t>=12448&&t<=12543},Bopomofo:function(t){return t>=12544&&t<=12591},"Hangul Compatibility Jamo":function(t){return t>=12592&&t<=12687},Kanbun:function(t){return t>=12688&&t<=12703},"Bopomofo Extended":function(t){return t>=12704&&t<=12735},"CJK Strokes":function(t){return t>=12736&&t<=12783},"Katakana Phonetic Extensions":function(t){return t>=12784&&t<=12799},"Enclosed CJK Letters and Months":function(t){return t>=12800&&t<=13055},"CJK Compatibility":function(t){return t>=13056&&t<=13311},"CJK Unified Ideographs Extension A":function(t){return t>=13312&&t<=19903},"Yijing Hexagram Symbols":function(t){return t>=19904&&t<=19967},"CJK Unified Ideographs":function(t){return t>=19968&&t<=40959},"Yi Syllables":function(t){return t>=40960&&t<=42127},"Yi Radicals":function(t){return t>=42128&&t<=42191},"Hangul Jamo Extended-A":function(t){return t>=43360&&t<=43391},"Hangul Syllables":function(t){return t>=44032&&t<=55215},"Hangul Jamo Extended-B":function(t){return t>=55216&&t<=55295},"Private Use Area":function(t){return t>=57344&&t<=63743},"CJK Compatibility Ideographs":function(t){return t>=63744&&t<=64255},"Arabic Presentation Forms-A":function(t){return t>=64336&&t<=65023},"Vertical Forms":function(t){return t>=65040&&t<=65055},"CJK Compatibility Forms":function(t){return t>=65072&&t<=65103},"Small Form Variants":function(t){return t>=65104&&t<=65135},"Arabic Presentation Forms-B":function(t){return t>=65136&&t<=65279},"Halfwidth and Fullwidth Forms":function(t){return t>=65280&&t<=65519}}},{}],266:[function(t,e,r){var n=function(t,e){this.max=t,this.onRemove=e,this.reset()};n.prototype.reset=function(){var t=this;for(var e in t.data)t.onRemove(t.data[e]);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.getAndRemove(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.getAndRemove=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.get=function(t){return this.has(t)?this.data[t]:null},n.prototype.remove=function(t){if(!this.has(t))return this;var e=this.data[t];return delete this.data[t],this.onRemove(e),this.order.splice(this.order.indexOf(t),1),this},n.prototype.setMaxSize=function(t){var e=this;for(this.max=t;this.order.length>this.max;){var r=e.getAndRemove(e.order[0]);r&&e.onRemove(r)}return this},e.exports=n},{}],267:[function(t,e,r){function n(t,e){var r=a(s.API_URL);if(t.protocol=r.protocol,t.authority=r.authority,"/"!==r.path&&(t.path=""+r.path+t.path),!s.REQUIRE_ACCESS_TOKEN)return o(t);if(!(e=e||s.ACCESS_TOKEN))throw new Error("An API access token is required to use Mapbox GL. "+u);if("s"===e[0])throw new Error("Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). "+u);return t.params.push("access_token="+e),o(t)}function i(t){return 0===t.indexOf("mapbox:")}function a(t){var e=t.match(h);if(!e)throw new Error("Unable to parse URL object");return{protocol:e[1],authority:e[2],path:e[3]||"/",params:e[4]?e[4].split("&"):[]}}function o(t){var e=t.params.length?"?"+t.params.join("&"):"";return t.protocol+"://"+t.authority+t.path+e}var s=t("./config"),l=t("./browser"),u="See https://www.mapbox.com/api-documentation/#access-tokens";r.isMapboxURL=i,r.normalizeStyleURL=function(t,e){if(!i(t))return t;var r=a(t);return r.path="/styles/v1"+r.path,n(r,e)},r.normalizeGlyphsURL=function(t,e){if(!i(t))return t;var r=a(t);return r.path="/fonts/v1"+r.path,n(r,e)},r.normalizeSourceURL=function(t,e){if(!i(t))return t;var r=a(t);return r.path="/v4/"+r.authority+".json",r.params.push("secure"),n(r,e)},r.normalizeSpriteURL=function(t,e,r,s){var l=a(t);return i(t)?(l.path="/styles/v1"+l.path+"/sprite"+e+r,n(l,s)):(l.path+=""+e+r,o(l))};var c=/(\.(png|jpg)\d*)(?=$)/;r.normalizeTileURL=function(t,e,r){if(!e||!i(e))return t;var n=a(t),u=l.devicePixelRatio>=2||512===r?"@2x":"",h=l.supportsWebp?".webp":"$1";return n.path=n.path.replace(c,""+u+h),function(t){for(var e=0;e=65097&&t<=65103)||n["CJK Compatibility Ideographs"](t)||n["CJK Compatibility"](t)||n["CJK Radicals Supplement"](t)||n["CJK Strokes"](t)||!(!n["CJK Symbols and Punctuation"](t)||t>=12296&&t<=12305||t>=12308&&t<=12319||12336===t)||n["CJK Unified Ideographs Extension A"](t)||n["CJK Unified Ideographs"](t)||n["Enclosed CJK Letters and Months"](t)||n["Hangul Compatibility Jamo"](t)||n["Hangul Jamo Extended-A"](t)||n["Hangul Jamo Extended-B"](t)||n["Hangul Jamo"](t)||n["Hangul Syllables"](t)||n.Hiragana(t)||n["Ideographic Description Characters"](t)||n.Kanbun(t)||n["Kangxi Radicals"](t)||n["Katakana Phonetic Extensions"](t)||n.Katakana(t)&&12540!==t||!(!n["Halfwidth and Fullwidth Forms"](t)||65288===t||65289===t||65293===t||t>=65306&&t<=65310||65339===t||65341===t||65343===t||t>=65371&&t<=65503||65507===t||t>=65512&&t<=65519)||!(!n["Small Form Variants"](t)||t>=65112&&t<=65118||t>=65123&&t<=65126)||n["Unified Canadian Aboriginal Syllabics"](t)||n["Unified Canadian Aboriginal Syllabics Extended"](t)||n["Vertical Forms"](t)||n["Yijing Hexagram Symbols"](t)||n["Yi Syllables"](t)||n["Yi Radicals"](t)))},r.charHasNeutralVerticalOrientation=function(t){return!!(n["Latin-1 Supplement"](t)&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||n["General Punctuation"](t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||n["Letterlike Symbols"](t)||n["Number Forms"](t)||n["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||n["Control Pictures"](t)&&9251!==t||n["Optical Character Recognition"](t)||n["Enclosed Alphanumerics"](t)||n["Geometric Shapes"](t)||n["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||n["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||n["CJK Symbols and Punctuation"](t)||n.Katakana(t)||n["Private Use Area"](t)||n["CJK Compatibility Forms"](t)||n["Small Form Variants"](t)||n["Halfwidth and Fullwidth Forms"](t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t)},r.charHasRotatedVerticalOrientation=function(t){return!(r.charHasUprightVerticalOrientation(t)||r.charHasNeutralVerticalOrientation(t))}},{"./is_char_in_unicode_block":265}],270:[function(t,e,r){var n=t("../geo/lng_lat");e.exports=function(t,e,r){if(t=new n(t.lng,t.lat),e){var i=new n(t.lng-360,t.lat),a=new n(t.lng+360,t.lat),o=r.locationPoint(t).distSqr(e);r.locationPoint(i).distSqr(e)180;){var s=r.locationPoint(t);if(s.x>=0&&s.y>=0&&s.x<=r.width&&s.y<=r.height)break;t.lng>r.center.lng?t.lng-=360:t.lng+=360}return t}},{"../geo/lng_lat":62}],271:[function(t,e,r){function n(t,e){return Math.ceil(t/e)*e}var i={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array},a=function(){this.isTransferred=!1,this.capacity=-1,this.resize(0)};a.serialize=function(t,e){return t._trim(),e&&(t.isTransferred=!0,e.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}},a.deserialize=function(t){var e=Object.create(this.prototype);return e.arrayBuffer=t.arrayBuffer,e.length=t.length,e.capacity=t.arrayBuffer.byteLength/e.bytesPerElement,e._refreshViews(),e},a.prototype._trim=function(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())},a.prototype.clear=function(){this.length=0},a.prototype.resize=function(t){this.reserve(t),this.length=t},a.prototype.reserve=function(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);var e=this.uint8;this._refreshViews(),e&&this.uint8.set(e)}},a.prototype._refreshViews=function(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")},e.exports.StructArray=a,e.exports.Struct=function(t,e){this._structArray=t,this._pos1=e*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8},e.exports.viewTypes=i,e.exports.createLayout=function(t,e){void 0===e&&(e=1);var r=0,a=0;return{members:t.map(function(t){var o=function(t){return i[t].BYTES_PER_ELEMENT}(t.type),s=r=n(r,Math.max(e,o)),l=t.components||1;return a=Math.max(a,o),r+=o*l,{name:t.name,type:t.type,components:l,offset:s}}),size:n(r,Math.max(a,e)),alignment:e}}},{}],272:[function(t,e,r){e.exports=function(t,e){var r=!1,n=0,i=function(){n=0,r&&(t(),n=setTimeout(i,e),r=!1)};return function(){return r=!0,n||i(),n}}},{}],273:[function(t,e,r){function n(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 i(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.dx0,h=e.dx<0,f=a;fc.dy&&(l=u,u=c,c=l),u.dy>h.dy&&(l=u,u=h,h=l),c.dy>h.dy&&(l=c,c=h,h=l),u.dy&&i(h,u,a,o,s),c.dy&&i(h,c,a,o,s)}t("../geo/coordinate");var o=t("../source/tile_id").OverscaledTileID;e.exports=function(t,e,r,n){function i(e,i,a){var u,c,h;if(a>=0&&a<=s)for(u=e;u=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.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.values=function(t){var e=[];for(var r in t)e.push(t[r]);return e},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=arguments,r=[],n=arguments.length-1;n-- >0;)r[n]=e[n+1];for(var i=0,a=r;i=0)return!0;return!1};var o={};r.warnOnce=function(t){o[t]||("undefined"!=typeof console&&console.warn(t),o[t]=!0)},r.isCounterClockwise=function(t,e,r){return(r.y-t.y)*(e.x-t.x)>(e.y-t.y)*(r.x-t.x)},r.calculateSignedArea=function(t){for(var e=0,r=0,n=t.length,i=n-1,a=void 0,o=void 0;r0||Math.abs(e.y-n.y)>0)&&Math.abs(r.calculateSignedArea(t))>.01},r.sphericalToCartesian=function(t){var e=t[0],r=t[1],n=t[2];return r+=90,r*=Math.PI/180,n*=Math.PI/180,{x:e*Math.cos(r)*Math.sin(n),y:e*Math.sin(r)*Math.sin(n),z:e*Math.cos(n)}},r.parseCacheControl=function(t){var e={};if(t.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,function(t,r,n,i){var a=n||i;return e[r]=!a||a.toLowerCase(),""}),e["max-age"]){var r=parseInt(e["max-age"],10);isNaN(r)?delete e["max-age"]:e["max-age"]=r}return e}},{"../geo/coordinate":61,"../style-spec/util/deep_equal":155,"@mapbox/point-geometry":4,"@mapbox/unitbezier":7}],276:[function(t,e,r){var n=function(t,e,r,n){this.type="Feature",this._vectorTileFeature=t,t._z=e,t._x=r,t._y=n,this.properties=t.properties,null!=t.id&&(this.id=t.id)},i={geometry:{}};i.geometry.get=function(){return void 0===this._geometry&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry},i.geometry.set=function(t){this._geometry=t},n.prototype.toJSON=function(){var t={geometry:this.geometry};for(var e in this)"_geometry"!==e&&"_vectorTileFeature"!==e&&(t[e]=this[e]);return t},Object.defineProperties(n.prototype,i),e.exports=n},{}],277:[function(t,e,r){var n=t("./script_detection");e.exports=function(t){for(var r="",i=0;i":"\ufe40","?":"\ufe16","@":"\uff20","[":"\ufe47","\\":"\uff3c","]":"\ufe48","^":"\uff3e",_:"\ufe33","`":"\uff40","{":"\ufe37","|":"\u2015","}":"\ufe38","~":"\uff5e","\xa2":"\uffe0","\xa3":"\uffe1","\xa5":"\uffe5","\xa6":"\uffe4","\xac":"\uffe2","\xaf":"\uffe3","\u2013":"\ufe32","\u2014":"\ufe31","\u2018":"\ufe43","\u2019":"\ufe44","\u201c":"\ufe41","\u201d":"\ufe42","\u2026":"\ufe19","\u2027":"\u30fb","\u20a9":"\uffe6","\u3001":"\ufe11","\u3002":"\ufe12","\u3008":"\ufe3f","\u3009":"\ufe40","\u300a":"\ufe3d","\u300b":"\ufe3e","\u300c":"\ufe41","\u300d":"\ufe42","\u300e":"\ufe43","\u300f":"\ufe44","\u3010":"\ufe3b","\u3011":"\ufe3c","\u3014":"\ufe39","\u3015":"\ufe3a","\u3016":"\ufe17","\u3017":"\ufe18","\uff01":"\ufe15","\uff08":"\ufe35","\uff09":"\ufe36","\uff0c":"\ufe10","\uff0d":"\ufe32","\uff0e":"\u30fb","\uff1a":"\ufe13","\uff1b":"\ufe14","\uff1c":"\ufe3f","\uff1e":"\ufe40","\uff1f":"\ufe16","\uff3b":"\ufe47","\uff3d":"\ufe48","\uff3f":"\ufe33","\uff5b":"\ufe37","\uff5c":"\u2015","\uff5d":"\ufe38","\uff5f":"\ufe35","\uff60":"\ufe36","\uff61":"\ufe12","\uff62":"\ufe41","\uff63":"\ufe42"}},{"./script_detection":269}],278:[function(t,e,r){function n(t,e,r){void 0===r&&(r={}),Object.defineProperty(e,"_classRegistryKey",{value:t,writeable:!1}),g[t]={klass:e,omit:r.omit||[],shallow:r.shallow||[]}}var i=t("grid-index"),a=t("../style-spec/util/color"),o=t("../style-spec/expression"),s=o.StylePropertyFunction,l=o.StyleExpression,u=o.StyleExpressionWithErrorHandling,c=o.ZoomDependentExpression,h=o.ZoomConstantExpression,f=t("../style-spec/expression/compound_expression").CompoundExpression,p=t("../style-spec/expression/definitions"),d=t("./window").ImageData,g={};for(var v in n("Object",Object),i.serialize=function(t,e){var r=t.toArrayBuffer();return e&&e.push(r),r},i.deserialize=function(t){return new i(t)},n("Grid",i),n("Color",a),n("StylePropertyFunction",s),n("StyleExpression",l,{omit:["_evaluator"]}),n("StyleExpressionWithErrorHandling",u,{omit:["_evaluator"]}),n("ZoomDependentExpression",c),n("ZoomConstantExpression",h),n("CompoundExpression",f,{omit:["_evaluate"]}),p)p[v]._classRegistryKey||n("Expression_"+v,p[v]);e.exports={register:n,serialize:function t(e,r){if(null===e||void 0===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp)return e;if(e instanceof ArrayBuffer)return r&&r.push(e),e;if(ArrayBuffer.isView(e)){var n=e;return r&&r.push(n.buffer),n}if(e instanceof d)return r&&r.push(e.data.buffer),e;if(Array.isArray(e)){for(var i=[],a=0,o=e;a=0)){var f=e[h];c[h]=g[u].shallow.indexOf(h)>=0?f:t(f,r)}return{name:u,properties:c}}throw new Error("can't serialize object of type "+typeof e)},deserialize:function t(e){if(null===e||void 0===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||e instanceof Boolean||e instanceof Number||e instanceof String||e instanceof Date||e instanceof RegExp||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||e instanceof d)return e;if(Array.isArray(e))return e.map(function(e){return t(e)});if("object"==typeof e){var r=e,n=r.name,i=r.properties;if(!n)throw new Error("can't deserialize object of anonymous class");var a=g[n].klass;if(!a)throw new Error("can't deserialize unregistered class "+n);if(a.deserialize)return a.deserialize(i._serialized);for(var o=Object.create(a.prototype),s=0,l=Object.keys(i);s=0?i[u]:t(i[u])}return o}throw new Error("can't deserialize object of type "+typeof e)}}},{"../style-spec/expression":139,"../style-spec/expression/compound_expression":123,"../style-spec/expression/definitions":131,"../style-spec/util/color":153,"./window":254,"grid-index":24}],279:[function(t,e,r){var n=t("./web_worker"),i=function(){this.active={}};i.prototype.acquire=function(e){if(!this.workers){var r=t("../").workerCount;for(this.workers=[];this.workers.length0}function Iq(t){var e={},r={};switch(t.type){case"circle":ne.extendFlat(r,{"circle-radius":t.circle.radius,"circle-color":t.color,"circle-opacity":t.opacity});break;case"line":ne.extendFlat(r,{"line-width":t.line.width,"line-color":t.color,"line-opacity":t.opacity});break;case"fill":ne.extendFlat(r,{"fill-color":t.color,"fill-outline-color":t.fill.outlinecolor,"fill-opacity":t.opacity});break;case"symbol":var n=t.symbol,i=Cq(n.textposition,n.iconsize);ne.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}),ne.extendFlat(r,{"icon-color":t.color,"text-color":n.textfont.color,"text-opacity":t.opacity})}return{layout:e,paint:r}}zq.update=function(t){this.visible?this.needsNewSource(t)?(this.updateLayer(t),this.updateSource(t)):this.needsNewLayer(t)?this.updateLayer(t):this.updateStyle(t):(this.updateSource(t),this.updateLayer(t)),this.visible=Pq(t)},zq.needsNewSource=function(t){return this.sourceType!==t.sourcetype||this.source!==t.source||this.layerType!==t.type},zq.needsNewLayer=function(t){return this.layerType!==t.type||this.below!==t.below},zq.updateSource=function(t){var e=this.map;if(e.getSource(this.idSource)&&e.removeSource(this.idSource),this.sourceType=t.sourcetype,this.source=t.source,Pq(t)){var r=function(t){var e,r=t.sourcetype,n=t.source,i={type:r};"geojson"===r?e="data":"vector"===r&&(e="string"==typeof n?"url":"tiles");return i[e]=n,i}(t);e.addSource(this.idSource,r)}},zq.updateLayer=function(t){var e=this.map,r=Iq(t);e.getLayer(this.idLayer)&&e.removeLayer(this.idLayer),this.layerType=t.type,Pq(t)&&e.addLayer({id:this.idLayer,source:this.idSource,"source-layer":t.sourcelayer||"",type:t.type,layout:r.layout,paint:r.paint},t.below)},zq.updateStyle=function(t){if(Pq(t)){var e=Iq(t);this.mapbox.setOptions(this.idLayer,"setLayoutProperty",e.layout),this.mapbox.setOptions(this.idLayer,"setPaintProperty",e.paint)}},zq.dispose=function(){var t=this.map;t.removeLayer(this.idLayer),t.removeSource(this.idSource)};var Dq=function(t,e,r){var n=new Lq(t,e);return n.update(r),n};function Oq(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=[]}var Rq=Oq.prototype,Fq=function(t){return new Oq(t)};function Bq(t){var e=Sq.style.values,r=Sq.style.dflt,n={};return ne.isPlainObject(t)?(n.id=t.id,n.style=t):"string"==typeof t?(n.id=t,n.style=-1!==e.indexOf(t)?Nq(t):t):(n.id=r,n.style=Nq(r)),n.transition={duration:0,delay:0},n}function Nq(t){return _q.styleUrlPrefix+t+"-"+_q.styleUrlSuffix}function jq(t){return[t.lon,t.lat]}Rq.plot=function(t,e,r){var n,i=this,a=i.opts=e[this.id];i.map&&a.accesstoken!==i.accessToken&&(i.map.remove(),i.map=null,i.styleObj=null,i.traceHash=[],i.layerList={}),n=i.map?new Promise(function(r,n){i.updateMap(t,e,r,n)}):new Promise(function(r,n){i.createMap(t,e,r,n)}),r.push(n)},Rq.createMap=function(t,e,r,n){var i=this,a=i.gd,o=i.opts,s=i.styleObj=Bq(o.style);i.accessToken=o.accesstoken;var l=i.map=new bq.Map({container:i.div,style:s.style,center:jq(o.center),zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,interactive:!i.isStatic,preserveDrawingBuffer:i.isStatic,doubleClickZoom:!1,boxZoom:!1}),u=_q.controlContainerClassName,c=i.div.getElementsByClassName(u)[0];function h(){yo.loneUnhover(e._toppaper)}i.div.removeChild(c),l._canvas.style.left="0px",l._canvas.style.top="0px",i.rejectOnError(n),l.once("load",function(){i.updateData(t),i.updateLayout(e),i.resolveOnRender(r)}),i.isStatic||(l.on("moveend",function(t){if(i.map){var e=i.getView();if(o._input.center=o.center=e.center,o._input.zoom=o.zoom=e.zoom,o._input.bearing=o.bearing=e.bearing,o._input.pitch=o.pitch=e.pitch,t.originalEvent){var r={};r[i.id]=ne.extendFlat({},e),a.emit("plotly_relayout",r)}}}),l.on("mousemove",function(t){var e=i.div.getBoundingClientRect();t.clientX=t.point.x+e.left,t.clientY=t.point.y+e.top,t.target.getBoundingClientRect=function(){return e},i.xaxis.p2c=function(){return t.lngLat.lng},i.yaxis.p2c=function(){return t.lngLat.lat},yo.hover(a,t,i.id)}),l.on("click",function(t){yo.click(a,t.originalEvent)}),l.on("dragstart",h),l.on("zoomstart",h),l.on("dblclick",function(){var t=i.viewInitial;l.setCenter(jq(t.center)),l.setZoom(t.zoom),l.setBearing(t.bearing),l.setPitch(t.pitch);var e=i.getView();o._input.center=o.center=e.center,o._input.zoom=o.zoom=e.zoom,o._input.bearing=o.bearing=e.bearing,o._input.pitch=o.pitch=e.pitch,a.emit("plotly_doubleclick",null)}),i.clearSelect=function(){a._fullLayout._zoomlayer.selectAll(".select-outline").remove()})},Rq.updateMap=function(t,e,r,n){var i=this,a=i.map;i.rejectOnError(n);var o=Bq(i.opts.style);i.styleObj.id!==o.id?(i.styleObj=o,a.setStyle(o.style),a.once("styledata",function(){i.traceHash={},i.updateData(t),i.updateLayout(e),i.resolveOnRender(r)})):(i.updateData(t),i.updateLayout(e),i.resolveOnRender(r))},Rq.updateData=function(t){var e,r,n,i,a=this.traceHash;for(n=0;n=0?Math.floor((e+180)/360):Math.ceil((e-180)/360)),u=e-l;if(yo.getClosest(n,function(t){var e=t.lonlat;if(e[0]===Zq)return 1/0;var n=ne.wrap180(e[0]),i=e[1],l=s.project([n,i]),c=l.x-a.c2p([u,i]),h=l.y-o.c2p([n,r]),f=Math.max(3,t.mrc||0);return Math.max(Math.sqrt(c*c+h*h)-f,1-3/f)},t),!1!==t.index){var c=n[t.index],h=c.lonlat,f=[ne.wrap180(h[0])+l,h[1]],p=a.c2p(f),d=o.c2p(f),g=c.mrc||1;return t.x0=p-g,t.x1=p+g,t.y0=d-g,t.y1=d+g,t.color=mx(i,c),t.extraText=function(t,e,r){var n=(e.hi||t.hoverinfo).split("+"),i=-1!==n.indexOf("all"),a=-1!==n.indexOf("lon"),o=-1!==n.indexOf("lat"),s=e.lonlat,l=[];function u(t){return t+"\xb0"}return i||a&&o?l.push("("+u(s[0])+", "+u(s[1])+")"):a?l.push(r.lon+u(s[0])):o&&l.push(r.lat+u(s[1])),(i||-1!==n.indexOf("text"))&&xo(e,t,l),l.join("
")}(i,c,n[0].t.labels),[t]}},iH.eventData=function(t,e){return t.lon=e.lon,t.lat=e.lat,t},iH.selectPoints=function(t,e){var r,n=t.cd,i=t.xaxis,a=t.yaxis,o=[],s=n[0].trace;if(!Tr.hasMarkers(s))return[];if(!1===e)for(r=0;r0?1:-1}function VH(t){return jH(Math.cos(t))}function UH(t){return jH(Math.sin(t))}LH.plot=function(t,e){var r=e[this.id];this._hasClipOnAxisFalse=!1;for(var n=0;n=90||s>90&&l>=450?1:c<=0&&f<=0?0:Math.max(c,f);e=s<=180&&l>=180||s>180&&l>=540?-1:u>=0&&h>=0?0:Math.min(u,h);r=s<=270&&l>=270||s>270&&l>=630?-1:c>=0&&f>=0?0:Math.min(c,f);n=l>=360?1:u<=0&&h<=0?0:Math.max(u,h);return[e,r,n,i]}(d),v=g[2]-g[0],m=g[3]-g[1],y=p/f,x=Math.abs(m/v);y>x?(s=f,h=(p-(l=f*x))/i.h/2,u=[a[0],a[1]],c=[o[0]+h,o[1]-h]):(l=p,h=(f-(s=p/x))/i.w/2,u=[a[0]+h,a[1]-h],c=[o[0],o[1]]),r.xLength2=s,r.yLength2=l,r.xDomain2=u,r.yDomain2=c;var b=r.xOffset2=i.l+i.w*u[0],_=r.yOffset2=i.t+i.h*(1-c[1]),w=r.radius=s/v,M=r.cx=b-w*g[0],A=r.cy=_+w*g[3],k=r.cxx=M-b,T=r.cyy=A-_;r.updateRadialAxis(t,e),r.updateRadialAxisTitle(t,e),r.updateAngularAxis(t,e);var S=r.radialAxis.range,E=S[1]-S[0],C=r.xaxis={type:"linear",_id:"x",range:[g[0]*E,g[2]*E],domain:u};ri.setConvert(C,t),C.setScale();var L=r.yaxis={type:"linear",_id:"y",range:[g[1]*E,g[3]*E],domain:c};ri.setConvert(L,t),L.setScale(),C.isPtWithinRange=function(t){return r.isPtWithinSector(t)},L.isPtWithinRange=function(){return!0},n.frontplot.attr("transform",BH(b,_)).call(Sr.setClipUrl,r._hasClipOnAxisFalse?null:r.clipIds.circle),n.bgcircle.attr({d:OH(w,d),transform:BH(M,A)}).call(Oe.fill,e.bgcolor),r.clipPaths.circle.select("path").attr("d",OH(w,d)).attr("transform",BH(k,T)),r.framework.selectAll(".crisp").classed("crisp",0)},LH.updateRadialAxis=function(t,e){var r=this.gd,n=this.layers,i=this.radius,a=this.cx,o=this.cy,s=t._size,l=e.radialaxis,u=e.sector,c=TH(u[0]);this.fillViewInitialKey("radialaxis.angle",l.angle);var h=this.radialAxis=ne.extendFlat({},l,{_axislayer:n["radial-axis"],_gridlayer:n["radial-grid"],_id:"x",_pos:0,side:{counterclockwise:"top",clockwise:"bottom"}[l.side],domain:[0,i/s.w],anchor:"free",position:0,_counteraxis:!0,automargin:!1});PH(h,l,t),_H(h),l.range=h.range.slice(),l._input.range=h.range.slice(),this.fillViewInitialKey("radialaxis.range",h.range.slice()),"auto"===h.tickangle&&c>90&&c<=270&&(h.tickangle=180),h._transfn=function(t){return"translate("+h.l2p(t.x)+",0)"},h._gridpath=function(t){return DH(h.r2p(t.x),u)};var f=IH(l);this.radialTickLayout!==f&&(n["radial-axis"].selectAll(".xtick").remove(),this.radialTickLayout=f),ri.doTicks(r,h,!0),FH(n["radial-axis"],l.showticklabels||l.ticks,{transform:BH(a,o)+NH(-l.angle)}),FH(n["radial-grid"],l.showgrid,{transform:BH(a,o)}).selectAll("path").attr("transform",null),FH(n["radial-line"].select("line"),l.showline,{x1:0,y1:0,x2:i,y2:0,transform:BH(a,o)+NH(-l.angle)}).attr("stroke-width",l.linewidth).call(Oe.stroke,l.linecolor)},LH.updateRadialAxisTitle=function(t,e,r){var n=this.gd,i=this.radius,a=this.cx,o=this.cy,s=e.radialaxis,l=this.id+"title",u=void 0!==r?r:s.angle,c=AH(u),h=Math.cos(c),f=Math.sin(c),p=0;if(s.title){var d=Sr.bBox(this.layers["radial-axis"].node()).height,g=s.titlefont.size;p="counterclockwise"===s.side?-d-.4*g:d+.8*g}this.layers["radial-axis-title"]=Dn.draw(n,l,{propContainer:s,propName:this.id+".radialaxis.title",placeholder:MH(n,"Click to enter radial axis title"),attributes:{x:a+i/2*h+p*f,y:o-i/2*f+p*h,"text-anchor":"middle"},transform:{rotate:-u}})},LH.updateAngularAxis=function(t,r){var n=this,i=n.gd,a=n.layers,o=n.radius,s=n.cx,l=n.cy,u=r.angularaxis,c=r.sector,h=c.map(AH);n.fillViewInitialKey("angularaxis.rotation",u.rotation);var f=n.angularAxis=ne.extendFlat({},u,{_axislayer:a["angular-axis"],_gridlayer:a["angular-grid"],_id:"angular",_pos:0,side:"right",domain:[0,Math.PI],anchor:"free",position:0,_counteraxis:!0,automargin:!1,autorange:!1});if("linear"===f.type)RH(c)?f.range=c.slice():f.range=h.map(f.unTransformRad).map(kH),"radians"===f.thetaunit&&(f.tick0=kH(f.tick0),f.dtick=kH(f.dtick));else if("category"===f.type){var p=u.period?Math.max(u.period,u._categories.length):u._categories.length;f.range=[0,p],f._tickFilter=function(t){return n.isPtWithinSector({r:n.radialAxis.range[1],rad:f.c2rad(t.x)})}}function d(t){return f.c2rad(t.x,"degrees")}function g(t){return[o*Math.cos(t),o*Math.sin(t)]}PH(f,u,t),f._transfn=function(t){var r=d(t),n=g(r),i=BH(s+n[0],l-n[1]),a=e.select(this);return a&&a.node()&&a.classed("ticks")&&(i+=NH(-kH(r))),i},f._gridpath=function(t){var e=g(d(t));return"M0,0L"+-e[0]+","+e[1]};var v="outside"!==u.ticks?.7:.5;f._labelx=function(t){var e=d(t),r=f._labelStandoff,n=f._pad;return(0===UH(e)?0:Math.cos(e)*(r+n+v*t.fontSize))+VH(e)*(t.dx+r+n)},f._labely=function(t){var e=d(t),r=f._labelStandoff,n=f._labelShift,i=f._pad;return t.dy+t.fontSize*wH-n+-Math.sin(e)*(r+i+v*t.fontSize)},f._labelanchor=function(t,e){var r=d(e);return 0===UH(r)?VH(r)>0?"start":"end":"middle"};var m=IH(u);n.angularTickLayout!==m&&(a["angular-axis"].selectAll(".angulartick").remove(),n.angularTickLayout=m),ri.doTicks(i,f,!0),FH(a["angular-line"].select("path"),u.showline,{d:OH(o,c),transform:BH(s,l)}).attr("stroke-width",u.linewidth).call(Oe.stroke,u.linecolor)},LH.updateFx=function(t,e){this.gd._context.staticPlot||(this.updateAngularDrag(t,e),this.updateRadialDrag(t,e),this.updateMainDrag(t,e))},LH.updateMainDrag=function(t,r){var n=this,i=n.gd,a=n.layers,o=t._zoomlayer,l=oH.MINZOOM,u=oH.OFFEDGE,c=n.radius,h=n.cx,f=n.cy,p=n.cxx,d=n.cyy,g=r.sector,v=Bm.makeDragger(a,"path","maindrag","crosshair");e.select(v).attr("d",OH(c,g)).attr("transform",BH(h,f));var m,y,x,b,_,w,M,A,k,T={element:v,gd:i,subplot:n.id,plotinfo:{xaxis:n.xaxis,yaxis:n.yaxis},xaxes:[n.xaxis],yaxes:[n.yaxis]};function S(t,e){var r=t-p,n=e-d;return Math.sqrt(r*r+n*n)}function E(t,e){return Math.atan2(d-e,t-p)}function C(t,e){return[t*Math.cos(e),t*Math.sin(-e)]}function L(t,e){var r=oH.cornerLen,n=oH.cornerHalfWidth;if(0===t)return OH(2*n,g);var i=r/t/2,a=e-i,o=e+i,s=Math.max(0,Math.min(t,c)),l=s-n,u=s+n;return"M"+C(l,a)+"A"+[l,l]+" 0,0,0 "+C(l,o)+"L"+C(u,o)+"A"+[u,u]+" 0,0,1 "+C(u,a)+"Z"}function z(t,e){var r,n,i=m+t,a=y+e,o=S(m,y),s=Math.min(S(i,a),c),h=E(m,y),f=E(i,a);ol?(o0==c>f[0]){y=u.range[1]=c,ri.doTicks(i,n.radialAxis,!0),a["radial-grid"].attr("transform",BH(s,l)).selectAll("path").attr("transform",null);var d=y-f[0],g=n.sectorBBox;for(var v in n.xaxis.range=[g[0]*d,g[2]*d],n.yaxis.range=[g[1]*d,g[3]*d],n.xaxis.setScale(),n.yaxis.setScale(),n.traceHash){var m=n.traceHash[v],x=ne.filterVisible(m),b=m[0][0].trace._module,_=i._fullLayout[n.id];if(b.plot(i,n,x,_),!P.traceIs(v,"gl"))for(var w=0;wo&&(o+=360);var s,l,u=TH(kH(t.rad)),c=u+360;return n[1]>=n[0]?(s=n[0],l=n[1]):(s=n[1],l=n[0]),i>=s&&i<=l&&(RH(e)||u>=a&&u<=o||c>=a&&c<=o)},LH.fillViewInitialKey=function(t,e){t in this.viewInitial||(this.viewInitial[t]=e)};var qH=sa.getSubplotCalcData,HH=ne.counterRegex,GH=oH.attr,WH=oH.name,YH=HH(WH),XH={};XH[GH]={valType:"subplotid",dflt:WH,editType:"calc"};var ZH={attr:GH,name:WH,idRoot:WH,idRegex:YH,attrRegex:YH,attributes:XH,layoutAttributes:dH,supplyLayoutDefaults:function(t,e,r){Jc(t,e,0,{type:oH.name,attributes:dH,handleDefaults:xH,font:e.font,paper_bgcolor:e.paper_bgcolor,fullData:r,layoutOut:e})},plot:function(t){for(var e=t._fullLayout,r=t.calcdata,n=e._subplots[WH],i=0;i")}var nG={hoverPoints:function(t,e,r,n){var i=yx(t,e,r,n);if(i&&!1!==i[0].index){var a=i[0];if(void 0===a.index)return i;var o=t.subplot,s=a.cd[a.index],l=a.trace;if(o.isPtWithinSector(s))return a.xLabelVal=void 0,a.yLabelVal=void 0,a.extraText=rG(s,l,o),i}},makeHoverPointText:rG},iG=t.BADNUM,aG={moduleType:"trace",name:"scatterpolar",basePlotModule:ZH,categories:["polar","symbols","markerColorscale","showLegend","scatter-like"],attributes:QH,supplyDefaults:function(t,e,r,n){function i(r,n){return ne.coerce(t,e,QH,r,n)}var a=i("r"),o=i("theta"),s=a&&o?Math.min(a.length,o.length):0;if(s){e._length=s,i("thetaunit"),i("mode",sl[1]?function(t){return t<=0}:function(t){return t>=0},n=0;n=0?(f=i.c2r(h)-o[0],w=p,d=a.c2rad(w,v.thetaunit),k[c]=A[2*c]=f*Math.cos(d),T[c]=A[2*c+1]=f*Math.sin(d)):k[c]=T[c]=A[2*c]=A[2*c+1]=NaN;var S=yq.sceneOptions(t,e,v,A);S.fill&&!s.fill2d&&(s.fill2d=!0),S.marker&&!s.scatter2d&&(s.scatter2d=!0),S.line&&!s.line2d&&(s.line2d=!0),!S.errorX&&!S.errorY||s.error2d||(s.error2d=!0),Tr.hasMarkers(v)&&(S.selected.positions=S.unselected.positions=S.marker.positions),s.lineOptions.push(S.line),s.errorXOptions.push(S.errorX),s.errorYOptions.push(S.errorY),s.fillOptions.push(S.fill),s.markerOptions.push(S.marker),s.selectedOptions.push(S.selected),s.unselectedOptions.push(S.unselected),s.count=n.length,m.scene=s,m.index=u,m.x=k,m.y=T,m.rawx=k,m.rawy=T,m.r=y,m.theta=x,m.positions=A,m.count=M,m.tree=vV(A,512)}}),yq.plot(t,e,n)},hoverPoints:function(t,e,r,n){var i=t.cd[0].t,a=i.r,o=i.theta,s=yq.hoverPoints(t,e,r,n);if(s&&!1!==s[0].index){var l=s[0];if(void 0===l.index)return s;var u=t.subplot,c=u.angularAxis,h=l.cd[l.index],f=l.trace;if(h.r=a[l.index],h.theta=o[l.index],h.rad=c.c2rad(h.theta,f.thetaunit),u.isPtWithinSector(h))return l.xLabelVal=void 0,l.yLabelVal=void 0,l.extraText=lG(h,f,u),s}},style:yq.style,selectPoints:yq.selectPoints,meta:{}},cG=m.extendFlat,hG={title:Ce.title,titlefont:Ce.titlefont,color:Ce.color,tickmode:Ce.tickmode,nticks:cG({},Ce.nticks,{dflt:6,min:1}),tick0:Ce.tick0,dtick:Ce.dtick,tickvals:Ce.tickvals,ticktext:Ce.ticktext,ticks:Ce.ticks,ticklen:Ce.ticklen,tickwidth:Ce.tickwidth,tickcolor:Ce.tickcolor,showticklabels:Ce.showticklabels,showtickprefix:Ce.showtickprefix,tickprefix:Ce.tickprefix,showticksuffix:Ce.showticksuffix,ticksuffix:Ce.ticksuffix,showexponent:Ce.showexponent,exponentformat:Ce.exponentformat,separatethousands:Ce.separatethousands,tickfont:Ce.tickfont,tickangle:Ce.tickangle,tickformat:Ce.tickformat,tickformatstops:Ce.tickformatstops,hoverformat:Ce.hoverformat,showline:cG({},Ce.showline,{dflt:!0}),linecolor:Ce.linecolor,linewidth:Ce.linewidth,showgrid:cG({},Ce.showgrid,{dflt:!0}),gridcolor:Ce.gridcolor,gridwidth:Ce.gridwidth,layer:Ce.layer,min:{valType:"number",dflt:0,min:0}},fG=function(t,e,r){function n(r,n){return ne.coerce(t,e,hG,r,n)}e.type="linear";var i=n("color"),a=i===t.color?i:r.font.color,o=e._name.charAt(0).toUpperCase(),s="Component "+o,l=n("title",s);e._hovertitle=l===s?l:o,ne.coerceFont(n,"titlefont",{family:r.font.family,size:Math.round(1.2*r.font.size),color:a}),n("min"),Ge(t,e,n,"linear"),Ue(t,e,n,"linear",{}),qe(t,e,n,{outerTicks:!0}),n("showticklabels")&&(ne.coerceFont(n,"tickfont",{family:r.font.family,size:r.font.size,color:a}),n("tickangle"),n("tickformat")),Zi(t,e,n,{dfltColor:i,bgColor:r.bgColor,blend:60,showLine:!0,showGrid:!0,noZeroLine:!0,attributes:hG}),n("hoverformat"),n("layer")},pG=qc.attributes,dG=(0,ye.overrideAll)({domain:pG({name:"ternary"}),bgcolor:{valType:"color",dflt:C.background},sum:{valType:"number",dflt:1,min:0},aaxis:hG,baxis:hG,caxis:hG},"plot","from-root"),gG=["aaxis","baxis","caxis"];function vG(t,e,r,n){var i,a,o,s=r("bgcolor"),l=r("sum");n.bgColor=Oe.combine(s,n.paper_bgcolor);for(var u=0;u=l&&(c.min=0,h.min=0,f.min=0,t.aaxis&&delete t.aaxis.min,t.baxis&&delete t.baxis.min,t.caxis&&delete t.caxis.min)}var mG=ne._,yG=m.extendFlat;function xG(t,e){this.id=t.id,this.graphDiv=t.graphDiv,this.init(e),this.makeFramework(e)}var bG=xG,_G=xG.prototype;_G.init=function(t){this.container=t._ternarylayer,this.defs=t._defs,this.layoutId=t._uid,this.traceHash={},this.layers={}},_G.plot=function(t,e){var r=e[this.id],n=e._size;this._hasClipOnAxisFalse=!1;for(var i=0;iwG*g?i=(a=g)*wG:a=(i=d)/wG,o=f*i/d,s=p*a/g,r=e.l+e.w*c-i/2,n=e.t+e.h*(1-h)-a/2,l.x0=r,l.y0=n,l.w=i,l.h=a,l.sum=v,l.xaxis={type:"linear",range:[m+2*x-v,v-m-2*y],domain:[c-o/2,c+o/2],_id:"x"},ei(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:[m,v-y-x],domain:[h-s/2,h+s/2],_id:"y"},ei(l.yaxis,l.graphDiv._fullLayout),l.yaxis.setScale(),l.yaxis.isPtWithinRange=function(){return!0};var b=l.yaxis.domain[0],_=l.aaxis=yG({},t.aaxis,{visible:!0,range:[m,v-y-x],side:"left",_counterangle:30,tickangle:(+t.aaxis.tickangle||0)-30,domain:[b,b+s*wG],_axislayer:l.layers.aaxis,_gridlayer:l.layers.agrid,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l"+a+",-"+i/2,automargin:!1});ei(_,l.graphDiv._fullLayout),_.setScale();var w=l.baxis=yG({},t.baxis,{visible:!0,range:[v-m-x,y],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,automargin:!1});ei(w,l.graphDiv._fullLayout),w.setScale(),_._counteraxis=w;var M=l.caxis=yG({},t.caxis,{visible:!0,range:[v-m-y,x],side:"right",_counterangle:30,tickangle:(+t.caxis.tickangle||0)+30,domain:[b,b+s*wG],_axislayer:l.layers.caxis,_gridlayer:l.layers.cgrid,_counteraxis:l.baxis,_pos:0,_id:"y",_length:i,_gridpath:"M0,0l-"+a+","+i/2,automargin:!1});ei(M,l.graphDiv._fullLayout),M.setScale();var A="M"+r+","+(n+a)+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDef.select("path").attr("d",A),l.layers.plotbg.select("path").attr("d",A);var k="M0,"+a+"h"+i+"l-"+i/2+",-"+a+"Z";l.clipDefRelative.select("path").attr("d",k);var T="translate("+r+","+n+")";l.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",T),l.clipDefRelative.select("path").attr("transform",null);var S="translate("+(r-w._offset)+","+(n+a)+")";l.layers.baxis.attr("transform",S),l.layers.bgrid.attr("transform",S);var E="translate("+(r+i/2)+","+n+")rotate(30)translate(0,"+-_._offset+")";l.layers.aaxis.attr("transform",E),l.layers.agrid.attr("transform",E);var C="translate("+(r+i/2)+","+n+")rotate(-30)translate(0,"+-M._offset+")";l.layers.caxis.attr("transform",C),l.layers.cgrid.attr("transform",C),l.drawAxes(!0),l.plotContainer.selectAll(".crisp").classed("crisp",!1),l.layers.aline.select("path").attr("d",_.showline?"M"+r+","+(n+a)+"l"+i/2+",-"+a:"M0,0").call(Oe.stroke,_.linecolor||"#000").style("stroke-width",(_.linewidth||0)+"px"),l.layers.bline.select("path").attr("d",w.showline?"M"+r+","+(n+a)+"h"+i:"M0,0").call(Oe.stroke,w.linecolor||"#000").style("stroke-width",(w.linewidth||0)+"px"),l.layers.cline.select("path").attr("d",M.showline?"M"+(r+i/2)+","+n+"l"+i/2+","+a:"M0,0").call(Oe.stroke,M.linecolor||"#000").style("stroke-width",(M.linewidth||0)+"px"),l.graphDiv._context.staticPlot||l.initInteractions(),Sr.setClipUrl(l.layers.frontplot,l._hasClipOnAxisFalse?null:l.clipId)},_G.drawAxes=function(t){var e=this.graphDiv,r=this.id.substr(7)+"title",n=this.aaxis,i=this.baxis,a=this.caxis;if(ri.doTicks(e,n,!0),ri.doTicks(e,i,!0),ri.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));this.layers["a-title"]=Dn.draw(e,"a"+r,{propContainer:n,propName:this.id+".aaxis.title",placeholder:mG(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;this.layers["b-title"]=Dn.draw(e,"b"+r,{propContainer:i,propName:this.id+".baxis.title",placeholder:mG(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"}}),this.layers["c-title"]=Dn.draw(e,"c"+r,{propContainer:a,propName:this.id+".caxis.title",placeholder:mG(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 MG=Te.MINZOOM/2+.87,AG="m-0.87,.5h"+MG+"v3h-"+(MG+5.2)+"l"+(MG/2+2.6)+",-"+(.87*MG+4.5)+"l2.6,1.5l-"+MG/2+","+.87*MG+"Z",kG="m0.87,.5h-"+MG+"v3h"+(MG+5.2)+"l-"+(MG/2+2.6)+",-"+(.87*MG+4.5)+"l-2.6,1.5l"+MG/2+","+.87*MG+"Z",TG="m0,1l"+MG/2+","+.87*MG+"l2.6,-1.5l-"+(MG/2+2.6)+",-"+(.87*MG+4.5)+"l-"+(MG/2+2.6)+","+(.87*MG+4.5)+"l2.6,1.5l"+MG/2+",-"+.87*MG+"Z",SG="m0.5,0.5h5v-2h-5v-5h-2v5h-5v2h5v5h2Z",EG=!0;function CG(t){e.select(t).selectAll(".zoombox,.js-zoombox-backdrop,.js-zoombox-menu,.zoombox-corners").remove()}_G.initInteractions=function(){var t,e,r,n,i,a,o,l,u,c,h=this,f=h.layers.plotbg.select("path").node(),p=h.graphDiv,d=p._fullLayout._zoomlayer,g={element:f,gd:p,plotinfo:{xaxis:h.xaxis,yaxis:h.yaxis},subplot:h.id,prepFn:function(v,m,y){g.xaxes=[h.xaxis],g.yaxes=[h.yaxis];var A=p._fullLayout.dragmode;v.shiftKey&&(A="pan"===A?"zoom":"pan"),g.minDrag="lasso"===A?1:void 0,"zoom"===A?(g.moveFn=x,g.doneFn=b,function(p,g,v){var m=f.getBoundingClientRect();t=g-m.left,e=v-m.top,r={a:h.aaxis.range[0],b:h.baxis.range[1],c:h.caxis.range[1]},i=r,n=h.aaxis.range[1]-r.a,a=s(h.graphDiv._fullLayout[h.id].bgcolor).getLuminance(),o="M0,"+h.h+"L"+h.w/2+", 0L"+h.w+","+h.h+"Z",l=!1,u=d.append("path").attr("class","zoombox").attr("transform","translate("+h.x0+", "+h.y0+")").style({fill:a>.2?"rgba(0,0,0,0)":"rgba(255,255,255,0)","stroke-width":0}).attr("d",o),c=d.append("path").attr("class","zoombox-corners").attr("transform","translate("+h.x0+", "+h.y0+")").style({fill:Oe.background,stroke:Oe.defaultLine,"stroke-width":1,opacity:0}).attr("d","M0,0Z"),M()}(0,m,y)):"pan"===A?(g.moveFn=_,g.doneFn=w,r={a:h.aaxis.range[0],b:h.baxis.range[1],c:h.caxis.range[1]},i=r,M()):"select"!==A&&"lasso"!==A||_c(v,m,y,g,A)},clickFn:function(t,e){if(CG(p),2===t){var r={};r[h.id+".aaxis.min"]=0,r[h.id+".baxis.min"]=0,r[h.id+".caxis.min"]=0,p.emit("plotly_doubleclick",null),P.call("relayout",p,r)}yo.click(p,e,h.id)}};function v(t,e){return 1-e/h.h}function m(t,e){return 1-(t+(h.h-e)/Math.sqrt(3))/h.w}function y(t,e){return(t-(h.h-e)/Math.sqrt(3))/h.w}function x(s,f){var p=t+s,d=e+f,g=Math.max(0,Math.min(1,v(0,e),v(0,d))),x=Math.max(0,Math.min(1,m(t,e),m(p,d))),b=Math.max(0,Math.min(1,y(t,e),y(p,d))),_=(g/2+b)*h.w,w=(1-g/2-x)*h.w,M=(_+w)/2,A=w-_,k=(1-g)*h.h,T=k-A/wG;A.2?"rgba(0,0,0,0.4)":"rgba(255,255,255,0.3)").duration(200),c.transition().style("opacity",1).duration(200),l=!0)}function b(){if(CG(p),i!==r){var t={};t[h.id+".aaxis.min"]=i.a,t[h.id+".baxis.min"]=i.b,t[h.id+".caxis.min"]=i.c,P.call("relayout",p,t),EG&&p.data&&p._context.showTips&&(ne.notifier(mG(p,"Double-click to zoom back out"),"long"),EG=!1)}}function _(t,e){var n=t/h.xaxis._m,a=e/h.yaxis._m,o=[(i={a:r.a-a,b:r.b+(n+a)/2,c:r.c-(n-a)/2}).a,i.b,i.c].sort(),s=o.indexOf(i.a),l=o.indexOf(i.b),u=o.indexOf(i.c);o[0]<0&&(o[1]+o[0]/2<0?(o[2]+=o[0]+o[1],o[0]=o[1]=0):(o[2]+=o[0]/2,o[1]+=o[0]/2,o[0]=0),i={a:o[s],b:o[l],c:o[u]},e=(r.a-i.a)*h.yaxis._m,t=(r.c-i.c-r.b+i.b)*h.xaxis._m);var c="translate("+(h.x0+t)+","+(h.y0+e)+")";h.plotContainer.selectAll(".scatterlayer,.maplayer").attr("transform",c);var f="translate("+-t+","+-e+")";h.clipDefRelative.select("path").attr("transform",f),h.aaxis.range=[i.a,h.sum-i.b-i.c],h.baxis.range=[h.sum-i.a-i.c,i.b],h.caxis.range=[h.sum-i.a-i.b,i.c],h.drawAxes(!1),h.plotContainer.selectAll(".crisp").classed("crisp",!1),h._hasClipOnAxisFalse&&h.plotContainer.select(".scatterlayer").selectAll(".trace").call(Sr.hideOutsideRangePoints,h)}function w(){var t={};t[h.id+".aaxis.min"]=i.a,t[h.id+".baxis.min"]=i.b,t[h.id+".caxis.min"]=i.c,P.call("relayout",p,t)}function M(){d.selectAll(".select-outline").remove()}f.onmousemove=function(t){yo.hover(p,t,h.id),p._fullLayout._lasthover=f,p._fullLayout._hoversubplot=h.id},f.onmouseout=function(t){p._dragging||Ua.unhover(p,t)},Ua.init(g)};var LG={},zG=sa.getSubplotCalcData,PG=ne.counterRegex;LG.name="ternary",LG.attr="subplot",LG.idRoot="ternary",LG.idRegex=LG.attrRegex=PG("ternary"),LG.attributes={subplot:{valType:"subplotid",dflt:"ternary",editType:"calc"}},LG.layoutAttributes=dG,LG.supplyLayoutDefaults=function(t,e,r){Jc(t,e,0,{type:"ternary",attributes:dG,handleDefaults:vG,font:e.font,paper_bgcolor:e.paper_bgcolor})},LG.plot=function(t){for(var e=t._fullLayout,r=t.calcdata,n=e._subplots.ternary,i=0;i"),i}function g(t,e){d.push(t._hovertitle+": "+ri.tickText(t,e,"hover").text)}},UG.selectPoints=Sx,UG.eventData=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},UG.moduleType="trace",UG.name="scatterternary",UG.basePlotModule=LG,UG.categories=["ternary","symbols","markerColorscale","showLegend","scatter-like"],UG.meta={};var qG=UG,HG={},GG=Di.pointsAccessorFunction;HG.moduleType="transform",HG.name="sort",HG.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"},HG.supplyDefaults=function(t){var e={};function r(r,n){return ne.coerce(t,e,HG.attributes,r,n)}return r("enabled")&&(r("target"),r("order")),e},HG.calcTransform=function(t,e,r){if(r.enabled){var n=ne.getTargetArray(e,r);if(n){var i,a,o=r.target,s=n.length,l=e._arrayAttrs,u=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 0.0 ||\n any(lessThan(worldCoordinate, clipBounds[0])) || any(greaterThan(worldCoordinate, clipBounds[1]))) {\n discard;\n }\n\n vec3 N = normalize(surfaceNormal);\n vec3 V = normalize(eyeDirection);\n vec3 L = normalize(lightDirection);\n\n if(gl_FrontFacing) {\n N = -N;\n }\n\n float specular = max(beckmannSpecular(L, V, N, roughness), 0.);\n float diffuse = min(kambient + kdiffuse * max(dot(N, L), 0.0), 1.0);\n\n //decide how to interpolate color \u2014 in vertex or in fragment\n vec4 surfaceColor = step(vertexColor, .5) * texture2D(colormap, vec2(value, value)) + step(.5, vertexColor) * vColor;\n\n vec4 litColor = surfaceColor.a * vec4(diffuse * surfaceColor.rgb + kspecular * vec3(1,1,1) * specular, 1.0);\n\n gl_FragColor = mix(litColor, contourColor, contourTint) * opacity;\n}\n"]),JG=E_(["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"]),KG=E_(["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"]);YG.createShader=function(t){var e=Bw(t,XG,ZG,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},YG.createPickShader=function(t){var e=Bw(t,XG,KG,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},YG.createContourShader=function(t){var e=Bw(t,JG,ZG,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e},YG.createPickContourShader=function(t){var e=Bw(t,JG,KG,null,[{name:"uv",type:"vec4"},{name:"f",type:"float"}]);return e.attributes.uv.location=0,e.attributes.f.location=1,e};var QG=function(t,e,r){if(Array.isArray(r)){if(r.length!==e.dimension)throw new Error("ndarray-gradient: invalid boundary conditions")}else r=b_(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 n=0;n=0?s.push("0"):e.indexOf(-(l+1))>=0?s.push("s["+l+"]-1"):(s.push("-1"),a.push("1"),o.push("s["+l+"]-2"));var u=".lo("+a.join()+").hi("+o.join()+")";if(0===a.length&&(u=""),i>0){n.push("if(1");for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push("&&s[",l,"]>2");n.push("){grad",i,"(src.pick(",s.join(),")",u);for(var l=0;l=0||e.indexOf(-(l+1))>=0||n.push(",dst.pick(",s.join(),",",l,")",u);n.push(");")}for(var l=0;l1){dst.set(",s.join(),",",c,",0.5*(src.get(",f.join(),")-src.get(",p.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):n.push("if(s[",c,"]>1){diff(",h,",src.pick(",f.join(),")",u,",src.pick(",p.join(),")",u,");}else{zero(",h,");};");break;case"mirror":0===i?n.push("dst.set(",s.join(),",",c,",0);"):n.push("zero(",h,");");break;case"wrap":var d=s.slice(),g=s.slice();e[l]<0?(d[c]="s["+c+"]-2",g[c]="0"):(d[c]="s["+c+"]-1",g[c]="1"),0===i?n.push("if(s[",c,"]>2){dst.set(",s.join(),",",c,",0.5*(src.get(",d.join(),")-src.get(",g.join(),")))}else{dst.set(",s.join(),",",c,",0)};"):n.push("if(s[",c,"]>2){diff(",h,",src.pick(",d.join(),")",u,",src.pick(",g.join(),")",u,");}else{zero(",h,");};");break;default:throw new Error("ndarray-gradient: Invalid boundary condition")}}i>0&&n.push("};")}for(var a=0;a<1<=1)return!0;for(var t=0;t<3;++t)if(this._contourCounts[t].length>0||this._dynamicCounts[t]>0)return!0;return!1},yW.pickSlots=1,yW.setPickBase=function(t){this.pickId=t};var xW=[0,0,0],bW={showSurface:!1,showContour:!1,projections:[pW.slice(),pW.slice(),pW.slice()],clipBounds:[[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]],[[0,0,0],[0,0,0]]]};function _W(t,e){var r,n,i,a=e.axes&&e.axes.lastCubeProps.axis||xW,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=bW.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],Dz(l,t.model,l);var u=bW.clipBounds[r];for(i=0;i<2;++i)for(n=0;n<3;++n)u[i][n]=t.clipBounds[i][n];u[0][r]=-1e8,u[1][r]=1e8}return bW.showSurface=o,bW.showContour=s,bW}var wW={model:pW,view:pW,projection:pW,inverseModel:pW.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},MW=pW.slice(),AW=[1,0,0,0,1,0,0,0,1];function kW(t,e){t=t||{};var r=this.gl;r.disable(r.CULL_FACE),this._colorMap.bind(0);var n=wW;n.model=t.model||pW,n.view=t.view||pW,n.projection=t.projection||pW,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=cz(n.inverseModel,n.model);for(var i=0;i<2;++i)for(var a=n.clipBounds[i],o=0;o<3;++o)a[o]=Math.min(Math.max(this.clipBounds[i][o],-1e8),1e8);n.kambient=this.ambientLight,n.kdiffuse=this.diffuseLight,n.kspecular=this.specularLight,n.roughness=this.roughness,n.fresnel=this.fresnel,n.opacity=this.opacity,n.height=0,n.permutation=AW,n.vertexColor=this.vertexColor;var s=MW;for(Dz(s,n.view,n.model),Dz(s,n.projection,s),cz(s,s),i=0;i<3;++i)n.eyePosition[i]=s[12+i]/s[15];var l=s[15];for(i=0;i<3;++i)l+=this.lightPosition[i]*s[4*i+3];for(i=0;i<3;++i){var u=s[12+i];for(o=0;o<3;++o)u+=s[4*o+i]*this.lightPosition[o];n.lightPosition[i]=u/l}var c=_W(n,this);if(c.showSurface&&e===this.opacity<1){for(this._shader.bind(),this._shader.uniforms=n,this._vao.bind(),this.showSurface&&this._vertexCount&&this._vao.draw(r.TRIANGLES,this._vertexCount),i=0;i<3;++i)this.surfaceProject[i]&&this.vertexCount&&(this._shader.uniforms.model=c.projections[i],this._shader.uniforms.clipBounds=c.clipBounds[i],this._vao.draw(r.TRIANGLES,this._vertexCount));this._vao.unbind()}if(c.showContour&&!e){var h=this._contourShader;n.kambient=1,n.kdiffuse=0,n.kspecular=0,n.opacity=1,h.bind(),h.uniforms=n;var f=this._contourVAO;for(f.bind(),i=0;i<3;++i)for(h.uniforms.permutation=gW[i],r.lineWidth(this.contourWidth[i]),o=0;o>4)/16)/255,i=Math.floor(n),a=n-i,o=e[1]*(t.value[1]+(15&t.value[2])/16)/255,s=Math.floor(o),l=o-s;i+=1,s+=1;var u=r.position;u[0]=u[1]=u[2]=0;for(var c=0;c<2;++c)for(var h=c?a:1-a,f=0;f<2;++f)for(var p=i+c,d=s+f,g=h*(f?l:1-l),v=0;v<3;++v)u[v]+=this._field[v].get(p,d)*g;for(var m=this._pickResult.level,y=0;y<3;++y)if(m[y]=wT.le(this.contourLevels[y],u[y]),m[y]<0)this.contourLevels[y].length>0&&(m[y]=0);else if(m[y]Math.abs(b-u[y])&&(m[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],v=0;v<3;++v)r.dataCoordinate[v]=this._field[v].get(r.index[0],r.index[1]);return r},yW.update=function(t){t=t||{},this.dirty=!0,"contourWidth"in t&&(this.contourWidth=EW(t.contourWidth,Number)),"showContour"in t&&(this.showContour=EW(t.showContour,Boolean)),"showSurface"in t&&(this.showSurface=!!t.showSurface),"contourTint"in t&&(this.contourTint=EW(t.contourTint,Boolean)),"contourColor"in t&&(this.contourColor=LW(t.contourColor)),"contourProject"in t&&(this.contourProject=EW(t.contourProject,function(t){return EW(t,Boolean)})),"surfaceProject"in t&&(this.surfaceProject=t.surfaceProject),"dynamicColor"in t&&(this.dynamicColor=LW(t.dynamicColor)),"dynamicTint"in t&&(this.dynamicTint=EW(t.dynamicTint,Number)),"dynamicWidth"in t&&(this.dynamicWidth=EW(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&&(__.freeFloat(this._field[2].data),this._field[2].data=__.mallocFloat(Mb.nextPow2(n))),this._field[2]=wb(this._field[2].data,[e.shape[0]+2,e.shape[1]+2]),SW(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&&(__.freeFloat(this._field[a].data),this._field[a].data=__.mallocFloat(this._field[2].size)),this._field[a]=wb(this._field[a].data,[i[0]+2,i[1]+2]);if(t.coords){var o=t.coords;if(!Array.isArray(o)||3!==o.length)throw new Error("gl-surface: invalid coordinates for x/y");for(a=0;a<2;++a){var s=o[a];for(f=0;f<2;++f)if(s.shape[f]!==i[f])throw new Error("gl-surface: coords have incorrect shape");SW(this._field[a],s)}}else if(t.ticks){var l=t.ticks;if(!Array.isArray(l)||2!==l.length)throw new Error("gl-surface: invalid ticks");for(a=0;a<2;++a){var u=l[a];if((Array.isArray(u)||u.length)&&(u=wb(u)),u.shape[0]!==i[a])throw new Error("gl-surface: invalid tick length");var c=wb(u.data,i);c.stride[a]=u.stride[0],c.stride[1^a]=0,SW(this._field[a],c)}}else{for(a=0;a<2;++a){var h=[0,0];h[a]=1,this._field[a]=wb(this._field[a].data,[i[0]+2,i[1]+2],h,0)}this._field[0].set(0,0,0);for(var f=0;f0){for(var ct=0;ct<5;++ct)H.pop();I-=1}continue t}H.push(X[0],X[1],K[0],K[1],X[2]),I+=1}}Y.push(I)}this._contourOffsets[G]=W,this._contourCounts[G]=Y}var ht=__.mallocFloat(H.length);for(a=0;a",maxDimensionCount:60,overdrag:45,releaseTransitionDuration:120,releaseTransitionEase:"cubic-out",scrollbarCaptureWidth:18,scrollbarHideDelay:1e3,scrollbarHideDuration:1e3,scrollbarOffset:5,scrollbarWidth:8,transitionDuration:100,transitionEase:"cubic-out",uplift:5,wrapSpacer:" ",wrapSplitCharacter:" ",cn:{table:"table",tableControlView:"table-control-view",scrollBackground:"scroll-background",yColumn:"y-column",columnBlock:"column-block",scrollAreaClip:"scroll-area-clip",scrollAreaClipRect:"scroll-area-clip-rect",columnBoundary:"column-boundary",columnBoundaryClippath:"column-boundary-clippath",columnBoundaryRect:"column-boundary-rect",columnCells:"column-cells",columnCell:"column-cell",cellRect:"cell-rect",cellText:"cell-text",cellTextHolder:"cell-text-holder",scrollbarKit:"scrollbar-kit",scrollbar:"scrollbar",scrollbarSlider:"scrollbar-slider",scrollbarGlyph:"scrollbar-glyph",scrollbarCaptureZone:"scrollbar-capture-zone"}},iY=m.extendFlat;function aY(t){return t.calcdata.columns.reduce(function(e,r){return r.xIndex=e||u===t.length-1)&&(n[i]=o,o.key=l++,o.firstRowIndex=s,o.lastRowIndex=u,o={firstRowIndex:null,lastRowIndex:null,rows:[]},i+=a,s=u+1,a=0);return n}var lY={},uY=m.extendFlat;lY.splitToPanels=function(t){var e=[0,0],r=uY({},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:uY({},t.calcdata,{cells:t.calcdata.headerCells})});return[uY({},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}),uY({},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]},lY.splitToCells=function(t){var e=function(t){var e=t.rowBlocks[t.page],r=e?e.rows[0].rowIndex:0,n=e?r+e.rows.length:0;return[r,n]}(t);return(t.values||[]).slice(e[0],e[1]).map(function(r,n){return{keyWithinBlock:n+("string"==typeof r&&r.match(/[<$&> ]/)?"_keybuster_"+Math.random():""),key:e[0]+n,column:t,calcdata:t.calcdata,page:t.page,rowBlocks:t.rowBlocks,value:r}})};var cY=ne.raiseToTop,hY=ne.cancelTransition,fY=function(t,n){var i=t._fullLayout._paper.selectAll("."+nY.cn.table).data(n.map(function(e){var n=ZR.unwrap(e).trace;return function(t,e){var n=e.cells.values,i=function(t){return t.slice(e.header.values.length,t.length)},a=e.header.values.map(function(t){return Array.isArray(t)?t:[t]}).concat(i(n).map(function(){return[""]})),o=e.domain,s=Math.floor(t._fullLayout._size.w*(o.x[1]-o.x[0])),l=Math.floor(t._fullLayout._size.h*(o.y[1]-o.y[0])),u=e.header.values.length?a[0].map(function(){return e.header.height}):[nY.emptyHeaderHeight],c=n.length?n[0].map(function(){return e.cells.height}):[],h=u.reduce(function(t,e){return t+e},0),f=sY(c,l-h+nY.uplift),p=oY(sY(u,h),[]),d=oY(f,p),g={},v=e._fullInput.columnorder.concat(i(n.map(function(t,e){return e}))),m=a.map(function(t,n){var i=Array.isArray(e.columnwidth)?e.columnwidth[Math.min(n,e.columnwidth.length-1)]:e.columnwidth;return r(i)?Number(i):1}),y=m.reduce(function(t,e){return t+e},0);m=m.map(function(t){return t/y*s});var x={key:e.index,translateX:o.x[0]*t._fullLayout._size.w,translateY:t._fullLayout._size.h*(1-o.y[1]),size:t._fullLayout._size,width:s,height:l,columnOrder:v,groupHeight:l,rowBlocks:d,headerRowBlocks:p,scrollY:0,cells:e.cells,headerCells:iY({},e.header,{values:a}),gdColumns:a.map(function(t){return t[0]}),gdColumnsOriginalOrder:a.map(function(t){return t[0]}),prevPages:[0,0],scrollbarState:{scrollbarScrollInProgress:!1},columns:a.map(function(t,e){var r=g[t];return g[t]=(r||0)+1,{key:t+"__"+g[t],label:t,specIndex:e,xIndex:v[e],xScale:aY,x:void 0,calcdata:void 0,columnWidth:m[e]}})};return x.columns.forEach(function(t){t.calcdata=x,t.x=aY(t)}),x}(t,n)}),ZR.keyFun);i.exit().remove(),i.enter().append("g").classed(nY.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"),i.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 a=i.selectAll("."+nY.cn.tableControlView).data(ZR.repeat,ZR.keyFun);a.enter().append("g").classed(nY.cn.tableControlView,!0).style("box-sizing","content-box").on("mousemove",function(e){a.filter(function(t){return e===t}).call(vY,t)}).on("mousewheel",function(r){r.scrollbarState.wheeling||(r.scrollbarState.wheeling=!0,e.event.stopPropagation(),e.event.preventDefault(),TY(t,a,null,r.scrollY+e.event.deltaY)(r),r.scrollbarState.wheeling=!1)}).call(vY,t,!0),a.attr("transform",function(t){return"translate("+t.size.l+" "+t.size.t+")"});var o=a.selectAll("."+nY.cn.scrollBackground).data(ZR.repeat,ZR.keyFun);o.enter().append("rect").classed(nY.cn.scrollBackground,!0).attr("fill","none"),o.attr("width",function(t){return t.width}).attr("height",function(t){return t.height}),a.each(function(r){Sr.setClipUrl(e.select(this),pY(t,r))});var s=a.selectAll("."+nY.cn.yColumn).data(function(t){return t.columns},ZR.keyFun);s.enter().append("g").classed(nY.cn.yColumn,!0),s.exit().remove(),s.attr("transform",function(t){return"translate("+t.x+" 0)"}).call(e.behavior.drag().origin(function(r){return _Y(e.select(this),r,-nY.uplift),cY(this),r.calcdata.columnDragInProgress=!0,vY(a.filter(function(t){return r.calcdata.key===t.key}),t),r}).on("drag",function(t){var r=e.select(this),n=function(r){return(t===r?e.event.x:r.x)+r.columnWidth/2};t.x=Math.max(-nY.overdrag,Math.min(t.calcdata.width+nY.overdrag-t.columnWidth,e.event.x)),gY(s).filter(function(e){return e.calcdata.key===t.calcdata.key}).sort(function(t,e){return n(t)-n(e)}).forEach(function(e,r){e.xIndex=r,e.x=t===e?e.x:e.xScale(e)}),s.filter(function(e){return t!==e}).transition().ease(nY.transitionEase).duration(nY.transitionDuration).attr("transform",function(t){return"translate("+t.x+" 0)"}),r.call(hY).attr("transform","translate("+t.x+" -"+nY.uplift+" )")}).on("dragend",function(r){var n=e.select(this),i=r.calcdata;r.x=r.xScale(r),r.calcdata.columnDragInProgress=!1,_Y(n,r,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,i,i.columns.map(function(t){return t.xIndex}))})),s.each(function(r){Sr.setClipUrl(e.select(this),dY(t,r))});var l=s.selectAll("."+nY.cn.columnBlock).data(lY.splitToPanels,ZR.keyFun);l.enter().append("g").classed(nY.cn.columnBlock,!0).attr("id",function(t){return t.key}),l.style("cursor",function(t){return t.dragHandle?"ew-resize":t.calcdata.scrollbarState.barWiggleRoom?"ns-resize":"default"});var u=l.filter(MY),c=l.filter(wY);c.call(e.behavior.drag().origin(function(t){return e.event.stopPropagation(),t}).on("drag",TY(t,a,-1)).on("dragend",function(){})),mY(t,a,u,l),mY(t,a,c,l);var h=a.selectAll("."+nY.cn.scrollAreaClip).data(ZR.repeat,ZR.keyFun);h.enter().append("clipPath").classed(nY.cn.scrollAreaClip,!0).attr("id",function(e){return pY(t,e)});var f=h.selectAll("."+nY.cn.scrollAreaClipRect).data(ZR.repeat,ZR.keyFun);f.enter().append("rect").classed(nY.cn.scrollAreaClipRect,!0).attr("x",-nY.overdrag).attr("y",-nY.uplift).attr("fill","none"),f.attr("width",function(t){return t.width+2*nY.overdrag}).attr("height",function(t){return t.height+nY.uplift}),s.selectAll("."+nY.cn.columnBoundary).data(ZR.repeat,ZR.keyFun).enter().append("g").classed(nY.cn.columnBoundary,!0);var p=s.selectAll("."+nY.cn.columnBoundaryClippath).data(ZR.repeat,ZR.keyFun);p.enter().append("clipPath").classed(nY.cn.columnBoundaryClippath,!0),p.attr("id",function(e){return dY(t,e)});var d=p.selectAll("."+nY.cn.columnBoundaryRect).data(ZR.repeat,ZR.keyFun);d.enter().append("rect").classed(nY.cn.columnBoundaryRect,!0).attr("fill","none"),d.attr("width",function(t){return t.columnWidth}).attr("height",function(t){return t.calcdata.height+nY.uplift}),kY(null,c,a)};function pY(t,e){return"clip"+t._fullLayout._uid+"_scrollAreaBottomClip_"+e.key}function dY(t,e){return"clip"+t._fullLayout._uid+"_columnBoundaryClippath_"+e.calcdata.key+"_"+e.specIndex}function gY(t){return[].concat.apply([],t.map(function(t){return t})).map(function(t){return t.__data__})}function vY(t,r,n){var i=t.selectAll("."+nY.cn.scrollbarKit).data(ZR.repeat,ZR.keyFun);i.enter().append("g").classed(nY.cn.scrollbarKit,!0).style("shape-rendering","geometricPrecision"),i.each(function(t){var e=t.scrollbarState;e.totalHeight=function(t){var e=t.rowBlocks;return PY(e,e.length-1)+(e.length?IY(e[e.length-1],1/0):1)}(t),e.scrollableAreaHeight=t.groupHeight-AY(t),e.currentlyVisibleHeight=Math.min(e.totalHeight,e.scrollableAreaHeight),e.ratio=e.currentlyVisibleHeight/e.totalHeight,e.barLength=Math.max(e.ratio*e.currentlyVisibleHeight,nY.goldenRatio*nY.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+nY.scrollbarWidth/2+nY.scrollbarOffset)+" "+AY(t)+")"});var a=i.selectAll("."+nY.cn.scrollbar).data(ZR.repeat,ZR.keyFun);a.enter().append("g").classed(nY.cn.scrollbar,!0);var o=a.selectAll("."+nY.cn.scrollbarSlider).data(ZR.repeat,ZR.keyFun);o.enter().append("g").classed(nY.cn.scrollbarSlider,!0),o.attr("transform",function(t){return"translate(0 "+(t.scrollbarState.topY||0)+")"});var s=o.selectAll("."+nY.cn.scrollbarGlyph).data(ZR.repeat,ZR.keyFun);s.enter().append("line").classed(nY.cn.scrollbarGlyph,!0).attr("stroke","black").attr("stroke-width",nY.scrollbarWidth).attr("stroke-linecap","round").attr("y1",nY.scrollbarWidth/2),s.attr("y2",function(t){return t.scrollbarState.barLength-nY.scrollbarWidth/2}).attr("stroke-opacity",function(t){return t.columnDragInProgress||!t.scrollbarState.barWiggleRoom||n?0:.4}),s.transition().delay(0).duration(0),s.transition().delay(nY.scrollbarHideDelay).duration(nY.scrollbarHideDuration).attr("stroke-opacity",0);var l=a.selectAll("."+nY.cn.scrollbarCaptureZone).data(ZR.repeat,ZR.keyFun);l.enter().append("line").classed(nY.cn.scrollbarCaptureZone,!0).attr("stroke","white").attr("stroke-opacity",.01).attr("stroke-width",nY.scrollbarCaptureWidth).attr("stroke-linecap","butt").attr("y1",0).on("mousedown",function(n){var i=e.event.y,a=this.getBoundingClientRect(),o=n.scrollbarState,s=i-a.top,l=e.scale.linear().domain([0,o.scrollableAreaHeight]).range([0,o.totalHeight]).clamp(!0);o.topY<=s&&s<=o.bottomY||TY(r,t,null,l(s-o.barLength/2))(n)}).call(e.behavior.drag().origin(function(t){return e.event.stopPropagation(),t.scrollbarState.scrollbarScrollInProgress=!0,t}).on("drag",TY(r,t)).on("dragend",function(){})),l.attr("y2",function(t){return t.scrollbarState.scrollableAreaHeight})}function mY(t,r,n,i){var a=function(t){var e=t.selectAll("."+nY.cn.columnCell).data(lY.splitToCells,function(t){return t.keyWithinBlock});return e.enter().append("g").classed(nY.cn.columnCell,!0),e.exit().remove(),e}(function(t){var e=t.selectAll("."+nY.cn.columnCells).data(ZR.repeat,ZR.keyFun);return e.enter().append("g").classed(nY.cn.columnCells,!0),e.exit().remove(),e}(n));!function(t){t.each(function(t,e){var r=t.calcdata.cells.font,n=t.column.specIndex,i={size:bY(r.size,n,e),color:bY(r.color,n,e),family:bY(r.family,n,e)};t.rowNumber=t.key,t.align=bY(t.calcdata.cells.align,n,e),t.cellBorderWidth=bY(t.calcdata.cells.line.width,n,e),t.font=i})}(a),function(t){t.attr("width",function(t){return t.column.columnWidth}).attr("stroke-width",function(t){return t.cellBorderWidth}).each(function(t){var r=e.select(this);Oe.stroke(r,bY(t.calcdata.cells.line.color,t.column.specIndex,t.rowNumber)),Oe.fill(r,bY(t.calcdata.cells.fill.color,t.column.specIndex,t.rowNumber))})}(function(t){var e=t.selectAll("."+nY.cn.cellRect).data(ZR.repeat,function(t){return t.keyWithinBlock});return e.enter().append("rect").classed(nY.cn.cellRect,!0),e}(a));var o=function(t){var r=t.selectAll("."+nY.cn.cellText).data(ZR.repeat,function(t){return t.keyWithinBlock});return r.enter().append("text").classed(nY.cn.cellText,!0).style("cursor",function(){return"auto"}).on("mousedown",function(){e.event.stopPropagation()}),r}(function(t){var e=t.selectAll("."+nY.cn.cellTextHolder).data(ZR.repeat,function(t){return t.keyWithinBlock});return e.enter().append("g").classed(nY.cn.cellTextHolder,!0).style("shape-rendering","geometricPrecision"),e}(a));!function(t){t.each(function(t){Sr.font(e.select(this),t.font)})}(o),yY(o,r,i,t),zY(a)}function yY(t,r,n,i){t.text(function(t){var r=t.column.specIndex,n=t.rowNumber,i=t.value,a="string"==typeof i,o=a&&i.match(/
/i),s=!a||o;t.mayHaveMarkup=a&&i.match(/[<&>]/);var l,u="string"==typeof(l=i)&&l.match(nY.latexCheck);t.latex=u;var c,h,f=u?"":bY(t.calcdata.cells.prefix,r,n)||"",p=u?"":bY(t.calcdata.cells.suffix,r,n)||"",d=u?null:bY(t.calcdata.cells.format,r,n)||null,g=f+(d?e.format(d)(t.value):t.value)+p;if(t.wrappingNeeded=!t.wrapped&&!s&&!u&&(c=xY(g)),t.cellHeightMayIncrease=o||u||t.mayHaveMarkup||(void 0===c?xY(g):c),t.needsConvertToTspans=t.mayHaveMarkup||t.wrappingNeeded||t.latex,t.wrappingNeeded){var v=(" "===nY.wrapSplitCharacter?g.replace(/
i&&n.push(a),i+=l}return n}(i,l,s);1===u.length&&(u[0]===i.length-1?u.unshift(u[0]-1):u.push(u[0]+1)),u[0]%2&&u.reverse(),e.each(function(t,e){t.page=u[e],t.scrollY=l}),e.attr("transform",function(t){return"translate(0 "+(PY(t.rowBlocks,t.page)-t.scrollY)+")"}),t&&(SY(t,r,e,u,n.prevPages,n,0),SY(t,r,e,u,n.prevPages,n,1),vY(r,t))}}function TY(t,r,n,i){return function(a){var o=a.calcdata?a.calcdata:a,s=r.filter(function(t){return o.key===t.key}),l=n||o.scrollbarState.dragMultiplier;o.scrollY=void 0===i?o.scrollY+l*e.event.dy:i;var u=s.selectAll("."+nY.cn.yColumn).selectAll("."+nY.cn.columnBlock).filter(wY);kY(t,u,s)}}function SY(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]});mY(t,e,a,r),i[o]=n[o]}))}function EY(t,r,n){return function(){var i=e.select(r.parentNode);i.each(function(t){var e=t.fragments;i.selectAll("tspan.line").each(function(t,r){e[r].width=this.getComputedTextLength()});var r,n,a=e[e.length-1].width,o=e.slice(0,-1),s=[],l=0,u=t.column.columnWidth-2*nY.cellPad;for(t.value="";o.length;)l+(n=(r=o.shift()).width+a)>u&&(t.value+=s.join(nY.wrapSpacer)+nY.lineBreaker,s=[],l=0),s.push(r.text),l+=n;l&&(t.value+=s.join(nY.wrapSpacer)),t.wrapped=!0}),i.selectAll("tspan.line").remove(),yY(i.select("."+nY.cn.cellText),n,t),e.select(r.parentNode.parentNode).call(zY)}}function CY(t,r,n,i,a){return function(){if(!a.settledY){var o=e.select(r.parentNode),s=OY(a),l=a.key-s.firstRowIndex,u=s.rows[l].rowHeight,c=a.cellHeightMayIncrease?r.parentNode.getBoundingClientRect().height+2*nY.cellPad:u,h=Math.max(c,u);h-s.rows[l].rowHeight&&(s.rows[l].rowHeight=h,t.selectAll("."+nY.cn.columnCell).call(zY),kY(null,t.filter(wY),0),vY(n,i,!0)),o.attr("transform",function(){var t=this.parentNode.getBoundingClientRect(),r=e.select(this.parentNode).select("."+nY.cn.cellRect).node().getBoundingClientRect(),n=this.transform.baseVal.consolidate(),i=r.top-t.top+(n?n.matrix.f:nY.cellPad);return"translate("+LY(a,e.select(this.parentNode).select("."+nY.cn.cellTextHolder).node().getBoundingClientRect().width)+" "+i+")"}),a.settledY=!0}}}function LY(t,e){switch(t.align){case"left":return nY.cellPad;case"right":return t.column.columnWidth-(e||0)-nY.cellPad;case"center":return(t.column.columnWidth-(e||0))/2;default:return nY.cellPad}}function zY(t){t.attr("transform",function(t){var e=t.rowBlocks[0].auxiliaryBlocks.reduce(function(t,e){return t+IY(e,1/0)},0);return"translate(0 "+(IY(OY(t),t.key)+e)+")"}).selectAll("."+nY.cn.cellRect).attr("height",function(t){return(e=OY(t),r=t.key,e.rows[r-e.firstRowIndex]).rowHeight;var e,r})}function PY(t,e){for(var r=0,n=e-1;n>=0;n--)r+=DY(t[n]);return r}function IY(t,e){for(var r=0,n=0;n1,p=l.bdPos=l.dPos*(1-i.violingap)*(1-i.violingroupgap)/(f?h:1),d=l.bPos=f?2*l.dPos*((l.num+.5)/h-.5)*(1-i.violingap):0;if(!0!==u.visible||l.empty)e.select(this).remove();else{var g=r[l.valLetter+"axis"],v=r[l.posLetter+"axis"],m="both"===u.side,y=m||"positive"===u.side,x=m||"negative"===u.side,b=u.box&&u.box.visible,_=u.meanline&&u.meanline.visible,w=i._violinScaleGroupStats[u.scalegroup];if(c.selectAll("path.violin").data(ne.identity).enter().append("path").style("vector-effect","non-scaling-stroke").attr("class","violin").each(function(t){var r,n,i,a,o,c,h,f,b=e.select(this),_=t.density,M=_.length,A=t.pos+d,k=v.c2p(A);switch(u.scalemode){case"width":r=w.maxWidth/p;break;case"count":r=w.maxWidth/p*(w.maxCount/t.pts.length)}if(y){for(h=new Array(M),o=0;o0){var d,g,v,m,y,x=t.xa,b=t.ya;"h"===l.orientation?(y=e,d="y",v=b,g="x",m=x):(y=r,d="x",v=x,g="y",m=b);var _=s[t.index];if(y>=_.span[0]&&y<=_.span[1]){var w=ne.extendFlat({},t),M=m.c2p(y,!0),A=HY.getKdeValue(_,l,y),k=HY.getPositionOnKdePath(_,l,M),T=v._offset,S=v._length;w[d+"0"]=k[0],w[d+"1"]=k[1],w[g+"0"]=w[g+"1"]=M,w[g+"Label"]=g+": "+ri.hoverLabelText(m,y)+", "+s[0].t.labels.kde+" "+A.toFixed(3),w.spikeDistance=p[0].spikeDistance;var E=d+"Spike";w[E]=p[0][E],p[0].spikeDistance=void 0,p[0][E]=void 0,f.push(w),(o={stroke:t.color})[d+"1"]=ne.constrain(T+k[0],T,T+S),o[d+"2"]=ne.constrain(T+k[1],T,T+S),o[g+"1"]=o[g+"2"]=m._offset+M}}}-1!==u.indexOf("points")&&(a=_s.hoverOnPoints(t,e,r));var C=i.selectAll(".violinline-"+l.uid).data(o?[0]:[]);return C.enter().append("line").classed("violinline-"+l.uid,!0).attr("stroke-width",1.5),C.exit().remove(),C.attr(o),"closest"===n?a?[a]:f:a?(f.push(a),f):f},selectPoints:zs,moduleType:"trace",name:"violin",basePlotModule:ua,categories:["cartesian","symbols","oriented","box-violin","showLegend"],meta:{}};return Fx.register([os,Bs,Kx,qL,ZL,$L,YF,fp,qG,tX,Wj,tY,DR,dV,Sh,xq,aB,LL,LF,aH,uN,VY,Gu,tV,Ep,UR,iu,aG,uG]),Fx.register([Hi,qx,Yx,WG]),Fx.register([Ul]),Fx});