{"version":3,"sources":["/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/base.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/client/connection.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/client/session.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/bokeh_events.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/build_views.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/dom.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/dom_view.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/enums.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/has_props.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/hittest.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/layout/alignments.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/layout/layout_canvas.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/layout/side_panel.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/layout/solver.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/logging.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/properties.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/property_mixins.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/selection_manager.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/settings.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/signaling.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/ui_events.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/array.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/arrayable.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/assert.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/bbox.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/callback.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/canvas.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/color.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/compat.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/data_structures.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/eq.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/math.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/object.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/projections.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/refs.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/selection.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/serialization.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/spatial.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/string.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/svg_colors.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/templating.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/text.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/throttle.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/typed_array.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/types.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/wheel.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/util/zoom.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/vectorization.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/view.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/core/visuals.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/document/document.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/document/events.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/document/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/embed/dom.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/embed/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/embed/notebook.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/embed/server.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/embed/standalone.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/main.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/model.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/annotation.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/arrow.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/arrow_head.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/band.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/box_annotation.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/color_bar.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/label.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/label_set.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/legend.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/legend_item.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/poly_annotation.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/slope.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/span.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/text_annotation.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/title.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/toolbar_panel.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/tooltip.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/annotations/whisker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/categorical_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/continuous_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/datetime_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/linear_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/log_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/axes/mercator_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/callbacks/callback.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/callbacks/customjs.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/callbacks/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/callbacks/open_url.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/canvas/canvas.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/canvas/cartesian_frame.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/canvas/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/expressions/cumsum.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/expressions/expression.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/expressions/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/expressions/stack.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/filters/boolean_filter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/filters/customjs_filter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/filters/filter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/filters/group_filter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/filters/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/filters/index_filter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/basic_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/categorical_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/datetime_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/func_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/log_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/mercator_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/numeral_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/printf_tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/formatters/tick_formatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/annular_wedge.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/annulus.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/arc.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/bezier.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/box.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/center_rotatable.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/circle.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/ellipse.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/ellipse_oval.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/glyph.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/hbar.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/hex_tile.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/image.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/image_rgba.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/image_url.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/line.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/multi_line.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/multi_polygons.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/oval.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/patch.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/patches.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/quad.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/quadratic.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/ray.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/rect.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/segment.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/step.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/text.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/utils.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/vbar.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/wedge.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/glyphs/xy_glyph.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/graphs/graph_hit_test_policy.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/graphs/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/graphs/layout_provider.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/graphs/static_layout_provider.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/grids/grid.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/grids/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/box.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/column.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/layout_dom.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/row.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/spacer.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/layouts/widget_box.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/categorical_color_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/categorical_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/categorical_marker_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/color_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/continuous_color_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/linear_color_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/log_color_mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/mappers/mapper.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/markers/defs.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/markers/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/markers/marker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/markers/scatter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/plots/gmap_plot.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/plots/gmap_plot_canvas.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/plots/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/plots/plot.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/plots/plot_canvas.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/ranges/data_range.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/ranges/data_range1d.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/ranges/factor_range.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/ranges/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/ranges/range.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/ranges/range1d.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/renderers/glyph_renderer.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/renderers/graph_renderer.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/renderers/guide_renderer.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/renderers/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/renderers/renderer.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/scales/categorical_scale.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/scales/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/scales/linear_scale.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/scales/log_scale.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/scales/scale.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/selections/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/selections/interaction_policy.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/selections/selection.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/ajax_data_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/cds_view.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/column_data_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/columnar_data_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/data_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/geojson_data_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/sources/remote_data_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/adaptive_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/basic_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/categorical_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/composite_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/continuous_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/datetime_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/days_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/fixed_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/log_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/mercator_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/months_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/single_interval_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/util.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tickers/years_ticker.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/bbox_tile_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/image_pool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/mercator_tile_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/quadkey_tile_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/tile_renderer.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/tile_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/tile_utils.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/tms_tile_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tiles/wmts_tile_source.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/action_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/custom_action.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/help_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/redo_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/reset_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/save_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/undo_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/zoom_in_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/actions/zoom_out_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/button_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/box_edit_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/edit_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/freehand_draw_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/point_draw_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/poly_draw_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/poly_edit_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/edit/poly_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/box_select_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/box_zoom_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/gesture_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/lasso_select_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/pan_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/poly_select_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/range_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/select_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/tap_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/wheel_pan_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/gestures/wheel_zoom_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/inspectors/crosshair_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/inspectors/customjs_hover.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/inspectors/hover_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/inspectors/inspect_tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/on_off_button.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/tool.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/tool_proxy.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/toolbar.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/toolbar_base.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/toolbar_box.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/tools/util.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/customjs_transform.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/dodge.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/interpolator.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/jitter.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/linear_interpolator.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/step_interpolator.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/models/transforms/transform.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/polyfill.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/protocol/index.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/protocol/message.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/protocol/receiver.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/safely.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/testing.js","/home/travis/build/bokeh/bokeh/bokehjs/build/js/tree/version.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/canvas2svg/canvas2svg.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/d/auto-bind.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/d/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/array/#/clear.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/array/from/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/array/from/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/array/from/shim.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/function/is-arguments.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/function/is-function.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/function/noop.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/global.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/math/sign/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/math/sign/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/math/sign/shim.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/number/to-integer.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/number/to-pos-integer.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/_iterate.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/assign/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/assign/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/assign/shim.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/copy.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/create.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/for-each.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/is-callable.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/is-object.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/is-value.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/keys/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/keys/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/keys/shim.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/map.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/normalize-options.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/set-prototype-of/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/set-prototype-of/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/set-prototype-of/shim.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/valid-callable.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/valid-object.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/object/valid-value.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/string/#/contains/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/string/#/contains/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/string/#/contains/shim.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/string/is-string.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es5-ext/string/random-uniq.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/array.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/for-of.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/get.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/is-iterable.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/string.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-iterator/valid-iterable.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-promise/dist/es6-promise.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-symbol/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-symbol/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-symbol/is-symbol.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-symbol/polyfill.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-symbol/validate-symbol.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-weak-map/implement.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-weak-map/is-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-weak-map/is-native-implemented.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/es6-weak-map/polyfill.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/flatbush/flatbush.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/hammerjs/hammer.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/constraint.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/expression.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/maptype.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/solver.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/strength.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/tsu/algorithm.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/tsu/array_base.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/tsu/associative_array.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/tsu/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/tsu/iterator.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/tsu/pair.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/kiwi/build/variable.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/numbro/numbro.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/Proj.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/adjust_axis.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/common/adjust_lon.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/common/msfnz.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/common/phi2z.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/common/sign.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/common/toPoint.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/common/tsfnz.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/constants/Datum.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/constants/Ellipsoid.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/constants/PrimeMeridian.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/constants/units.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/core.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/datum.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/datumUtils.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/datum_transform.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/defs.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/deriveConstants.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/extend.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/global.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/parseCode.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/projString.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/projections.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/projections/longlat.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/projections/merc.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/transform.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/proj4/lib/wkt.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/sprintf-js/src/sprintf.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/timezone/index.js","/home/travis/build/bokeh/bokeh/bokehjs/node_modules/tslib/tslib.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACldA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpiBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3XA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/sBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7IA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1hBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1UA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/cA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjDA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChJA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3LA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClMA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1cA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1fA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1QA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACv+BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3WA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9WA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5LA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9PA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChIA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3CA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9lCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrBA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3CA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnBA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChkCA;AACA;AACA;AACA;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACbA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACRA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5wEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9HA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACl6BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9JA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9uBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;ACNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClBA;AACA;AACA;AACA;AACA;AACA;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AClFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACzNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACfA;AACA;AACA;AACA;AACA;ACJA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACnCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACpCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACvDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACrIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC/EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC9MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AC5WA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"generated.js","sourceRoot":"","sourcesContent":["/* base */ function _(require, module, exports) {\n var models = require(153) /* ./models/index */;\n var object_1 = require(32) /* ./core/util/object */;\n exports.overrides = {};\n var _all_models = object_1.clone(models);\n exports.Models = (function (name) {\n var model = exports.overrides[name] || _all_models[name];\n if (model == null) {\n throw new Error(\"Model '\" + name + \"' does not exist. This could be due to a widget\\n or a custom model not being registered before first usage.\");\n }\n return model;\n });\n exports.Models.register = function (name, model) {\n exports.overrides[name] = model;\n };\n exports.Models.unregister = function (name) {\n delete exports.overrides[name];\n };\n exports.Models.register_models = function (models, force, errorFn) {\n if (force === void 0) {\n force = false;\n }\n if (models == null)\n return;\n for (var name_1 in models) {\n var model = models[name_1];\n if (force || !_all_models.hasOwnProperty(name_1))\n _all_models[name_1] = model;\n else if (errorFn != null)\n errorFn(name_1);\n else\n console.warn(\"Model '\" + name_1 + \"' was already registered\");\n }\n };\n exports.register_models = exports.Models.register_models;\n exports.Models.registered_names = function () { return Object.keys(_all_models); };\n // \"index\" is a map from the toplevel model IDs rendered by\n // embed.ts, to the view objects for those models. It doesn't\n // contain all views, only those explicitly rendered to an element\n // by embed.ts.\n exports.index = {};\n}\n","/* client/connection */ function _(require, module, exports) {\n var es6_promise_1 = require(336) /* es6-promise */;\n var logging_1 = require(14) /* core/logging */;\n var document_1 = require(52) /* document */;\n var message_1 = require(282) /* protocol/message */;\n var receiver_1 = require(283) /* protocol/receiver */;\n var session_1 = require(2) /* ./session */;\n exports.DEFAULT_SERVER_WEBSOCKET_URL = \"ws://localhost:5006/ws\";\n exports.DEFAULT_SESSION_ID = \"default\";\n var _connection_count = 0;\n var ClientConnection = /** @class */ (function () {\n function ClientConnection(url, id, args_string, _on_have_session_hook, _on_closed_permanently_hook) {\n if (url === void 0) {\n url = exports.DEFAULT_SERVER_WEBSOCKET_URL;\n }\n if (id === void 0) {\n id = exports.DEFAULT_SESSION_ID;\n }\n if (args_string === void 0) {\n args_string = null;\n }\n if (_on_have_session_hook === void 0) {\n _on_have_session_hook = null;\n }\n if (_on_closed_permanently_hook === void 0) {\n _on_closed_permanently_hook = null;\n }\n this.url = url;\n this.id = id;\n this.args_string = args_string;\n this._on_have_session_hook = _on_have_session_hook;\n this._on_closed_permanently_hook = _on_closed_permanently_hook;\n this._number = _connection_count++;\n this.socket = null;\n this.session = null;\n this.closed_permanently = false;\n this._current_handler = null;\n this._pending_ack = null; // null or [resolve,reject]\n this._pending_replies = {}; // map reqid to [resolve,reject]\n this._receiver = new receiver_1.Receiver();\n logging_1.logger.debug(\"Creating websocket \" + this._number + \" to '\" + this.url + \"' session '\" + this.id + \"'\");\n }\n ClientConnection.prototype.connect = function () {\n var _this = this;\n if (this.closed_permanently)\n return es6_promise_1.Promise.reject(new Error(\"Cannot connect() a closed ClientConnection\"));\n if (this.socket != null)\n return es6_promise_1.Promise.reject(new Error(\"Already connected\"));\n this._pending_replies = {};\n this._current_handler = null;\n try {\n var versioned_url = this.url + \"?bokeh-protocol-version=1.0&bokeh-session-id=\" + this.id;\n if (this.args_string != null && this.args_string.length > 0)\n versioned_url += \"&\" + this.args_string;\n this.socket = new WebSocket(versioned_url);\n return new es6_promise_1.Promise(function (resolve, reject) {\n // \"arraybuffer\" gives us binary data we can look at;\n // if we just needed an opaque blob we could use \"blob\"\n _this.socket.binaryType = \"arraybuffer\";\n _this.socket.onopen = function () { return _this._on_open(resolve, reject); };\n _this.socket.onmessage = function (event) { return _this._on_message(event); };\n _this.socket.onclose = function (event) { return _this._on_close(event); };\n _this.socket.onerror = function () { return _this._on_error(reject); };\n });\n }\n catch (error) {\n logging_1.logger.error(\"websocket creation failed to url: \" + this.url);\n logging_1.logger.error(\" - \" + error);\n return es6_promise_1.Promise.reject(error);\n }\n };\n ClientConnection.prototype.close = function () {\n if (!this.closed_permanently) {\n logging_1.logger.debug(\"Permanently closing websocket connection \" + this._number);\n this.closed_permanently = true;\n if (this.socket != null)\n this.socket.close(1000, \"close method called on ClientConnection \" + this._number);\n this.session._connection_closed();\n if (this._on_closed_permanently_hook != null) {\n this._on_closed_permanently_hook();\n this._on_closed_permanently_hook = null;\n }\n }\n };\n ClientConnection.prototype._schedule_reconnect = function (milliseconds) {\n var _this = this;\n var retry = function () {\n // TODO commented code below until we fix reconnection to repull\n // the document when required. Otherwise, we get a lot of\n // confusing errors that are causing trouble when debugging.\n /*\n if (this.closed_permanently) {\n */\n if (!_this.closed_permanently)\n logging_1.logger.info(\"Websocket connection \" + _this._number + \" disconnected, will not attempt to reconnect\");\n return;\n /*\n } else {\n logger.debug(`Attempting to reconnect websocket ${this._number}`)\n this.connect()\n }\n */\n };\n setTimeout(retry, milliseconds);\n };\n ClientConnection.prototype.send = function (message) {\n if (this.socket == null)\n throw new Error(\"not connected so cannot send \" + message);\n message.send(this.socket);\n };\n ClientConnection.prototype.send_with_reply = function (message) {\n var _this = this;\n var promise = new es6_promise_1.Promise(function (resolve, reject) {\n _this._pending_replies[message.msgid()] = [resolve, reject];\n _this.send(message);\n });\n return promise.then(function (message) {\n if (message.msgtype() === \"ERROR\")\n throw new Error(\"Error reply \" + message.content['text']);\n else\n return message;\n }, function (error) {\n throw error;\n });\n };\n ClientConnection.prototype._pull_doc_json = function () {\n var message = message_1.Message.create(\"PULL-DOC-REQ\", {});\n var promise = this.send_with_reply(message);\n return promise.then(function (reply) {\n if (!('doc' in reply.content))\n throw new Error(\"No 'doc' field in PULL-DOC-REPLY\");\n return reply.content['doc'];\n }, function (error) {\n throw error;\n });\n };\n ClientConnection.prototype._repull_session_doc = function () {\n var _this = this;\n if (this.session == null)\n logging_1.logger.debug(\"Pulling session for first time\");\n else\n logging_1.logger.debug(\"Repulling session\");\n this._pull_doc_json().then(function (doc_json) {\n if (_this.session == null) {\n if (_this.closed_permanently)\n logging_1.logger.debug(\"Got new document after connection was already closed\");\n else {\n var document_2 = document_1.Document.from_json(doc_json);\n // Constructing models changes some of their attributes, we deal with that\n // here. This happens when models set attributes during construction\n // or initialization.\n var patch = document_1.Document._compute_patch_since_json(doc_json, document_2);\n if (patch.events.length > 0) {\n logging_1.logger.debug(\"Sending \" + patch.events.length + \" changes from model construction back to server\");\n var patch_message = message_1.Message.create('PATCH-DOC', {}, patch);\n _this.send(patch_message);\n }\n _this.session = new session_1.ClientSession(_this, document_2, _this.id);\n logging_1.logger.debug(\"Created a new session from new pulled doc\");\n if (_this._on_have_session_hook != null) {\n _this._on_have_session_hook(_this.session);\n _this._on_have_session_hook = null;\n }\n }\n }\n else {\n _this.session.document.replace_with_json(doc_json);\n logging_1.logger.debug(\"Updated existing session with new pulled doc\");\n }\n }, function (error) {\n // handling the error here is useless because we wouldn't\n // get errors from the resolve handler above, so see\n // the catch below instead\n throw error;\n }).catch(function (error) {\n if (console.trace != null)\n console.trace(error);\n logging_1.logger.error(\"Failed to repull session \" + error);\n });\n };\n ClientConnection.prototype._on_open = function (resolve, reject) {\n var _this = this;\n logging_1.logger.info(\"Websocket connection \" + this._number + \" is now open\");\n this._pending_ack = [resolve, reject];\n this._current_handler = function (message) {\n _this._awaiting_ack_handler(message);\n };\n };\n ClientConnection.prototype._on_message = function (event) {\n if (this._current_handler == null)\n logging_1.logger.error(\"Got a message with no current handler set\");\n try {\n this._receiver.consume(event.data);\n }\n catch (e) {\n this._close_bad_protocol(e.toString());\n }\n if (this._receiver.message == null)\n return;\n var msg = this._receiver.message;\n var problem = msg.problem();\n if (problem != null)\n this._close_bad_protocol(problem);\n this._current_handler(msg);\n };\n ClientConnection.prototype._on_close = function (event) {\n var _this = this;\n logging_1.logger.info(\"Lost websocket \" + this._number + \" connection, \" + event.code + \" (\" + event.reason + \")\");\n this.socket = null;\n if (this._pending_ack != null) {\n this._pending_ack[1](new Error(\"Lost websocket connection, \" + event.code + \" (\" + event.reason + \")\"));\n this._pending_ack = null;\n }\n var pop_pending = function () {\n for (var reqid in _this._pending_replies) {\n var promise_funcs_1 = _this._pending_replies[reqid];\n delete _this._pending_replies[reqid];\n return promise_funcs_1;\n }\n return null;\n };\n var promise_funcs = pop_pending();\n while (promise_funcs != null) {\n promise_funcs[1](\"Disconnected\");\n promise_funcs = pop_pending();\n }\n if (!this.closed_permanently)\n this._schedule_reconnect(2000);\n };\n ClientConnection.prototype._on_error = function (reject) {\n logging_1.logger.debug(\"Websocket error on socket \" + this._number);\n reject(new Error(\"Could not open websocket\"));\n };\n ClientConnection.prototype._close_bad_protocol = function (detail) {\n logging_1.logger.error(\"Closing connection: \" + detail);\n if (this.socket != null)\n this.socket.close(1002, detail); // 1002 = protocol error\n };\n ClientConnection.prototype._awaiting_ack_handler = function (message) {\n var _this = this;\n if (message.msgtype() === \"ACK\") {\n this._current_handler = function (message) { return _this._steady_state_handler(message); };\n // Reload any sessions\n // TODO (havocp) there's a race where we might get a PATCH before\n // we send and get a reply to our pulls.\n this._repull_session_doc();\n if (this._pending_ack != null) {\n this._pending_ack[0](this);\n this._pending_ack = null;\n }\n }\n else\n this._close_bad_protocol(\"First message was not an ACK\");\n };\n ClientConnection.prototype._steady_state_handler = function (message) {\n if (message.reqid() in this._pending_replies) {\n var promise_funcs = this._pending_replies[message.reqid()];\n delete this._pending_replies[message.reqid()];\n promise_funcs[0](message);\n }\n else\n this.session.handle(message);\n };\n return ClientConnection;\n }());\n exports.ClientConnection = ClientConnection;\n // Returns a promise of a ClientSession\n // The returned promise has a close() method in case you want to close before\n // getting a session; session.close() works too once you have a session.\n function pull_session(url, session_id, args_string) {\n var connection;\n var promise = new es6_promise_1.Promise(function (resolve, reject) {\n connection = new ClientConnection(url, session_id, args_string, function (session) {\n try {\n resolve(session);\n }\n catch (error) {\n logging_1.logger.error(\"Promise handler threw an error, closing session \" + error);\n session.close();\n throw error;\n }\n }, function () {\n // we rely on reject() as a no-op if we already resolved\n reject(new Error(\"Connection was closed before we successfully pulled a session\"));\n });\n return connection.connect().then(function (_) { return undefined; }, function (error) {\n logging_1.logger.error(\"Failed to connect to Bokeh server \" + error);\n throw error;\n });\n });\n /*\n // add a \"close\" method to the promise... too weird?\n promise.close = () => {\n connection.close()\n }\n */\n return promise;\n }\n exports.pull_session = pull_session;\n}\n","/* client/session */ function _(require, module, exports) {\n var logging_1 = require(14) /* core/logging */;\n var document_1 = require(52) /* document */;\n var message_1 = require(282) /* protocol/message */;\n var ClientSession = /** @class */ (function () {\n function ClientSession(_connection, document /*Document*/, id) {\n var _this = this;\n this._connection = _connection;\n this.document = document;\n this.id = id;\n this._document_listener = function (event) { return _this._document_changed(event); };\n this.document.on_change(this._document_listener);\n this.event_manager = this.document.event_manager;\n this.event_manager.session = this;\n }\n ClientSession.prototype.handle = function (message) {\n var msgtype = message.msgtype();\n if (msgtype === 'PATCH-DOC')\n this._handle_patch(message);\n else if (msgtype === 'OK')\n this._handle_ok(message);\n else if (msgtype === 'ERROR')\n this._handle_error(message);\n else\n logging_1.logger.debug(\"Doing nothing with message \" + message.msgtype());\n };\n ClientSession.prototype.close = function () {\n this._connection.close();\n };\n ClientSession.prototype.send_event = function (event) {\n var message = message_1.Message.create('EVENT', {}, JSON.stringify(event));\n this._connection.send(message);\n };\n /*protected*/ ClientSession.prototype._connection_closed = function () {\n this.document.remove_on_change(this._document_listener);\n };\n // Sends a request to the server for info about the server, such as its Bokeh\n // version. Returns a promise, the value of the promise is a free-form dictionary\n // of server details.\n ClientSession.prototype.request_server_info = function () {\n var message = message_1.Message.create('SERVER-INFO-REQ', {});\n var promise = this._connection.send_with_reply(message);\n return promise.then(function (reply) { return reply.content; });\n };\n // Sends some request to the server (no guarantee about which one) and returns\n // a promise which is completed when the server replies. The purpose of this\n // is that if you wait for the promise to be completed, you know the server\n // has processed the request. This is useful when writing tests because once\n // the server has processed this request it should also have processed any\n // events or requests you sent previously, which means you can check for the\n // results of that processing without a race condition. (This assumes the\n // server processes events in sequence, which it mostly has to semantically,\n // since reordering events might change the final state.)\n ClientSession.prototype.force_roundtrip = function () {\n return this.request_server_info().then(function (_) { return undefined; });\n };\n ClientSession.prototype._document_changed = function (event) {\n // Filter out events that were initiated by the ClientSession itself\n if (event.setter_id === this.id)\n return;\n // Filter out changes to attributes that aren't server-visible\n if (event instanceof document_1.ModelChangedEvent && !(event.attr in event.model.serializable_attributes()))\n return;\n // TODO (havocp) the connection may be closed here, which will\n // cause this send to throw an error - need to deal with it more cleanly.\n var message = message_1.Message.create('PATCH-DOC', {}, this.document.create_json_patch([event]));\n this._connection.send(message);\n };\n ClientSession.prototype._handle_patch = function (message) {\n this.document.apply_json_patch(message.content, message.buffers, this.id);\n };\n ClientSession.prototype._handle_ok = function (message) {\n logging_1.logger.trace(\"Unhandled OK reply to \" + message.reqid());\n };\n ClientSession.prototype._handle_error = function (message) {\n logging_1.logger.error(\"Unhandled ERROR reply to \" + message.reqid() + \": \" + message.content['text']);\n };\n return ClientSession;\n }());\n exports.ClientSession = ClientSession;\n}\n","/* core/bokeh_events */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var logging_1 = require(14) /* ./logging */;\n var object_1 = require(32) /* ./util/object */;\n var event_classes = {};\n function register_event_class(event_name) {\n return function (event_cls) {\n event_cls.prototype.event_name = event_name;\n event_classes[event_name] = event_cls;\n };\n }\n exports.register_event_class = register_event_class;\n function register_with_event(event_cls) {\n var models = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n models[_i - 1] = arguments[_i];\n }\n var applicable_models = event_cls.prototype.applicable_models.concat(models);\n event_cls.prototype.applicable_models = applicable_models;\n }\n exports.register_with_event = register_with_event;\n var BokehEvent = /** @class */ (function () {\n function BokehEvent(options) {\n if (options === void 0) {\n options = {};\n }\n this.model_id = null;\n this._options = options;\n if (options.model_id) {\n this.model_id = options.model_id;\n }\n }\n BokehEvent.prototype.set_model_id = function (id) {\n this._options.model_id = id;\n this.model_id = id;\n return this;\n };\n BokehEvent.prototype.is_applicable_to = function (obj) {\n return this.applicable_models.some(function (model) { return obj instanceof model; });\n };\n BokehEvent.event_class = function (e) {\n // Given an event with a type attribute matching the event_name,\n // return the appropriate BokehEvent class\n if (e.type) {\n return event_classes[e.type];\n }\n else {\n logging_1.logger.warn('BokehEvent.event_class required events with a string type attribute');\n }\n };\n BokehEvent.prototype.toJSON = function () {\n return {\n event_name: this.event_name,\n event_values: object_1.clone(this._options),\n };\n };\n BokehEvent.prototype._customize_event = function (_model) {\n return this;\n };\n return BokehEvent;\n }());\n exports.BokehEvent = BokehEvent;\n BokehEvent.prototype.applicable_models = [];\n var ButtonClick = /** @class */ (function (_super) {\n tslib_1.__extends(ButtonClick, _super);\n function ButtonClick() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ButtonClick = tslib_1.__decorate([\n register_event_class(\"button_click\")\n ], ButtonClick);\n return ButtonClick;\n }(BokehEvent));\n exports.ButtonClick = ButtonClick;\n // A UIEvent is an event originating on a PlotCanvas this includes\n // DOM events such as keystrokes as well as hammer events and LOD events.\n var UIEvent = /** @class */ (function (_super) {\n tslib_1.__extends(UIEvent, _super);\n function UIEvent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return UIEvent;\n }(BokehEvent));\n exports.UIEvent = UIEvent;\n var LODStart = /** @class */ (function (_super) {\n tslib_1.__extends(LODStart, _super);\n function LODStart() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LODStart = tslib_1.__decorate([\n register_event_class(\"lodstart\")\n ], LODStart);\n return LODStart;\n }(UIEvent));\n exports.LODStart = LODStart;\n var LODEnd = /** @class */ (function (_super) {\n tslib_1.__extends(LODEnd, _super);\n function LODEnd() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LODEnd = tslib_1.__decorate([\n register_event_class(\"lodend\")\n ], LODEnd);\n return LODEnd;\n }(UIEvent));\n exports.LODEnd = LODEnd;\n var SelectionGeometry = /** @class */ (function (_super) {\n tslib_1.__extends(SelectionGeometry, _super);\n function SelectionGeometry(options) {\n var _this = _super.call(this, options) || this;\n _this.geometry = options.geometry;\n _this.final = options.final;\n return _this;\n }\n SelectionGeometry = tslib_1.__decorate([\n register_event_class(\"selectiongeometry\")\n ], SelectionGeometry);\n return SelectionGeometry;\n }(UIEvent));\n exports.SelectionGeometry = SelectionGeometry;\n var Reset = /** @class */ (function (_super) {\n tslib_1.__extends(Reset, _super);\n function Reset() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Reset = tslib_1.__decorate([\n register_event_class(\"reset\")\n ], Reset);\n return Reset;\n }(UIEvent));\n exports.Reset = Reset;\n var PointEvent = /** @class */ (function (_super) {\n tslib_1.__extends(PointEvent, _super);\n function PointEvent(options) {\n var _this = _super.call(this, options) || this;\n _this.sx = options.sx;\n _this.sy = options.sy;\n _this.x = null;\n _this.y = null;\n return _this;\n }\n PointEvent.from_event = function (e, model_id) {\n if (model_id === void 0) {\n model_id = null;\n }\n return new this({ sx: e.sx, sy: e.sy, model_id: model_id });\n };\n PointEvent.prototype._customize_event = function (plot) {\n var xscale = plot.plot_canvas.frame.xscales['default'];\n var yscale = plot.plot_canvas.frame.yscales['default'];\n this.x = xscale.invert(this.sx);\n this.y = yscale.invert(this.sy);\n this._options['x'] = this.x;\n this._options['y'] = this.y;\n return this;\n };\n return PointEvent;\n }(UIEvent));\n exports.PointEvent = PointEvent;\n var Pan = /** @class */ (function (_super) {\n tslib_1.__extends(Pan, _super);\n function Pan(options) {\n if (options === void 0) {\n options = {};\n }\n var _this = _super.call(this, options) || this;\n _this.delta_x = options.delta_x;\n _this.delta_y = options.delta_y;\n return _this;\n }\n Pan.from_event = function (e, model_id) {\n if (model_id === void 0) {\n model_id = null;\n }\n return new this({\n sx: e.sx,\n sy: e.sy,\n delta_x: e.deltaX,\n delta_y: e.deltaY,\n direction: e.direction,\n model_id: model_id,\n });\n };\n Pan = tslib_1.__decorate([\n register_event_class(\"pan\")\n ], Pan);\n return Pan;\n }(PointEvent));\n exports.Pan = Pan;\n var Pinch = /** @class */ (function (_super) {\n tslib_1.__extends(Pinch, _super);\n function Pinch(options) {\n if (options === void 0) {\n options = {};\n }\n var _this = _super.call(this, options) || this;\n _this.scale = options.scale;\n return _this;\n }\n Pinch.from_event = function (e, model_id) {\n if (model_id === void 0) {\n model_id = null;\n }\n return new this({\n sx: e.sx,\n sy: e.sy,\n scale: e.scale,\n model_id: model_id,\n });\n };\n Pinch = tslib_1.__decorate([\n register_event_class(\"pinch\")\n ], Pinch);\n return Pinch;\n }(PointEvent));\n exports.Pinch = Pinch;\n var MouseWheel = /** @class */ (function (_super) {\n tslib_1.__extends(MouseWheel, _super);\n function MouseWheel(options) {\n if (options === void 0) {\n options = {};\n }\n var _this = _super.call(this, options) || this;\n _this.delta = options.delta;\n return _this;\n }\n MouseWheel.from_event = function (e, model_id) {\n if (model_id === void 0) {\n model_id = null;\n }\n return new this({\n sx: e.sx,\n sy: e.sy,\n delta: e.delta,\n model_id: model_id,\n });\n };\n MouseWheel = tslib_1.__decorate([\n register_event_class(\"wheel\")\n ], MouseWheel);\n return MouseWheel;\n }(PointEvent));\n exports.MouseWheel = MouseWheel;\n var MouseMove = /** @class */ (function (_super) {\n tslib_1.__extends(MouseMove, _super);\n function MouseMove() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MouseMove = tslib_1.__decorate([\n register_event_class(\"mousemove\")\n ], MouseMove);\n return MouseMove;\n }(PointEvent));\n exports.MouseMove = MouseMove;\n var MouseEnter = /** @class */ (function (_super) {\n tslib_1.__extends(MouseEnter, _super);\n function MouseEnter() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MouseEnter = tslib_1.__decorate([\n register_event_class(\"mouseenter\")\n ], MouseEnter);\n return MouseEnter;\n }(PointEvent));\n exports.MouseEnter = MouseEnter;\n var MouseLeave = /** @class */ (function (_super) {\n tslib_1.__extends(MouseLeave, _super);\n function MouseLeave() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MouseLeave = tslib_1.__decorate([\n register_event_class(\"mouseleave\")\n ], MouseLeave);\n return MouseLeave;\n }(PointEvent));\n exports.MouseLeave = MouseLeave;\n var Tap = /** @class */ (function (_super) {\n tslib_1.__extends(Tap, _super);\n function Tap() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Tap = tslib_1.__decorate([\n register_event_class(\"tap\")\n ], Tap);\n return Tap;\n }(PointEvent));\n exports.Tap = Tap;\n var DoubleTap = /** @class */ (function (_super) {\n tslib_1.__extends(DoubleTap, _super);\n function DoubleTap() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DoubleTap = tslib_1.__decorate([\n register_event_class(\"doubletap\")\n ], DoubleTap);\n return DoubleTap;\n }(PointEvent));\n exports.DoubleTap = DoubleTap;\n var Press = /** @class */ (function (_super) {\n tslib_1.__extends(Press, _super);\n function Press() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Press = tslib_1.__decorate([\n register_event_class(\"press\")\n ], Press);\n return Press;\n }(PointEvent));\n exports.Press = Press;\n var PanStart = /** @class */ (function (_super) {\n tslib_1.__extends(PanStart, _super);\n function PanStart() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PanStart = tslib_1.__decorate([\n register_event_class(\"panstart\")\n ], PanStart);\n return PanStart;\n }(PointEvent));\n exports.PanStart = PanStart;\n var PanEnd = /** @class */ (function (_super) {\n tslib_1.__extends(PanEnd, _super);\n function PanEnd() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PanEnd = tslib_1.__decorate([\n register_event_class(\"panend\")\n ], PanEnd);\n return PanEnd;\n }(PointEvent));\n exports.PanEnd = PanEnd;\n var PinchStart = /** @class */ (function (_super) {\n tslib_1.__extends(PinchStart, _super);\n function PinchStart() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PinchStart = tslib_1.__decorate([\n register_event_class(\"pinchstart\")\n ], PinchStart);\n return PinchStart;\n }(PointEvent));\n exports.PinchStart = PinchStart;\n var PinchEnd = /** @class */ (function (_super) {\n tslib_1.__extends(PinchEnd, _super);\n function PinchEnd() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PinchEnd = tslib_1.__decorate([\n register_event_class(\"pinchend\")\n ], PinchEnd);\n return PinchEnd;\n }(PointEvent));\n exports.PinchEnd = PinchEnd;\n}\n","/* core/build_views */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var array_1 = require(21) /* ./util/array */;\n function build_views(view_storage, models, options, cls) {\n if (cls === void 0) {\n cls = function (model) { return model.default_view; };\n }\n var to_remove = array_1.difference(Object.keys(view_storage), models.map(function (model) { return model.id; }));\n for (var _i = 0, to_remove_1 = to_remove; _i < to_remove_1.length; _i++) {\n var model_id = to_remove_1[_i];\n view_storage[model_id].remove();\n delete view_storage[model_id];\n }\n var created_views = [];\n var new_models = models.filter(function (model) { return view_storage[model.id] == null; });\n for (var _a = 0, new_models_1 = new_models; _a < new_models_1.length; _a++) {\n var model = new_models_1[_a];\n var view_cls = cls(model);\n var view_options = tslib_1.__assign({}, options, { model: model, connect_signals: false });\n var view = new view_cls(view_options);\n view_storage[model.id] = view;\n created_views.push(view);\n }\n for (var _b = 0, created_views_1 = created_views; _b < created_views_1.length; _b++) {\n var view = created_views_1[_b];\n view.connect_signals();\n }\n return created_views;\n }\n exports.build_views = build_views;\n function remove_views(view_storage) {\n for (var id in view_storage) {\n view_storage[id].remove();\n delete view_storage[id];\n }\n }\n exports.remove_views = remove_views;\n}\n","/* core/dom */ function _(require, module, exports) {\n var types_1 = require(44) /* ./util/types */;\n var _createElement = function (tag) {\n return function (attrs) {\n if (attrs === void 0) {\n attrs = {};\n }\n var children = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n children[_i - 1] = arguments[_i];\n }\n var element = document.createElement(tag);\n for (var attr in attrs) {\n var value = attrs[attr];\n if (value == null || types_1.isBoolean(value) && !value)\n continue;\n if (attr === \"class\" && types_1.isArray(value)) {\n for (var _a = 0, _b = value; _a < _b.length; _a++) {\n var cls = _b[_a];\n if (cls != null)\n element.classList.add(cls);\n }\n continue;\n }\n if (attr === \"style\" && types_1.isPlainObject(value)) {\n for (var prop in value) {\n element.style[prop] = value[prop];\n }\n continue;\n }\n if (attr === \"data\" && types_1.isPlainObject(value)) {\n for (var key in value) {\n element.dataset[key] = value[key]; // XXX: attrs needs a better type\n }\n continue;\n }\n element.setAttribute(attr, value);\n }\n function append(child) {\n if (child instanceof HTMLElement)\n element.appendChild(child);\n else if (types_1.isString(child))\n element.appendChild(document.createTextNode(child));\n else if (child != null && child !== false)\n throw new Error(\"expected an HTMLElement, string, false or null, got \" + JSON.stringify(child));\n }\n for (var _c = 0, children_1 = children; _c < children_1.length; _c++) {\n var child = children_1[_c];\n if (types_1.isArray(child)) {\n for (var _d = 0, child_1 = child; _d < child_1.length; _d++) {\n var _child = child_1[_d];\n append(_child);\n }\n }\n else\n append(child);\n }\n return element;\n };\n };\n function createElement(tag, attrs) {\n var children = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n children[_i - 2] = arguments[_i];\n }\n return _createElement(tag).apply(void 0, [attrs].concat(children));\n }\n exports.createElement = createElement;\n exports.div = _createElement(\"div\"), exports.span = _createElement(\"span\"), exports.link = _createElement(\"link\"), exports.style = _createElement(\"style\"), exports.a = _createElement(\"a\"), exports.p = _createElement(\"p\"), exports.i = _createElement(\"i\"), exports.pre = _createElement(\"pre\"), exports.button = _createElement(\"button\"), exports.label = _createElement(\"label\"), exports.input = _createElement(\"input\"), exports.select = _createElement(\"select\"), exports.option = _createElement(\"option\"), exports.optgroup = _createElement(\"optgroup\"), exports.textarea = _createElement(\"textarea\"), exports.canvas = _createElement(\"canvas\"), exports.ul = _createElement(\"ul\"), exports.ol = _createElement(\"ol\"), exports.li = _createElement(\"li\");\n exports.nbsp = document.createTextNode(\"\\u00a0\");\n function removeElement(element) {\n var parent = element.parentNode;\n if (parent != null) {\n parent.removeChild(element);\n }\n }\n exports.removeElement = removeElement;\n function replaceWith(element, replacement) {\n var parent = element.parentNode;\n if (parent != null) {\n parent.replaceChild(replacement, element);\n }\n }\n exports.replaceWith = replaceWith;\n function prepend(element) {\n var nodes = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n nodes[_i - 1] = arguments[_i];\n }\n var first = element.firstChild;\n for (var _a = 0, nodes_1 = nodes; _a < nodes_1.length; _a++) {\n var node = nodes_1[_a];\n element.insertBefore(node, first);\n }\n }\n exports.prepend = prepend;\n function empty(element) {\n var child;\n while (child = element.firstChild) {\n element.removeChild(child);\n }\n }\n exports.empty = empty;\n function show(element) {\n element.style.display = \"\";\n }\n exports.show = show;\n function hide(element) {\n element.style.display = \"none\";\n }\n exports.hide = hide;\n function position(element) {\n return {\n top: element.offsetTop,\n left: element.offsetLeft,\n };\n }\n exports.position = position;\n function offset(element) {\n var rect = element.getBoundingClientRect();\n return {\n top: rect.top + window.pageYOffset - document.documentElement.clientTop,\n left: rect.left + window.pageXOffset - document.documentElement.clientLeft,\n };\n }\n exports.offset = offset;\n function matches(el, selector) {\n var p = Element.prototype;\n var f = p.matches || p.webkitMatchesSelector || p.mozMatchesSelector || p.msMatchesSelector;\n return f.call(el, selector);\n }\n exports.matches = matches;\n function parent(el, selector) {\n var node = el;\n while (node = node.parentElement) {\n if (matches(node, selector))\n return node;\n }\n return null;\n }\n exports.parent = parent;\n function margin(el) {\n var style = getComputedStyle(el);\n return {\n top: parseFloat(style.marginTop) || 0,\n bottom: parseFloat(style.marginBottom) || 0,\n left: parseFloat(style.marginLeft) || 0,\n right: parseFloat(style.marginRight) || 0,\n };\n }\n exports.margin = margin;\n function padding(el) {\n var style = getComputedStyle(el);\n return {\n top: parseFloat(style.paddingTop) || 0,\n bottom: parseFloat(style.paddingBottom) || 0,\n left: parseFloat(style.paddingLeft) || 0,\n right: parseFloat(style.paddingRight) || 0,\n };\n }\n exports.padding = padding;\n var Keys;\n (function (Keys) {\n Keys[Keys[\"Backspace\"] = 8] = \"Backspace\";\n Keys[Keys[\"Tab\"] = 9] = \"Tab\";\n Keys[Keys[\"Enter\"] = 13] = \"Enter\";\n Keys[Keys[\"Esc\"] = 27] = \"Esc\";\n Keys[Keys[\"PageUp\"] = 33] = \"PageUp\";\n Keys[Keys[\"PageDown\"] = 34] = \"PageDown\";\n Keys[Keys[\"Left\"] = 37] = \"Left\";\n Keys[Keys[\"Up\"] = 38] = \"Up\";\n Keys[Keys[\"Right\"] = 39] = \"Right\";\n Keys[Keys[\"Down\"] = 40] = \"Down\";\n Keys[Keys[\"Delete\"] = 46] = \"Delete\";\n })(Keys = exports.Keys || (exports.Keys = {}));\n}\n","/* core/dom_view */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var view_1 = require(48) /* ./view */;\n var DOM = require(5) /* ./dom */;\n var DOMView = /** @class */ (function (_super) {\n tslib_1.__extends(DOMView, _super);\n function DOMView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n DOMView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this._has_finished = false;\n this.el = this._createElement();\n };\n DOMView.prototype.remove = function () {\n DOM.removeElement(this.el);\n _super.prototype.remove.call(this);\n };\n DOMView.prototype.css_classes = function () {\n return [];\n };\n DOMView.prototype.cursor = function (_sx, _sy) {\n return null;\n };\n DOMView.prototype.layout = function () { };\n DOMView.prototype.render = function () { };\n DOMView.prototype.renderTo = function (element) {\n element.appendChild(this.el);\n this.layout();\n };\n DOMView.prototype.has_finished = function () {\n return this._has_finished;\n };\n Object.defineProperty(DOMView.prototype, \"_root_element\", {\n get: function () {\n return DOM.parent(this.el, \".bk-root\") || document.body;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DOMView.prototype, \"solver\", {\n get: function () {\n return this.is_root ? this._solver : this.parent.solver;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DOMView.prototype, \"is_idle\", {\n get: function () {\n return this.has_finished();\n },\n enumerable: true,\n configurable: true\n });\n DOMView.prototype._createElement = function () {\n return DOM.createElement(this.tagName, { id: this.id, class: this.css_classes() });\n };\n return DOMView;\n }(view_1.View));\n exports.DOMView = DOMView;\n DOMView.prototype.tagName = \"div\";\n}\n","/* core/enums */ function _(require, module, exports) {\n exports.AngleUnits = [\"deg\", \"rad\"];\n exports.Dimension = [\"width\", \"height\"];\n exports.Dimensions = [\"width\", \"height\", \"both\"];\n exports.Direction = [\"clock\", \"anticlock\"];\n exports.FontStyle = [\"normal\", \"italic\", \"bold\", \"bold italic\"];\n exports.LatLon = [\"lat\", \"lon\"];\n exports.LineCap = [\"butt\", \"round\", \"square\"];\n exports.LineJoin = [\"miter\", \"round\", \"bevel\"];\n exports.Location = [\"above\", \"below\", \"left\", \"right\"];\n exports.LegendClickPolicy = [\"none\", \"hide\", \"mute\"];\n exports.LegendLocation = [\n \"top_left\", \"top_center\", \"top_right\",\n \"center_left\", \"center\", \"center_right\",\n \"bottom_left\", \"bottom_center\", \"bottom_right\",\n ];\n exports.Anchor = exports.LegendLocation;\n exports.Orientation = [\"vertical\", \"horizontal\"];\n exports.OutputBackend = [\"canvas\", \"svg\", \"webgl\"];\n exports.RenderLevel = [\"image\", \"underlay\", \"glyph\", \"annotation\", \"overlay\"];\n exports.RenderMode = [\"canvas\", \"css\"];\n exports.Side = [\"above\", \"below\", \"left\", \"right\"];\n exports.Place = [\"above\", \"below\", \"left\", \"right\", \"center\"];\n exports.SpatialUnits = [\"screen\", \"data\"];\n exports.StartEnd = [\"start\", \"end\"];\n exports.VerticalAlign = [\"top\", \"middle\", \"bottom\"];\n exports.TextAlign = [\"left\", \"right\", \"center\"];\n exports.TextBaseline = [\"top\", \"middle\", \"bottom\", \"alphabetic\", \"hanging\", \"ideographic\"];\n exports.TickLabelOrientation = [\"vertical\", \"horizontal\", \"parallel\", \"normal\"];\n exports.TooltipAttachment = [\"horizontal\", \"vertical\", \"left\", \"right\", \"above\", \"below\"];\n exports.Distribution = [\"uniform\", \"normal\"];\n exports.StepMode = [\"after\", \"before\", \"center\"];\n exports.SizingMode = [\"stretch_both\", \"scale_width\", \"scale_height\", \"scale_both\", \"fixed\"];\n exports.PaddingUnits = [\"percent\", \"absolute\"];\n exports.SliderCallbackPolicy = [\"continuous\", \"throttle\", \"mouseup\"];\n exports.RoundingFunction = [\"round\", \"nearest\", \"floor\", \"rounddown\", \"ceil\", \"roundup\"];\n exports.UpdateMode = [\"replace\", \"append\"];\n exports.HTTPMethod = [\"POST\", \"GET\"];\n exports.Logo = [\"normal\", \"grey\"];\n}\n","/* core/has_props */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var signaling_1 = require(19) /* ./signaling */;\n var property_mixins = require(16) /* ./property_mixins */;\n var refs_1 = require(34) /* ./util/refs */;\n var p = require(15) /* ./properties */;\n var string_1 = require(38) /* ./util/string */;\n var array_1 = require(21) /* ./util/array */;\n var object_1 = require(32) /* ./util/object */;\n var types_1 = require(44) /* ./util/types */;\n var eq_1 = require(30) /* ./util/eq */;\n var HasProps = /** @class */ (function (_super) {\n tslib_1.__extends(HasProps, _super);\n function HasProps(attrs) {\n if (attrs === void 0) {\n attrs = {};\n }\n var _this = _super.call(this) || this;\n _this._subtype = undefined;\n _this.document = null;\n _this.destroyed = new signaling_1.Signal0(_this, \"destroyed\");\n _this.change = new signaling_1.Signal0(_this, \"change\");\n _this.transformchange = new signaling_1.Signal0(_this, \"transformchange\");\n _this.attributes = {};\n _this.properties = {};\n _this._set_after_defaults = {};\n _this._pending = false;\n _this._changing = false;\n for (var name_1 in _this.props) {\n var _a = _this.props[name_1], type = _a.type, default_value = _a.default_value;\n if (type != null)\n _this.properties[name_1] = new type(_this, name_1, default_value);\n else\n throw new Error(\"undefined property type for \" + _this.type + \".\" + name_1);\n }\n // auto generating ID\n if (attrs.id == null)\n _this.setv({ id: string_1.uniqueId() }, { silent: true });\n var deferred = attrs.__deferred__ || false;\n if (deferred) {\n attrs = object_1.clone(attrs);\n delete attrs.__deferred__;\n }\n _this.setv(attrs, { silent: true });\n // allowing us to defer initialization when loading many models\n // when loading a bunch of models, we want to do initialization as a second pass\n // because other objects that this one depends on might not be loaded yet\n if (!deferred)\n _this.finalize();\n return _this;\n }\n HasProps.initClass = function () {\n this.prototype.type = \"HasProps\";\n this.prototype.props = {};\n this.prototype.mixins = [];\n this.define({\n id: [p.Any],\n });\n };\n // }}}\n HasProps._fix_default = function (default_value, _attr) {\n if (default_value === undefined)\n return undefined;\n else if (types_1.isFunction(default_value))\n return default_value;\n else if (!types_1.isObject(default_value))\n return function () { return default_value; };\n else {\n //logger.warn(`${this.prototype.type}.${attr} uses unwrapped non-primitive default value`)\n if (types_1.isArray(default_value))\n return function () { return array_1.copy(default_value); };\n else\n return function () { return object_1.clone(default_value); };\n }\n };\n HasProps.define = function (obj) {\n var _loop_1 = function (name_2) {\n var prop = obj[name_2];\n if (this_1.prototype.props[name_2] != null)\n throw new Error(\"attempted to redefine property '\" + this_1.prototype.type + \".\" + name_2 + \"'\");\n if (this_1.prototype[name_2] != null)\n throw new Error(\"attempted to redefine attribute '\" + this_1.prototype.type + \".\" + name_2 + \"'\");\n Object.defineProperty(this_1.prototype, name_2, {\n // XXX: don't use tail calls in getters/setters due to https://bugs.webkit.org/show_bug.cgi?id=164306\n get: function () {\n var value = this.getv(name_2);\n return value;\n },\n set: function (value) {\n var _a;\n this.setv((_a = {}, _a[name_2] = value, _a));\n return this;\n },\n configurable: false,\n enumerable: true,\n });\n var type = prop[0], default_value = prop[1], internal = prop[2];\n var refined_prop = {\n type: type,\n default_value: this_1._fix_default(default_value, name_2),\n internal: internal || false,\n };\n var props = object_1.clone(this_1.prototype.props);\n props[name_2] = refined_prop;\n this_1.prototype.props = props;\n };\n var this_1 = this;\n for (var name_2 in obj) {\n _loop_1(name_2);\n }\n };\n HasProps.internal = function (obj) {\n var _object = {};\n for (var name_3 in obj) {\n var prop = obj[name_3];\n var type = prop[0], default_value = prop[1];\n _object[name_3] = [type, default_value, true];\n }\n this.define(_object);\n };\n HasProps.mixin = function () {\n var names = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n names[_i] = arguments[_i];\n }\n this.define(property_mixins.create(names));\n var mixins = this.prototype.mixins.concat(names);\n this.prototype.mixins = mixins;\n };\n HasProps.mixins = function (names) {\n this.mixin.apply(this, names);\n };\n HasProps.override = function (obj) {\n for (var name_4 in obj) {\n var default_value = this._fix_default(obj[name_4], name_4);\n var value = this.prototype.props[name_4];\n if (value == null)\n throw new Error(\"attempted to override nonexistent '\" + this.prototype.type + \".\" + name_4 + \"'\");\n var props = object_1.clone(this.prototype.props);\n props[name_4] = tslib_1.__assign({}, value, { default_value: default_value });\n this.prototype.props = props;\n }\n };\n HasProps.prototype.toString = function () {\n return this.type + \"(\" + this.id + \")\";\n };\n HasProps.prototype.finalize = function () {\n var _this = this;\n // This is necessary because the initial creation of properties relies on\n // model.get which is not usable at that point yet in the constructor. This\n // initializer is called when deferred initialization happens for all models\n // and insures that the Bokeh properties are initialized from Backbone\n // attributes in a consistent way.\n //\n // TODO (bev) split property creation up into two parts so that only the\n // portion of init that can be done happens in HasProps constructor and so\n // that subsequent updates do not duplicate that setup work.\n for (var name_5 in this.properties) {\n var prop = this.properties[name_5];\n prop.update();\n if (prop.spec.transform != null)\n this.connect(prop.spec.transform.change, function () { return _this.transformchange.emit(); });\n }\n this.initialize();\n this.connect_signals();\n };\n HasProps.prototype.initialize = function () { };\n HasProps.prototype.connect_signals = function () { };\n HasProps.prototype.disconnect_signals = function () {\n signaling_1.Signal.disconnectReceiver(this);\n };\n HasProps.prototype.destroy = function () {\n this.disconnect_signals();\n this.destroyed.emit();\n };\n // Create a new model with identical attributes to this one.\n HasProps.prototype.clone = function () {\n return new this.constructor(this.attributes);\n };\n // Set a hash of model attributes on the object, firing `\"change\"`. This is\n // the core primitive operation of a model, updating the data and notifying\n // anyone who needs to know about the change in state. The heart of the beast.\n HasProps.prototype._setv = function (attrs, options) {\n // Extract attributes and options.\n var check_eq = options.check_eq;\n var silent = options.silent;\n var changes = [];\n var changing = this._changing;\n this._changing = true;\n var current = this.attributes;\n // For each `set` attribute, update or delete the current value.\n for (var attr in attrs) {\n var val = attrs[attr];\n if (check_eq !== false) {\n if (!eq_1.isEqual(current[attr], val))\n changes.push(attr);\n }\n else\n changes.push(attr);\n current[attr] = val;\n }\n // Trigger all relevant attribute changes.\n if (!silent) {\n if (changes.length > 0)\n this._pending = true;\n for (var i = 0; i < changes.length; i++)\n this.properties[changes[i]].change.emit();\n }\n // You might be wondering why there's a `while` loop here. Changes can\n // be recursively nested within `\"change\"` events.\n if (changing)\n return;\n if (!silent && !options.no_change) {\n while (this._pending) {\n this._pending = false;\n this.change.emit();\n }\n }\n this._pending = false;\n this._changing = false;\n };\n HasProps.prototype.setv = function (attrs, options) {\n if (options === void 0) {\n options = {};\n }\n for (var key in attrs) {\n if (!attrs.hasOwnProperty(key))\n continue;\n var prop_name = key;\n if (this.props[prop_name] == null)\n throw new Error(\"property \" + this.type + \".\" + prop_name + \" wasn't declared\");\n if (!(options != null && options.defaults))\n this._set_after_defaults[key] = true;\n }\n if (!object_1.isEmpty(attrs)) {\n var old = {};\n for (var key in attrs)\n old[key] = this.getv(key);\n this._setv(attrs, options);\n var silent = options.silent;\n if (silent == null || !silent) {\n for (var key in attrs)\n this._tell_document_about_change(key, old[key], this.getv(key), options);\n }\n }\n };\n HasProps.prototype.getv = function (prop_name) {\n if (this.props[prop_name] == null)\n throw new Error(\"property \" + this.type + \".\" + prop_name + \" wasn't declared\");\n else\n return this.attributes[prop_name];\n };\n HasProps.prototype.ref = function () {\n return refs_1.create_ref(this);\n };\n // we only keep the subtype so we match Python;\n // only Python cares about this\n HasProps.prototype.set_subtype = function (subtype) {\n this._subtype = subtype;\n };\n HasProps.prototype.attribute_is_serializable = function (attr) {\n var prop = this.props[attr];\n if (prop == null)\n throw new Error(this.type + \".attribute_is_serializable('\" + attr + \"'): \" + attr + \" wasn't declared\");\n else\n return !prop.internal;\n };\n // dict of attributes that should be serialized to the server. We\n // sometimes stick things in attributes that aren't part of the\n // Document's models, subtypes that do that have to remove their\n // extra attributes here.\n HasProps.prototype.serializable_attributes = function () {\n var attrs = {};\n for (var name_6 in this.attributes) {\n var value = this.attributes[name_6];\n if (this.attribute_is_serializable(name_6))\n attrs[name_6] = value;\n }\n return attrs;\n };\n HasProps._value_to_json = function (_key, value, _optional_parent_object) {\n if (value instanceof HasProps)\n return value.ref();\n else if (types_1.isArray(value)) {\n var ref_array = [];\n for (var i = 0; i < value.length; i++) {\n var v = value[i];\n ref_array.push(HasProps._value_to_json(i.toString(), v, value));\n }\n return ref_array;\n }\n else if (types_1.isPlainObject(value)) {\n var ref_obj = {};\n for (var subkey in value) {\n if (value.hasOwnProperty(subkey))\n ref_obj[subkey] = HasProps._value_to_json(subkey, value[subkey], value);\n }\n return ref_obj;\n }\n else\n return value;\n };\n // Convert attributes to \"shallow\" JSON (values which are themselves models\n // are included as just references)\n HasProps.prototype.attributes_as_json = function (include_defaults, value_to_json) {\n if (include_defaults === void 0) {\n include_defaults = true;\n }\n if (value_to_json === void 0) {\n value_to_json = HasProps._value_to_json;\n }\n var serializable = this.serializable_attributes();\n var attrs = {};\n for (var key in serializable) {\n if (serializable.hasOwnProperty(key)) {\n var value = serializable[key];\n if (include_defaults)\n attrs[key] = value;\n else if (key in this._set_after_defaults)\n attrs[key] = value;\n }\n }\n return value_to_json(\"attributes\", attrs, this);\n };\n // this is like _value_record_references but expects to find refs\n // instead of models, and takes a doc to look up the refs in\n HasProps._json_record_references = function (doc, v, result, recurse) {\n if (v == null) {\n }\n else if (refs_1.is_ref(v)) {\n if (!(v.id in result)) {\n var model = doc.get_model_by_id(v.id);\n HasProps._value_record_references(model, result, recurse);\n }\n }\n else if (types_1.isArray(v)) {\n for (var _i = 0, v_1 = v; _i < v_1.length; _i++) {\n var elem = v_1[_i];\n HasProps._json_record_references(doc, elem, result, recurse);\n }\n }\n else if (types_1.isPlainObject(v)) {\n for (var k in v) {\n if (v.hasOwnProperty(k)) {\n var elem = v[k];\n HasProps._json_record_references(doc, elem, result, recurse);\n }\n }\n }\n };\n // add all references from 'v' to 'result', if recurse\n // is true then descend into refs, if false only\n // descend into non-refs\n HasProps._value_record_references = function (v, result, recurse) {\n if (v == null) {\n }\n else if (v instanceof HasProps) {\n if (!(v.id in result)) {\n result[v.id] = v;\n if (recurse) {\n var immediate = v._immediate_references();\n for (var _i = 0, immediate_1 = immediate; _i < immediate_1.length; _i++) {\n var obj = immediate_1[_i];\n HasProps._value_record_references(obj, result, true);\n } // true=recurse\n }\n }\n }\n else if (v.buffer instanceof ArrayBuffer) {\n }\n else if (types_1.isArray(v)) {\n for (var _a = 0, v_2 = v; _a < v_2.length; _a++) {\n var elem = v_2[_a];\n HasProps._value_record_references(elem, result, recurse);\n }\n }\n else if (types_1.isPlainObject(v)) {\n for (var k in v) {\n if (v.hasOwnProperty(k)) {\n var elem = v[k];\n HasProps._value_record_references(elem, result, recurse);\n }\n }\n }\n };\n // Get models that are immediately referenced by our properties\n // (do not recurse, do not include ourselves)\n HasProps.prototype._immediate_references = function () {\n var result = {};\n var attrs = this.serializable_attributes();\n for (var key in attrs) {\n var value = attrs[key];\n HasProps._value_record_references(value, result, false); // false = no recurse\n }\n return object_1.values(result);\n };\n HasProps.prototype.references = function () {\n var references = {};\n HasProps._value_record_references(this, references, true);\n return object_1.values(references);\n };\n HasProps.prototype._doc_attached = function () { };\n HasProps.prototype.attach_document = function (doc) {\n // This should only be called by the Document implementation to set the document field\n if (this.document != null && this.document != doc)\n throw new Error(\"models must be owned by only a single document\");\n this.document = doc;\n this._doc_attached();\n };\n HasProps.prototype.detach_document = function () {\n // This should only be called by the Document implementation to unset the document field\n this.document = null;\n };\n HasProps.prototype._tell_document_about_change = function (attr, old, new_, options) {\n if (!this.attribute_is_serializable(attr))\n return;\n if (this.document != null) {\n var new_refs = {};\n HasProps._value_record_references(new_, new_refs, false);\n var old_refs = {};\n HasProps._value_record_references(old, old_refs, false);\n var need_invalidate = false;\n for (var new_id in new_refs) {\n if (!(new_id in old_refs)) {\n need_invalidate = true;\n break;\n }\n }\n if (!need_invalidate) {\n for (var old_id in old_refs) {\n if (!(old_id in new_refs)) {\n need_invalidate = true;\n break;\n }\n }\n }\n if (need_invalidate)\n this.document._invalidate_all_models();\n this.document._notify_change(this, attr, old, new_, options);\n }\n };\n HasProps.prototype.materialize_dataspecs = function (source) {\n // Note: this should be moved to a function separate from HasProps\n var data = {};\n for (var name_7 in this.properties) {\n var prop = this.properties[name_7];\n if (!prop.dataspec)\n continue;\n // this skips optional properties like radius for circles\n if (prop.optional && prop.spec.value == null && !(name_7 in this._set_after_defaults))\n continue;\n data[\"_\" + name_7] = prop.array(source);\n // the shapes are indexed by the column name, but when we materialize the dataspec, we should\n // store under the canonical field name, e.g. _image_shape, even if the column name is \"foo\"\n if (prop.spec.field != null && prop.spec.field in source._shapes)\n data[\"_\" + name_7 + \"_shape\"] = source._shapes[prop.spec.field];\n if (prop instanceof p.DistanceSpec)\n data[\"max_\" + name_7] = array_1.max(data[\"_\" + name_7]);\n }\n return data;\n };\n return HasProps;\n }(signaling_1.Signalable()));\n exports.HasProps = HasProps;\n HasProps.initClass();\n}\n","/* core/hittest */ function _(require, module, exports) {\n var array_1 = require(21) /* ./util/array */;\n var selection_1 = require(197) /* ../models/selections/selection */;\n function point_in_poly(x, y, px, py) {\n var inside = false;\n var x1 = px[px.length - 1];\n var y1 = py[py.length - 1];\n for (var i = 0; i < px.length; i++) {\n var x2 = px[i];\n var y2 = py[i];\n if ((y1 < y) != (y2 < y)) {\n if (x1 + (y - y1) / (y2 - y1) * (x2 - x1) < x)\n inside = !inside;\n }\n x1 = x2;\n y1 = y2;\n }\n return inside;\n }\n exports.point_in_poly = point_in_poly;\n function point_in_ellipse(x, y, angle, b, a, x0, y0) {\n var A = (Math.pow((Math.cos(angle) / a), 2) + Math.pow((Math.sin(angle) / b), 2));\n var B = 2 * Math.cos(angle) * Math.sin(angle) * (Math.pow((1 / a), 2) - Math.pow((1 / b), 2));\n var C = (Math.pow((Math.cos(angle) / b), 2) + Math.pow((Math.sin(angle) / a), 2));\n var eqn = A * Math.pow((x - x0), 2) + B * (x - x0) * (y - y0) + C * Math.pow((y - y0), 2);\n var inside = eqn <= 1;\n return inside;\n }\n exports.point_in_ellipse = point_in_ellipse;\n function create_empty_hit_test_result() {\n return new selection_1.Selection();\n }\n exports.create_empty_hit_test_result = create_empty_hit_test_result;\n function create_hit_test_result_from_hits(hits) {\n var result = new selection_1.Selection();\n result.indices = array_1.sortBy(hits, function (_a) {\n var _i = _a[0], dist = _a[1];\n return dist;\n }).map(function (_a) {\n var i = _a[0], _dist = _a[1];\n return i;\n });\n return result;\n }\n exports.create_hit_test_result_from_hits = create_hit_test_result_from_hits;\n function validate_bbox_coords(_a, _b) {\n var x0 = _a[0], x1 = _a[1];\n var y0 = _b[0], y1 = _b[1];\n var _c, _d;\n // spatial index (flatbush) expects x0, y0 to be min, x1, y1 max\n if (x0 > x1)\n _c = [x1, x0], x0 = _c[0], x1 = _c[1];\n if (y0 > y1)\n _d = [y1, y0], y0 = _d[0], y1 = _d[1];\n return { minX: x0, minY: y0, maxX: x1, maxY: y1 };\n }\n exports.validate_bbox_coords = validate_bbox_coords;\n function sqr(x) {\n return x * x;\n }\n function dist_2_pts(p0, p1) {\n return sqr(p0.x - p1.x) + sqr(p0.y - p1.y);\n }\n exports.dist_2_pts = dist_2_pts;\n function dist_to_segment_squared(p, v, w) {\n var l2 = dist_2_pts(v, w);\n if (l2 == 0)\n return dist_2_pts(p, v);\n var t = ((p.x - v.x) * (w.x - v.x) + (p.y - v.y) * (w.y - v.y)) / l2;\n if (t < 0)\n return dist_2_pts(p, v);\n if (t > 1)\n return dist_2_pts(p, w);\n var q = { x: v.x + t * (w.x - v.x), y: v.y + t * (w.y - v.y) };\n return dist_2_pts(p, q);\n }\n exports.dist_to_segment_squared = dist_to_segment_squared;\n function dist_to_segment(p, v, w) {\n return Math.sqrt(dist_to_segment_squared(p, v, w));\n }\n exports.dist_to_segment = dist_to_segment;\n function check_2_segments_intersect(l0_x0, l0_y0, l0_x1, l0_y1, l1_x0, l1_y0, l1_x1, l1_y1) {\n /*\n * Check if 2 segments (l0 and l1) intersect. Returns a structure with\n * the following attributes:\n * * hit (boolean): whether the 2 segments intersect\n * * x (float): x coordinate of the intersection point\n * * y (float): y coordinate of the intersection point\n */\n var den = ((l1_y1 - l1_y0) * (l0_x1 - l0_x0)) - ((l1_x1 - l1_x0) * (l0_y1 - l0_y0));\n if (den == 0) {\n return { hit: false, x: null, y: null };\n }\n else {\n var a = l0_y0 - l1_y0;\n var b = l0_x0 - l1_x0;\n var num1 = ((l1_x1 - l1_x0) * a) - ((l1_y1 - l1_y0) * b);\n var num2 = ((l0_x1 - l0_x0) * a) - ((l0_y1 - l0_y0) * b);\n a = num1 / den;\n b = num2 / den;\n var x = l0_x0 + (a * (l0_x1 - l0_x0));\n var y = l0_y0 + (a * (l0_y1 - l0_y0));\n return {\n hit: (a > 0 && a < 1) && (b > 0 && b < 1),\n x: x,\n y: y,\n };\n }\n }\n exports.check_2_segments_intersect = check_2_segments_intersect;\n}\n","/* core/layout/alignments */ function _(require, module, exports) {\n var solver_1 = require(13) /* ./solver */;\n var array_1 = require(21) /* ../util/array */;\n function vstack(container, children) {\n var constraints = [];\n if (children.length > 0) {\n constraints.push(solver_1.EQ(array_1.head(children)._bottom, [-1, container._bottom]));\n constraints.push(solver_1.EQ(array_1.tail(children)._top, [-1, container._top]));\n constraints.push.apply(constraints, array_1.pairwise(children, function (prev, next) { return solver_1.EQ(prev._top, [-1, next._bottom]); }));\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n var child = children_1[_i];\n constraints.push(solver_1.EQ(child._left, [-1, container._left]));\n constraints.push(solver_1.EQ(child._right, [-1, container._right]));\n }\n }\n return constraints;\n }\n exports.vstack = vstack;\n function hstack(container, children) {\n var constraints = [];\n if (children.length > 0) {\n constraints.push(solver_1.EQ(array_1.head(children)._right, [-1, container._right]));\n constraints.push(solver_1.EQ(array_1.tail(children)._left, [-1, container._left]));\n constraints.push.apply(constraints, array_1.pairwise(children, function (prev, next) { return solver_1.EQ(prev._left, [-1, next._right]); }));\n for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\n var child = children_2[_i];\n constraints.push(solver_1.EQ(child._top, [-1, container._top]));\n constraints.push(solver_1.EQ(child._bottom, [-1, container._bottom]));\n }\n }\n return constraints;\n }\n exports.hstack = hstack;\n}\n","/* core/layout/layout_canvas */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var solver_1 = require(13) /* ./solver */;\n var has_props_1 = require(8) /* ../has_props */;\n var bbox_1 = require(24) /* ../util/bbox */;\n var LayoutCanvas = /** @class */ (function (_super) {\n tslib_1.__extends(LayoutCanvas, _super);\n function LayoutCanvas(attrs) {\n return _super.call(this, attrs) || this;\n }\n LayoutCanvas.initClass = function () {\n this.prototype.type = \"LayoutCanvas\";\n };\n LayoutCanvas.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._top = new solver_1.Variable(this.toString() + \".top\");\n this._left = new solver_1.Variable(this.toString() + \".left\");\n this._width = new solver_1.Variable(this.toString() + \".width\");\n this._height = new solver_1.Variable(this.toString() + \".height\");\n this._right = new solver_1.Variable(this.toString() + \".right\");\n this._bottom = new solver_1.Variable(this.toString() + \".bottom\");\n var layout = this;\n this._hcenter = {\n get value() {\n return (layout._left.value + layout._right.value) / 2;\n },\n };\n this._vcenter = {\n get value() {\n return (layout._top.value + layout._bottom.value) / 2;\n },\n };\n };\n LayoutCanvas.prototype.get_editables = function () {\n return [];\n };\n LayoutCanvas.prototype.get_constraints = function () {\n return [\n solver_1.GE(this._top),\n solver_1.GE(this._bottom),\n solver_1.GE(this._left),\n solver_1.GE(this._right),\n solver_1.GE(this._width),\n solver_1.GE(this._height),\n solver_1.EQ(this._left, this._width, [-1, this._right]),\n solver_1.EQ(this._top, this._height, [-1, this._bottom]),\n ];\n };\n LayoutCanvas.prototype.get_layoutable_children = function () {\n return [];\n };\n Object.defineProperty(LayoutCanvas.prototype, \"bbox\", {\n get: function () {\n return new bbox_1.BBox({\n x0: this._left.value, y0: this._top.value,\n x1: this._right.value, y1: this._bottom.value,\n });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutCanvas.prototype, \"layout_bbox\", {\n get: function () {\n return {\n top: this._top.value,\n left: this._left.value,\n width: this._width.value,\n height: this._height.value,\n right: this._right.value,\n bottom: this._bottom.value,\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutCanvas.prototype, \"xview\", {\n get: function () {\n var _this = this;\n return {\n compute: function (x) {\n return _this._left.value + x;\n },\n v_compute: function (xx) {\n var _xx = new Float64Array(xx.length);\n var left = _this._left.value;\n for (var i = 0; i < xx.length; i++) {\n _xx[i] = left + xx[i];\n }\n return _xx;\n },\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(LayoutCanvas.prototype, \"yview\", {\n get: function () {\n var _this = this;\n return {\n compute: function (y) {\n return _this._bottom.value - y;\n },\n v_compute: function (yy) {\n var _yy = new Float64Array(yy.length);\n var bottom = _this._bottom.value;\n for (var i = 0; i < yy.length; i++) {\n _yy[i] = bottom - yy[i];\n }\n return _yy;\n },\n };\n },\n enumerable: true,\n configurable: true\n });\n return LayoutCanvas;\n }(has_props_1.HasProps));\n exports.LayoutCanvas = LayoutCanvas;\n LayoutCanvas.initClass();\n}\n","/* core/layout/side_panel */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var solver_1 = require(13) /* ./solver */;\n var layout_canvas_1 = require(11) /* ./layout_canvas */;\n var p = require(15) /* ../properties */;\n var logging_1 = require(14) /* ../logging */;\n var types_1 = require(44) /* ../util/types */;\n // This table lays out the rules for configuring the baseline, alignment, etc. of\n // title text, based on it's location and orientation\n //\n // side orient baseline align angle normal-dist\n // ------------------------------------------------------------------------------\n // above parallel bottom center 0 height\n // normal middle left -90 width\n // horizontal bottom center 0 height\n // [angle > 0] middle left width * sin + height * cos\n // [angle < 0] middle right width * sin + height * cos\n //\n // below parallel top center 0 height\n // normal middle right 90 width\n // horizontal top center 0 height\n // [angle > 0] middle right width * sin + height * cos\n // [angle < 0] middle left width * sin + height * cos\n //\n // left parallel bottom center 90 height\n // normal middle right 0 width\n // horizontal middle right 0 width\n // [angle > 0] middle right width * cos + height * sin\n // [angle < 0] middle right width * cos + height + sin\n //\n // right parallel bottom center -90 height\n // normal middle left 0 width\n // horizontal middle left 0 width\n // [angle > 0] middle left width * cos + height * sin\n // [angle < 0] middle left width * cos + height + sin\n var pi2 = Math.PI / 2;\n var ALPHABETIC = 'alphabetic';\n var TOP = 'top';\n var BOTTOM = 'bottom';\n var MIDDLE = 'middle';\n var HANGING = 'hanging';\n var LEFT = 'left';\n var RIGHT = 'right';\n var CENTER = 'center';\n var _angle_lookup = {\n above: {\n parallel: 0,\n normal: -pi2,\n horizontal: 0,\n vertical: -pi2,\n },\n below: {\n parallel: 0,\n normal: pi2,\n horizontal: 0,\n vertical: pi2,\n },\n left: {\n parallel: -pi2,\n normal: 0,\n horizontal: 0,\n vertical: -pi2,\n },\n right: {\n parallel: pi2,\n normal: 0,\n horizontal: 0,\n vertical: pi2,\n },\n };\n var _baseline_lookup = {\n above: {\n justified: TOP,\n parallel: ALPHABETIC,\n normal: MIDDLE,\n horizontal: ALPHABETIC,\n vertical: MIDDLE,\n },\n below: {\n justified: BOTTOM,\n parallel: HANGING,\n normal: MIDDLE,\n horizontal: HANGING,\n vertical: MIDDLE,\n },\n left: {\n justified: TOP,\n parallel: ALPHABETIC,\n normal: MIDDLE,\n horizontal: MIDDLE,\n vertical: ALPHABETIC,\n },\n right: {\n justified: TOP,\n parallel: ALPHABETIC,\n normal: MIDDLE,\n horizontal: MIDDLE,\n vertical: ALPHABETIC,\n },\n };\n var _align_lookup = {\n above: {\n justified: CENTER,\n parallel: CENTER,\n normal: LEFT,\n horizontal: CENTER,\n vertical: LEFT,\n },\n below: {\n justified: CENTER,\n parallel: CENTER,\n normal: LEFT,\n horizontal: CENTER,\n vertical: LEFT,\n },\n left: {\n justified: CENTER,\n parallel: CENTER,\n normal: RIGHT,\n horizontal: RIGHT,\n vertical: CENTER,\n },\n right: {\n justified: CENTER,\n parallel: CENTER,\n normal: LEFT,\n horizontal: LEFT,\n vertical: CENTER,\n },\n };\n var _align_lookup_negative = {\n above: RIGHT,\n below: LEFT,\n left: RIGHT,\n right: LEFT,\n };\n var _align_lookup_positive = {\n above: LEFT,\n below: RIGHT,\n left: RIGHT,\n right: LEFT,\n };\n function isSizeable(model) {\n return \"panel\" in model;\n }\n exports.isSizeable = isSizeable;\n function isSizeableView(view) {\n return isSizeable(view.model) && \"get_size\" in view;\n }\n exports.isSizeableView = isSizeableView;\n exports._view_sizes = new WeakMap();\n exports._view_constraints = new WeakMap();\n function update_panel_constraints(view) {\n var s = view.solver;\n var size = view.get_size();\n var constraint = exports._view_constraints.get(view);\n if (constraint != null && s.has_constraint(constraint)) {\n if (exports._view_sizes.get(view) === size)\n return;\n s.remove_constraint(constraint);\n }\n constraint = solver_1.GE(view.model.panel._size, -size);\n s.add_constraint(constraint);\n exports._view_sizes.set(view, size);\n exports._view_constraints.set(view, constraint);\n }\n exports.update_panel_constraints = update_panel_constraints;\n var SidePanel = /** @class */ (function (_super) {\n tslib_1.__extends(SidePanel, _super);\n function SidePanel(attrs) {\n return _super.call(this, attrs) || this;\n }\n SidePanel.initClass = function () {\n this.prototype.type = \"SidePanel\";\n this.internal({\n side: [p.String],\n });\n };\n SidePanel.prototype.toString = function () {\n return this.type + \"(\" + this.id + \", \" + this.side + \")\";\n };\n SidePanel.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n switch (this.side) {\n case \"above\":\n this._dim = 0;\n this._normals = [0, -1];\n this._size = this._height;\n break;\n case \"below\":\n this._dim = 0;\n this._normals = [0, 1];\n this._size = this._height;\n break;\n case \"left\":\n this._dim = 1;\n this._normals = [-1, 0];\n this._size = this._width;\n break;\n case \"right\":\n this._dim = 1;\n this._normals = [1, 0];\n this._size = this._width;\n break;\n default:\n logging_1.logger.error(\"unrecognized side: '\" + this.side + \"'\");\n }\n };\n Object.defineProperty(SidePanel.prototype, \"dimension\", {\n get: function () {\n return this._dim;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SidePanel.prototype, \"normals\", {\n get: function () {\n return this._normals;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SidePanel.prototype, \"is_horizontal\", {\n get: function () {\n return this.side == \"above\" || this.side == \"below\";\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SidePanel.prototype, \"is_vertical\", {\n get: function () {\n return this.side == \"left\" || this.side == \"right\";\n },\n enumerable: true,\n configurable: true\n });\n SidePanel.prototype.apply_label_text_heuristics = function (ctx, orient) {\n var side = this.side;\n var baseline;\n var align;\n if (types_1.isString(orient)) {\n baseline = _baseline_lookup[side][orient];\n align = _align_lookup[side][orient];\n }\n else {\n if (orient === 0) {\n baseline = \"whatever\"; // XXX: _baseline_lookup[side][orient]\n align = \"whatever\"; // XXX: _align_lookup[side][orient]\n }\n else if (orient < 0) {\n baseline = 'middle';\n align = _align_lookup_negative[side];\n }\n else {\n baseline = 'middle';\n align = _align_lookup_positive[side];\n }\n }\n ctx.textBaseline = baseline;\n ctx.textAlign = align;\n };\n SidePanel.prototype.get_label_angle_heuristic = function (orient) {\n return _angle_lookup[this.side][orient];\n };\n return SidePanel;\n }(layout_canvas_1.LayoutCanvas));\n exports.SidePanel = SidePanel;\n SidePanel.initClass();\n}\n","/* core/layout/solver */ function _(require, module, exports) {\n var kiwi_1 = require(350) /* kiwi */;\n exports.Variable = kiwi_1.Variable;\n exports.Expression = kiwi_1.Expression;\n exports.Constraint = kiwi_1.Constraint;\n exports.Operator = kiwi_1.Operator;\n exports.Strength = kiwi_1.Strength;\n function _constrainer(op) {\n return function () {\n var terms = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n terms[_i] = arguments[_i];\n }\n return new kiwi_1.Constraint(new (kiwi_1.Expression.bind.apply(kiwi_1.Expression, [void 0].concat(terms)))(), op);\n };\n }\n function _weak_constrainer(op) {\n return function () {\n var terms = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n terms[_i] = arguments[_i];\n }\n return new kiwi_1.Constraint(new (kiwi_1.Expression.bind.apply(kiwi_1.Expression, [void 0].concat(terms)))(), op, kiwi_1.Strength.weak);\n };\n }\n exports.EQ = _constrainer(kiwi_1.Operator.Eq);\n exports.LE = _constrainer(kiwi_1.Operator.Le);\n exports.GE = _constrainer(kiwi_1.Operator.Ge);\n exports.WEAK_EQ = _weak_constrainer(kiwi_1.Operator.Eq);\n exports.WEAK_LE = _weak_constrainer(kiwi_1.Operator.Le);\n exports.WEAK_GE = _weak_constrainer(kiwi_1.Operator.Ge);\n var Solver = /** @class */ (function () {\n function Solver() {\n this.solver = new kiwi_1.Solver();\n }\n Solver.prototype.clear = function () {\n this.solver = new kiwi_1.Solver();\n };\n Solver.prototype.toString = function () {\n return \"Solver(num_constraints=\" + this.num_constraints + \", num_editables=\" + this.num_editables + \")\";\n };\n Object.defineProperty(Solver.prototype, \"num_constraints\", {\n get: function () {\n return this.solver.numConstraints;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Solver.prototype, \"num_editables\", {\n get: function () {\n return this.solver.numEditVariables;\n },\n enumerable: true,\n configurable: true\n });\n Solver.prototype.get_constraints = function () {\n return this.solver.getConstraints();\n };\n Solver.prototype.update_variables = function () {\n this.solver.updateVariables();\n };\n Solver.prototype.has_constraint = function (constraint) {\n return this.solver.hasConstraint(constraint);\n };\n Solver.prototype.add_constraint = function (constraint) {\n try {\n this.solver.addConstraint(constraint);\n }\n catch (e) {\n throw new Error(e.message + \": \" + constraint.toString());\n }\n };\n Solver.prototype.remove_constraint = function (constraint) {\n this.solver.removeConstraint(constraint);\n };\n Solver.prototype.add_edit_variable = function (variable, strength) {\n this.solver.addEditVariable(variable, strength);\n };\n Solver.prototype.remove_edit_variable = function (variable) {\n this.solver.removeEditVariable(variable);\n };\n Solver.prototype.suggest_value = function (variable, value) {\n this.solver.suggestValue(variable, value);\n };\n return Solver;\n }());\n exports.Solver = Solver;\n}\n","/* core/logging */ function _(require, module, exports) {\n var types_1 = require(44) /* ./util/types */;\n var _loggers = {};\n var LogLevel = /** @class */ (function () {\n function LogLevel(name, level) {\n this.name = name;\n this.level = level;\n }\n return LogLevel;\n }());\n exports.LogLevel = LogLevel;\n var Logger = /** @class */ (function () {\n function Logger(name, level) {\n if (level === void 0) {\n level = Logger.INFO;\n }\n this._name = name;\n this.set_level(level);\n }\n Object.defineProperty(Logger, \"levels\", {\n get: function () {\n return Object.keys(Logger.log_levels);\n },\n enumerable: true,\n configurable: true\n });\n Logger.get = function (name, level) {\n if (level === void 0) {\n level = Logger.INFO;\n }\n if (name.length > 0) {\n var logger_1 = _loggers[name];\n if (logger_1 == null)\n _loggers[name] = logger_1 = new Logger(name, level);\n return logger_1;\n }\n else\n throw new TypeError(\"Logger.get() expects a non-empty string name and an optional log-level\");\n };\n Object.defineProperty(Logger.prototype, \"level\", {\n get: function () {\n return this.get_level();\n },\n enumerable: true,\n configurable: true\n });\n Logger.prototype.get_level = function () {\n return this._log_level;\n };\n Logger.prototype.set_level = function (log_level) {\n if (log_level instanceof LogLevel)\n this._log_level = log_level;\n else if (types_1.isString(log_level) && Logger.log_levels[log_level] != null)\n this._log_level = Logger.log_levels[log_level];\n else\n throw new Error(\"Logger.set_level() expects a log-level object or a string name of a log-level\");\n var logger_name = \"[\" + this._name + \"]\";\n for (var name_1 in Logger.log_levels) {\n var log_level_1 = Logger.log_levels[name_1];\n if (log_level_1.level < this._log_level.level || this._log_level.level === Logger.OFF.level)\n this[name_1] = function () { };\n else\n this[name_1] = _method_factory(name_1, logger_name);\n }\n };\n Logger.prototype.trace = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n Logger.prototype.debug = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n Logger.prototype.info = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n Logger.prototype.warn = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n Logger.prototype.error = function () {\n var _args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n _args[_i] = arguments[_i];\n }\n };\n Logger.TRACE = new LogLevel(\"trace\", 0);\n Logger.DEBUG = new LogLevel(\"debug\", 1);\n Logger.INFO = new LogLevel(\"info\", 2);\n Logger.WARN = new LogLevel(\"warn\", 6);\n Logger.ERROR = new LogLevel(\"error\", 7);\n Logger.FATAL = new LogLevel(\"fatal\", 8);\n Logger.OFF = new LogLevel(\"off\", 9);\n Logger.log_levels = {\n trace: Logger.TRACE,\n debug: Logger.DEBUG,\n info: Logger.INFO,\n warn: Logger.WARN,\n error: Logger.ERROR,\n fatal: Logger.FATAL,\n off: Logger.OFF,\n };\n return Logger;\n }());\n exports.Logger = Logger;\n function _method_factory(method_name, logger_name) {\n if (console[method_name] != null)\n return console[method_name].bind(console, logger_name);\n else if (console.log != null)\n return console.log.bind(console, logger_name);\n else\n return function () { };\n }\n exports.logger = Logger.get(\"bokeh\");\n function set_log_level(level) {\n if (Logger.log_levels[level] == null) {\n console.log(\"[bokeh] unrecognized logging level '\" + level + \"' passed to Bokeh.set_log_level(), ignoring\");\n console.log(\"[bokeh] valid log levels are: \" + Logger.levels.join(', '));\n }\n else {\n console.log(\"[bokeh] setting log level to: '\" + level + \"'\");\n exports.logger.set_level(level);\n }\n }\n exports.set_log_level = set_log_level;\n}\n","/* core/properties */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var signaling_1 = require(19) /* ./signaling */;\n var enums = require(7) /* ./enums */;\n var svg_colors_1 = require(39) /* ./util/svg_colors */;\n var color_1 = require(27) /* ./util/color */;\n var array_1 = require(21) /* ./util/array */;\n var arrayable_1 = require(22) /* ./util/arrayable */;\n var types_1 = require(44) /* ./util/types */;\n signaling_1.Signal; // XXX: silence TS, because `Signal` appears in declarations due to Signalable\n function valueToString(value) {\n try {\n return JSON.stringify(value);\n }\n catch (_a) {\n return value.toString();\n }\n }\n function isSpec(obj) {\n return types_1.isPlainObject(obj) &&\n ((obj.value === undefined ? 0 : 1) +\n (obj.field === undefined ? 0 : 1) +\n (obj.expr === undefined ? 0 : 1) == 1); // garbage JS XOR\n }\n exports.isSpec = isSpec;\n //\n // Property base class\n //\n var Property = /** @class */ (function (_super) {\n tslib_1.__extends(Property, _super);\n function Property(obj, attr, default_value) {\n var _this = _super.call(this) || this;\n _this.obj = obj;\n _this.attr = attr;\n _this.default_value = default_value;\n _this.optional = false;\n _this.obj = obj;\n _this.attr = attr;\n _this.default_value = default_value;\n _this.change = new signaling_1.Signal0(_this.obj, \"change\");\n _this._init();\n _this.connect(_this.change, function () { return _this._init(); });\n return _this;\n }\n Property.prototype.update = function () {\n this._init();\n };\n // ----- customizable policies\n Property.prototype.init = function () { };\n Property.prototype.transform = function (values) {\n return values;\n };\n Property.prototype.validate = function (_value) { };\n // ----- property accessors\n Property.prototype.value = function (do_spec_transform) {\n if (do_spec_transform === void 0) {\n do_spec_transform = true;\n }\n if (this.spec.value === undefined)\n throw new Error(\"attempted to retrieve property value for property without value specification\");\n var ret = this.transform([this.spec.value])[0];\n if (this.spec.transform != null && do_spec_transform)\n ret = this.spec.transform.compute(ret);\n return ret;\n };\n Property.prototype.array = function (source) {\n if (!this.dataspec)\n throw new Error(\"attempted to retrieve property array for non-dataspec property\");\n var ret;\n if (this.spec.field != null) {\n ret = this.transform(source.get_column(this.spec.field));\n if (ret == null)\n throw new Error(\"attempted to retrieve property array for nonexistent field '\" + this.spec.field + \"'\");\n }\n else if (this.spec.expr != null) {\n ret = this.transform(this.spec.expr.v_compute(source));\n }\n else {\n var length_1 = source.get_length();\n if (length_1 == null)\n length_1 = 1;\n var value = this.value(false); // don't apply any spec transform\n ret = array_1.repeat(value, length_1);\n }\n if (this.spec.transform != null)\n ret = this.spec.transform.v_compute(ret);\n return ret;\n };\n // ----- private methods\n /*protected*/ Property.prototype._init = function () {\n var _a;\n var obj = this.obj;\n var attr = this.attr;\n var attr_value = obj.getv(attr);\n if (attr_value === undefined) {\n var default_value = this.default_value;\n if (default_value !== undefined)\n attr_value = default_value(obj);\n else\n attr_value = null;\n obj.setv((_a = {}, _a[attr] = attr_value, _a), { silent: true, defaults: true });\n }\n if (types_1.isArray(attr_value))\n this.spec = { value: attr_value };\n else if (isSpec(attr_value))\n this.spec = attr_value;\n else\n this.spec = { value: attr_value };\n if (this.dataspec && this.spec.field != null && !types_1.isString(this.spec.field))\n throw new Error(\"field value for property '\" + attr + \"' is not a string\");\n if (this.spec.value != null)\n this.validate(this.spec.value);\n this.init();\n };\n Property.prototype.toString = function () {\n /*${this.name}*/\n return \"Prop(\" + this.obj + \".\" + this.attr + \", spec: \" + valueToString(this.spec) + \")\";\n };\n return Property;\n }(signaling_1.Signalable()));\n exports.Property = Property;\n Property.prototype.dataspec = false;\n //\n // Simple Properties\n //\n function simple_prop(name, pred) {\n return /** @class */ (function (_super) {\n tslib_1.__extends(class_1, _super);\n function class_1() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n class_1.prototype.validate = function (value) {\n if (!pred(value))\n throw new Error(name + \" property '\" + this.attr + \"' given invalid value: \" + valueToString(value));\n };\n return class_1;\n }(Property));\n }\n exports.simple_prop = simple_prop;\n var Any = /** @class */ (function (_super) {\n tslib_1.__extends(Any, _super);\n function Any() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Any;\n }(simple_prop(\"Any\", function (_x) { return true; })));\n exports.Any = Any;\n var Array = /** @class */ (function (_super) {\n tslib_1.__extends(Array, _super);\n function Array() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Array;\n }(simple_prop(\"Array\", function (x) { return types_1.isArray(x) || x instanceof Float64Array; })));\n exports.Array = Array;\n var Bool = /** @class */ (function (_super) {\n tslib_1.__extends(Bool, _super);\n function Bool() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Bool;\n }(simple_prop(\"Bool\", types_1.isBoolean)));\n exports.Bool = Bool;\n exports.Boolean = Bool;\n var Color = /** @class */ (function (_super) {\n tslib_1.__extends(Color, _super);\n function Color() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Color;\n }(simple_prop(\"Color\", function (x) { return (types_1.isString(x) && (svg_colors_1.is_svg_color(x.toLowerCase()) || x.substring(0, 1) == \"#\" || color_1.valid_rgb(x))); })));\n exports.Color = Color;\n var Instance = /** @class */ (function (_super) {\n tslib_1.__extends(Instance, _super);\n function Instance() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Instance;\n }(simple_prop(\"Instance\", function (x) { return x.properties != null; })));\n exports.Instance = Instance;\n // TODO (bev) separate booleans?\n var Number = /** @class */ (function (_super) {\n tslib_1.__extends(Number, _super);\n function Number() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Number;\n }(simple_prop(\"Number\", function (x) { return types_1.isNumber(x) || types_1.isBoolean(x); })));\n exports.Number = Number;\n exports.Int = Number;\n var Angle = /** @class */ (function (_super) {\n tslib_1.__extends(Angle, _super);\n function Angle() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Angle;\n }(Number));\n exports.Angle = Angle;\n // TODO extend Number instead of copying it's predicate\n //class Percent extends Number(\"Percent\", (x) -> 0 <= x <= 1.0)\n var Percent = /** @class */ (function (_super) {\n tslib_1.__extends(Percent, _super);\n function Percent() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Percent;\n }(simple_prop(\"Number\", function (x) { return (types_1.isNumber(x) || types_1.isBoolean(x)) && 0 <= x && x <= 1.0; })));\n exports.Percent = Percent;\n var String = /** @class */ (function (_super) {\n tslib_1.__extends(String, _super);\n function String() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return String;\n }(simple_prop(\"String\", types_1.isString)));\n exports.String = String;\n exports.FontSize = String;\n // TODO (bev) don't think this exists python side\n var Font = /** @class */ (function (_super) {\n tslib_1.__extends(Font, _super);\n function Font() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Font;\n }(String));\n exports.Font = Font;\n //\n // Enum properties\n //\n function enum_prop(name, enum_values) {\n return /** @class */ (function (_super) {\n tslib_1.__extends(class_2, _super);\n function class_2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return class_2;\n }(simple_prop(name, function (x) { return array_1.includes(enum_values, x); })));\n }\n exports.enum_prop = enum_prop;\n var Anchor = /** @class */ (function (_super) {\n tslib_1.__extends(Anchor, _super);\n function Anchor() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Anchor;\n }(enum_prop(\"Anchor\", enums.LegendLocation)));\n exports.Anchor = Anchor;\n var AngleUnits = /** @class */ (function (_super) {\n tslib_1.__extends(AngleUnits, _super);\n function AngleUnits() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return AngleUnits;\n }(enum_prop(\"AngleUnits\", enums.AngleUnits)));\n exports.AngleUnits = AngleUnits;\n var Direction = /** @class */ (function (_super) {\n tslib_1.__extends(Direction, _super);\n function Direction() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Direction.prototype.transform = function (values) {\n var result = new Uint8Array(values.length);\n for (var i = 0; i < values.length; i++) {\n switch (values[i]) {\n case \"clock\":\n result[i] = 0;\n break;\n case \"anticlock\":\n result[i] = 1;\n break;\n }\n }\n return result;\n };\n return Direction;\n }(enum_prop(\"Direction\", enums.Direction)));\n exports.Direction = Direction;\n var Dimension = /** @class */ (function (_super) {\n tslib_1.__extends(Dimension, _super);\n function Dimension() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Dimension;\n }(enum_prop(\"Dimension\", enums.Dimension)));\n exports.Dimension = Dimension;\n var Dimensions = /** @class */ (function (_super) {\n tslib_1.__extends(Dimensions, _super);\n function Dimensions() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Dimensions;\n }(enum_prop(\"Dimensions\", enums.Dimensions)));\n exports.Dimensions = Dimensions;\n var FontStyle = /** @class */ (function (_super) {\n tslib_1.__extends(FontStyle, _super);\n function FontStyle() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return FontStyle;\n }(enum_prop(\"FontStyle\", enums.FontStyle)));\n exports.FontStyle = FontStyle;\n var LatLon = /** @class */ (function (_super) {\n tslib_1.__extends(LatLon, _super);\n function LatLon() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LatLon;\n }(enum_prop(\"LatLon\", enums.LatLon)));\n exports.LatLon = LatLon;\n var LineCap = /** @class */ (function (_super) {\n tslib_1.__extends(LineCap, _super);\n function LineCap() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LineCap;\n }(enum_prop(\"LineCap\", enums.LineCap)));\n exports.LineCap = LineCap;\n var LineJoin = /** @class */ (function (_super) {\n tslib_1.__extends(LineJoin, _super);\n function LineJoin() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LineJoin;\n }(enum_prop(\"LineJoin\", enums.LineJoin)));\n exports.LineJoin = LineJoin;\n var LegendLocation = /** @class */ (function (_super) {\n tslib_1.__extends(LegendLocation, _super);\n function LegendLocation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LegendLocation;\n }(enum_prop(\"LegendLocation\", enums.LegendLocation)));\n exports.LegendLocation = LegendLocation;\n var Location = /** @class */ (function (_super) {\n tslib_1.__extends(Location, _super);\n function Location() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Location;\n }(enum_prop(\"Location\", enums.Location)));\n exports.Location = Location;\n var OutputBackend = /** @class */ (function (_super) {\n tslib_1.__extends(OutputBackend, _super);\n function OutputBackend() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return OutputBackend;\n }(enum_prop(\"OutputBackend\", enums.OutputBackend)));\n exports.OutputBackend = OutputBackend;\n var Orientation = /** @class */ (function (_super) {\n tslib_1.__extends(Orientation, _super);\n function Orientation() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Orientation;\n }(enum_prop(\"Orientation\", enums.Orientation)));\n exports.Orientation = Orientation;\n var VerticalAlign = /** @class */ (function (_super) {\n tslib_1.__extends(VerticalAlign, _super);\n function VerticalAlign() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return VerticalAlign;\n }(enum_prop(\"VerticalAlign\", enums.VerticalAlign)));\n exports.VerticalAlign = VerticalAlign;\n var TextAlign = /** @class */ (function (_super) {\n tslib_1.__extends(TextAlign, _super);\n function TextAlign() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return TextAlign;\n }(enum_prop(\"TextAlign\", enums.TextAlign)));\n exports.TextAlign = TextAlign;\n var TextBaseline = /** @class */ (function (_super) {\n tslib_1.__extends(TextBaseline, _super);\n function TextBaseline() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return TextBaseline;\n }(enum_prop(\"TextBaseline\", enums.TextBaseline)));\n exports.TextBaseline = TextBaseline;\n var RenderLevel = /** @class */ (function (_super) {\n tslib_1.__extends(RenderLevel, _super);\n function RenderLevel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return RenderLevel;\n }(enum_prop(\"RenderLevel\", enums.RenderLevel)));\n exports.RenderLevel = RenderLevel;\n var RenderMode = /** @class */ (function (_super) {\n tslib_1.__extends(RenderMode, _super);\n function RenderMode() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return RenderMode;\n }(enum_prop(\"RenderMode\", enums.RenderMode)));\n exports.RenderMode = RenderMode;\n var SizingMode = /** @class */ (function (_super) {\n tslib_1.__extends(SizingMode, _super);\n function SizingMode() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return SizingMode;\n }(enum_prop(\"SizingMode\", enums.SizingMode)));\n exports.SizingMode = SizingMode;\n var SpatialUnits = /** @class */ (function (_super) {\n tslib_1.__extends(SpatialUnits, _super);\n function SpatialUnits() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return SpatialUnits;\n }(enum_prop(\"SpatialUnits\", enums.SpatialUnits)));\n exports.SpatialUnits = SpatialUnits;\n var Distribution = /** @class */ (function (_super) {\n tslib_1.__extends(Distribution, _super);\n function Distribution() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return Distribution;\n }(enum_prop(\"Distribution\", enums.Distribution)));\n exports.Distribution = Distribution;\n var StepMode = /** @class */ (function (_super) {\n tslib_1.__extends(StepMode, _super);\n function StepMode() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return StepMode;\n }(enum_prop(\"StepMode\", enums.StepMode)));\n exports.StepMode = StepMode;\n var PaddingUnits = /** @class */ (function (_super) {\n tslib_1.__extends(PaddingUnits, _super);\n function PaddingUnits() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return PaddingUnits;\n }(enum_prop(\"PaddingUnits\", enums.PaddingUnits)));\n exports.PaddingUnits = PaddingUnits;\n var StartEnd = /** @class */ (function (_super) {\n tslib_1.__extends(StartEnd, _super);\n function StartEnd() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return StartEnd;\n }(enum_prop(\"StartEnd\", enums.StartEnd)));\n exports.StartEnd = StartEnd;\n //\n // Units Properties\n //\n function units_prop(name, valid_units, default_units) {\n return /** @class */ (function (_super) {\n tslib_1.__extends(class_3, _super);\n function class_3() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n class_3.prototype.init = function () {\n if (this.spec.units == null)\n this.spec.units = default_units;\n var units = this.spec.units;\n if (!array_1.includes(valid_units, units))\n throw new Error(name + \" units must be one of \" + valid_units + \", given invalid value: \" + units);\n };\n Object.defineProperty(class_3.prototype, \"units\", {\n get: function () {\n return this.spec.units;\n },\n set: function (units) {\n this.spec.units = units;\n },\n enumerable: true,\n configurable: true\n });\n return class_3;\n }(Number));\n }\n exports.units_prop = units_prop;\n //\n // DataSpec properties\n //\n var AngleSpec = /** @class */ (function (_super) {\n tslib_1.__extends(AngleSpec, _super);\n function AngleSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AngleSpec.prototype.transform = function (values) {\n if (this.spec.units == \"deg\")\n values = arrayable_1.map(values, function (x) { return x * Math.PI / 180.0; });\n values = arrayable_1.map(values, function (x) { return -x; });\n return _super.prototype.transform.call(this, values);\n };\n return AngleSpec;\n }(units_prop(\"AngleSpec\", enums.AngleUnits, \"rad\")));\n exports.AngleSpec = AngleSpec;\n AngleSpec.prototype.dataspec = true;\n var ColorSpec = /** @class */ (function (_super) {\n tslib_1.__extends(ColorSpec, _super);\n function ColorSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return ColorSpec;\n }(Color));\n exports.ColorSpec = ColorSpec;\n ColorSpec.prototype.dataspec = true;\n var DistanceSpec = /** @class */ (function (_super) {\n tslib_1.__extends(DistanceSpec, _super);\n function DistanceSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return DistanceSpec;\n }(units_prop(\"DistanceSpec\", enums.SpatialUnits, \"data\")));\n exports.DistanceSpec = DistanceSpec;\n DistanceSpec.prototype.dataspec = true;\n var FontSizeSpec = /** @class */ (function (_super) {\n tslib_1.__extends(FontSizeSpec, _super);\n function FontSizeSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return FontSizeSpec;\n }(String));\n exports.FontSizeSpec = FontSizeSpec;\n FontSizeSpec.prototype.dataspec = true;\n var MarkerSpec = /** @class */ (function (_super) {\n tslib_1.__extends(MarkerSpec, _super);\n function MarkerSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return MarkerSpec;\n }(String));\n exports.MarkerSpec = MarkerSpec;\n MarkerSpec.prototype.dataspec = true;\n var NumberSpec = /** @class */ (function (_super) {\n tslib_1.__extends(NumberSpec, _super);\n function NumberSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return NumberSpec;\n }(Number));\n exports.NumberSpec = NumberSpec;\n NumberSpec.prototype.dataspec = true;\n var StringSpec = /** @class */ (function (_super) {\n tslib_1.__extends(StringSpec, _super);\n function StringSpec() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return StringSpec;\n }(String));\n exports.StringSpec = StringSpec;\n StringSpec.prototype.dataspec = true;\n}\n","/* core/property_mixins */ function _(require, module, exports) {\n var p = require(15) /* ./properties */;\n var object_1 = require(32) /* ./util/object */;\n function _gen_mixin(mixin, prefix) {\n var result = {};\n for (var name_1 in mixin) {\n var prop = mixin[name_1];\n result[prefix + name_1] = prop;\n }\n return result;\n }\n var _line_mixin = {\n line_color: [p.ColorSpec, 'black'],\n line_width: [p.NumberSpec, 1],\n line_alpha: [p.NumberSpec, 1.0],\n line_join: [p.LineJoin, 'bevel'],\n line_cap: [p.LineCap, 'butt'],\n line_dash: [p.Array, []],\n line_dash_offset: [p.Number, 0],\n };\n exports.line = function (prefix) {\n if (prefix === void 0) {\n prefix = \"\";\n }\n return _gen_mixin(_line_mixin, prefix);\n };\n var _fill_mixin = {\n fill_color: [p.ColorSpec, 'gray'],\n fill_alpha: [p.NumberSpec, 1.0],\n };\n exports.fill = function (prefix) {\n if (prefix === void 0) {\n prefix = \"\";\n }\n return _gen_mixin(_fill_mixin, prefix);\n };\n var _text_mixin = {\n text_font: [p.Font, 'helvetica'],\n text_font_size: [p.FontSizeSpec, '12pt'],\n text_font_style: [p.FontStyle, 'normal'],\n text_color: [p.ColorSpec, '#444444'],\n text_alpha: [p.NumberSpec, 1.0],\n text_align: [p.TextAlign, 'left'],\n text_baseline: [p.TextBaseline, 'bottom'],\n text_line_height: [p.Number, 1.2],\n };\n exports.text = function (prefix) {\n if (prefix === void 0) {\n prefix = \"\";\n }\n return _gen_mixin(_text_mixin, prefix);\n };\n function create(configs) {\n var result = {};\n for (var _i = 0, configs_1 = configs; _i < configs_1.length; _i++) {\n var config = configs_1[_i];\n var _a = config.split(\":\"), kind = _a[0], prefix = _a[1];\n var mixin = void 0;\n switch (kind) {\n case \"line\":\n mixin = exports.line;\n break;\n case \"fill\":\n mixin = exports.fill;\n break;\n case \"text\":\n mixin = exports.text;\n break;\n default:\n throw new Error(\"Unknown property mixin kind '\" + kind + \"'\");\n }\n object_1.extend(result, mixin(prefix));\n }\n return result;\n }\n exports.create = create;\n}\n","/* core/selection_manager */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var has_props_1 = require(8) /* ./has_props */;\n var selection_1 = require(197) /* models/selections/selection */;\n var glyph_renderer_1 = require(185) /* models/renderers/glyph_renderer */;\n var graph_renderer_1 = require(186) /* models/renderers/graph_renderer */;\n var p = require(15) /* ./properties */;\n var SelectionManager = /** @class */ (function (_super) {\n tslib_1.__extends(SelectionManager, _super);\n function SelectionManager() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SelectionManager.initClass = function () {\n this.prototype.type = \"SelectionManager\";\n this.internal({\n source: [p.Any],\n });\n };\n SelectionManager.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.inspectors = {};\n };\n SelectionManager.prototype.select = function (renderer_views, geometry, final, append) {\n if (append === void 0) {\n append = false;\n }\n // divide renderers into glyph_renderers or graph_renderers\n var glyph_renderer_views = [];\n var graph_renderer_views = [];\n for (var _i = 0, renderer_views_1 = renderer_views; _i < renderer_views_1.length; _i++) {\n var r = renderer_views_1[_i];\n if (r instanceof glyph_renderer_1.GlyphRendererView)\n glyph_renderer_views.push(r);\n else if (r instanceof graph_renderer_1.GraphRendererView)\n graph_renderer_views.push(r);\n }\n var did_hit = false;\n // graph renderer case\n for (var _a = 0, graph_renderer_views_1 = graph_renderer_views; _a < graph_renderer_views_1.length; _a++) {\n var r = graph_renderer_views_1[_a];\n var hit_test_result = r.model.selection_policy.hit_test(geometry, r);\n did_hit = did_hit || r.model.selection_policy.do_selection(hit_test_result, r.model, final, append);\n }\n // glyph renderers\n if (glyph_renderer_views.length > 0) {\n var hit_test_result = this.source.selection_policy.hit_test(geometry, glyph_renderer_views);\n did_hit = did_hit || this.source.selection_policy.do_selection(hit_test_result, this.source, final, append);\n }\n return did_hit;\n };\n SelectionManager.prototype.inspect = function (renderer_view, geometry) {\n var did_hit = false;\n if (renderer_view instanceof glyph_renderer_1.GlyphRendererView) {\n var hit_test_result = renderer_view.hit_test(geometry);\n if (hit_test_result != null) {\n did_hit = !hit_test_result.is_empty();\n var inspection = this.get_or_create_inspector(renderer_view.model);\n inspection.update(hit_test_result, true, false);\n this.source.setv({ inspected: inspection }, { silent: true });\n this.source.inspect.emit([renderer_view, { geometry: geometry }]);\n }\n }\n else if (renderer_view instanceof graph_renderer_1.GraphRendererView) {\n var hit_test_result = renderer_view.model.inspection_policy.hit_test(geometry, renderer_view);\n did_hit = did_hit || renderer_view.model.inspection_policy.do_inspection(hit_test_result, geometry, renderer_view, false, false);\n }\n return did_hit;\n };\n SelectionManager.prototype.clear = function (rview) {\n this.source.selected.clear();\n if (rview != null)\n this.get_or_create_inspector(rview.model).clear();\n };\n SelectionManager.prototype.get_or_create_inspector = function (rmodel) {\n if (this.inspectors[rmodel.id] == null)\n this.inspectors[rmodel.id] = new selection_1.Selection();\n return this.inspectors[rmodel.id];\n };\n return SelectionManager;\n }(has_props_1.HasProps));\n exports.SelectionManager = SelectionManager;\n SelectionManager.initClass();\n}\n","/* core/settings */ function _(require, module, exports) {\n var Settings = /** @class */ (function () {\n function Settings() {\n this._dev = false;\n }\n Object.defineProperty(Settings.prototype, \"dev\", {\n get: function () {\n return this._dev;\n },\n set: function (dev) {\n this._dev = dev;\n },\n enumerable: true,\n configurable: true\n });\n return Settings;\n }());\n exports.Settings = Settings;\n exports.settings = new Settings();\n}\n","/* core/signaling */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var data_structures_1 = require(29) /* ./util/data_structures */;\n var callback_1 = require(25) /* ./util/callback */;\n var array_1 = require(21) /* ./util/array */;\n var Signal = /** @class */ (function () {\n function Signal(sender, name) {\n this.sender = sender;\n this.name = name;\n }\n Signal.prototype.connect = function (slot, context) {\n if (context === void 0) {\n context = null;\n }\n if (!receiversForSender.has(this.sender)) {\n receiversForSender.set(this.sender, []);\n }\n var receivers = receiversForSender.get(this.sender);\n if (findConnection(receivers, this, slot, context) != null) {\n return false;\n }\n var receiver = context || slot;\n if (!sendersForReceiver.has(receiver)) {\n sendersForReceiver.set(receiver, []);\n }\n var senders = sendersForReceiver.get(receiver);\n var connection = { signal: this, slot: slot, context: context };\n receivers.push(connection);\n senders.push(connection);\n return true;\n };\n Signal.prototype.disconnect = function (slot, context) {\n if (context === void 0) {\n context = null;\n }\n var receivers = receiversForSender.get(this.sender);\n if (receivers == null || receivers.length === 0) {\n return false;\n }\n var connection = findConnection(receivers, this, slot, context);\n if (connection == null) {\n return false;\n }\n var receiver = context || slot;\n var senders = sendersForReceiver.get(receiver);\n connection.signal = null;\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n return true;\n };\n Signal.prototype.emit = function (args) {\n var receivers = receiversForSender.get(this.sender) || [];\n for (var _i = 0, receivers_1 = receivers; _i < receivers_1.length; _i++) {\n var _a = receivers_1[_i], signal = _a.signal, slot = _a.slot, context = _a.context;\n if (signal === this) {\n slot.call(context, args, this.sender);\n }\n }\n };\n return Signal;\n }());\n exports.Signal = Signal;\n var Signal0 = /** @class */ (function (_super) {\n tslib_1.__extends(Signal0, _super);\n function Signal0() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Signal0.prototype.emit = function () {\n _super.prototype.emit.call(this, undefined);\n };\n return Signal0;\n }(Signal));\n exports.Signal0 = Signal0;\n (function (Signal) {\n function disconnectBetween(sender, receiver) {\n var receivers = receiversForSender.get(sender);\n if (receivers == null || receivers.length === 0)\n return;\n var senders = sendersForReceiver.get(receiver);\n if (senders == null || senders.length === 0)\n return;\n for (var _i = 0, senders_1 = senders; _i < senders_1.length; _i++) {\n var connection = senders_1[_i];\n if (connection.signal == null)\n return;\n if (connection.signal.sender === sender)\n connection.signal = null;\n }\n scheduleCleanup(receivers);\n scheduleCleanup(senders);\n }\n Signal.disconnectBetween = disconnectBetween;\n function disconnectSender(sender) {\n var receivers = receiversForSender.get(sender);\n if (receivers == null || receivers.length === 0)\n return;\n for (var _i = 0, receivers_2 = receivers; _i < receivers_2.length; _i++) {\n var connection = receivers_2[_i];\n if (connection.signal == null)\n return;\n var receiver = connection.context || connection.slot;\n connection.signal = null;\n scheduleCleanup(sendersForReceiver.get(receiver));\n }\n scheduleCleanup(receivers);\n }\n Signal.disconnectSender = disconnectSender;\n function disconnectReceiver(receiver) {\n var senders = sendersForReceiver.get(receiver);\n if (senders == null || senders.length === 0)\n return;\n for (var _i = 0, senders_2 = senders; _i < senders_2.length; _i++) {\n var connection = senders_2[_i];\n if (connection.signal == null)\n return;\n var sender = connection.signal.sender;\n connection.signal = null;\n scheduleCleanup(receiversForSender.get(sender));\n }\n scheduleCleanup(senders);\n }\n Signal.disconnectReceiver = disconnectReceiver;\n function disconnectAll(obj) {\n var receivers = receiversForSender.get(obj);\n if (receivers != null && receivers.length !== 0) {\n for (var _i = 0, receivers_3 = receivers; _i < receivers_3.length; _i++) {\n var connection = receivers_3[_i];\n connection.signal = null;\n }\n scheduleCleanup(receivers);\n }\n var senders = sendersForReceiver.get(obj);\n if (senders != null && senders.length !== 0) {\n for (var _a = 0, senders_3 = senders; _a < senders_3.length; _a++) {\n var connection = senders_3[_a];\n connection.signal = null;\n }\n scheduleCleanup(senders);\n }\n }\n Signal.disconnectAll = disconnectAll;\n })(Signal = exports.Signal || (exports.Signal = {}));\n exports.Signal = Signal;\n function Signalable(Base) {\n // XXX: `class Foo extends Signalable(Object)` doesn't work (compiles, but fails at runtime), so\n // we have to do this to allow signalable classes without an explict base class.\n if (Base != null) {\n return /** @class */ (function (_super) {\n tslib_1.__extends(class_1, _super);\n function class_1() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n class_1.prototype.connect = function (signal, slot) {\n return signal.connect(slot, this);\n };\n return class_1;\n }(Base));\n }\n else {\n return /** @class */ (function () {\n function class_2() {\n }\n class_2.prototype.connect = function (signal, slot) {\n return signal.connect(slot, this);\n };\n return class_2;\n }());\n }\n }\n exports.Signalable = Signalable;\n var _Signalable;\n (function (_Signalable) {\n function connect(signal, slot) {\n return signal.connect(slot, this);\n }\n _Signalable.connect = connect;\n })(_Signalable = exports._Signalable || (exports._Signalable = {}));\n var receiversForSender = new WeakMap();\n var sendersForReceiver = new WeakMap();\n function findConnection(conns, signal, slot, context) {\n return array_1.find(conns, function (conn) { return conn.signal === signal && conn.slot === slot && conn.context === context; });\n }\n var dirtySet = new data_structures_1.Set();\n function scheduleCleanup(connections) {\n if (dirtySet.size === 0) {\n callback_1.defer(cleanupDirtySet);\n }\n dirtySet.add(connections);\n }\n function cleanupDirtySet() {\n dirtySet.forEach(function (connections) {\n array_1.removeBy(connections, function (connection) { return connection.signal == null; });\n });\n dirtySet.clear();\n }\n}\n","/* core/ui_events */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var Hammer = require(347) /* hammerjs */;\n var signaling_1 = require(19) /* ./signaling */;\n var logging_1 = require(14) /* ./logging */;\n var dom_1 = require(5) /* ./dom */;\n var wheel_1 = require(45) /* ./util/wheel */;\n var array_1 = require(21) /* ./util/array */;\n var object_1 = require(32) /* ./util/object */;\n var types_1 = require(44) /* ./util/types */;\n var bokeh_events_1 = require(3) /* ./bokeh_events */;\n exports.is_mobile = 'ontouchstart' in window || navigator.maxTouchPoints > 0;\n var UIEvents = /** @class */ (function () {\n function UIEvents(plot_view, toolbar, hit_area, plot) {\n var _this = this;\n this.plot_view = plot_view;\n this.toolbar = toolbar;\n this.hit_area = hit_area;\n this.plot = plot;\n this.pan_start = new signaling_1.Signal(this, 'pan:start');\n this.pan = new signaling_1.Signal(this, 'pan');\n this.pan_end = new signaling_1.Signal(this, 'pan:end');\n this.pinch_start = new signaling_1.Signal(this, 'pinch:start');\n this.pinch = new signaling_1.Signal(this, 'pinch');\n this.pinch_end = new signaling_1.Signal(this, 'pinch:end');\n this.rotate_start = new signaling_1.Signal(this, 'rotate:start');\n this.rotate = new signaling_1.Signal(this, 'rotate');\n this.rotate_end = new signaling_1.Signal(this, 'rotate:end');\n this.tap = new signaling_1.Signal(this, 'tap');\n this.doubletap = new signaling_1.Signal(this, 'doubletap');\n this.press = new signaling_1.Signal(this, 'press');\n this.move_enter = new signaling_1.Signal(this, 'move:enter');\n this.move = new signaling_1.Signal(this, 'move');\n this.move_exit = new signaling_1.Signal(this, 'move:exit');\n this.scroll = new signaling_1.Signal(this, 'scroll');\n this.keydown = new signaling_1.Signal(this, 'keydown');\n this.keyup = new signaling_1.Signal(this, 'keyup');\n this.hammer = new Hammer(this.hit_area);\n this._configure_hammerjs();\n // Mouse & keyboard events not handled through hammerjs\n // We can 'add and forget' these event listeners because this.hit_area is a DOM element\n // that will be thrown away when the view is removed\n this.hit_area.addEventListener(\"mousemove\", function (e) { return _this._mouse_move(e); });\n this.hit_area.addEventListener(\"mouseenter\", function (e) { return _this._mouse_enter(e); });\n this.hit_area.addEventListener(\"mouseleave\", function (e) { return _this._mouse_exit(e); });\n this.hit_area.addEventListener(\"wheel\", function (e) { return _this._mouse_wheel(e); });\n // But we MUST remove listeners registered on document or we'll leak memory: register\n // 'this' as the listener (it implements the event listener interface, i.e. handleEvent)\n // instead of an anonymous function so we can easily refer back to it for removing\n document.addEventListener(\"keydown\", this);\n document.addEventListener(\"keyup\", this);\n }\n UIEvents.prototype.destroy = function () {\n this.hammer.destroy();\n document.removeEventListener(\"keydown\", this);\n document.removeEventListener(\"keyup\", this);\n };\n UIEvents.prototype.handleEvent = function (e) {\n if (e.type == \"keydown\")\n this._key_down(e);\n else if (e.type == \"keyup\")\n this._key_up(e);\n };\n UIEvents.prototype._configure_hammerjs = function () {\n var _this = this;\n // This is to be able to distinguish double taps from single taps\n this.hammer.get('doubletap').recognizeWith('tap');\n this.hammer.get('tap').requireFailure('doubletap');\n this.hammer.get('doubletap').dropRequireFailure('tap');\n this.hammer.on('doubletap', function (e) { return _this._doubletap(e); });\n this.hammer.on('tap', function (e) { return _this._tap(e); });\n this.hammer.on('press', function (e) { return _this._press(e); });\n this.hammer.get('pan').set({ direction: Hammer.DIRECTION_ALL });\n this.hammer.on('panstart', function (e) { return _this._pan_start(e); });\n this.hammer.on('pan', function (e) { return _this._pan(e); });\n this.hammer.on('panend', function (e) { return _this._pan_end(e); });\n this.hammer.get('pinch').set({ enable: true });\n this.hammer.on('pinchstart', function (e) { return _this._pinch_start(e); });\n this.hammer.on('pinch', function (e) { return _this._pinch(e); });\n this.hammer.on('pinchend', function (e) { return _this._pinch_end(e); });\n this.hammer.get('rotate').set({ enable: true });\n this.hammer.on('rotatestart', function (e) { return _this._rotate_start(e); });\n this.hammer.on('rotate', function (e) { return _this._rotate(e); });\n this.hammer.on('rotateend', function (e) { return _this._rotate_end(e); });\n };\n UIEvents.prototype.register_tool = function (tool_view) {\n var _this = this;\n var et = tool_view.model.event_type;\n if (et != null) {\n if (types_1.isString(et))\n this._register_tool(tool_view, et);\n else {\n // Multi-tools should only registered shared events once\n et.forEach(function (e, index) { return _this._register_tool(tool_view, e, index < 1); });\n }\n }\n };\n UIEvents.prototype._register_tool = function (tool_view, et, shared) {\n if (shared === void 0) {\n shared = true;\n }\n var v = tool_view;\n var id = v.model.id;\n var conditionally = function (fn) {\n return function (arg) {\n if (arg.id == id)\n fn(arg.e);\n };\n };\n var unconditionally = function (fn) {\n return function (arg) {\n fn(arg.e);\n };\n };\n switch (et) {\n case \"pan\": {\n if (v._pan_start != null)\n v.connect(this.pan_start, conditionally(v._pan_start.bind(v)));\n if (v._pan != null)\n v.connect(this.pan, conditionally(v._pan.bind(v)));\n if (v._pan_end != null)\n v.connect(this.pan_end, conditionally(v._pan_end.bind(v)));\n break;\n }\n case \"pinch\": {\n if (v._pinch_start != null)\n v.connect(this.pinch_start, conditionally(v._pinch_start.bind(v)));\n if (v._pinch != null)\n v.connect(this.pinch, conditionally(v._pinch.bind(v)));\n if (v._pinch_end != null)\n v.connect(this.pinch_end, conditionally(v._pinch_end.bind(v)));\n break;\n }\n case \"rotate\": {\n if (v._rotate_start != null)\n v.connect(this.rotate_start, conditionally(v._rotate_start.bind(v)));\n if (v._rotate != null)\n v.connect(this.rotate, conditionally(v._rotate.bind(v)));\n if (v._rotate_end != null)\n v.connect(this.rotate_end, conditionally(v._rotate_end.bind(v)));\n break;\n }\n case \"move\": {\n if (v._move_enter != null)\n v.connect(this.move_enter, conditionally(v._move_enter.bind(v)));\n if (v._move != null)\n v.connect(this.move, conditionally(v._move.bind(v)));\n if (v._move_exit != null)\n v.connect(this.move_exit, conditionally(v._move_exit.bind(v)));\n break;\n }\n case \"tap\": {\n if (v._tap != null)\n v.connect(this.tap, conditionally(v._tap.bind(v)));\n break;\n }\n case \"press\": {\n if (v._press != null)\n v.connect(this.press, conditionally(v._press.bind(v)));\n break;\n }\n case \"scroll\": {\n if (v._scroll != null)\n v.connect(this.scroll, conditionally(v._scroll.bind(v)));\n break;\n }\n default:\n throw new Error(\"unsupported event_type: \" + et);\n }\n // Skip shared events if registering multi-tool\n if (!shared)\n return;\n if (v._doubletap != null)\n v.connect(this.doubletap, unconditionally(v._doubletap.bind(v)));\n if (v._keydown != null)\n v.connect(this.keydown, unconditionally(v._keydown.bind(v)));\n if (v._keyup != null)\n v.connect(this.keyup, unconditionally(v._keyup.bind(v)));\n // Dual touch hack part 1/2\n // This is a hack for laptops with touch screen who may be pinching or scrolling\n // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event\n // will be linked to pinch. But we also want to trigger in the case of a scroll.\n if (exports.is_mobile && v._scroll != null && et == 'pinch') {\n logging_1.logger.debug(\"Registering scroll on touch screen\");\n v.connect(this.scroll, conditionally(v._scroll.bind(v)));\n }\n };\n UIEvents.prototype._hit_test_renderers = function (sx, sy) {\n var views = this.plot_view.get_renderer_views();\n for (var _i = 0, _a = array_1.reversed(views); _i < _a.length; _i++) {\n var view = _a[_i];\n var level = view.model.level;\n if ((level == 'annotation' || level == 'overlay') && view.interactive_hit != null) {\n if (view.interactive_hit(sx, sy))\n return view;\n }\n }\n return null;\n };\n UIEvents.prototype._hit_test_frame = function (sx, sy) {\n return this.plot_view.frame.bbox.contains(sx, sy);\n };\n UIEvents.prototype._hit_test_canvas = function (sx, sy) {\n return this.plot_view.canvas.bbox.contains(sx, sy);\n };\n UIEvents.prototype._trigger = function (signal, e, srcEvent) {\n var _this = this;\n var gestures = this.toolbar.gestures;\n var event_type = signal.name;\n var base_type = event_type.split(\":\")[0];\n var view = this._hit_test_renderers(e.sx, e.sy);\n var on_canvas = this._hit_test_canvas(e.sx, e.sy);\n switch (base_type) {\n case \"move\": {\n var active_gesture = gestures[base_type].active;\n if (active_gesture != null)\n this.trigger(signal, e, active_gesture.id);\n var active_inspectors = this.toolbar.inspectors.filter(function (t) { return t.active; });\n var cursor = \"default\";\n // the event happened on a renderer\n if (view != null) {\n cursor = view.cursor(e.sx, e.sy) || cursor;\n if (!object_1.isEmpty(active_inspectors)) {\n // override event_type to cause inspectors to clear overlays\n signal = this.move_exit;\n event_type = signal.name;\n }\n // the event happened on the plot frame but off a renderer\n }\n else if (this._hit_test_frame(e.sx, e.sy)) {\n if (!object_1.isEmpty(active_inspectors)) {\n cursor = \"crosshair\";\n }\n }\n this.plot_view.set_cursor(cursor);\n this.plot_view.set_toolbar_visibility(on_canvas);\n active_inspectors.map(function (inspector) { return _this.trigger(signal, e, inspector.id); });\n break;\n }\n case \"tap\": {\n var target = srcEvent.target;\n if (target != null && target != this.hit_area)\n return; // don't trigger bokeh events\n if (view != null && view.on_hit != null)\n view.on_hit(e.sx, e.sy);\n var active_gesture = gestures[base_type].active;\n if (active_gesture != null)\n this.trigger(signal, e, active_gesture.id);\n break;\n }\n case \"scroll\": {\n // Dual touch hack part 2/2\n // This is a hack for laptops with touch screen who may be pinching or scrolling\n // in order to use the wheel zoom tool. If it's a touch screen the WheelZoomTool event\n // will be linked to pinch. But we also want to trigger in the case of a scroll.\n var base = exports.is_mobile ? \"pinch\" : \"scroll\";\n var active_gesture = gestures[base].active;\n if (active_gesture != null) {\n srcEvent.preventDefault();\n srcEvent.stopPropagation();\n this.trigger(signal, e, active_gesture.id);\n }\n break;\n }\n default: {\n var active_gesture = gestures[base_type].active;\n if (active_gesture != null)\n this.trigger(signal, e, active_gesture.id);\n }\n }\n this._trigger_bokeh_event(e);\n };\n UIEvents.prototype.trigger = function (signal, e, id) {\n if (id === void 0) {\n id = null;\n }\n signal.emit({ id: id, e: e });\n };\n UIEvents.prototype._trigger_bokeh_event = function (e) {\n var event_cls = bokeh_events_1.BokehEvent.event_class(e);\n if (event_cls != null)\n this.plot.trigger_event(event_cls.from_event(e));\n else\n logging_1.logger.debug(\"Unhandled event of type \" + e.type);\n };\n UIEvents.prototype._get_sxy = function (event) {\n // XXX: jsdom doesn't support TouchEvent constructor\n function is_touch(event) {\n return typeof TouchEvent !== \"undefined\" && event instanceof TouchEvent;\n }\n var _a = is_touch(event) ? (event.touches.length != 0 ? event.touches : event.changedTouches)[0] : event, pageX = _a.pageX, pageY = _a.pageY;\n var _b = dom_1.offset(this.hit_area), left = _b.left, top = _b.top;\n return {\n sx: pageX - left,\n sy: pageY - top,\n };\n };\n UIEvents.prototype._gesture_event = function (e) {\n return tslib_1.__assign({ type: e.type }, this._get_sxy(e.srcEvent), { deltaX: e.deltaX, deltaY: e.deltaY, scale: e.scale, shiftKey: e.srcEvent.shiftKey });\n };\n UIEvents.prototype._tap_event = function (e) {\n return tslib_1.__assign({ type: e.type }, this._get_sxy(e.srcEvent), { shiftKey: e.srcEvent.shiftKey });\n };\n UIEvents.prototype._move_event = function (e) {\n return tslib_1.__assign({ type: e.type }, this._get_sxy(e));\n };\n UIEvents.prototype._scroll_event = function (e) {\n return tslib_1.__assign({ type: e.type }, this._get_sxy(e), { delta: wheel_1.getDeltaY(e) });\n };\n UIEvents.prototype._key_event = function (e) {\n return { type: e.type, keyCode: e.keyCode };\n };\n UIEvents.prototype._pan_start = function (e) {\n var ev = this._gesture_event(e);\n // back out delta to get original center point\n ev.sx -= e.deltaX;\n ev.sy -= e.deltaY;\n this._trigger(this.pan_start, ev, e.srcEvent);\n };\n UIEvents.prototype._pan = function (e) {\n this._trigger(this.pan, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._pan_end = function (e) {\n this._trigger(this.pan_end, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._pinch_start = function (e) {\n this._trigger(this.pinch_start, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._pinch = function (e) {\n this._trigger(this.pinch, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._pinch_end = function (e) {\n this._trigger(this.pinch_end, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._rotate_start = function (e) {\n this._trigger(this.rotate_start, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._rotate = function (e) {\n this._trigger(this.rotate, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._rotate_end = function (e) {\n this._trigger(this.rotate_end, this._gesture_event(e), e.srcEvent);\n };\n UIEvents.prototype._tap = function (e) {\n this._trigger(this.tap, this._tap_event(e), e.srcEvent);\n };\n UIEvents.prototype._doubletap = function (e) {\n // NOTE: doubletap event triggered unconditionally\n var ev = this._tap_event(e);\n this._trigger_bokeh_event(ev);\n this.trigger(this.doubletap, ev);\n };\n UIEvents.prototype._press = function (e) {\n this._trigger(this.press, this._tap_event(e), e.srcEvent);\n };\n UIEvents.prototype._mouse_enter = function (e) {\n this._trigger(this.move_enter, this._move_event(e), e);\n };\n UIEvents.prototype._mouse_move = function (e) {\n this._trigger(this.move, this._move_event(e), e);\n };\n UIEvents.prototype._mouse_exit = function (e) {\n this._trigger(this.move_exit, this._move_event(e), e);\n };\n UIEvents.prototype._mouse_wheel = function (e) {\n this._trigger(this.scroll, this._scroll_event(e), e);\n };\n UIEvents.prototype._key_down = function (e) {\n // NOTE: keyup event triggered unconditionally\n this.trigger(this.keydown, this._key_event(e));\n };\n UIEvents.prototype._key_up = function (e) {\n // NOTE: keyup event triggered unconditionally\n this.trigger(this.keyup, this._key_event(e));\n };\n return UIEvents;\n }());\n exports.UIEvents = UIEvents;\n}\n","/* core/util/array */ function _(require, module, exports) {\n var math_1 = require(31) /* ./math */;\n var assert_1 = require(23) /* ./assert */;\n var arrayable_1 = require(22) /* ./arrayable */;\n exports.min = arrayable_1.min;\n exports.minBy = arrayable_1.minBy;\n exports.max = arrayable_1.max;\n exports.maxBy = arrayable_1.maxBy;\n exports.sum = arrayable_1.sum;\n var slice = Array.prototype.slice;\n function head(array) {\n return array[0];\n }\n exports.head = head;\n function tail(array) {\n return array[array.length - 1];\n }\n exports.tail = tail;\n function last(array) {\n return array[array.length - 1];\n }\n exports.last = last;\n function copy(array) {\n return slice.call(array);\n }\n exports.copy = copy;\n function concat(arrays) {\n var _a;\n return (_a = []).concat.apply(_a, arrays);\n }\n exports.concat = concat;\n function includes(array, value) {\n return array.indexOf(value) !== -1;\n }\n exports.includes = includes;\n exports.contains = includes;\n function nth(array, index) {\n return array[index >= 0 ? index : array.length + index];\n }\n exports.nth = nth;\n function zip(As, Bs) {\n var n = Math.min(As.length, Bs.length);\n var ABs = new Array(n);\n for (var i = 0; i < n; i++) {\n ABs[i] = [As[i], Bs[i]];\n }\n return ABs;\n }\n exports.zip = zip;\n function unzip(ABs) {\n var _a;\n var n = ABs.length;\n var As = new Array(n);\n var Bs = new Array(n);\n for (var i = 0; i < n; i++) {\n _a = ABs[i], As[i] = _a[0], Bs[i] = _a[1];\n }\n return [As, Bs];\n }\n exports.unzip = unzip;\n function range(start, stop, step) {\n if (step === void 0) {\n step = 1;\n }\n assert_1.assert(step > 0, \"'step' must be a positive number\");\n if (stop == null) {\n stop = start;\n start = 0;\n }\n var max = Math.max, ceil = Math.ceil, abs = Math.abs;\n var delta = start <= stop ? step : -step;\n var length = max(ceil(abs(stop - start) / step), 0);\n var range = Array(length);\n for (var i = 0; i < length; i++, start += delta) {\n range[i] = start;\n }\n return range;\n }\n exports.range = range;\n function linspace(start, stop, num) {\n if (num === void 0) {\n num = 100;\n }\n var step = (stop - start) / (num - 1);\n var array = new Array(num);\n for (var i = 0; i < num; i++) {\n array[i] = start + step * i;\n }\n return array;\n }\n exports.linspace = linspace;\n function transpose(array) {\n var rows = array.length;\n var cols = array[0].length;\n var transposed = [];\n for (var j = 0; j < cols; j++) {\n transposed[j] = [];\n for (var i = 0; i < rows; i++) {\n transposed[j][i] = array[i][j];\n }\n }\n return transposed;\n }\n exports.transpose = transpose;\n function cumsum(array) {\n var result = [];\n array.reduce(function (a, b, i) { return result[i] = a + b; }, 0);\n return result;\n }\n exports.cumsum = cumsum;\n function argmin(array) {\n return arrayable_1.minBy(range(array.length), function (i) { return array[i]; });\n }\n exports.argmin = argmin;\n function argmax(array) {\n return arrayable_1.maxBy(range(array.length), function (i) { return array[i]; });\n }\n exports.argmax = argmax;\n function all(array, predicate) {\n for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {\n var item = array_1[_i];\n if (!predicate(item))\n return false;\n }\n return true;\n }\n exports.all = all;\n function any(array, predicate) {\n for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {\n var item = array_2[_i];\n if (predicate(item))\n return true;\n }\n return false;\n }\n exports.any = any;\n function findIndexFactory(dir) {\n return function (array, predicate) {\n var length = array.length;\n var index = dir > 0 ? 0 : length - 1;\n for (; index >= 0 && index < length; index += dir) {\n if (predicate(array[index]))\n return index;\n }\n return -1;\n };\n }\n exports.findIndex = findIndexFactory(1);\n exports.findLastIndex = findIndexFactory(-1);\n function find(array, predicate) {\n var index = exports.findIndex(array, predicate);\n return index == -1 ? undefined : array[index];\n }\n exports.find = find;\n function findLast(array, predicate) {\n var index = exports.findLastIndex(array, predicate);\n return index == -1 ? undefined : array[index];\n }\n exports.findLast = findLast;\n function sortedIndex(array, value) {\n var low = 0;\n var high = array.length;\n while (low < high) {\n var mid = Math.floor((low + high) / 2);\n if (array[mid] < value)\n low = mid + 1;\n else\n high = mid;\n }\n return low;\n }\n exports.sortedIndex = sortedIndex;\n function sortBy(array, key) {\n var tmp = array.map(function (value, index) {\n return { value: value, index: index, key: key(value) };\n });\n tmp.sort(function (left, right) {\n var a = left.key;\n var b = right.key;\n if (a !== b) {\n if (a > b || a === undefined)\n return 1;\n if (a < b || b === undefined)\n return -1;\n }\n return left.index - right.index;\n });\n return tmp.map(function (item) { return item.value; });\n }\n exports.sortBy = sortBy;\n function uniq(array) {\n var result = [];\n for (var _i = 0, array_3 = array; _i < array_3.length; _i++) {\n var value = array_3[_i];\n if (!includes(result, value)) {\n result.push(value);\n }\n }\n return result;\n }\n exports.uniq = uniq;\n function uniqBy(array, key) {\n var result = [];\n var seen = [];\n for (var _i = 0, array_4 = array; _i < array_4.length; _i++) {\n var value = array_4[_i];\n var computed = key(value);\n if (!includes(seen, computed)) {\n seen.push(computed);\n result.push(value);\n }\n }\n return result;\n }\n exports.uniqBy = uniqBy;\n function union() {\n var arrays = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n arrays[_i] = arguments[_i];\n }\n return uniq(concat(arrays));\n }\n exports.union = union;\n function intersection(array) {\n var arrays = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n arrays[_i - 1] = arguments[_i];\n }\n var result = [];\n top: for (var _a = 0, array_5 = array; _a < array_5.length; _a++) {\n var item = array_5[_a];\n if (includes(result, item))\n continue;\n for (var _b = 0, arrays_1 = arrays; _b < arrays_1.length; _b++) {\n var other = arrays_1[_b];\n if (!includes(other, item))\n continue top;\n }\n result.push(item);\n }\n return result;\n }\n exports.intersection = intersection;\n function difference(array) {\n var arrays = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n arrays[_i - 1] = arguments[_i];\n }\n var rest = concat(arrays);\n return array.filter(function (value) { return !includes(rest, value); });\n }\n exports.difference = difference;\n function removeBy(array, key) {\n for (var i = 0; i < array.length;) {\n if (key(array[i]))\n array.splice(i, 1);\n else\n i++;\n }\n }\n exports.removeBy = removeBy;\n // Shuffle a collection, using the modern version of the\n // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n function shuffle(array) {\n var length = array.length;\n var shuffled = new Array(length);\n for (var i = 0; i < length; i++) {\n var rand = math_1.randomIn(0, i);\n if (rand !== i)\n shuffled[i] = shuffled[rand];\n shuffled[rand] = array[i];\n }\n return shuffled;\n }\n exports.shuffle = shuffle;\n function pairwise(array, fn) {\n var n = array.length;\n var result = new Array(n - 1);\n for (var i = 0; i < n - 1; i++) {\n result[i] = fn(array[i], array[i + 1]);\n }\n return result;\n }\n exports.pairwise = pairwise;\n function reversed(array) {\n var n = array.length;\n var result = new Array(n);\n for (var i = 0; i < n; i++) {\n result[n - i - 1] = array[i];\n }\n return result;\n }\n exports.reversed = reversed;\n function repeat(value, n) {\n var result = new Array(n);\n for (var i = 0; i < n; i++) {\n result[i] = value;\n }\n return result;\n }\n exports.repeat = repeat;\n}\n","/* core/util/arrayable */ function _(require, module, exports) {\n function splice(array, start, k) {\n var items = [];\n for (var _i = 3; _i < arguments.length; _i++) {\n items[_i - 3] = arguments[_i];\n }\n var len = array.length;\n if (start < 0)\n start += len;\n if (start < 0)\n start = 0;\n else if (start > len)\n start = len;\n if (k == null || k > len - start)\n k = len - start;\n else if (k < 0)\n k = 0;\n var n = len - k + items.length;\n var result = new array.constructor(n);\n var i = 0;\n for (; i < start; i++) {\n result[i] = array[i];\n }\n for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {\n var item = items_1[_a];\n result[i++] = item;\n }\n for (var j = start + k; j < len; j++) {\n result[i++] = array[j];\n }\n return result;\n }\n exports.splice = splice;\n function insert(array, item, i) {\n return splice(array, i, 0, item);\n }\n exports.insert = insert;\n function append(array, item) {\n return splice(array, array.length, 0, item);\n }\n exports.append = append;\n function prepend(array, item) {\n return splice(array, 0, 0, item);\n }\n exports.prepend = prepend;\n function indexOf(array, item) {\n for (var i = 0, n = array.length; i < n; i++) {\n if (array[i] === item)\n return i;\n }\n return -1;\n }\n exports.indexOf = indexOf;\n function map(array, fn) {\n var n = array.length;\n var result = new array.constructor(n);\n for (var i = 0; i < n; i++) {\n result[i] = fn(array[i], i, array);\n }\n return result;\n }\n exports.map = map;\n function min(array) {\n var value;\n var result = Infinity;\n for (var i = 0, length_1 = array.length; i < length_1; i++) {\n value = array[i];\n if (value < result) {\n result = value;\n }\n }\n return result;\n }\n exports.min = min;\n function minBy(array, key) {\n if (array.length == 0)\n throw new Error(\"minBy() called with an empty array\");\n var result = array[0];\n var resultComputed = key(result);\n for (var i = 1, length_2 = array.length; i < length_2; i++) {\n var value = array[i];\n var computed = key(value);\n if (computed < resultComputed) {\n result = value;\n resultComputed = computed;\n }\n }\n return result;\n }\n exports.minBy = minBy;\n function max(array) {\n var value;\n var result = -Infinity;\n for (var i = 0, length_3 = array.length; i < length_3; i++) {\n value = array[i];\n if (value > result) {\n result = value;\n }\n }\n return result;\n }\n exports.max = max;\n function maxBy(array, key) {\n if (array.length == 0)\n throw new Error(\"maxBy() called with an empty array\");\n var result = array[0];\n var resultComputed = key(result);\n for (var i = 1, length_4 = array.length; i < length_4; i++) {\n var value = array[i];\n var computed = key(value);\n if (computed > resultComputed) {\n result = value;\n resultComputed = computed;\n }\n }\n return result;\n }\n exports.maxBy = maxBy;\n function sum(array) {\n var result = 0;\n for (var i = 0, n = array.length; i < n; i++) {\n result += array[i];\n }\n return result;\n }\n exports.sum = sum;\n}\n","/* core/util/assert */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var AssertionError = /** @class */ (function (_super) {\n tslib_1.__extends(AssertionError, _super);\n function AssertionError() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return AssertionError;\n }(Error));\n exports.AssertionError = AssertionError;\n function assert(condition, message) {\n if (condition === true || (condition !== false && condition()))\n return;\n throw new AssertionError(message || \"Assertion failed\");\n }\n exports.assert = assert;\n}\n","/* core/util/bbox */ function _(require, module, exports) {\n var min = Math.min, max = Math.max;\n function empty() {\n return {\n minX: Infinity,\n minY: Infinity,\n maxX: -Infinity,\n maxY: -Infinity,\n };\n }\n exports.empty = empty;\n function positive_x() {\n return {\n minX: Number.MIN_VALUE,\n minY: -Infinity,\n maxX: Infinity,\n maxY: Infinity,\n };\n }\n exports.positive_x = positive_x;\n function positive_y() {\n return {\n minX: -Infinity,\n minY: Number.MIN_VALUE,\n maxX: Infinity,\n maxY: Infinity,\n };\n }\n exports.positive_y = positive_y;\n function union(a, b) {\n return {\n minX: min(a.minX, b.minX),\n maxX: max(a.maxX, b.maxX),\n minY: min(a.minY, b.minY),\n maxY: max(a.maxY, b.maxY),\n };\n }\n exports.union = union;\n var BBox = /** @class */ (function () {\n function BBox(box) {\n if ('x0' in box && 'y0' in box && 'x1' in box && 'y1' in box) {\n var _a = box, x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1;\n if (!(x0 <= x1 && y0 <= y1))\n throw new Error(\"invalid bbox {x0: \" + x0 + \", y0: \" + y0 + \", x1: \" + x1 + \", y1: \" + y1 + \"}\");\n this.x0 = x0;\n this.y0 = y0;\n this.x1 = x1;\n this.y1 = y1;\n }\n else {\n var _b = box, x = _b.x, y = _b.y, width = _b.width, height = _b.height;\n if (!(width >= 0 && height >= 0))\n throw new Error(\"invalid bbox {x: \" + x + \", y: \" + y + \", width: \" + width + \", height: \" + height + \"}\");\n this.x0 = x;\n this.y0 = y;\n this.x1 = x + width;\n this.y1 = y + height;\n }\n }\n Object.defineProperty(BBox.prototype, \"minX\", {\n get: function () { return this.x0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"minY\", {\n get: function () { return this.y0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"maxX\", {\n get: function () { return this.x1; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"maxY\", {\n get: function () { return this.y1; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"left\", {\n get: function () { return this.x0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"top\", {\n get: function () { return this.y0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"right\", {\n get: function () { return this.x1; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"bottom\", {\n get: function () { return this.y1; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"p0\", {\n get: function () { return [this.x0, this.y0]; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"p1\", {\n get: function () { return [this.x1, this.y1]; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"x\", {\n get: function () { return this.x0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"y\", {\n get: function () { return this.y0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"width\", {\n get: function () { return this.x1 - this.x0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"height\", {\n get: function () { return this.y1 - this.y0; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"rect\", {\n get: function () { return { x: this.x, y: this.y, width: this.width, height: this.height }; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"h_range\", {\n get: function () { return { start: this.x0, end: this.x1 }; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"v_range\", {\n get: function () { return { start: this.y0, end: this.y1 }; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"ranges\", {\n get: function () { return [this.h_range, this.v_range]; },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BBox.prototype, \"aspect\", {\n get: function () { return this.width / this.height; },\n enumerable: true,\n configurable: true\n });\n BBox.prototype.contains = function (x, y) {\n return x >= this.x0 && x <= this.x1 && y >= this.y0 && y <= this.y1;\n };\n BBox.prototype.clip = function (x, y) {\n if (x < this.x0)\n x = this.x0;\n else if (x > this.x1)\n x = this.x1;\n if (y < this.y0)\n y = this.y0;\n else if (y > this.y1)\n y = this.y1;\n return [x, y];\n };\n BBox.prototype.union = function (that) {\n return new BBox({\n x0: min(this.x0, that.x0),\n y0: min(this.y0, that.y0),\n x1: max(this.x1, that.x1),\n y1: max(this.y1, that.y1),\n });\n };\n return BBox;\n }());\n exports.BBox = BBox;\n}\n","/* core/util/callback */ function _(require, module, exports) {\n function delay(func, wait) {\n return setTimeout(func, wait);\n }\n exports.delay = delay;\n var _defer = typeof requestAnimationFrame === \"function\" ? requestAnimationFrame : setImmediate;\n function defer(func) {\n return _defer(func);\n }\n exports.defer = defer;\n function throttle(func, wait, options) {\n if (options === void 0) {\n options = {};\n }\n var context, args, result;\n var timeout = null;\n var previous = 0;\n var later = function () {\n previous = options.leading === false ? 0 : Date.now();\n timeout = null;\n result = func.apply(context, args);\n if (!timeout)\n context = args = null;\n };\n return function () {\n var now = Date.now();\n if (!previous && options.leading === false)\n previous = now;\n var remaining = wait - (now - previous);\n context = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n result = func.apply(context, args);\n if (!timeout)\n context = args = null;\n }\n else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n }\n exports.throttle = throttle;\n function once(func) {\n var done = false;\n var memo;\n return function () {\n if (!done) {\n done = true;\n memo = func();\n }\n return memo;\n };\n }\n exports.once = once;\n}\n","/* core/util/canvas */ function _(require, module, exports) {\n var SVGRenderingContext2D = require(287) /* canvas2svg */;\n exports.SVGRenderingContext2D = SVGRenderingContext2D;\n function fixup_line_dash(ctx) {\n if (!ctx.setLineDash) {\n ctx.setLineDash = function (dash) {\n ctx.mozDash = dash;\n ctx.webkitLineDash = dash;\n };\n }\n if (!ctx.getLineDash) {\n ctx.getLineDash = function () {\n return ctx.mozDash;\n };\n }\n }\n function fixup_line_dash_offset(ctx) {\n ctx.setLineDashOffset = function (offset) {\n ctx.lineDashOffset = offset;\n ctx.mozDashOffset = offset;\n ctx.webkitLineDashOffset = offset;\n };\n ctx.getLineDashOffset = function () {\n return ctx.mozDashOffset;\n };\n }\n function fixup_image_smoothing(ctx) {\n ctx.setImageSmoothingEnabled = function (value) {\n ctx.imageSmoothingEnabled = value;\n ctx.mozImageSmoothingEnabled = value;\n ctx.oImageSmoothingEnabled = value;\n ctx.webkitImageSmoothingEnabled = value;\n ctx.msImageSmoothingEnabled = value;\n };\n ctx.getImageSmoothingEnabled = function () {\n var val = ctx.imageSmoothingEnabled;\n return val != null ? val : true;\n };\n }\n function fixup_measure_text(ctx) {\n if (ctx.measureText && ctx.html5MeasureText == null) {\n ctx.html5MeasureText = ctx.measureText;\n ctx.measureText = function (text) {\n var textMetrics = ctx.html5MeasureText(text);\n // fake it til you make it\n textMetrics.ascent = ctx.html5MeasureText(\"m\").width * 1.6;\n return textMetrics;\n };\n }\n }\n function fixup_ellipse(ctx) {\n // implementing the ctx.ellipse function with bezier curves\n // we don't implement the startAngle, endAngle and anticlockwise arguments.\n function ellipse_bezier(x, y, radiusX, radiusY, rotation, _startAngle, _endAngle, anticlockwise) {\n if (anticlockwise === void 0) {\n anticlockwise = false;\n }\n var c = 0.551784; // see http://www.tinaja.com/glib/ellipse4.pdf\n ctx.translate(x, y);\n ctx.rotate(rotation);\n var rx = radiusX;\n var ry = radiusY;\n if (anticlockwise) {\n rx = -radiusX;\n ry = -radiusY;\n }\n ctx.moveTo(-rx, 0); // start point of first curve\n ctx.bezierCurveTo(-rx, ry * c, -rx * c, ry, 0, ry);\n ctx.bezierCurveTo(rx * c, ry, rx, ry * c, rx, 0);\n ctx.bezierCurveTo(rx, -ry * c, rx * c, -ry, 0, -ry);\n ctx.bezierCurveTo(-rx * c, -ry, -rx, -ry * c, -rx, 0);\n ctx.rotate(-rotation);\n ctx.translate(-x, -y);\n }\n if (!ctx.ellipse)\n ctx.ellipse = ellipse_bezier;\n }\n function fixup_ctx(ctx) {\n fixup_line_dash(ctx);\n fixup_line_dash_offset(ctx);\n fixup_image_smoothing(ctx);\n fixup_measure_text(ctx);\n fixup_ellipse(ctx);\n }\n exports.fixup_ctx = fixup_ctx;\n function get_scale_ratio(ctx, hidpi, backend) {\n if (backend == \"svg\")\n return 1;\n else if (hidpi) {\n var devicePixelRatio_1 = window.devicePixelRatio || 1;\n var backingStoreRatio = ctx.webkitBackingStorePixelRatio ||\n ctx.mozBackingStorePixelRatio ||\n ctx.msBackingStorePixelRatio ||\n ctx.oBackingStorePixelRatio ||\n ctx.backingStorePixelRatio || 1;\n return devicePixelRatio_1 / backingStoreRatio;\n }\n else\n return 1;\n }\n exports.get_scale_ratio = get_scale_ratio;\n}\n","/* core/util/color */ function _(require, module, exports) {\n var svg_colors_1 = require(39) /* ./svg_colors */;\n var array_1 = require(21) /* ./array */;\n function _component2hex(v) {\n var h = Number(v).toString(16);\n return h.length == 1 ? \"0\" + h : h;\n }\n function color2hex(color) {\n color = color + '';\n if (color.indexOf('#') == 0)\n return color;\n else if (svg_colors_1.is_svg_color(color))\n return svg_colors_1.svg_colors[color];\n else if (color.indexOf('rgb') == 0) {\n var rgb = color.replace(/^rgba?\\(|\\s+|\\)$/g, '').split(',');\n var hex = rgb.slice(0, 3).map(_component2hex).join('');\n if (rgb.length == 4)\n hex += _component2hex(Math.floor(parseFloat(rgb[3]) * 255));\n return \"#\" + hex.slice(0, 8); // can also be rgba\n }\n else\n return color;\n }\n exports.color2hex = color2hex;\n function color2rgba(color, alpha) {\n if (alpha === void 0) {\n alpha = 1.0;\n }\n if (!color) // NaN, null, '', etc.\n return [0, 0, 0, 0]; // transparent\n // Convert to hex and then to clean version of 6 or 8 chars\n var hex = color2hex(color);\n hex = hex.replace(/ |#/g, '');\n if (hex.length <= 4) {\n hex = hex.replace(/(.)/g, '$1$1');\n }\n // Convert pairs to numbers\n var rgba = hex.match(/../g).map(function (i) { return parseInt(i, 16) / 255; });\n // Ensure correct length, add alpha if necessary\n while (rgba.length < 3)\n rgba.push(0);\n if (rgba.length < 4)\n rgba.push(alpha);\n return rgba.slice(0, 4);\n }\n exports.color2rgba = color2rgba;\n function valid_rgb(value) {\n var params;\n switch (value.substring(0, 4)) {\n case \"rgba\": {\n params = { start: \"rgba(\", len: 4, alpha: true };\n break;\n }\n case \"rgb(\": {\n params = { start: \"rgb(\", len: 3, alpha: false };\n break;\n }\n default:\n return false;\n }\n // if '.' and then ',' found, we know decimals are used on rgb\n if (new RegExp(\".*?(\\\\.).*(,)\").test(value))\n throw new Error(\"color expects integers for rgb in rgb/rgba tuple, received \" + value);\n // extract the numerical values from inside parens\n var contents = value.replace(params.start, \"\").replace(\")\", \"\").split(',').map(parseFloat);\n // check length of array based on rgb/rgba\n if (contents.length != params.len)\n throw new Error(\"color expects rgba \" + params.len + \"-tuple, received \" + value);\n // check for valid numerical values for rgba\n if (params.alpha && !(0 <= contents[3] && contents[3] <= 1))\n throw new Error(\"color expects rgba 4-tuple to have alpha value between 0 and 1\");\n if (array_1.includes(contents.slice(0, 3).map(function (rgb) { return 0 <= rgb && rgb <= 255; }), false))\n throw new Error(\"color expects rgb to have value between 0 and 255\");\n return true;\n }\n exports.valid_rgb = valid_rgb;\n}\n","/* core/util/compat */ function _(require, module, exports) {\n exports.is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ||\n (navigator.userAgent.indexOf('Trident') > 0) ||\n (navigator.userAgent.indexOf('Edge') > 0);\n exports.is_little_endian = (function () {\n var buf = new ArrayBuffer(4);\n var buf8 = new Uint8Array(buf);\n var buf32 = new Uint32Array(buf);\n buf32[1] = 0x0a0b0c0d;\n var little_endian = true;\n if (buf8[4] == 0x0a && buf8[5] == 0x0b && buf8[6] == 0x0c && buf8[7] == 0x0d) {\n little_endian = false;\n }\n return little_endian;\n })();\n}\n","/* core/util/data_structures */ function _(require, module, exports) {\n var array_1 = require(21) /* ./array */;\n var eq_1 = require(30) /* ./eq */;\n var types_1 = require(44) /* ./types */;\n var MultiDict = /** @class */ (function () {\n function MultiDict() {\n this._dict = {};\n }\n MultiDict.prototype._existing = function (key) {\n if (key in this._dict)\n return this._dict[key];\n else\n return null;\n };\n MultiDict.prototype.add_value = function (key, value) {\n /*\n if value == null\n throw new Error(\"Can't put null in this dict\")\n if isArray(value)\n throw new Error(\"Can't put arrays in this dict\")\n */\n var existing = this._existing(key);\n if (existing == null) {\n this._dict[key] = value;\n }\n else if (types_1.isArray(existing)) {\n existing.push(value);\n }\n else {\n this._dict[key] = [existing, value];\n }\n };\n MultiDict.prototype.remove_value = function (key, value) {\n var existing = this._existing(key);\n if (types_1.isArray(existing)) {\n var new_array = array_1.difference(existing, [value]);\n if (new_array.length > 0)\n this._dict[key] = new_array;\n else\n delete this._dict[key];\n }\n else if (eq_1.isEqual(existing, value)) {\n delete this._dict[key];\n }\n };\n MultiDict.prototype.get_one = function (key, duplicate_error) {\n var existing = this._existing(key);\n if (types_1.isArray(existing)) {\n if (existing.length === 1)\n return existing[0];\n else\n throw new Error(duplicate_error);\n }\n else\n return existing;\n };\n return MultiDict;\n }());\n exports.MultiDict = MultiDict;\n var Set = /** @class */ (function () {\n function Set(obj) {\n if (obj == null)\n this._values = [];\n else if (obj instanceof Set)\n this._values = array_1.copy(obj._values);\n else {\n this._values = [];\n for (var _i = 0, obj_1 = obj; _i < obj_1.length; _i++) {\n var item = obj_1[_i];\n this.add(item);\n }\n }\n }\n Object.defineProperty(Set.prototype, \"values\", {\n get: function () {\n return array_1.copy(this._values).sort();\n },\n enumerable: true,\n configurable: true\n });\n Set.prototype.toString = function () {\n return \"Set([\" + this.values.join(\",\") + \"])\";\n };\n Object.defineProperty(Set.prototype, \"size\", {\n get: function () {\n return this._values.length;\n },\n enumerable: true,\n configurable: true\n });\n Set.prototype.has = function (item) {\n return this._values.indexOf(item) !== -1;\n };\n Set.prototype.add = function (item) {\n if (!this.has(item))\n this._values.push(item);\n };\n Set.prototype.remove = function (item) {\n var i = this._values.indexOf(item);\n if (i !== -1)\n this._values.splice(i, 1);\n };\n Set.prototype.toggle = function (item) {\n var i = this._values.indexOf(item);\n if (i === -1)\n this._values.push(item);\n else\n this._values.splice(i, 1);\n };\n Set.prototype.clear = function () {\n this._values = [];\n };\n Set.prototype.union = function (input) {\n input = new Set(input);\n return new Set(this._values.concat(input._values));\n };\n Set.prototype.intersect = function (input) {\n input = new Set(input);\n var output = new Set();\n for (var _i = 0, _a = input._values; _i < _a.length; _i++) {\n var item = _a[_i];\n if (this.has(item) && input.has(item))\n output.add(item);\n }\n return output;\n };\n Set.prototype.diff = function (input) {\n input = new Set(input);\n var output = new Set();\n for (var _i = 0, _a = this._values; _i < _a.length; _i++) {\n var item = _a[_i];\n if (!input.has(item))\n output.add(item);\n }\n return output;\n };\n Set.prototype.forEach = function (fn, thisArg) {\n for (var _i = 0, _a = this._values; _i < _a.length; _i++) {\n var value = _a[_i];\n fn.call(thisArg || this, value, value, this);\n }\n };\n return Set;\n }());\n exports.Set = Set;\n}\n","/* core/util/eq */ function _(require, module, exports) {\n var types_1 = require(44) /* ./types */;\n var toString = Object.prototype.toString;\n // Internal recursive comparison function for `isEqual`.\n function eq(a, b, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b)\n return a !== 0 || 1 / a === 1 / b;\n // A strict comparison is necessary because `null == undefined`.\n if (a == null || b == null)\n return a === b;\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b))\n return false;\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case '[object RegExp]':\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case '[object String]':\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return '' + a === '' + b;\n case '[object Number]':\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN\n if (+a !== +a)\n return +b !== +b;\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case '[object Date]':\n case '[object Boolean]':\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n }\n var areArrays = className === '[object Array]';\n if (!areArrays) {\n if (typeof a != 'object' || typeof b != 'object')\n return false;\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor, bCtor = b.constructor;\n if (aCtor !== bCtor && !(types_1.isFunction(aCtor) && aCtor instanceof aCtor &&\n types_1.isFunction(bCtor) && bCtor instanceof bCtor)\n && ('constructor' in a && 'constructor' in b)) {\n return false;\n }\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a)\n return bStack[length] === b;\n }\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length)\n return false;\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], aStack, bStack))\n return false;\n }\n }\n else {\n // Deep compare objects.\n var keys = Object.keys(a);\n var key = void 0;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (Object.keys(b).length !== length)\n return false;\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(b.hasOwnProperty(key) && eq(a[key], b[key], aStack, bStack)))\n return false;\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n }\n // Perform a deep comparison to check if two objects are equal.\n function isEqual(a, b) {\n return eq(a, b);\n }\n exports.isEqual = isEqual;\n}\n","/* core/util/math */ function _(require, module, exports) {\n function angle_norm(angle) {\n while (angle < 0) {\n angle += 2 * Math.PI;\n }\n while (angle > 2 * Math.PI) {\n angle -= 2 * Math.PI;\n }\n return angle;\n }\n exports.angle_norm = angle_norm;\n function angle_dist(lhs, rhs) {\n return Math.abs(angle_norm(lhs - rhs));\n }\n exports.angle_dist = angle_dist;\n function angle_between(mid, lhs, rhs, direction) {\n var norm_mid = angle_norm(mid);\n var d = angle_dist(lhs, rhs);\n var cond = angle_dist(lhs, norm_mid) <= d && angle_dist(norm_mid, rhs) <= d;\n if (direction == 1 /* anticlock */)\n return !cond;\n else\n return cond;\n }\n exports.angle_between = angle_between;\n function random() {\n return Math.random();\n }\n exports.random = random;\n function randomIn(min, max) {\n if (max == null) {\n max = min;\n min = 0;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n }\n exports.randomIn = randomIn;\n function atan2(start, end) {\n /*\n * Calculate the angle between a line containing start and end points (composed\n * of [x, y] arrays) and the positive x-axis.\n */\n return Math.atan2(end[1] - start[1], end[0] - start[0]);\n }\n exports.atan2 = atan2;\n // http://www2.econ.osaka-u.ac.jp/~tanizaki/class/2013/econome3/13.pdf (Page 432)\n function rnorm(mu, sigma) {\n // Generate a random normal with a mean of 0 and a sigma of 1\n var r1;\n var r2;\n while (true) {\n r1 = random();\n r2 = random();\n r2 = (2 * r2 - 1) * Math.sqrt(2 * (1 / Math.E));\n if (-4 * r1 * r1 * Math.log(r1) >= r2 * r2)\n break;\n }\n var rn = r2 / r1;\n // Transform the standard normal to meet the characteristics that we want (mu, sigma)\n rn = mu + sigma * rn;\n return rn;\n }\n exports.rnorm = rnorm;\n function clamp(val, min, max) {\n if (val > max)\n return max;\n if (val < min)\n return min;\n return val;\n }\n exports.clamp = clamp;\n}\n","/* core/util/object */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var array_1 = require(21) /* ./array */;\n exports.keys = Object.keys;\n function values(object) {\n var keys = Object.keys(object);\n var length = keys.length;\n var values = new Array(length);\n for (var i = 0; i < length; i++) {\n values[i] = object[keys[i]];\n }\n return values;\n }\n exports.values = values;\n function extend(dest, src) {\n return tslib_1.__assign(dest, src);\n }\n exports.extend = extend;\n function clone(obj) {\n return extend({}, obj); // XXX: can't use {...obj} due to https://github.com/Microsoft/TypeScript/issues/14409\n }\n exports.clone = clone;\n function merge(obj1, obj2) {\n /*\n * Returns an object with the array values for obj1 and obj2 unioned by key.\n */\n var result = Object.create(Object.prototype);\n var keys = array_1.concat([Object.keys(obj1), Object.keys(obj2)]);\n for (var _i = 0, keys_1 = keys; _i < keys_1.length; _i++) {\n var key = keys_1[_i];\n var arr1 = obj1.hasOwnProperty(key) ? obj1[key] : [];\n var arr2 = obj2.hasOwnProperty(key) ? obj2[key] : [];\n result[key] = array_1.union(arr1, arr2);\n }\n return result;\n }\n exports.merge = merge;\n function size(obj) {\n return Object.keys(obj).length;\n }\n exports.size = size;\n function isEmpty(obj) {\n return size(obj) === 0;\n }\n exports.isEmpty = isEmpty;\n}\n","/* core/util/projections */ function _(require, module, exports) {\n var proj4 = require(374) /* proj4/lib/core */;\n var Projection = require(362) /* proj4/lib/Proj */;\n var mercator = new Projection('GOOGLE');\n var wgs84 = new Projection('WGS84');\n exports.wgs84_mercator = proj4(wgs84, mercator);\n var mercator_bounds = {\n lon: [-20026376.39, 20026376.39],\n lat: [-20048966.10, 20048966.10],\n };\n var latlon_bounds = {\n lon: [-180, 180],\n lat: [-85.06, 85.06],\n };\n function clip_mercator(low, high, dimension) {\n var _a = mercator_bounds[dimension], min = _a[0], max = _a[1];\n return [Math.max(low, min), Math.min(high, max)];\n }\n exports.clip_mercator = clip_mercator;\n function in_bounds(value, dimension) {\n return value > latlon_bounds[dimension][0] && value < latlon_bounds[dimension][1];\n }\n exports.in_bounds = in_bounds;\n function project_xy(x, y) {\n var n = Math.min(x.length, y.length);\n var merc_x_s = new Array(n);\n var merc_y_s = new Array(n);\n for (var i = 0; i < n; i++) {\n var _a = exports.wgs84_mercator.forward([x[i], y[i]]), merc_x = _a[0], merc_y = _a[1];\n merc_x_s[i] = merc_x;\n merc_y_s[i] = merc_y;\n }\n return [merc_x_s, merc_y_s];\n }\n exports.project_xy = project_xy;\n function project_xsys(xs, ys) {\n var n = Math.min(xs.length, ys.length);\n var merc_xs_s = new Array(n);\n var merc_ys_s = new Array(n);\n for (var i = 0; i < n; i++) {\n var _a = project_xy(xs[i], ys[i]), merc_x_s = _a[0], merc_y_s = _a[1];\n merc_xs_s[i] = merc_x_s;\n merc_ys_s[i] = merc_y_s;\n }\n return [merc_xs_s, merc_ys_s];\n }\n exports.project_xsys = project_xsys;\n}\n","/* core/util/refs */ function _(require, module, exports) {\n var types_1 = require(44) /* ./types */;\n // Create a Bokeh reference from a HasProps subclass\n //\n // @param obj [HasProps] the object to create a reference for\n // @return [Object] a Bokeh reference for `obj`\n // @throw Error if `obj` is not a HasProps\n //\n function create_ref(obj) {\n var ref = {\n type: obj.type,\n id: obj.id,\n };\n if (obj._subtype != null) {\n ref.subtype = obj._subtype;\n }\n return ref;\n }\n exports.create_ref = create_ref;\n // Determine whether an object has the proper format of a Bokeh reference\n //\n // @param arg [Object] the object to test\n // @return [bool] whether the object is a refererence\n //\n // @note this function does not check that the id and types are valid,\n // only that the format is correct (all required keys are present)\n //\n function is_ref(arg) {\n if (types_1.isObject(arg)) {\n var keys = Object.keys(arg).sort();\n if (keys.length == 2)\n return keys[0] == 'id' && keys[1] == 'type';\n if (keys.length == 3)\n return keys[0] == 'id' && keys[1] == 'subtype' && keys[2] == 'type';\n }\n return false;\n }\n exports.is_ref = is_ref;\n}\n","/* core/util/selection */ function _(require, module, exports) {\n function get_indices(data_source) {\n var selected = data_source.selected;\n if (selected['0d'].glyph)\n return selected['0d'].indices;\n else if (selected['1d'].indices.length > 0)\n return selected['1d'].indices;\n else if (selected['2d'].indices.length > 0)\n return selected['2d'].indices;\n else\n return [];\n }\n exports.get_indices = get_indices;\n}\n","/* core/util/serialization */ function _(require, module, exports) {\n var types_1 = require(44) /* ./types */;\n var compat_1 = require(28) /* ./compat */;\n exports.ARRAY_TYPES = {\n uint8: Uint8Array,\n int8: Int8Array,\n uint16: Uint16Array,\n int16: Int16Array,\n uint32: Uint32Array,\n int32: Int32Array,\n float32: Float32Array,\n float64: Float64Array,\n };\n exports.DTYPES = {\n Uint8Array: \"uint8\",\n Int8Array: \"int8\",\n Uint16Array: \"uint16\",\n Int16Array: \"int16\",\n Uint32Array: \"uint32\",\n Int32Array: \"int32\",\n Float32Array: \"float32\",\n Float64Array: \"float64\",\n };\n function arrayName(array) {\n if (\"name\" in array.constructor)\n return array.constructor.name;\n else {\n switch (true) {\n case array instanceof Uint8Array: return \"Uint8Array\";\n case array instanceof Int8Array: return \"Int8Array\";\n case array instanceof Uint16Array: return \"Uint16Array\";\n case array instanceof Int16Array: return \"Int16Array\";\n case array instanceof Uint32Array: return \"Uint32Array\";\n case array instanceof Int32Array: return \"Int32Array\";\n case array instanceof Float32Array: return \"Float32Array\";\n case array instanceof Float64Array: return \"Float64Array\";\n default:\n throw new Error(\"unsupported typed array\");\n }\n }\n }\n exports.BYTE_ORDER = compat_1.is_little_endian ? \"little\" : \"big\";\n function swap16(a) {\n var x = new Uint8Array(a.buffer, a.byteOffset, a.length * 2);\n for (var i = 0, end = x.length; i < end; i += 2) {\n var t = x[i];\n x[i] = x[i + 1];\n x[i + 1] = t;\n }\n }\n exports.swap16 = swap16;\n function swap32(a) {\n var x = new Uint8Array(a.buffer, a.byteOffset, a.length * 4);\n for (var i = 0, end = x.length; i < end; i += 4) {\n var t = x[i];\n x[i] = x[i + 3];\n x[i + 3] = t;\n t = x[i + 1];\n x[i + 1] = x[i + 2];\n x[i + 2] = t;\n }\n }\n exports.swap32 = swap32;\n function swap64(a) {\n var x = new Uint8Array(a.buffer, a.byteOffset, a.length * 8);\n for (var i = 0, end = x.length; i < end; i += 8) {\n var t = x[i];\n x[i] = x[i + 7];\n x[i + 7] = t;\n t = x[i + 1];\n x[i + 1] = x[i + 6];\n x[i + 6] = t;\n t = x[i + 2];\n x[i + 2] = x[i + 5];\n x[i + 5] = t;\n t = x[i + 3];\n x[i + 3] = x[i + 4];\n x[i + 4] = t;\n }\n }\n exports.swap64 = swap64;\n function process_buffer(specification, buffers) {\n var need_swap = specification.order !== exports.BYTE_ORDER;\n var shape = specification.shape;\n var bytes = null;\n for (var _i = 0, buffers_1 = buffers; _i < buffers_1.length; _i++) {\n var buf = buffers_1[_i];\n var header = JSON.parse(buf[0]);\n if (header.id === specification.__buffer__) {\n bytes = buf[1];\n break;\n }\n }\n var arr = new (exports.ARRAY_TYPES[specification.dtype])(bytes);\n if (need_swap) {\n if (arr.BYTES_PER_ELEMENT === 2) {\n swap16(arr);\n }\n else if (arr.BYTES_PER_ELEMENT === 4) {\n swap32(arr);\n }\n else if (arr.BYTES_PER_ELEMENT === 8) {\n swap64(arr);\n }\n }\n return [arr, shape];\n }\n exports.process_buffer = process_buffer;\n function process_array(obj, buffers) {\n if (types_1.isObject(obj) && '__ndarray__' in obj)\n return decode_base64(obj);\n else if (types_1.isObject(obj) && '__buffer__' in obj)\n return process_buffer(obj, buffers);\n else if (types_1.isArray(obj) || types_1.isTypedArray(obj))\n return [obj, []];\n else\n return undefined;\n }\n exports.process_array = process_array;\n function arrayBufferToBase64(buffer) {\n var bytes = new Uint8Array(buffer);\n var chars = Array.from(bytes).map(function (b) { return String.fromCharCode(b); });\n return btoa(chars.join(\"\"));\n }\n exports.arrayBufferToBase64 = arrayBufferToBase64;\n function base64ToArrayBuffer(base64) {\n var binary_string = atob(base64);\n var len = binary_string.length;\n var bytes = new Uint8Array(len);\n for (var i = 0, end = len; i < end; i++) {\n bytes[i] = binary_string.charCodeAt(i);\n }\n return bytes.buffer;\n }\n exports.base64ToArrayBuffer = base64ToArrayBuffer;\n function decode_base64(input) {\n var bytes = base64ToArrayBuffer(input.__ndarray__);\n var dtype = input.dtype;\n var shape = input.shape;\n var array;\n if (dtype in exports.ARRAY_TYPES)\n array = new (exports.ARRAY_TYPES[dtype])(bytes);\n else\n throw new Error(\"unknown dtype: \" + dtype);\n return [array, shape];\n }\n exports.decode_base64 = decode_base64;\n function encode_base64(array, shape) {\n var b64 = arrayBufferToBase64(array.buffer);\n var name = arrayName(array);\n var dtype;\n if (name in exports.DTYPES)\n dtype = exports.DTYPES[name];\n else\n throw new Error(\"unknown array type: \" + name);\n var data = {\n __ndarray__: b64,\n shape: shape,\n dtype: dtype,\n };\n return data;\n }\n exports.encode_base64 = encode_base64;\n function decode_traverse_data(v, buffers) {\n // v is just a regular array of scalars\n if (v.length == 0 || !(types_1.isObject(v[0]) || types_1.isArray(v[0]))) {\n return [v, []];\n }\n var arrays = [];\n var shapes = [];\n for (var _i = 0, v_1 = v; _i < v_1.length; _i++) {\n var obj = v_1[_i];\n var _a = types_1.isArray(obj) ? decode_traverse_data(obj, buffers) :\n process_array(obj, buffers), arr = _a[0], shape = _a[1];\n arrays.push(arr);\n shapes.push(shape);\n }\n // If there is a list of empty lists, reduce that to just a list\n var filtered_shapes = shapes.map(function (shape) { return shape.filter(function (v) { return v.length != 0; }); });\n return [arrays, filtered_shapes];\n }\n function decode_column_data(data, buffers) {\n if (buffers === void 0) {\n buffers = [];\n }\n var new_data = {};\n var new_shapes = {};\n for (var k in data) {\n // might be array of scalars, or might be ragged array or arrays\n var v = data[k];\n if (types_1.isArray(v)) {\n // v is just a regular array of scalars\n if (v.length == 0 || !(types_1.isObject(v[0]) || types_1.isArray(v[0]))) {\n new_data[k] = v;\n continue;\n }\n // v is a ragged array of arrays\n var _a = decode_traverse_data(v, buffers), arrays = _a[0], shapes = _a[1];\n new_data[k] = arrays;\n new_shapes[k] = shapes;\n // must be object or array (single array case)\n }\n else {\n var _b = process_array(v, buffers), arr = _b[0], shape = _b[1];\n new_data[k] = arr;\n new_shapes[k] = shape;\n }\n }\n return [new_data, new_shapes];\n }\n exports.decode_column_data = decode_column_data;\n function encode_traverse_data(v, shapes) {\n var new_array = [];\n for (var i = 0, end = v.length; i < end; i++) {\n var item = v[i];\n if (types_1.isTypedArray(item)) {\n var shape = shapes[i] ? shapes[i] : undefined;\n new_array.push(encode_base64(item, shape));\n }\n else if (types_1.isArray(item)) {\n new_array.push(encode_traverse_data(item, shapes ? shapes[i] : []));\n }\n else\n new_array.push(item);\n }\n return new_array;\n }\n function encode_column_data(data, shapes) {\n var new_data = {};\n for (var k in data) {\n var v = data[k];\n var shapes_k = shapes != null ? shapes[k] : undefined;\n var new_v = void 0;\n if (types_1.isTypedArray(v)) {\n new_v = encode_base64(v, shapes_k);\n }\n else if (types_1.isArray(v)) {\n new_v = encode_traverse_data(v, shapes_k || []);\n }\n else\n new_v = v;\n new_data[k] = new_v;\n }\n return new_data;\n }\n exports.encode_column_data = encode_column_data;\n}\n","/* core/util/spatial */ function _(require, module, exports) {\n var FlatBush = require(346) /* flatbush */;\n var bbox_1 = require(24) /* ./bbox */;\n var SpatialIndex = /** @class */ (function () {\n function SpatialIndex(points) {\n this.points = points;\n this.index = null;\n if (points.length > 0) {\n this.index = new FlatBush(points.length);\n for (var _i = 0, points_1 = points; _i < points_1.length; _i++) {\n var p = points_1[_i];\n var minX = p.minX, minY = p.minY, maxX = p.maxX, maxY = p.maxY;\n this.index.add(minX, minY, maxX, maxY);\n }\n this.index.finish();\n }\n }\n Object.defineProperty(SpatialIndex.prototype, \"bbox\", {\n get: function () {\n if (this.index == null)\n return bbox_1.empty();\n else {\n var _a = this.index, minX = _a.minX, minY = _a.minY, maxX = _a.maxX, maxY = _a.maxY;\n return { minX: minX, minY: minY, maxX: maxX, maxY: maxY };\n }\n },\n enumerable: true,\n configurable: true\n });\n SpatialIndex.prototype.search = function (rect) {\n var _this = this;\n if (this.index == null)\n return [];\n else {\n var minX = rect.minX, minY = rect.minY, maxX = rect.maxX, maxY = rect.maxY;\n var indices = this.index.search(minX, minY, maxX, maxY);\n return indices.map(function (j) { return _this.points[j]; });\n }\n };\n SpatialIndex.prototype.indices = function (rect) {\n return this.search(rect).map(function (_a) {\n var i = _a.i;\n return i;\n });\n };\n return SpatialIndex;\n }());\n exports.SpatialIndex = SpatialIndex;\n}\n","/* core/util/string */ function _(require, module, exports) {\n var settings_1 = require(18) /* ../settings */;\n function startsWith(str, searchString, position) {\n if (position === void 0) {\n position = 0;\n }\n return str.substr(position, searchString.length) == searchString;\n }\n exports.startsWith = startsWith;\n function uuid4() {\n // from ipython project\n // http://www.ietf.org/rfc/rfc4122.txt\n var s = new Array(32);\n var hexDigits = \"0123456789ABCDEF\";\n for (var i = 0; i < 32; i++) {\n s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);\n }\n s[12] = \"4\"; // bits 12-15 of the time_hi_and_version field to 0010\n s[16] = hexDigits.substr((s[16].charCodeAt(0) & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01\n return s.join(\"\");\n }\n exports.uuid4 = uuid4;\n var counter = 1000;\n function uniqueId(prefix) {\n var id = settings_1.settings.dev ? \"j\" + counter++ : uuid4();\n if (prefix != null)\n return prefix + \"-\" + id;\n else\n return id;\n }\n exports.uniqueId = uniqueId;\n function escape(s) {\n return s.replace(/(?:[&<>\"'`])/g, function (ch) {\n switch (ch) {\n case '&': return '&';\n case '<': return '<';\n case '>': return '>';\n case '\"': return '"';\n case \"'\": return ''';\n case '`': return '`';\n default: return ch;\n }\n });\n }\n exports.escape = escape;\n function unescape(s) {\n return s.replace(/&(amp|lt|gt|quot|#x27|#x60);/g, function (_, entity) {\n switch (entity) {\n case 'amp': return '&';\n case 'lt': return '<';\n case 'gt': return '>';\n case 'quot': return '\"';\n case '#x27': return \"'\";\n case '#x60': return '`';\n default: return entity;\n }\n });\n }\n exports.unescape = unescape;\n function use_strict(code) {\n return \"'use strict';\\n\" + code;\n }\n exports.use_strict = use_strict;\n}\n","/* core/util/svg_colors */ function _(require, module, exports) {\n exports.svg_colors = {\n indianred: \"#CD5C5C\",\n lightcoral: \"#F08080\",\n salmon: \"#FA8072\",\n darksalmon: \"#E9967A\",\n lightsalmon: \"#FFA07A\",\n crimson: \"#DC143C\",\n red: \"#FF0000\",\n firebrick: \"#B22222\",\n darkred: \"#8B0000\",\n pink: \"#FFC0CB\",\n lightpink: \"#FFB6C1\",\n hotpink: \"#FF69B4\",\n deeppink: \"#FF1493\",\n mediumvioletred: \"#C71585\",\n palevioletred: \"#DB7093\",\n coral: \"#FF7F50\",\n tomato: \"#FF6347\",\n orangered: \"#FF4500\",\n darkorange: \"#FF8C00\",\n orange: \"#FFA500\",\n gold: \"#FFD700\",\n yellow: \"#FFFF00\",\n lightyellow: \"#FFFFE0\",\n lemonchiffon: \"#FFFACD\",\n lightgoldenrodyellow: \"#FAFAD2\",\n papayawhip: \"#FFEFD5\",\n moccasin: \"#FFE4B5\",\n peachpuff: \"#FFDAB9\",\n palegoldenrod: \"#EEE8AA\",\n khaki: \"#F0E68C\",\n darkkhaki: \"#BDB76B\",\n lavender: \"#E6E6FA\",\n thistle: \"#D8BFD8\",\n plum: \"#DDA0DD\",\n violet: \"#EE82EE\",\n orchid: \"#DA70D6\",\n fuchsia: \"#FF00FF\",\n magenta: \"#FF00FF\",\n mediumorchid: \"#BA55D3\",\n mediumpurple: \"#9370DB\",\n blueviolet: \"#8A2BE2\",\n darkviolet: \"#9400D3\",\n darkorchid: \"#9932CC\",\n darkmagenta: \"#8B008B\",\n purple: \"#800080\",\n indigo: \"#4B0082\",\n slateblue: \"#6A5ACD\",\n darkslateblue: \"#483D8B\",\n mediumslateblue: \"#7B68EE\",\n greenyellow: \"#ADFF2F\",\n chartreuse: \"#7FFF00\",\n lawngreen: \"#7CFC00\",\n lime: \"#00FF00\",\n limegreen: \"#32CD32\",\n palegreen: \"#98FB98\",\n lightgreen: \"#90EE90\",\n mediumspringgreen: \"#00FA9A\",\n springgreen: \"#00FF7F\",\n mediumseagreen: \"#3CB371\",\n seagreen: \"#2E8B57\",\n forestgreen: \"#228B22\",\n green: \"#008000\",\n darkgreen: \"#006400\",\n yellowgreen: \"#9ACD32\",\n olivedrab: \"#6B8E23\",\n olive: \"#808000\",\n darkolivegreen: \"#556B2F\",\n mediumaquamarine: \"#66CDAA\",\n darkseagreen: \"#8FBC8F\",\n lightseagreen: \"#20B2AA\",\n darkcyan: \"#008B8B\",\n teal: \"#008080\",\n aqua: \"#00FFFF\",\n cyan: \"#00FFFF\",\n lightcyan: \"#E0FFFF\",\n paleturquoise: \"#AFEEEE\",\n aquamarine: \"#7FFFD4\",\n turquoise: \"#40E0D0\",\n mediumturquoise: \"#48D1CC\",\n darkturquoise: \"#00CED1\",\n cadetblue: \"#5F9EA0\",\n steelblue: \"#4682B4\",\n lightsteelblue: \"#B0C4DE\",\n powderblue: \"#B0E0E6\",\n lightblue: \"#ADD8E6\",\n skyblue: \"#87CEEB\",\n lightskyblue: \"#87CEFA\",\n deepskyblue: \"#00BFFF\",\n dodgerblue: \"#1E90FF\",\n cornflowerblue: \"#6495ED\",\n royalblue: \"#4169E1\",\n blue: \"#0000FF\",\n mediumblue: \"#0000CD\",\n darkblue: \"#00008B\",\n navy: \"#000080\",\n midnightblue: \"#191970\",\n cornsilk: \"#FFF8DC\",\n blanchedalmond: \"#FFEBCD\",\n bisque: \"#FFE4C4\",\n navajowhite: \"#FFDEAD\",\n wheat: \"#F5DEB3\",\n burlywood: \"#DEB887\",\n tan: \"#D2B48C\",\n rosybrown: \"#BC8F8F\",\n sandybrown: \"#F4A460\",\n goldenrod: \"#DAA520\",\n darkgoldenrod: \"#B8860B\",\n peru: \"#CD853F\",\n chocolate: \"#D2691E\",\n saddlebrown: \"#8B4513\",\n sienna: \"#A0522D\",\n brown: \"#A52A2A\",\n maroon: \"#800000\",\n white: \"#FFFFFF\",\n snow: \"#FFFAFA\",\n honeydew: \"#F0FFF0\",\n mintcream: \"#F5FFFA\",\n azure: \"#F0FFFF\",\n aliceblue: \"#F0F8FF\",\n ghostwhite: \"#F8F8FF\",\n whitesmoke: \"#F5F5F5\",\n seashell: \"#FFF5EE\",\n beige: \"#F5F5DC\",\n oldlace: \"#FDF5E6\",\n floralwhite: \"#FFFAF0\",\n ivory: \"#FFFFF0\",\n antiquewhite: \"#FAEBD7\",\n linen: \"#FAF0E6\",\n lavenderblush: \"#FFF0F5\",\n mistyrose: \"#FFE4E1\",\n gainsboro: \"#DCDCDC\",\n lightgray: \"#D3D3D3\",\n lightgrey: \"#D3D3D3\",\n silver: \"#C0C0C0\",\n darkgray: \"#A9A9A9\",\n darkgrey: \"#A9A9A9\",\n gray: \"#808080\",\n grey: \"#808080\",\n dimgray: \"#696969\",\n dimgrey: \"#696969\",\n lightslategray: \"#778899\",\n lightslategrey: \"#778899\",\n slategray: \"#708090\",\n slategrey: \"#708090\",\n darkslategray: \"#2F4F4F\",\n darkslategrey: \"#2F4F4F\",\n black: \"#000000\",\n };\n function is_svg_color(color) {\n return color in exports.svg_colors;\n }\n exports.is_svg_color = is_svg_color;\n}\n","/* core/util/templating */ function _(require, module, exports) {\n var sprintf_js_1 = require(389) /* sprintf-js */;\n var Numbro = require(361) /* numbro */;\n var tz = require(390) /* timezone */;\n var string_1 = require(38) /* ./string */;\n var types_1 = require(44) /* ./types */;\n exports.DEFAULT_FORMATTERS = {\n numeral: function (value, format, _special_vars) { return Numbro.format(value, format); },\n datetime: function (value, format, _special_vars) { return tz(value, format); },\n printf: function (value, format, _special_vars) { return sprintf_js_1.sprintf(format, value); },\n };\n function basic_formatter(value, _format, _special_vars) {\n if (types_1.isNumber(value)) {\n var format = (function () {\n switch (false) {\n case Math.floor(value) != value:\n return \"%d\";\n case !(Math.abs(value) > 0.1) || !(Math.abs(value) < 1000):\n return \"%0.3f\";\n default:\n return \"%0.3e\";\n }\n })();\n return sprintf_js_1.sprintf(format, value);\n }\n else\n return \"\" + value; // get strings for categorical types\n }\n exports.basic_formatter = basic_formatter;\n function get_formatter(name, raw_spec, format, formatters) {\n // no format, use default built in formatter\n if (format == null)\n return basic_formatter;\n // format spec in the formatters dict, use that\n if (formatters != null && (name in formatters || raw_spec in formatters)) {\n // some day (Bokeh 2.0) we can get rid of the check for name, and just check the raw spec\n // keep it now for compatibility but do not demonstrate it anywhere\n var key = raw_spec in formatters ? raw_spec : name;\n var formatter_1 = formatters[key];\n if (types_1.isString(formatter_1)) {\n if (formatter_1 in exports.DEFAULT_FORMATTERS)\n return exports.DEFAULT_FORMATTERS[formatter_1];\n else\n throw new Error(\"Unknown tooltip field formatter type '\" + formatter_1 + \"'\");\n }\n return function (value, format, special_vars) {\n return formatter_1.format(value, format, special_vars);\n };\n }\n // otherwise use \"numeral\" as default\n return exports.DEFAULT_FORMATTERS[\"numeral\"];\n }\n exports.get_formatter = get_formatter;\n function get_value(name, data_source, i, special_vars) {\n if (name[0] == \"$\") {\n if (name.substring(1) in special_vars)\n return special_vars[name.substring(1)];\n else\n throw new Error(\"Unknown special variable '\" + name + \"'\");\n }\n var column = data_source.get_column(name);\n // missing column\n if (column == null)\n return null;\n // typical (non-image) index\n if (types_1.isNumber(i))\n return column[i];\n // image index\n var data = column[i.index];\n if (types_1.isTypedArray(data) || types_1.isArray(data)) {\n // inspect array of arrays\n if (types_1.isArray(data[0])) {\n var row = data[i.dim2];\n return row[i.dim1];\n }\n // inspect flat array\n else\n return data[i.flat_index];\n }\n // inspect per-image scalar data\n else\n return data;\n }\n exports.get_value = get_value;\n function replace_placeholders(str, data_source, i, formatters, special_vars) {\n if (special_vars === void 0) {\n special_vars = {};\n }\n // this extracts the $x, @x, @{x} without any trailing {format}\n var raw_spec = str.replace(/(?:^|[^@])([@|\\$](?:\\w+|{[^{}]+}))(?:{[^{}]+})?/g, function (_match, raw_spec, _format) { return \"\" + raw_spec; });\n // this handles the special case @$name, replacing it with an @var corresponding to special_vars.name\n str = str.replace(/@\\$name/g, function (_match) { return \"@{\" + special_vars.name + \"}\"; });\n // this prepends special vars with \"@\", e.g \"$x\" becomes \"@$x\", so subsequent processing is simpler\n str = str.replace(/(^|[^\\$])\\$(\\w+)/g, function (_match, prefix, name) { return prefix + \"@$\" + name; });\n str = str.replace(/(^|[^@])@(?:(\\$?\\w+)|{([^{}]+)})(?:{([^{}]+)})?/g, function (_match, prefix, name, long_name, format) {\n name = long_name != null ? long_name : name;\n var value = get_value(name, data_source, i, special_vars);\n // missing value, return ???\n if (value == null)\n return \"\" + prefix + string_1.escape(\"???\");\n // 'safe' format, return the value as-is\n if (format == 'safe')\n return \"\" + prefix + value;\n // format and escape everything else\n var formatter = get_formatter(name, raw_spec, format, formatters);\n return \"\" + prefix + string_1.escape(formatter(value, format, special_vars));\n });\n return str;\n }\n exports.replace_placeholders = replace_placeholders;\n}\n","/* core/util/text */ function _(require, module, exports) {\n var dom_1 = require(5) /* ../dom */;\n var cache = {};\n function get_text_height(font) {\n if (cache[font] != null)\n return cache[font];\n var text = dom_1.span({ style: { font: font } }, \"Hg\");\n var block = dom_1.div({ style: { display: \"inline-block\", width: \"1px\", height: \"0px\" } });\n var elem = dom_1.div({}, text, block);\n document.body.appendChild(elem);\n try {\n block.style.verticalAlign = \"baseline\";\n var ascent = dom_1.offset(block).top - dom_1.offset(text).top;\n block.style.verticalAlign = \"bottom\";\n var height = dom_1.offset(block).top - dom_1.offset(text).top;\n var result = { height: height, ascent: ascent, descent: height - ascent };\n cache[font] = result;\n return result;\n }\n finally {\n document.body.removeChild(elem);\n }\n }\n exports.get_text_height = get_text_height;\n}\n","/* core/util/throttle */ function _(require, module, exports) {\n function _delay_animation(callback) {\n callback(Date.now()); // XXX: performance.now()\n return -1;\n }\n var delay_animation = (typeof window !== 'undefined' ? window.requestAnimationFrame : undefined) ||\n (typeof window !== 'undefined' ? window.webkitRequestAnimationFrame : undefined) ||\n (typeof window !== 'undefined' ? window.mozRequestAnimationFrame : undefined) ||\n (typeof window !== 'undefined' ? window.msRequestAnimationFrame : undefined) || _delay_animation;\n // Returns a function, that, when invoked, will only be triggered at\n // most once during a given window of time.\n //\n // In addition, if the browser supports requestAnimationFrame, the\n // throttled function will be run no more frequently than request\n // animation frame allows.\n //\n // @param func [function] the function to throttle\n // @param wait [number] time in milliseconds to use for window\n // @return [function] throttled function\n //\n function throttle(func, wait) {\n var timeout = null;\n var previous = 0;\n var pending = false;\n var later = function () {\n previous = Date.now();\n timeout = null;\n pending = false;\n func();\n };\n return function () {\n var now = Date.now();\n var remaining = wait - (now - previous);\n if (remaining <= 0 && !pending) {\n if (timeout != null)\n clearTimeout(timeout);\n pending = true;\n delay_animation(later);\n }\n else if (!timeout && !pending)\n timeout = setTimeout(function () { return delay_animation(later); }, remaining);\n };\n }\n exports.throttle = throttle;\n}\n","/* core/util/typed_array */ function _(require, module, exports) {\n function concat(array0) {\n var arrays = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n arrays[_i - 1] = arguments[_i];\n }\n var n = array0.length;\n for (var _a = 0, arrays_1 = arrays; _a < arrays_1.length; _a++) {\n var array = arrays_1[_a];\n n += array.length;\n }\n var result = new array0.constructor(n);\n result.set(array0, 0);\n var i = array0.length;\n for (var _b = 0, arrays_2 = arrays; _b < arrays_2.length; _b++) {\n var array = arrays_2[_b];\n result.set(array, i);\n i += array.length;\n }\n return result;\n }\n exports.concat = concat;\n}\n","/* core/util/types */ function _(require, module, exports) {\n var array_1 = require(21) /* ./array */;\n var toString = Object.prototype.toString;\n function isBoolean(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n }\n exports.isBoolean = isBoolean;\n function isNumber(obj) {\n return toString.call(obj) === \"[object Number]\";\n }\n exports.isNumber = isNumber;\n function isInteger(obj) {\n return isNumber(obj) && isFinite(obj) && Math.floor(obj) === obj;\n }\n exports.isInteger = isInteger;\n function isString(obj) {\n return toString.call(obj) === \"[object String]\";\n }\n exports.isString = isString;\n function isStrictNaN(obj) {\n return isNumber(obj) && obj !== +obj;\n }\n exports.isStrictNaN = isStrictNaN;\n function isFunction(obj) {\n return toString.call(obj) === \"[object Function]\";\n }\n exports.isFunction = isFunction;\n function isArray(obj) {\n return Array.isArray(obj);\n }\n exports.isArray = isArray;\n function isArrayOf(arr, predicate) {\n return array_1.all(arr, predicate);\n }\n exports.isArrayOf = isArrayOf;\n function isArrayableOf(arr, predicate) {\n for (var i = 0, end = arr.length; i < end; i++) {\n if (!predicate(arr[i]))\n return false;\n }\n return true;\n }\n exports.isArrayableOf = isArrayableOf;\n function isTypedArray(obj) {\n return obj != null && obj.buffer != null && obj.buffer instanceof ArrayBuffer;\n }\n exports.isTypedArray = isTypedArray;\n function isObject(obj) {\n var tp = typeof obj;\n return tp === 'function' || tp === 'object' && !!obj;\n }\n exports.isObject = isObject;\n function isPlainObject(obj) {\n return isObject(obj) && (obj.constructor == null || obj.constructor === Object);\n }\n exports.isPlainObject = isPlainObject;\n}\n","/* core/util/wheel */ function _(require, module, exports) {\n function fontSize(element) {\n var value = getComputedStyle(element).fontSize;\n if (value != null)\n return parseInt(value, 10);\n return null;\n }\n function lineHeight(element) {\n var parent = element.offsetParent || document.body;\n return fontSize(parent) || fontSize(element) || 16;\n }\n function pageHeight(element) {\n return element.clientHeight; // XXX: should be content height?\n }\n function getDeltaY(event) {\n var deltaY = -event.deltaY;\n if (event.target instanceof HTMLElement) {\n switch (event.deltaMode) {\n case event.DOM_DELTA_LINE:\n deltaY *= lineHeight(event.target);\n break;\n case event.DOM_DELTA_PAGE:\n deltaY *= pageHeight(event.target);\n break;\n }\n }\n return deltaY;\n }\n exports.getDeltaY = getDeltaY;\n}\n","/* core/util/zoom */ function _(require, module, exports) {\n var math_1 = require(31) /* ./math */;\n // Module for zoom-related functions\n function scale_highlow(range, factor, center) {\n var _a = [range.start, range.end], low = _a[0], high = _a[1];\n var x = center != null ? center : (high + low) / 2.0;\n var x0 = low - (low - x) * factor;\n var x1 = high - (high - x) * factor;\n return [x0, x1];\n }\n exports.scale_highlow = scale_highlow;\n function get_info(scales, _a) {\n var sxy0 = _a[0], sxy1 = _a[1];\n var info = {};\n for (var name_1 in scales) {\n var scale = scales[name_1];\n var _b = scale.r_invert(sxy0, sxy1), start = _b[0], end = _b[1];\n info[name_1] = { start: start, end: end };\n }\n return info;\n }\n exports.get_info = get_info;\n function scale_range(frame, factor, h_axis, v_axis, center) {\n /*\n * Utility function for zoom tools to calculate/create the zoom_info object\n * of the form required by ``PlotCanvasView.update_range``\n *\n * Parameters:\n * frame : CartesianFrame\n * factor : Number\n * h_axis : Boolean, optional\n * whether to zoom the horizontal axis (default = true)\n * v_axis : Boolean, optional\n * whether to zoom the horizontal axis (default = true)\n * center : object, optional\n * of form {'x': Number, 'y', Number}\n *\n * Returns:\n * object:\n */\n if (h_axis === void 0) {\n h_axis = true;\n }\n if (v_axis === void 0) {\n v_axis = true;\n }\n // clamp the magnitude of factor, if it is > 1 bad things happen\n factor = math_1.clamp(factor, -0.9, 0.9);\n var hfactor = h_axis ? factor : 0;\n var _a = scale_highlow(frame.bbox.h_range, hfactor, center != null ? center.x : undefined), sx0 = _a[0], sx1 = _a[1];\n var xrs = get_info(frame.xscales, [sx0, sx1]);\n var vfactor = v_axis ? factor : 0;\n var _b = scale_highlow(frame.bbox.v_range, vfactor, center != null ? center.y : undefined), sy0 = _b[0], sy1 = _b[1];\n var yrs = get_info(frame.yscales, [sy0, sy1]);\n // OK this sucks we can't set factor independently in each direction. It is used\n // for GMap plots, and GMap plots always preserve aspect, so effective the value\n // of 'dimensions' is ignored.\n return {\n xrs: xrs,\n yrs: yrs,\n factor: factor,\n };\n }\n exports.scale_range = scale_range;\n}\n","/* core/vectorization */ function _(require, module, exports) {\n var types_1 = require(44) /* core/util/types */;\n function isValue(obj) {\n return types_1.isObject(obj) && \"value\" in obj;\n }\n exports.isValue = isValue;\n function isField(obj) {\n return types_1.isObject(obj) && \"field\" in obj;\n }\n exports.isField = isField;\n}\n","/* core/view */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var signaling_1 = require(19) /* ./signaling */;\n var string_1 = require(38) /* ./util/string */;\n var View = /** @class */ (function (_super) {\n tslib_1.__extends(View, _super);\n function View(options) {\n var _this = _super.call(this) || this;\n _this.removed = new signaling_1.Signal0(_this, \"removed\");\n if (options.model != null)\n _this.model = options.model;\n else\n throw new Error(\"model of a view wasn't configured\");\n _this._parent = options.parent;\n _this.id = options.id || string_1.uniqueId();\n _this.initialize(options);\n if (options.connect_signals !== false)\n _this.connect_signals();\n return _this;\n }\n View.prototype.initialize = function (_options) { };\n View.prototype.remove = function () {\n this._parent = undefined;\n this.disconnect_signals();\n this.removed.emit();\n };\n View.prototype.toString = function () {\n return this.model.type + \"View(\" + this.id + \")\";\n };\n Object.defineProperty(View.prototype, \"parent\", {\n get: function () {\n if (this._parent !== undefined)\n return this._parent;\n else\n throw new Error(\"parent of a view wasn't configured\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(View.prototype, \"is_root\", {\n get: function () {\n return this.parent === null;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(View.prototype, \"root\", {\n get: function () {\n return this.is_root ? this : this.parent.root;\n },\n enumerable: true,\n configurable: true\n });\n View.prototype.connect_signals = function () { };\n View.prototype.disconnect_signals = function () {\n signaling_1.Signal.disconnectReceiver(this);\n };\n View.prototype.notify_finished = function () {\n this.root.notify_finished();\n };\n return View;\n }(signaling_1.Signalable()));\n exports.View = View;\n}\n","/* core/visuals */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var mixins = require(16) /* ./property_mixins */;\n var color_1 = require(27) /* ./util/color */;\n var ContextProperties = /** @class */ (function () {\n function ContextProperties(obj, prefix) {\n if (prefix === void 0) {\n prefix = \"\";\n }\n this.obj = obj;\n this.prefix = prefix;\n // }\n this.cache = {};\n var do_spec = obj.properties[prefix + this.do_attr].spec;\n this.doit = do_spec.value !== null; // XXX: can't be `undefined`, see TODOs below.\n for (var _i = 0, _a = this.attrs; _i < _a.length; _i++) {\n var attr = _a[_i];\n this[attr] = obj.properties[prefix + attr];\n }\n }\n ContextProperties.prototype.warm_cache = function (source) {\n for (var _i = 0, _a = this.attrs; _i < _a.length; _i++) {\n var attr = _a[_i];\n var prop = this.obj.properties[this.prefix + attr];\n if (prop.spec.value !== undefined) // TODO (bev) better test?\n this.cache[attr] = prop.spec.value;\n else if (source != null)\n this.cache[attr + \"_array\"] = prop.array(source);\n else\n throw new Error(\"source is required with a vectorized visual property\");\n }\n };\n ContextProperties.prototype.cache_select = function (attr, i) {\n var prop = this.obj.properties[this.prefix + attr];\n var value;\n if (prop.spec.value !== undefined) // TODO (bev) better test?\n this.cache[attr] = value = prop.spec.value;\n else\n this.cache[attr] = value = this.cache[attr + \"_array\"][i];\n return value;\n };\n ContextProperties.prototype.set_vectorize = function (ctx, i) {\n if (this.all_indices != null) // all_indices is set by a Visuals instance associated with a CDSView\n this._set_vectorize(ctx, this.all_indices[i]);\n else // all_indices is not set for annotations which may have vectorized visual props\n this._set_vectorize(ctx, i);\n };\n return ContextProperties;\n }());\n exports.ContextProperties = ContextProperties;\n var Line = /** @class */ (function (_super) {\n tslib_1.__extends(Line, _super);\n function Line() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Line.prototype.set_value = function (ctx) {\n ctx.strokeStyle = this.line_color.value();\n ctx.globalAlpha = this.line_alpha.value();\n ctx.lineWidth = this.line_width.value();\n ctx.lineJoin = this.line_join.value();\n ctx.lineCap = this.line_cap.value();\n ctx.setLineDash(this.line_dash.value());\n ctx.setLineDashOffset(this.line_dash_offset.value());\n };\n Line.prototype._set_vectorize = function (ctx, i) {\n this.cache_select(\"line_color\", i);\n if (ctx.strokeStyle !== this.cache.line_color)\n ctx.strokeStyle = this.cache.line_color;\n this.cache_select(\"line_alpha\", i);\n if (ctx.globalAlpha !== this.cache.line_alpha)\n ctx.globalAlpha = this.cache.line_alpha;\n this.cache_select(\"line_width\", i);\n if (ctx.lineWidth !== this.cache.line_width)\n ctx.lineWidth = this.cache.line_width;\n this.cache_select(\"line_join\", i);\n if (ctx.lineJoin !== this.cache.line_join)\n ctx.lineJoin = this.cache.line_join;\n this.cache_select(\"line_cap\", i);\n if (ctx.lineCap !== this.cache.line_cap)\n ctx.lineCap = this.cache.line_cap;\n this.cache_select(\"line_dash\", i);\n if (ctx.getLineDash() !== this.cache.line_dash)\n ctx.setLineDash(this.cache.line_dash);\n this.cache_select(\"line_dash_offset\", i);\n if (ctx.getLineDashOffset() !== this.cache.line_dash_offset)\n ctx.setLineDashOffset(this.cache.line_dash_offset);\n };\n Line.prototype.color_value = function () {\n var _a = color_1.color2rgba(this.line_color.value(), this.line_alpha.value()), r = _a[0], g = _a[1], b = _a[2], a = _a[3];\n return \"rgba(\" + r * 255 + \",\" + g * 255 + \",\" + b * 255 + \",\" + a + \")\";\n };\n return Line;\n }(ContextProperties));\n exports.Line = Line;\n Line.prototype.attrs = Object.keys(mixins.line());\n Line.prototype.do_attr = \"line_color\";\n var Fill = /** @class */ (function (_super) {\n tslib_1.__extends(Fill, _super);\n function Fill() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Fill.prototype.set_value = function (ctx) {\n ctx.fillStyle = this.fill_color.value();\n ctx.globalAlpha = this.fill_alpha.value();\n };\n Fill.prototype._set_vectorize = function (ctx, i) {\n this.cache_select(\"fill_color\", i);\n if (ctx.fillStyle !== this.cache.fill_color)\n ctx.fillStyle = this.cache.fill_color;\n this.cache_select(\"fill_alpha\", i);\n if (ctx.globalAlpha !== this.cache.fill_alpha)\n ctx.globalAlpha = this.cache.fill_alpha;\n };\n Fill.prototype.color_value = function () {\n var _a = color_1.color2rgba(this.fill_color.value(), this.fill_alpha.value()), r = _a[0], g = _a[1], b = _a[2], a = _a[3];\n return \"rgba(\" + r * 255 + \",\" + g * 255 + \",\" + b * 255 + \",\" + a + \")\";\n };\n return Fill;\n }(ContextProperties));\n exports.Fill = Fill;\n Fill.prototype.attrs = Object.keys(mixins.fill());\n Fill.prototype.do_attr = \"fill_color\";\n var Text = /** @class */ (function (_super) {\n tslib_1.__extends(Text, _super);\n function Text() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Text.prototype.cache_select = function (name, i) {\n var value;\n if (name == \"font\") {\n _super.prototype.cache_select.call(this, \"text_font_style\", i);\n _super.prototype.cache_select.call(this, \"text_font_size\", i);\n _super.prototype.cache_select.call(this, \"text_font\", i);\n var _a = this.cache, text_font_style = _a.text_font_style, text_font_size = _a.text_font_size, text_font = _a.text_font;\n this.cache.font = value = text_font_style + \" \" + text_font_size + \" \" + text_font;\n }\n else\n value = _super.prototype.cache_select.call(this, name, i);\n return value;\n };\n Text.prototype.font_value = function () {\n var font = this.text_font.value();\n var font_size = this.text_font_size.value();\n var font_style = this.text_font_style.value();\n return font_style + \" \" + font_size + \" \" + font;\n };\n Text.prototype.color_value = function () {\n var _a = color_1.color2rgba(this.text_color.value(), this.text_alpha.value()), r = _a[0], g = _a[1], b = _a[2], a = _a[3];\n return \"rgba(\" + r * 255 + \",\" + g * 255 + \",\" + b * 255 + \",\" + a + \")\";\n };\n Text.prototype.set_value = function (ctx) {\n ctx.font = this.font_value();\n ctx.fillStyle = this.text_color.value();\n ctx.globalAlpha = this.text_alpha.value();\n ctx.textAlign = this.text_align.value();\n ctx.textBaseline = this.text_baseline.value();\n };\n Text.prototype._set_vectorize = function (ctx, i) {\n this.cache_select(\"font\", i);\n if (ctx.font !== this.cache.font)\n ctx.font = this.cache.font;\n this.cache_select(\"text_color\", i);\n if (ctx.fillStyle !== this.cache.text_color)\n ctx.fillStyle = this.cache.text_color;\n this.cache_select(\"text_alpha\", i);\n if (ctx.globalAlpha !== this.cache.text_alpha)\n ctx.globalAlpha = this.cache.text_alpha;\n this.cache_select(\"text_align\", i);\n if (ctx.textAlign !== this.cache.text_align)\n ctx.textAlign = this.cache.text_align;\n this.cache_select(\"text_baseline\", i);\n if (ctx.textBaseline !== this.cache.text_baseline)\n ctx.textBaseline = this.cache.text_baseline;\n };\n return Text;\n }(ContextProperties));\n exports.Text = Text;\n Text.prototype.attrs = Object.keys(mixins.text());\n Text.prototype.do_attr = \"text_color\";\n var Visuals = /** @class */ (function () {\n function Visuals(model) {\n for (var _i = 0, _a = model.mixins; _i < _a.length; _i++) {\n var mixin = _a[_i];\n var _b = mixin.split(\":\"), name_1 = _b[0], _c = _b[1], prefix = _c === void 0 ? \"\" : _c;\n var cls = void 0;\n switch (name_1) {\n case \"line\":\n cls = Line;\n break;\n case \"fill\":\n cls = Fill;\n break;\n case \"text\":\n cls = Text;\n break;\n default:\n throw new Error(\"unknown visual: \" + name_1);\n }\n this[prefix + name_1] = new cls(model, prefix);\n }\n }\n Visuals.prototype.warm_cache = function (source) {\n for (var name_2 in this) {\n if (this.hasOwnProperty(name_2)) {\n var prop = this[name_2];\n if (prop instanceof ContextProperties)\n prop.warm_cache(source);\n }\n }\n };\n Visuals.prototype.set_all_indices = function (all_indices) {\n for (var name_3 in this) {\n if (this.hasOwnProperty(name_3)) {\n var prop = this[name_3];\n if (prop instanceof ContextProperties)\n prop.all_indices = all_indices;\n }\n }\n };\n return Visuals;\n }());\n exports.Visuals = Visuals;\n}\n","/* document/document */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var base_1 = require(0) /* ../base */;\n var version_1 = require(286) /* ../version */;\n var logging_1 = require(14) /* ../core/logging */;\n var bokeh_events_1 = require(3) /* core/bokeh_events */;\n var has_props_1 = require(8) /* core/has_props */;\n var signaling_1 = require(19) /* core/signaling */;\n var refs_1 = require(34) /* core/util/refs */;\n var serialization_1 = require(36) /* core/util/serialization */;\n var data_structures_1 = require(29) /* core/util/data_structures */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var eq_1 = require(30) /* core/util/eq */;\n var types_1 = require(44) /* core/util/types */;\n var layout_dom_1 = require(157) /* models/layouts/layout_dom */;\n var column_data_source_1 = require(200) /* models/sources/column_data_source */;\n var model_1 = require(59) /* model */;\n var events_1 = require(51) /* ./events */;\n var EventManager = /** @class */ (function () {\n function EventManager(document /* Document */) {\n this.document = document;\n // Dispatches events to the subscribed models\n this.session = null;\n this.subscribed_models = new data_structures_1.Set();\n }\n EventManager.prototype.send_event = function (event) {\n // Send message to Python via session\n if (this.session != null)\n this.session.send_event(event);\n };\n EventManager.prototype.trigger = function (event) {\n for (var _i = 0, _a = this.subscribed_models.values; _i < _a.length; _i++) {\n var model_id = _a[_i];\n if (event.model_id != null && event.model_id !== model_id)\n continue;\n var model = this.document._all_models[model_id];\n if (model != null)\n model._process_event(event);\n }\n };\n return EventManager;\n }());\n exports.EventManager = EventManager;\n exports.documents = [];\n exports.DEFAULT_TITLE = \"Bokeh Application\";\n // This class should match the API of the Python Document class\n // as much as possible.\n var Document = /** @class */ (function () {\n function Document() {\n exports.documents.push(this);\n this._init_timestamp = Date.now();\n this._title = exports.DEFAULT_TITLE;\n this._roots = [];\n this._all_models = {};\n this._all_models_by_name = new data_structures_1.MultiDict();\n this._all_models_freeze_count = 0;\n this._callbacks = [];\n this.event_manager = new EventManager(this);\n this.idle = new signaling_1.Signal0(this, \"idle\");\n this._idle_roots = new WeakMap(); // TODO: WeakSet would be better\n this._interactive_timestamp = null;\n this._interactive_plot = null;\n }\n Object.defineProperty(Document.prototype, \"layoutables\", {\n get: function () {\n return this._roots.filter(function (root) { return root instanceof layout_dom_1.LayoutDOM; });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Document.prototype, \"is_idle\", {\n get: function () {\n for (var _i = 0, _a = this.layoutables; _i < _a.length; _i++) {\n var root = _a[_i];\n if (!this._idle_roots.has(root))\n return false;\n }\n return true;\n },\n enumerable: true,\n configurable: true\n });\n Document.prototype.notify_idle = function (model) {\n this._idle_roots.set(model, true);\n if (this.is_idle) {\n logging_1.logger.info(\"document idle at \" + (Date.now() - this._init_timestamp) + \" ms\");\n this.idle.emit();\n }\n };\n Document.prototype.clear = function () {\n this._push_all_models_freeze();\n try {\n while (this._roots.length > 0) {\n this.remove_root(this._roots[0]);\n }\n }\n finally {\n this._pop_all_models_freeze();\n }\n };\n Document.prototype.interactive_start = function (plot) {\n if (this._interactive_plot == null) {\n this._interactive_plot = plot;\n this._interactive_plot.trigger_event(new bokeh_events_1.LODStart({}));\n }\n this._interactive_timestamp = Date.now();\n };\n Document.prototype.interactive_stop = function (plot) {\n if (this._interactive_plot != null && this._interactive_plot.id === plot.id) {\n this._interactive_plot.trigger_event(new bokeh_events_1.LODEnd({}));\n }\n this._interactive_plot = null;\n this._interactive_timestamp = null;\n };\n Document.prototype.interactive_duration = function () {\n if (this._interactive_timestamp == null)\n return -1;\n else\n return Date.now() - this._interactive_timestamp;\n };\n Document.prototype.destructively_move = function (dest_doc) {\n if (dest_doc === this) {\n throw new Error(\"Attempted to overwrite a document with itself\");\n }\n dest_doc.clear();\n // we have to remove ALL roots before adding any\n // to the new doc or else models referenced from multiple\n // roots could be in both docs at once, which isn't allowed.\n var roots = array_1.copy(this._roots);\n this.clear();\n for (var _i = 0, roots_1 = roots; _i < roots_1.length; _i++) {\n var root = roots_1[_i];\n if (root.document != null)\n throw new Error(\"Somehow we didn't detach \" + root);\n }\n if (Object.keys(this._all_models).length !== 0) {\n throw new Error(\"this._all_models still had stuff in it: \" + this._all_models);\n }\n for (var _a = 0, roots_2 = roots; _a < roots_2.length; _a++) {\n var root = roots_2[_a];\n dest_doc.add_root(root);\n }\n dest_doc.set_title(this._title);\n };\n // TODO other fields of doc\n Document.prototype._push_all_models_freeze = function () {\n this._all_models_freeze_count += 1;\n };\n Document.prototype._pop_all_models_freeze = function () {\n this._all_models_freeze_count -= 1;\n if (this._all_models_freeze_count === 0) {\n this._recompute_all_models();\n }\n };\n /*protected*/ Document.prototype._invalidate_all_models = function () {\n logging_1.logger.debug(\"invalidating document models\");\n // if freeze count is > 0, we'll recompute on unfreeze\n if (this._all_models_freeze_count === 0) {\n this._recompute_all_models();\n }\n };\n Document.prototype._recompute_all_models = function () {\n var new_all_models_set = new data_structures_1.Set();\n for (var _i = 0, _a = this._roots; _i < _a.length; _i++) {\n var r = _a[_i];\n new_all_models_set = new_all_models_set.union(r.references());\n }\n var old_all_models_set = new data_structures_1.Set(object_1.values(this._all_models));\n var to_detach = old_all_models_set.diff(new_all_models_set);\n var to_attach = new_all_models_set.diff(old_all_models_set);\n var recomputed = {};\n for (var _b = 0, _c = new_all_models_set.values; _b < _c.length; _b++) {\n var m = _c[_b];\n recomputed[m.id] = m;\n }\n for (var _d = 0, _e = to_detach.values; _d < _e.length; _d++) {\n var d = _e[_d];\n d.detach_document();\n if (d instanceof model_1.Model && d.name != null)\n this._all_models_by_name.remove_value(d.name, d);\n }\n for (var _f = 0, _g = to_attach.values; _f < _g.length; _f++) {\n var a = _g[_f];\n a.attach_document(this);\n if (a instanceof model_1.Model && a.name != null)\n this._all_models_by_name.add_value(a.name, a);\n }\n this._all_models = recomputed;\n };\n Document.prototype.roots = function () {\n return this._roots;\n };\n Document.prototype.add_root = function (model, setter_id) {\n logging_1.logger.debug(\"Adding root: \" + model);\n if (array_1.includes(this._roots, model))\n return;\n this._push_all_models_freeze();\n try {\n this._roots.push(model);\n }\n finally {\n this._pop_all_models_freeze();\n }\n this._trigger_on_change(new events_1.RootAddedEvent(this, model, setter_id));\n };\n Document.prototype.remove_root = function (model, setter_id) {\n var i = this._roots.indexOf(model);\n if (i < 0)\n return;\n this._push_all_models_freeze();\n try {\n this._roots.splice(i, 1);\n }\n finally {\n this._pop_all_models_freeze();\n }\n this._trigger_on_change(new events_1.RootRemovedEvent(this, model, setter_id));\n };\n Document.prototype.title = function () {\n return this._title;\n };\n Document.prototype.set_title = function (title, setter_id) {\n if (title !== this._title) {\n this._title = title;\n this._trigger_on_change(new events_1.TitleChangedEvent(this, title, setter_id));\n }\n };\n Document.prototype.get_model_by_id = function (model_id) {\n if (model_id in this._all_models) {\n return this._all_models[model_id];\n }\n else {\n return null;\n }\n };\n Document.prototype.get_model_by_name = function (name) {\n return this._all_models_by_name.get_one(name, \"Multiple models are named '\" + name + \"'\");\n };\n Document.prototype.on_change = function (callback) {\n if (!array_1.includes(this._callbacks, callback))\n this._callbacks.push(callback);\n };\n Document.prototype.remove_on_change = function (callback) {\n var i = this._callbacks.indexOf(callback);\n if (i >= 0)\n this._callbacks.splice(i, 1);\n };\n Document.prototype._trigger_on_change = function (event) {\n for (var _i = 0, _a = this._callbacks; _i < _a.length; _i++) {\n var cb = _a[_i];\n cb(event);\n }\n };\n // called by the model\n Document.prototype._notify_change = function (model, attr, old, new_, options) {\n if (attr === 'name') {\n this._all_models_by_name.remove_value(old, model);\n if (new_ != null)\n this._all_models_by_name.add_value(new_, model);\n }\n var setter_id = options != null ? options.setter_id : void 0;\n var hint = options != null ? options.hint : void 0;\n this._trigger_on_change(new events_1.ModelChangedEvent(this, model, attr, old, new_, setter_id, hint));\n };\n Document._references_json = function (references, include_defaults) {\n if (include_defaults === void 0) {\n include_defaults = true;\n }\n var references_json = [];\n for (var _i = 0, references_1 = references; _i < references_1.length; _i++) {\n var r = references_1[_i];\n var ref = r.ref();\n ref.attributes = r.attributes_as_json(include_defaults);\n // server doesn't want id in here since it's already in ref above\n delete ref.attributes.id;\n references_json.push(ref);\n }\n return references_json;\n };\n Document._instantiate_object = function (obj_id, obj_type, obj_attrs) {\n var full_attrs = tslib_1.__assign({}, obj_attrs, { id: obj_id, __deferred__: true });\n var model = base_1.Models(obj_type);\n return new model(full_attrs);\n };\n // given a JSON representation of all models in a graph, return a\n // dict of new model objects\n Document._instantiate_references_json = function (references_json, existing_models) {\n // Create all instances, but without setting their props\n var references = {};\n for (var _i = 0, references_json_1 = references_json; _i < references_json_1.length; _i++) {\n var obj = references_json_1[_i];\n var obj_id = obj.id;\n var obj_type = obj.type;\n var obj_attrs = obj.attributes || {};\n var instance = void 0;\n if (obj_id in existing_models)\n instance = existing_models[obj_id];\n else {\n instance = Document._instantiate_object(obj_id, obj_type, obj_attrs);\n if (obj.subtype != null)\n instance.set_subtype(obj.subtype);\n }\n references[instance.id] = instance;\n }\n return references;\n };\n // if v looks like a ref, or a collection, resolve it, otherwise return it unchanged\n // recurse into collections but not into HasProps\n Document._resolve_refs = function (value, old_references, new_references) {\n function resolve_ref(v) {\n if (refs_1.is_ref(v)) {\n if (v.id in old_references)\n return old_references[v.id];\n else if (v.id in new_references)\n return new_references[v.id];\n else\n throw new Error(\"reference \" + JSON.stringify(v) + \" isn't known (not in Document?)\");\n }\n else if (types_1.isArray(v))\n return resolve_array(v);\n else if (types_1.isPlainObject(v))\n return resolve_dict(v);\n else\n return v;\n }\n function resolve_array(array) {\n var results = [];\n for (var _i = 0, array_2 = array; _i < array_2.length; _i++) {\n var v = array_2[_i];\n results.push(resolve_ref(v));\n }\n return results;\n }\n function resolve_dict(dict) {\n var resolved = {};\n for (var k in dict) {\n var v = dict[k];\n resolved[k] = resolve_ref(v);\n }\n return resolved;\n }\n return resolve_ref(value);\n };\n // given a JSON representation of all models in a graph and new\n // model instances, set the properties on the models from the\n // JSON\n Document._initialize_references_json = function (references_json, old_references, new_references) {\n var to_update = {};\n for (var _i = 0, references_json_2 = references_json; _i < references_json_2.length; _i++) {\n var obj = references_json_2[_i];\n var obj_id = obj.id;\n var obj_attrs = obj.attributes;\n var was_new = !(obj_id in old_references);\n var instance = !was_new ? old_references[obj_id] : new_references[obj_id];\n // replace references with actual instances in obj_attrs\n var resolved_attrs = Document._resolve_refs(obj_attrs, old_references, new_references);\n to_update[instance.id] = [instance, resolved_attrs, was_new];\n }\n function foreach_depth_first(items, f) {\n var already_started = {};\n function foreach_value(v) {\n if (v instanceof has_props_1.HasProps) {\n // note that we ignore instances that aren't updated (not in to_update)\n if (!(v.id in already_started) && v.id in items) {\n already_started[v.id] = true;\n var _a = items[v.id], attrs = _a[1], was_new = _a[2];\n for (var a in attrs) {\n var e = attrs[a];\n foreach_value(e);\n }\n f(v, attrs, was_new);\n }\n }\n else if (types_1.isArray(v)) {\n for (var _i = 0, v_1 = v; _i < v_1.length; _i++) {\n var e = v_1[_i];\n foreach_value(e);\n }\n }\n else if (types_1.isPlainObject(v)) {\n for (var k in v) {\n var e = v[k];\n foreach_value(e);\n }\n }\n }\n for (var k in items) {\n var _a = items[k], instance = _a[0];\n foreach_value(instance);\n }\n }\n // this first pass removes all 'refs' replacing them with real instances\n foreach_depth_first(to_update, function (instance, attrs, was_new) {\n if (was_new)\n instance.setv(attrs, { silent: true });\n });\n // after removing all the refs, we can run the initialize code safely\n foreach_depth_first(to_update, function (instance, _attrs, was_new) {\n if (was_new)\n instance.finalize();\n });\n };\n Document._event_for_attribute_change = function (changed_obj, key, new_value, doc, value_refs) {\n var changed_model = doc.get_model_by_id(changed_obj.id); // XXX!\n if (!changed_model.attribute_is_serializable(key))\n return null;\n else {\n var event_1 = {\n kind: \"ModelChanged\",\n model: {\n id: changed_obj.id,\n type: changed_obj.type,\n },\n attr: key,\n new: new_value,\n };\n has_props_1.HasProps._json_record_references(doc, new_value, value_refs, true); // true = recurse\n return event_1;\n }\n };\n Document._events_to_sync_objects = function (from_obj, to_obj, to_doc, value_refs) {\n var from_keys = Object.keys(from_obj.attributes); //XXX!\n var to_keys = Object.keys(to_obj.attributes); //XXX!\n var removed = array_1.difference(from_keys, to_keys);\n var added = array_1.difference(to_keys, from_keys);\n var shared = array_1.intersection(from_keys, to_keys);\n var events = [];\n for (var _i = 0, removed_1 = removed; _i < removed_1.length; _i++) {\n var key = removed_1[_i];\n // we don't really have a \"remove\" event - not sure this ever\n // happens even. One way this could happen is if the server\n // does include_defaults=True and we do\n // include_defaults=false ... in that case it'd be best to\n // just ignore this probably. Warn about it, could mean\n // there's a bug if we don't have a key that the server sent.\n logging_1.logger.warn(\"Server sent key \" + key + \" but we don't seem to have it in our JSON\");\n }\n for (var _a = 0, added_1 = added; _a < added_1.length; _a++) {\n var key = added_1[_a];\n var new_value = to_obj.attributes[key]; // XXX!\n events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n }\n for (var _b = 0, shared_1 = shared; _b < shared_1.length; _b++) {\n var key = shared_1[_b];\n var old_value = from_obj.attributes[key]; // XXX!\n var new_value = to_obj.attributes[key]; // XXX!\n if (old_value == null && new_value == null) {\n }\n else if (old_value == null || new_value == null) {\n events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n }\n else {\n if (!eq_1.isEqual(old_value, new_value))\n events.push(Document._event_for_attribute_change(from_obj, key, new_value, to_doc, value_refs));\n }\n }\n return events.filter(function (e) { return e != null; });\n };\n // we use this to detect changes during document deserialization\n // (in model constructors and initializers)\n Document._compute_patch_since_json = function (from_json, to_doc) {\n var to_json = to_doc.to_json(false); // include_defaults=false\n function refs(json) {\n var result = {};\n for (var _i = 0, _a = json.roots.references; _i < _a.length; _i++) {\n var obj = _a[_i];\n result[obj.id] = obj;\n }\n return result;\n }\n var from_references = refs(from_json);\n var from_roots = {};\n var from_root_ids = [];\n for (var _i = 0, _a = from_json.roots.root_ids; _i < _a.length; _i++) {\n var r = _a[_i];\n from_roots[r] = from_references[r];\n from_root_ids.push(r);\n }\n var to_references = refs(to_json);\n var to_roots = {};\n var to_root_ids = [];\n for (var _b = 0, _c = to_json.roots.root_ids; _b < _c.length; _b++) {\n var r = _c[_b];\n to_roots[r] = to_references[r];\n to_root_ids.push(r);\n }\n from_root_ids.sort();\n to_root_ids.sort();\n if (array_1.difference(from_root_ids, to_root_ids).length > 0 ||\n array_1.difference(to_root_ids, from_root_ids).length > 0) {\n // this would arise if someone does add_root/remove_root during\n // document deserialization, hopefully they won't ever do so.\n throw new Error(\"Not implemented: computing add/remove of document roots\");\n }\n var value_refs = {};\n var events = [];\n for (var id in to_doc._all_models) {\n if (id in from_references) {\n var update_model_events = Document._events_to_sync_objects(from_references[id], to_references[id], to_doc, value_refs);\n events = events.concat(update_model_events);\n }\n }\n return {\n references: Document._references_json(object_1.values(value_refs), false),\n events: events,\n };\n };\n Document.prototype.to_json_string = function (include_defaults) {\n if (include_defaults === void 0) {\n include_defaults = true;\n }\n return JSON.stringify(this.to_json(include_defaults));\n };\n Document.prototype.to_json = function (include_defaults) {\n if (include_defaults === void 0) {\n include_defaults = true;\n }\n var root_ids = this._roots.map(function (r) { return r.id; });\n var root_references = object_1.values(this._all_models);\n return {\n version: version_1.version,\n title: this._title,\n roots: {\n root_ids: root_ids,\n references: Document._references_json(root_references, include_defaults),\n },\n };\n };\n Document.from_json_string = function (s) {\n var json = JSON.parse(s);\n return Document.from_json(json);\n };\n Document.from_json = function (json) {\n logging_1.logger.debug(\"Creating Document from JSON\");\n var py_version = json.version; // XXX!\n var is_dev = py_version.indexOf('+') !== -1 || py_version.indexOf('-') !== -1;\n var versions_string = \"Library versions: JS (\" + version_1.version + \") / Python (\" + py_version + \")\";\n if (!is_dev && version_1.version !== py_version) {\n logging_1.logger.warn(\"JS/Python version mismatch\");\n logging_1.logger.warn(versions_string);\n }\n else\n logging_1.logger.debug(versions_string);\n var roots_json = json.roots;\n var root_ids = roots_json.root_ids;\n var references_json = roots_json.references;\n var references = Document._instantiate_references_json(references_json, {});\n Document._initialize_references_json(references_json, {}, references);\n var doc = new Document();\n for (var _i = 0, root_ids_1 = root_ids; _i < root_ids_1.length; _i++) {\n var r = root_ids_1[_i];\n doc.add_root(references[r]);\n } // XXX: HasProps\n doc.set_title(json.title); // XXX!\n return doc;\n };\n Document.prototype.replace_with_json = function (json) {\n var replacement = Document.from_json(json);\n replacement.destructively_move(this);\n };\n Document.prototype.create_json_patch_string = function (events) {\n return JSON.stringify(this.create_json_patch(events));\n };\n Document.prototype.create_json_patch = function (events) {\n var references = {};\n var json_events = [];\n for (var _i = 0, events_2 = events; _i < events_2.length; _i++) {\n var event_2 = events_2[_i];\n if (event_2.document !== this) {\n logging_1.logger.warn(\"Cannot create a patch using events from a different document, event had \", event_2.document, \" we are \", this);\n throw new Error(\"Cannot create a patch using events from a different document\");\n }\n json_events.push(event_2.json(references));\n }\n return {\n events: json_events,\n references: Document._references_json(object_1.values(references)),\n };\n };\n Document.prototype.apply_json_patch = function (patch, buffers, setter_id) {\n var _a;\n var references_json = patch.references;\n var events_json = patch.events;\n var references = Document._instantiate_references_json(references_json, this._all_models);\n // The model being changed isn't always in references so add it in\n for (var _i = 0, events_json_1 = events_json; _i < events_json_1.length; _i++) {\n var event_json = events_json_1[_i];\n switch (event_json.kind) {\n case \"RootAdded\":\n case \"RootRemoved\":\n case \"ModelChanged\": {\n var model_id = event_json.model.id;\n if (model_id in this._all_models) {\n references[model_id] = this._all_models[model_id];\n }\n else {\n if (!(model_id in references)) {\n logging_1.logger.warn(\"Got an event for unknown model \", event_json.model);\n throw new Error(\"event model wasn't known\");\n }\n }\n break;\n }\n }\n }\n // split references into old and new so we know whether to initialize or update\n var old_references = {};\n var new_references = {};\n for (var id in references) {\n var value = references[id];\n if (id in this._all_models)\n old_references[id] = value;\n else\n new_references[id] = value;\n }\n Document._initialize_references_json(references_json, old_references, new_references);\n for (var _b = 0, events_json_2 = events_json; _b < events_json_2.length; _b++) {\n var event_json = events_json_2[_b];\n switch (event_json.kind) {\n case 'ModelChanged': {\n var patched_id = event_json.model.id;\n if (!(patched_id in this._all_models)) {\n throw new Error(\"Cannot apply patch to \" + patched_id + \" which is not in the document\");\n }\n var patched_obj = this._all_models[patched_id];\n var attr = event_json.attr;\n var model_type = event_json.model.type;\n // XXXX currently still need this first branch, some updates (initial?) go through here\n if (attr === 'data' && model_type === 'ColumnDataSource') {\n var _c = serialization_1.decode_column_data(event_json.new, buffers), data = _c[0], shapes = _c[1];\n patched_obj.setv({ _shapes: shapes, data: data }, { setter_id: setter_id });\n }\n else {\n var value = Document._resolve_refs(event_json.new, old_references, new_references);\n patched_obj.setv((_a = {}, _a[attr] = value, _a), { setter_id: setter_id });\n }\n break;\n }\n case 'ColumnDataChanged': {\n var column_source_id = event_json.column_source.id;\n if (!(column_source_id in this._all_models)) {\n throw new Error(\"Cannot stream to \" + column_source_id + \" which is not in the document\");\n }\n var column_source = this._all_models[column_source_id];\n var _d = serialization_1.decode_column_data(event_json.new, buffers), data = _d[0], shapes = _d[1];\n if (event_json.cols != null) {\n for (var k in column_source.data) {\n if (!(k in data)) {\n data[k] = column_source.data[k];\n }\n }\n for (var k in column_source._shapes) {\n if (!(k in shapes)) {\n shapes[k] = column_source._shapes[k];\n }\n }\n }\n column_source.setv({\n _shapes: shapes,\n data: data,\n }, {\n setter_id: setter_id,\n check_eq: false,\n });\n break;\n }\n case 'ColumnsStreamed': {\n var column_source_id = event_json.column_source.id;\n if (!(column_source_id in this._all_models)) {\n throw new Error(\"Cannot stream to \" + column_source_id + \" which is not in the document\");\n }\n var column_source = this._all_models[column_source_id];\n if (!(column_source instanceof column_data_source_1.ColumnDataSource)) {\n throw new Error(\"Cannot stream to non-ColumnDataSource\");\n }\n var data = event_json.data;\n var rollover = event_json.rollover;\n column_source.stream(data, rollover, setter_id);\n break;\n }\n case 'ColumnsPatched': {\n var column_source_id = event_json.column_source.id;\n if (!(column_source_id in this._all_models)) {\n throw new Error(\"Cannot patch \" + column_source_id + \" which is not in the document\");\n }\n var column_source = this._all_models[column_source_id];\n if (!(column_source instanceof column_data_source_1.ColumnDataSource)) {\n throw new Error(\"Cannot patch non-ColumnDataSource\");\n }\n var patches = event_json.patches;\n column_source.patch(patches, setter_id);\n break;\n }\n case 'RootAdded': {\n var root_id = event_json.model.id;\n var root_obj = references[root_id];\n this.add_root(root_obj, setter_id); // XXX: HasProps\n break;\n }\n case 'RootRemoved': {\n var root_id = event_json.model.id;\n var root_obj = references[root_id];\n this.remove_root(root_obj, setter_id); // XXX: HasProps\n break;\n }\n case 'TitleChanged': {\n this.set_title(event_json.title, setter_id);\n break;\n }\n default:\n throw new Error(\"Unknown patch event \" + JSON.stringify(event_json));\n }\n }\n };\n return Document;\n }());\n exports.Document = Document;\n}\n","/* document/events */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var has_props_1 = require(8) /* core/has_props */;\n var DocumentChangedEvent = /** @class */ (function () {\n function DocumentChangedEvent(document) {\n this.document = document;\n }\n return DocumentChangedEvent;\n }());\n exports.DocumentChangedEvent = DocumentChangedEvent;\n var ModelChangedEvent = /** @class */ (function (_super) {\n tslib_1.__extends(ModelChangedEvent, _super);\n function ModelChangedEvent(document, model, attr, old, new_, setter_id, hint) {\n var _this = _super.call(this, document) || this;\n _this.model = model;\n _this.attr = attr;\n _this.old = old;\n _this.new_ = new_;\n _this.setter_id = setter_id;\n _this.hint = hint;\n return _this;\n }\n ModelChangedEvent.prototype.json = function (references) {\n if (this.attr === \"id\") {\n throw new Error(\"'id' field should never change, whatever code just set it is wrong\");\n }\n if (this.hint != null)\n return this.hint.json(references);\n var value = this.new_;\n var value_json = has_props_1.HasProps._value_to_json(this.attr, value, this.model);\n var value_refs = {};\n has_props_1.HasProps._value_record_references(value, value_refs, true); // true = recurse\n if (this.model.id in value_refs && this.model !== value) {\n // we know we don't want a whole new copy of the obj we're\n // patching unless it's also the value itself\n delete value_refs[this.model.id];\n }\n for (var id in value_refs) {\n references[id] = value_refs[id];\n }\n return {\n kind: \"ModelChanged\",\n model: this.model.ref(),\n attr: this.attr,\n new: value_json,\n };\n };\n return ModelChangedEvent;\n }(DocumentChangedEvent));\n exports.ModelChangedEvent = ModelChangedEvent;\n var ColumnsPatchedEvent = /** @class */ (function (_super) {\n tslib_1.__extends(ColumnsPatchedEvent, _super);\n function ColumnsPatchedEvent(document, column_source, patches) {\n var _this = _super.call(this, document) || this;\n _this.column_source = column_source;\n _this.patches = patches;\n return _this;\n }\n ColumnsPatchedEvent.prototype.json = function (_references) {\n return {\n kind: \"ColumnsPatched\",\n column_source: this.column_source,\n patches: this.patches,\n };\n };\n return ColumnsPatchedEvent;\n }(DocumentChangedEvent));\n exports.ColumnsPatchedEvent = ColumnsPatchedEvent;\n var ColumnsStreamedEvent = /** @class */ (function (_super) {\n tslib_1.__extends(ColumnsStreamedEvent, _super);\n function ColumnsStreamedEvent(document, column_source, data, rollover) {\n var _this = _super.call(this, document) || this;\n _this.column_source = column_source;\n _this.data = data;\n _this.rollover = rollover;\n return _this;\n }\n ColumnsStreamedEvent.prototype.json = function (_references) {\n return {\n kind: \"ColumnsStreamed\",\n column_source: this.column_source,\n data: this.data,\n rollover: this.rollover,\n };\n };\n return ColumnsStreamedEvent;\n }(DocumentChangedEvent));\n exports.ColumnsStreamedEvent = ColumnsStreamedEvent;\n var TitleChangedEvent = /** @class */ (function (_super) {\n tslib_1.__extends(TitleChangedEvent, _super);\n function TitleChangedEvent(document, title, setter_id) {\n var _this = _super.call(this, document) || this;\n _this.title = title;\n _this.setter_id = setter_id;\n return _this;\n }\n TitleChangedEvent.prototype.json = function (_references) {\n return {\n kind: \"TitleChanged\",\n title: this.title,\n };\n };\n return TitleChangedEvent;\n }(DocumentChangedEvent));\n exports.TitleChangedEvent = TitleChangedEvent;\n var RootAddedEvent = /** @class */ (function (_super) {\n tslib_1.__extends(RootAddedEvent, _super);\n function RootAddedEvent(document, model, setter_id) {\n var _this = _super.call(this, document) || this;\n _this.model = model;\n _this.setter_id = setter_id;\n return _this;\n }\n RootAddedEvent.prototype.json = function (references) {\n has_props_1.HasProps._value_record_references(this.model, references, true);\n return {\n kind: \"RootAdded\",\n model: this.model.ref(),\n };\n };\n return RootAddedEvent;\n }(DocumentChangedEvent));\n exports.RootAddedEvent = RootAddedEvent;\n var RootRemovedEvent = /** @class */ (function (_super) {\n tslib_1.__extends(RootRemovedEvent, _super);\n function RootRemovedEvent(document, model, setter_id) {\n var _this = _super.call(this, document) || this;\n _this.model = model;\n _this.setter_id = setter_id;\n return _this;\n }\n RootRemovedEvent.prototype.json = function (_references) {\n return {\n kind: \"RootRemoved\",\n model: this.model.ref(),\n };\n };\n return RootRemovedEvent;\n }(DocumentChangedEvent));\n exports.RootRemovedEvent = RootRemovedEvent;\n}\n","/* document/index */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n tslib_1.__exportStar(require(50) /* ./document */, exports);\n tslib_1.__exportStar(require(51) /* ./events */, exports);\n}\n","/* embed/dom */ function _(require, module, exports) {\n var dom_1 = require(5) /* ../core/dom */;\n // Matches Bokeh CSS class selector. Setting all Bokeh parent element class names\n // with this var prevents user configurations where css styling is unset.\n exports.BOKEH_ROOT = \"bk-root\";\n function inject_css(url) {\n var element = dom_1.link({ href: url, rel: \"stylesheet\", type: \"text/css\" });\n document.body.appendChild(element);\n }\n exports.inject_css = inject_css;\n function inject_raw_css(css) {\n var element = dom_1.style({}, css);\n document.body.appendChild(element);\n }\n exports.inject_raw_css = inject_raw_css;\n function _get_element(elementid) {\n var element = document.getElementById(elementid);\n if (element == null)\n throw new Error(\"Error rendering Bokeh model: could not find #\" + elementid + \" HTML tag\");\n if (!document.body.contains(element))\n throw new Error(\"Error rendering Bokeh model: element #\" + elementid + \" must be under \");\n // If autoload script, replace script tag with div for embedding.\n if (element.tagName == \"SCRIPT\") {\n var root_el = dom_1.div({ class: exports.BOKEH_ROOT });\n dom_1.replaceWith(element, root_el);\n element = root_el;\n }\n return element;\n }\n function _resolve_element(item) {\n var elementid = item.elementid;\n if (elementid != null)\n return _get_element(elementid);\n else\n return document.body;\n }\n exports._resolve_element = _resolve_element;\n function _resolve_root_elements(item) {\n var roots = {};\n if (item.roots != null) {\n for (var root_id in item.roots)\n roots[root_id] = _get_element(item.roots[root_id]);\n }\n return roots;\n }\n exports._resolve_root_elements = _resolve_root_elements;\n}\n","/* embed/index */ function _(require, module, exports) {\n var document_1 = require(52) /* ../document */;\n var logging_1 = require(14) /* ../core/logging */;\n var callback_1 = require(25) /* ../core/util/callback */;\n var string_1 = require(38) /* ../core/util/string */;\n var types_1 = require(44) /* ../core/util/types */;\n var standalone_1 = require(57) /* ./standalone */;\n var server_1 = require(56) /* ./server */;\n var dom_1 = require(53) /* ./dom */;\n var standalone_2 = require(57) /* ./standalone */;\n exports.add_document_standalone = standalone_2.add_document_standalone;\n var server_2 = require(56) /* ./server */;\n exports.add_document_from_session = server_2.add_document_from_session;\n var notebook_1 = require(55) /* ./notebook */;\n exports.embed_items_notebook = notebook_1.embed_items_notebook;\n exports.kernels = notebook_1.kernels;\n var dom_2 = require(53) /* ./dom */;\n exports.BOKEH_ROOT = dom_2.BOKEH_ROOT;\n exports.inject_css = dom_2.inject_css;\n exports.inject_raw_css = dom_2.inject_raw_css;\n function embed_item(item, target_id) {\n var _a;\n var docs_json = {};\n var doc_id = string_1.uuid4();\n docs_json[doc_id] = item.doc;\n if (target_id == null)\n target_id = item.target_id;\n var roots = (_a = {}, _a[item.root_id] = target_id, _a);\n var render_item = { roots: roots, docid: doc_id };\n callback_1.defer(function () { return _embed_items(docs_json, [render_item]); });\n }\n exports.embed_item = embed_item;\n // TODO (bev) this is currently clunky. Standalone embeds only provide\n // the first two args, whereas server provide the app_app, and *may* prove and\n // absolute_url as well if non-relative links are needed for resources. This function\n // should probably be split in to two pieces to reflect the different usage patterns\n function embed_items(docs_json, render_items, app_path, absolute_url) {\n callback_1.defer(function () { return _embed_items(docs_json, render_items, app_path, absolute_url); });\n }\n exports.embed_items = embed_items;\n function _embed_items(docs_json, render_items, app_path, absolute_url) {\n if (types_1.isString(docs_json))\n docs_json = JSON.parse(string_1.unescape(docs_json));\n var docs = {};\n for (var docid in docs_json) {\n var doc_json = docs_json[docid];\n docs[docid] = document_1.Document.from_json(doc_json);\n }\n for (var _i = 0, render_items_1 = render_items; _i < render_items_1.length; _i++) {\n var item = render_items_1[_i];\n var element = dom_1._resolve_element(item);\n var roots = dom_1._resolve_root_elements(item);\n if (item.docid != null) {\n standalone_1.add_document_standalone(docs[item.docid], element, roots, item.use_for_title);\n }\n else if (item.sessionid != null) {\n var websocket_url = server_1._get_ws_url(app_path, absolute_url);\n logging_1.logger.debug(\"embed: computed ws url: \" + websocket_url);\n var promise = server_1.add_document_from_session(websocket_url, item.sessionid, element, roots, item.use_for_title);\n promise.then(function () {\n console.log(\"Bokeh items were rendered successfully\");\n }, function (error) {\n console.log(\"Error rendering Bokeh items:\", error);\n });\n }\n else\n throw new Error(\"Error rendering Bokeh items: either 'docid' or 'sessionid' was expected.\");\n }\n }\n}\n","/* embed/notebook */ function _(require, module, exports) {\n var document_1 = require(52) /* ../document */;\n var receiver_1 = require(283) /* ../protocol/receiver */;\n var logging_1 = require(14) /* ../core/logging */;\n var object_1 = require(32) /* ../core/util/object */;\n var standalone_1 = require(57) /* ./standalone */;\n var dom_1 = require(53) /* ./dom */;\n // This exists to allow the jupyterlab_bokeh extension to store the\n // notebook kernel so that _init_comms can register the comms target.\n // This has to be available at window.Bokeh.embed.kernels in JupyterLab\n exports.kernels = {};\n function _handle_notebook_comms(receiver, comm_msg) {\n if (comm_msg.buffers.length > 0)\n receiver.consume(comm_msg.buffers[0].buffer);\n else\n receiver.consume(comm_msg.content.data);\n var msg = receiver.message;\n if (msg != null)\n this.apply_json_patch(msg.content, msg.buffers);\n }\n function _init_comms(target, doc) {\n if (typeof Jupyter !== 'undefined' && Jupyter.notebook.kernel != null) {\n logging_1.logger.info(\"Registering Jupyter comms for target \" + target);\n var comm_manager = Jupyter.notebook.kernel.comm_manager;\n try {\n comm_manager.register_target(target, function (comm) {\n logging_1.logger.info(\"Registering Jupyter comms for target \" + target);\n var r = new receiver_1.Receiver();\n comm.on_msg(_handle_notebook_comms.bind(doc, r));\n });\n }\n catch (e) {\n logging_1.logger.warn(\"Jupyter comms failed to register. push_notebook() will not function. (exception reported: \" + e + \")\");\n }\n }\n else if (doc.roots()[0].id in exports.kernels) {\n logging_1.logger.info(\"Registering JupyterLab comms for target \" + target);\n var kernel = exports.kernels[doc.roots()[0].id];\n try {\n kernel.registerCommTarget(target, function (comm) {\n logging_1.logger.info(\"Registering JupyterLab comms for target \" + target);\n var r = new receiver_1.Receiver();\n comm.onMsg = _handle_notebook_comms.bind(doc, r);\n });\n }\n catch (e) {\n logging_1.logger.warn(\"Jupyter comms failed to register. push_notebook() will not function. (exception reported: \" + e + \")\");\n }\n }\n else {\n console.warn(\"Jupyter notebooks comms not available. push_notebook() will not function. If running JupyterLab ensure the latest jupyterlab_bokeh extension is installed. In an exported notebook this warning is expected.\");\n }\n }\n function embed_items_notebook(docs_json, render_items) {\n if (object_1.size(docs_json) != 1)\n throw new Error(\"embed_items_notebook expects exactly one document in docs_json\");\n var document = document_1.Document.from_json(object_1.values(docs_json)[0]);\n for (var _i = 0, render_items_1 = render_items; _i < render_items_1.length; _i++) {\n var item = render_items_1[_i];\n if (item.notebook_comms_target != null)\n _init_comms(item.notebook_comms_target, document);\n var element = dom_1._resolve_element(item);\n var roots = dom_1._resolve_root_elements(item);\n standalone_1.add_document_standalone(document, element, roots);\n }\n }\n exports.embed_items_notebook = embed_items_notebook;\n}\n","/* embed/server */ function _(require, module, exports) {\n var connection_1 = require(1) /* ../client/connection */;\n var logging_1 = require(14) /* ../core/logging */;\n var standalone_1 = require(57) /* ./standalone */;\n // @internal\n function _get_ws_url(app_path, absolute_url) {\n var protocol = 'ws:';\n if (window.location.protocol == 'https:')\n protocol = 'wss:';\n var loc;\n if (absolute_url != null) {\n loc = document.createElement('a');\n loc.href = absolute_url;\n }\n else\n loc = window.location;\n if (app_path != null) {\n if (app_path == \"/\")\n app_path = \"\";\n }\n else\n app_path = loc.pathname.replace(/\\/+$/, '');\n return protocol + '//' + loc.host + app_path + '/ws';\n }\n exports._get_ws_url = _get_ws_url;\n // map { websocket url to map { session id to promise of ClientSession } }\n var _sessions = {};\n function _get_session(websocket_url, session_id, args_string) {\n if (!(websocket_url in _sessions))\n _sessions[websocket_url] = {};\n var subsessions = _sessions[websocket_url];\n if (!(session_id in subsessions))\n subsessions[session_id] = connection_1.pull_session(websocket_url, session_id, args_string);\n return subsessions[session_id];\n }\n // Fill element with the roots from session_id\n function add_document_from_session(websocket_url, session_id, element, roots, use_for_title) {\n if (roots === void 0) {\n roots = {};\n }\n if (use_for_title === void 0) {\n use_for_title = false;\n }\n var args_string = window.location.search.substr(1);\n var promise = _get_session(websocket_url, session_id, args_string);\n return promise.then(function (session) {\n return standalone_1.add_document_standalone(session.document, element, roots, use_for_title);\n }, function (error) {\n logging_1.logger.error(\"Failed to load Bokeh session \" + session_id + \": \" + error);\n throw error;\n });\n }\n exports.add_document_from_session = add_document_from_session;\n}\n","/* embed/standalone */ function _(require, module, exports) {\n var document_1 = require(52) /* ../document */;\n var dom_1 = require(5) /* ../core/dom */;\n var base = require(0) /* ../base */;\n var dom_2 = require(53) /* ./dom */;\n function _create_view(model) {\n var view = new model.default_view({ model: model, parent: null });\n base.index[model.id] = view;\n return view;\n }\n function add_document_standalone(document, element, roots, use_for_title) {\n if (roots === void 0) {\n roots = {};\n }\n if (use_for_title === void 0) {\n use_for_title = false;\n }\n // this is a LOCAL index of views used only by this particular rendering\n // call, so we can remove the views we create.\n var views = {};\n function render_model(model) {\n var root_el;\n if (model.id in roots)\n root_el = roots[model.id];\n else if (element.classList.contains(dom_2.BOKEH_ROOT))\n root_el = element;\n else {\n root_el = dom_1.div({ class: dom_2.BOKEH_ROOT });\n element.appendChild(root_el);\n }\n var view = _create_view(model);\n view.renderTo(root_el);\n views[model.id] = view;\n }\n function unrender_model(model) {\n var id = model.id;\n if (id in views) {\n var view = views[id];\n view.remove();\n delete views[id];\n delete base.index[id];\n }\n }\n for (var _i = 0, _a = document.roots(); _i < _a.length; _i++) {\n var model = _a[_i];\n render_model(model);\n }\n if (use_for_title)\n window.document.title = document.title();\n document.on_change(function (event) {\n if (event instanceof document_1.RootAddedEvent)\n render_model(event.model);\n else if (event instanceof document_1.RootRemovedEvent)\n unrender_model(event.model);\n else if (use_for_title && event instanceof document_1.TitleChangedEvent)\n window.document.title = event.title;\n });\n return views;\n }\n exports.add_document_standalone = add_document_standalone;\n}\n","/* main */ function _(require, module, exports) {\n require(280) /* ./polyfill */;\n var version_1 = require(286) /* ./version */;\n exports.version = version_1.version;\n var embed = require(54) /* ./embed */;\n exports.embed = embed;\n var protocol = require(281) /* ./protocol */;\n exports.protocol = protocol;\n var _testing = require(285) /* ./testing */;\n exports._testing = _testing;\n var logging_1 = require(14) /* ./core/logging */;\n exports.logger = logging_1.logger;\n exports.set_log_level = logging_1.set_log_level;\n var settings_1 = require(18) /* ./core/settings */;\n exports.settings = settings_1.settings;\n var base_1 = require(0) /* ./base */;\n exports.Models = base_1.Models;\n exports.index = base_1.index;\n var document_1 = require(52) /* ./document */;\n exports.documents = document_1.documents;\n var safely_1 = require(284) /* ./safely */;\n exports.safely = safely_1.safely;\n}\n","/* model */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var has_props_1 = require(8) /* ./core/has_props */;\n var p = require(15) /* ./core/properties */;\n var types_1 = require(44) /* ./core/util/types */;\n var object_1 = require(32) /* ./core/util/object */;\n var logging_1 = require(14) /* ./core/logging */;\n var Model = /** @class */ (function (_super) {\n tslib_1.__extends(Model, _super);\n function Model(attrs) {\n return _super.call(this, attrs) || this;\n }\n Model.initClass = function () {\n this.prototype.type = \"Model\";\n this.define({\n tags: [p.Array, []],\n name: [p.String],\n js_property_callbacks: [p.Any, {}],\n js_event_callbacks: [p.Any, {}],\n subscribed_events: [p.Array, []],\n });\n };\n Model.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n for (var base_evt in this.js_property_callbacks) {\n var callbacks = this.js_property_callbacks[base_evt];\n var _a = base_evt.split(':'), evt = _a[0], _b = _a[1], attr = _b === void 0 ? null : _b;\n var _loop_1 = function (cb) {\n var signal = attr != null ? this_1.properties[attr][evt] : this_1[evt];\n this_1.connect(signal, function () { return cb.execute(_this, {}); });\n };\n var this_1 = this;\n for (var _i = 0, callbacks_1 = callbacks; _i < callbacks_1.length; _i++) {\n var cb = callbacks_1[_i];\n _loop_1(cb);\n }\n }\n this.connect(this.properties.js_event_callbacks.change, function () { return _this._update_event_callbacks; });\n this.connect(this.properties.subscribed_events.change, function () { return _this._update_event_callbacks; });\n };\n /*protected*/ Model.prototype._process_event = function (event) {\n if (event.is_applicable_to(this)) {\n event = event._customize_event(this);\n for (var _i = 0, _a = this.js_event_callbacks[event.event_name] || []; _i < _a.length; _i++) {\n var callback = _a[_i];\n callback.execute(event, {});\n }\n if (this.document != null) {\n if (this.subscribed_events.some(function (m) { return m == event.event_name; }))\n this.document.event_manager.send_event(event);\n }\n }\n };\n Model.prototype.trigger_event = function (event) {\n if (this.document != null)\n this.document.event_manager.trigger(event.set_model_id(this.id));\n };\n Model.prototype._update_event_callbacks = function () {\n if (this.document == null) {\n // File an issue: SidePanel in particular seems to have this issue\n logging_1.logger.warn('WARNING: Document not defined for updating event callbacks');\n return;\n }\n this.document.event_manager.subscribed_models.add(this.id);\n };\n Model.prototype._doc_attached = function () {\n if (!object_1.isEmpty(this.js_event_callbacks) || !object_1.isEmpty(this.subscribed_events))\n this._update_event_callbacks();\n };\n Model.prototype.select = function (selector) {\n if (types_1.isString(selector))\n return this.references().filter(function (ref) { return ref instanceof Model && ref.name === selector; });\n else if (selector.prototype instanceof has_props_1.HasProps)\n return this.references().filter(function (ref) { return ref instanceof selector; });\n else\n throw new Error(\"invalid selector\");\n };\n Model.prototype.select_one = function (selector) {\n var result = this.select(selector);\n switch (result.length) {\n case 0:\n return null;\n case 1:\n return result[0];\n default:\n throw new Error(\"found more than one object matching given selector\");\n }\n };\n return Model;\n }(has_props_1.HasProps));\n exports.Model = Model;\n Model.initClass();\n}\n","/* models/annotations/annotation */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var side_panel_1 = require(12) /* core/layout/side_panel */;\n var p = require(15) /* core/properties */;\n var proj = require(33) /* core/util/projections */;\n var object_1 = require(32) /* core/util/object */;\n var renderer_1 = require(189) /* ../renderers/renderer */;\n var AnnotationView = /** @class */ (function (_super) {\n tslib_1.__extends(AnnotationView, _super);\n function AnnotationView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AnnotationView.prototype._get_size = function () {\n throw new Error(\"not implemented\");\n };\n AnnotationView.prototype.get_size = function () {\n return this.model.visible ? Math.round(this._get_size()) : 0;\n };\n AnnotationView.prototype.set_data = function (source) {\n var _a, _b;\n var data = this.model.materialize_dataspecs(source);\n object_1.extend(this, data);\n if (this.plot_model.use_map) {\n var self_1 = this;\n if (self_1._x != null)\n _a = proj.project_xy(self_1._x, self_1._y), self_1._x = _a[0], self_1._y = _a[1];\n if (self_1._xs != null)\n _b = proj.project_xsys(self_1._xs, self_1._ys), self_1._xs = _b[0], self_1._ys = _b[1];\n }\n };\n return AnnotationView;\n }(renderer_1.RendererView));\n exports.AnnotationView = AnnotationView;\n var Annotation = /** @class */ (function (_super) {\n tslib_1.__extends(Annotation, _super);\n function Annotation(attrs) {\n return _super.call(this, attrs) || this;\n }\n Annotation.initClass = function () {\n this.prototype.type = 'Annotation';\n this.define({\n plot: [p.Instance],\n });\n this.override({\n level: 'annotation',\n });\n };\n Annotation.prototype.add_panel = function (side) {\n if (this.panel == null || side !== this.panel.side) {\n var panel = new side_panel_1.SidePanel({ side: side });\n panel.attach_document(this.document);\n this.set_panel(panel);\n }\n };\n Annotation.prototype.set_panel = function (panel) {\n this.panel = panel;\n // If the annotation is in a side panel, we need to set level to overlay, so it is visible.\n this.level = 'overlay';\n };\n return Annotation;\n }(renderer_1.Renderer));\n exports.Annotation = Annotation;\n Annotation.initClass();\n}\n","/* models/annotations/arrow */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var arrow_head_1 = require(62) /* ./arrow_head */;\n var column_data_source_1 = require(200) /* ../sources/column_data_source */;\n var p = require(15) /* core/properties */;\n var math_1 = require(31) /* core/util/math */;\n var ArrowView = /** @class */ (function (_super) {\n tslib_1.__extends(ArrowView, _super);\n function ArrowView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ArrowView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n if (this.model.source == null)\n this.model.source = new column_data_source_1.ColumnDataSource();\n this.set_data(this.model.source);\n };\n ArrowView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.source.streaming, function () { return _this.set_data(_this.model.source); });\n this.connect(this.model.source.patching, function () { return _this.set_data(_this.model.source); });\n this.connect(this.model.source.change, function () { return _this.set_data(_this.model.source); });\n };\n ArrowView.prototype.set_data = function (source) {\n _super.prototype.set_data.call(this, source);\n this.visuals.warm_cache(source);\n this.plot_view.request_render();\n };\n ArrowView.prototype._map_data = function () {\n var frame = this.plot_view.frame;\n var sx_start, sy_start;\n if (this.model.start_units == 'data') {\n sx_start = frame.xscales[this.model.x_range_name].v_compute(this._x_start);\n sy_start = frame.yscales[this.model.y_range_name].v_compute(this._y_start);\n }\n else {\n sx_start = frame.xview.v_compute(this._x_start);\n sy_start = frame.yview.v_compute(this._y_start);\n }\n var sx_end, sy_end;\n if (this.model.end_units == 'data') {\n sx_end = frame.xscales[this.model.x_range_name].v_compute(this._x_end);\n sy_end = frame.yscales[this.model.y_range_name].v_compute(this._y_end);\n }\n else {\n sx_end = frame.xview.v_compute(this._x_end);\n sy_end = frame.yview.v_compute(this._y_end);\n }\n return [[sx_start, sy_start], [sx_end, sy_end]];\n };\n ArrowView.prototype.render = function () {\n if (!this.model.visible)\n return;\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n // Order in this function is important. First we draw all the arrow heads.\n var _a = this._map_data(), start = _a[0], end = _a[1];\n if (this.model.end != null)\n this._arrow_head(ctx, \"render\", this.model.end, start, end);\n if (this.model.start != null)\n this._arrow_head(ctx, \"render\", this.model.start, end, start);\n // Next we call .clip on all the arrow heads, inside an initial canvas sized\n // rect, to create an \"inverted\" clip region for the arrow heads\n ctx.beginPath();\n var _b = this.plot_model.canvas.bbox.rect, x = _b.x, y = _b.y, width = _b.width, height = _b.height;\n ctx.rect(x, y, width, height);\n if (this.model.end != null)\n this._arrow_head(ctx, \"clip\", this.model.end, start, end);\n if (this.model.start != null)\n this._arrow_head(ctx, \"clip\", this.model.start, end, start);\n ctx.closePath();\n ctx.clip();\n // Finally we draw the arrow body, with the clipping regions set up. This prevents\n // \"fat\" arrows from overlapping the arrow head in a bad way.\n this._arrow_body(ctx, start, end);\n ctx.restore();\n };\n ArrowView.prototype._arrow_head = function (ctx, action, head, start, end) {\n for (var i = 0, _end = this._x_start.length; i < _end; i++) {\n // arrow head runs orthogonal to arrow body\n var angle = Math.PI / 2 + math_1.atan2([start[0][i], start[1][i]], [end[0][i], end[1][i]]);\n ctx.save();\n ctx.translate(end[0][i], end[1][i]);\n ctx.rotate(angle);\n if (action == \"render\")\n head.render(ctx, i);\n else if (action == \"clip\")\n head.clip(ctx, i);\n ctx.restore();\n }\n };\n ArrowView.prototype._arrow_body = function (ctx, start, end) {\n if (!this.visuals.line.doit)\n return;\n for (var i = 0, n = this._x_start.length; i < n; i++) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.beginPath();\n ctx.moveTo(start[0][i], start[1][i]);\n ctx.lineTo(end[0][i], end[1][i]);\n ctx.stroke();\n }\n };\n return ArrowView;\n }(annotation_1.AnnotationView));\n exports.ArrowView = ArrowView;\n var Arrow = /** @class */ (function (_super) {\n tslib_1.__extends(Arrow, _super);\n function Arrow(attrs) {\n return _super.call(this, attrs) || this;\n }\n Arrow.initClass = function () {\n this.prototype.type = 'Arrow';\n this.prototype.default_view = ArrowView;\n this.mixins(['line']);\n this.define({\n x_start: [p.NumberSpec,],\n y_start: [p.NumberSpec,],\n start_units: [p.String, 'data'],\n start: [p.Instance, null],\n x_end: [p.NumberSpec,],\n y_end: [p.NumberSpec,],\n end_units: [p.String, 'data'],\n end: [p.Instance, function () { return new arrow_head_1.OpenHead({}); }],\n source: [p.Instance],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n };\n return Arrow;\n }(annotation_1.Annotation));\n exports.Arrow = Arrow;\n Arrow.initClass();\n}\n","/* models/annotations/arrow_head */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var visuals_1 = require(49) /* core/visuals */;\n var p = require(15) /* core/properties */;\n var ArrowHead = /** @class */ (function (_super) {\n tslib_1.__extends(ArrowHead, _super);\n function ArrowHead(attrs) {\n return _super.call(this, attrs) || this;\n }\n ArrowHead.initClass = function () {\n this.prototype.type = 'ArrowHead';\n this.define({\n size: [p.Number, 25],\n });\n };\n ArrowHead.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.visuals = new visuals_1.Visuals(this);\n };\n return ArrowHead;\n }(annotation_1.Annotation));\n exports.ArrowHead = ArrowHead;\n ArrowHead.initClass();\n var OpenHead = /** @class */ (function (_super) {\n tslib_1.__extends(OpenHead, _super);\n function OpenHead(attrs) {\n return _super.call(this, attrs) || this;\n }\n OpenHead.initClass = function () {\n this.prototype.type = 'OpenHead';\n this.mixins(['line']);\n };\n OpenHead.prototype.clip = function (ctx, i) {\n // This method should not begin or close a path\n this.visuals.line.set_vectorize(ctx, i);\n ctx.moveTo(0.5 * this.size, this.size);\n ctx.lineTo(0.5 * this.size, -2);\n ctx.lineTo(-0.5 * this.size, -2);\n ctx.lineTo(-0.5 * this.size, this.size);\n ctx.lineTo(0, 0);\n ctx.lineTo(0.5 * this.size, this.size);\n };\n OpenHead.prototype.render = function (ctx, i) {\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.beginPath();\n ctx.moveTo(0.5 * this.size, this.size);\n ctx.lineTo(0, 0);\n ctx.lineTo(-0.5 * this.size, this.size);\n ctx.stroke();\n }\n };\n return OpenHead;\n }(ArrowHead));\n exports.OpenHead = OpenHead;\n OpenHead.initClass();\n var NormalHead = /** @class */ (function (_super) {\n tslib_1.__extends(NormalHead, _super);\n function NormalHead(attrs) {\n return _super.call(this, attrs) || this;\n }\n NormalHead.initClass = function () {\n this.prototype.type = 'NormalHead';\n this.mixins(['line', 'fill']);\n this.override({\n fill_color: 'black',\n });\n };\n NormalHead.prototype.clip = function (ctx, i) {\n // This method should not begin or close a path\n this.visuals.line.set_vectorize(ctx, i);\n ctx.moveTo(0.5 * this.size, this.size);\n ctx.lineTo(0.5 * this.size, -2);\n ctx.lineTo(-0.5 * this.size, -2);\n ctx.lineTo(-0.5 * this.size, this.size);\n ctx.lineTo(0.5 * this.size, this.size);\n };\n NormalHead.prototype.render = function (ctx, i) {\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n this._normal(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n this._normal(ctx, i);\n ctx.stroke();\n }\n };\n NormalHead.prototype._normal = function (ctx, _i) {\n ctx.beginPath();\n ctx.moveTo(0.5 * this.size, this.size);\n ctx.lineTo(0, 0);\n ctx.lineTo(-0.5 * this.size, this.size);\n ctx.closePath();\n };\n return NormalHead;\n }(ArrowHead));\n exports.NormalHead = NormalHead;\n NormalHead.initClass();\n var VeeHead = /** @class */ (function (_super) {\n tslib_1.__extends(VeeHead, _super);\n function VeeHead(attrs) {\n return _super.call(this, attrs) || this;\n }\n VeeHead.initClass = function () {\n this.prototype.type = 'VeeHead';\n this.mixins(['line', 'fill']);\n this.override({\n fill_color: 'black',\n });\n };\n VeeHead.prototype.clip = function (ctx, i) {\n // This method should not begin or close a path\n this.visuals.line.set_vectorize(ctx, i);\n ctx.moveTo(0.5 * this.size, this.size);\n ctx.lineTo(0.5 * this.size, -2);\n ctx.lineTo(-0.5 * this.size, -2);\n ctx.lineTo(-0.5 * this.size, this.size);\n ctx.lineTo(0, 0.5 * this.size);\n ctx.lineTo(0.5 * this.size, this.size);\n };\n VeeHead.prototype.render = function (ctx, i) {\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n this._vee(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n this._vee(ctx, i);\n ctx.stroke();\n }\n };\n VeeHead.prototype._vee = function (ctx, _i) {\n ctx.beginPath();\n ctx.moveTo(0.5 * this.size, this.size);\n ctx.lineTo(0, 0);\n ctx.lineTo(-0.5 * this.size, this.size);\n ctx.lineTo(0, 0.5 * this.size);\n ctx.closePath();\n };\n return VeeHead;\n }(ArrowHead));\n exports.VeeHead = VeeHead;\n VeeHead.initClass();\n var TeeHead = /** @class */ (function (_super) {\n tslib_1.__extends(TeeHead, _super);\n function TeeHead(attrs) {\n return _super.call(this, attrs) || this;\n }\n TeeHead.initClass = function () {\n this.prototype.type = 'TeeHead';\n this.mixins(['line']);\n };\n TeeHead.prototype.render = function (ctx, i) {\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.beginPath();\n ctx.moveTo(0.5 * this.size, 0);\n ctx.lineTo(-0.5 * this.size, 0);\n ctx.stroke();\n }\n };\n TeeHead.prototype.clip = function (_ctx, _i) { };\n return TeeHead;\n }(ArrowHead));\n exports.TeeHead = TeeHead;\n TeeHead.initClass();\n}\n","/* models/annotations/band */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var column_data_source_1 = require(200) /* ../sources/column_data_source */;\n var p = require(15) /* core/properties */;\n var BandView = /** @class */ (function (_super) {\n tslib_1.__extends(BandView, _super);\n function BandView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BandView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.set_data(this.model.source);\n };\n BandView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.source.streaming, function () { return _this.set_data(_this.model.source); });\n this.connect(this.model.source.patching, function () { return _this.set_data(_this.model.source); });\n this.connect(this.model.source.change, function () { return _this.set_data(_this.model.source); });\n };\n BandView.prototype.set_data = function (source) {\n _super.prototype.set_data.call(this, source);\n this.visuals.warm_cache(source);\n this.plot_view.request_render();\n };\n BandView.prototype._map_data = function () {\n var frame = this.plot_view.frame;\n var dim = this.model.dimension;\n var xscale = frame.xscales[this.model.x_range_name];\n var yscale = frame.yscales[this.model.y_range_name];\n var limit_scale = dim == \"height\" ? yscale : xscale;\n var base_scale = dim == \"height\" ? xscale : yscale;\n var limit_view = dim == \"height\" ? frame.yview : frame.xview;\n var base_view = dim == \"height\" ? frame.xview : frame.yview;\n var _lower_sx;\n if (this.model.lower.units == \"data\")\n _lower_sx = limit_scale.v_compute(this._lower);\n else\n _lower_sx = limit_view.v_compute(this._lower);\n var _upper_sx;\n if (this.model.upper.units == \"data\")\n _upper_sx = limit_scale.v_compute(this._upper);\n else\n _upper_sx = limit_view.v_compute(this._upper);\n var _base_sx;\n if (this.model.base.units == \"data\")\n _base_sx = base_scale.v_compute(this._base);\n else\n _base_sx = base_view.v_compute(this._base);\n var _a = dim == 'height' ? [1, 0] : [0, 1], i = _a[0], j = _a[1];\n var _lower = [_lower_sx, _base_sx];\n var _upper = [_upper_sx, _base_sx];\n this._lower_sx = _lower[i];\n this._lower_sy = _lower[j];\n this._upper_sx = _upper[i];\n this._upper_sy = _upper[j];\n };\n BandView.prototype.render = function () {\n if (!this.model.visible)\n return;\n this._map_data();\n var ctx = this.plot_view.canvas_view.ctx;\n // Draw the band body\n ctx.beginPath();\n ctx.moveTo(this._lower_sx[0], this._lower_sy[0]);\n for (var i = 0, end = this._lower_sx.length; i < end; i++) {\n ctx.lineTo(this._lower_sx[i], this._lower_sy[i]);\n }\n // iterate backwards so that the upper end is below the lower start\n for (var start = this._upper_sx.length - 1, i = start; i >= 0; i--) {\n ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n }\n ctx.closePath();\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_value(ctx);\n ctx.fill();\n }\n // Draw the lower band edge\n ctx.beginPath();\n ctx.moveTo(this._lower_sx[0], this._lower_sy[0]);\n for (var i = 0, end = this._lower_sx.length; i < end; i++) {\n ctx.lineTo(this._lower_sx[i], this._lower_sy[i]);\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_value(ctx);\n ctx.stroke();\n }\n // Draw the upper band edge\n ctx.beginPath();\n ctx.moveTo(this._upper_sx[0], this._upper_sy[0]);\n for (var i = 0, end = this._upper_sx.length; i < end; i++) {\n ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_value(ctx);\n ctx.stroke();\n }\n };\n return BandView;\n }(annotation_1.AnnotationView));\n exports.BandView = BandView;\n var Band = /** @class */ (function (_super) {\n tslib_1.__extends(Band, _super);\n function Band(attrs) {\n return _super.call(this, attrs) || this;\n }\n Band.initClass = function () {\n this.prototype.type = 'Band';\n this.prototype.default_view = BandView;\n this.mixins(['line', 'fill']);\n this.define({\n lower: [p.DistanceSpec],\n upper: [p.DistanceSpec],\n base: [p.DistanceSpec],\n dimension: [p.Dimension, 'height'],\n source: [p.Instance, function () { return new column_data_source_1.ColumnDataSource(); }],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.override({\n fill_color: \"#fff9ba\",\n fill_alpha: 0.4,\n line_color: \"#cccccc\",\n line_alpha: 0.3,\n });\n };\n return Band;\n }(annotation_1.Annotation));\n exports.Band = Band;\n Band.initClass();\n}\n","/* models/annotations/box_annotation */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var signaling_1 = require(19) /* core/signaling */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var bbox_1 = require(24) /* core/util/bbox */;\n exports.EDGE_TOLERANCE = 2.5;\n var BoxAnnotationView = /** @class */ (function (_super) {\n tslib_1.__extends(BoxAnnotationView, _super);\n function BoxAnnotationView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BoxAnnotationView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.plot_view.canvas_overlays.appendChild(this.el);\n this.el.classList.add(\"bk-shading\");\n dom_1.hide(this.el);\n };\n BoxAnnotationView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n // need to respond to either normal BB change events or silent\n // \"data only updates\" that tools might want to use\n if (this.model.render_mode == 'css') {\n // dispatch CSS update immediately\n this.connect(this.model.change, function () { return _this.render(); });\n this.connect(this.model.data_update, function () { return _this.render(); });\n }\n else {\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.data_update, function () { return _this.plot_view.request_render(); });\n }\n };\n BoxAnnotationView.prototype.render = function () {\n var _this = this;\n if (!this.model.visible && this.model.render_mode == 'css')\n dom_1.hide(this.el);\n if (!this.model.visible)\n return;\n // don't render if *all* position are null\n if (this.model.left == null && this.model.right == null && this.model.top == null && this.model.bottom == null) {\n dom_1.hide(this.el);\n return;\n }\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[this.model.x_range_name];\n var yscale = frame.yscales[this.model.y_range_name];\n var _calc_dim = function (dim, dim_units, scale, view, frame_extrema) {\n var sdim;\n if (dim != null) {\n if (_this.model.screen)\n sdim = dim;\n else {\n if (dim_units == 'data')\n sdim = scale.compute(dim);\n else\n sdim = view.compute(dim);\n }\n }\n else\n sdim = frame_extrema;\n return sdim;\n };\n this.sleft = _calc_dim(this.model.left, this.model.left_units, xscale, frame.xview, frame._left.value);\n this.sright = _calc_dim(this.model.right, this.model.right_units, xscale, frame.xview, frame._right.value);\n this.stop = _calc_dim(this.model.top, this.model.top_units, yscale, frame.yview, frame._top.value);\n this.sbottom = _calc_dim(this.model.bottom, this.model.bottom_units, yscale, frame.yview, frame._bottom.value);\n var draw = this.model.render_mode == 'css' ? this._css_box.bind(this) : this._canvas_box.bind(this);\n draw(this.sleft, this.sright, this.sbottom, this.stop);\n };\n BoxAnnotationView.prototype._css_box = function (sleft, sright, sbottom, stop) {\n var line_width = this.model.properties.line_width.value();\n var sw = Math.floor(sright - sleft) - line_width;\n var sh = Math.floor(sbottom - stop) - line_width;\n this.el.style.left = sleft + \"px\";\n this.el.style.width = sw + \"px\";\n this.el.style.top = stop + \"px\";\n this.el.style.height = sh + \"px\";\n this.el.style.borderWidth = line_width + \"px\";\n this.el.style.borderColor = this.model.properties.line_color.value();\n this.el.style.backgroundColor = this.model.properties.fill_color.value();\n this.el.style.opacity = this.model.properties.fill_alpha.value();\n // try our best to honor line dashing in some way, if we can\n var ld = this.model.properties.line_dash.value().length < 2 ? \"solid\" : \"dashed\";\n this.el.style.borderStyle = ld;\n dom_1.show(this.el);\n };\n BoxAnnotationView.prototype._canvas_box = function (sleft, sright, sbottom, stop) {\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n ctx.beginPath();\n ctx.rect(sleft, stop, sright - sleft, sbottom - stop);\n this.visuals.fill.set_value(ctx);\n ctx.fill();\n this.visuals.line.set_value(ctx);\n ctx.stroke();\n ctx.restore();\n };\n BoxAnnotationView.prototype.interactive_bbox = function () {\n var tol = this.model.properties.line_width.value() + exports.EDGE_TOLERANCE;\n return new bbox_1.BBox({\n x0: this.sleft - tol,\n y0: this.stop - tol,\n x1: this.sright + tol,\n y1: this.sbottom + tol,\n });\n };\n BoxAnnotationView.prototype.interactive_hit = function (sx, sy) {\n if (this.model.in_cursor == null)\n return false;\n var bbox = this.interactive_bbox();\n return bbox.contains(sx, sy);\n };\n BoxAnnotationView.prototype.cursor = function (sx, sy) {\n var tol = 3;\n if (Math.abs(sx - this.sleft) < tol || Math.abs(sx - this.sright) < tol)\n return this.model.ew_cursor;\n else if (Math.abs(sy - this.sbottom) < tol || Math.abs(sy - this.stop) < tol)\n return this.model.ns_cursor;\n else if (sx > this.sleft && sx < this.sright && sy > this.stop && sy < this.sbottom)\n return this.model.in_cursor;\n else\n return null;\n };\n return BoxAnnotationView;\n }(annotation_1.AnnotationView));\n exports.BoxAnnotationView = BoxAnnotationView;\n var BoxAnnotation = /** @class */ (function (_super) {\n tslib_1.__extends(BoxAnnotation, _super);\n function BoxAnnotation(attrs) {\n return _super.call(this, attrs) || this;\n }\n BoxAnnotation.initClass = function () {\n this.prototype.type = 'BoxAnnotation';\n this.prototype.default_view = BoxAnnotationView;\n this.mixins(['line', 'fill']);\n this.define({\n render_mode: [p.RenderMode, 'canvas'],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n top: [p.Number, null],\n top_units: [p.SpatialUnits, 'data'],\n bottom: [p.Number, null],\n bottom_units: [p.SpatialUnits, 'data'],\n left: [p.Number, null],\n left_units: [p.SpatialUnits, 'data'],\n right: [p.Number, null],\n right_units: [p.SpatialUnits, 'data'],\n });\n this.internal({\n screen: [p.Boolean, false],\n ew_cursor: [p.String, null],\n ns_cursor: [p.String, null],\n in_cursor: [p.String, null],\n });\n this.override({\n fill_color: '#fff9ba',\n fill_alpha: 0.4,\n line_color: '#cccccc',\n line_alpha: 0.3,\n });\n };\n BoxAnnotation.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.data_update = new signaling_1.Signal0(this, \"data_update\");\n };\n BoxAnnotation.prototype.update = function (_a) {\n var left = _a.left, right = _a.right, top = _a.top, bottom = _a.bottom;\n this.setv({ left: left, right: right, top: top, bottom: bottom, screen: true }, { silent: true });\n this.data_update.emit();\n };\n return BoxAnnotation;\n }(annotation_1.Annotation));\n exports.BoxAnnotation = BoxAnnotation;\n BoxAnnotation.initClass();\n}\n","/* models/annotations/color_bar */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var basic_ticker_1 = require(207) /* ../tickers/basic_ticker */;\n var basic_tick_formatter_1 = require(104) /* ../formatters/basic_tick_formatter */;\n var linear_color_mapper_1 = require(167) /* ../mappers/linear_color_mapper */;\n var linear_scale_1 = require(192) /* ../scales/linear_scale */;\n var log_scale_1 = require(193) /* ../scales/log_scale */;\n var range1d_1 = require(184) /* ../ranges/range1d */;\n var p = require(15) /* core/properties */;\n var text_util = require(41) /* core/util/text */;\n var array_1 = require(21) /* core/util/array */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var object_1 = require(32) /* core/util/object */;\n var types_1 = require(44) /* core/util/types */;\n var SHORT_DIM = 25;\n var LONG_DIM_MIN_SCALAR = 0.3;\n var LONG_DIM_MAX_SCALAR = 0.8;\n var ColorBarView = /** @class */ (function (_super) {\n tslib_1.__extends(ColorBarView, _super);\n function ColorBarView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ColorBarView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this._set_canvas_image();\n };\n ColorBarView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.visible.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.ticker.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.formatter.change, function () { return _this.plot_view.request_render(); });\n if (this.model.color_mapper != null) {\n this.connect(this.model.color_mapper.change, function () {\n _this._set_canvas_image();\n _this.plot_view.request_render();\n });\n }\n };\n ColorBarView.prototype._get_size = function () {\n if (this.model.color_mapper == null)\n return 0;\n var bbox = this.compute_legend_dimensions();\n var side = this.model.panel.side;\n switch (side) {\n case \"above\":\n case \"below\":\n return bbox.height;\n case \"left\":\n case \"right\":\n return bbox.width;\n default:\n throw new Error(\"unreachable code\");\n }\n };\n ColorBarView.prototype._set_canvas_image = function () {\n var _a, _b;\n if (this.model.color_mapper == null)\n return;\n var palette = this.model.color_mapper.palette;\n if (this.model.orientation == 'vertical')\n palette = array_1.reversed(palette);\n var w, h;\n switch (this.model.orientation) {\n case \"vertical\": {\n _a = [1, palette.length], w = _a[0], h = _a[1];\n break;\n }\n case \"horizontal\": {\n _b = [palette.length, 1], w = _b[0], h = _b[1];\n break;\n }\n default:\n throw new Error(\"unreachable code\");\n }\n var canvas = document.createElement('canvas');\n canvas.width = w;\n canvas.height = h;\n var image_ctx = canvas.getContext('2d');\n var image_data = image_ctx.getImageData(0, 0, w, h);\n // We always want to draw the entire palette linearly, so we create a new\n // LinearColorMapper instance and map a monotonic range of values with\n // length = palette.length to get each palette color in order.\n var cmap = new linear_color_mapper_1.LinearColorMapper({ palette: palette }).rgba_mapper;\n var buf8 = cmap.v_compute(array_1.range(0, palette.length));\n image_data.data.set(buf8);\n image_ctx.putImageData(image_data, 0, 0);\n this.image = canvas;\n };\n ColorBarView.prototype.compute_legend_dimensions = function () {\n var image_dimensions = this.model._computed_image_dimensions();\n var _a = [image_dimensions.height, image_dimensions.width], image_height = _a[0], image_width = _a[1];\n var label_extent = this._get_label_extent();\n var title_extent = this.model._title_extent();\n var tick_extent = this.model._tick_extent();\n var padding = this.model.padding;\n var legend_height, legend_width;\n switch (this.model.orientation) {\n case \"vertical\":\n legend_height = image_height + title_extent + 2 * padding;\n legend_width = image_width + tick_extent + label_extent + 2 * padding;\n break;\n case \"horizontal\":\n legend_height = image_height + title_extent + tick_extent + label_extent + 2 * padding;\n legend_width = image_width + 2 * padding;\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n return { width: legend_width, height: legend_height };\n };\n ColorBarView.prototype.compute_legend_location = function () {\n var legend_dimensions = this.compute_legend_dimensions();\n var _a = [legend_dimensions.height, legend_dimensions.width], legend_height = _a[0], legend_width = _a[1];\n var legend_margin = this.model.margin;\n var panel = this.model.panel != null ? this.model.panel : this.plot_view.frame;\n var _b = panel.bbox.ranges, hr = _b[0], vr = _b[1];\n var location = this.model.location;\n var sx, sy;\n if (types_1.isString(location)) {\n switch (location) {\n case 'top_left':\n sx = hr.start + legend_margin;\n sy = vr.start + legend_margin;\n break;\n case 'top_center':\n sx = (hr.end + hr.start) / 2 - legend_width / 2;\n sy = vr.start + legend_margin;\n break;\n case 'top_right':\n sx = hr.end - legend_margin - legend_width;\n sy = vr.start + legend_margin;\n break;\n case 'bottom_right':\n sx = hr.end - legend_margin - legend_width;\n sy = vr.end - legend_margin - legend_height;\n break;\n case 'bottom_center':\n sx = (hr.end + hr.start) / 2 - legend_width / 2;\n sy = vr.end - legend_margin - legend_height;\n break;\n case 'bottom_left':\n sx = hr.start + legend_margin;\n sy = vr.end - legend_margin - legend_height;\n break;\n case 'center_left':\n sx = hr.start + legend_margin;\n sy = (vr.end + vr.start) / 2 - legend_height / 2;\n break;\n case 'center':\n sx = (hr.end + hr.start) / 2 - legend_width / 2;\n sy = (vr.end + vr.start) / 2 - legend_height / 2;\n break;\n case 'center_right':\n sx = hr.end - legend_margin - legend_width;\n sy = (vr.end + vr.start) / 2 - legend_height / 2;\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n }\n else if (types_1.isArray(location) && location.length == 2) {\n var vx = location[0], vy = location[1];\n sx = panel.xview.compute(vx);\n sy = panel.yview.compute(vy) - legend_height;\n }\n else\n throw new Error(\"unreachable code\");\n return { sx: sx, sy: sy };\n };\n ColorBarView.prototype.render = function () {\n if (!this.model.visible || this.model.color_mapper == null)\n return;\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n var _a = this.compute_legend_location(), sx = _a.sx, sy = _a.sy;\n ctx.translate(sx, sy);\n this._draw_bbox(ctx);\n var image_offset = this._get_image_offset();\n ctx.translate(image_offset.x, image_offset.y);\n this._draw_image(ctx);\n if (this.model.color_mapper.low != null && this.model.color_mapper.high != null) {\n var tick_info = this.model.tick_info();\n this._draw_major_ticks(ctx, tick_info);\n this._draw_minor_ticks(ctx, tick_info);\n this._draw_major_labels(ctx, tick_info);\n }\n if (this.model.title)\n this._draw_title(ctx);\n ctx.restore();\n };\n ColorBarView.prototype._draw_bbox = function (ctx) {\n var bbox = this.compute_legend_dimensions();\n ctx.save();\n if (this.visuals.background_fill.doit) {\n this.visuals.background_fill.set_value(ctx);\n ctx.fillRect(0, 0, bbox.width, bbox.height);\n }\n if (this.visuals.border_line.doit) {\n this.visuals.border_line.set_value(ctx);\n ctx.strokeRect(0, 0, bbox.width, bbox.height);\n }\n ctx.restore();\n };\n ColorBarView.prototype._draw_image = function (ctx) {\n var image = this.model._computed_image_dimensions();\n ctx.save();\n ctx.setImageSmoothingEnabled(false);\n ctx.globalAlpha = this.model.scale_alpha;\n ctx.drawImage(this.image, 0, 0, image.width, image.height);\n if (this.visuals.bar_line.doit) {\n this.visuals.bar_line.set_value(ctx);\n ctx.strokeRect(0, 0, image.width, image.height);\n }\n ctx.restore();\n };\n ColorBarView.prototype._draw_major_ticks = function (ctx, tick_info) {\n if (!this.visuals.major_tick_line.doit)\n return;\n var _a = this.model._normals(), nx = _a[0], ny = _a[1];\n var image = this.model._computed_image_dimensions();\n var _b = [image.width * nx, image.height * ny], x_offset = _b[0], y_offset = _b[1];\n var _c = tick_info.coords.major, sx = _c[0], sy = _c[1];\n var tin = this.model.major_tick_in;\n var tout = this.model.major_tick_out;\n ctx.save();\n ctx.translate(x_offset, y_offset);\n this.visuals.major_tick_line.set_value(ctx);\n for (var i = 0, end = sx.length; i < end; i++) {\n ctx.beginPath();\n ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout));\n ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin));\n ctx.stroke();\n }\n ctx.restore();\n };\n ColorBarView.prototype._draw_minor_ticks = function (ctx, tick_info) {\n if (!this.visuals.minor_tick_line.doit)\n return;\n var _a = this.model._normals(), nx = _a[0], ny = _a[1];\n var image = this.model._computed_image_dimensions();\n var _b = [image.width * nx, image.height * ny], x_offset = _b[0], y_offset = _b[1];\n var _c = tick_info.coords.minor, sx = _c[0], sy = _c[1];\n var tin = this.model.minor_tick_in;\n var tout = this.model.minor_tick_out;\n ctx.save();\n ctx.translate(x_offset, y_offset);\n this.visuals.minor_tick_line.set_value(ctx);\n for (var i = 0, end = sx.length; i < end; i++) {\n ctx.beginPath();\n ctx.moveTo(Math.round(sx[i] + nx * tout), Math.round(sy[i] + ny * tout));\n ctx.lineTo(Math.round(sx[i] - nx * tin), Math.round(sy[i] - ny * tin));\n ctx.stroke();\n }\n ctx.restore();\n };\n ColorBarView.prototype._draw_major_labels = function (ctx, tick_info) {\n if (!this.visuals.major_label_text.doit)\n return;\n var _a = this.model._normals(), nx = _a[0], ny = _a[1];\n var image = this.model._computed_image_dimensions();\n var _b = [image.width * nx, image.height * ny], x_offset = _b[0], y_offset = _b[1];\n var standoff = (this.model.label_standoff + this.model._tick_extent());\n var _c = [standoff * nx, standoff * ny], x_standoff = _c[0], y_standoff = _c[1];\n var _d = tick_info.coords.major, sx = _d[0], sy = _d[1];\n var formatted_labels = tick_info.labels.major;\n this.visuals.major_label_text.set_value(ctx);\n ctx.save();\n ctx.translate(x_offset + x_standoff, y_offset + y_standoff);\n for (var i = 0, end = sx.length; i < end; i++) {\n ctx.fillText(formatted_labels[i], Math.round(sx[i] + nx * this.model.label_standoff), Math.round(sy[i] + ny * this.model.label_standoff));\n }\n ctx.restore();\n };\n ColorBarView.prototype._draw_title = function (ctx) {\n if (!this.visuals.title_text.doit)\n return;\n ctx.save();\n this.visuals.title_text.set_value(ctx);\n ctx.fillText(this.model.title, 0, -this.model.title_standoff);\n ctx.restore();\n };\n ColorBarView.prototype._get_label_extent = function () {\n var major_labels = this.model.tick_info().labels.major;\n var label_extent;\n if (this.model.color_mapper.low != null && this.model.color_mapper.high != null && !object_1.isEmpty(major_labels)) {\n var ctx_1 = this.plot_view.canvas_view.ctx;\n ctx_1.save();\n this.visuals.major_label_text.set_value(ctx_1);\n switch (this.model.orientation) {\n case \"vertical\":\n label_extent = array_1.max((major_labels.map(function (label) { return ctx_1.measureText(label.toString()).width; })));\n break;\n case \"horizontal\":\n label_extent = text_util.get_text_height(this.visuals.major_label_text.font_value()).height;\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n label_extent += this.model.label_standoff;\n ctx_1.restore();\n }\n else\n label_extent = 0;\n return label_extent;\n };\n ColorBarView.prototype._get_image_offset = function () {\n // Returns image offset relative to legend bounding box\n var x = this.model.padding;\n var y = this.model.padding + this.model._title_extent();\n return { x: x, y: y };\n };\n return ColorBarView;\n }(annotation_1.AnnotationView));\n exports.ColorBarView = ColorBarView;\n var ColorBar = /** @class */ (function (_super) {\n tslib_1.__extends(ColorBar, _super);\n function ColorBar(attrs) {\n return _super.call(this, attrs) || this;\n }\n ColorBar.initClass = function () {\n this.prototype.type = 'ColorBar';\n this.prototype.default_view = ColorBarView;\n this.mixins([\n 'text:major_label_',\n 'text:title_',\n 'line:major_tick_',\n 'line:minor_tick_',\n 'line:border_',\n 'line:bar_',\n 'fill:background_',\n ]);\n this.define({\n location: [p.Any, 'top_right'],\n orientation: [p.Orientation, 'vertical'],\n title: [p.String,],\n title_standoff: [p.Number, 2],\n width: [p.Any, 'auto'],\n height: [p.Any, 'auto'],\n scale_alpha: [p.Number, 1.0],\n ticker: [p.Instance, function () { return new basic_ticker_1.BasicTicker(); }],\n formatter: [p.Instance, function () { return new basic_tick_formatter_1.BasicTickFormatter(); }],\n major_label_overrides: [p.Any, {}],\n color_mapper: [p.Instance],\n label_standoff: [p.Number, 5],\n margin: [p.Number, 30],\n padding: [p.Number, 10],\n major_tick_in: [p.Number, 5],\n major_tick_out: [p.Number, 0],\n minor_tick_in: [p.Number, 0],\n minor_tick_out: [p.Number, 0],\n });\n this.override({\n background_fill_color: \"#ffffff\",\n background_fill_alpha: 0.95,\n bar_line_color: null,\n border_line_color: null,\n major_label_text_align: \"center\",\n major_label_text_baseline: \"middle\",\n major_label_text_font_size: \"8pt\",\n major_tick_line_color: \"#ffffff\",\n minor_tick_line_color: null,\n title_text_font_size: \"10pt\",\n title_text_font_style: \"italic\",\n });\n };\n ColorBar.prototype._normals = function () {\n return this.orientation == 'vertical' ? [1, 0] : [0, 1];\n };\n ColorBar.prototype._title_extent = function () {\n var font_value = this.title_text_font + \" \" + this.title_text_font_size + \" \" + this.title_text_font_style;\n var title_extent = this.title ? text_util.get_text_height(font_value).height + this.title_standoff : 0;\n return title_extent;\n };\n ColorBar.prototype._tick_extent = function () {\n if (this.color_mapper.low != null && this.color_mapper.high != null)\n return array_1.max([this.major_tick_out, this.minor_tick_out]);\n else\n return 0;\n };\n ColorBar.prototype._computed_image_dimensions = function () {\n /*\n Heuristics to determine ColorBar image dimensions if set to \"auto\"\n \n Note: Returns the height/width values for the ColorBar's scale image, not\n the dimensions of the entire ColorBar.\n \n If the short dimension (the width of a vertical bar or height of a\n horizontal bar) is set to \"auto\", the resulting dimension will be set to\n 25 px.\n \n For a ColorBar in a side panel with the long dimension (the height of a\n vertical bar or width of a horizontal bar) set to \"auto\", the\n resulting dimension will be as long as the adjacent frame edge, so that the\n bar \"fits\" to the plot.\n \n For a ColorBar in the plot frame with the long dimension set to \"auto\", the\n resulting dimension will be the greater of:\n * The length of the color palette * 25px\n * The parallel frame dimension * 0.30\n (i.e the frame height for a vertical ColorBar)\n But not greater than:\n * The parallel frame dimension * 0.80\n */\n var frame_height = this.plot.plot_canvas.frame._height.value;\n var frame_width = this.plot.plot_canvas.frame._width.value;\n var title_extent = this._title_extent();\n var height, width;\n switch (this.orientation) {\n case \"vertical\": {\n if (this.height == 'auto') {\n if (this.panel != null)\n height = frame_height - 2 * this.padding - title_extent;\n else {\n height = array_1.max([this.color_mapper.palette.length * SHORT_DIM, frame_height * LONG_DIM_MIN_SCALAR]);\n height = array_1.min([height, frame_height * LONG_DIM_MAX_SCALAR - 2 * this.padding - title_extent]);\n }\n }\n else\n height = this.height;\n width = this.width == 'auto' ? SHORT_DIM : this.width;\n break;\n }\n case \"horizontal\": {\n height = this.height == 'auto' ? SHORT_DIM : this.height;\n if (this.width == 'auto') {\n if (this.panel != null)\n width = frame_width - 2 * this.padding;\n else {\n width = array_1.max([this.color_mapper.palette.length * SHORT_DIM, frame_width * LONG_DIM_MIN_SCALAR]);\n width = array_1.min([width, frame_width * LONG_DIM_MAX_SCALAR - 2 * this.padding]);\n }\n }\n else\n width = this.width;\n break;\n }\n default:\n throw new Error(\"unreachable code\");\n }\n return { width: width, height: height };\n };\n ColorBar.prototype._tick_coordinate_scale = function (scale_length) {\n /*\n Creates and returns a scale instance that maps the `color_mapper` range\n (low to high) to a screen space range equal to the length of the ColorBar's\n scale image. The scale is used to calculate the tick coordinates in screen\n coordinates for plotting purposes.\n \n Note: the type of color_mapper has to match the type of scale (i.e.\n a LinearColorMapper will require a corresponding LinearScale instance).\n */\n var ranges = {\n source_range: new range1d_1.Range1d({\n start: this.color_mapper.low,\n end: this.color_mapper.high,\n }),\n target_range: new range1d_1.Range1d({\n start: 0,\n end: scale_length,\n }),\n };\n switch (this.color_mapper.type) {\n case \"LinearColorMapper\": return new linear_scale_1.LinearScale(ranges);\n case \"LogColorMapper\": return new log_scale_1.LogScale(ranges);\n default:\n throw new Error(\"unreachable code\");\n }\n };\n ColorBar.prototype._format_major_labels = function (initial_labels, major_ticks) {\n // XXX: passing null as cross_loc probably means MercatorTickFormatters, etc\n // will not function properly in conjunction with colorbars\n var formatted_labels = this.formatter.doFormat(initial_labels, null);\n for (var i = 0, end = major_ticks.length; i < end; i++) {\n if (major_ticks[i] in this.major_label_overrides)\n formatted_labels[i] = this.major_label_overrides[major_ticks[i]];\n }\n return formatted_labels;\n };\n ColorBar.prototype.tick_info = function () {\n var image_dimensions = this._computed_image_dimensions();\n var scale_length;\n switch (this.orientation) {\n case \"vertical\": {\n scale_length = image_dimensions.height;\n break;\n }\n case \"horizontal\": {\n scale_length = image_dimensions.width;\n break;\n }\n default:\n throw new Error(\"unreachable code\");\n }\n var scale = this._tick_coordinate_scale(scale_length);\n var _a = this._normals(), i = _a[0], j = _a[1];\n var _b = [this.color_mapper.low, this.color_mapper.high], start = _b[0], end = _b[1];\n // XXX: passing null as cross_loc probably means MercatorTickers, etc\n // will not function properly in conjunction with colorbars\n var ticks = this.ticker.get_ticks(start, end, null, null, this.ticker.desired_num_ticks);\n var majors = ticks.major;\n var minors = ticks.minor;\n var major_coords = [[], []];\n var minor_coords = [[], []];\n for (var ii = 0, _end = majors.length; ii < _end; ii++) {\n if (majors[ii] < start || majors[ii] > end)\n continue;\n major_coords[i].push(majors[ii]);\n major_coords[j].push(0);\n }\n for (var ii = 0, _end = minors.length; ii < _end; ii++) {\n if (minors[ii] < start || minors[ii] > end)\n continue;\n minor_coords[i].push(minors[ii]);\n minor_coords[j].push(0);\n }\n var labels = { major: this._format_major_labels(major_coords[i], majors) };\n var coords = {\n major: [[], []],\n minor: [[], []],\n };\n coords.major[i] = scale.v_compute(major_coords[i]);\n coords.minor[i] = scale.v_compute(minor_coords[i]);\n coords.major[j] = major_coords[j];\n coords.minor[j] = minor_coords[j];\n // Because we want the scale to be reversed\n if (this.orientation == 'vertical') {\n coords.major[i] = arrayable_1.map(coords.major[i], function (coord) { return scale_length - coord; });\n coords.minor[i] = arrayable_1.map(coords.minor[i], function (coord) { return scale_length - coord; });\n }\n return { coords: coords, labels: labels };\n };\n return ColorBar;\n }(annotation_1.Annotation));\n exports.ColorBar = ColorBar;\n ColorBar.initClass();\n}\n","/* models/annotations/index */ function _(require, module, exports) {\n var annotation_1 = require(60) /* ./annotation */;\n exports.Annotation = annotation_1.Annotation;\n var arrow_1 = require(61) /* ./arrow */;\n exports.Arrow = arrow_1.Arrow;\n var arrow_head_1 = require(62) /* ./arrow_head */;\n exports.ArrowHead = arrow_head_1.ArrowHead;\n var arrow_head_2 = require(62) /* ./arrow_head */;\n exports.OpenHead = arrow_head_2.OpenHead;\n var arrow_head_3 = require(62) /* ./arrow_head */;\n exports.NormalHead = arrow_head_3.NormalHead;\n var arrow_head_4 = require(62) /* ./arrow_head */;\n exports.TeeHead = arrow_head_4.TeeHead;\n var arrow_head_5 = require(62) /* ./arrow_head */;\n exports.VeeHead = arrow_head_5.VeeHead;\n var band_1 = require(63) /* ./band */;\n exports.Band = band_1.Band;\n var box_annotation_1 = require(64) /* ./box_annotation */;\n exports.BoxAnnotation = box_annotation_1.BoxAnnotation;\n var color_bar_1 = require(65) /* ./color_bar */;\n exports.ColorBar = color_bar_1.ColorBar;\n var label_1 = require(67) /* ./label */;\n exports.Label = label_1.Label;\n var label_set_1 = require(68) /* ./label_set */;\n exports.LabelSet = label_set_1.LabelSet;\n var legend_1 = require(69) /* ./legend */;\n exports.Legend = legend_1.Legend;\n var legend_item_1 = require(70) /* ./legend_item */;\n exports.LegendItem = legend_item_1.LegendItem;\n var poly_annotation_1 = require(71) /* ./poly_annotation */;\n exports.PolyAnnotation = poly_annotation_1.PolyAnnotation;\n var slope_1 = require(72) /* ./slope */;\n exports.Slope = slope_1.Slope;\n var span_1 = require(73) /* ./span */;\n exports.Span = span_1.Span;\n var text_annotation_1 = require(74) /* ./text_annotation */;\n exports.TextAnnotation = text_annotation_1.TextAnnotation;\n var title_1 = require(75) /* ./title */;\n exports.Title = title_1.Title;\n var toolbar_panel_1 = require(76) /* ./toolbar_panel */;\n exports.ToolbarPanel = toolbar_panel_1.ToolbarPanel;\n var tooltip_1 = require(77) /* ./tooltip */;\n exports.Tooltip = tooltip_1.Tooltip;\n var whisker_1 = require(78) /* ./whisker */;\n exports.Whisker = whisker_1.Whisker;\n}\n","/* models/annotations/label */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var text_annotation_1 = require(74) /* ./text_annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var LabelView = /** @class */ (function (_super) {\n tslib_1.__extends(LabelView, _super);\n function LabelView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LabelView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.visuals.warm_cache();\n };\n LabelView.prototype._get_size = function () {\n var ctx = this.plot_view.canvas_view.ctx;\n this.visuals.text.set_value(ctx);\n if (this.model.panel.is_horizontal) {\n var height = ctx.measureText(this.model.text).ascent;\n return height;\n }\n else {\n var width = ctx.measureText(this.model.text).width;\n return width;\n }\n };\n LabelView.prototype.render = function () {\n if (!this.model.visible && this.model.render_mode == 'css')\n dom_1.hide(this.el);\n if (!this.model.visible)\n return;\n // Here because AngleSpec does units tranform and label doesn't support specs\n var angle;\n switch (this.model.angle_units) {\n case \"rad\": {\n angle = -this.model.angle;\n break;\n }\n case \"deg\": {\n angle = (-this.model.angle * Math.PI) / 180.0;\n break;\n }\n default:\n throw new Error(\"unreachable code\");\n }\n var panel = this.model.panel != null ? this.model.panel : this.plot_view.frame;\n var xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n var yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n var sx = this.model.x_units == \"data\" ? xscale.compute(this.model.x) : panel.xview.compute(this.model.x);\n var sy = this.model.y_units == \"data\" ? yscale.compute(this.model.y) : panel.yview.compute(this.model.y);\n sx += this.model.x_offset;\n sy -= this.model.y_offset;\n var draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this);\n draw(this.plot_view.canvas_view.ctx, this.model.text, sx, sy, angle);\n };\n return LabelView;\n }(text_annotation_1.TextAnnotationView));\n exports.LabelView = LabelView;\n var Label = /** @class */ (function (_super) {\n tslib_1.__extends(Label, _super);\n function Label(attrs) {\n return _super.call(this, attrs) || this;\n }\n Label.initClass = function () {\n this.prototype.type = 'Label';\n this.prototype.default_view = LabelView;\n this.mixins(['text', 'line:border_', 'fill:background_']);\n this.define({\n x: [p.Number,],\n x_units: [p.SpatialUnits, 'data'],\n y: [p.Number,],\n y_units: [p.SpatialUnits, 'data'],\n text: [p.String,],\n angle: [p.Angle, 0],\n angle_units: [p.AngleUnits, 'rad'],\n x_offset: [p.Number, 0],\n y_offset: [p.Number, 0],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.override({\n background_fill_color: null,\n border_line_color: null,\n });\n };\n return Label;\n }(text_annotation_1.TextAnnotation));\n exports.Label = Label;\n Label.initClass();\n}\n","/* models/annotations/label_set */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var text_annotation_1 = require(74) /* ./text_annotation */;\n var column_data_source_1 = require(200) /* ../sources/column_data_source */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var LabelSetView = /** @class */ (function (_super) {\n tslib_1.__extends(LabelSetView, _super);\n function LabelSetView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LabelSetView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.set_data(this.model.source);\n if (this.model.render_mode == 'css') {\n for (var i = 0, end = this._text.length; i < end; i++) {\n var el = dom_1.div({ class: 'bk-annotation-child', style: { display: \"none\" } });\n this.el.appendChild(el);\n }\n }\n };\n LabelSetView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n if (this.model.render_mode == 'css') {\n // dispatch CSS update immediately\n this.connect(this.model.change, function () {\n _this.set_data(_this.model.source);\n _this.render();\n });\n this.connect(this.model.source.streaming, function () {\n _this.set_data(_this.model.source);\n _this.render();\n });\n this.connect(this.model.source.patching, function () {\n _this.set_data(_this.model.source);\n _this.render();\n });\n this.connect(this.model.source.change, function () {\n _this.set_data(_this.model.source);\n _this.render();\n });\n }\n else {\n this.connect(this.model.change, function () {\n _this.set_data(_this.model.source);\n _this.plot_view.request_render();\n });\n this.connect(this.model.source.streaming, function () {\n _this.set_data(_this.model.source);\n _this.plot_view.request_render();\n });\n this.connect(this.model.source.patching, function () {\n _this.set_data(_this.model.source);\n _this.plot_view.request_render();\n });\n this.connect(this.model.source.change, function () {\n _this.set_data(_this.model.source);\n _this.plot_view.request_render();\n });\n }\n };\n LabelSetView.prototype.set_data = function (source) {\n _super.prototype.set_data.call(this, source);\n this.visuals.warm_cache(source);\n };\n LabelSetView.prototype._map_data = function () {\n var xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n var yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n var panel = this.model.panel != null ? this.model.panel : this.plot_view.frame;\n var sx = this.model.x_units == \"data\" ? xscale.v_compute(this._x) : panel.xview.v_compute(this._x);\n var sy = this.model.y_units == \"data\" ? yscale.v_compute(this._y) : panel.yview.v_compute(this._y);\n return [sx, sy];\n };\n LabelSetView.prototype.render = function () {\n if (!this.model.visible && this.model.render_mode == 'css')\n dom_1.hide(this.el);\n if (!this.model.visible)\n return;\n var draw = this.model.render_mode == 'canvas' ? this._v_canvas_text.bind(this) : this._v_css_text.bind(this);\n var ctx = this.plot_view.canvas_view.ctx;\n var _a = this._map_data(), sx = _a[0], sy = _a[1];\n for (var i = 0, end = this._text.length; i < end; i++) {\n draw(ctx, i, this._text[i], sx[i] + this._x_offset[i], sy[i] - this._y_offset[i], this._angle[i]);\n }\n };\n LabelSetView.prototype._get_size = function () {\n var ctx = this.plot_view.canvas_view.ctx;\n this.visuals.text.set_value(ctx);\n switch (this.model.panel.side) {\n case \"above\":\n case \"below\": {\n var height = ctx.measureText(this._text[0]).ascent;\n return height;\n }\n case \"left\":\n case \"right\": {\n var width = ctx.measureText(this._text[0]).width;\n return width;\n }\n default:\n throw new Error(\"unreachable code\");\n }\n };\n LabelSetView.prototype._v_canvas_text = function (ctx, i, text, sx, sy, angle) {\n this.visuals.text.set_vectorize(ctx, i);\n var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n ctx.save();\n ctx.beginPath();\n ctx.translate(sx, sy);\n ctx.rotate(angle);\n ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]);\n if (this.visuals.background_fill.doit) {\n this.visuals.background_fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (this.visuals.border_line.doit) {\n this.visuals.border_line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n if (this.visuals.text.doit) {\n this.visuals.text.set_vectorize(ctx, i);\n ctx.fillText(text, 0, 0);\n }\n ctx.restore();\n };\n LabelSetView.prototype._v_css_text = function (ctx, i, text, sx, sy, angle) {\n var el = this.el.children[i];\n el.textContent = text;\n this.visuals.text.set_vectorize(ctx, i);\n var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n // attempt to support vector-style (\"8 4 8\") line dashing for css mode\n var ld = this.visuals.border_line.line_dash.value();\n var line_dash = ld.length < 2 ? \"solid\" : \"dashed\";\n this.visuals.border_line.set_vectorize(ctx, i);\n this.visuals.background_fill.set_vectorize(ctx, i);\n el.style.position = 'absolute';\n el.style.left = sx + bbox_dims[0] + \"px\";\n el.style.top = sy + bbox_dims[1] + \"px\";\n el.style.color = \"\" + this.visuals.text.text_color.value();\n el.style.opacity = \"\" + this.visuals.text.text_alpha.value();\n el.style.font = \"\" + this.visuals.text.font_value();\n el.style.lineHeight = \"normal\"; // needed to prevent ipynb css override\n if (angle) {\n el.style.transform = \"rotate(\" + angle + \"rad)\";\n }\n if (this.visuals.background_fill.doit) {\n el.style.backgroundColor = \"\" + this.visuals.background_fill.color_value();\n }\n if (this.visuals.border_line.doit) {\n el.style.borderStyle = \"\" + line_dash;\n el.style.borderWidth = this.visuals.border_line.line_width.value() + \"px\";\n el.style.borderColor = \"\" + this.visuals.border_line.color_value();\n }\n dom_1.show(el);\n };\n return LabelSetView;\n }(text_annotation_1.TextAnnotationView));\n exports.LabelSetView = LabelSetView;\n var LabelSet = /** @class */ (function (_super) {\n tslib_1.__extends(LabelSet, _super);\n function LabelSet(attrs) {\n return _super.call(this, attrs) || this;\n }\n LabelSet.initClass = function () {\n this.prototype.type = 'LabelSet';\n this.prototype.default_view = LabelSetView;\n this.mixins(['text', 'line:border_', 'fill:background_']);\n this.define({\n x: [p.NumberSpec],\n y: [p.NumberSpec],\n x_units: [p.SpatialUnits, 'data'],\n y_units: [p.SpatialUnits, 'data'],\n text: [p.StringSpec, { field: \"text\" }],\n angle: [p.AngleSpec, 0],\n x_offset: [p.NumberSpec, { value: 0 }],\n y_offset: [p.NumberSpec, { value: 0 }],\n source: [p.Instance, function () { return new column_data_source_1.ColumnDataSource(); }],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.override({\n background_fill_color: null,\n border_line_color: null,\n });\n };\n return LabelSet;\n }(text_annotation_1.TextAnnotation));\n exports.LabelSet = LabelSet;\n LabelSet.initClass();\n}\n","/* models/annotations/legend */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var p = require(15) /* core/properties */;\n var signaling_1 = require(19) /* core/signaling */;\n var text_1 = require(41) /* core/util/text */;\n var bbox_1 = require(24) /* core/util/bbox */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var types_1 = require(44) /* core/util/types */;\n var LegendView = /** @class */ (function (_super) {\n tslib_1.__extends(LegendView, _super);\n function LegendView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LegendView.prototype.cursor = function (_sx, _sy) {\n return this.model.click_policy == \"none\" ? null : \"pointer\";\n };\n Object.defineProperty(LegendView.prototype, \"legend_padding\", {\n get: function () {\n return this.visuals.border_line.line_color.value() != null ? this.model.padding : 0;\n },\n enumerable: true,\n configurable: true\n });\n LegendView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.item_change, function () { return _this.plot_view.request_render(); });\n };\n LegendView.prototype.compute_legend_bbox = function () {\n var legend_names = this.model.get_legend_names();\n var _a = this.model, glyph_height = _a.glyph_height, glyph_width = _a.glyph_width;\n var _b = this.model, label_height = _b.label_height, label_width = _b.label_width;\n this.max_label_height = array_1.max([text_1.get_text_height(this.visuals.label_text.font_value()).height, label_height, glyph_height]);\n // this is to measure text properties\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n this.visuals.label_text.set_value(ctx);\n this.text_widths = {};\n for (var _i = 0, legend_names_1 = legend_names; _i < legend_names_1.length; _i++) {\n var name_1 = legend_names_1[_i];\n this.text_widths[name_1] = array_1.max([ctx.measureText(name_1).width, label_width]);\n }\n ctx.restore();\n var max_label_width = Math.max(array_1.max(object_1.values(this.text_widths)), 0);\n var legend_margin = this.model.margin;\n var legend_padding = this.legend_padding;\n var legend_spacing = this.model.spacing;\n var label_standoff = this.model.label_standoff;\n var legend_height, legend_width;\n if (this.model.orientation == \"vertical\") {\n legend_height = legend_names.length * this.max_label_height + Math.max(legend_names.length - 1, 0) * legend_spacing + 2 * legend_padding;\n legend_width = max_label_width + glyph_width + label_standoff + 2 * legend_padding;\n }\n else {\n legend_width = 2 * legend_padding + Math.max(legend_names.length - 1, 0) * legend_spacing;\n for (var name_2 in this.text_widths) {\n var width = this.text_widths[name_2];\n legend_width += array_1.max([width, label_width]) + glyph_width + label_standoff;\n }\n legend_height = this.max_label_height + 2 * legend_padding;\n }\n var panel = this.model.panel != null ? this.model.panel : this.plot_view.frame;\n var _c = panel.bbox.ranges, hr = _c[0], vr = _c[1];\n var location = this.model.location;\n var sx, sy;\n if (types_1.isString(location)) {\n switch (location) {\n case 'top_left':\n sx = hr.start + legend_margin;\n sy = vr.start + legend_margin;\n break;\n case 'top_center':\n sx = (hr.end + hr.start) / 2 - legend_width / 2;\n sy = vr.start + legend_margin;\n break;\n case 'top_right':\n sx = hr.end - legend_margin - legend_width;\n sy = vr.start + legend_margin;\n break;\n case 'bottom_right':\n sx = hr.end - legend_margin - legend_width;\n sy = vr.end - legend_margin - legend_height;\n break;\n case 'bottom_center':\n sx = (hr.end + hr.start) / 2 - legend_width / 2;\n sy = vr.end - legend_margin - legend_height;\n break;\n case 'bottom_left':\n sx = hr.start + legend_margin;\n sy = vr.end - legend_margin - legend_height;\n break;\n case 'center_left':\n sx = hr.start + legend_margin;\n sy = (vr.end + vr.start) / 2 - legend_height / 2;\n break;\n case 'center':\n sx = (hr.end + hr.start) / 2 - legend_width / 2;\n sy = (vr.end + vr.start) / 2 - legend_height / 2;\n break;\n case 'center_right':\n sx = hr.end - legend_margin - legend_width;\n sy = (vr.end + vr.start) / 2 - legend_height / 2;\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n }\n else if (types_1.isArray(location) && location.length == 2) {\n var vx = location[0], vy = location[1];\n sx = panel.xview.compute(vx);\n sy = panel.yview.compute(vy) - legend_height;\n }\n else\n throw new Error(\"unreachable code\");\n return { x: sx, y: sy, width: legend_width, height: legend_height };\n };\n LegendView.prototype.interactive_bbox = function () {\n var _a = this.compute_legend_bbox(), x = _a.x, y = _a.y, width = _a.width, height = _a.height;\n return new bbox_1.BBox({ x: x, y: y, width: width, height: height });\n };\n LegendView.prototype.interactive_hit = function (sx, sy) {\n var bbox = this.interactive_bbox();\n return bbox.contains(sx, sy);\n };\n LegendView.prototype.on_hit = function (sx, sy) {\n var _a, _b;\n var yoffset;\n var glyph_width = this.model.glyph_width;\n var legend_padding = this.legend_padding;\n var legend_spacing = this.model.spacing;\n var label_standoff = this.model.label_standoff;\n var xoffset = (yoffset = legend_padding);\n var legend_bbox = this.compute_legend_bbox();\n var vertical = this.model.orientation == \"vertical\";\n for (var _i = 0, _c = this.model.items; _i < _c.length; _i++) {\n var item = _c[_i];\n var labels = item.get_labels_list_from_label_prop();\n for (var _d = 0, labels_1 = labels; _d < labels_1.length; _d++) {\n var label = labels_1[_d];\n var x1 = legend_bbox.x + xoffset;\n var y1 = legend_bbox.y + yoffset;\n var w = void 0, h = void 0;\n if (vertical)\n _a = [legend_bbox.width - 2 * legend_padding, this.max_label_height], w = _a[0], h = _a[1];\n else\n _b = [this.text_widths[label] + glyph_width + label_standoff, this.max_label_height], w = _b[0], h = _b[1];\n var bbox = new bbox_1.BBox({ x: x1, y: y1, width: w, height: h });\n if (bbox.contains(sx, sy)) {\n switch (this.model.click_policy) {\n case \"hide\": {\n for (var _e = 0, _f = item.renderers; _e < _f.length; _e++) {\n var r = _f[_e];\n r.visible = !r.visible;\n }\n break;\n }\n case \"mute\": {\n for (var _g = 0, _h = item.renderers; _g < _h.length; _g++) {\n var r = _h[_g];\n r.muted = !r.muted;\n }\n break;\n }\n }\n return true;\n }\n if (vertical)\n yoffset += this.max_label_height + legend_spacing;\n else\n xoffset += this.text_widths[label] + glyph_width + label_standoff + legend_spacing;\n }\n }\n return false;\n };\n LegendView.prototype.render = function () {\n if (!this.model.visible)\n return;\n if (this.model.items.length == 0)\n return;\n // set a backref on render so that items can later signal item_change upates\n // on the model to trigger a re-render\n for (var _i = 0, _a = this.model.items; _i < _a.length; _i++) {\n var item = _a[_i];\n item.legend = this.model;\n }\n var ctx = this.plot_view.canvas_view.ctx;\n var bbox = this.compute_legend_bbox();\n ctx.save();\n this._draw_legend_box(ctx, bbox);\n this._draw_legend_items(ctx, bbox);\n ctx.restore();\n };\n LegendView.prototype._draw_legend_box = function (ctx, bbox) {\n ctx.beginPath();\n ctx.rect(bbox.x, bbox.y, bbox.width, bbox.height);\n this.visuals.background_fill.set_value(ctx);\n ctx.fill();\n if (this.visuals.border_line.doit) {\n this.visuals.border_line.set_value(ctx);\n ctx.stroke();\n }\n };\n LegendView.prototype._draw_legend_items = function (ctx, bbox) {\n var _this = this;\n var _a = this.model, glyph_width = _a.glyph_width, glyph_height = _a.glyph_height;\n var legend_padding = this.legend_padding;\n var legend_spacing = this.model.spacing;\n var label_standoff = this.model.label_standoff;\n var xoffset = legend_padding;\n var yoffset = legend_padding;\n var vertical = this.model.orientation == \"vertical\";\n var _loop_1 = function (item) {\n var _a, _b;\n var labels = item.get_labels_list_from_label_prop();\n var field = item.get_field_from_label_prop();\n if (labels.length == 0)\n return \"continue\";\n var active = (function () {\n switch (_this.model.click_policy) {\n case \"none\": return true;\n case \"hide\": return array_1.all(item.renderers, function (r) { return r.visible; });\n case \"mute\": return array_1.all(item.renderers, function (r) { return !r.muted; });\n }\n })();\n for (var _i = 0, labels_2 = labels; _i < labels_2.length; _i++) {\n var label = labels_2[_i];\n var x1 = bbox.x + xoffset;\n var y1 = bbox.y + yoffset;\n var x2 = x1 + glyph_width;\n var y2 = y1 + glyph_height;\n if (vertical)\n yoffset += this_1.max_label_height + legend_spacing;\n else\n xoffset += this_1.text_widths[label] + glyph_width + label_standoff + legend_spacing;\n this_1.visuals.label_text.set_value(ctx);\n ctx.fillText(label, x2 + label_standoff, y1 + this_1.max_label_height / 2.0);\n for (var _c = 0, _d = item.renderers; _c < _d.length; _c++) {\n var r = _d[_c];\n var view = this_1.plot_view.renderer_views[r.id];\n view.draw_legend(ctx, x1, x2, y1, y2, field, label, item.index);\n }\n if (!active) {\n var w = void 0, h = void 0;\n if (vertical)\n _a = [bbox.width - 2 * legend_padding, this_1.max_label_height], w = _a[0], h = _a[1];\n else\n _b = [this_1.text_widths[label] + glyph_width + label_standoff, this_1.max_label_height], w = _b[0], h = _b[1];\n ctx.beginPath();\n ctx.rect(x1, y1, w, h);\n this_1.visuals.inactive_fill.set_value(ctx);\n ctx.fill();\n }\n }\n };\n var this_1 = this;\n for (var _i = 0, _b = this.model.items; _i < _b.length; _i++) {\n var item = _b[_i];\n _loop_1(item);\n }\n };\n LegendView.prototype._get_size = function () {\n var bbox = this.compute_legend_bbox();\n switch (this.model.panel.side) {\n case \"above\":\n case \"below\":\n return bbox.height + 2 * this.model.margin;\n case \"left\":\n case \"right\":\n return bbox.width + 2 * this.model.margin;\n }\n };\n return LegendView;\n }(annotation_1.AnnotationView));\n exports.LegendView = LegendView;\n var Legend = /** @class */ (function (_super) {\n tslib_1.__extends(Legend, _super);\n function Legend(attrs) {\n return _super.call(this, attrs) || this;\n }\n Legend.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.item_change = new signaling_1.Signal0(this, \"item_change\");\n };\n Legend.initClass = function () {\n this.prototype.type = 'Legend';\n this.prototype.default_view = LegendView;\n this.mixins(['text:label_', 'fill:inactive_', 'line:border_', 'fill:background_']);\n this.define({\n orientation: [p.Orientation, 'vertical'],\n location: [p.Any, 'top_right'],\n label_standoff: [p.Number, 5],\n glyph_height: [p.Number, 20],\n glyph_width: [p.Number, 20],\n label_height: [p.Number, 20],\n label_width: [p.Number, 20],\n margin: [p.Number, 10],\n padding: [p.Number, 10],\n spacing: [p.Number, 3],\n items: [p.Array, []],\n click_policy: [p.Any, \"none\"],\n });\n this.override({\n border_line_color: \"#e5e5e5\",\n border_line_alpha: 0.5,\n border_line_width: 1,\n background_fill_color: \"#ffffff\",\n background_fill_alpha: 0.95,\n inactive_fill_color: \"white\",\n inactive_fill_alpha: 0.7,\n label_text_font_size: \"10pt\",\n label_text_baseline: \"middle\",\n });\n };\n Legend.prototype.get_legend_names = function () {\n var legend_names = [];\n for (var _i = 0, _a = this.items; _i < _a.length; _i++) {\n var item = _a[_i];\n var labels = item.get_labels_list_from_label_prop();\n legend_names.push.apply(legend_names, labels);\n }\n return legend_names;\n };\n return Legend;\n }(annotation_1.Annotation));\n exports.Legend = Legend;\n Legend.initClass();\n}\n","/* models/annotations/legend_item */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var columnar_data_source_1 = require(201) /* ../sources/columnar_data_source */;\n var vectorization_1 = require(47) /* core/vectorization */;\n var p = require(15) /* core/properties */;\n var logging_1 = require(14) /* core/logging */;\n var array_1 = require(21) /* core/util/array */;\n var LegendItem = /** @class */ (function (_super) {\n tslib_1.__extends(LegendItem, _super);\n function LegendItem(attrs) {\n return _super.call(this, attrs) || this;\n }\n LegendItem.initClass = function () {\n this.prototype.type = \"LegendItem\";\n this.define({\n label: [p.StringSpec, null],\n renderers: [p.Array, []],\n index: [p.Number, null],\n });\n };\n LegendItem.prototype._check_data_sources_on_renderers = function () {\n var field = this.get_field_from_label_prop();\n if (field != null) {\n if (this.renderers.length < 1) {\n return false;\n }\n var source = this.renderers[0].data_source;\n if (source != null) {\n for (var _i = 0, _a = this.renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n if (r.data_source != source) {\n return false;\n }\n }\n }\n }\n return true;\n };\n LegendItem.prototype._check_field_label_on_data_source = function () {\n var field = this.get_field_from_label_prop();\n if (field != null) {\n if (this.renderers.length < 1) {\n return false;\n }\n var source = this.renderers[0].data_source;\n if (source != null && !array_1.includes(source.columns(), field)) {\n return false;\n }\n }\n return true;\n };\n LegendItem.prototype.initialize = function () {\n var _this = this;\n _super.prototype.initialize.call(this);\n this.legend = null;\n this.connect(this.change, function () {\n if (_this.legend != null)\n _this.legend.item_change.emit();\n });\n // Validate data_sources match\n var data_source_validation = this._check_data_sources_on_renderers();\n if (!data_source_validation)\n logging_1.logger.error(\"Non matching data sources on legend item renderers\");\n // Validate label in data_source\n var field_validation = this._check_field_label_on_data_source();\n if (!field_validation)\n logging_1.logger.error(\"Bad column name on label: \" + this.label);\n };\n LegendItem.prototype.get_field_from_label_prop = function () {\n var label = this.label;\n return vectorization_1.isField(label) ? label.field : null;\n };\n LegendItem.prototype.get_labels_list_from_label_prop = function () {\n // Always return a list of the labels\n if (vectorization_1.isValue(this.label))\n return [this.label.value];\n var field = this.get_field_from_label_prop();\n if (field != null) {\n var source = void 0;\n if (this.renderers[0] && this.renderers[0].data_source != null)\n source = this.renderers[0].data_source;\n else\n return [\"No source found\"];\n if (source instanceof columnar_data_source_1.ColumnarDataSource) {\n var data = source.get_column(field);\n if (data != null)\n return array_1.uniq(Array.from(data));\n else\n return [\"Invalid field\"];\n }\n }\n return [];\n };\n return LegendItem;\n }(model_1.Model));\n exports.LegendItem = LegendItem;\n LegendItem.initClass();\n}\n","/* models/annotations/poly_annotation */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var signaling_1 = require(19) /* core/signaling */;\n var p = require(15) /* core/properties */;\n var PolyAnnotationView = /** @class */ (function (_super) {\n tslib_1.__extends(PolyAnnotationView, _super);\n function PolyAnnotationView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PolyAnnotationView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n // need to respond to either normal BB change events or silent\n // \"data only updates\" that tools might want to use\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.data_update, function () { return _this.plot_view.request_render(); });\n };\n PolyAnnotationView.prototype.render = function () {\n if (!this.model.visible)\n return;\n var _a = this.model, xs = _a.xs, ys = _a.ys;\n if (xs.length != ys.length)\n return;\n if (xs.length < 3 || ys.length < 3)\n return;\n var frame = this.plot_view.frame;\n var ctx = this.plot_view.canvas_view.ctx;\n for (var i = 0, end = xs.length; i < end; i++) {\n var sx = void 0;\n if (this.model.xs_units == 'screen')\n sx = this.model.screen ? xs[i] : frame.xview.compute(xs[i]);\n else\n throw new Error(\"not implemented\");\n var sy = void 0;\n if (this.model.ys_units == 'screen')\n sy = this.model.screen ? ys[i] : frame.yview.compute(ys[i]);\n else\n throw new Error(\"not implemented\");\n if (i == 0) {\n ctx.beginPath();\n ctx.moveTo(sx, sy);\n }\n else {\n ctx.lineTo(sx, sy);\n }\n }\n ctx.closePath();\n if (this.visuals.line.doit) {\n this.visuals.line.set_value(ctx);\n ctx.stroke();\n }\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_value(ctx);\n ctx.fill();\n }\n };\n return PolyAnnotationView;\n }(annotation_1.AnnotationView));\n exports.PolyAnnotationView = PolyAnnotationView;\n var PolyAnnotation = /** @class */ (function (_super) {\n tslib_1.__extends(PolyAnnotation, _super);\n function PolyAnnotation(attrs) {\n return _super.call(this, attrs) || this;\n }\n PolyAnnotation.initClass = function () {\n this.prototype.type = \"PolyAnnotation\";\n this.prototype.default_view = PolyAnnotationView;\n this.mixins(['line', 'fill']);\n this.define({\n xs: [p.Array, []],\n xs_units: [p.SpatialUnits, 'data'],\n ys: [p.Array, []],\n ys_units: [p.SpatialUnits, 'data'],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.internal({\n screen: [p.Boolean, false],\n });\n this.override({\n fill_color: \"#fff9ba\",\n fill_alpha: 0.4,\n line_color: \"#cccccc\",\n line_alpha: 0.3,\n });\n };\n PolyAnnotation.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.data_update = new signaling_1.Signal0(this, \"data_update\");\n };\n PolyAnnotation.prototype.update = function (_a) {\n var xs = _a.xs, ys = _a.ys;\n this.setv({ xs: xs, ys: ys, screen: true }, { silent: true });\n this.data_update.emit();\n };\n return PolyAnnotation;\n }(annotation_1.Annotation));\n exports.PolyAnnotation = PolyAnnotation;\n PolyAnnotation.initClass();\n}\n","/* models/annotations/slope */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var p = require(15) /* core/properties */;\n var SlopeView = /** @class */ (function (_super) {\n tslib_1.__extends(SlopeView, _super);\n function SlopeView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SlopeView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n };\n SlopeView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n };\n SlopeView.prototype.render = function () {\n if (!this.model.visible)\n return;\n this._draw_slope();\n };\n SlopeView.prototype._draw_slope = function () {\n var gradient = this.model.gradient;\n var y_intercept = this.model.y_intercept;\n if (gradient == null || y_intercept == null) {\n return;\n }\n var frame = this.plot_view.frame;\n var xscale = frame.xscales[this.model.x_range_name];\n var yscale = frame.yscales[this.model.y_range_name];\n var sy_start = frame._top.value;\n var sy_end = sy_start + frame._height.value;\n var y_start = yscale.invert(sy_start);\n var y_end = yscale.invert(sy_end);\n var x_start = (y_start - y_intercept) / gradient;\n var x_end = (y_end - y_intercept) / gradient;\n var sx_start = xscale.compute(x_start);\n var sx_end = xscale.compute(x_end);\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n ctx.beginPath();\n this.visuals.line.set_value(ctx);\n ctx.moveTo(sx_start, sy_start);\n ctx.lineTo(sx_end, sy_end);\n ctx.stroke();\n ctx.restore();\n };\n return SlopeView;\n }(annotation_1.AnnotationView));\n exports.SlopeView = SlopeView;\n var Slope = /** @class */ (function (_super) {\n tslib_1.__extends(Slope, _super);\n function Slope(attrs) {\n return _super.call(this, attrs) || this;\n }\n Slope.initClass = function () {\n this.prototype.type = 'Slope';\n this.prototype.default_view = SlopeView;\n this.mixins(['line']);\n this.define({\n gradient: [p.Number, null],\n y_intercept: [p.Number, null],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.override({\n line_color: 'black',\n });\n };\n return Slope;\n }(annotation_1.Annotation));\n exports.Slope = Slope;\n Slope.initClass();\n}\n","/* models/annotations/span */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var SpanView = /** @class */ (function (_super) {\n tslib_1.__extends(SpanView, _super);\n function SpanView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SpanView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.plot_view.canvas_overlays.appendChild(this.el);\n this.el.style.position = \"absolute\";\n dom_1.hide(this.el);\n };\n SpanView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n if (this.model.for_hover)\n this.connect(this.model.properties.computed_location.change, function () { return _this._draw_span(); });\n else {\n if (this.model.render_mode == 'canvas') {\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n this.connect(this.model.properties.location.change, function () { return _this.plot_view.request_render(); });\n }\n else {\n this.connect(this.model.change, function () { return _this.render(); });\n this.connect(this.model.properties.location.change, function () { return _this._draw_span(); });\n }\n }\n };\n SpanView.prototype.render = function () {\n if (!this.model.visible && this.model.render_mode == 'css')\n dom_1.hide(this.el);\n if (!this.model.visible)\n return;\n this._draw_span();\n };\n SpanView.prototype._draw_span = function () {\n var _this = this;\n var loc = this.model.for_hover ? this.model.computed_location : this.model.location;\n if (loc == null) {\n dom_1.hide(this.el);\n return;\n }\n var frame = this.plot_view.frame;\n var xscale = frame.xscales[this.model.x_range_name];\n var yscale = frame.yscales[this.model.y_range_name];\n var _calc_dim = function (scale, view) {\n if (_this.model.for_hover)\n return _this.model.computed_location;\n else {\n if (_this.model.location_units == 'data')\n return scale.compute(loc);\n else\n return view.compute(loc);\n }\n };\n var height, sleft, stop, width;\n if (this.model.dimension == 'width') {\n stop = _calc_dim(yscale, frame.yview);\n sleft = frame._left.value;\n width = frame._width.value;\n height = this.model.properties.line_width.value();\n }\n else {\n stop = frame._top.value;\n sleft = _calc_dim(xscale, frame.xview);\n width = this.model.properties.line_width.value();\n height = frame._height.value;\n }\n if (this.model.render_mode == \"css\") {\n this.el.style.top = stop + \"px\";\n this.el.style.left = sleft + \"px\";\n this.el.style.width = width + \"px\";\n this.el.style.height = height + \"px\";\n this.el.style.backgroundColor = this.model.properties.line_color.value();\n this.el.style.opacity = this.model.properties.line_alpha.value();\n dom_1.show(this.el);\n }\n else if (this.model.render_mode == \"canvas\") {\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n ctx.beginPath();\n this.visuals.line.set_value(ctx);\n ctx.moveTo(sleft, stop);\n if (this.model.dimension == \"width\") {\n ctx.lineTo(sleft + width, stop);\n }\n else {\n ctx.lineTo(sleft, stop + height);\n }\n ctx.stroke();\n ctx.restore();\n }\n };\n return SpanView;\n }(annotation_1.AnnotationView));\n exports.SpanView = SpanView;\n var Span = /** @class */ (function (_super) {\n tslib_1.__extends(Span, _super);\n function Span(attrs) {\n return _super.call(this, attrs) || this;\n }\n Span.initClass = function () {\n this.prototype.type = 'Span';\n this.prototype.default_view = SpanView;\n this.mixins(['line']);\n this.define({\n render_mode: [p.RenderMode, 'canvas'],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n location: [p.Number, null],\n location_units: [p.SpatialUnits, 'data'],\n dimension: [p.Dimension, 'width'],\n });\n this.override({\n line_color: 'black',\n });\n this.internal({\n for_hover: [p.Boolean, false],\n computed_location: [p.Number, null],\n });\n };\n return Span;\n }(annotation_1.Annotation));\n exports.Span = Span;\n Span.initClass();\n}\n","/* models/annotations/text_annotation */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var text_1 = require(41) /* core/util/text */;\n var TextAnnotationView = /** @class */ (function (_super) {\n tslib_1.__extends(TextAnnotationView, _super);\n function TextAnnotationView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TextAnnotationView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n if (this.model.render_mode == 'css') {\n this.el.classList.add('bk-annotation');\n this.plot_view.canvas_overlays.appendChild(this.el);\n }\n };\n TextAnnotationView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n if (this.model.render_mode == 'css') {\n // dispatch CSS update immediately\n this.connect(this.model.change, function () { return _this.render(); });\n }\n else {\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n }\n };\n TextAnnotationView.prototype._calculate_text_dimensions = function (ctx, text) {\n var width = ctx.measureText(text).width;\n var height = text_1.get_text_height(this.visuals.text.font_value()).height;\n return [width, height];\n };\n TextAnnotationView.prototype._calculate_bounding_box_dimensions = function (ctx, text) {\n var _a = this._calculate_text_dimensions(ctx, text), width = _a[0], height = _a[1];\n var x_offset;\n switch (ctx.textAlign) {\n case 'left':\n x_offset = 0;\n break;\n case 'center':\n x_offset = -width / 2;\n break;\n case 'right':\n x_offset = -width;\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n // guestimated from https://www.w3.org/TR/2dcontext/#dom-context-2d-textbaseline\n var y_offset;\n switch (ctx.textBaseline) {\n case 'top':\n y_offset = 0.0;\n break;\n case 'middle':\n y_offset = -0.5 * height;\n break;\n case 'bottom':\n y_offset = -1.0 * height;\n break;\n case 'alphabetic':\n y_offset = -0.8 * height;\n break;\n case 'hanging':\n y_offset = -0.17 * height;\n break;\n case 'ideographic':\n y_offset = -0.83 * height;\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n return [x_offset, y_offset, width, height];\n };\n TextAnnotationView.prototype._canvas_text = function (ctx, text, sx, sy, angle) {\n this.visuals.text.set_value(ctx);\n var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n ctx.save();\n ctx.beginPath();\n ctx.translate(sx, sy);\n if (angle)\n ctx.rotate(angle);\n ctx.rect(bbox_dims[0], bbox_dims[1], bbox_dims[2], bbox_dims[3]);\n if (this.visuals.background_fill.doit) {\n this.visuals.background_fill.set_value(ctx);\n ctx.fill();\n }\n if (this.visuals.border_line.doit) {\n this.visuals.border_line.set_value(ctx);\n ctx.stroke();\n }\n if (this.visuals.text.doit) {\n this.visuals.text.set_value(ctx);\n ctx.fillText(text, 0, 0);\n }\n ctx.restore();\n };\n TextAnnotationView.prototype._css_text = function (ctx, text, sx, sy, angle) {\n dom_1.hide(this.el);\n this.visuals.text.set_value(ctx);\n var bbox_dims = this._calculate_bounding_box_dimensions(ctx, text);\n // attempt to support vector string-style (\"8 4 8\") line dashing for css mode\n var ld = this.visuals.border_line.line_dash.value();\n var line_dash = ld.length < 2 ? \"solid\" : \"dashed\";\n this.visuals.border_line.set_value(ctx);\n this.visuals.background_fill.set_value(ctx);\n this.el.style.position = 'absolute';\n this.el.style.left = sx + bbox_dims[0] + \"px\";\n this.el.style.top = sy + bbox_dims[1] + \"px\";\n this.el.style.color = \"\" + this.visuals.text.text_color.value();\n this.el.style.opacity = \"\" + this.visuals.text.text_alpha.value();\n this.el.style.font = \"\" + this.visuals.text.font_value();\n this.el.style.lineHeight = \"normal\"; // needed to prevent ipynb css override\n if (angle) {\n this.el.style.transform = \"rotate(\" + angle + \"rad)\";\n }\n if (this.visuals.background_fill.doit) {\n this.el.style.backgroundColor = \"\" + this.visuals.background_fill.color_value();\n }\n if (this.visuals.border_line.doit) {\n this.el.style.borderStyle = \"\" + line_dash;\n this.el.style.borderWidth = this.visuals.border_line.line_width.value() + \"px\";\n this.el.style.borderColor = \"\" + this.visuals.border_line.color_value();\n }\n this.el.textContent = text;\n dom_1.show(this.el);\n };\n return TextAnnotationView;\n }(annotation_1.AnnotationView));\n exports.TextAnnotationView = TextAnnotationView;\n var TextAnnotation = /** @class */ (function (_super) {\n tslib_1.__extends(TextAnnotation, _super);\n function TextAnnotation(attrs) {\n return _super.call(this, attrs) || this;\n }\n TextAnnotation.initClass = function () {\n this.prototype.type = \"TextAnnotation\";\n this.define({\n render_mode: [p.RenderMode, \"canvas\"],\n });\n };\n return TextAnnotation;\n }(annotation_1.Annotation));\n exports.TextAnnotation = TextAnnotation;\n TextAnnotation.initClass();\n}\n","/* models/annotations/title */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var text_annotation_1 = require(74) /* ./text_annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var visuals_1 = require(49) /* core/visuals */;\n var TitleView = /** @class */ (function (_super) {\n tslib_1.__extends(TitleView, _super);\n function TitleView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TitleView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.visuals.text = new visuals_1.Text(this.model);\n };\n TitleView.prototype._get_location = function () {\n var panel = this.model.panel;\n var hmargin = this.model.offset;\n var vmargin = 5;\n var sx, sy;\n switch (panel.side) {\n case 'above':\n case 'below': {\n switch (this.model.vertical_align) {\n case 'top':\n sy = panel._top.value + vmargin;\n break;\n case 'middle':\n sy = panel._vcenter.value;\n break;\n case 'bottom':\n sy = panel._bottom.value - vmargin;\n break;\n default: throw new Error(\"unreachable code\");\n }\n switch (this.model.align) {\n case 'left':\n sx = panel._left.value + hmargin;\n break;\n case 'center':\n sx = panel._hcenter.value;\n break;\n case 'right':\n sx = panel._right.value - hmargin;\n break;\n default: throw new Error(\"unreachable code\");\n }\n break;\n }\n case 'left': {\n switch (this.model.vertical_align) {\n case 'top':\n sx = panel._left.value - vmargin;\n break;\n case 'middle':\n sx = panel._hcenter.value;\n break;\n case 'bottom':\n sx = panel._right.value + vmargin;\n break;\n default: throw new Error(\"unreachable code\");\n }\n switch (this.model.align) {\n case 'left':\n sy = panel._bottom.value - hmargin;\n break;\n case 'center':\n sy = panel._vcenter.value;\n break;\n case 'right':\n sy = panel._top.value + hmargin;\n break;\n default: throw new Error(\"unreachable code\");\n }\n break;\n }\n case 'right': {\n switch (this.model.vertical_align) {\n case 'top':\n sx = panel._right.value - vmargin;\n break;\n case 'middle':\n sx = panel._hcenter.value;\n break;\n case 'bottom':\n sx = panel._left.value + vmargin;\n break;\n default: throw new Error(\"unreachable code\");\n }\n switch (this.model.align) {\n case 'left':\n sy = panel._top.value + hmargin;\n break;\n case 'center':\n sy = panel._vcenter.value;\n break;\n case 'right':\n sy = panel._bottom.value - hmargin;\n break;\n default: throw new Error(\"unreachable code\");\n }\n break;\n }\n default: throw new Error(\"unreachable code\");\n }\n return [sx, sy];\n };\n TitleView.prototype.render = function () {\n if (!this.model.visible) {\n if (this.model.render_mode == 'css')\n dom_1.hide(this.el);\n return;\n }\n var text = this.model.text;\n if (text == null || text.length == 0)\n return;\n this.model.text_baseline = this.model.vertical_align;\n this.model.text_align = this.model.align;\n var _a = this._get_location(), sx = _a[0], sy = _a[1];\n var angle = this.model.panel.get_label_angle_heuristic('parallel');\n var draw = this.model.render_mode == 'canvas' ? this._canvas_text.bind(this) : this._css_text.bind(this);\n draw(this.plot_view.canvas_view.ctx, text, sx, sy, angle);\n };\n TitleView.prototype._get_size = function () {\n var text = this.model.text;\n if (text == null || text.length == 0)\n return 0;\n else {\n var ctx = this.plot_view.canvas_view.ctx;\n this.visuals.text.set_value(ctx);\n return ctx.measureText(text).ascent + 10;\n }\n };\n return TitleView;\n }(text_annotation_1.TextAnnotationView));\n exports.TitleView = TitleView;\n var Title = /** @class */ (function (_super) {\n tslib_1.__extends(Title, _super);\n function Title(attrs) {\n return _super.call(this, attrs) || this;\n }\n Title.initClass = function () {\n this.prototype.type = 'Title';\n this.prototype.default_view = TitleView;\n this.mixins(['line:border_', 'fill:background_']);\n this.define({\n text: [p.String,],\n text_font: [p.Font, 'helvetica'],\n text_font_size: [p.FontSizeSpec, '10pt'],\n text_font_style: [p.FontStyle, 'bold'],\n text_color: [p.ColorSpec, '#444444'],\n text_alpha: [p.NumberSpec, 1.0],\n vertical_align: [p.VerticalAlign, 'bottom'],\n align: [p.TextAlign, 'left'],\n offset: [p.Number, 0],\n });\n this.override({\n background_fill_color: null,\n border_line_color: null,\n });\n this.internal({\n text_align: [p.TextAlign, 'left'],\n text_baseline: [p.TextBaseline, 'bottom'],\n });\n };\n return Title;\n }(text_annotation_1.TextAnnotation));\n exports.Title = Title;\n Title.initClass();\n}\n","/* models/annotations/toolbar_panel */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var build_views_1 = require(4) /* core/build_views */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var ToolbarPanelView = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarPanelView, _super);\n function ToolbarPanelView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ToolbarPanelView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.plot_view.canvas_events.appendChild(this.el);\n this._toolbar_views = {};\n build_views_1.build_views(this._toolbar_views, [this.model.toolbar], { parent: this });\n var toolbar_view = this._toolbar_views[this.model.toolbar.id];\n this.plot_view.visibility_callbacks.push(function (visible) { return toolbar_view.set_visibility(visible); });\n };\n ToolbarPanelView.prototype.remove = function () {\n build_views_1.remove_views(this._toolbar_views);\n _super.prototype.remove.call(this);\n };\n ToolbarPanelView.prototype.render = function () {\n _super.prototype.render.call(this);\n if (!this.model.visible) {\n dom_1.hide(this.el);\n return;\n }\n var panel = this.model.panel;\n this.el.style.position = \"absolute\";\n this.el.style.left = panel._left.value + \"px\";\n this.el.style.top = panel._top.value + \"px\";\n this.el.style.width = panel._width.value + \"px\";\n this.el.style.height = panel._height.value + \"px\";\n this.el.style.overflow = \"hidden\";\n var toolbar_view = this._toolbar_views[this.model.toolbar.id];\n toolbar_view.render();\n dom_1.empty(this.el);\n this.el.appendChild(toolbar_view.el);\n dom_1.show(this.el);\n };\n ToolbarPanelView.prototype._get_size = function () {\n return 30;\n };\n return ToolbarPanelView;\n }(annotation_1.AnnotationView));\n exports.ToolbarPanelView = ToolbarPanelView;\n var ToolbarPanel = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarPanel, _super);\n function ToolbarPanel(attrs) {\n return _super.call(this, attrs) || this;\n }\n ToolbarPanel.initClass = function () {\n this.prototype.type = 'ToolbarPanel';\n this.prototype.default_view = ToolbarPanelView;\n this.define({\n toolbar: [p.Instance],\n });\n };\n return ToolbarPanel;\n }(annotation_1.Annotation));\n exports.ToolbarPanel = ToolbarPanel;\n ToolbarPanel.initClass();\n}\n","/* models/annotations/tooltip */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n function compute_side(attachment, sx, sy, hcenter, vcenter) {\n var side;\n switch (attachment) {\n case \"horizontal\":\n side = sx < hcenter ? 'right' : 'left';\n break;\n case \"vertical\":\n side = sy < vcenter ? 'below' : 'above';\n break;\n default:\n side = attachment;\n }\n return side;\n }\n exports.compute_side = compute_side;\n var TooltipView = /** @class */ (function (_super) {\n tslib_1.__extends(TooltipView, _super);\n function TooltipView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TooltipView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n // TODO (bev) really probably need multiple divs\n this.plot_view.canvas_overlays.appendChild(this.el);\n dom_1.hide(this.el);\n };\n TooltipView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.data.change, function () { return _this._draw_tips(); });\n };\n TooltipView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-tooltip\");\n };\n TooltipView.prototype.render = function () {\n if (!this.model.visible)\n return;\n this._draw_tips();\n };\n TooltipView.prototype._draw_tips = function () {\n var data = this.model.data;\n dom_1.empty(this.el);\n dom_1.hide(this.el);\n if (this.model.custom)\n this.el.classList.add(\"bk-tooltip-custom\");\n else\n this.el.classList.remove(\"bk-tooltip-custom\");\n if (data.length == 0)\n return;\n var frame = this.plot_view.frame;\n for (var _i = 0, data_1 = data; _i < data_1.length; _i++) {\n var _a = data_1[_i], sx_1 = _a[0], sy_1 = _a[1], content = _a[2];\n if (this.model.inner_only && !frame.bbox.contains(sx_1, sy_1))\n continue;\n var tip = dom_1.div({}, content);\n this.el.appendChild(tip);\n }\n var _b = data[data.length - 1], sx = _b[0], sy = _b[1]; // XXX: this previously depended on {sx, sy} leaking from the for-loop\n var side = compute_side(this.model.attachment, sx, sy, frame._hcenter.value, frame._vcenter.value);\n this.el.classList.remove(\"bk-right\");\n this.el.classList.remove(\"bk-left\");\n this.el.classList.remove(\"bk-above\");\n this.el.classList.remove(\"bk-below\");\n var arrow_size = 10; // XXX: keep in sync with less\n dom_1.show(this.el); // XXX: {offset,client}Width() gives 0 when display=\"none\"\n // slightly confusing: side \"left\" (for example) is relative to point that\n // is being annotated but CS class \"bk-left\" is relative to the tooltip itself\n var left, top;\n switch (side) {\n case \"right\":\n this.el.classList.add(\"bk-left\");\n left = sx + (this.el.offsetWidth - this.el.clientWidth) + arrow_size;\n top = sy - this.el.offsetHeight / 2;\n break;\n case \"left\":\n this.el.classList.add(\"bk-right\");\n left = sx - this.el.offsetWidth - arrow_size;\n top = sy - this.el.offsetHeight / 2;\n break;\n case \"below\":\n this.el.classList.add(\"bk-above\");\n top = sy + (this.el.offsetHeight - this.el.clientHeight) + arrow_size;\n left = Math.round(sx - this.el.offsetWidth / 2);\n break;\n case \"above\":\n this.el.classList.add(\"bk-below\");\n top = sy - this.el.offsetHeight - arrow_size;\n left = Math.round(sx - this.el.offsetWidth / 2);\n break;\n default:\n throw new Error(\"unreachable code\");\n }\n if (this.model.show_arrow)\n this.el.classList.add(\"bk-tooltip-arrow\");\n // TODO (bev) this is not currently bulletproof. If there are\n // two hits, not colocated and one is off the screen, that can\n // be problematic\n if (this.el.childNodes.length > 0) {\n this.el.style.top = top + \"px\";\n this.el.style.left = left + \"px\";\n }\n else\n dom_1.hide(this.el);\n };\n return TooltipView;\n }(annotation_1.AnnotationView));\n exports.TooltipView = TooltipView;\n var Tooltip = /** @class */ (function (_super) {\n tslib_1.__extends(Tooltip, _super);\n function Tooltip(attrs) {\n return _super.call(this, attrs) || this;\n }\n Tooltip.initClass = function () {\n this.prototype.type = 'Tooltip';\n this.prototype.default_view = TooltipView;\n this.define({\n attachment: [p.String, 'horizontal'],\n inner_only: [p.Bool, true],\n show_arrow: [p.Bool, true],\n });\n this.override({\n level: 'overlay',\n });\n this.internal({\n data: [p.Any, []],\n custom: [p.Any],\n });\n };\n Tooltip.prototype.clear = function () {\n this.data = [];\n };\n Tooltip.prototype.add = function (sx, sy, content) {\n this.data = this.data.concat([[sx, sy, content]]);\n };\n return Tooltip;\n }(annotation_1.Annotation));\n exports.Tooltip = Tooltip;\n Tooltip.initClass();\n}\n","/* models/annotations/whisker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var annotation_1 = require(60) /* ./annotation */;\n var column_data_source_1 = require(200) /* ../sources/column_data_source */;\n var arrow_head_1 = require(62) /* ./arrow_head */;\n var p = require(15) /* core/properties */;\n var WhiskerView = /** @class */ (function (_super) {\n tslib_1.__extends(WhiskerView, _super);\n function WhiskerView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WhiskerView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.set_data(this.model.source);\n };\n WhiskerView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.source.streaming, function () { return _this.set_data(_this.model.source); });\n this.connect(this.model.source.patching, function () { return _this.set_data(_this.model.source); });\n this.connect(this.model.source.change, function () { return _this.set_data(_this.model.source); });\n };\n WhiskerView.prototype.set_data = function (source) {\n _super.prototype.set_data.call(this, source);\n this.visuals.warm_cache(source);\n this.plot_view.request_render();\n };\n WhiskerView.prototype._map_data = function () {\n var frame = this.plot_model.frame;\n var dim = this.model.dimension;\n var xscale = frame.xscales[this.model.x_range_name];\n var yscale = frame.yscales[this.model.y_range_name];\n var limit_scale = dim == \"height\" ? yscale : xscale;\n var base_scale = dim == \"height\" ? xscale : yscale;\n var limit_view = dim == \"height\" ? frame.yview : frame.xview;\n var base_view = dim == \"height\" ? frame.xview : frame.yview;\n var _lower_sx;\n if (this.model.lower.units == \"data\")\n _lower_sx = limit_scale.v_compute(this._lower);\n else\n _lower_sx = limit_view.v_compute(this._lower);\n var _upper_sx;\n if (this.model.upper.units == \"data\")\n _upper_sx = limit_scale.v_compute(this._upper);\n else\n _upper_sx = limit_view.v_compute(this._upper);\n var _base_sx;\n if (this.model.base.units == \"data\")\n _base_sx = base_scale.v_compute(this._base);\n else\n _base_sx = base_view.v_compute(this._base);\n var _a = dim == 'height' ? [1, 0] : [0, 1], i = _a[0], j = _a[1];\n var _lower = [_lower_sx, _base_sx];\n var _upper = [_upper_sx, _base_sx];\n this._lower_sx = _lower[i];\n this._lower_sy = _lower[j];\n this._upper_sx = _upper[i];\n this._upper_sy = _upper[j];\n };\n WhiskerView.prototype.render = function () {\n if (!this.model.visible)\n return;\n this._map_data();\n var ctx = this.plot_view.canvas_view.ctx;\n if (this.visuals.line.doit) {\n for (var i = 0, end = this._lower_sx.length; i < end; i++) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.beginPath();\n ctx.moveTo(this._lower_sx[i], this._lower_sy[i]);\n ctx.lineTo(this._upper_sx[i], this._upper_sy[i]);\n ctx.stroke();\n }\n }\n var angle = this.model.dimension == \"height\" ? 0 : Math.PI / 2;\n if (this.model.lower_head != null) {\n for (var i = 0, end = this._lower_sx.length; i < end; i++) {\n ctx.save();\n ctx.translate(this._lower_sx[i], this._lower_sy[i]);\n ctx.rotate(angle + Math.PI);\n this.model.lower_head.render(ctx, i);\n ctx.restore();\n }\n }\n if (this.model.upper_head != null) {\n for (var i = 0, end = this._upper_sx.length; i < end; i++) {\n ctx.save();\n ctx.translate(this._upper_sx[i], this._upper_sy[i]);\n ctx.rotate(angle);\n this.model.upper_head.render(ctx, i);\n ctx.restore();\n }\n }\n };\n return WhiskerView;\n }(annotation_1.AnnotationView));\n exports.WhiskerView = WhiskerView;\n var Whisker = /** @class */ (function (_super) {\n tslib_1.__extends(Whisker, _super);\n function Whisker(attrs) {\n return _super.call(this, attrs) || this;\n }\n Whisker.initClass = function () {\n this.prototype.type = 'Whisker';\n this.prototype.default_view = WhiskerView;\n this.mixins(['line']);\n this.define({\n lower: [p.DistanceSpec],\n lower_head: [p.Instance, function () { return new arrow_head_1.TeeHead({ level: \"underlay\", size: 10 }); }],\n upper: [p.DistanceSpec],\n upper_head: [p.Instance, function () { return new arrow_head_1.TeeHead({ level: \"underlay\", size: 10 }); }],\n base: [p.DistanceSpec],\n dimension: [p.Dimension, 'height'],\n source: [p.Instance, function () { return new column_data_source_1.ColumnDataSource(); }],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.override({\n level: 'underlay',\n });\n };\n return Whisker;\n }(annotation_1.Annotation));\n exports.Whisker = Whisker;\n Whisker.initClass();\n}\n","/* models/axes/axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var guide_renderer_1 = require(187) /* ../renderers/guide_renderer */;\n var p = require(15) /* core/properties */;\n var side_panel_1 = require(12) /* core/layout/side_panel */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var factor_range_1 = require(181) /* models/ranges/factor_range */;\n var abs = Math.abs, min = Math.min, max = Math.max;\n var AxisView = /** @class */ (function (_super) {\n tslib_1.__extends(AxisView, _super);\n function AxisView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AxisView.prototype.render = function () {\n if (!this.model.visible)\n return;\n var extents = {\n tick: this._tick_extent(),\n tick_label: this._tick_label_extents(),\n axis_label: this._axis_label_extent(),\n };\n var tick_coords = this.model.tick_coords;\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n this._draw_rule(ctx, extents);\n this._draw_major_ticks(ctx, extents, tick_coords);\n this._draw_minor_ticks(ctx, extents, tick_coords);\n this._draw_major_labels(ctx, extents, tick_coords);\n this._draw_axis_label(ctx, extents, tick_coords);\n if (this._render != null)\n this._render(ctx, extents, tick_coords);\n ctx.restore();\n };\n AxisView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.plot_view.request_render(); });\n };\n AxisView.prototype.get_size = function () {\n return this.model.visible ? Math.round(this._get_size()) : 0;\n };\n AxisView.prototype._get_size = function () {\n if (this.model.fixed_location != null) {\n return 0;\n }\n return this._tick_extent() + this._tick_label_extent() + this._axis_label_extent();\n };\n Object.defineProperty(AxisView.prototype, \"needs_clip\", {\n get: function () {\n return this.model.fixed_location != null;\n },\n enumerable: true,\n configurable: true\n });\n // drawing sub functions -----------------------------------------------------\n AxisView.prototype._draw_rule = function (ctx, _extents) {\n if (!this.visuals.axis_line.doit)\n return;\n var _a = this.model.rule_coords, xs = _a[0], ys = _a[1];\n var _b = this.plot_view.map_to_screen(xs, ys, this.model.x_range_name, this.model.y_range_name), sxs = _b[0], sys = _b[1];\n var _c = this.model.normals, nx = _c[0], ny = _c[1];\n var _d = this.model.offsets, xoff = _d[0], yoff = _d[1];\n this.visuals.axis_line.set_value(ctx);\n ctx.beginPath();\n ctx.moveTo(Math.round(sxs[0] + nx * xoff), Math.round(sys[0] + ny * yoff));\n for (var i = 1; i < sxs.length; i++) {\n var sx = Math.round(sxs[i] + nx * xoff);\n var sy = Math.round(sys[i] + ny * yoff);\n ctx.lineTo(sx, sy);\n }\n ctx.stroke();\n };\n AxisView.prototype._draw_major_ticks = function (ctx, _extents, tick_coords) {\n var tin = this.model.major_tick_in;\n var tout = this.model.major_tick_out;\n var visuals = this.visuals.major_tick_line;\n this._draw_ticks(ctx, tick_coords.major, tin, tout, visuals);\n };\n AxisView.prototype._draw_minor_ticks = function (ctx, _extents, tick_coords) {\n var tin = this.model.minor_tick_in;\n var tout = this.model.minor_tick_out;\n var visuals = this.visuals.minor_tick_line;\n this._draw_ticks(ctx, tick_coords.minor, tin, tout, visuals);\n };\n AxisView.prototype._draw_major_labels = function (ctx, extents, tick_coords) {\n var coords = tick_coords.major;\n var labels = this.model.compute_labels(coords[this.model.dimension]);\n var orient = this.model.major_label_orientation;\n var standoff = extents.tick + this.model.major_label_standoff;\n var visuals = this.visuals.major_label_text;\n this._draw_oriented_labels(ctx, labels, coords, orient, this.model.panel.side, standoff, visuals);\n };\n AxisView.prototype._draw_axis_label = function (ctx, extents, _tick_coords) {\n if (this.model.axis_label == null || this.model.axis_label.length == 0 || this.model.fixed_location != null)\n return;\n var sx;\n var sy;\n switch (this.model.panel.side) {\n case \"above\":\n sx = this.model.panel._hcenter.value;\n sy = this.model.panel._bottom.value;\n break;\n case \"below\":\n sx = this.model.panel._hcenter.value;\n sy = this.model.panel._top.value;\n break;\n case \"left\":\n sx = this.model.panel._right.value;\n sy = this.model.panel._vcenter.value;\n break;\n case \"right\":\n sx = this.model.panel._left.value;\n sy = this.model.panel._vcenter.value;\n break;\n default:\n throw new Error(\"unknown side: \" + this.model.panel.side);\n }\n var coords = [[sx], [sy]];\n var standoff = extents.tick + array_1.sum(extents.tick_label) + this.model.axis_label_standoff;\n var visuals = this.visuals.axis_label_text;\n this._draw_oriented_labels(ctx, [this.model.axis_label], coords, 'parallel', this.model.panel.side, standoff, visuals, \"screen\");\n };\n AxisView.prototype._draw_ticks = function (ctx, coords, tin, tout, visuals) {\n if (!visuals.doit)\n return;\n var x = coords[0], y = coords[1];\n var _a = this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name), sxs = _a[0], sys = _a[1];\n var _b = this.model.normals, nx = _b[0], ny = _b[1];\n var _c = this.model.offsets, xoff = _c[0], yoff = _c[1];\n var _d = [nx * (xoff - tin), ny * (yoff - tin)], nxin = _d[0], nyin = _d[1];\n var _e = [nx * (xoff + tout), ny * (yoff + tout)], nxout = _e[0], nyout = _e[1];\n visuals.set_value(ctx);\n for (var i = 0; i < sxs.length; i++) {\n var sx0 = Math.round(sxs[i] + nxout);\n var sy0 = Math.round(sys[i] + nyout);\n var sx1 = Math.round(sxs[i] + nxin);\n var sy1 = Math.round(sys[i] + nyin);\n ctx.beginPath();\n ctx.moveTo(sx0, sy0);\n ctx.lineTo(sx1, sy1);\n ctx.stroke();\n }\n };\n AxisView.prototype._draw_oriented_labels = function (ctx, labels, coords, orient, _side, standoff, visuals, units) {\n if (units === void 0) {\n units = \"data\";\n }\n var _a, _b, _c;\n if (!visuals.doit || labels.length == 0)\n return;\n var sxs, sys;\n var xoff, yoff;\n if (units == \"screen\") {\n sxs = coords[0], sys = coords[1];\n _a = [0, 0], xoff = _a[0], yoff = _a[1];\n }\n else {\n var dxs = coords[0], dys = coords[1];\n _b = this.plot_view.map_to_screen(dxs, dys, this.model.x_range_name, this.model.y_range_name), sxs = _b[0], sys = _b[1];\n _c = this.model.offsets, xoff = _c[0], yoff = _c[1];\n }\n var _d = this.model.normals, nx = _d[0], ny = _d[1];\n var nxd = nx * (xoff + standoff);\n var nyd = ny * (yoff + standoff);\n visuals.set_value(ctx);\n this.model.panel.apply_label_text_heuristics(ctx, orient);\n var angle;\n if (types_1.isString(orient))\n angle = this.model.panel.get_label_angle_heuristic(orient);\n else\n angle = -orient;\n for (var i = 0; i < sxs.length; i++) {\n var sx = Math.round(sxs[i] + nxd);\n var sy = Math.round(sys[i] + nyd);\n ctx.translate(sx, sy);\n ctx.rotate(angle);\n ctx.fillText(labels[i], 0, 0);\n ctx.rotate(-angle);\n ctx.translate(-sx, -sy);\n }\n };\n // extents sub functions -----------------------------------------------------\n /*protected*/ AxisView.prototype._axis_label_extent = function () {\n if (this.model.axis_label == null || this.model.axis_label == \"\")\n return 0;\n var standoff = this.model.axis_label_standoff;\n var visuals = this.visuals.axis_label_text;\n return this._oriented_labels_extent([this.model.axis_label], \"parallel\", this.model.panel.side, standoff, visuals);\n };\n /*protected*/ AxisView.prototype._tick_extent = function () {\n return this.model.major_tick_out;\n };\n /*protected*/ AxisView.prototype._tick_label_extent = function () {\n return array_1.sum(this._tick_label_extents());\n };\n AxisView.prototype._tick_label_extents = function () {\n var coords = this.model.tick_coords.major;\n var labels = this.model.compute_labels(coords[this.model.dimension]);\n var orient = this.model.major_label_orientation;\n var standoff = this.model.major_label_standoff;\n var visuals = this.visuals.major_label_text;\n return [this._oriented_labels_extent(labels, orient, this.model.panel.side, standoff, visuals)];\n };\n AxisView.prototype._oriented_labels_extent = function (labels, orient, side, standoff, visuals) {\n if (labels.length == 0)\n return 0;\n var ctx = this.plot_view.canvas_view.ctx;\n visuals.set_value(ctx);\n var hscale;\n var angle;\n if (types_1.isString(orient)) {\n hscale = 1;\n angle = this.model.panel.get_label_angle_heuristic(orient);\n }\n else {\n hscale = 2;\n angle = -orient;\n }\n angle = Math.abs(angle);\n var c = Math.cos(angle);\n var s = Math.sin(angle);\n var extent = 0;\n for (var i = 0; i < labels.length; i++) {\n var w = ctx.measureText(labels[i]).width * 1.1;\n var h = ctx.measureText(labels[i]).ascent * 0.9;\n var val = void 0;\n if (side == \"above\" || side == \"below\")\n val = w * s + (h / hscale) * c;\n else\n val = w * c + (h / hscale) * s;\n // update extent if current value is larger\n if (val > extent)\n extent = val;\n }\n // only apply the standoff if we already have non-zero extent\n if (extent > 0)\n extent += standoff;\n return extent;\n };\n return AxisView;\n }(guide_renderer_1.GuideRendererView));\n exports.AxisView = AxisView;\n var Axis = /** @class */ (function (_super) {\n tslib_1.__extends(Axis, _super);\n function Axis(attrs) {\n return _super.call(this, attrs) || this;\n }\n Axis.initClass = function () {\n this.prototype.type = \"Axis\";\n this.prototype.default_view = AxisView;\n this.mixins([\n 'line:axis_',\n 'line:major_tick_',\n 'line:minor_tick_',\n 'text:major_label_',\n 'text:axis_label_',\n ]);\n this.define({\n bounds: [p.Any, 'auto'],\n ticker: [p.Instance, null],\n formatter: [p.Instance, null],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n axis_label: [p.String, ''],\n axis_label_standoff: [p.Int, 5],\n major_label_standoff: [p.Int, 5],\n major_label_orientation: [p.Any, \"horizontal\"],\n major_label_overrides: [p.Any, {}],\n major_tick_in: [p.Number, 2],\n major_tick_out: [p.Number, 6],\n minor_tick_in: [p.Number, 0],\n minor_tick_out: [p.Number, 4],\n fixed_location: [p.Any, null],\n });\n this.override({\n axis_line_color: 'black',\n major_tick_line_color: 'black',\n minor_tick_line_color: 'black',\n major_label_text_font_size: \"8pt\",\n major_label_text_align: \"center\",\n major_label_text_baseline: \"alphabetic\",\n axis_label_text_font_size: \"10pt\",\n axis_label_text_font_style: \"italic\",\n });\n };\n Axis.prototype.add_panel = function (side) {\n this.panel = new side_panel_1.SidePanel({ side: side });\n this.panel.attach_document(this.document); // XXX!\n };\n Object.defineProperty(Axis.prototype, \"normals\", {\n get: function () {\n return this.panel.normals;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"dimension\", {\n get: function () {\n return this.panel.dimension;\n },\n enumerable: true,\n configurable: true\n });\n Axis.prototype.compute_labels = function (ticks) {\n var labels = this.formatter.doFormat(ticks, this);\n for (var i = 0; i < ticks.length; i++) {\n if (ticks[i] in this.major_label_overrides)\n labels[i] = this.major_label_overrides[ticks[i]];\n }\n return labels;\n };\n Object.defineProperty(Axis.prototype, \"offsets\", {\n get: function () {\n var frame = this.plot.plot_canvas.frame;\n var _a = [0, 0], xoff = _a[0], yoff = _a[1];\n switch (this.panel.side) {\n case \"below\":\n yoff = abs(this.panel._top.value - frame._bottom.value);\n break;\n case \"above\":\n yoff = abs(this.panel._bottom.value - frame._top.value);\n break;\n case \"right\":\n xoff = abs(this.panel._left.value - frame._right.value);\n break;\n case \"left\":\n xoff = abs(this.panel._right.value - frame._left.value);\n break;\n }\n return [xoff, yoff];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"ranges\", {\n get: function () {\n var i = this.dimension;\n var j = (i + 1) % 2;\n var frame = this.plot.plot_canvas.frame;\n var ranges = [\n frame.x_ranges[this.x_range_name],\n frame.y_ranges[this.y_range_name],\n ];\n return [ranges[i], ranges[j]];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"computed_bounds\", {\n get: function () {\n var range = this.ranges[0];\n var user_bounds = this.bounds; // XXX: ? 'auto'\n var range_bounds = [range.min, range.max];\n if (user_bounds == 'auto')\n return [range.min, range.max];\n else if (types_1.isArray(user_bounds)) {\n var start = void 0;\n var end = void 0;\n var user_start = user_bounds[0], user_end = user_bounds[1];\n var range_start = range_bounds[0], range_end = range_bounds[1];\n if (abs(user_start - user_end) > abs(range_start - range_end)) {\n start = max(min(user_start, user_end), range_start);\n end = min(max(user_start, user_end), range_end);\n }\n else {\n start = min(user_start, user_end);\n end = max(user_start, user_end);\n }\n return [start, end];\n }\n else\n throw new Error(\"user bounds '\" + user_bounds + \"' not understood\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"rule_coords\", {\n get: function () {\n var i = this.dimension;\n var j = (i + 1) % 2;\n var range = this.ranges[0];\n var _a = this.computed_bounds, start = _a[0], end = _a[1];\n var xs = new Array(2);\n var ys = new Array(2);\n var coords = [xs, ys];\n coords[i][0] = Math.max(start, range.min);\n coords[i][1] = Math.min(end, range.max);\n if (coords[i][0] > coords[i][1])\n coords[i][0] = coords[i][1] = NaN;\n coords[j][0] = this.loc;\n coords[j][1] = this.loc;\n return coords;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"tick_coords\", {\n get: function () {\n var i = this.dimension;\n var j = (i + 1) % 2;\n var range = this.ranges[0];\n var _a = this.computed_bounds, start = _a[0], end = _a[1];\n var ticks = this.ticker.get_ticks(start, end, range, this.loc, {});\n var majors = ticks.major;\n var minors = ticks.minor;\n var xs = [];\n var ys = [];\n var coords = [xs, ys];\n var minor_xs = [];\n var minor_ys = [];\n var minor_coords = [minor_xs, minor_ys];\n var _b = [range.min, range.max], range_min = _b[0], range_max = _b[1];\n for (var ii = 0; ii < majors.length; ii++) {\n if (majors[ii] < range_min || majors[ii] > range_max)\n continue;\n coords[i].push(majors[ii]);\n coords[j].push(this.loc);\n }\n for (var ii = 0; ii < minors.length; ii++) {\n if (minors[ii] < range_min || minors[ii] > range_max)\n continue;\n minor_coords[i].push(minors[ii]);\n minor_coords[j].push(this.loc);\n }\n return {\n major: coords,\n minor: minor_coords,\n };\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Axis.prototype, \"loc\", {\n get: function () {\n if (this.fixed_location != null) {\n if (types_1.isNumber(this.fixed_location)) {\n return this.fixed_location;\n }\n var _a = this.ranges, cross_range_1 = _a[1];\n if (cross_range_1 instanceof factor_range_1.FactorRange) {\n return cross_range_1.synthetic(this.fixed_location);\n }\n throw new Error(\"unexpected\");\n }\n var _b = this.ranges, cross_range = _b[1];\n switch (this.panel.side) {\n case 'left':\n case 'below':\n return cross_range.start;\n case 'right':\n case 'above':\n return cross_range.end;\n }\n },\n enumerable: true,\n configurable: true\n });\n return Axis;\n }(guide_renderer_1.GuideRenderer));\n exports.Axis = Axis;\n Axis.initClass();\n}\n","/* models/axes/categorical_axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var axis_1 = require(79) /* ./axis */;\n var categorical_ticker_1 = require(208) /* ../tickers/categorical_ticker */;\n var categorical_tick_formatter_1 = require(105) /* ../formatters/categorical_tick_formatter */;\n var p = require(15) /* core/properties */;\n var CategoricalAxisView = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalAxisView, _super);\n function CategoricalAxisView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CategoricalAxisView.prototype._render = function (ctx, extents, tick_coords) {\n this._draw_group_separators(ctx, extents, tick_coords);\n };\n CategoricalAxisView.prototype._draw_group_separators = function (ctx, _extents, _tick_coords) {\n var _a;\n var range = this.model.ranges[0];\n var _b = this.model.computed_bounds, start = _b[0], end = _b[1];\n if (!range.tops || range.tops.length < 2 || !this.visuals.separator_line.doit)\n return;\n var dim = this.model.dimension;\n var alt = (dim + 1) % 2;\n var coords = [[], []];\n var ind = 0;\n for (var i = 0; i < range.tops.length - 1; i++) {\n var first = void 0, last = void 0;\n for (var j = ind; j < range.factors.length; j++) {\n if (range.factors[j][0] == range.tops[i + 1]) {\n _a = [range.factors[j - 1], range.factors[j]], first = _a[0], last = _a[1];\n ind = j;\n break;\n }\n }\n var pt = (range.synthetic(first) + range.synthetic(last)) / 2;\n if (pt > start && pt < end) {\n coords[dim].push(pt);\n coords[alt].push(this.model.loc);\n }\n }\n var tex = this._tick_label_extent();\n this._draw_ticks(ctx, coords, -3, (tex - 6), this.visuals.separator_line);\n };\n CategoricalAxisView.prototype._draw_major_labels = function (ctx, extents, _tick_coords) {\n var info = this._get_factor_info();\n var standoff = extents.tick + this.model.major_label_standoff;\n for (var i = 0; i < info.length; i++) {\n var _a = info[i], labels = _a[0], coords = _a[1], orient = _a[2], visuals = _a[3];\n this._draw_oriented_labels(ctx, labels, coords, orient, this.model.panel.side, standoff, visuals);\n standoff += extents.tick_label[i];\n }\n };\n CategoricalAxisView.prototype._tick_label_extents = function () {\n var info = this._get_factor_info();\n var extents = [];\n for (var _i = 0, info_1 = info; _i < info_1.length; _i++) {\n var _a = info_1[_i], labels = _a[0], orient = _a[2], visuals = _a[3];\n var extent = this._oriented_labels_extent(labels, orient, this.model.panel.side, this.model.major_label_standoff, visuals);\n extents.push(extent);\n }\n return extents;\n };\n CategoricalAxisView.prototype._get_factor_info = function () {\n var range = this.model.ranges[0];\n var _a = this.model.computed_bounds, start = _a[0], end = _a[1];\n var loc = this.model.loc;\n var ticks = this.model.ticker.get_ticks(start, end, range, loc, {});\n var coords = this.model.tick_coords;\n var info = [];\n if (range.levels == 1) {\n var labels = this.model.formatter.doFormat(ticks.major, this.model);\n info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n }\n else if (range.levels == 2) {\n var labels = this.model.formatter.doFormat(ticks.major.map(function (x) { return x[1]; }), this.model);\n info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]);\n }\n else if (range.levels == 3) {\n var labels = this.model.formatter.doFormat(ticks.major.map(function (x) { return x[2]; }), this.model);\n var mid_labels = ticks.mids.map(function (x) { return x[1]; });\n info.push([labels, coords.major, this.model.major_label_orientation, this.visuals.major_label_text]);\n info.push([mid_labels, coords.mids, this.model.subgroup_label_orientation, this.visuals.subgroup_text]);\n info.push([ticks.tops, coords.tops, this.model.group_label_orientation, this.visuals.group_text]);\n }\n return info;\n };\n return CategoricalAxisView;\n }(axis_1.AxisView));\n exports.CategoricalAxisView = CategoricalAxisView;\n var CategoricalAxis = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalAxis, _super);\n function CategoricalAxis(attrs) {\n return _super.call(this, attrs) || this;\n }\n CategoricalAxis.initClass = function () {\n this.prototype.type = \"CategoricalAxis\";\n this.prototype.default_view = CategoricalAxisView;\n this.mixins([\n \"line:separator_\",\n \"text:group_\",\n \"text:subgroup_\",\n ]);\n this.define({\n group_label_orientation: [p.Any, \"parallel\"],\n subgroup_label_orientation: [p.Any, \"parallel\"],\n });\n this.override({\n ticker: function () { return new categorical_ticker_1.CategoricalTicker(); },\n formatter: function () { return new categorical_tick_formatter_1.CategoricalTickFormatter(); },\n separator_line_color: \"lightgrey\",\n separator_line_width: 2,\n group_text_font_style: \"bold\",\n group_text_font_size: \"8pt\",\n group_text_color: \"grey\",\n subgroup_text_font_style: \"bold\",\n subgroup_text_font_size: \"8pt\",\n });\n };\n Object.defineProperty(CategoricalAxis.prototype, \"tick_coords\", {\n get: function () {\n var _this = this;\n var i = this.dimension;\n var j = (i + 1) % 2;\n var range = this.ranges[0];\n var _a = this.computed_bounds, start = _a[0], end = _a[1];\n var ticks = this.ticker.get_ticks(start, end, range, this.loc, {});\n var coords = {\n major: [[], []],\n mids: [[], []],\n tops: [[], []],\n minor: [[], []],\n };\n coords.major[i] = ticks.major;\n coords.major[j] = ticks.major.map(function (_x) { return _this.loc; });\n if (range.levels == 3)\n coords.mids[i] = ticks.mids;\n coords.mids[j] = ticks.mids.map(function (_x) { return _this.loc; });\n if (range.levels > 1)\n coords.tops[i] = ticks.tops;\n coords.tops[j] = ticks.tops.map(function (_x) { return _this.loc; });\n return coords;\n },\n enumerable: true,\n configurable: true\n });\n return CategoricalAxis;\n }(axis_1.Axis));\n exports.CategoricalAxis = CategoricalAxis;\n CategoricalAxis.initClass();\n}\n","/* models/axes/continuous_axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var axis_1 = require(79) /* ./axis */;\n var ContinuousAxis = /** @class */ (function (_super) {\n tslib_1.__extends(ContinuousAxis, _super);\n function ContinuousAxis(attrs) {\n return _super.call(this, attrs) || this;\n }\n ContinuousAxis.initClass = function () {\n this.prototype.type = \"ContinuousAxis\";\n };\n return ContinuousAxis;\n }(axis_1.Axis));\n exports.ContinuousAxis = ContinuousAxis;\n ContinuousAxis.initClass();\n}\n","/* models/axes/datetime_axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var linear_axis_1 = require(84) /* ./linear_axis */;\n var datetime_tick_formatter_1 = require(106) /* ../formatters/datetime_tick_formatter */;\n var datetime_ticker_1 = require(211) /* ../tickers/datetime_ticker */;\n var DatetimeAxisView = /** @class */ (function (_super) {\n tslib_1.__extends(DatetimeAxisView, _super);\n function DatetimeAxisView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return DatetimeAxisView;\n }(linear_axis_1.LinearAxisView));\n exports.DatetimeAxisView = DatetimeAxisView;\n var DatetimeAxis = /** @class */ (function (_super) {\n tslib_1.__extends(DatetimeAxis, _super);\n function DatetimeAxis(attrs) {\n return _super.call(this, attrs) || this;\n }\n DatetimeAxis.initClass = function () {\n this.prototype.type = \"DatetimeAxis\";\n this.prototype.default_view = DatetimeAxisView;\n this.override({\n ticker: function () { return new datetime_ticker_1.DatetimeTicker(); },\n formatter: function () { return new datetime_tick_formatter_1.DatetimeTickFormatter(); },\n });\n };\n return DatetimeAxis;\n }(linear_axis_1.LinearAxis));\n exports.DatetimeAxis = DatetimeAxis;\n DatetimeAxis.initClass();\n}\n","/* models/axes/index */ function _(require, module, exports) {\n var axis_1 = require(79) /* ./axis */;\n exports.Axis = axis_1.Axis;\n var categorical_axis_1 = require(80) /* ./categorical_axis */;\n exports.CategoricalAxis = categorical_axis_1.CategoricalAxis;\n var continuous_axis_1 = require(81) /* ./continuous_axis */;\n exports.ContinuousAxis = continuous_axis_1.ContinuousAxis;\n var datetime_axis_1 = require(82) /* ./datetime_axis */;\n exports.DatetimeAxis = datetime_axis_1.DatetimeAxis;\n var linear_axis_1 = require(84) /* ./linear_axis */;\n exports.LinearAxis = linear_axis_1.LinearAxis;\n var log_axis_1 = require(85) /* ./log_axis */;\n exports.LogAxis = log_axis_1.LogAxis;\n var mercator_axis_1 = require(86) /* ./mercator_axis */;\n exports.MercatorAxis = mercator_axis_1.MercatorAxis;\n}\n","/* models/axes/linear_axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var axis_1 = require(79) /* ./axis */;\n var continuous_axis_1 = require(81) /* ./continuous_axis */;\n var basic_tick_formatter_1 = require(104) /* ../formatters/basic_tick_formatter */;\n var basic_ticker_1 = require(207) /* ../tickers/basic_ticker */;\n var LinearAxisView = /** @class */ (function (_super) {\n tslib_1.__extends(LinearAxisView, _super);\n function LinearAxisView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LinearAxisView;\n }(axis_1.AxisView));\n exports.LinearAxisView = LinearAxisView;\n var LinearAxis = /** @class */ (function (_super) {\n tslib_1.__extends(LinearAxis, _super);\n function LinearAxis(attrs) {\n return _super.call(this, attrs) || this;\n }\n LinearAxis.initClass = function () {\n this.prototype.type = \"LinearAxis\";\n this.prototype.default_view = LinearAxisView;\n this.override({\n ticker: function () { return new basic_ticker_1.BasicTicker(); },\n formatter: function () { return new basic_tick_formatter_1.BasicTickFormatter(); },\n });\n };\n return LinearAxis;\n }(continuous_axis_1.ContinuousAxis));\n exports.LinearAxis = LinearAxis;\n LinearAxis.initClass();\n}\n","/* models/axes/log_axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var axis_1 = require(79) /* ./axis */;\n var continuous_axis_1 = require(81) /* ./continuous_axis */;\n var log_tick_formatter_1 = require(109) /* ../formatters/log_tick_formatter */;\n var log_ticker_1 = require(215) /* ../tickers/log_ticker */;\n var LogAxisView = /** @class */ (function (_super) {\n tslib_1.__extends(LogAxisView, _super);\n function LogAxisView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return LogAxisView;\n }(axis_1.AxisView));\n exports.LogAxisView = LogAxisView;\n var LogAxis = /** @class */ (function (_super) {\n tslib_1.__extends(LogAxis, _super);\n function LogAxis(attrs) {\n return _super.call(this, attrs) || this;\n }\n LogAxis.initClass = function () {\n this.prototype.type = \"LogAxis\";\n this.prototype.default_view = LogAxisView;\n this.override({\n ticker: function () { return new log_ticker_1.LogTicker(); },\n formatter: function () { return new log_tick_formatter_1.LogTickFormatter(); },\n });\n };\n return LogAxis;\n }(continuous_axis_1.ContinuousAxis));\n exports.LogAxis = LogAxis;\n LogAxis.initClass();\n}\n","/* models/axes/mercator_axis */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var axis_1 = require(79) /* ./axis */;\n var linear_axis_1 = require(84) /* ./linear_axis */;\n var mercator_tick_formatter_1 = require(110) /* ../formatters/mercator_tick_formatter */;\n var mercator_ticker_1 = require(216) /* ../tickers/mercator_ticker */;\n var MercatorAxisView = /** @class */ (function (_super) {\n tslib_1.__extends(MercatorAxisView, _super);\n function MercatorAxisView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return MercatorAxisView;\n }(axis_1.AxisView));\n exports.MercatorAxisView = MercatorAxisView;\n var MercatorAxis = /** @class */ (function (_super) {\n tslib_1.__extends(MercatorAxis, _super);\n function MercatorAxis(attrs) {\n return _super.call(this, attrs) || this;\n }\n MercatorAxis.initClass = function () {\n this.prototype.type = \"MercatorAxis\";\n this.prototype.default_view = MercatorAxisView;\n this.override({\n ticker: function () { return new mercator_ticker_1.MercatorTicker({ dimension: \"lat\" }); },\n formatter: function () { return new mercator_tick_formatter_1.MercatorTickFormatter({ dimension: \"lat\" }); },\n });\n };\n return MercatorAxis;\n }(linear_axis_1.LinearAxis));\n exports.MercatorAxis = MercatorAxis;\n MercatorAxis.initClass();\n}\n","/* models/callbacks/callback */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var Callback = /** @class */ (function (_super) {\n tslib_1.__extends(Callback, _super);\n function Callback(attrs) {\n return _super.call(this, attrs) || this;\n }\n Callback.initClass = function () {\n this.prototype.type = 'Callback';\n };\n return Callback;\n }(model_1.Model));\n exports.Callback = Callback;\n Callback.initClass();\n}\n","/* models/callbacks/customjs */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var callback_1 = require(87) /* ./callback */;\n var p = require(15) /* core/properties */;\n var object_1 = require(32) /* core/util/object */;\n var string_1 = require(38) /* core/util/string */;\n var CustomJS = /** @class */ (function (_super) {\n tslib_1.__extends(CustomJS, _super);\n function CustomJS(attrs) {\n return _super.call(this, attrs) || this;\n }\n CustomJS.initClass = function () {\n this.prototype.type = 'CustomJS';\n this.define({\n args: [p.Any, {}],\n code: [p.String, ''],\n use_strict: [p.Boolean, false],\n });\n };\n Object.defineProperty(CustomJS.prototype, \"names\", {\n get: function () {\n return object_1.keys(this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CustomJS.prototype, \"values\", {\n get: function () {\n return object_1.values(this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CustomJS.prototype, \"func\", {\n get: function () {\n var code = this.use_strict ? string_1.use_strict(this.code) : this.code;\n return new (Function.bind.apply(Function, [void 0].concat(this.names, [\"cb_obj\", \"cb_data\", \"require\", \"exports\", code])))();\n },\n enumerable: true,\n configurable: true\n });\n CustomJS.prototype.execute = function (cb_obj, cb_data) {\n return this.func.apply(cb_obj, this.values.concat(cb_obj, cb_data, require, {}));\n };\n return CustomJS;\n }(callback_1.Callback));\n exports.CustomJS = CustomJS;\n CustomJS.initClass();\n}\n","/* models/callbacks/index */ function _(require, module, exports) {\n var customjs_1 = require(88) /* ./customjs */;\n exports.CustomJS = customjs_1.CustomJS;\n var open_url_1 = require(90) /* ./open_url */;\n exports.OpenURL = open_url_1.OpenURL;\n}\n","/* models/callbacks/open_url */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var callback_1 = require(87) /* ./callback */;\n var p = require(15) /* core/properties */;\n var selection_1 = require(35) /* core/util/selection */;\n var templating_1 = require(40) /* core/util/templating */;\n var OpenURL = /** @class */ (function (_super) {\n tslib_1.__extends(OpenURL, _super);\n function OpenURL(attrs) {\n return _super.call(this, attrs) || this;\n }\n OpenURL.initClass = function () {\n this.prototype.type = 'OpenURL';\n this.define({\n url: [p.String, 'http://'],\n });\n };\n OpenURL.prototype.execute = function (_cb_obj, cb_data) {\n for (var _i = 0, _a = selection_1.get_indices(cb_data.source); _i < _a.length; _i++) {\n var i = _a[_i];\n var url = templating_1.replace_placeholders(this.url, cb_data.source, i);\n window.open(url);\n }\n return null;\n };\n return OpenURL;\n }(callback_1.Callback));\n exports.OpenURL = OpenURL;\n OpenURL.initClass();\n}\n","/* models/canvas/canvas */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var layout_canvas_1 = require(11) /* core/layout/layout_canvas */;\n var dom_view_1 = require(6) /* core/dom_view */;\n var solver_1 = require(13) /* core/layout/solver */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var dom_1 = require(5) /* core/dom */;\n var canvas_1 = require(26) /* core/util/canvas */;\n // fixes up a problem with some versions of IE11\n // ref: http://stackoverflow.com/questions/22062313/imagedata-set-in-internetexplorer\n if (window.CanvasPixelArray != null) {\n window.CanvasPixelArray.prototype.set = function (arr) {\n for (var i = 0; i < this.length; i++) {\n this[i] = arr[i];\n }\n };\n }\n var CanvasView = /** @class */ (function (_super) {\n tslib_1.__extends(CanvasView, _super);\n function CanvasView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(CanvasView.prototype, \"ctx\", {\n get: function () {\n return this._ctx;\n },\n enumerable: true,\n configurable: true\n });\n CanvasView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.map_el = this.model.map ? this.el.appendChild(dom_1.div({ class: \"bk-canvas-map\" })) : null;\n switch (this.model.output_backend) {\n case \"canvas\":\n case \"webgl\": {\n this.canvas_el = this.el.appendChild(dom_1.canvas({ class: \"bk-canvas\" }));\n var ctx = this.canvas_el.getContext('2d');\n if (ctx == null)\n throw new Error(\"unable to obtain 2D rendering context\");\n this._ctx = ctx;\n break;\n }\n case \"svg\": {\n var ctx = new canvas_1.SVGRenderingContext2D();\n this._ctx = ctx;\n this.canvas_el = this.el.appendChild(ctx.getSvg());\n break;\n }\n }\n this.overlays_el = this.el.appendChild(dom_1.div({ class: \"bk-canvas-overlays\" }));\n this.events_el = this.el.appendChild(dom_1.div({ class: \"bk-canvas-events\" }));\n canvas_1.fixup_ctx(this._ctx);\n logging_1.logger.debug(\"CanvasView initialized\");\n };\n CanvasView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-canvas-wrapper\");\n };\n CanvasView.prototype.get_canvas_element = function () {\n return this.canvas_el;\n };\n CanvasView.prototype.prepare_canvas = function () {\n // Ensure canvas has the correct size, taking HIDPI into account\n var width = this.model._width.value;\n var height = this.model._height.value;\n this.el.style.width = width + \"px\";\n this.el.style.height = height + \"px\";\n var pixel_ratio = canvas_1.get_scale_ratio(this.ctx, this.model.use_hidpi, this.model.output_backend);\n this.model.pixel_ratio = pixel_ratio;\n this.canvas_el.style.width = width + \"px\";\n this.canvas_el.style.height = height + \"px\";\n // XXX: io.export and canvas2svg don't like this\n // this.canvas_el.width = width*pixel_ratio\n // this.canvas_el.height = height*pixel_ratio\n this.canvas_el.setAttribute(\"width\", \"\" + width * pixel_ratio);\n this.canvas_el.setAttribute(\"height\", \"\" + height * pixel_ratio);\n logging_1.logger.debug(\"Rendering CanvasView with width: \" + width + \", height: \" + height + \", pixel ratio: \" + pixel_ratio);\n };\n CanvasView.prototype.set_dims = function (_a) {\n var width = _a[0], height = _a[1];\n // XXX: for whatever reason we need to protect against those nonsense values,\n // that appear in the middle of updating layout. Otherwise we would get\n // all possible errors from the layout solver.\n if (width <= 0 || height <= 0)\n return;\n if (width != this.model._width.value) {\n if (this._width_constraint != null && this.solver.has_constraint(this._width_constraint))\n this.solver.remove_constraint(this._width_constraint);\n this._width_constraint = solver_1.EQ(this.model._width, -width);\n this.solver.add_constraint(this._width_constraint);\n }\n if (height != this.model._height.value) {\n if (this._height_constraint != null && this.solver.has_constraint(this._height_constraint))\n this.solver.remove_constraint(this._height_constraint);\n this._height_constraint = solver_1.EQ(this.model._height, -height);\n this.solver.add_constraint(this._height_constraint);\n }\n this.solver.update_variables();\n };\n return CanvasView;\n }(dom_view_1.DOMView));\n exports.CanvasView = CanvasView;\n var Canvas = /** @class */ (function (_super) {\n tslib_1.__extends(Canvas, _super);\n function Canvas(attrs) {\n return _super.call(this, attrs) || this;\n }\n Canvas.initClass = function () {\n this.prototype.type = \"Canvas\";\n this.prototype.default_view = CanvasView;\n this.internal({\n map: [p.Boolean, false],\n use_hidpi: [p.Boolean, true],\n pixel_ratio: [p.Number, 1],\n output_backend: [p.OutputBackend, \"canvas\"],\n });\n };\n Object.defineProperty(Canvas.prototype, \"panel\", {\n get: function () {\n return this;\n },\n enumerable: true,\n configurable: true\n });\n return Canvas;\n }(layout_canvas_1.LayoutCanvas));\n exports.Canvas = Canvas;\n Canvas.initClass();\n}\n","/* models/canvas/cartesian_frame */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var categorical_scale_1 = require(190) /* ../scales/categorical_scale */;\n var linear_scale_1 = require(192) /* ../scales/linear_scale */;\n var log_scale_1 = require(193) /* ../scales/log_scale */;\n var range1d_1 = require(184) /* ../ranges/range1d */;\n var data_range1d_1 = require(180) /* ../ranges/data_range1d */;\n var factor_range_1 = require(181) /* ../ranges/factor_range */;\n var layout_canvas_1 = require(11) /* core/layout/layout_canvas */;\n var p = require(15) /* core/properties */;\n var CartesianFrame = /** @class */ (function (_super) {\n tslib_1.__extends(CartesianFrame, _super);\n function CartesianFrame(attrs) {\n return _super.call(this, attrs) || this;\n }\n CartesianFrame.initClass = function () {\n this.prototype.type = \"CartesianFrame\";\n this.internal({\n extra_x_ranges: [p.Any, {}],\n extra_y_ranges: [p.Any, {}],\n x_range: [p.Instance],\n y_range: [p.Instance],\n x_scale: [p.Instance],\n y_scale: [p.Instance],\n });\n };\n CartesianFrame.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._configure_scales();\n };\n CartesianFrame.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.change, function () { return _this._configure_scales(); });\n };\n Object.defineProperty(CartesianFrame.prototype, \"panel\", {\n get: function () {\n return this;\n },\n enumerable: true,\n configurable: true\n });\n CartesianFrame.prototype.get_editables = function () {\n return _super.prototype.get_editables.call(this).concat([this._width, this._height]);\n };\n CartesianFrame.prototype.map_to_screen = function (x, y, x_name, y_name) {\n if (x_name === void 0) {\n x_name = \"default\";\n }\n if (y_name === void 0) {\n y_name = \"default\";\n }\n var sx = this.xscales[x_name].v_compute(x);\n var sy = this.yscales[y_name].v_compute(y);\n return [sx, sy];\n };\n CartesianFrame.prototype._get_ranges = function (range, extra_ranges) {\n var ranges = {};\n ranges[\"default\"] = range;\n if (extra_ranges != null) {\n for (var name_1 in extra_ranges)\n ranges[name_1] = extra_ranges[name_1];\n }\n return ranges;\n };\n CartesianFrame.prototype._get_scales = function (scale, ranges, frame_range) {\n var scales = {};\n for (var name_2 in ranges) {\n var range = ranges[name_2];\n if (range instanceof data_range1d_1.DataRange1d || range instanceof range1d_1.Range1d) {\n if (!(scale instanceof log_scale_1.LogScale) && !(scale instanceof linear_scale_1.LinearScale))\n throw new Error(\"Range \" + range.type + \" is incompatible is Scale \" + scale.type);\n // XXX: special case because CategoricalScale is a subclass of LinearScale, should be removed in future\n if (scale instanceof categorical_scale_1.CategoricalScale)\n throw new Error(\"Range \" + range.type + \" is incompatible is Scale \" + scale.type);\n }\n if (range instanceof factor_range_1.FactorRange) {\n if (!(scale instanceof categorical_scale_1.CategoricalScale))\n throw new Error(\"Range \" + range.type + \" is incompatible is Scale \" + scale.type);\n }\n if (scale instanceof log_scale_1.LogScale && range instanceof data_range1d_1.DataRange1d)\n range.scale_hint = \"log\";\n var s = scale.clone();\n s.setv({ source_range: range, target_range: frame_range });\n scales[name_2] = s;\n }\n return scales;\n };\n CartesianFrame.prototype._configure_frame_ranges = function () {\n // data to/from screen space transform (left-bottom <-> left-top origin)\n this._h_target = new range1d_1.Range1d({ start: this._left.value, end: this._right.value });\n this._v_target = new range1d_1.Range1d({ start: this._bottom.value, end: this._top.value });\n };\n CartesianFrame.prototype._configure_scales = function () {\n this._configure_frame_ranges();\n this._x_ranges = this._get_ranges(this.x_range, this.extra_x_ranges);\n this._y_ranges = this._get_ranges(this.y_range, this.extra_y_ranges);\n this._xscales = this._get_scales(this.x_scale, this._x_ranges, this._h_target);\n this._yscales = this._get_scales(this.y_scale, this._y_ranges, this._v_target);\n };\n CartesianFrame.prototype.update_scales = function () {\n this._configure_frame_ranges();\n for (var name_3 in this._xscales) {\n var scale = this._xscales[name_3];\n scale.target_range = this._h_target;\n }\n for (var name_4 in this._yscales) {\n var scale = this._yscales[name_4];\n scale.target_range = this._v_target;\n }\n };\n Object.defineProperty(CartesianFrame.prototype, \"x_ranges\", {\n get: function () {\n return this._x_ranges;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CartesianFrame.prototype, \"y_ranges\", {\n get: function () {\n return this._y_ranges;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CartesianFrame.prototype, \"xscales\", {\n get: function () {\n return this._xscales;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CartesianFrame.prototype, \"yscales\", {\n get: function () {\n return this._yscales;\n },\n enumerable: true,\n configurable: true\n });\n return CartesianFrame;\n }(layout_canvas_1.LayoutCanvas));\n exports.CartesianFrame = CartesianFrame;\n CartesianFrame.initClass();\n}\n","/* models/canvas/index */ function _(require, module, exports) {\n var canvas_1 = require(91) /* ./canvas */;\n exports.Canvas = canvas_1.Canvas;\n var cartesian_frame_1 = require(92) /* ./cartesian_frame */;\n exports.CartesianFrame = cartesian_frame_1.CartesianFrame;\n}\n","/* models/expressions/cumsum */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var expression_1 = require(95) /* ./expression */;\n var p = require(15) /* core/properties */;\n var CumSum = /** @class */ (function (_super) {\n tslib_1.__extends(CumSum, _super);\n function CumSum(attrs) {\n return _super.call(this, attrs) || this;\n }\n CumSum.initClass = function () {\n this.prototype.type = \"CumSum\";\n this.define({\n field: [p.String],\n include_zero: [p.Boolean, false],\n });\n };\n CumSum.prototype._v_compute = function (source) {\n var result = new Float64Array(source.get_length() || 0);\n var col = source.data[this.field];\n var offset = this.include_zero ? 1 : 0;\n result[0] = this.include_zero ? 0 : col[0];\n for (var i = 1; i < result.length; i++) {\n result[i] = result[i - 1] + col[i - offset];\n }\n return result;\n };\n return CumSum;\n }(expression_1.Expression));\n exports.CumSum = CumSum;\n CumSum.initClass();\n}\n","/* models/expressions/expression */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var Expression = /** @class */ (function (_super) {\n tslib_1.__extends(Expression, _super);\n function Expression(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this._connected = {};\n _this._result = {};\n return _this;\n }\n Expression.initClass = function () {\n this.prototype.type = \"Expression\";\n };\n Expression.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._connected = {};\n this._result = {};\n };\n Expression.prototype.v_compute = function (source) {\n var _this = this;\n if (this._connected[source.id] == null) {\n this.connect(source.change, function () { return delete _this._result[source.id]; });\n this.connect(source.patching, function () { return delete _this._result[source.id]; });\n this.connect(source.streaming, function () { return delete _this._result[source.id]; });\n this._connected[source.id] = true;\n }\n var result = this._result[source.id];\n if (result == null)\n this._result[source.id] = result = this._v_compute(source);\n return result;\n };\n return Expression;\n }(model_1.Model));\n exports.Expression = Expression;\n Expression.initClass();\n}\n","/* models/expressions/index */ function _(require, module, exports) {\n var expression_1 = require(95) /* ./expression */;\n exports.Expression = expression_1.Expression;\n var stack_1 = require(97) /* ./stack */;\n exports.Stack = stack_1.Stack;\n var cumsum_1 = require(94) /* ./cumsum */;\n exports.CumSum = cumsum_1.CumSum;\n}\n","/* models/expressions/stack */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var expression_1 = require(95) /* ./expression */;\n var p = require(15) /* core/properties */;\n var Stack = /** @class */ (function (_super) {\n tslib_1.__extends(Stack, _super);\n function Stack(attrs) {\n return _super.call(this, attrs) || this;\n }\n Stack.initClass = function () {\n this.prototype.type = \"Stack\";\n this.define({\n fields: [p.Array, []],\n });\n };\n Stack.prototype._v_compute = function (source) {\n var result = new Float64Array(source.get_length() || 0);\n for (var _i = 0, _a = this.fields; _i < _a.length; _i++) {\n var f = _a[_i];\n for (var i = 0; i < source.data[f].length; i++) {\n var x = source.data[f][i];\n result[i] += x;\n }\n }\n return result;\n };\n return Stack;\n }(expression_1.Expression));\n exports.Stack = Stack;\n Stack.initClass();\n}\n","/* models/filters/boolean_filter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var filter_1 = require(100) /* ./filter */;\n var p = require(15) /* core/properties */;\n var logging_1 = require(14) /* core/logging */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var BooleanFilter = /** @class */ (function (_super) {\n tslib_1.__extends(BooleanFilter, _super);\n function BooleanFilter(attrs) {\n return _super.call(this, attrs) || this;\n }\n BooleanFilter.initClass = function () {\n this.prototype.type = 'BooleanFilter';\n this.define({\n booleans: [p.Array, null],\n });\n };\n BooleanFilter.prototype.compute_indices = function (source) {\n var booleans = this.booleans;\n if (booleans != null && booleans.length > 0) {\n if (array_1.all(booleans, types_1.isBoolean)) {\n if (booleans.length !== source.get_length()) {\n logging_1.logger.warn(\"BooleanFilter \" + this.id + \": length of booleans doesn't match data source\");\n }\n return array_1.range(0, booleans.length).filter(function (i) { return booleans[i] === true; });\n }\n else {\n logging_1.logger.warn(\"BooleanFilter \" + this.id + \": booleans should be array of booleans, defaulting to no filtering\");\n return null;\n }\n }\n else {\n if (booleans != null && booleans.length == 0)\n logging_1.logger.warn(\"BooleanFilter \" + this.id + \": booleans is empty, defaulting to no filtering\");\n else\n logging_1.logger.warn(\"BooleanFilter \" + this.id + \": booleans was not set, defaulting to no filtering\");\n return null;\n }\n };\n return BooleanFilter;\n }(filter_1.Filter));\n exports.BooleanFilter = BooleanFilter;\n BooleanFilter.initClass();\n}\n","/* models/filters/customjs_filter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var filter_1 = require(100) /* ./filter */;\n var p = require(15) /* core/properties */;\n var object_1 = require(32) /* core/util/object */;\n var string_1 = require(38) /* core/util/string */;\n var CustomJSFilter = /** @class */ (function (_super) {\n tslib_1.__extends(CustomJSFilter, _super);\n function CustomJSFilter(attrs) {\n return _super.call(this, attrs) || this;\n }\n CustomJSFilter.initClass = function () {\n this.prototype.type = 'CustomJSFilter';\n this.define({\n args: [p.Any, {}],\n code: [p.String, ''],\n use_strict: [p.Boolean, false],\n });\n };\n Object.defineProperty(CustomJSFilter.prototype, \"names\", {\n get: function () {\n return object_1.keys(this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CustomJSFilter.prototype, \"values\", {\n get: function () {\n return object_1.values(this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CustomJSFilter.prototype, \"func\", {\n get: function () {\n var code = this.use_strict ? string_1.use_strict(this.code) : this.code;\n return new (Function.bind.apply(Function, [void 0].concat(this.names, [\"source\", \"require\", \"exports\", code])))();\n },\n enumerable: true,\n configurable: true\n });\n CustomJSFilter.prototype.compute_indices = function (source) {\n this.filter = this.func.apply(this, this.values.concat([source, require, {}]));\n return _super.prototype.compute_indices.call(this, source);\n };\n return CustomJSFilter;\n }(filter_1.Filter));\n exports.CustomJSFilter = CustomJSFilter;\n CustomJSFilter.initClass();\n}\n","/* models/filters/filter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var array_1 = require(21) /* core/util/array */;\n var logging_1 = require(14) /* core/logging */;\n var Filter = /** @class */ (function (_super) {\n tslib_1.__extends(Filter, _super);\n function Filter(attrs) {\n return _super.call(this, attrs) || this;\n }\n Filter.initClass = function () {\n this.prototype.type = 'Filter';\n this.define({\n filter: [p.Array, null],\n });\n };\n Filter.prototype.compute_indices = function (_source) {\n var filter = this.filter;\n if (filter != null && filter.length >= 0) {\n if (types_1.isArrayOf(filter, types_1.isBoolean)) {\n return array_1.range(0, filter.length).filter(function (i) { return filter[i] === true; });\n }\n if (types_1.isArrayOf(filter, types_1.isInteger)) {\n return filter;\n }\n logging_1.logger.warn(\"Filter \" + this.id + \": filter should either be array of only booleans or only integers, defaulting to no filtering\");\n return null;\n }\n else {\n logging_1.logger.warn(\"Filter \" + this.id + \": filter was not set to be an array, defaulting to no filtering\");\n return null;\n }\n };\n return Filter;\n }(model_1.Model));\n exports.Filter = Filter;\n Filter.initClass();\n}\n","/* models/filters/group_filter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var filter_1 = require(100) /* ./filter */;\n var p = require(15) /* core/properties */;\n var logging_1 = require(14) /* core/logging */;\n var array_1 = require(21) /* core/util/array */;\n var GroupFilter = /** @class */ (function (_super) {\n tslib_1.__extends(GroupFilter, _super);\n function GroupFilter(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.indices = null;\n return _this;\n }\n GroupFilter.initClass = function () {\n this.prototype.type = 'GroupFilter';\n this.define({\n column_name: [p.String],\n group: [p.String],\n });\n };\n GroupFilter.prototype.compute_indices = function (source) {\n var _this = this;\n var column = source.get_column(this.column_name);\n if (column == null) {\n logging_1.logger.warn(\"group filter: groupby column not found in data source\");\n return null;\n }\n else {\n this.indices = array_1.range(0, source.get_length() || 0).filter(function (i) { return column[i] === _this.group; });\n if (this.indices.length === 0) {\n logging_1.logger.warn(\"group filter: group '\" + this.group + \"' did not match any values in column '\" + this.column_name + \"'\");\n }\n return this.indices;\n }\n };\n return GroupFilter;\n }(filter_1.Filter));\n exports.GroupFilter = GroupFilter;\n GroupFilter.initClass();\n}\n","/* models/filters/index */ function _(require, module, exports) {\n var boolean_filter_1 = require(98) /* ./boolean_filter */;\n exports.BooleanFilter = boolean_filter_1.BooleanFilter;\n var customjs_filter_1 = require(99) /* ./customjs_filter */;\n exports.CustomJSFilter = customjs_filter_1.CustomJSFilter;\n var filter_1 = require(100) /* ./filter */;\n exports.Filter = filter_1.Filter;\n var group_filter_1 = require(101) /* ./group_filter */;\n exports.GroupFilter = group_filter_1.GroupFilter;\n var index_filter_1 = require(103) /* ./index_filter */;\n exports.IndexFilter = index_filter_1.IndexFilter;\n}\n","/* models/filters/index_filter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var filter_1 = require(100) /* ./filter */;\n var p = require(15) /* core/properties */;\n var logging_1 = require(14) /* core/logging */;\n var types_1 = require(44) /* core/util/types */;\n var array_1 = require(21) /* core/util/array */;\n var IndexFilter = /** @class */ (function (_super) {\n tslib_1.__extends(IndexFilter, _super);\n function IndexFilter(attrs) {\n return _super.call(this, attrs) || this;\n }\n IndexFilter.initClass = function () {\n this.prototype.type = 'IndexFilter';\n this.define({\n indices: [p.Array, null],\n });\n };\n IndexFilter.prototype.compute_indices = function (_source) {\n if (this.indices != null && this.indices.length >= 0) {\n if (array_1.all(this.indices, types_1.isInteger))\n return this.indices;\n else {\n logging_1.logger.warn(\"IndexFilter \" + this.id + \": indices should be array of integers, defaulting to no filtering\");\n return null;\n }\n }\n else {\n logging_1.logger.warn(\"IndexFilter \" + this.id + \": indices was not set, defaulting to no filtering\");\n return null;\n }\n };\n return IndexFilter;\n }(filter_1.Filter));\n exports.IndexFilter = IndexFilter;\n IndexFilter.initClass();\n}\n","/* models/formatters/basic_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var BasicTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(BasicTickFormatter, _super);\n function BasicTickFormatter(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.last_precision = 3;\n return _this;\n }\n BasicTickFormatter.initClass = function () {\n this.prototype.type = 'BasicTickFormatter';\n this.define({\n precision: [p.Any, 'auto'],\n use_scientific: [p.Bool, true],\n power_limit_high: [p.Number, 5],\n power_limit_low: [p.Number, -3],\n });\n };\n Object.defineProperty(BasicTickFormatter.prototype, \"scientific_limit_low\", {\n get: function () {\n return Math.pow(10.0, this.power_limit_low);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(BasicTickFormatter.prototype, \"scientific_limit_high\", {\n get: function () {\n return Math.pow(10.0, this.power_limit_high);\n },\n enumerable: true,\n configurable: true\n });\n BasicTickFormatter.prototype.doFormat = function (ticks, _axis) {\n if (ticks.length == 0)\n return [];\n var zero_eps = 0;\n if (ticks.length >= 2)\n zero_eps = Math.abs(ticks[1] - ticks[0]) / 10000;\n var need_sci = false;\n if (this.use_scientific) {\n for (var _i = 0, ticks_1 = ticks; _i < ticks_1.length; _i++) {\n var tick = ticks_1[_i];\n var tick_abs = Math.abs(tick);\n if (tick_abs > zero_eps && (tick_abs >= this.scientific_limit_high || tick_abs <= this.scientific_limit_low)) {\n need_sci = true;\n break;\n }\n }\n }\n var labels = new Array(ticks.length);\n var precision = this.precision;\n if (precision == null || types_1.isNumber(precision)) {\n if (need_sci) {\n for (var i = 0, end = ticks.length; i < end; i++) {\n labels[i] = ticks[i].toExponential(precision || undefined);\n }\n }\n else {\n for (var i = 0, end = ticks.length; i < end; i++) {\n labels[i] = ticks[i].toFixed(precision || undefined).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n }\n }\n }\n else {\n for (var x = this.last_precision, asc = this.last_precision <= 15; asc ? x <= 15 : x >= 15; asc ? x++ : x--) {\n var is_ok = true;\n if (need_sci) {\n for (var i = 0, end = ticks.length; i < end; i++) {\n labels[i] = ticks[i].toExponential(x);\n if (i > 0) {\n if (labels[i] === labels[i - 1]) {\n is_ok = false;\n break;\n }\n }\n }\n if (is_ok) {\n break;\n }\n }\n else {\n for (var i = 0, end = ticks.length; i < end; i++) {\n labels[i] = ticks[i].toFixed(x).replace(/(\\.[0-9]*?)0+$/, \"$1\").replace(/\\.$/, \"\");\n if (i > 0) {\n if (labels[i] == labels[i - 1]) {\n is_ok = false;\n break;\n }\n }\n }\n if (is_ok) {\n break;\n }\n }\n if (is_ok) {\n this.last_precision = x;\n break;\n }\n }\n }\n return labels;\n };\n return BasicTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.BasicTickFormatter = BasicTickFormatter;\n BasicTickFormatter.initClass();\n}\n","/* models/formatters/categorical_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var array_1 = require(21) /* core/util/array */;\n var CategoricalTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalTickFormatter, _super);\n function CategoricalTickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n CategoricalTickFormatter.initClass = function () {\n this.prototype.type = 'CategoricalTickFormatter';\n };\n CategoricalTickFormatter.prototype.doFormat = function (ticks, _axis) {\n return array_1.copy(ticks);\n };\n return CategoricalTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.CategoricalTickFormatter = CategoricalTickFormatter;\n CategoricalTickFormatter.initClass();\n}\n","/* models/formatters/datetime_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var sprintf_js_1 = require(389) /* sprintf-js */;\n var tz = require(390) /* timezone */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n function _us(t) {\n // From double-precision unix (millisecond) timestamp get\n // microsecond since last second. Precision seems to run\n // out around the hundreds of nanoseconds scale, so rounding\n // to the nearest microsecond should round to a nice\n // microsecond / millisecond tick.\n return Math.round(((t / 1000) % 1) * 1000000);\n }\n function _array(t) {\n return tz(t, \"%Y %m %d %H %M %S\").split(/\\s+/).map(function (e) { return parseInt(e, 10); });\n }\n function _strftime(t, format) {\n if (types_1.isFunction(format)) {\n return format(t);\n }\n else {\n // Python's datetime library augments the microsecond directive %f, which is not\n // supported by the javascript library timezone: http://bigeasy.github.io/timezone/.\n // Use a regular expression to replace %f directive with microseconds.\n // TODO: what should we do for negative microsecond strings?\n var microsecond_replacement_string = sprintf_js_1.sprintf(\"$1%06d\", _us(t));\n format = format.replace(/((^|[^%])(%%)*)%f/, microsecond_replacement_string);\n if (format.indexOf(\"%\") == -1) {\n // timezone seems to ignore any strings without any formatting directives,\n // and just return the time argument back instead of the string argument.\n // But we want the string argument, in case a user supplies a format string\n // which doesn't contain a formatting directive or is only using %f.\n return format;\n }\n return tz(t, format);\n }\n }\n // Labels of time units, from finest to coarsest.\n var format_order = [\n 'microseconds', 'milliseconds', 'seconds', 'minsec', 'minutes', 'hourmin', 'hours', 'days', 'months', 'years',\n ];\n var DatetimeTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(DatetimeTickFormatter, _super);\n function DatetimeTickFormatter(attrs) {\n var _this = _super.call(this, attrs) || this;\n // Whether or not to strip the leading zeros on tick labels.\n _this.strip_leading_zeros = true;\n return _this;\n }\n DatetimeTickFormatter.initClass = function () {\n this.prototype.type = 'DatetimeTickFormatter';\n this.define({\n microseconds: [p.Array, ['%fus']],\n milliseconds: [p.Array, ['%3Nms', '%S.%3Ns']],\n seconds: [p.Array, ['%Ss']],\n minsec: [p.Array, [':%M:%S']],\n minutes: [p.Array, [':%M', '%Mm']],\n hourmin: [p.Array, ['%H:%M']],\n hours: [p.Array, ['%Hh', '%H:%M']],\n days: [p.Array, ['%m/%d', '%a%d']],\n months: [p.Array, ['%m/%Y', '%b %Y']],\n years: [p.Array, ['%Y']],\n });\n };\n DatetimeTickFormatter.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n // TODO (bev) trigger update on format change\n this._update_width_formats();\n };\n DatetimeTickFormatter.prototype._update_width_formats = function () {\n var now = +tz(new Date());\n var _widths = function (fmt_strings) {\n var sizes = fmt_strings.map(function (fmt_string) { return _strftime(now, fmt_string).length; });\n var sorted = array_1.sortBy(array_1.zip(sizes, fmt_strings), function (_a) {\n var size = _a[0];\n return size;\n });\n return array_1.unzip(sorted);\n };\n this._width_formats = {\n microseconds: _widths(this.microseconds),\n milliseconds: _widths(this.milliseconds),\n seconds: _widths(this.seconds),\n minsec: _widths(this.minsec),\n minutes: _widths(this.minutes),\n hourmin: _widths(this.hourmin),\n hours: _widths(this.hours),\n days: _widths(this.days),\n months: _widths(this.months),\n years: _widths(this.years),\n };\n };\n // FIXME There is some unfortunate flicker when panning/zooming near the\n // span boundaries.\n // FIXME Rounding is weird at the 20-us scale and below.\n DatetimeTickFormatter.prototype._get_resolution_str = function (resolution_secs, span_secs) {\n // Our resolution boundaries should not be round numbers, because we want\n // them to fall between the possible tick intervals (which *are* round\n // numbers, as we've worked hard to ensure). Consequently, we adjust the\n // resolution upwards a small amount (less than any possible step in\n // scales) to make the effective boundaries slightly lower.\n var adjusted_secs = resolution_secs * 1.1;\n switch (false) {\n case !(adjusted_secs < 1e-3): return \"microseconds\";\n case !(adjusted_secs < 1.0): return \"milliseconds\";\n case !(adjusted_secs < 60): return span_secs >= 60 ? \"minsec\" : \"seconds\";\n case !(adjusted_secs < 3600): return span_secs >= 3600 ? \"hourmin\" : \"minutes\";\n case !(adjusted_secs < (24 * 3600)): return \"hours\";\n case !(adjusted_secs < (31 * 24 * 3600)): return \"days\";\n case !(adjusted_secs < (365 * 24 * 3600)): return \"months\";\n default: return \"years\";\n }\n };\n DatetimeTickFormatter.prototype.doFormat = function (ticks, _axis) {\n // In order to pick the right set of labels, we need to determine\n // the resolution of the ticks. We can do this using a ticker if\n // it's provided, or by computing the resolution from the actual\n // ticks we've been given.\n if (ticks.length == 0)\n return [];\n var span = Math.abs(ticks[ticks.length - 1] - ticks[0]) / 1000.0;\n var r = span / (ticks.length - 1);\n var resol = this._get_resolution_str(r, span);\n var _a = this._width_formats[resol], format = _a[1][0];\n // Apply the format to the tick values\n var labels = [];\n var resol_ndx = format_order.indexOf(resol);\n // This dictionary maps the name of a time resolution (in @format_order)\n // to its index in a time.localtime() timetuple. The default is to map\n // everything to index 0, which is year. This is not ideal; it might cause\n // a problem with the tick at midnight, january 1st, 0 a.d. being incorrectly\n // promoted at certain tick resolutions.\n var time_tuple_ndx_for_resol = {};\n for (var _i = 0, format_order_1 = format_order; _i < format_order_1.length; _i++) {\n var fmt = format_order_1[_i];\n time_tuple_ndx_for_resol[fmt] = 0;\n }\n time_tuple_ndx_for_resol[\"seconds\"] = 5;\n time_tuple_ndx_for_resol[\"minsec\"] = 4;\n time_tuple_ndx_for_resol[\"minutes\"] = 4;\n time_tuple_ndx_for_resol[\"hourmin\"] = 3;\n time_tuple_ndx_for_resol[\"hours\"] = 3;\n // As we format each tick, check to see if we are at a boundary of the\n // next higher unit of time. If so, replace the current format with one\n // from that resolution. This is not the best heuristic in the world,\n // but it works! There is some trickiness here due to having to deal\n // with hybrid formats in a reasonable manner.\n for (var _b = 0, ticks_1 = ticks; _b < ticks_1.length; _b++) {\n var t = ticks_1[_b];\n var s = void 0, tm = void 0;\n try {\n tm = _array(t);\n s = _strftime(t, format);\n }\n catch (error) {\n logging_1.logger.warn(\"unable to format tick for timestamp value \" + t);\n logging_1.logger.warn(\" - \" + error);\n labels.push(\"ERR\");\n continue;\n }\n var hybrid_handled = false;\n var next_ndx = resol_ndx;\n // The way to check that we are at the boundary of the next unit of\n // time is by checking that we have 0 units of the resolution, i.e.\n // we are at zero minutes, so display hours, or we are at zero seconds,\n // so display minutes (and if that is zero as well, then display hours).\n while (tm[time_tuple_ndx_for_resol[format_order[next_ndx]]] == 0) {\n var next_format = void 0;\n next_ndx += 1;\n if (next_ndx == format_order.length)\n break;\n if ((resol == \"minsec\" || resol == \"hourmin\") && !hybrid_handled) {\n if ((resol == \"minsec\" && tm[4] == 0 && tm[5] != 0) || (resol == \"hourmin\" && tm[3] == 0 && tm[4] != 0)) {\n next_format = this._width_formats[format_order[resol_ndx - 1]][1][0];\n s = _strftime(t, next_format);\n break;\n }\n else {\n hybrid_handled = true;\n }\n }\n next_format = this._width_formats[format_order[next_ndx]][1][0];\n s = _strftime(t, next_format);\n }\n // TODO: should expose this in api. %H, %d, etc use leading zeros and\n // users might prefer to see them lined up correctly.\n if (this.strip_leading_zeros) {\n var ss = s.replace(/^0+/g, \"\");\n if (ss != s && isNaN(parseInt(ss))) {\n // If the string can now be parsed as starting with an integer, then\n // leave all zeros stripped, otherwise start with a zero. Hence:\n // A label such as '000ms' should leave one zero.\n // A label such as '001ms' or '0-1ms' should not leave a leading zero.\n ss = \"0\" + ss;\n }\n labels.push(ss);\n }\n else\n labels.push(s);\n }\n return labels;\n };\n return DatetimeTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.DatetimeTickFormatter = DatetimeTickFormatter;\n DatetimeTickFormatter.initClass();\n}\n","/* models/formatters/func_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var p = require(15) /* core/properties */;\n var object_1 = require(32) /* core/util/object */;\n var string_1 = require(38) /* core/util/string */;\n var FuncTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(FuncTickFormatter, _super);\n function FuncTickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n FuncTickFormatter.initClass = function () {\n this.prototype.type = 'FuncTickFormatter';\n this.define({\n args: [p.Any, {}],\n code: [p.String, ''],\n use_strict: [p.Boolean, false],\n });\n };\n Object.defineProperty(FuncTickFormatter.prototype, \"names\", {\n get: function () {\n return object_1.keys(this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FuncTickFormatter.prototype, \"values\", {\n get: function () {\n return object_1.values(this.args);\n },\n enumerable: true,\n configurable: true\n });\n FuncTickFormatter.prototype._make_func = function () {\n var code = this.use_strict ? string_1.use_strict(this.code) : this.code;\n return new (Function.bind.apply(Function, [void 0, \"tick\", \"index\", \"ticks\"].concat(this.names, [\"require\", \"exports\", code])))();\n };\n FuncTickFormatter.prototype.doFormat = function (ticks, _axis) {\n var _this = this;\n var cache = {};\n var func = this._make_func().bind(cache);\n return ticks.map(function (tick, index, ticks) { return func.apply(void 0, [tick, index, ticks].concat(_this.values, [require, {}])); });\n };\n return FuncTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.FuncTickFormatter = FuncTickFormatter;\n FuncTickFormatter.initClass();\n}\n","/* models/formatters/index */ function _(require, module, exports) {\n var basic_tick_formatter_1 = require(104) /* ./basic_tick_formatter */;\n exports.BasicTickFormatter = basic_tick_formatter_1.BasicTickFormatter;\n var categorical_tick_formatter_1 = require(105) /* ./categorical_tick_formatter */;\n exports.CategoricalTickFormatter = categorical_tick_formatter_1.CategoricalTickFormatter;\n var datetime_tick_formatter_1 = require(106) /* ./datetime_tick_formatter */;\n exports.DatetimeTickFormatter = datetime_tick_formatter_1.DatetimeTickFormatter;\n var func_tick_formatter_1 = require(107) /* ./func_tick_formatter */;\n exports.FuncTickFormatter = func_tick_formatter_1.FuncTickFormatter;\n var log_tick_formatter_1 = require(109) /* ./log_tick_formatter */;\n exports.LogTickFormatter = log_tick_formatter_1.LogTickFormatter;\n var mercator_tick_formatter_1 = require(110) /* ./mercator_tick_formatter */;\n exports.MercatorTickFormatter = mercator_tick_formatter_1.MercatorTickFormatter;\n var numeral_tick_formatter_1 = require(111) /* ./numeral_tick_formatter */;\n exports.NumeralTickFormatter = numeral_tick_formatter_1.NumeralTickFormatter;\n var printf_tick_formatter_1 = require(112) /* ./printf_tick_formatter */;\n exports.PrintfTickFormatter = printf_tick_formatter_1.PrintfTickFormatter;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n exports.TickFormatter = tick_formatter_1.TickFormatter;\n}\n","/* models/formatters/log_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var basic_tick_formatter_1 = require(104) /* ./basic_tick_formatter */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var LogTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(LogTickFormatter, _super);\n function LogTickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n LogTickFormatter.initClass = function () {\n this.prototype.type = 'LogTickFormatter';\n this.define({\n ticker: [p.Instance, null],\n });\n };\n LogTickFormatter.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.basic_formatter = new basic_tick_formatter_1.BasicTickFormatter();\n if (this.ticker == null)\n logging_1.logger.warn(\"LogTickFormatter not configured with a ticker, using default base of 10 (labels will be incorrect if ticker base is not 10)\");\n };\n LogTickFormatter.prototype.doFormat = function (ticks, axis) {\n if (ticks.length == 0)\n return [];\n var base = this.ticker != null ? this.ticker.base : 10;\n var small_interval = false;\n var labels = new Array(ticks.length);\n for (var i = 0, end = ticks.length; i < end; i++) {\n labels[i] = base + \"^\" + Math.round(Math.log(ticks[i]) / Math.log(base));\n if (i > 0 && labels[i] == labels[i - 1]) {\n small_interval = true;\n break;\n }\n }\n if (small_interval)\n return this.basic_formatter.doFormat(ticks, axis);\n else\n return labels;\n };\n return LogTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.LogTickFormatter = LogTickFormatter;\n LogTickFormatter.initClass();\n}\n","/* models/formatters/mercator_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var basic_tick_formatter_1 = require(104) /* ./basic_tick_formatter */;\n var p = require(15) /* core/properties */;\n var projections_1 = require(33) /* core/util/projections */;\n var MercatorTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(MercatorTickFormatter, _super);\n function MercatorTickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n MercatorTickFormatter.initClass = function () {\n this.prototype.type = 'MercatorTickFormatter';\n this.define({\n dimension: [p.LatLon],\n });\n };\n MercatorTickFormatter.prototype.doFormat = function (ticks, axis) {\n if (this.dimension == null)\n throw new Error(\"MercatorTickFormatter.dimension not configured\");\n if (ticks.length == 0)\n return [];\n var n = ticks.length;\n var proj_ticks = new Array(n);\n if (this.dimension == \"lon\") {\n for (var i = 0; i < n; i++) {\n var lon = projections_1.wgs84_mercator.inverse([ticks[i], axis.loc])[0];\n proj_ticks[i] = lon;\n }\n }\n else {\n for (var i = 0; i < n; i++) {\n var _a = projections_1.wgs84_mercator.inverse([axis.loc, ticks[i]]), lat = _a[1];\n proj_ticks[i] = lat;\n }\n }\n return _super.prototype.doFormat.call(this, proj_ticks, axis);\n };\n return MercatorTickFormatter;\n }(basic_tick_formatter_1.BasicTickFormatter));\n exports.MercatorTickFormatter = MercatorTickFormatter;\n MercatorTickFormatter.initClass();\n}\n","/* models/formatters/numeral_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var Numbro = require(361) /* numbro */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var p = require(15) /* core/properties */;\n var NumeralTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(NumeralTickFormatter, _super);\n function NumeralTickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n NumeralTickFormatter.initClass = function () {\n this.prototype.type = 'NumeralTickFormatter';\n this.define({\n // TODO (bev) all of these could be tightened up\n format: [p.String, '0,0'],\n language: [p.String, 'en'],\n rounding: [p.String, 'round'],\n });\n };\n Object.defineProperty(NumeralTickFormatter.prototype, \"_rounding_fn\", {\n get: function () {\n switch (this.rounding) {\n case \"round\":\n case \"nearest\":\n return Math.round;\n case \"floor\":\n case \"rounddown\":\n return Math.floor;\n case \"ceil\":\n case \"roundup\":\n return Math.ceil;\n }\n },\n enumerable: true,\n configurable: true\n });\n NumeralTickFormatter.prototype.doFormat = function (ticks, _axis) {\n var _a = this, format = _a.format, language = _a.language, _rounding_fn = _a._rounding_fn;\n return ticks.map(function (tick) { return Numbro.format(tick, format, language, _rounding_fn); });\n };\n return NumeralTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.NumeralTickFormatter = NumeralTickFormatter;\n NumeralTickFormatter.initClass();\n}\n","/* models/formatters/printf_tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var sprintf_js_1 = require(389) /* sprintf-js */;\n var tick_formatter_1 = require(113) /* ./tick_formatter */;\n var p = require(15) /* core/properties */;\n var PrintfTickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(PrintfTickFormatter, _super);\n function PrintfTickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n PrintfTickFormatter.initClass = function () {\n this.prototype.type = 'PrintfTickFormatter';\n this.define({\n format: [p.String, '%s'],\n });\n };\n PrintfTickFormatter.prototype.doFormat = function (ticks, _axis) {\n var _this = this;\n return ticks.map(function (tick) { return sprintf_js_1.sprintf(_this.format, tick); });\n };\n return PrintfTickFormatter;\n }(tick_formatter_1.TickFormatter));\n exports.PrintfTickFormatter = PrintfTickFormatter;\n PrintfTickFormatter.initClass();\n}\n","/* models/formatters/tick_formatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var TickFormatter = /** @class */ (function (_super) {\n tslib_1.__extends(TickFormatter, _super);\n function TickFormatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n TickFormatter.initClass = function () {\n this.prototype.type = \"TickFormatter\";\n };\n return TickFormatter;\n }(model_1.Model));\n exports.TickFormatter = TickFormatter;\n TickFormatter.initClass();\n}\n","/* models/glyphs/annular_wedge */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var math_1 = require(31) /* core/util/math */;\n var AnnularWedgeView = /** @class */ (function (_super) {\n tslib_1.__extends(AnnularWedgeView, _super);\n function AnnularWedgeView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AnnularWedgeView.prototype._map_data = function () {\n if (this.model.properties.inner_radius.units == \"data\")\n this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius);\n else\n this.sinner_radius = this._inner_radius;\n if (this.model.properties.outer_radius.units == \"data\")\n this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius);\n else\n this.souter_radius = this._outer_radius;\n this._angle = new Float32Array(this._start_angle.length);\n for (var i = 0, end = this._start_angle.length; i < end; i++) {\n this._angle[i] = this._end_angle[i] - this._start_angle[i];\n }\n };\n AnnularWedgeView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, _start_angle = _a._start_angle, _angle = _a._angle, sinner_radius = _a.sinner_radius, souter_radius = _a.souter_radius;\n var direction = this.model.properties.direction.value();\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i] + _start_angle[i] + _angle[i]))\n continue;\n ctx.translate(sx[i], sy[i]);\n ctx.rotate(_start_angle[i]);\n ctx.moveTo(souter_radius[i], 0);\n ctx.beginPath();\n ctx.arc(0, 0, souter_radius[i], 0, _angle[i], direction);\n ctx.rotate(_angle[i]);\n ctx.lineTo(sinner_radius[i], 0);\n ctx.arc(0, 0, sinner_radius[i], 0, -_angle[i], !direction);\n ctx.closePath();\n ctx.rotate(-_angle[i] - _start_angle[i]);\n ctx.translate(-sx[i], -sy[i]);\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n AnnularWedgeView.prototype._hit_point = function (geometry) {\n var _a, _b;\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n // check radius first\n var x0, y0;\n var x1, y1;\n if (this.model.properties.outer_radius.units == \"data\") {\n x0 = x - this.max_outer_radius;\n x1 = x + this.max_outer_radius;\n y0 = y - this.max_outer_radius;\n y1 = y + this.max_outer_radius;\n }\n else {\n var sx0 = sx - this.max_outer_radius;\n var sx1 = sx + this.max_outer_radius;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var sy0 = sy - this.max_outer_radius;\n var sy1 = sy + this.max_outer_radius;\n _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n }\n var candidates = [];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n for (var _i = 0, _c = this.index.indices(bbox); _i < _c.length; _i++) {\n var i = _c[_i];\n var or2 = Math.pow(this.souter_radius[i], 2);\n var ir2 = Math.pow(this.sinner_radius[i], 2);\n var _d = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _d[0], sx1 = _d[1];\n var _e = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _e[0], sy1 = _e[1];\n var dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2);\n if (dist <= or2 && dist >= ir2)\n candidates.push([i, dist]);\n }\n var direction = this.model.properties.direction.value();\n var hits = [];\n for (var _f = 0, candidates_1 = candidates; _f < candidates_1.length; _f++) {\n var _g = candidates_1[_f], i = _g[0], dist = _g[1];\n // NOTE: minus the angle because JS uses non-mathy convention for angles\n var angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]);\n if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) {\n hits.push([i, dist]);\n }\n }\n return hittest.create_hit_test_result_from_hits(hits);\n };\n AnnularWedgeView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n AnnularWedgeView.prototype._scenterxy = function (i) {\n var r = (this.sinner_radius[i] + this.souter_radius[i]) / 2;\n var a = (this._start_angle[i] + this._end_angle[i]) / 2;\n return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) };\n };\n AnnularWedgeView.prototype.scenterx = function (i) {\n return this._scenterxy(i).x;\n };\n AnnularWedgeView.prototype.scentery = function (i) {\n return this._scenterxy(i).y;\n };\n return AnnularWedgeView;\n }(xy_glyph_1.XYGlyphView));\n exports.AnnularWedgeView = AnnularWedgeView;\n var AnnularWedge = /** @class */ (function (_super) {\n tslib_1.__extends(AnnularWedge, _super);\n function AnnularWedge(attrs) {\n return _super.call(this, attrs) || this;\n }\n AnnularWedge.initClass = function () {\n this.prototype.type = 'AnnularWedge';\n this.prototype.default_view = AnnularWedgeView;\n this.mixins(['line', 'fill']);\n this.define({\n direction: [p.Direction, 'anticlock'],\n inner_radius: [p.DistanceSpec],\n outer_radius: [p.DistanceSpec],\n start_angle: [p.AngleSpec],\n end_angle: [p.AngleSpec],\n });\n };\n return AnnularWedge;\n }(xy_glyph_1.XYGlyph));\n exports.AnnularWedge = AnnularWedge;\n AnnularWedge.initClass();\n}\n","/* models/glyphs/annulus */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var compat_1 = require(28) /* core/util/compat */;\n var AnnulusView = /** @class */ (function (_super) {\n tslib_1.__extends(AnnulusView, _super);\n function AnnulusView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AnnulusView.prototype._map_data = function () {\n if (this.model.properties.inner_radius.units == \"data\")\n this.sinner_radius = this.sdist(this.renderer.xscale, this._x, this._inner_radius);\n else\n this.sinner_radius = this._inner_radius;\n if (this.model.properties.outer_radius.units == \"data\")\n this.souter_radius = this.sdist(this.renderer.xscale, this._x, this._outer_radius);\n else\n this.souter_radius = this._outer_radius;\n };\n AnnulusView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, sinner_radius = _a.sinner_radius, souter_radius = _a.souter_radius;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sinner_radius[i] + souter_radius[i]))\n continue;\n // Because this visual has a whole in it, it proved \"challenging\"\n // for some browsers to render if drawn in one go --- i.e. it did not\n // work on IE. If we render in two parts (upper and lower part),\n // it is unambiguous what part should be filled. The line is\n // better drawn in one go though, otherwise the part where the pieces\n // meet will not be fully closed due to aa.\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.beginPath();\n if (compat_1.is_ie) {\n // Draw two halves of the donut. Works on IE, but causes an aa line on Safari.\n for (var _b = 0, _c = [false, true]; _b < _c.length; _b++) {\n var clockwise = _c[_b];\n ctx.arc(sx[i], sy[i], sinner_radius[i], 0, Math.PI, clockwise);\n ctx.arc(sx[i], sy[i], souter_radius[i], Math.PI, 0, !clockwise);\n }\n }\n else {\n // Draw donut in one go. Does not work on iE.\n ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI, true);\n ctx.arc(sx[i], sy[i], souter_radius[i], 2 * Math.PI, 0, false);\n }\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.beginPath();\n ctx.arc(sx[i], sy[i], sinner_radius[i], 0, 2 * Math.PI);\n ctx.moveTo(sx[i] + souter_radius[i], sy[i]);\n ctx.arc(sx[i], sy[i], souter_radius[i], 0, 2 * Math.PI);\n ctx.stroke();\n }\n }\n };\n AnnulusView.prototype._hit_point = function (geometry) {\n var _a, _b;\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var x0, y0;\n var x1, y1;\n if (this.model.properties.outer_radius.units == \"data\") {\n x0 = x - this.max_outer_radius;\n x1 = x + this.max_outer_radius;\n y0 = y - this.max_outer_radius;\n y1 = y + this.max_outer_radius;\n }\n else {\n var sx0 = sx - this.max_outer_radius;\n var sx1 = sx + this.max_outer_radius;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var sy0 = sy - this.max_outer_radius;\n var sy1 = sy + this.max_outer_radius;\n _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n }\n var hits = [];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n for (var _i = 0, _c = this.index.indices(bbox); _i < _c.length; _i++) {\n var i = _c[_i];\n var or2 = Math.pow(this.souter_radius[i], 2);\n var ir2 = Math.pow(this.sinner_radius[i], 2);\n var _d = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _d[0], sx1 = _d[1];\n var _e = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _e[0], sy1 = _e[1];\n var dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2);\n if (dist <= or2 && dist >= ir2)\n hits.push([i, dist]);\n }\n return hittest.create_hit_test_result_from_hits(hits);\n };\n AnnulusView.prototype.draw_legend_for_index = function (ctx, _a, index) {\n var x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1;\n var len = index + 1;\n var sx = new Array(len);\n sx[index] = (x0 + x1) / 2;\n var sy = new Array(len);\n sy[index] = (y0 + y1) / 2;\n var r = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.5;\n var sinner_radius = new Array(len);\n sinner_radius[index] = r * 0.4;\n var souter_radius = new Array(len);\n souter_radius[index] = r * 0.8;\n this._render(ctx, [index], { sx: sx, sy: sy, sinner_radius: sinner_radius, souter_radius: souter_radius }); // XXX\n };\n return AnnulusView;\n }(xy_glyph_1.XYGlyphView));\n exports.AnnulusView = AnnulusView;\n var Annulus = /** @class */ (function (_super) {\n tslib_1.__extends(Annulus, _super);\n function Annulus(attrs) {\n return _super.call(this, attrs) || this;\n }\n Annulus.initClass = function () {\n this.prototype.type = 'Annulus';\n this.prototype.default_view = AnnulusView;\n this.mixins(['line', 'fill']);\n this.define({\n inner_radius: [p.DistanceSpec],\n outer_radius: [p.DistanceSpec],\n });\n };\n return Annulus;\n }(xy_glyph_1.XYGlyph));\n exports.Annulus = Annulus;\n Annulus.initClass();\n}\n","/* models/glyphs/arc */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var p = require(15) /* core/properties */;\n var ArcView = /** @class */ (function (_super) {\n tslib_1.__extends(ArcView, _super);\n function ArcView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ArcView.prototype._map_data = function () {\n if (this.model.properties.radius.units == \"data\")\n this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n else\n this.sradius = this._radius;\n };\n ArcView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, sradius = _a.sradius, _start_angle = _a._start_angle, _end_angle = _a._end_angle;\n if (this.visuals.line.doit) {\n var direction = this.model.properties.direction.value();\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))\n continue;\n ctx.beginPath();\n ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n ArcView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n return ArcView;\n }(xy_glyph_1.XYGlyphView));\n exports.ArcView = ArcView;\n var Arc = /** @class */ (function (_super) {\n tslib_1.__extends(Arc, _super);\n function Arc(attrs) {\n return _super.call(this, attrs) || this;\n }\n Arc.initClass = function () {\n this.prototype.type = 'Arc';\n this.prototype.default_view = ArcView;\n this.mixins(['line']);\n this.define({\n direction: [p.Direction, 'anticlock'],\n radius: [p.DistanceSpec],\n start_angle: [p.AngleSpec],\n end_angle: [p.AngleSpec],\n });\n };\n return Arc;\n }(xy_glyph_1.XYGlyph));\n exports.Arc = Arc;\n Arc.initClass();\n}\n","/* models/glyphs/bezier */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n // algorithm adapted from http://stackoverflow.com/a/14429749/3406693\n function _cbb(x0, y0, x1, y1, x2, y2, x3, y3) {\n var tvalues = [];\n var bounds = [[], []];\n for (var i = 0; i <= 2; i++) {\n var a = void 0, b = void 0, c = void 0;\n if (i === 0) {\n b = ((6 * x0) - (12 * x1)) + (6 * x2);\n a = (((-3 * x0) + (9 * x1)) - (9 * x2)) + (3 * x3);\n c = (3 * x1) - (3 * x0);\n }\n else {\n b = ((6 * y0) - (12 * y1)) + (6 * y2);\n a = (((-3 * y0) + (9 * y1)) - (9 * y2)) + (3 * y3);\n c = (3 * y1) - (3 * y0);\n }\n if (Math.abs(a) < 1e-12) { // Numerical robustness\n if (Math.abs(b) < 1e-12) // Numerical robustness\n continue;\n var t = -c / b;\n if (0 < t && t < 1)\n tvalues.push(t);\n continue;\n }\n var b2ac = (b * b) - (4 * c * a);\n var sqrtb2ac = Math.sqrt(b2ac);\n if (b2ac < 0)\n continue;\n var t1 = (-b + sqrtb2ac) / (2 * a);\n if (0 < t1 && t1 < 1)\n tvalues.push(t1);\n var t2 = (-b - sqrtb2ac) / (2 * a);\n if (0 < t2 && t2 < 1)\n tvalues.push(t2);\n }\n var j = tvalues.length;\n var jlen = j;\n while (j--) {\n var t = tvalues[j];\n var mt = 1 - t;\n var x = (mt * mt * mt * x0) + (3 * mt * mt * t * x1) + (3 * mt * t * t * x2) + (t * t * t * x3);\n bounds[0][j] = x;\n var y = (mt * mt * mt * y0) + (3 * mt * mt * t * y1) + (3 * mt * t * t * y2) + (t * t * t * y3);\n bounds[1][j] = y;\n }\n bounds[0][jlen] = x0;\n bounds[1][jlen] = y0;\n bounds[0][jlen + 1] = x3;\n bounds[1][jlen + 1] = y3;\n return [\n Math.min.apply(Math, bounds[0]),\n Math.max.apply(Math, bounds[1]),\n Math.max.apply(Math, bounds[0]),\n Math.min.apply(Math, bounds[1]),\n ];\n }\n var BezierView = /** @class */ (function (_super) {\n tslib_1.__extends(BezierView, _super);\n function BezierView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BezierView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._x0.length; i < end; i++) {\n if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx0[i] + this._cy0[i] + this._cx1[i] + this._cy1[i]))\n continue;\n var _a = _cbb(this._x0[i], this._y0[i], this._x1[i], this._y1[i], this._cx0[i], this._cy0[i], this._cx1[i], this._cy1[i]), x0 = _a[0], y0 = _a[1], x1 = _a[2], y1 = _a[3];\n points.push({ minX: x0, minY: y0, maxX: x1, maxY: y1, i: i });\n }\n return new spatial_1.SpatialIndex(points);\n };\n BezierView.prototype._render = function (ctx, indices, _a) {\n var sx0 = _a.sx0, sy0 = _a.sy0, sx1 = _a.sx1, sy1 = _a.sy1, scx0 = _a.scx0, scy0 = _a.scy0, scx1 = _a.scx1, scy1 = _a.scy1;\n if (this.visuals.line.doit) {\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx0[i] + scy0[i] + scx1[i] + scy1[i]))\n continue;\n ctx.beginPath();\n ctx.moveTo(sx0[i], sy0[i]);\n ctx.bezierCurveTo(scx0[i], scy0[i], scx1[i], scy1[i], sx1[i], sy1[i]);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n BezierView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n BezierView.prototype.scenterx = function () {\n throw new Error(\"not implemented\");\n };\n BezierView.prototype.scentery = function () {\n throw new Error(\"not implemented\");\n };\n return BezierView;\n }(glyph_1.GlyphView));\n exports.BezierView = BezierView;\n var Bezier = /** @class */ (function (_super) {\n tslib_1.__extends(Bezier, _super);\n function Bezier(attrs) {\n return _super.call(this, attrs) || this;\n }\n Bezier.initClass = function () {\n this.prototype.type = 'Bezier';\n this.prototype.default_view = BezierView;\n this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx0', 'cy0'], ['cx1', 'cy1']]);\n this.mixins(['line']);\n };\n return Bezier;\n }(glyph_1.Glyph));\n exports.Bezier = Bezier;\n Bezier.initClass();\n}\n","/* models/glyphs/box */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n var hittest = require(9) /* core/hittest */;\n var BoxView = /** @class */ (function (_super) {\n tslib_1.__extends(BoxView, _super);\n function BoxView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BoxView.prototype._index_box = function (len) {\n var points = [];\n for (var i = 0; i < len; i++) {\n var _a = this._lrtb(i), l = _a[0], r = _a[1], t = _a[2], b = _a[3];\n if (isNaN(l + r + t + b) || !isFinite(l + r + t + b))\n continue;\n points.push({\n minX: Math.min(l, r),\n minY: Math.min(t, b),\n maxX: Math.max(r, l),\n maxY: Math.max(t, b),\n i: i,\n });\n }\n return new spatial_1.SpatialIndex(points);\n };\n BoxView.prototype._render = function (ctx, indices, _a) {\n var sleft = _a.sleft, sright = _a.sright, stop = _a.stop, sbottom = _a.sbottom;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sleft[i] + stop[i] + sright[i] + sbottom[i]))\n continue;\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fillRect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n }\n if (this.visuals.line.doit) {\n ctx.beginPath();\n ctx.rect(sleft[i], stop[i], sright[i] - sleft[i], sbottom[i] - stop[i]);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n // We need to clamp the endpoints inside the viewport, because various browser canvas\n // implementations have issues drawing rects with enpoints far outside the viewport\n BoxView.prototype._clamp_viewport = function () {\n var hr = this.renderer.plot_view.frame.bbox.h_range;\n var vr = this.renderer.plot_view.frame.bbox.v_range;\n var n = this.stop.length;\n for (var i = 0; i < n; i++) {\n this.stop[i] = Math.max(this.stop[i], vr.start);\n this.sbottom[i] = Math.min(this.sbottom[i], vr.end);\n this.sleft[i] = Math.max(this.sleft[i], hr.start);\n this.sright[i] = Math.min(this.sright[i], hr.end);\n }\n };\n BoxView.prototype._hit_rect = function (geometry) {\n return this._hit_rect_against_index(geometry);\n };\n BoxView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var hits = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y });\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n BoxView.prototype._hit_span = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var hits;\n if (geometry.direction == 'v') {\n var y = this.renderer.yscale.invert(sy);\n var hr = this.renderer.plot_view.frame.bbox.h_range;\n var _a = this.renderer.xscale.r_invert(hr.start, hr.end), minX = _a[0], maxX = _a[1];\n hits = this.index.indices({ minX: minX, minY: y, maxX: maxX, maxY: y });\n }\n else {\n var x = this.renderer.xscale.invert(sx);\n var vr = this.renderer.plot_view.frame.bbox.v_range;\n var _b = this.renderer.yscale.r_invert(vr.start, vr.end), minY = _b[0], maxY = _b[1];\n hits = this.index.indices({ minX: x, minY: minY, maxX: x, maxY: maxY });\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n BoxView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n return BoxView;\n }(glyph_1.GlyphView));\n exports.BoxView = BoxView;\n var Box = /** @class */ (function (_super) {\n tslib_1.__extends(Box, _super);\n function Box(attrs) {\n return _super.call(this, attrs) || this;\n }\n Box.initClass = function () {\n this.prototype.type = \"Box\";\n this.mixins(['line', 'fill']);\n };\n return Box;\n }(glyph_1.Glyph));\n exports.Box = Box;\n Box.initClass();\n}\n","/* models/glyphs/center_rotatable */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var p = require(15) /* core/properties */;\n var CenterRotatableView = /** @class */ (function (_super) {\n tslib_1.__extends(CenterRotatableView, _super);\n function CenterRotatableView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return CenterRotatableView;\n }(xy_glyph_1.XYGlyphView));\n exports.CenterRotatableView = CenterRotatableView;\n var CenterRotatable = /** @class */ (function (_super) {\n tslib_1.__extends(CenterRotatable, _super);\n function CenterRotatable(attrs) {\n return _super.call(this, attrs) || this;\n }\n CenterRotatable.initClass = function () {\n this.prototype.type = 'CenterRotatable';\n this.mixins(['line', 'fill']);\n this.define({\n angle: [p.AngleSpec, 0],\n width: [p.DistanceSpec],\n height: [p.DistanceSpec],\n });\n };\n return CenterRotatable;\n }(xy_glyph_1.XYGlyph));\n exports.CenterRotatable = CenterRotatable;\n CenterRotatable.initClass();\n}\n","/* models/glyphs/circle */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var CircleView = /** @class */ (function (_super) {\n tslib_1.__extends(CircleView, _super);\n function CircleView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CircleView.prototype._map_data = function () {\n // XXX: Order is important here: size is always present (at least\n // a default), but radius is only present if a user specifies it.\n if (this._radius != null) {\n if (this.model.properties.radius.spec.units == \"data\") {\n var rd = this.model.properties.radius_dimension.spec.value;\n switch (rd) {\n case \"x\": {\n this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n break;\n }\n case \"y\": {\n this.sradius = this.sdist(this.renderer.yscale, this._y, this._radius);\n break;\n }\n }\n }\n else {\n this.sradius = this._radius;\n this.max_size = 2 * this.max_radius;\n }\n }\n else\n this.sradius = arrayable_1.map(this._size, function (s) { return s / 2; });\n };\n CircleView.prototype._mask_data = function () {\n var _a, _b, _c, _d;\n var _e = this.renderer.plot_view.frame.bbox.ranges, hr = _e[0], vr = _e[1];\n var x0, y0;\n var x1, y1;\n if (this._radius != null && this.model.properties.radius.units == \"data\") {\n var sx0 = hr.start;\n var sx1 = hr.end;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n x0 -= this.max_radius;\n x1 += this.max_radius;\n var sy0 = vr.start;\n var sy1 = vr.end;\n _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n y0 -= this.max_radius;\n y1 += this.max_radius;\n }\n else {\n var sx0 = hr.start - this.max_size;\n var sx1 = hr.end + this.max_size;\n _c = this.renderer.xscale.r_invert(sx0, sx1), x0 = _c[0], x1 = _c[1];\n var sy0 = vr.start - this.max_size;\n var sy1 = vr.end + this.max_size;\n _d = this.renderer.yscale.r_invert(sy0, sy1), y0 = _d[0], y1 = _d[1];\n }\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n return this.index.indices(bbox);\n };\n CircleView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, sradius = _a.sradius;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sradius[i]))\n continue;\n ctx.beginPath();\n ctx.arc(sx[i], sy[i], sradius[i], 0, 2 * Math.PI, false);\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n CircleView.prototype._hit_point = function (geometry) {\n var _a, _b, _c, _d, _e, _f;\n var dist, r2, sx0, sx1, sy0, sy1, x0, x1, y0, y1;\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n // check radius first\n if ((this._radius != null) && (this.model.properties.radius.units == \"data\")) {\n x0 = x - this.max_radius;\n x1 = x + this.max_radius;\n y0 = y - this.max_radius;\n y1 = y + this.max_radius;\n }\n else {\n sx0 = sx - this.max_size;\n sx1 = sx + this.max_size;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n _b = [Math.min(x0, x1), Math.max(x0, x1)], x0 = _b[0], x1 = _b[1];\n sy0 = sy - this.max_size;\n sy1 = sy + this.max_size;\n _c = this.renderer.yscale.r_invert(sy0, sy1), y0 = _c[0], y1 = _c[1];\n _d = [Math.min(y0, y1), Math.max(y0, y1)], y0 = _d[0], y1 = _d[1];\n }\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var candidates = this.index.indices(bbox);\n var hits = [];\n if ((this._radius != null) && (this.model.properties.radius.units == \"data\")) {\n for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n var i = candidates_1[_i];\n r2 = Math.pow(this.sradius[i], 2);\n _e = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _e[0], sx1 = _e[1];\n _f = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _f[0], sy1 = _f[1];\n dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2);\n if (dist <= r2) {\n hits.push([i, dist]);\n }\n }\n }\n else {\n for (var _g = 0, candidates_2 = candidates; _g < candidates_2.length; _g++) {\n var i = candidates_2[_g];\n r2 = Math.pow(this.sradius[i], 2);\n dist = Math.pow(this.sx[i] - sx, 2) + Math.pow(this.sy[i] - sy, 2);\n if (dist <= r2) {\n hits.push([i, dist]);\n }\n }\n }\n return hittest.create_hit_test_result_from_hits(hits);\n };\n CircleView.prototype._hit_span = function (geometry) {\n var _a, _b, _c, _d;\n var ms, x0, x1, y0, y1;\n var sx = geometry.sx, sy = geometry.sy;\n var _e = this.bounds(), minX = _e.minX, minY = _e.minY, maxX = _e.maxX, maxY = _e.maxY;\n var result = hittest.create_empty_hit_test_result();\n if (geometry.direction == 'h') {\n // use circle bounds instead of current pointer y coordinates\n var sx0 = void 0, sx1 = void 0;\n y0 = minY;\n y1 = maxY;\n if (this._radius != null && this.model.properties.radius.units == \"data\") {\n sx0 = sx - this.max_radius;\n sx1 = sx + this.max_radius;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n }\n else {\n ms = this.max_size / 2;\n sx0 = sx - ms;\n sx1 = sx + ms;\n _b = this.renderer.xscale.r_invert(sx0, sx1), x0 = _b[0], x1 = _b[1];\n }\n }\n else {\n // use circle bounds instead of current pointer x coordinates\n var sy0 = void 0, sy1 = void 0;\n x0 = minX;\n x1 = maxX;\n if (this._radius != null && this.model.properties.radius.units == \"data\") {\n sy0 = sy - this.max_radius;\n sy1 = sy + this.max_radius;\n _c = this.renderer.yscale.r_invert(sy0, sy1), y0 = _c[0], y1 = _c[1];\n }\n else {\n ms = this.max_size / 2;\n sy0 = sy - ms;\n sy1 = sy + ms;\n _d = this.renderer.yscale.r_invert(sy0, sy1), y0 = _d[0], y1 = _d[1];\n }\n }\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var hits = this.index.indices(bbox);\n result.indices = hits;\n return result;\n };\n CircleView.prototype._hit_rect = function (geometry) {\n var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1;\n var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var result = hittest.create_empty_hit_test_result();\n result.indices = this.index.indices(bbox);\n return result;\n };\n CircleView.prototype._hit_poly = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n // TODO (bev) use spatial index to pare candidate list\n var candidates = array_1.range(0, this.sx.length);\n var hits = [];\n for (var i = 0, end = candidates.length; i < end; i++) {\n var idx = candidates[i];\n if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy)) {\n hits.push(idx);\n }\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n // circle does not inherit from marker (since it also accepts radius) so we\n // must supply a draw_legend for it here\n CircleView.prototype.draw_legend_for_index = function (ctx, _a, index) {\n var x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1;\n // using objects like this seems a little wonky, since the keys are coerced to\n // stings, but it works\n var len = index + 1;\n var sx = new Array(len);\n sx[index] = (x0 + x1) / 2;\n var sy = new Array(len);\n sy[index] = (y0 + y1) / 2;\n var sradius = new Array(len);\n sradius[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.2;\n this._render(ctx, [index], { sx: sx, sy: sy, sradius: sradius }); // XXX\n };\n return CircleView;\n }(xy_glyph_1.XYGlyphView));\n exports.CircleView = CircleView;\n var Circle = /** @class */ (function (_super) {\n tslib_1.__extends(Circle, _super);\n function Circle(attrs) {\n return _super.call(this, attrs) || this;\n }\n Circle.initClass = function () {\n this.prototype.type = 'Circle';\n this.prototype.default_view = CircleView;\n this.mixins(['line', 'fill']);\n this.define({\n angle: [p.AngleSpec, 0],\n size: [p.DistanceSpec, { units: \"screen\", value: 4 }],\n radius: [p.DistanceSpec, null],\n radius_dimension: [p.String, 'x'],\n });\n };\n Circle.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.properties.radius.optional = true;\n };\n return Circle;\n }(xy_glyph_1.XYGlyph));\n exports.Circle = Circle;\n Circle.initClass();\n}\n","/* models/glyphs/ellipse */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var ellipse_oval_1 = require(122) /* ./ellipse_oval */;\n var EllipseView = /** @class */ (function (_super) {\n tslib_1.__extends(EllipseView, _super);\n function EllipseView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return EllipseView;\n }(ellipse_oval_1.EllipseOvalView));\n exports.EllipseView = EllipseView;\n var Ellipse = /** @class */ (function (_super) {\n tslib_1.__extends(Ellipse, _super);\n function Ellipse(attrs) {\n return _super.call(this, attrs) || this;\n }\n Ellipse.initClass = function () {\n this.prototype.type = 'Ellipse';\n this.prototype.default_view = EllipseView;\n };\n return Ellipse;\n }(ellipse_oval_1.EllipseOval));\n exports.Ellipse = Ellipse;\n Ellipse.initClass();\n}\n","/* models/glyphs/ellipse_oval */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var center_rotatable_1 = require(119) /* ./center_rotatable */;\n var hittest = require(9) /* core/hittest */;\n var EllipseOvalView = /** @class */ (function (_super) {\n tslib_1.__extends(EllipseOvalView, _super);\n function EllipseOvalView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n EllipseOvalView.prototype._set_data = function () {\n this.max_w2 = 0;\n if (this.model.properties.width.units == \"data\")\n this.max_w2 = this.max_width / 2;\n this.max_h2 = 0;\n if (this.model.properties.height.units == \"data\")\n this.max_h2 = this.max_height / 2;\n };\n EllipseOvalView.prototype._map_data = function () {\n if (this.model.properties.width.units == \"data\")\n this.sw = this.sdist(this.renderer.xscale, this._x, this._width, 'center');\n else\n this.sw = this._width;\n if (this.model.properties.height.units == \"data\")\n this.sh = this.sdist(this.renderer.yscale, this._y, this._height, 'center');\n else\n this.sh = this._height;\n };\n EllipseOvalView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh, _angle = _a._angle;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sw[i] + sh[i] + _angle[i]))\n continue;\n ctx.beginPath();\n ctx.ellipse(sx[i], sy[i], sw[i] / 2.0, sh[i] / 2.0, _angle[i], 0, 2 * Math.PI);\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n EllipseOvalView.prototype._hit_point = function (geometry) {\n var _a, _b, _c, _d;\n var x0, x1, y0, y1, cond, dist, sx0, sx1, sy0, sy1;\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n if (this.model.properties.width.units == \"data\") {\n x0 = x - this.max_width;\n x1 = x + this.max_width;\n }\n else {\n sx0 = sx - this.max_width;\n sx1 = sx + this.max_width;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n }\n if (this.model.properties.height.units == \"data\") {\n y0 = y - this.max_height;\n y1 = y + this.max_height;\n }\n else {\n sy0 = sy - this.max_height;\n sy1 = sy + this.max_height;\n _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n }\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var candidates = this.index.indices(bbox);\n var hits = [];\n for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n var i = candidates_1[_i];\n cond = hittest.point_in_ellipse(sx, sy, this._angle[i], this.sh[i] / 2, this.sw[i] / 2, this.sx[i], this.sy[i]);\n if (cond) {\n ;\n _c = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _c[0], sx1 = _c[1];\n _d = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _d[0], sy1 = _d[1];\n dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2);\n hits.push([i, dist]);\n }\n }\n return hittest.create_hit_test_result_from_hits(hits);\n };\n EllipseOvalView.prototype.draw_legend_for_index = function (ctx, _a, index) {\n var x0 = _a.x0, y0 = _a.y0, x1 = _a.x1, y1 = _a.y1;\n var len = index + 1;\n var sx = new Array(len);\n sx[index] = (x0 + x1) / 2;\n var sy = new Array(len);\n sy[index] = (y0 + y1) / 2;\n var scale = this.sw[index] / this.sh[index];\n var d = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.8;\n var sw = new Array(len);\n var sh = new Array(len);\n if (scale > 1) {\n sw[index] = d;\n sh[index] = d / scale;\n }\n else {\n sw[index] = d * scale;\n sh[index] = d;\n }\n this._render(ctx, [index], { sx: sx, sy: sy, sw: sw, sh: sh, _angle: [0] }); // XXX\n };\n EllipseOvalView.prototype._bounds = function (_a) {\n var minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;\n return {\n minX: minX - this.max_w2,\n maxX: maxX + this.max_w2,\n minY: minY - this.max_h2,\n maxY: maxY + this.max_h2,\n };\n };\n return EllipseOvalView;\n }(center_rotatable_1.CenterRotatableView));\n exports.EllipseOvalView = EllipseOvalView;\n var EllipseOval = /** @class */ (function (_super) {\n tslib_1.__extends(EllipseOval, _super);\n function EllipseOval(attrs) {\n return _super.call(this, attrs) || this;\n }\n EllipseOval.initClass = function () {\n this.prototype.type = 'EllipseOval';\n };\n return EllipseOval;\n }(center_rotatable_1.CenterRotatable));\n exports.EllipseOval = EllipseOval;\n EllipseOval.initClass();\n}\n","/* models/glyphs/glyph */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var bbox = require(24) /* core/util/bbox */;\n var proj = require(33) /* core/util/projections */;\n var visuals = require(49) /* core/visuals */;\n var view_1 = require(48) /* core/view */;\n var model_1 = require(59) /* ../../model */;\n var logging_1 = require(14) /* core/logging */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var object_1 = require(32) /* core/util/object */;\n var types_1 = require(44) /* core/util/types */;\n var line_1 = require(130) /* ./line */;\n var factor_range_1 = require(181) /* ../ranges/factor_range */;\n var GlyphView = /** @class */ (function (_super) {\n tslib_1.__extends(GlyphView, _super);\n function GlyphView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._nohit_warned = {};\n return _this;\n }\n GlyphView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this._nohit_warned = {};\n this.renderer = options.renderer;\n this.visuals = new visuals.Visuals(this.model);\n // Init gl (this should really be done anytime renderer is set,\n // and not done if it isn't ever set, but for now it only\n // matters in the unit tests because we build a view without a\n // renderer there)\n var gl = this.renderer.plot_view.gl;\n if (gl != null) {\n var webgl_module = null;\n try {\n webgl_module = require(452) /* ./webgl/index */;\n }\n catch (e) {\n if (e.code === 'MODULE_NOT_FOUND') {\n logging_1.logger.warn('WebGL was requested and is supported, but bokeh-gl(.min).js is not available, falling back to 2D rendering.');\n }\n else\n throw e;\n }\n if (webgl_module != null) {\n var Cls = webgl_module[this.model.type + 'GLGlyph'];\n if (Cls != null)\n this.glglyph = new Cls(gl.ctx, this);\n }\n }\n };\n GlyphView.prototype.set_visuals = function (source) {\n this.visuals.warm_cache(source);\n if (this.glglyph != null)\n this.glglyph.set_visuals_changed();\n };\n GlyphView.prototype.render = function (ctx, indices, data) {\n ctx.beginPath();\n if (this.glglyph != null) {\n if (this.glglyph.render(ctx, indices, data))\n return;\n }\n this._render(ctx, indices, data);\n };\n GlyphView.prototype.has_finished = function () {\n return true;\n };\n GlyphView.prototype.notify_finished = function () {\n this.renderer.notify_finished();\n };\n GlyphView.prototype._bounds = function (bounds) {\n return bounds;\n };\n GlyphView.prototype.bounds = function () {\n return this._bounds(this.index.bbox);\n };\n GlyphView.prototype.log_bounds = function () {\n var bb = bbox.empty();\n var positive_x_bbs = this.index.search(bbox.positive_x());\n for (var _i = 0, positive_x_bbs_1 = positive_x_bbs; _i < positive_x_bbs_1.length; _i++) {\n var x = positive_x_bbs_1[_i];\n if (x.minX < bb.minX)\n bb.minX = x.minX;\n if (x.maxX > bb.maxX)\n bb.maxX = x.maxX;\n }\n var positive_y_bbs = this.index.search(bbox.positive_y());\n for (var _a = 0, positive_y_bbs_1 = positive_y_bbs; _a < positive_y_bbs_1.length; _a++) {\n var y = positive_y_bbs_1[_a];\n if (y.minY < bb.minY)\n bb.minY = y.minY;\n if (y.maxY > bb.maxY)\n bb.maxY = y.maxY;\n }\n return this._bounds(bb);\n };\n GlyphView.prototype.get_anchor_point = function (anchor, i, _a) {\n var sx = _a[0], sy = _a[1];\n switch (anchor) {\n case \"center\": return { x: this.scenterx(i, sx, sy), y: this.scentery(i, sx, sy) };\n default: return null;\n }\n };\n GlyphView.prototype.sdist = function (scale, pts, spans, pts_location, dilate) {\n if (pts_location === void 0) {\n pts_location = \"edge\";\n }\n if (dilate === void 0) {\n dilate = false;\n }\n var pt0;\n var pt1;\n var n = pts.length;\n if (pts_location == 'center') {\n var halfspan = arrayable_1.map(spans, function (d) { return d / 2; });\n pt0 = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n pt0[i] = pts[i] - halfspan[i];\n }\n pt1 = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n pt1[i] = pts[i] + halfspan[i];\n }\n }\n else {\n pt0 = pts;\n pt1 = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n pt1[i] = pt0[i] + spans[i];\n }\n }\n var spt0 = scale.v_compute(pt0);\n var spt1 = scale.v_compute(pt1);\n if (dilate)\n return arrayable_1.map(spt0, function (_, i) { return Math.ceil(Math.abs(spt1[i] - spt0[i])); });\n else\n return arrayable_1.map(spt0, function (_, i) { return Math.abs(spt1[i] - spt0[i]); });\n };\n GlyphView.prototype.draw_legend_for_index = function (_ctx, _bbox, _index) { };\n GlyphView.prototype.hit_test = function (geometry) {\n var result = null;\n var func = \"_hit_\" + geometry.type;\n if (this[func] != null) {\n result = this[func](geometry);\n }\n else if (this._nohit_warned[geometry.type] == null) {\n logging_1.logger.debug(\"'\" + geometry.type + \"' selection not available for \" + this.model.type);\n this._nohit_warned[geometry.type] = true;\n }\n return result;\n };\n GlyphView.prototype._hit_rect_against_index = function (geometry) {\n var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1;\n var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var bb = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var result = hittest.create_empty_hit_test_result();\n result.indices = this.index.indices(bb);\n return result;\n };\n GlyphView.prototype.set_data = function (source, indices, indices_to_update) {\n var _a, _b, _c, _d;\n var data = this.model.materialize_dataspecs(source);\n this.visuals.set_all_indices(indices);\n if (indices && !(this instanceof line_1.LineView)) {\n var data_subset = {};\n var _loop_1 = function (k) {\n var v = data[k];\n if (k.charAt(0) === '_')\n data_subset[k] = indices.map(function (i) { return v[i]; });\n else\n data_subset[k] = v;\n };\n for (var k in data) {\n _loop_1(k);\n }\n data = data_subset;\n }\n var self = this;\n object_1.extend(self, data);\n // TODO (bev) Should really probably delegate computing projected\n // coordinates to glyphs, instead of centralizing here in one place.\n if (this.renderer.plot_view.model.use_map) {\n if (self._x != null)\n _a = proj.project_xy(self._x, self._y), self._x = _a[0], self._y = _a[1];\n if (self._xs != null)\n _b = proj.project_xsys(self._xs, self._ys), self._xs = _b[0], self._ys = _b[1];\n if (self._x0 != null)\n _c = proj.project_xy(self._x0, self._y0), self._x0 = _c[0], self._y0 = _c[1];\n if (self._x1 != null)\n _d = proj.project_xy(self._x1, self._y1), self._x1 = _d[0], self._y1 = _d[1];\n }\n // if we have any coordinates that are categorical, convert them to\n // synthetic coords here\n if (this.renderer.plot_view.frame.x_ranges != null) { // XXXX JUST TEMP FOR TESTS TO PASS\n var xr_1 = this.renderer.plot_view.frame.x_ranges[this.model.x_range_name];\n var yr_1 = this.renderer.plot_view.frame.y_ranges[this.model.y_range_name];\n for (var _i = 0, _e = this.model._coords; _i < _e.length; _i++) {\n var _f = _e[_i], xname = _f[0], yname = _f[1];\n xname = \"_\" + xname;\n yname = \"_\" + yname;\n // TODO (bev) more robust detection of multi-glyph case\n // hand multi glyph case\n if (self._xs != null) {\n if (xr_1 instanceof factor_range_1.FactorRange) {\n self[xname] = arrayable_1.map(self[xname], function (arr) { return xr_1.v_synthetic(arr); });\n }\n if (yr_1 instanceof factor_range_1.FactorRange) {\n self[yname] = arrayable_1.map(self[yname], function (arr) { return yr_1.v_synthetic(arr); });\n }\n }\n // hand standard glyph case\n else {\n if (xr_1 instanceof factor_range_1.FactorRange) {\n self[xname] = xr_1.v_synthetic(self[xname]);\n }\n if (yr_1 instanceof factor_range_1.FactorRange) {\n self[yname] = yr_1.v_synthetic(self[yname]);\n }\n }\n }\n }\n if (this.glglyph != null)\n this.glglyph.set_data_changed(self._x.length);\n this._set_data(indices_to_update); //TODO doesn't take subset indices into account\n this.index_data();\n };\n GlyphView.prototype._set_data = function (_indices) { };\n GlyphView.prototype.index_data = function () {\n this.index = this._index_data();\n };\n GlyphView.prototype.mask_data = function (indices) {\n // WebGL can do the clipping much more efficiently\n if (this.glglyph != null || this._mask_data == null)\n return indices;\n else\n return this._mask_data();\n };\n GlyphView.prototype.map_data = function () {\n var _a;\n // TODO: if using gl, skip this (when is this called?)\n // map all the coordinate fields\n var self = this;\n for (var _i = 0, _b = this.model._coords; _i < _b.length; _i++) {\n var _c = _b[_i], xname = _c[0], yname = _c[1];\n var sxname = \"s\" + xname;\n var syname = \"s\" + yname;\n xname = \"_\" + xname;\n yname = \"_\" + yname;\n if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) {\n var n = self[xname].length;\n self[sxname] = new Array(n);\n self[syname] = new Array(n);\n for (var i = 0; i < n; i++) {\n var _d = this.map_to_screen(self[xname][i], self[yname][i]), sx = _d[0], sy = _d[1];\n self[sxname][i] = sx;\n self[syname][i] = sy;\n }\n }\n else\n _a = this.map_to_screen(self[xname], self[yname]), self[sxname] = _a[0], self[syname] = _a[1];\n }\n this._map_data();\n };\n // This is where specs not included in coords are computed, e.g. radius.\n GlyphView.prototype._map_data = function () { };\n GlyphView.prototype.map_to_screen = function (x, y) {\n return this.renderer.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n };\n return GlyphView;\n }(view_1.View));\n exports.GlyphView = GlyphView;\n var Glyph = /** @class */ (function (_super) {\n tslib_1.__extends(Glyph, _super);\n function Glyph(attrs) {\n return _super.call(this, attrs) || this;\n }\n Glyph.initClass = function () {\n this.prototype.type = 'Glyph';\n this.prototype._coords = [];\n this.internal({\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n };\n Glyph.coords = function (coords) {\n var _coords = this.prototype._coords.concat(coords);\n this.prototype._coords = _coords;\n var result = {};\n for (var _i = 0, coords_1 = coords; _i < coords_1.length; _i++) {\n var _a = coords_1[_i], x = _a[0], y = _a[1];\n result[x] = [p.NumberSpec];\n result[y] = [p.NumberSpec];\n }\n this.define(result);\n };\n return Glyph;\n }(model_1.Model));\n exports.Glyph = Glyph;\n Glyph.initClass();\n}\n","/* models/glyphs/hbar */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var box_1 = require(118) /* ./box */;\n var p = require(15) /* core/properties */;\n var HBarView = /** @class */ (function (_super) {\n tslib_1.__extends(HBarView, _super);\n function HBarView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n HBarView.prototype.scenterx = function (i) {\n return (this.sleft[i] + this.sright[i]) / 2;\n };\n HBarView.prototype.scentery = function (i) {\n return this.sy[i];\n };\n HBarView.prototype._index_data = function () {\n return this._index_box(this._y.length);\n };\n HBarView.prototype._lrtb = function (i) {\n var l = Math.min(this._left[i], this._right[i]);\n var r = Math.max(this._left[i], this._right[i]);\n var t = this._y[i] + 0.5 * this._height[i];\n var b = this._y[i] - 0.5 * this._height[i];\n return [l, r, t, b];\n };\n HBarView.prototype._map_data = function () {\n this.sy = this.renderer.yscale.v_compute(this._y);\n this.sh = this.sdist(this.renderer.yscale, this._y, this._height, \"center\");\n this.sleft = this.renderer.xscale.v_compute(this._left);\n this.sright = this.renderer.xscale.v_compute(this._right);\n var n = this.sy.length;\n this.stop = new Float64Array(n);\n this.sbottom = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n this.stop[i] = this.sy[i] - this.sh[i] / 2;\n this.sbottom[i] = this.sy[i] + this.sh[i] / 2;\n }\n this._clamp_viewport();\n };\n return HBarView;\n }(box_1.BoxView));\n exports.HBarView = HBarView;\n var HBar = /** @class */ (function (_super) {\n tslib_1.__extends(HBar, _super);\n function HBar(attrs) {\n return _super.call(this, attrs) || this;\n }\n HBar.initClass = function () {\n this.prototype.type = 'HBar';\n this.prototype.default_view = HBarView;\n this.coords([['left', 'y']]);\n this.define({\n height: [p.DistanceSpec],\n right: [p.NumberSpec],\n });\n this.override({ left: 0 });\n };\n return HBar;\n }(box_1.Box));\n exports.HBar = HBar;\n HBar.initClass();\n}\n","/* models/glyphs/hex_tile */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var glyph_1 = require(123) /* ./glyph */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var utils_1 = require(143) /* ./utils */;\n var HexTileView = /** @class */ (function (_super) {\n tslib_1.__extends(HexTileView, _super);\n function HexTileView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n HexTileView.prototype.scenterx = function (i) { return this.sx[i]; };\n HexTileView.prototype.scentery = function (i) { return this.sy[i]; };\n HexTileView.prototype._set_data = function () {\n var n = this._q.length;\n var size = this.model.size;\n var aspect_scale = this.model.aspect_scale;\n this._x = new Float64Array(n);\n this._y = new Float64Array(n);\n if (this.model.orientation == \"pointytop\") {\n for (var i = 0; i < n; i++) {\n this._x[i] = size * Math.sqrt(3) * (this._q[i] + this._r[i] / 2) / aspect_scale;\n this._y[i] = -size * 3 / 2 * this._r[i];\n }\n }\n else {\n for (var i = 0; i < n; i++) {\n this._x[i] = size * 3 / 2 * this._q[i];\n this._y[i] = -size * Math.sqrt(3) * (this._r[i] + this._q[i] / 2) * aspect_scale;\n }\n }\n };\n HexTileView.prototype._index_data = function () {\n var _a;\n var ysize = this.model.size;\n var xsize = Math.sqrt(3) * ysize / 2;\n if (this.model.orientation == \"flattop\") {\n _a = [ysize, xsize], xsize = _a[0], ysize = _a[1];\n ysize *= this.model.aspect_scale;\n }\n else {\n xsize /= this.model.aspect_scale;\n }\n var points = [];\n for (var i = 0; i < this._x.length; i++) {\n var x = this._x[i];\n var y = this._y[i];\n if (isNaN(x + y) || !isFinite(x + y))\n continue;\n points.push({ minX: x - xsize, minY: y - ysize, maxX: x + xsize, maxY: y + ysize, i: i });\n }\n return new spatial_1.SpatialIndex(points);\n };\n // overriding map_data instead of _map_data because the default automatic mappings\n // for other glyphs (with cartesian coordinates) is not useful\n HexTileView.prototype.map_data = function () {\n var _a, _b;\n _a = this.map_to_screen(this._x, this._y), this.sx = _a[0], this.sy = _a[1];\n _b = this._get_unscaled_vertices(), this.svx = _b[0], this.svy = _b[1];\n };\n HexTileView.prototype._get_unscaled_vertices = function () {\n var size = this.model.size;\n var aspect_scale = this.model.aspect_scale;\n if (this.model.orientation == \"pointytop\") {\n var rscale = this.renderer.yscale;\n var hscale = this.renderer.xscale;\n var r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale\n var h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) / aspect_scale; // assumes linear scale\n var r2 = r / 2.0;\n var svx = [0, -h, -h, 0, h, h];\n var svy = [r, r2, -r2, -r, -r2, r2];\n return [svx, svy];\n }\n else {\n var rscale = this.renderer.xscale;\n var hscale = this.renderer.yscale;\n var r = Math.abs(rscale.compute(0) - rscale.compute(size)); // assumes linear scale\n var h = Math.sqrt(3) / 2 * Math.abs(hscale.compute(0) - hscale.compute(size)) * aspect_scale; // assumes linear scale\n var r2 = r / 2.0;\n var svx = [r, r2, -r2, -r, -r2, r2];\n var svy = [0, -h, -h, 0, h, h];\n return [svx, svy];\n }\n };\n HexTileView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, svx = _a.svx, svy = _a.svy, _scale = _a._scale;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + _scale[i]))\n continue;\n ctx.translate(sx[i], sy[i]);\n ctx.beginPath();\n for (var j = 0; j < 6; j++) {\n ctx.lineTo(svx[j] * _scale[i], svy[j] * _scale[i]);\n }\n ctx.closePath();\n ctx.translate(-sx[i], -sy[i]);\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n HexTileView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var candidates = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y });\n var hits = [];\n for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n var i = candidates_1[_i];\n if (hittest.point_in_poly(sx - this.sx[i], sy - this.sy[i], this.svx, this.svy)) {\n hits.push(i);\n }\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n HexTileView.prototype._hit_span = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var hits;\n if (geometry.direction == 'v') {\n var y = this.renderer.yscale.invert(sy);\n var hr = this.renderer.plot_view.frame.bbox.h_range;\n var _a = this.renderer.xscale.r_invert(hr.start, hr.end), minX = _a[0], maxX = _a[1];\n hits = this.index.indices({ minX: minX, minY: y, maxX: maxX, maxY: y });\n }\n else {\n var x = this.renderer.xscale.invert(sx);\n var vr = this.renderer.plot_view.frame.bbox.v_range;\n var _b = this.renderer.yscale.r_invert(vr.start, vr.end), minY = _b[0], maxY = _b[1];\n hits = this.index.indices({ minX: x, minY: minY, maxX: x, maxY: maxY });\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n HexTileView.prototype._hit_rect = function (geometry) {\n var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1;\n var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var result = hittest.create_empty_hit_test_result();\n result.indices = this.index.indices(bbox);\n return result;\n };\n HexTileView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n return HexTileView;\n }(glyph_1.GlyphView));\n exports.HexTileView = HexTileView;\n var HexTile = /** @class */ (function (_super) {\n tslib_1.__extends(HexTile, _super);\n function HexTile(attrs) {\n return _super.call(this, attrs) || this;\n }\n HexTile.initClass = function () {\n this.prototype.type = 'HexTile';\n this.prototype.default_view = HexTileView;\n this.coords([['r', 'q']]);\n this.mixins(['line', 'fill']);\n this.define({\n size: [p.Number, 1.0],\n aspect_scale: [p.Number, 1.0],\n scale: [p.NumberSpec, 1.0],\n orientation: [p.String, \"pointytop\"],\n });\n this.override({ line_color: null });\n };\n return HexTile;\n }(glyph_1.Glyph));\n exports.HexTile = HexTile;\n HexTile.initClass();\n}\n","/* models/glyphs/image */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var linear_color_mapper_1 = require(167) /* ../mappers/linear_color_mapper */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var hittest = require(9) /* core/hittest */;\n var ImageView = /** @class */ (function (_super) {\n tslib_1.__extends(ImageView, _super);\n function ImageView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ImageView.prototype.initialize = function (options) {\n var _this = this;\n _super.prototype.initialize.call(this, options);\n this.connect(this.model.color_mapper.change, function () { return _this._update_image(); });\n this.connect(this.model.properties.global_alpha.change, function () { return _this.renderer.request_render(); });\n };\n ImageView.prototype._update_image = function () {\n // Only reset image_data if already initialized\n if (this.image_data != null) {\n this._set_data();\n this.renderer.plot_view.request_render();\n }\n };\n ImageView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._x.length; i < end; i++) {\n var _a = this._lrtb(i), l = _a[0], r = _a[1], t = _a[2], b = _a[3];\n if (isNaN(l + r + t + b) || !isFinite(l + r + t + b)) {\n continue;\n }\n points.push({ minX: l, minY: b, maxX: r, maxY: t, i: i });\n }\n return new spatial_1.SpatialIndex(points);\n };\n ImageView.prototype._lrtb = function (i) {\n var xr = this.renderer.xscale.source_range;\n var x1 = this._x[i];\n var x2 = xr.is_reversed ? x1 - this._dw[i] : x1 + this._dw[i];\n var yr = this.renderer.yscale.source_range;\n var y1 = this._y[i];\n var y2 = yr.is_reversed ? y1 - this._dh[i] : y1 + this._dh[i];\n var _a = x1 < x2 ? [x1, x2] : [x2, x1], l = _a[0], r = _a[1];\n var _b = y1 < y2 ? [y1, y2] : [y2, y1], b = _b[0], t = _b[1];\n return [l, r, t, b];\n };\n ImageView.prototype._image_index = function (index, x, y) {\n var _a = this._lrtb(index), l = _a[0], r = _a[1], t = _a[2], b = _a[3];\n var width = this._width[index];\n var height = this._height[index];\n var dx = (r - l) / width;\n var dy = (t - b) / height;\n var dim1 = Math.floor((x - l) / dx);\n var dim2 = Math.floor((y - b) / dy);\n return { index: index, dim1: dim1, dim2: dim2, flat_index: dim2 * width + dim1 };\n };\n ImageView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var bbox = hittest.validate_bbox_coords([x, x], [y, y]);\n var candidates = this.index.indices(bbox);\n var result = hittest.create_empty_hit_test_result();\n result.image_indices = [];\n for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n var index = candidates_1[_i];\n if ((sx != Infinity) && (sy != Infinity)) {\n result.image_indices.push(this._image_index(index, x, y));\n }\n }\n return result;\n };\n ImageView.prototype._set_data = function () {\n if (this.image_data == null || this.image_data.length != this._image.length)\n this.image_data = new Array(this._image.length);\n if (this._width == null || this._width.length != this._image.length)\n this._width = new Array(this._image.length);\n if (this._height == null || this._height.length != this._image.length)\n this._height = new Array(this._image.length);\n var cmap = this.model.color_mapper.rgba_mapper;\n for (var i = 0, end = this._image.length; i < end; i++) {\n var img = void 0;\n if (this._image_shape != null && this._image_shape[i].length > 0) {\n img = this._image[i];\n var shape = this._image_shape[i];\n this._height[i] = shape[0];\n this._width[i] = shape[1];\n }\n else {\n var _image = this._image[i];\n img = array_1.concat(_image);\n this._height[i] = _image.length;\n this._width[i] = _image[0].length;\n }\n var _image_data = this.image_data[i];\n var canvas = void 0;\n if (_image_data != null && _image_data.width == this._width[i] &&\n _image_data.height == this._height[i])\n canvas = _image_data;\n else {\n canvas = document.createElement('canvas');\n canvas.width = this._width[i];\n canvas.height = this._height[i];\n }\n var ctx = canvas.getContext('2d');\n var image_data = ctx.getImageData(0, 0, this._width[i], this._height[i]);\n var buf8 = cmap.v_compute(img);\n image_data.data.set(buf8);\n ctx.putImageData(image_data, 0, 0);\n this.image_data[i] = canvas;\n this.max_dw = 0;\n if (this.model.properties.dw.units == \"data\")\n this.max_dw = array_1.max(this._dw);\n this.max_dh = 0;\n if (this.model.properties.dh.units == \"data\")\n this.max_dh = array_1.max(this._dh);\n }\n };\n ImageView.prototype._map_data = function () {\n switch (this.model.properties.dw.units) {\n case \"data\": {\n this.sw = this.sdist(this.renderer.xscale, this._x, this._dw, 'edge', this.model.dilate);\n break;\n }\n case \"screen\": {\n this.sw = this._dw;\n break;\n }\n }\n switch (this.model.properties.dh.units) {\n case \"data\": {\n this.sh = this.sdist(this.renderer.yscale, this._y, this._dh, 'edge', this.model.dilate);\n break;\n }\n case \"screen\": {\n this.sh = this._dh;\n break;\n }\n }\n };\n ImageView.prototype._render = function (ctx, indices, _a) {\n var image_data = _a.image_data, sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh;\n var old_smoothing = ctx.getImageSmoothingEnabled();\n ctx.setImageSmoothingEnabled(false);\n ctx.globalAlpha = this.model.global_alpha;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (image_data[i] == null)\n continue;\n if (isNaN(sx[i] + sy[i] + sw[i] + sh[i]))\n continue;\n var y_offset = sy[i];\n ctx.translate(0, y_offset);\n ctx.scale(1, -1);\n ctx.translate(0, -y_offset);\n ctx.drawImage(image_data[i], sx[i] | 0, sy[i] | 0, sw[i], sh[i]);\n ctx.translate(0, y_offset);\n ctx.scale(1, -1);\n ctx.translate(0, -y_offset);\n }\n ctx.setImageSmoothingEnabled(old_smoothing);\n };\n ImageView.prototype.bounds = function () {\n var bbox = this.index.bbox;\n bbox.maxX += this.max_dw;\n bbox.maxY += this.max_dh;\n return bbox;\n };\n return ImageView;\n }(xy_glyph_1.XYGlyphView));\n exports.ImageView = ImageView;\n // NOTE: this needs to be redefined here, because palettes are located in bokeh-api.js bundle\n var Greys9 = function () { return [\"#000000\", \"#252525\", \"#525252\", \"#737373\", \"#969696\", \"#bdbdbd\", \"#d9d9d9\", \"#f0f0f0\", \"#ffffff\"]; };\n var Image = /** @class */ (function (_super) {\n tslib_1.__extends(Image, _super);\n function Image(attrs) {\n return _super.call(this, attrs) || this;\n }\n Image.initClass = function () {\n this.prototype.type = 'Image';\n this.prototype.default_view = ImageView;\n this.define({\n image: [p.NumberSpec],\n dw: [p.DistanceSpec],\n dh: [p.DistanceSpec],\n dilate: [p.Bool, false],\n global_alpha: [p.Number, 1.0],\n color_mapper: [p.Instance, function () { return new linear_color_mapper_1.LinearColorMapper({ palette: Greys9() }); }],\n });\n };\n return Image;\n }(xy_glyph_1.XYGlyph));\n exports.Image = Image;\n Image.initClass();\n}\n","/* models/glyphs/image_rgba */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var ImageRGBAView = /** @class */ (function (_super) {\n tslib_1.__extends(ImageRGBAView, _super);\n function ImageRGBAView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ImageRGBAView.prototype.initialize = function (options) {\n var _this = this;\n _super.prototype.initialize.call(this, options);\n this.connect(this.model.properties.global_alpha.change, function () { return _this.renderer.request_render(); });\n };\n ImageRGBAView.prototype._set_data = function (indices) {\n if (this.image_data == null || this.image_data.length != this._image.length)\n this.image_data = new Array(this._image.length);\n if (this._width == null || this._width.length != this._image.length)\n this._width = new Array(this._image.length);\n if (this._height == null || this._height.length != this._image.length)\n this._height = new Array(this._image.length);\n for (var i = 0, end = this._image.length; i < end; i++) {\n if (indices != null && indices.indexOf(i) < 0)\n continue;\n var buf = void 0;\n if (this._image_shape != null && this._image_shape[i].length > 0) {\n buf = this._image[i].buffer;\n var shape = this._image_shape[i];\n this._height[i] = shape[0];\n this._width[i] = shape[1];\n }\n else {\n var _image = this._image[i];\n var flat = array_1.concat(_image);\n buf = new ArrayBuffer(flat.length * 4);\n var color = new Uint32Array(buf);\n for (var j = 0, endj = flat.length; j < endj; j++) {\n color[j] = flat[j];\n }\n this._height[i] = _image.length;\n this._width[i] = _image[0].length;\n }\n var _image_data = this.image_data[i];\n var canvas = void 0;\n if (_image_data != null && _image_data.width == this._width[i] &&\n _image_data.height == this._height[i])\n canvas = _image_data;\n else {\n canvas = document.createElement('canvas');\n canvas.width = this._width[i];\n canvas.height = this._height[i];\n }\n var ctx = canvas.getContext('2d');\n var image_data = ctx.getImageData(0, 0, this._width[i], this._height[i]);\n var buf8 = new Uint8Array(buf);\n image_data.data.set(buf8);\n ctx.putImageData(image_data, 0, 0);\n this.image_data[i] = canvas;\n this.max_dw = 0;\n if (this.model.properties.dw.units == \"data\")\n this.max_dw = array_1.max(this._dw);\n this.max_dh = 0;\n if (this.model.properties.dh.units == \"data\")\n this.max_dh = array_1.max(this._dh);\n }\n };\n ImageRGBAView.prototype._map_data = function () {\n switch (this.model.properties.dw.units) {\n case \"data\": {\n this.sw = this.sdist(this.renderer.xscale, this._x, this._dw, \"edge\", this.model.dilate);\n break;\n }\n case \"screen\": {\n this.sw = this._dw;\n break;\n }\n }\n switch (this.model.properties.dh.units) {\n case \"data\": {\n this.sh = this.sdist(this.renderer.yscale, this._y, this._dh, \"edge\", this.model.dilate);\n break;\n }\n case \"screen\": {\n this.sh = this._dh;\n break;\n }\n }\n };\n ImageRGBAView.prototype._render = function (ctx, indices, _a) {\n var image_data = _a.image_data, sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh;\n var old_smoothing = ctx.getImageSmoothingEnabled();\n ctx.setImageSmoothingEnabled(false);\n ctx.globalAlpha = this.model.global_alpha;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sw[i] + sh[i]))\n continue;\n var y_offset = sy[i];\n ctx.translate(0, y_offset);\n ctx.scale(1, -1);\n ctx.translate(0, -y_offset);\n ctx.drawImage(image_data[i], sx[i] | 0, sy[i] | 0, sw[i], sh[i]);\n ctx.translate(0, y_offset);\n ctx.scale(1, -1);\n ctx.translate(0, -y_offset);\n }\n ctx.setImageSmoothingEnabled(old_smoothing);\n };\n ImageRGBAView.prototype.bounds = function () {\n var bbox = this.index.bbox;\n bbox.maxX += this.max_dw;\n bbox.maxY += this.max_dh;\n return bbox;\n };\n return ImageRGBAView;\n }(xy_glyph_1.XYGlyphView));\n exports.ImageRGBAView = ImageRGBAView;\n var ImageRGBA = /** @class */ (function (_super) {\n tslib_1.__extends(ImageRGBA, _super);\n function ImageRGBA(attrs) {\n return _super.call(this, attrs) || this;\n }\n ImageRGBA.initClass = function () {\n this.prototype.type = 'ImageRGBA';\n this.prototype.default_view = ImageRGBAView;\n this.define({\n image: [p.NumberSpec],\n dw: [p.DistanceSpec],\n dh: [p.DistanceSpec],\n global_alpha: [p.Number, 1.0],\n dilate: [p.Bool, false],\n });\n };\n return ImageRGBA;\n }(xy_glyph_1.XYGlyph));\n exports.ImageRGBA = ImageRGBA;\n ImageRGBA.initClass();\n}\n","/* models/glyphs/image_url */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var spatial_1 = require(37) /* core/util/spatial */;\n exports.CanvasImage = Image;\n var ImageURLView = /** @class */ (function (_super) {\n tslib_1.__extends(ImageURLView, _super);\n function ImageURLView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._images_rendered = false;\n return _this;\n }\n ImageURLView.prototype.initialize = function (options) {\n var _this = this;\n _super.prototype.initialize.call(this, options);\n this.connect(this.model.properties.global_alpha.change, function () { return _this.renderer.request_render(); });\n };\n ImageURLView.prototype._index_data = function () {\n return new spatial_1.SpatialIndex([]);\n };\n ImageURLView.prototype._set_data = function () {\n var _this = this;\n if (this.image == null || this.image.length != this._url.length)\n this.image = arrayable_1.map(this._url, function () { return null; });\n var _a = this.model, retry_attempts = _a.retry_attempts, retry_timeout = _a.retry_timeout;\n this.retries = arrayable_1.map(this._url, function () { return retry_attempts; });\n var _loop_1 = function (i, end) {\n if (this_1._url[i] == null)\n return \"continue\";\n var img = new exports.CanvasImage();\n img.onerror = function () {\n if (_this.retries[i] > 0) {\n logging_1.logger.trace(\"ImageURL failed to load \" + _this._url[i] + \" image, retrying in \" + retry_timeout + \" ms\");\n setTimeout(function () { return img.src = _this._url[i]; }, retry_timeout);\n }\n else\n logging_1.logger.warn(\"ImageURL unable to load \" + _this._url[i] + \" image after \" + retry_attempts + \" retries\");\n _this.retries[i] -= 1;\n };\n img.onload = function () {\n _this.image[i] = img;\n _this.renderer.request_render();\n };\n img.src = this_1._url[i];\n };\n var this_1 = this;\n for (var i = 0, end = this._url.length; i < end; i++) {\n _loop_1(i, end);\n }\n var w_data = this.model.properties.w.units == \"data\";\n var h_data = this.model.properties.h.units == \"data\";\n var n = this._x.length;\n var xs = new Array(w_data ? 2 * n : n);\n var ys = new Array(h_data ? 2 * n : n);\n for (var i = 0; i < n; i++) {\n xs[i] = this._x[i];\n ys[i] = this._y[i];\n }\n // if the width/height are in screen units, don't try to include them in bounds\n if (w_data) {\n for (var i = 0; i < n; i++)\n xs[n + i] = this._x[i] + this._w[i];\n }\n if (h_data) {\n for (var i = 0; i < n; i++)\n ys[n + i] = this._y[i] + this._h[i];\n }\n var minX = arrayable_1.min(xs);\n var maxX = arrayable_1.max(xs);\n var minY = arrayable_1.min(ys);\n var maxY = arrayable_1.max(ys);\n this._bounds_rect = { minX: minX, maxX: maxX, minY: minY, maxY: maxY };\n };\n ImageURLView.prototype.has_finished = function () {\n return _super.prototype.has_finished.call(this) && this._images_rendered == true;\n };\n ImageURLView.prototype._map_data = function () {\n // Better to check this.model.w and this.model.h for null since the set_data\n // machinery will have converted this._w and this._w to lists of null\n var ws = this.model.w != null ? this._w : arrayable_1.map(this._x, function () { return NaN; });\n var hs = this.model.h != null ? this._h : arrayable_1.map(this._x, function () { return NaN; });\n switch (this.model.properties.w.units) {\n case \"data\": {\n this.sw = this.sdist(this.renderer.xscale, this._x, ws, \"edge\", this.model.dilate);\n break;\n }\n case \"screen\": {\n this.sw = ws;\n break;\n }\n }\n switch (this.model.properties.h.units) {\n case \"data\": {\n this.sh = this.sdist(this.renderer.yscale, this._y, hs, \"edge\", this.model.dilate);\n break;\n }\n case \"screen\": {\n this.sh = hs;\n break;\n }\n }\n };\n ImageURLView.prototype._render = function (ctx, indices, _a) {\n var image = _a.image, sx = _a.sx, sy = _a.sy, sw = _a.sw, sh = _a.sh, _angle = _a._angle;\n // TODO (bev): take actual border width into account when clipping\n var frame = this.renderer.plot_view.frame;\n ctx.rect(frame._left.value + 1, frame._top.value + 1, frame._width.value - 2, frame._height.value - 2);\n ctx.clip();\n var finished = true;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + _angle[i]))\n continue;\n if (this.retries[i] == -1)\n continue;\n var img = image[i];\n if (img == null) {\n finished = false;\n continue;\n }\n this._render_image(ctx, i, img, sx, sy, sw, sh, _angle);\n }\n if (finished && !this._images_rendered) {\n this._images_rendered = true;\n this.notify_finished();\n }\n };\n ImageURLView.prototype._final_sx_sy = function (anchor, sx, sy, sw, sh) {\n switch (anchor) {\n case 'top_left': return [sx, sy];\n case 'top_center': return [sx - (sw / 2), sy];\n case 'top_right': return [sx - sw, sy];\n case 'center_right': return [sx - sw, sy - (sh / 2)];\n case 'bottom_right': return [sx - sw, sy - sh];\n case 'bottom_center': return [sx - (sw / 2), sy - sh];\n case 'bottom_left': return [sx, sy - sh];\n case 'center_left': return [sx, sy - (sh / 2)];\n case 'center': return [sx - (sw / 2), sy - (sh / 2)];\n }\n };\n ImageURLView.prototype._render_image = function (ctx, i, image, sx, sy, sw, sh, angle) {\n if (isNaN(sw[i]))\n sw[i] = image.width;\n if (isNaN(sh[i]))\n sh[i] = image.height;\n var anchor = this.model.anchor;\n var _a = this._final_sx_sy(anchor, sx[i], sy[i], sw[i], sh[i]), sxi = _a[0], syi = _a[1];\n ctx.save();\n ctx.globalAlpha = this.model.global_alpha;\n if (angle[i]) {\n ctx.translate(sxi, syi);\n ctx.rotate(angle[i]);\n ctx.drawImage(image, 0, 0, sw[i], sh[i]);\n ctx.rotate(-angle[i]);\n ctx.translate(-sxi, -syi);\n }\n else\n ctx.drawImage(image, sxi, syi, sw[i], sh[i]);\n ctx.restore();\n };\n ImageURLView.prototype.bounds = function () {\n return this._bounds_rect;\n };\n return ImageURLView;\n }(xy_glyph_1.XYGlyphView));\n exports.ImageURLView = ImageURLView;\n var ImageURL = /** @class */ (function (_super) {\n tslib_1.__extends(ImageURL, _super);\n function ImageURL(attrs) {\n return _super.call(this, attrs) || this;\n }\n ImageURL.initClass = function () {\n this.prototype.type = 'ImageURL';\n this.prototype.default_view = ImageURLView;\n this.define({\n url: [p.StringSpec],\n anchor: [p.Anchor, 'top_left'],\n global_alpha: [p.Number, 1.0],\n angle: [p.AngleSpec, 0],\n w: [p.DistanceSpec],\n h: [p.DistanceSpec],\n dilate: [p.Bool, false],\n retry_attempts: [p.Number, 0],\n retry_timeout: [p.Number, 0],\n });\n };\n return ImageURL;\n }(xy_glyph_1.XYGlyph));\n exports.ImageURL = ImageURL;\n ImageURL.initClass();\n}\n","/* models/glyphs/index */ function _(require, module, exports) {\n var annular_wedge_1 = require(114) /* ./annular_wedge */;\n exports.AnnularWedge = annular_wedge_1.AnnularWedge;\n var annulus_1 = require(115) /* ./annulus */;\n exports.Annulus = annulus_1.Annulus;\n var arc_1 = require(116) /* ./arc */;\n exports.Arc = arc_1.Arc;\n var bezier_1 = require(117) /* ./bezier */;\n exports.Bezier = bezier_1.Bezier;\n var circle_1 = require(120) /* ./circle */;\n exports.Circle = circle_1.Circle;\n var center_rotatable_1 = require(119) /* ./center_rotatable */;\n exports.CenterRotatable = center_rotatable_1.CenterRotatable;\n var ellipse_1 = require(121) /* ./ellipse */;\n exports.Ellipse = ellipse_1.Ellipse;\n var ellipse_oval_1 = require(122) /* ./ellipse_oval */;\n exports.EllipseOval = ellipse_oval_1.EllipseOval;\n var glyph_1 = require(123) /* ./glyph */;\n exports.Glyph = glyph_1.Glyph;\n var hbar_1 = require(124) /* ./hbar */;\n exports.HBar = hbar_1.HBar;\n var hex_tile_1 = require(125) /* ./hex_tile */;\n exports.HexTile = hex_tile_1.HexTile;\n var image_1 = require(126) /* ./image */;\n exports.Image = image_1.Image;\n var image_rgba_1 = require(127) /* ./image_rgba */;\n exports.ImageRGBA = image_rgba_1.ImageRGBA;\n var image_url_1 = require(128) /* ./image_url */;\n exports.ImageURL = image_url_1.ImageURL;\n var line_1 = require(130) /* ./line */;\n exports.Line = line_1.Line;\n var multi_line_1 = require(131) /* ./multi_line */;\n exports.MultiLine = multi_line_1.MultiLine;\n var multi_polygons_1 = require(132) /* ./multi_polygons */;\n exports.MultiPolygons = multi_polygons_1.MultiPolygons;\n var oval_1 = require(133) /* ./oval */;\n exports.Oval = oval_1.Oval;\n var patch_1 = require(134) /* ./patch */;\n exports.Patch = patch_1.Patch;\n var patches_1 = require(135) /* ./patches */;\n exports.Patches = patches_1.Patches;\n var quad_1 = require(136) /* ./quad */;\n exports.Quad = quad_1.Quad;\n var quadratic_1 = require(137) /* ./quadratic */;\n exports.Quadratic = quadratic_1.Quadratic;\n var ray_1 = require(138) /* ./ray */;\n exports.Ray = ray_1.Ray;\n var rect_1 = require(139) /* ./rect */;\n exports.Rect = rect_1.Rect;\n var segment_1 = require(140) /* ./segment */;\n exports.Segment = segment_1.Segment;\n var step_1 = require(141) /* ./step */;\n exports.Step = step_1.Step;\n var text_1 = require(142) /* ./text */;\n exports.Text = text_1.Text;\n var vbar_1 = require(144) /* ./vbar */;\n exports.VBar = vbar_1.VBar;\n var wedge_1 = require(145) /* ./wedge */;\n exports.Wedge = wedge_1.Wedge;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n exports.XYGlyph = xy_glyph_1.XYGlyph;\n}\n","/* models/glyphs/line */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var hittest = require(9) /* core/hittest */;\n var LineView = /** @class */ (function (_super) {\n tslib_1.__extends(LineView, _super);\n function LineView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LineView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy;\n var drawing = false;\n var last_index = null;\n this.visuals.line.set_value(ctx);\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (drawing) {\n if (!isFinite(sx[i] + sy[i])) {\n ctx.stroke();\n ctx.beginPath();\n drawing = false;\n last_index = i;\n continue;\n }\n if (last_index != null && i - last_index > 1) {\n ctx.stroke();\n drawing = false;\n }\n }\n if (drawing)\n ctx.lineTo(sx[i], sy[i]);\n else {\n ctx.beginPath();\n ctx.moveTo(sx[i], sy[i]);\n drawing = true;\n }\n last_index = i;\n }\n if (drawing)\n ctx.stroke();\n };\n LineView.prototype._hit_point = function (geometry) {\n var _this = this;\n /* Check if the point geometry hits this line glyph and return an object\n that describes the hit result:\n Args:\n * geometry (object): object with the following keys\n * sx (float): screen x coordinate of the point\n * sy (float): screen y coordinate of the point\n * type (str): type of geometry (in this case it's a point)\n Output:\n Object with the following keys:\n * 0d (bool): whether the point hits the glyph or not\n * 1d (array(int)): array with the indices hit by the point\n */\n var result = hittest.create_empty_hit_test_result();\n var point = { x: geometry.sx, y: geometry.sy };\n var shortest = 9999;\n var threshold = Math.max(2, this.visuals.line.line_width.value() / 2);\n for (var i = 0, end = this.sx.length - 1; i < end; i++) {\n var p0 = { x: this.sx[i], y: this.sy[i] };\n var p1 = { x: this.sx[i + 1], y: this.sy[i + 1] };\n var dist = hittest.dist_to_segment(point, p0, p1);\n if (dist < threshold && dist < shortest) {\n shortest = dist;\n result.add_to_selected_glyphs(this.model);\n result.get_view = function () { return _this; };\n result.line_indices = [i];\n }\n }\n return result;\n };\n LineView.prototype._hit_span = function (geometry) {\n var _this = this;\n var sx = geometry.sx, sy = geometry.sy;\n var result = hittest.create_empty_hit_test_result();\n var val;\n var values;\n if (geometry.direction == 'v') {\n val = this.renderer.yscale.invert(sy);\n values = this._y;\n }\n else {\n val = this.renderer.xscale.invert(sx);\n values = this._x;\n }\n for (var i = 0, end = values.length - 1; i < end; i++) {\n if ((values[i] <= val && val <= values[i + 1]) || (values[i + 1] <= val && val <= values[i])) {\n result.add_to_selected_glyphs(this.model);\n result.get_view = function () { return _this; };\n result.line_indices.push(i);\n }\n }\n return result;\n };\n LineView.prototype.get_interpolation_hit = function (i, geometry) {\n var _a = [this._x[i], this._y[i], this._x[i + 1], this._y[i + 1]], x2 = _a[0], y2 = _a[1], x3 = _a[2], y3 = _a[3];\n return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3);\n };\n LineView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n return LineView;\n }(xy_glyph_1.XYGlyphView));\n exports.LineView = LineView;\n var Line = /** @class */ (function (_super) {\n tslib_1.__extends(Line, _super);\n function Line(attrs) {\n return _super.call(this, attrs) || this;\n }\n Line.initClass = function () {\n this.prototype.type = 'Line';\n this.prototype.default_view = LineView;\n this.mixins(['line']);\n };\n return Line;\n }(xy_glyph_1.XYGlyph));\n exports.Line = Line;\n Line.initClass();\n}\n","/* models/glyphs/multi_line */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var hittest = require(9) /* core/hittest */;\n var object_1 = require(32) /* core/util/object */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n var MultiLineView = /** @class */ (function (_super) {\n tslib_1.__extends(MultiLineView, _super);\n function MultiLineView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MultiLineView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._xs.length; i < end; i++) {\n if (this._xs[i] == null || this._xs[i].length === 0)\n continue;\n var _xsi = this._xs[i];\n var xs = [];\n for (var j = 0, n = _xsi.length; j < n; j++) {\n var x = _xsi[j];\n if (!types_1.isStrictNaN(x))\n xs.push(x);\n }\n var _ysi = this._ys[i];\n var ys = [];\n for (var j = 0, n = _ysi.length; j < n; j++) {\n var y = _ysi[j];\n if (!types_1.isStrictNaN(y))\n ys.push(y);\n }\n var _a = [array_1.min(xs), array_1.max(xs)], minX = _a[0], maxX = _a[1];\n var _b = [array_1.min(ys), array_1.max(ys)], minY = _b[0], maxY = _b[1];\n points.push({ minX: minX, minY: minY, maxX: maxX, maxY: maxY, i: i });\n }\n return new spatial_1.SpatialIndex(points);\n };\n MultiLineView.prototype._render = function (ctx, indices, _a) {\n var sxs = _a.sxs, sys = _a.sys;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n var _b = [sxs[i], sys[i]], sx = _b[0], sy = _b[1];\n this.visuals.line.set_vectorize(ctx, i);\n for (var j = 0, end = sx.length; j < end; j++) {\n if (j == 0) {\n ctx.beginPath();\n ctx.moveTo(sx[j], sy[j]);\n continue;\n }\n else if (isNaN(sx[j]) || isNaN(sy[j])) {\n ctx.stroke();\n ctx.beginPath();\n continue;\n }\n else\n ctx.lineTo(sx[j], sy[j]);\n }\n ctx.stroke();\n }\n };\n MultiLineView.prototype._hit_point = function (geometry) {\n var result = hittest.create_empty_hit_test_result();\n var point = { x: geometry.sx, y: geometry.sy };\n var shortest = 9999;\n var hits = {};\n for (var i = 0, end = this.sxs.length; i < end; i++) {\n var threshold = Math.max(2, this.visuals.line.cache_select('line_width', i) / 2);\n var points = null;\n for (var j = 0, endj = this.sxs[i].length - 1; j < endj; j++) {\n var p0 = { x: this.sxs[i][j], y: this.sys[i][j] };\n var p1 = { x: this.sxs[i][j + 1], y: this.sys[i][j + 1] };\n var dist = hittest.dist_to_segment(point, p0, p1);\n if (dist < threshold && dist < shortest) {\n shortest = dist;\n points = [j];\n }\n }\n if (points)\n hits[i] = points;\n }\n result.indices = object_1.keys(hits).map(function (x) { return parseInt(x, 10); });\n result.multiline_indices = hits;\n return result;\n };\n MultiLineView.prototype._hit_span = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var result = hittest.create_empty_hit_test_result();\n var val;\n var values;\n if (geometry.direction === 'v') {\n val = this.renderer.yscale.invert(sy);\n values = this._ys;\n }\n else {\n val = this.renderer.xscale.invert(sx);\n values = this._xs;\n }\n var hits = {};\n for (var i = 0, end = values.length; i < end; i++) {\n var points = [];\n for (var j = 0, endj = values[i].length - 1; j < endj; j++) {\n if (values[i][j] <= val && val <= values[i][j + 1])\n points.push(j);\n }\n if (points.length > 0)\n hits[i] = points;\n }\n result.indices = object_1.keys(hits).map(function (x) { return parseInt(x, 10); });\n result.multiline_indices = hits;\n return result;\n };\n MultiLineView.prototype.get_interpolation_hit = function (i, point_i, geometry) {\n var _a = [this._xs[i][point_i], this._ys[i][point_i], this._xs[i][point_i + 1], this._ys[i][point_i + 1]], x2 = _a[0], y2 = _a[1], x3 = _a[2], y3 = _a[3];\n return utils_1.line_interpolation(this.renderer, geometry, x2, y2, x3, y3);\n };\n MultiLineView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n MultiLineView.prototype.scenterx = function () {\n throw new Error(\"not implemented\");\n };\n MultiLineView.prototype.scentery = function () {\n throw new Error(\"not implemented\");\n };\n return MultiLineView;\n }(glyph_1.GlyphView));\n exports.MultiLineView = MultiLineView;\n var MultiLine = /** @class */ (function (_super) {\n tslib_1.__extends(MultiLine, _super);\n function MultiLine(attrs) {\n return _super.call(this, attrs) || this;\n }\n MultiLine.initClass = function () {\n this.prototype.type = 'MultiLine';\n this.prototype.default_view = MultiLineView;\n this.coords([['xs', 'ys']]);\n this.mixins(['line']);\n };\n return MultiLine;\n }(glyph_1.Glyph));\n exports.MultiLine = MultiLine;\n MultiLine.initClass();\n}\n","/* models/glyphs/multi_polygons */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n var array_1 = require(21) /* core/util/array */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var hittest = require(9) /* core/hittest */;\n var types_1 = require(44) /* core/util/types */;\n var MultiPolygonsView = /** @class */ (function (_super) {\n tslib_1.__extends(MultiPolygonsView, _super);\n function MultiPolygonsView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MultiPolygonsView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._xs.length; i < end; i++) {\n for (var j = 0, endj = this._xs[i].length; j < endj; j++) {\n var xs = this._xs[i][j][0]; // do not use holes\n var ys = this._ys[i][j][0]; // do not use holes\n if (xs.length == 0)\n continue;\n points.push({\n minX: array_1.min(xs),\n minY: array_1.min(ys),\n maxX: array_1.max(xs),\n maxY: array_1.max(ys),\n i: i,\n });\n }\n }\n this.hole_index = this._index_hole_data(); // should this be set here?\n return new spatial_1.SpatialIndex(points);\n };\n MultiPolygonsView.prototype._index_hole_data = function () {\n // need advice on how to use this sure if this could be more useful\n var points = [];\n for (var i = 0, end = this._xs.length; i < end; i++) {\n for (var j = 0, endj = this._xs[i].length; j < endj; j++) {\n if (this._xs[i][j].length > 1) {\n for (var k = 1, endk = this._xs[i][j].length; k < endk; k++) {\n var xs = this._xs[i][j][k]; // only use holes\n var ys = this._ys[i][j][k]; // only use holes\n if (xs.length == 0)\n continue;\n points.push({\n minX: array_1.min(xs),\n minY: array_1.min(ys),\n maxX: array_1.max(xs),\n maxY: array_1.max(ys),\n i: i,\n });\n }\n }\n }\n }\n return new spatial_1.SpatialIndex(points);\n };\n MultiPolygonsView.prototype._mask_data = function () {\n var xr = this.renderer.plot_view.frame.x_ranges[\"default\"];\n var _a = [xr.min, xr.max], x0 = _a[0], x1 = _a[1];\n var yr = this.renderer.plot_view.frame.y_ranges[\"default\"];\n var _b = [yr.min, yr.max], y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var indices = this.index.indices(bbox);\n // TODO this is probably needed in patches as well so that we don't draw glyphs multiple times\n return indices.sort(function (a, b) { return a - b; }).filter(function (value, index, array) {\n return (index === 0) || (value !== array[index - 1]);\n });\n };\n MultiPolygonsView.prototype._render = function (ctx, indices, _a) {\n var sxs = _a.sxs, sys = _a.sys;\n if (this.visuals.fill.doit || this.visuals.line.doit) {\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n ctx.beginPath();\n for (var j = 0, endj = sxs[i].length; j < endj; j++) {\n for (var k = 0, endk = sxs[i][j].length; k < endk; k++) {\n var _sx = sxs[i][j][k];\n var _sy = sys[i][j][k];\n for (var l = 0, endl = _sx.length; l < endl; l++) {\n if (l == 0) {\n ctx.moveTo(_sx[l], _sy[l]);\n continue;\n }\n else\n ctx.lineTo(_sx[l], _sy[l]);\n }\n ctx.closePath();\n }\n }\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fill(\"evenodd\");\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n }\n };\n MultiPolygonsView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var candidates = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y });\n var hole_candidates = this.hole_index.indices({ minX: x, minY: y, maxX: x, maxY: y });\n var hits = [];\n for (var i = 0, end = candidates.length; i < end; i++) {\n var idx = candidates[i];\n var sxs = this.sxs[idx];\n var sys = this.sys[idx];\n for (var j = 0, endj = sxs.length; j < endj; j++) {\n var nk = sxs[j].length;\n if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0])) {\n if (nk == 1) {\n hits.push(idx);\n }\n else if (hole_candidates.indexOf(idx) == -1) {\n hits.push(idx);\n }\n else if (nk > 1) {\n var in_a_hole = false;\n for (var k = 1; k < nk; k++) {\n var sxs_k = sxs[j][k];\n var sys_k = sys[j][k];\n if (hittest.point_in_poly(sx, sy, sxs_k, sys_k)) {\n in_a_hole = true;\n break;\n }\n else {\n continue;\n }\n }\n if (!in_a_hole) {\n hits.push(idx);\n }\n }\n }\n }\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n MultiPolygonsView.prototype._get_snap_coord = function (array) {\n return arrayable_1.sum(array) / array.length;\n };\n MultiPolygonsView.prototype.scenterx = function (i, sx, sy) {\n if (this.sxs[i].length == 1) {\n // We don't have discontinuous objects so we're ok\n return this._get_snap_coord(this.sxs[i][0][0]);\n }\n else {\n // We have discontinuous objects, so we need to find which\n // one we're in, we can use point_in_poly again\n var sxs = this.sxs[i];\n var sys = this.sys[i];\n for (var j = 0, end = sxs.length; j < end; j++) {\n if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0]))\n return this._get_snap_coord(sxs[j][0]);\n }\n }\n throw new Error(\"unreachable code\");\n };\n MultiPolygonsView.prototype.scentery = function (i, sx, sy) {\n if (this.sys[i].length == 1) {\n // We don't have discontinuous objects so we're ok\n return this._get_snap_coord(this.sys[i][0][0]);\n }\n else {\n // We have discontinuous objects, so we need to find which\n // one we're in, we can use point_in_poly again\n var sxs = this.sxs[i];\n var sys = this.sys[i];\n for (var j = 0, end = sxs.length; j < end; j++) {\n if (hittest.point_in_poly(sx, sy, sxs[j][0], sys[j][0]))\n return this._get_snap_coord(sys[j][0]);\n }\n }\n throw new Error(\"unreachable code\");\n };\n MultiPolygonsView.prototype.map_data = function () {\n var self = this;\n for (var _i = 0, _a = this.model._coords; _i < _a.length; _i++) {\n var _b = _a[_i], xname = _b[0], yname = _b[1];\n var sxname = \"s\" + xname;\n var syname = \"s\" + yname;\n xname = \"_\" + xname;\n yname = \"_\" + yname;\n if (self[xname] != null && (types_1.isArray(self[xname][0]) || types_1.isTypedArray(self[xname][0]))) {\n var ni = self[xname].length;\n self[sxname] = new Array(ni);\n self[syname] = new Array(ni);\n for (var i = 0; i < ni; i++) {\n var nj = self[xname][i].length;\n self[sxname][i] = new Array(nj);\n self[syname][i] = new Array(nj);\n for (var j = 0; j < nj; j++) {\n var nk = self[xname][i][j].length;\n self[sxname][i][j] = new Array(nk);\n self[syname][i][j] = new Array(nk);\n for (var k = 0; k < nk; k++) {\n var _c = this.map_to_screen(self[xname][i][j][k], self[yname][i][j][k]), sx = _c[0], sy = _c[1];\n self[sxname][i][j][k] = sx;\n self[syname][i][j][k] = sy;\n }\n }\n }\n }\n }\n };\n MultiPolygonsView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n return MultiPolygonsView;\n }(glyph_1.GlyphView));\n exports.MultiPolygonsView = MultiPolygonsView;\n var MultiPolygons = /** @class */ (function (_super) {\n tslib_1.__extends(MultiPolygons, _super);\n function MultiPolygons(attrs) {\n return _super.call(this, attrs) || this;\n }\n MultiPolygons.initClass = function () {\n this.prototype.type = 'MultiPolygons';\n this.prototype.default_view = MultiPolygonsView;\n this.coords([['xs', 'ys']]);\n this.mixins(['line', 'fill']);\n };\n return MultiPolygons;\n }(glyph_1.Glyph));\n exports.MultiPolygons = MultiPolygons;\n MultiPolygons.initClass();\n}\n","/* models/glyphs/oval */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var ellipse_oval_1 = require(122) /* ./ellipse_oval */;\n var OvalView = /** @class */ (function (_super) {\n tslib_1.__extends(OvalView, _super);\n function OvalView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n OvalView.prototype._map_data = function () {\n var sw;\n var n = this._x.length;\n this.sw = new Float64Array(n);\n if (this.model.properties.width.units == \"data\")\n sw = this.sdist(this.renderer.xscale, this._x, this._width, 'center');\n else\n sw = this._width;\n // oval drawn from bezier curves = ellipse with width reduced by 3/4\n for (var i = 0; i < n; i++)\n this.sw[i] = sw[i] * 0.75;\n if (this.model.properties.height.units == \"data\")\n this.sh = this.sdist(this.renderer.yscale, this._y, this._height, 'center');\n else\n this.sh = this._height;\n };\n return OvalView;\n }(ellipse_oval_1.EllipseOvalView));\n exports.OvalView = OvalView;\n var Oval = /** @class */ (function (_super) {\n tslib_1.__extends(Oval, _super);\n function Oval(attrs) {\n return _super.call(this, attrs) || this;\n }\n Oval.initClass = function () {\n this.prototype.type = 'Oval';\n this.prototype.default_view = OvalView;\n };\n return Oval;\n }(ellipse_oval_1.EllipseOval));\n exports.Oval = Oval;\n Oval.initClass();\n}\n","/* models/glyphs/patch */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var PatchView = /** @class */ (function (_super) {\n tslib_1.__extends(PatchView, _super);\n function PatchView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PatchView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy;\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_value(ctx);\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (i == 0) {\n ctx.beginPath();\n ctx.moveTo(sx[i], sy[i]);\n continue;\n }\n else if (isNaN(sx[i] + sy[i])) {\n ctx.closePath();\n ctx.fill();\n ctx.beginPath();\n continue;\n }\n else\n ctx.lineTo(sx[i], sy[i]);\n }\n ctx.closePath();\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_value(ctx);\n for (var _b = 0, indices_2 = indices; _b < indices_2.length; _b++) {\n var i = indices_2[_b];\n if (i == 0) {\n ctx.beginPath();\n ctx.moveTo(sx[i], sy[i]);\n continue;\n }\n else if (isNaN(sx[i] + sy[i])) {\n ctx.closePath();\n ctx.stroke();\n ctx.beginPath();\n continue;\n }\n else\n ctx.lineTo(sx[i], sy[i]);\n }\n ctx.closePath();\n return ctx.stroke();\n }\n };\n PatchView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n return PatchView;\n }(xy_glyph_1.XYGlyphView));\n exports.PatchView = PatchView;\n var Patch = /** @class */ (function (_super) {\n tslib_1.__extends(Patch, _super);\n function Patch(attrs) {\n return _super.call(this, attrs) || this;\n }\n Patch.initClass = function () {\n this.prototype.type = 'Patch';\n this.prototype.default_view = PatchView;\n this.mixins(['line', 'fill']);\n };\n return Patch;\n }(xy_glyph_1.XYGlyph));\n exports.Patch = Patch;\n Patch.initClass();\n}\n","/* models/glyphs/patches */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n var array_1 = require(21) /* core/util/array */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var types_1 = require(44) /* core/util/types */;\n var hittest = require(9) /* core/hittest */;\n var PatchesView = /** @class */ (function (_super) {\n tslib_1.__extends(PatchesView, _super);\n function PatchesView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PatchesView.prototype._build_discontinuous_object = function (nanned_qs) {\n // _s is this.xs, this.ys, this.sxs, this.sys\n // an object of n 1-d arrays in either data or screen units\n //\n // Each 1-d array gets broken to an array of arrays split\n // on any NaNs\n //\n // So:\n // { 0: [x11, x12],\n // 1: [x21, x22, x23],\n // 2: [x31, NaN, x32]\n // }\n // becomes\n // { 0: [[x11, x12]],\n // 1: [[x21, x22, x23]],\n // 2: [[x31],[x32]]\n // }\n var ds = [];\n for (var i = 0, end = nanned_qs.length; i < end; i++) {\n ds[i] = [];\n var qs = array_1.copy(nanned_qs[i]);\n while (qs.length > 0) {\n var nan_index = array_1.findLastIndex(qs, function (q) { return types_1.isStrictNaN(q); });\n var qs_part = void 0;\n if (nan_index >= 0)\n qs_part = qs.splice(nan_index);\n else {\n qs_part = qs;\n qs = [];\n }\n var denanned = qs_part.filter(function (q) { return !types_1.isStrictNaN(q); });\n ds[i].push(denanned);\n }\n }\n return ds;\n };\n PatchesView.prototype._index_data = function () {\n var xss = this._build_discontinuous_object(this._xs); // XXX\n var yss = this._build_discontinuous_object(this._ys); // XXX\n var points = [];\n for (var i = 0, end = this._xs.length; i < end; i++) {\n for (var j = 0, endj = xss[i].length; j < endj; j++) {\n var xs = xss[i][j];\n var ys = yss[i][j];\n if (xs.length == 0)\n continue;\n points.push({\n minX: array_1.min(xs),\n minY: array_1.min(ys),\n maxX: array_1.max(xs),\n maxY: array_1.max(ys),\n i: i,\n });\n }\n }\n return new spatial_1.SpatialIndex(points);\n };\n PatchesView.prototype._mask_data = function () {\n var xr = this.renderer.plot_view.frame.x_ranges[\"default\"];\n var _a = [xr.min, xr.max], x0 = _a[0], x1 = _a[1];\n var yr = this.renderer.plot_view.frame.y_ranges[\"default\"];\n var _b = [yr.min, yr.max], y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var indices = this.index.indices(bbox);\n // TODO (bev) this should be under test\n return indices.sort(function (a, b) { return a - b; });\n };\n PatchesView.prototype._render = function (ctx, indices, _a) {\n var sxs = _a.sxs, sys = _a.sys;\n // this.sxss and this.syss are used by _hit_point and sxc, syc\n // This is the earliest we can build them, and only build them once\n this.sxss = this._build_discontinuous_object(sxs); // XXX\n this.syss = this._build_discontinuous_object(sys); // XXX\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n var _b = [sxs[i], sys[i]], sx = _b[0], sy = _b[1];\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n for (var j = 0, end = sx.length; j < end; j++) {\n if (j == 0) {\n ctx.beginPath();\n ctx.moveTo(sx[j], sy[j]);\n continue;\n }\n else if (isNaN(sx[j] + sy[j])) {\n ctx.closePath();\n ctx.fill();\n ctx.beginPath();\n continue;\n }\n else\n ctx.lineTo(sx[j], sy[j]);\n }\n ctx.closePath();\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n for (var j = 0, end = sx.length; j < end; j++) {\n if (j == 0) {\n ctx.beginPath();\n ctx.moveTo(sx[j], sy[j]);\n continue;\n }\n else if (isNaN(sx[j] + sy[j])) {\n ctx.closePath();\n ctx.stroke();\n ctx.beginPath();\n continue;\n }\n else\n ctx.lineTo(sx[j], sy[j]);\n }\n ctx.closePath();\n ctx.stroke();\n }\n }\n };\n PatchesView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var candidates = this.index.indices({ minX: x, minY: y, maxX: x, maxY: y });\n var hits = [];\n for (var i = 0, end = candidates.length; i < end; i++) {\n var idx = candidates[i];\n var sxs = this.sxss[idx];\n var sys = this.syss[idx];\n for (var j = 0, endj = sxs.length; j < endj; j++) {\n if (hittest.point_in_poly(sx, sy, sxs[j], sys[j])) {\n hits.push(idx);\n }\n }\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n PatchesView.prototype._get_snap_coord = function (array) {\n return arrayable_1.sum(array) / array.length;\n };\n PatchesView.prototype.scenterx = function (i, sx, sy) {\n if (this.sxss[i].length == 1) {\n // We don't have discontinuous objects so we're ok\n return this._get_snap_coord(this.sxs[i]);\n }\n else {\n // We have discontinuous objects, so we need to find which\n // one we're in, we can use point_in_poly again\n var sxs = this.sxss[i];\n var sys = this.syss[i];\n for (var j = 0, end = sxs.length; j < end; j++) {\n if (hittest.point_in_poly(sx, sy, sxs[j], sys[j]))\n return this._get_snap_coord(sxs[j]);\n }\n }\n throw new Error(\"unreachable code\");\n };\n PatchesView.prototype.scentery = function (i, sx, sy) {\n if (this.syss[i].length == 1) {\n // We don't have discontinuous objects so we're ok\n return this._get_snap_coord(this.sys[i]);\n }\n else {\n // We have discontinuous objects, so we need to find which\n // one we're in, we can use point_in_poly again\n var sxs = this.sxss[i];\n var sys = this.syss[i];\n for (var j = 0, end = sxs.length; j < end; j++) {\n if (hittest.point_in_poly(sx, sy, sxs[j], sys[j]))\n return this._get_snap_coord(sys[j]);\n }\n }\n throw new Error(\"unreachable code\");\n };\n PatchesView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n return PatchesView;\n }(glyph_1.GlyphView));\n exports.PatchesView = PatchesView;\n var Patches = /** @class */ (function (_super) {\n tslib_1.__extends(Patches, _super);\n function Patches(attrs) {\n return _super.call(this, attrs) || this;\n }\n Patches.initClass = function () {\n this.prototype.type = 'Patches';\n this.prototype.default_view = PatchesView;\n this.coords([['xs', 'ys']]);\n this.mixins(['line', 'fill']);\n };\n return Patches;\n }(glyph_1.Glyph));\n exports.Patches = Patches;\n Patches.initClass();\n}\n","/* models/glyphs/quad */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var box_1 = require(118) /* ./box */;\n var QuadView = /** @class */ (function (_super) {\n tslib_1.__extends(QuadView, _super);\n function QuadView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n QuadView.prototype.get_anchor_point = function (anchor, i, _spt) {\n var left = Math.min(this.sleft[i], this.sright[i]);\n var right = Math.max(this.sright[i], this.sleft[i]);\n var top = Math.min(this.stop[i], this.sbottom[i]); // screen coordinates !!!\n var bottom = Math.max(this.sbottom[i], this.stop[i]); //\n switch (anchor) {\n case \"top_left\": return { x: left, y: top };\n case \"top_center\": return { x: (left + right) / 2, y: top };\n case \"top_right\": return { x: right, y: top };\n case \"center_right\": return { x: right, y: (top + bottom) / 2 };\n case \"bottom_right\": return { x: right, y: bottom };\n case \"bottom_center\": return { x: (left + right) / 2, y: bottom };\n case \"bottom_left\": return { x: left, y: bottom };\n case \"center_left\": return { x: left, y: (top + bottom) / 2 };\n case \"center\": return { x: (left + right) / 2, y: (top + bottom) / 2 };\n default: return null;\n }\n };\n QuadView.prototype.scenterx = function (i) {\n return (this.sleft[i] + this.sright[i]) / 2;\n };\n QuadView.prototype.scentery = function (i) {\n return (this.stop[i] + this.sbottom[i]) / 2;\n };\n QuadView.prototype._index_data = function () {\n return this._index_box(this._right.length);\n };\n QuadView.prototype._lrtb = function (i) {\n var l = this._left[i];\n var r = this._right[i];\n var t = this._top[i];\n var b = this._bottom[i];\n return [l, r, t, b];\n };\n return QuadView;\n }(box_1.BoxView));\n exports.QuadView = QuadView;\n var Quad = /** @class */ (function (_super) {\n tslib_1.__extends(Quad, _super);\n function Quad(attrs) {\n return _super.call(this, attrs) || this;\n }\n Quad.initClass = function () {\n this.prototype.type = 'Quad';\n this.prototype.default_view = QuadView;\n this.coords([['right', 'bottom'], ['left', 'top']]);\n };\n return Quad;\n }(box_1.Box));\n exports.Quad = Quad;\n Quad.initClass();\n}\n","/* models/glyphs/quadratic */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n // Formula from: http://pomax.nihongoresources.com/pages/bezier/\n //\n // if segment is quadratic bezier do:\n // for both directions do:\n // if control between start and end, compute linear bounding box\n // otherwise, compute\n // bound = u(1-t)^2 + 2v(1-t)t + wt^2\n // (with t = ((u-v) / (u-2v+w)), with {u = start, v = control, w = end})\n // if control precedes start, min = bound, otherwise max = bound\n function _qbb(u, v, w) {\n if (v == (u + w) / 2)\n return [u, w];\n else {\n var t = (u - v) / ((u - (2 * v)) + w);\n var bd = (u * Math.pow((1 - t), 2)) + (2 * v * (1 - t) * t) + (w * Math.pow(t, 2));\n return [Math.min(u, w, bd), Math.max(u, w, bd)];\n }\n }\n var QuadraticView = /** @class */ (function (_super) {\n tslib_1.__extends(QuadraticView, _super);\n function QuadraticView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n QuadraticView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._x0.length; i < end; i++) {\n if (isNaN(this._x0[i] + this._x1[i] + this._y0[i] + this._y1[i] + this._cx[i] + this._cy[i]))\n continue;\n var _a = _qbb(this._x0[i], this._cx[i], this._x1[i]), x0 = _a[0], x1 = _a[1];\n var _b = _qbb(this._y0[i], this._cy[i], this._y1[i]), y0 = _b[0], y1 = _b[1];\n points.push({ minX: x0, minY: y0, maxX: x1, maxY: y1, i: i });\n }\n return new spatial_1.SpatialIndex(points);\n };\n QuadraticView.prototype._render = function (ctx, indices, _a) {\n var sx0 = _a.sx0, sy0 = _a.sy0, sx1 = _a.sx1, sy1 = _a.sy1, scx = _a.scx, scy = _a.scy;\n if (this.visuals.line.doit) {\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i] + scx[i] + scy[i]))\n continue;\n ctx.beginPath();\n ctx.moveTo(sx0[i], sy0[i]);\n ctx.quadraticCurveTo(scx[i], scy[i], sx1[i], sy1[i]);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n QuadraticView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n QuadraticView.prototype.scenterx = function () {\n throw new Error(\"not implemented\");\n };\n QuadraticView.prototype.scentery = function () {\n throw new Error(\"not implemented\");\n };\n return QuadraticView;\n }(glyph_1.GlyphView));\n exports.QuadraticView = QuadraticView;\n var Quadratic = /** @class */ (function (_super) {\n tslib_1.__extends(Quadratic, _super);\n function Quadratic(attrs) {\n return _super.call(this, attrs) || this;\n }\n Quadratic.initClass = function () {\n this.prototype.type = 'Quadratic';\n this.prototype.default_view = QuadraticView;\n this.coords([['x0', 'y0'], ['x1', 'y1'], ['cx', 'cy']]);\n this.mixins(['line']);\n };\n return Quadratic;\n }(glyph_1.Glyph));\n exports.Quadratic = Quadratic;\n Quadratic.initClass();\n}\n","/* models/glyphs/ray */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var p = require(15) /* core/properties */;\n var RayView = /** @class */ (function (_super) {\n tslib_1.__extends(RayView, _super);\n function RayView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RayView.prototype._map_data = function () {\n if (this.model.properties.length.units == \"data\")\n this.slength = this.sdist(this.renderer.xscale, this._x, this._length);\n else\n this.slength = this._length;\n };\n RayView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, slength = _a.slength, _angle = _a._angle;\n if (this.visuals.line.doit) {\n var width = this.renderer.plot_view.frame._width.value;\n var height = this.renderer.plot_view.frame._height.value;\n var inf_len = 2 * (width + height);\n for (var i = 0, end = slength.length; i < end; i++) {\n if (slength[i] == 0)\n slength[i] = inf_len;\n }\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + _angle[i] + slength[i]))\n continue;\n ctx.translate(sx[i], sy[i]);\n ctx.rotate(_angle[i]);\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(slength[i], 0);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n ctx.rotate(-_angle[i]);\n ctx.translate(-sx[i], -sy[i]);\n }\n }\n };\n RayView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n return RayView;\n }(xy_glyph_1.XYGlyphView));\n exports.RayView = RayView;\n var Ray = /** @class */ (function (_super) {\n tslib_1.__extends(Ray, _super);\n function Ray(attrs) {\n return _super.call(this, attrs) || this;\n }\n Ray.initClass = function () {\n this.prototype.type = 'Ray';\n this.prototype.default_view = RayView;\n this.mixins(['line']);\n this.define({\n length: [p.DistanceSpec],\n angle: [p.AngleSpec],\n });\n };\n return Ray;\n }(xy_glyph_1.XYGlyph));\n exports.Ray = Ray;\n Ray.initClass();\n}\n","/* models/glyphs/rect */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var center_rotatable_1 = require(119) /* ./center_rotatable */;\n var utils_1 = require(143) /* ./utils */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var RectView = /** @class */ (function (_super) {\n tslib_1.__extends(RectView, _super);\n function RectView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RectView.prototype._set_data = function () {\n this.max_w2 = 0;\n if (this.model.properties.width.units == \"data\")\n this.max_w2 = this.max_width / 2;\n this.max_h2 = 0;\n if (this.model.properties.height.units == \"data\")\n this.max_h2 = this.max_height / 2;\n };\n RectView.prototype._map_data = function () {\n var _a, _b;\n if (this.model.properties.width.units == \"data\")\n _a = this._map_dist_corner_for_data_side_length(this._x, this._width, this.renderer.xscale), this.sw = _a[0], this.sx0 = _a[1];\n else {\n this.sw = this._width;\n var n_1 = this.sx.length;\n this.sx0 = new Float64Array(n_1);\n for (var i = 0; i < n_1; i++)\n this.sx0[i] = this.sx[i] - this.sw[i] / 2;\n }\n if (this.model.properties.height.units == \"data\")\n _b = this._map_dist_corner_for_data_side_length(this._y, this._height, this.renderer.yscale), this.sh = _b[0], this.sy1 = _b[1];\n else {\n this.sh = this._height;\n var n_2 = this.sy.length;\n this.sy1 = new Float64Array(n_2);\n for (var i = 0; i < n_2; i++)\n this.sy1[i] = this.sy[i] - this.sh[i] / 2;\n }\n var n = this.sw.length;\n this.ssemi_diag = new Float64Array(n);\n for (var i = 0; i < n; i++)\n this.ssemi_diag[i] = Math.sqrt((this.sw[i] / 2 * this.sw[i]) / 2 + (this.sh[i] / 2 * this.sh[i]) / 2);\n };\n RectView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, sx0 = _a.sx0, sy1 = _a.sy1, sw = _a.sw, sh = _a.sh, _angle = _a._angle;\n if (this.visuals.fill.doit) {\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i]))\n continue;\n //no need to test the return value, we call fillRect for every glyph anyway\n this.visuals.fill.set_vectorize(ctx, i);\n if (_angle[i]) {\n ctx.translate(sx[i], sy[i]);\n ctx.rotate(_angle[i]);\n ctx.fillRect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]);\n ctx.rotate(-_angle[i]);\n ctx.translate(-sx[i], -sy[i]);\n }\n else\n ctx.fillRect(sx0[i], sy1[i], sw[i], sh[i]);\n }\n }\n if (this.visuals.line.doit) {\n ctx.beginPath();\n for (var _b = 0, indices_2 = indices; _b < indices_2.length; _b++) {\n var i = indices_2[_b];\n if (isNaN(sx[i] + sy[i] + sx0[i] + sy1[i] + sw[i] + sh[i] + _angle[i]))\n continue;\n // fillRect does not fill zero-height or -width rects, but rect(...)\n // does seem to stroke them (1px wide or tall). Explicitly ignore rects\n // with zero width or height to be consistent\n if (sw[i] == 0 || sh[i] == 0)\n continue;\n if (_angle[i]) {\n ctx.translate(sx[i], sy[i]);\n ctx.rotate(_angle[i]);\n ctx.rect(-sw[i] / 2, -sh[i] / 2, sw[i], sh[i]);\n ctx.rotate(-_angle[i]);\n ctx.translate(-sx[i], -sy[i]);\n }\n else\n ctx.rect(sx0[i], sy1[i], sw[i], sh[i]);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n ctx.beginPath();\n }\n ctx.stroke();\n }\n };\n RectView.prototype._hit_rect = function (geometry) {\n return this._hit_rect_against_index(geometry);\n };\n RectView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n var scenter_x = [];\n for (var i = 0, end = this.sx0.length; i < end; i++) {\n scenter_x.push(this.sx0[i] + this.sw[i] / 2);\n }\n var scenter_y = [];\n for (var i = 0, end = this.sy1.length; i < end; i++) {\n scenter_y.push(this.sy1[i] + this.sh[i] / 2);\n }\n var max_x2_ddist = arrayable_1.max(this._ddist(0, scenter_x, this.ssemi_diag));\n var max_y2_ddist = arrayable_1.max(this._ddist(1, scenter_y, this.ssemi_diag));\n var x0 = x - max_x2_ddist;\n var x1 = x + max_x2_ddist;\n var y0 = y - max_y2_ddist;\n var y1 = y + max_y2_ddist;\n var hits = [];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n for (var _i = 0, _a = this.index.indices(bbox); _i < _a.length; _i++) {\n var i = _a[_i];\n var height_in = void 0, width_in = void 0;\n if (this._angle[i]) {\n var s = Math.sin(-this._angle[i]);\n var c = Math.cos(-this._angle[i]);\n var px = c * (sx - this.sx[i]) - s * (sy - this.sy[i]) + this.sx[i];\n var py = s * (sx - this.sx[i]) + c * (sy - this.sy[i]) + this.sy[i];\n sx = px;\n sy = py;\n width_in = Math.abs(this.sx[i] - sx) <= this.sw[i] / 2;\n height_in = Math.abs(this.sy[i] - sy) <= this.sh[i] / 2;\n }\n else {\n width_in = (sx - this.sx0[i] <= this.sw[i]) && (sx - this.sx0[i] >= 0);\n height_in = (sy - this.sy1[i] <= this.sh[i]) && (sy - this.sy1[i] >= 0);\n }\n if (height_in && width_in)\n hits.push(i);\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n RectView.prototype._map_dist_corner_for_data_side_length = function (coord, side_length, scale) {\n var n = coord.length;\n var pt0 = new Float64Array(n);\n var pt1 = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n pt0[i] = Number(coord[i]) - side_length[i] / 2;\n pt1[i] = Number(coord[i]) + side_length[i] / 2;\n }\n var spt0 = scale.v_compute(pt0);\n var spt1 = scale.v_compute(pt1);\n var sside_length = this.sdist(scale, pt0, side_length, 'edge', this.model.dilate);\n var spt_corner = spt0;\n for (var i = 0, end = spt0.length; i < end; i++) {\n if (spt0[i] != spt1[i]) {\n spt_corner = spt0[i] < spt1[i] ? spt0 : spt1;\n break;\n }\n }\n return [sside_length, spt_corner];\n };\n RectView.prototype._ddist = function (dim, spts, spans) {\n var scale = dim == 0 ? this.renderer.xscale : this.renderer.yscale;\n var spt0 = spts;\n var m = spt0.length;\n var spt1 = new Float64Array(m);\n for (var i = 0; i < m; i++)\n spt1[i] = spt0[i] + spans[i];\n var pt0 = scale.v_invert(spt0);\n var pt1 = scale.v_invert(spt1);\n var n = pt0.length;\n var ddist = new Float64Array(n);\n for (var i = 0; i < n; i++)\n ddist[i] = Math.abs(pt1[i] - pt0[i]);\n return ddist;\n };\n RectView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n RectView.prototype._bounds = function (_a) {\n var minX = _a.minX, maxX = _a.maxX, minY = _a.minY, maxY = _a.maxY;\n return {\n minX: minX - this.max_w2,\n maxX: maxX + this.max_w2,\n minY: minY - this.max_h2,\n maxY: maxY + this.max_h2,\n };\n };\n return RectView;\n }(center_rotatable_1.CenterRotatableView));\n exports.RectView = RectView;\n var Rect = /** @class */ (function (_super) {\n tslib_1.__extends(Rect, _super);\n function Rect(attrs) {\n return _super.call(this, attrs) || this;\n }\n Rect.initClass = function () {\n this.prototype.type = 'Rect';\n this.prototype.default_view = RectView;\n this.define({\n dilate: [p.Bool, false],\n });\n };\n return Rect;\n }(center_rotatable_1.CenterRotatable));\n exports.Rect = Rect;\n Rect.initClass();\n}\n","/* models/glyphs/segment */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var hittest = require(9) /* core/hittest */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var utils_1 = require(143) /* ./utils */;\n var SegmentView = /** @class */ (function (_super) {\n tslib_1.__extends(SegmentView, _super);\n function SegmentView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SegmentView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._x0.length; i < end; i++) {\n var x0 = this._x0[i];\n var x1 = this._x1[i];\n var y0 = this._y0[i];\n var y1 = this._y1[i];\n if (!isNaN(x0 + x1 + y0 + y1)) {\n points.push({\n minX: Math.min(x0, x1),\n minY: Math.min(y0, y1),\n maxX: Math.max(x0, x1),\n maxY: Math.max(y0, y1),\n i: i,\n });\n }\n }\n return new spatial_1.SpatialIndex(points);\n };\n SegmentView.prototype._render = function (ctx, indices, _a) {\n var sx0 = _a.sx0, sy0 = _a.sy0, sx1 = _a.sx1, sy1 = _a.sy1;\n if (this.visuals.line.doit) {\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx0[i] + sy0[i] + sx1[i] + sy1[i]))\n continue;\n ctx.beginPath();\n ctx.moveTo(sx0[i], sy0[i]);\n ctx.lineTo(sx1[i], sy1[i]);\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n SegmentView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var point = { x: sx, y: sy };\n var hits = [];\n var lw_voffset = 2; // FIXME: Use maximum of segments line_width/2 instead of magic constant 2\n var _a = this.renderer.xscale.r_invert(sx - lw_voffset, sx + lw_voffset), minX = _a[0], maxX = _a[1];\n var _b = this.renderer.yscale.r_invert(sy - lw_voffset, sy + lw_voffset), minY = _b[0], maxY = _b[1];\n var candidates = this.index.indices({ minX: minX, minY: minY, maxX: maxX, maxY: maxY });\n for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n var i = candidates_1[_i];\n var threshold2 = Math.pow(Math.max(2, this.visuals.line.cache_select('line_width', i) / 2), 2);\n var p0 = { x: this.sx0[i], y: this.sy0[i] };\n var p1 = { x: this.sx1[i], y: this.sy1[i] };\n var dist2 = hittest.dist_to_segment_squared(point, p0, p1);\n if (dist2 < threshold2)\n hits.push(i);\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n SegmentView.prototype._hit_span = function (geometry) {\n var _a, _b;\n var _c = this.renderer.plot_view.frame.bbox.ranges, hr = _c[0], vr = _c[1];\n var sx = geometry.sx, sy = geometry.sy;\n var v0;\n var v1;\n var val;\n if (geometry.direction == 'v') {\n val = this.renderer.yscale.invert(sy);\n _a = [this._y0, this._y1], v0 = _a[0], v1 = _a[1];\n }\n else {\n val = this.renderer.xscale.invert(sx);\n _b = [this._x0, this._x1], v0 = _b[0], v1 = _b[1];\n }\n var hits = [];\n var _d = this.renderer.xscale.r_invert(hr.start, hr.end), minX = _d[0], maxX = _d[1];\n var _e = this.renderer.yscale.r_invert(vr.start, vr.end), minY = _e[0], maxY = _e[1];\n var candidates = this.index.indices({ minX: minX, minY: minY, maxX: maxX, maxY: maxY });\n for (var _i = 0, candidates_2 = candidates; _i < candidates_2.length; _i++) {\n var i = candidates_2[_i];\n if ((v0[i] <= val && val <= v1[i]) || (v1[i] <= val && val <= v0[i]))\n hits.push(i);\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n SegmentView.prototype.scenterx = function (i) {\n return (this.sx0[i] + this.sx1[i]) / 2;\n };\n SegmentView.prototype.scentery = function (i) {\n return (this.sy0[i] + this.sy1[i]) / 2;\n };\n SegmentView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n return SegmentView;\n }(glyph_1.GlyphView));\n exports.SegmentView = SegmentView;\n var Segment = /** @class */ (function (_super) {\n tslib_1.__extends(Segment, _super);\n function Segment(attrs) {\n return _super.call(this, attrs) || this;\n }\n Segment.initClass = function () {\n this.prototype.type = 'Segment';\n this.prototype.default_view = SegmentView;\n this.coords([['x0', 'y0'], ['x1', 'y1']]);\n this.mixins(['line']);\n };\n return Segment;\n }(glyph_1.Glyph));\n exports.Segment = Segment;\n Segment.initClass();\n}\n","/* models/glyphs/step */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var p = require(15) /* core/properties */;\n var StepView = /** @class */ (function (_super) {\n tslib_1.__extends(StepView, _super);\n function StepView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n StepView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy;\n var _b, _c, _d, _e, _f, _g;\n var drawing = false;\n var last_index = null;\n this.visuals.line.set_value(ctx);\n var L = indices.length;\n if (L < 2)\n return;\n ctx.beginPath();\n ctx.moveTo(sx[0], sy[0]);\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n var x1 = void 0, x2 = void 0;\n var y1 = void 0, y2 = void 0;\n switch (this.model.mode) {\n case \"before\": {\n ;\n _b = [sx[i - 1], sy[i]], x1 = _b[0], y1 = _b[1];\n _c = [sx[i], sy[i]], x2 = _c[0], y2 = _c[1];\n break;\n }\n case \"after\": {\n ;\n _d = [sx[i], sy[i - 1]], x1 = _d[0], y1 = _d[1];\n _e = [sx[i], sy[i]], x2 = _e[0], y2 = _e[1];\n break;\n }\n case \"center\": {\n var xm = (sx[i - 1] + sx[i]) / 2;\n _f = [xm, sy[i - 1]], x1 = _f[0], y1 = _f[1];\n _g = [xm, sy[i]], x2 = _g[0], y2 = _g[1];\n break;\n }\n default:\n throw new Error(\"unexpected\");\n }\n if (drawing) {\n if (!isFinite(sx[i] + sy[i])) {\n ctx.stroke();\n ctx.beginPath();\n drawing = false;\n last_index = i;\n continue;\n }\n if (last_index != null && i - last_index > 1) {\n ctx.stroke();\n drawing = false;\n }\n }\n if (drawing) {\n ctx.lineTo(x1, y1);\n ctx.lineTo(x2, y2);\n }\n else {\n ctx.beginPath();\n ctx.moveTo(sx[i], sy[i]);\n drawing = true;\n }\n last_index = i;\n }\n ctx.lineTo(sx[L - 1], sy[L - 1]);\n ctx.stroke();\n };\n StepView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_line_legend(this.visuals, ctx, bbox, index);\n };\n return StepView;\n }(xy_glyph_1.XYGlyphView));\n exports.StepView = StepView;\n var Step = /** @class */ (function (_super) {\n tslib_1.__extends(Step, _super);\n function Step(attrs) {\n return _super.call(this, attrs) || this;\n }\n Step.initClass = function () {\n this.prototype.type = 'Step';\n this.prototype.default_view = StepView;\n this.mixins(['line']);\n this.define({\n mode: [p.StepMode, \"before\"],\n });\n };\n return Step;\n }(xy_glyph_1.XYGlyph));\n exports.Step = Step;\n Step.initClass();\n}\n","/* models/glyphs/text */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var text_1 = require(41) /* core/util/text */;\n var TextView = /** @class */ (function (_super) {\n tslib_1.__extends(TextView, _super);\n function TextView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TextView.prototype._rotate_point = function (x, y, xoff, yoff, angle) {\n var sxr = (x - xoff) * Math.cos(angle) - (y - yoff) * Math.sin(angle) + xoff;\n var syr = (x - xoff) * Math.sin(angle) + (y - yoff) * Math.cos(angle) + yoff;\n return [sxr, syr];\n };\n TextView.prototype._text_bounds = function (x0, y0, width, height) {\n var xvals = [x0, x0 + width, x0 + width, x0, x0];\n var yvals = [y0, y0, y0 - height, y0 - height, y0];\n return [xvals, yvals];\n };\n TextView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, _x_offset = _a._x_offset, _y_offset = _a._y_offset, _angle = _a._angle, _text = _a._text;\n this._sys = [];\n this._sxs = [];\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + _x_offset[i] + _y_offset[i] + _angle[i]) || _text[i] == null)\n continue;\n this._sxs[i] = [];\n this._sys[i] = [];\n if (this.visuals.text.doit) {\n var text = \"\" + _text[i];\n ctx.save();\n ctx.translate(sx[i] + _x_offset[i], sy[i] + _y_offset[i]);\n ctx.rotate(_angle[i]);\n this.visuals.text.set_vectorize(ctx, i);\n var font = this.visuals.text.cache_select(\"font\", i);\n var height = text_1.get_text_height(font).height;\n var line_height = this.visuals.text.text_line_height.value() * height;\n if (text.indexOf(\"\\n\") == -1) {\n ctx.fillText(text, 0, 0);\n var x0 = sx[i] + _x_offset[i];\n var y0 = sy[i] + _y_offset[i];\n var width = ctx.measureText(text).width;\n var _b = this._text_bounds(x0, y0, width, line_height), xvalues = _b[0], yvalues = _b[1];\n this._sxs[i].push(xvalues);\n this._sys[i].push(yvalues);\n }\n else {\n var lines = text.split(\"\\n\");\n var block_height = line_height * lines.length;\n var baseline = this.visuals.text.cache_select(\"text_baseline\", i);\n var y = void 0;\n switch (baseline) {\n case \"top\": {\n y = 0;\n break;\n }\n case \"middle\": {\n y = (-block_height / 2) + (line_height / 2);\n break;\n }\n case \"bottom\": {\n y = -block_height + line_height;\n break;\n }\n default: {\n y = 0;\n console.warn(\"'\" + baseline + \"' baseline not supported with multi line text\");\n }\n }\n for (var _c = 0, lines_1 = lines; _c < lines_1.length; _c++) {\n var line = lines_1[_c];\n ctx.fillText(line, 0, y);\n var x0 = sx[i] + _x_offset[i];\n var y0 = y + sy[i] + _y_offset[i];\n var width = ctx.measureText(line).width;\n var _d = this._text_bounds(x0, y0, width, line_height), xvalues = _d[0], yvalues = _d[1];\n this._sxs[i].push(xvalues);\n this._sys[i].push(yvalues);\n y += line_height;\n }\n }\n ctx.restore();\n }\n }\n };\n TextView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var hits = [];\n for (var i = 0; i < this._sxs.length; i++) {\n var sxs = this._sxs[i];\n var sys = this._sys[i];\n var n = sxs.length;\n for (var j = 0, endj = n; j < endj; j++) {\n var _a = this._rotate_point(sx, sy, sxs[n - 1][0], sys[n - 1][0], -this._angle[i]), sxr = _a[0], syr = _a[1];\n if (hittest.point_in_poly(sxr, syr, sxs[j], sys[j])) {\n hits.push(i);\n }\n }\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n TextView.prototype._scenterxy = function (i) {\n var sx0 = this._sxs[i][0][0];\n var sy0 = this._sys[i][0][0];\n var sxc = (this._sxs[i][0][2] + sx0) / 2;\n var syc = (this._sys[i][0][2] + sy0) / 2;\n var _a = this._rotate_point(sxc, syc, sx0, sy0, this._angle[i]), sxcr = _a[0], sycr = _a[1];\n return { x: sxcr, y: sycr };\n };\n TextView.prototype.scenterx = function (i) {\n return this._scenterxy(i).x;\n };\n TextView.prototype.scentery = function (i) {\n return this._scenterxy(i).y;\n };\n return TextView;\n }(xy_glyph_1.XYGlyphView));\n exports.TextView = TextView;\n var Text = /** @class */ (function (_super) {\n tslib_1.__extends(Text, _super);\n function Text(attrs) {\n return _super.call(this, attrs) || this;\n }\n Text.initClass = function () {\n this.prototype.type = 'Text';\n this.prototype.default_view = TextView;\n this.mixins(['text']);\n this.define({\n text: [p.StringSpec, { field: \"text\" }],\n angle: [p.AngleSpec, 0],\n x_offset: [p.NumberSpec, 0],\n y_offset: [p.NumberSpec, 0],\n });\n };\n return Text;\n }(xy_glyph_1.XYGlyph));\n exports.Text = Text;\n Text.initClass();\n}\n","/* models/glyphs/utils */ function _(require, module, exports) {\n var hittest = require(9) /* core/hittest */;\n function generic_line_legend(visuals, ctx, _a, index) {\n var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1;\n ctx.save();\n ctx.beginPath();\n ctx.moveTo(x0, (y0 + y1) / 2);\n ctx.lineTo(x1, (y0 + y1) / 2);\n if (visuals.line.doit) {\n visuals.line.set_vectorize(ctx, index);\n ctx.stroke();\n }\n ctx.restore();\n }\n exports.generic_line_legend = generic_line_legend;\n function generic_area_legend(visuals, ctx, _a, index) {\n var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1;\n var w = Math.abs(x1 - x0);\n var dw = w * 0.1;\n var h = Math.abs(y1 - y0);\n var dh = h * 0.1;\n var sx0 = x0 + dw;\n var sx1 = x1 - dw;\n var sy0 = y0 + dh;\n var sy1 = y1 - dh;\n if (visuals.fill.doit) {\n visuals.fill.set_vectorize(ctx, index);\n ctx.fillRect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n }\n if (visuals.line.doit) {\n ctx.beginPath();\n ctx.rect(sx0, sy0, sx1 - sx0, sy1 - sy0);\n visuals.line.set_vectorize(ctx, index);\n ctx.stroke();\n }\n }\n exports.generic_area_legend = generic_area_legend;\n function line_interpolation(renderer, geometry, x2, y2, x3, y3) {\n var _a, _b, _c, _d, _e, _f;\n var sx = geometry.sx, sy = geometry.sy;\n var x0, x1;\n var y0, y1;\n if (geometry.type == 'point') {\n // The +/- adjustments here are to dilate the hit point into a virtual \"segment\" to use below\n ;\n _a = renderer.yscale.r_invert(sy - 1, sy + 1), y0 = _a[0], y1 = _a[1];\n _b = renderer.xscale.r_invert(sx - 1, sx + 1), x0 = _b[0], x1 = _b[1];\n }\n else {\n // The +/- adjustments here are to handle cases such as purely horizontal or vertical lines\n if (geometry.direction == 'v') {\n ;\n _c = renderer.yscale.r_invert(sy, sy), y0 = _c[0], y1 = _c[1];\n _d = [Math.min(x2 - 1, x3 - 1), Math.max(x2 + 1, x3 + 1)], x0 = _d[0], x1 = _d[1];\n }\n else {\n ;\n _e = renderer.xscale.r_invert(sx, sx), x0 = _e[0], x1 = _e[1];\n _f = [Math.min(y2 - 1, y3 - 1), Math.max(y2 + 1, y3 + 1)], y0 = _f[0], y1 = _f[1];\n }\n }\n var _g = hittest.check_2_segments_intersect(x0, y0, x1, y1, x2, y2, x3, y3), x = _g.x, y = _g.y;\n return [x, y]; // XXX: null is not handled at use sites\n }\n exports.line_interpolation = line_interpolation;\n}\n","/* models/glyphs/vbar */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var box_1 = require(118) /* ./box */;\n var p = require(15) /* core/properties */;\n var VBarView = /** @class */ (function (_super) {\n tslib_1.__extends(VBarView, _super);\n function VBarView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n VBarView.prototype.scenterx = function (i) {\n return this.sx[i];\n };\n VBarView.prototype.scentery = function (i) {\n return (this.stop[i] + this.sbottom[i]) / 2;\n };\n VBarView.prototype._index_data = function () {\n return this._index_box(this._x.length);\n };\n VBarView.prototype._lrtb = function (i) {\n var l = this._x[i] - (this._width[i] / 2);\n var r = this._x[i] + (this._width[i] / 2);\n var t = Math.max(this._top[i], this._bottom[i]);\n var b = Math.min(this._top[i], this._bottom[i]);\n return [l, r, t, b];\n };\n VBarView.prototype._map_data = function () {\n this.sx = this.renderer.xscale.v_compute(this._x);\n this.sw = this.sdist(this.renderer.xscale, this._x, this._width, \"center\");\n this.stop = this.renderer.yscale.v_compute(this._top);\n this.sbottom = this.renderer.yscale.v_compute(this._bottom);\n var n = this.sx.length;\n this.sleft = new Float64Array(n);\n this.sright = new Float64Array(n);\n for (var i = 0; i < n; i++) {\n this.sleft[i] = this.sx[i] - this.sw[i] / 2;\n this.sright[i] = this.sx[i] + this.sw[i] / 2;\n }\n this._clamp_viewport();\n };\n return VBarView;\n }(box_1.BoxView));\n exports.VBarView = VBarView;\n var VBar = /** @class */ (function (_super) {\n tslib_1.__extends(VBar, _super);\n function VBar(attrs) {\n return _super.call(this, attrs) || this;\n }\n VBar.initClass = function () {\n this.prototype.type = 'VBar';\n this.prototype.default_view = VBarView;\n this.coords([['x', 'bottom']]);\n this.define({\n width: [p.DistanceSpec],\n top: [p.NumberSpec],\n });\n this.override({\n bottom: 0,\n });\n };\n return VBar;\n }(box_1.Box));\n exports.VBar = VBar;\n VBar.initClass();\n}\n","/* models/glyphs/wedge */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ./xy_glyph */;\n var utils_1 = require(143) /* ./utils */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var math_1 = require(31) /* core/util/math */;\n var WedgeView = /** @class */ (function (_super) {\n tslib_1.__extends(WedgeView, _super);\n function WedgeView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WedgeView.prototype._map_data = function () {\n if (this.model.properties.radius.units == \"data\")\n this.sradius = this.sdist(this.renderer.xscale, this._x, this._radius);\n else\n this.sradius = this._radius;\n };\n WedgeView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, sradius = _a.sradius, _start_angle = _a._start_angle, _end_angle = _a._end_angle;\n var direction = this.model.properties.direction.value();\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + sradius[i] + _start_angle[i] + _end_angle[i]))\n continue;\n ctx.beginPath();\n ctx.arc(sx[i], sy[i], sradius[i], _start_angle[i], _end_angle[i], direction);\n ctx.lineTo(sx[i], sy[i]);\n ctx.closePath();\n if (this.visuals.fill.doit) {\n this.visuals.fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (this.visuals.line.doit) {\n this.visuals.line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n };\n WedgeView.prototype._hit_point = function (geometry) {\n var _a, _b, _c, _d;\n var dist, sx0, sx1, sy0, sy1, x0, x1, y0, y1;\n var sx = geometry.sx, sy = geometry.sy;\n var x = this.renderer.xscale.invert(sx);\n var y = this.renderer.yscale.invert(sy);\n // check diameter first\n var max_diameter = 2 * this.max_radius;\n if (this.model.properties.radius.units === \"data\") {\n x0 = x - max_diameter;\n x1 = x + max_diameter;\n y0 = y - max_diameter;\n y1 = y + max_diameter;\n }\n else {\n sx0 = sx - max_diameter;\n sx1 = sx + max_diameter;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n sy0 = sy - max_diameter;\n sy1 = sy + max_diameter;\n _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n }\n var candidates = [];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n for (var _i = 0, _e = this.index.indices(bbox); _i < _e.length; _i++) {\n var i = _e[_i];\n var r2 = Math.pow(this.sradius[i], 2);\n _c = this.renderer.xscale.r_compute(x, this._x[i]), sx0 = _c[0], sx1 = _c[1];\n _d = this.renderer.yscale.r_compute(y, this._y[i]), sy0 = _d[0], sy1 = _d[1];\n dist = Math.pow(sx0 - sx1, 2) + Math.pow(sy0 - sy1, 2);\n if (dist <= r2) {\n candidates.push([i, dist]);\n }\n }\n var direction = this.model.properties.direction.value();\n var hits = [];\n for (var _f = 0, candidates_1 = candidates; _f < candidates_1.length; _f++) {\n var _g = candidates_1[_f], i = _g[0], dist_1 = _g[1];\n // NOTE: minus the angle because JS uses non-mathy convention for angles\n var angle = Math.atan2(sy - this.sy[i], sx - this.sx[i]);\n if (math_1.angle_between(-angle, -this._start_angle[i], -this._end_angle[i], direction)) {\n hits.push([i, dist_1]);\n }\n }\n return hittest.create_hit_test_result_from_hits(hits);\n };\n WedgeView.prototype.draw_legend_for_index = function (ctx, bbox, index) {\n utils_1.generic_area_legend(this.visuals, ctx, bbox, index);\n };\n WedgeView.prototype._scenterxy = function (i) {\n var r = this.sradius[i] / 2;\n var a = (this._start_angle[i] + this._end_angle[i]) / 2;\n return { x: this.sx[i] + (r * Math.cos(a)), y: this.sy[i] + (r * Math.sin(a)) };\n };\n WedgeView.prototype.scenterx = function (i) {\n return this._scenterxy(i).x;\n };\n WedgeView.prototype.scentery = function (i) {\n return this._scenterxy(i).y;\n };\n return WedgeView;\n }(xy_glyph_1.XYGlyphView));\n exports.WedgeView = WedgeView;\n var Wedge = /** @class */ (function (_super) {\n tslib_1.__extends(Wedge, _super);\n function Wedge(attrs) {\n return _super.call(this, attrs) || this;\n }\n Wedge.initClass = function () {\n this.prototype.type = 'Wedge';\n this.prototype.default_view = WedgeView;\n this.mixins(['line', 'fill']);\n this.define({\n direction: [p.Direction, 'anticlock'],\n radius: [p.DistanceSpec],\n start_angle: [p.AngleSpec],\n end_angle: [p.AngleSpec],\n });\n };\n return Wedge;\n }(xy_glyph_1.XYGlyph));\n exports.Wedge = Wedge;\n Wedge.initClass();\n}\n","/* models/glyphs/xy_glyph */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var spatial_1 = require(37) /* core/util/spatial */;\n var glyph_1 = require(123) /* ./glyph */;\n var XYGlyphView = /** @class */ (function (_super) {\n tslib_1.__extends(XYGlyphView, _super);\n function XYGlyphView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n XYGlyphView.prototype._index_data = function () {\n var points = [];\n for (var i = 0, end = this._x.length; i < end; i++) {\n var x = this._x[i];\n var y = this._y[i];\n if (isNaN(x + y) || !isFinite(x + y))\n continue;\n points.push({ minX: x, minY: y, maxX: x, maxY: y, i: i });\n }\n return new spatial_1.SpatialIndex(points);\n };\n XYGlyphView.prototype.scenterx = function (i) {\n return this.sx[i];\n };\n XYGlyphView.prototype.scentery = function (i) {\n return this.sy[i];\n };\n return XYGlyphView;\n }(glyph_1.GlyphView));\n exports.XYGlyphView = XYGlyphView;\n var XYGlyph = /** @class */ (function (_super) {\n tslib_1.__extends(XYGlyph, _super);\n function XYGlyph(attrs) {\n return _super.call(this, attrs) || this;\n }\n XYGlyph.initClass = function () {\n this.prototype.type = \"XYGlyph\";\n this.coords([['x', 'y']]);\n };\n return XYGlyph;\n }(glyph_1.Glyph));\n exports.XYGlyph = XYGlyph;\n XYGlyph.initClass();\n}\n","/* models/graphs/graph_hit_test_policy */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var array_1 = require(21) /* core/util/array */;\n var hittest_1 = require(9) /* core/hittest */;\n var GraphHitTestPolicy = /** @class */ (function (_super) {\n tslib_1.__extends(GraphHitTestPolicy, _super);\n function GraphHitTestPolicy(attrs) {\n return _super.call(this, attrs) || this;\n }\n GraphHitTestPolicy.initClass = function () {\n this.prototype.type = \"GraphHitTestPolicy\";\n };\n GraphHitTestPolicy.prototype._hit_test_nodes = function (geometry, graph_view) {\n if (!graph_view.model.visible)\n return null;\n var hit_test_result = graph_view.node_view.glyph.hit_test(geometry);\n if (hit_test_result == null)\n return null;\n else\n return graph_view.node_view.model.view.convert_selection_from_subset(hit_test_result);\n };\n GraphHitTestPolicy.prototype._hit_test_edges = function (geometry, graph_view) {\n if (!graph_view.model.visible)\n return null;\n var hit_test_result = graph_view.edge_view.glyph.hit_test(geometry);\n if (hit_test_result == null)\n return null;\n else\n return graph_view.edge_view.model.view.convert_selection_from_subset(hit_test_result);\n };\n return GraphHitTestPolicy;\n }(model_1.Model));\n exports.GraphHitTestPolicy = GraphHitTestPolicy;\n var NodesOnly = /** @class */ (function (_super) {\n tslib_1.__extends(NodesOnly, _super);\n function NodesOnly(attrs) {\n return _super.call(this, attrs) || this;\n }\n NodesOnly.initClass = function () {\n this.prototype.type = 'NodesOnly';\n };\n NodesOnly.prototype.hit_test = function (geometry, graph_view) {\n return this._hit_test_nodes(geometry, graph_view);\n };\n NodesOnly.prototype.do_selection = function (hit_test_result, graph, final, append) {\n if (hit_test_result == null)\n return false;\n var node_selection = graph.node_renderer.data_source.selected;\n node_selection.update(hit_test_result, final, append);\n graph.node_renderer.data_source._select.emit();\n return !node_selection.is_empty();\n };\n NodesOnly.prototype.do_inspection = function (hit_test_result, geometry, graph_view, final, append) {\n if (hit_test_result == null)\n return false;\n var node_inspection = graph_view.model.get_selection_manager().get_or_create_inspector(graph_view.node_view.model);\n node_inspection.update(hit_test_result, final, append);\n // silently set inspected attr to avoid triggering data_source.change event and rerender\n graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry: geometry }]);\n return !node_inspection.is_empty();\n };\n return NodesOnly;\n }(GraphHitTestPolicy));\n exports.NodesOnly = NodesOnly;\n NodesOnly.initClass();\n var NodesAndLinkedEdges = /** @class */ (function (_super) {\n tslib_1.__extends(NodesAndLinkedEdges, _super);\n function NodesAndLinkedEdges(attrs) {\n return _super.call(this, attrs) || this;\n }\n NodesAndLinkedEdges.initClass = function () {\n this.prototype.type = 'NodesAndLinkedEdges';\n };\n NodesAndLinkedEdges.prototype.hit_test = function (geometry, graph_view) {\n return this._hit_test_nodes(geometry, graph_view);\n };\n NodesAndLinkedEdges.prototype.get_linked_edges = function (node_source, edge_source, mode) {\n var node_indices = [];\n if (mode == 'selection') {\n node_indices = node_source.selected.indices.map(function (i) { return node_source.data.index[i]; });\n }\n else if (mode == 'inspection') {\n node_indices = node_source.inspected.indices.map(function (i) { return node_source.data.index[i]; });\n }\n var edge_indices = [];\n for (var i = 0; i < edge_source.data.start.length; i++) {\n if (array_1.contains(node_indices, edge_source.data.start[i]) || array_1.contains(node_indices, edge_source.data.end[i]))\n edge_indices.push(i);\n }\n var linked_edges = hittest_1.create_empty_hit_test_result();\n for (var _i = 0, edge_indices_1 = edge_indices; _i < edge_indices_1.length; _i++) {\n var i = edge_indices_1[_i];\n linked_edges.multiline_indices[i] = [0]; //currently only supports 2-element multilines, so this is all of it\n }\n linked_edges.indices = edge_indices;\n return linked_edges;\n };\n NodesAndLinkedEdges.prototype.do_selection = function (hit_test_result, graph, final, append) {\n if (hit_test_result == null)\n return false;\n var node_selection = graph.node_renderer.data_source.selected;\n node_selection.update(hit_test_result, final, append);\n var edge_selection = graph.edge_renderer.data_source.selected;\n var linked_edges_selection = this.get_linked_edges(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection');\n edge_selection.update(linked_edges_selection, final, append);\n graph.node_renderer.data_source._select.emit();\n return !node_selection.is_empty();\n };\n NodesAndLinkedEdges.prototype.do_inspection = function (hit_test_result, geometry, graph_view, final, append) {\n if (hit_test_result == null)\n return false;\n var node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model);\n node_inspection.update(hit_test_result, final, append);\n graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n var edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model);\n var linked_edges = this.get_linked_edges(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection');\n edge_inspection.update(linked_edges, final, append);\n //silently set inspected attr to avoid triggering data_source.change event and rerender\n graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true });\n graph_view.node_view.model.data_source.inspect.emit([graph_view.node_view, { geometry: geometry }]);\n return !node_inspection.is_empty();\n };\n return NodesAndLinkedEdges;\n }(GraphHitTestPolicy));\n exports.NodesAndLinkedEdges = NodesAndLinkedEdges;\n NodesAndLinkedEdges.initClass();\n var EdgesAndLinkedNodes = /** @class */ (function (_super) {\n tslib_1.__extends(EdgesAndLinkedNodes, _super);\n function EdgesAndLinkedNodes(attrs) {\n return _super.call(this, attrs) || this;\n }\n EdgesAndLinkedNodes.initClass = function () {\n this.prototype.type = 'EdgesAndLinkedNodes';\n };\n EdgesAndLinkedNodes.prototype.hit_test = function (geometry, graph_view) {\n return this._hit_test_edges(geometry, graph_view);\n };\n EdgesAndLinkedNodes.prototype.get_linked_nodes = function (node_source, edge_source, mode) {\n var edge_indices = [];\n if (mode == 'selection')\n edge_indices = edge_source.selected.indices;\n else if (mode == 'inspection')\n edge_indices = edge_source.inspected.indices;\n var nodes = [];\n for (var _i = 0, edge_indices_2 = edge_indices; _i < edge_indices_2.length; _i++) {\n var i = edge_indices_2[_i];\n nodes.push(edge_source.data.start[i]);\n nodes.push(edge_source.data.end[i]);\n }\n var node_indices = array_1.uniq(nodes).map(function (i) { return arrayable_1.indexOf(node_source.data.index, i); });\n var linked_nodes = hittest_1.create_empty_hit_test_result();\n linked_nodes.indices = node_indices;\n return linked_nodes;\n };\n EdgesAndLinkedNodes.prototype.do_selection = function (hit_test_result, graph, final, append) {\n if (hit_test_result == null)\n return false;\n var edge_selection = graph.edge_renderer.data_source.selected;\n edge_selection.update(hit_test_result, final, append);\n var node_selection = graph.node_renderer.data_source.selected;\n var linked_nodes = this.get_linked_nodes(graph.node_renderer.data_source, graph.edge_renderer.data_source, 'selection');\n node_selection.update(linked_nodes, final, append);\n graph.edge_renderer.data_source._select.emit();\n return !edge_selection.is_empty();\n };\n EdgesAndLinkedNodes.prototype.do_inspection = function (hit_test_result, geometry, graph_view, final, append) {\n if (hit_test_result == null)\n return false;\n var edge_inspection = graph_view.edge_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.edge_view.model);\n edge_inspection.update(hit_test_result, final, append);\n graph_view.edge_view.model.data_source.setv({ inspected: edge_inspection }, { silent: true });\n var node_inspection = graph_view.node_view.model.data_source.selection_manager.get_or_create_inspector(graph_view.node_view.model);\n var linked_nodes = this.get_linked_nodes(graph_view.node_view.model.data_source, graph_view.edge_view.model.data_source, 'inspection');\n node_inspection.update(linked_nodes, final, append);\n // silently set inspected attr to avoid triggering data_source.change event and rerender\n graph_view.node_view.model.data_source.setv({ inspected: node_inspection }, { silent: true });\n graph_view.edge_view.model.data_source.inspect.emit([graph_view.edge_view, { geometry: geometry }]);\n return !edge_inspection.is_empty();\n };\n return EdgesAndLinkedNodes;\n }(GraphHitTestPolicy));\n exports.EdgesAndLinkedNodes = EdgesAndLinkedNodes;\n EdgesAndLinkedNodes.initClass();\n}\n","/* models/graphs/index */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n tslib_1.__exportStar(require(147) /* ./graph_hit_test_policy */, exports);\n tslib_1.__exportStar(require(149) /* ./layout_provider */, exports);\n tslib_1.__exportStar(require(150) /* ./static_layout_provider */, exports);\n}\n","/* models/graphs/layout_provider */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var LayoutProvider = /** @class */ (function (_super) {\n tslib_1.__extends(LayoutProvider, _super);\n function LayoutProvider(attrs) {\n return _super.call(this, attrs) || this;\n }\n LayoutProvider.initClass = function () {\n this.prototype.type = \"LayoutProvider\";\n };\n return LayoutProvider;\n }(model_1.Model));\n exports.LayoutProvider = LayoutProvider;\n LayoutProvider.initClass();\n}\n","/* models/graphs/static_layout_provider */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var layout_provider_1 = require(149) /* ./layout_provider */;\n var p = require(15) /* ../../core/properties */;\n var StaticLayoutProvider = /** @class */ (function (_super) {\n tslib_1.__extends(StaticLayoutProvider, _super);\n function StaticLayoutProvider(attrs) {\n return _super.call(this, attrs) || this;\n }\n StaticLayoutProvider.initClass = function () {\n this.prototype.type = \"StaticLayoutProvider\";\n this.define({\n graph_layout: [p.Any, {}],\n });\n };\n StaticLayoutProvider.prototype.get_node_coordinates = function (node_source) {\n var xs = [];\n var ys = [];\n var index = node_source.data.index;\n for (var i = 0, end = index.length; i < end; i++) {\n var point = this.graph_layout[index[i]];\n var _a = point != null ? point : [NaN, NaN], x = _a[0], y = _a[1];\n xs.push(x);\n ys.push(y);\n }\n return [xs, ys];\n };\n StaticLayoutProvider.prototype.get_edge_coordinates = function (edge_source) {\n var _a, _b;\n var xs = [];\n var ys = [];\n var starts = edge_source.data.start;\n var ends = edge_source.data.end;\n var has_paths = (edge_source.data.xs != null) && (edge_source.data.ys != null);\n for (var i = 0, endi = starts.length; i < endi; i++) {\n var in_layout = (this.graph_layout[starts[i]] != null) && (this.graph_layout[ends[i]] != null);\n if (has_paths && in_layout) {\n xs.push(edge_source.data.xs[i]);\n ys.push(edge_source.data.ys[i]);\n }\n else {\n var end = void 0, start = void 0;\n if (in_layout)\n _a = [this.graph_layout[starts[i]], this.graph_layout[ends[i]]], start = _a[0], end = _a[1];\n else\n _b = [[NaN, NaN], [NaN, NaN]], start = _b[0], end = _b[1];\n xs.push([start[0], end[0]]);\n ys.push([start[1], end[1]]);\n }\n }\n return [xs, ys];\n };\n return StaticLayoutProvider;\n }(layout_provider_1.LayoutProvider));\n exports.StaticLayoutProvider = StaticLayoutProvider;\n StaticLayoutProvider.initClass();\n}\n","/* models/grids/grid */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var axis_1 = require(79) /* ../axes/axis */;\n var guide_renderer_1 = require(187) /* ../renderers/guide_renderer */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var GridView = /** @class */ (function (_super) {\n tslib_1.__extends(GridView, _super);\n function GridView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(GridView.prototype, \"_x_range_name\", {\n get: function () {\n return this.model.x_range_name;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(GridView.prototype, \"_y_range_name\", {\n get: function () {\n return this.model.y_range_name;\n },\n enumerable: true,\n configurable: true\n });\n GridView.prototype.render = function () {\n if (!this.model.visible)\n return;\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n this._draw_regions(ctx);\n this._draw_minor_grids(ctx);\n this._draw_grids(ctx);\n ctx.restore();\n };\n GridView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.request_render(); });\n };\n GridView.prototype._draw_regions = function (ctx) {\n if (!this.visuals.band_fill.doit)\n return;\n var _a = this.model.grid_coords('major', false), xs = _a[0], ys = _a[1];\n this.visuals.band_fill.set_value(ctx);\n for (var i = 0; i < xs.length - 1; i++) {\n if (i % 2 == 1) {\n var _b = this.plot_view.map_to_screen(xs[i], ys[i], this._x_range_name, this._y_range_name), sx0 = _b[0], sy0 = _b[1];\n var _c = this.plot_view.map_to_screen(xs[i + 1], ys[i + 1], this._x_range_name, this._y_range_name), sx1 = _c[0], sy1 = _c[1];\n ctx.fillRect(sx0[0], sy0[0], sx1[1] - sx0[0], sy1[1] - sy0[0]);\n ctx.fill();\n }\n }\n };\n GridView.prototype._draw_grids = function (ctx) {\n if (!this.visuals.grid_line.doit)\n return;\n var _a = this.model.grid_coords('major'), xs = _a[0], ys = _a[1];\n this._draw_grid_helper(ctx, this.visuals.grid_line, xs, ys);\n };\n GridView.prototype._draw_minor_grids = function (ctx) {\n if (!this.visuals.minor_grid_line.doit)\n return;\n var _a = this.model.grid_coords('minor'), xs = _a[0], ys = _a[1];\n this._draw_grid_helper(ctx, this.visuals.minor_grid_line, xs, ys);\n };\n GridView.prototype._draw_grid_helper = function (ctx, visuals, xs, ys) {\n visuals.set_value(ctx);\n for (var i = 0; i < xs.length; i++) {\n var _a = this.plot_view.map_to_screen(xs[i], ys[i], this._x_range_name, this._y_range_name), sx = _a[0], sy = _a[1];\n ctx.beginPath();\n ctx.moveTo(Math.round(sx[0]), Math.round(sy[0]));\n for (var i_1 = 1; i_1 < sx.length; i_1++)\n ctx.lineTo(Math.round(sx[i_1]), Math.round(sy[i_1]));\n ctx.stroke();\n }\n };\n return GridView;\n }(guide_renderer_1.GuideRendererView));\n exports.GridView = GridView;\n var Grid = /** @class */ (function (_super) {\n tslib_1.__extends(Grid, _super);\n function Grid(attrs) {\n return _super.call(this, attrs) || this;\n }\n Grid.initClass = function () {\n this.prototype.type = \"Grid\";\n this.prototype.default_view = GridView;\n this.mixins(['line:grid_', 'line:minor_grid_', 'fill:band_']);\n this.define({\n bounds: [p.Any, 'auto'],\n dimension: [p.Number, 0],\n ticker: [p.Instance],\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n });\n this.override({\n level: \"underlay\",\n band_fill_color: null,\n band_fill_alpha: 0,\n grid_line_color: '#e5e5e5',\n minor_grid_line_color: null,\n });\n };\n Grid.prototype.ranges = function () {\n var i = this.dimension;\n var j = (i + 1) % 2;\n var frame = this.plot.plot_canvas.frame;\n var ranges = [\n frame.x_ranges[this.x_range_name],\n frame.y_ranges[this.y_range_name],\n ];\n return [ranges[i], ranges[j]];\n };\n Grid.prototype.computed_bounds = function () {\n var _a;\n var range = this.ranges()[0];\n var user_bounds = this.bounds;\n var range_bounds = [range.min, range.max];\n var start;\n var end;\n if (types_1.isArray(user_bounds)) {\n start = Math.min(user_bounds[0], user_bounds[1]);\n end = Math.max(user_bounds[0], user_bounds[1]);\n if (start < range_bounds[0])\n start = range_bounds[0];\n // XXX:\n //else if (start > range_bounds[1])\n // start = null\n if (end > range_bounds[1])\n end = range_bounds[1];\n // XXX:\n //else if (end < range_bounds[0])\n // end = null\n }\n else {\n start = range_bounds[0], end = range_bounds[1];\n for (var _i = 0, _b = this.plot.select(axis_1.Axis); _i < _b.length; _i++) {\n var axis = _b[_i];\n if (axis.dimension == this.dimension && axis.x_range_name == this.x_range_name\n && axis.y_range_name == this.y_range_name) {\n _a = axis.computed_bounds, start = _a[0], end = _a[1];\n }\n }\n }\n return [start, end];\n };\n Grid.prototype.grid_coords = function (location, exclude_ends) {\n if (exclude_ends === void 0) {\n exclude_ends = true;\n }\n var _a;\n var i = this.dimension;\n var j = (i + 1) % 2;\n var _b = this.ranges(), range = _b[0], cross_range = _b[1];\n var _c = this.computed_bounds(), start = _c[0], end = _c[1];\n _a = [Math.min(start, end), Math.max(start, end)], start = _a[0], end = _a[1];\n // TODO: (bev) using cross_range.min for cross_loc is a bit of a cheat. Since we\n // currently only support \"straight line\" grids, this should be OK for now. If\n // we ever want to support \"curved\" grids, e.g. for some projections, we may\n // have to communicate more than just a single cross location.\n var ticks = this.ticker.get_ticks(start, end, range, cross_range.min, {})[location];\n var min = range.min;\n var max = range.max;\n var cmin = cross_range.min;\n var cmax = cross_range.max;\n var coords = [[], []];\n if (!exclude_ends) {\n if (ticks[0] != min)\n ticks.splice(0, 0, min);\n if (ticks[ticks.length - 1] != max)\n ticks.push(max);\n }\n for (var ii = 0; ii < ticks.length; ii++) {\n if ((ticks[ii] == min || ticks[ii] == max) && exclude_ends)\n continue;\n var dim_i = [];\n var dim_j = [];\n var N = 2;\n for (var n = 0; n < N; n++) {\n var loc = cmin + (cmax - cmin) / (N - 1) * n;\n dim_i.push(ticks[ii]);\n dim_j.push(loc);\n }\n coords[i].push(dim_i);\n coords[j].push(dim_j);\n }\n return coords;\n };\n return Grid;\n }(guide_renderer_1.GuideRenderer));\n exports.Grid = Grid;\n Grid.initClass();\n}\n","/* models/grids/index */ function _(require, module, exports) {\n var grid_1 = require(151) /* ./grid */;\n exports.Grid = grid_1.Grid;\n}\n","/* models/index */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n tslib_1.__exportStar(require(66) /* ./annotations */, exports);\n tslib_1.__exportStar(require(83) /* ./axes */, exports);\n tslib_1.__exportStar(require(89) /* ./callbacks */, exports);\n tslib_1.__exportStar(require(93) /* ./canvas */, exports);\n tslib_1.__exportStar(require(96) /* ./expressions */, exports);\n tslib_1.__exportStar(require(102) /* ./filters */, exports);\n tslib_1.__exportStar(require(108) /* ./formatters */, exports);\n tslib_1.__exportStar(require(129) /* ./glyphs */, exports);\n tslib_1.__exportStar(require(148) /* ./graphs */, exports);\n tslib_1.__exportStar(require(152) /* ./grids */, exports);\n tslib_1.__exportStar(require(156) /* ./layouts */, exports);\n tslib_1.__exportStar(require(166) /* ./mappers */, exports);\n tslib_1.__exportStar(require(274) /* ./transforms */, exports);\n tslib_1.__exportStar(require(171) /* ./markers */, exports);\n tslib_1.__exportStar(require(176) /* ./plots */, exports);\n tslib_1.__exportStar(require(182) /* ./ranges */, exports);\n tslib_1.__exportStar(require(188) /* ./renderers */, exports);\n tslib_1.__exportStar(require(191) /* ./scales */, exports);\n tslib_1.__exportStar(require(195) /* ./selections */, exports);\n tslib_1.__exportStar(require(204) /* ./sources */, exports);\n tslib_1.__exportStar(require(214) /* ./tickers */, exports);\n tslib_1.__exportStar(require(224) /* ./tiles */, exports);\n tslib_1.__exportStar(require(260) /* ./tools */, exports);\n}\n","/* models/layouts/box */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var solver_1 = require(13) /* core/layout/solver */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var layout_dom_1 = require(157) /* ./layout_dom */;\n var BoxView = /** @class */ (function (_super) {\n tslib_1.__extends(BoxView, _super);\n function BoxView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BoxView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.children.change, function () { return _this.rebuild_child_views(); });\n };\n BoxView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-grid\");\n };\n BoxView.prototype.get_height = function () {\n var children = this.model.get_layoutable_children();\n var child_heights = children.map(function (child) { return child._height.value; });\n var height;\n if (this.model._horizontal)\n height = array_1.max(child_heights);\n else\n height = array_1.sum(child_heights);\n return height;\n };\n BoxView.prototype.get_width = function () {\n var children = this.model.get_layoutable_children();\n var child_widths = children.map(function (child) { return child._width.value; });\n var width;\n if (this.model._horizontal)\n width = array_1.sum(child_widths);\n else\n width = array_1.max(child_widths);\n return width;\n };\n return BoxView;\n }(layout_dom_1.LayoutDOMView));\n exports.BoxView = BoxView;\n var Box = /** @class */ (function (_super) {\n tslib_1.__extends(Box, _super);\n function Box(attrs) {\n return _super.call(this, attrs) || this;\n }\n Box.initClass = function () {\n this.prototype.type = \"Box\";\n this.prototype.default_view = BoxView;\n this.define({\n children: [p.Array, []],\n });\n this.internal({\n spacing: [p.Number, 6],\n });\n };\n Box.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._child_equal_size_width = new solver_1.Variable(this.toString() + \".child_equal_size_width\");\n this._child_equal_size_height = new solver_1.Variable(this.toString() + \".child_equal_size_height\");\n this._box_equal_size_top = new solver_1.Variable(this.toString() + \".box_equal_size_top\");\n this._box_equal_size_bottom = new solver_1.Variable(this.toString() + \".box_equal_size_bottom\");\n this._box_equal_size_left = new solver_1.Variable(this.toString() + \".box_equal_size_left\");\n this._box_equal_size_right = new solver_1.Variable(this.toString() + \".box_equal_size_right\");\n this._box_cell_align_top = new solver_1.Variable(this.toString() + \".box_cell_align_top\");\n this._box_cell_align_bottom = new solver_1.Variable(this.toString() + \".box_cell_align_bottom\");\n this._box_cell_align_left = new solver_1.Variable(this.toString() + \".box_cell_align_left\");\n this._box_cell_align_right = new solver_1.Variable(this.toString() + \".box_cell_align_right\");\n };\n Box.prototype.get_layoutable_children = function () {\n return this.children;\n };\n Box.prototype.get_constrained_variables = function () {\n return tslib_1.__assign({}, _super.prototype.get_constrained_variables.call(this), { box_equal_size_top: this._box_equal_size_top, box_equal_size_bottom: this._box_equal_size_bottom, box_equal_size_left: this._box_equal_size_left, box_equal_size_right: this._box_equal_size_right, box_cell_align_top: this._box_cell_align_top, box_cell_align_bottom: this._box_cell_align_bottom, box_cell_align_left: this._box_cell_align_left, box_cell_align_right: this._box_cell_align_right });\n };\n Box.prototype.get_constraints = function () {\n var constraints = _super.prototype.get_constraints.call(this);\n var add = function () {\n var new_constraints = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n new_constraints[_i] = arguments[_i];\n }\n constraints.push.apply(constraints, new_constraints);\n };\n var children = this.get_layoutable_children();\n if (children.length == 0)\n // No need to continue further if there are no children. Children sure do\n // make life a lot more complicated.\n return constraints;\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n var child = children_1[_i];\n var vars_1 = child.get_constrained_variables();\n // Make total widget sizes fill the orthogonal direction\n // TODO(bird) Can't we make this shorter by using span which has already picked a\n // dominant direction (we'd just also need to set a doc_span)\n var rect = this._child_rect(vars_1);\n if (this._horizontal) {\n if (vars_1.height != null)\n add(solver_1.EQ(rect.height, [-1, this._height]));\n }\n else {\n if (vars_1.width != null)\n add(solver_1.EQ(rect.width, [-1, this._width]));\n }\n // Add equal_size constraint\n // - A child's \"interesting area\" (like the plot area) is the same size as the previous child\n // (a child can opt out of this by not returning the box_equal_size variables)\n if (this._horizontal) {\n if (vars_1.box_equal_size_left != null && vars_1.box_equal_size_right != null && vars_1.width != null)\n add(solver_1.EQ([-1, vars_1.box_equal_size_left], [-1, vars_1.box_equal_size_right], vars_1.width, this._child_equal_size_width));\n }\n else {\n if (vars_1.box_equal_size_top != null && vars_1.box_equal_size_bottom != null && vars_1.height != null)\n add(solver_1.EQ([-1, vars_1.box_equal_size_top], [-1, vars_1.box_equal_size_bottom], vars_1.height, this._child_equal_size_height));\n }\n }\n // TODO(bird) - This is the second time we loop through children\n var last = this._info(children[0].get_constrained_variables());\n add(solver_1.EQ(last.span.start, 0));\n for (var i = 1; i < children.length; i++) {\n var next = this._info(children[i].get_constrained_variables());\n // Each child's start equals the previous child's end (unless we have a fixed layout\n // in which case size may not be available)\n if (last.span.size)\n add(solver_1.EQ(last.span.start, last.span.size, [-1, next.span.start]));\n // The whitespace at end of one child + start of next must equal the box spacing.\n // This must be a weak constraint because it can conflict with aligning the\n // alignable edges in each child. Alignment is generally more important visually than spacing.\n add(solver_1.WEAK_EQ(last.whitespace.after, next.whitespace.before, 0 - this.spacing));\n // If we can't satisfy the whitespace being equal to box spacing, we should fix\n // it (align things) by increasing rather than decreasing the whitespace.\n add(solver_1.GE(last.whitespace.after, next.whitespace.before, 0 - this.spacing));\n last = next;\n }\n // Child's side has to stick to the end of the box\n var vars = children[children.length - 1].get_constrained_variables();\n if (this._horizontal) {\n if (vars.width != null)\n add(solver_1.EQ(last.span.start, last.span.size, [-1, this._width]));\n }\n else {\n if (vars.height != null)\n add(solver_1.EQ(last.span.start, last.span.size, [-1, this._height]));\n }\n constraints = constraints.concat(\n // align outermost edges in both dimensions\n this._align_outer_edges_constraints(true), // horizontal=true\n this._align_outer_edges_constraints(false), \n // line up edges in same_arity boxes\n this._align_inner_cell_edges_constraints(), \n // build our equal_size bounds from the child ones\n this._box_equal_size_bounds(true), // horizontal=true\n this._box_equal_size_bounds(false), \n // propagate cell alignment (between same_arity boxes) up the hierarchy\n this._box_cell_align_bounds(true), // horizontal=true\n this._box_cell_align_bounds(false), \n // build our whitespace from the child ones\n this._box_whitespace(true), // horizontal=true\n this._box_whitespace(false));\n return constraints;\n };\n Box.prototype._child_rect = function (vars) {\n return {\n x: vars.origin_x,\n y: vars.origin_y,\n width: vars.width,\n height: vars.height,\n };\n };\n Box.prototype._span = function (rect) {\n // return [coordinate, size] pair in box_aligned direction\n if (this._horizontal)\n return { start: rect.x, size: rect.width };\n else\n return { start: rect.y, size: rect.height };\n };\n Box.prototype._info = function (vars) {\n var whitespace;\n if (this._horizontal)\n whitespace = { before: vars.whitespace_left, after: vars.whitespace_right };\n else\n whitespace = { before: vars.whitespace_top, after: vars.whitespace_bottom };\n var span = this._span(this._child_rect(vars));\n return { span: span, whitespace: whitespace };\n };\n Box.prototype._flatten_cell_edge_variables = function (horizontal) {\n /*\n * All alignment happens in terms of the\n * box_cell_align_{left,right,top,bottom} variables. We add\n * \"path\" information to variables so we know which ones align,\n * where the \"path\" includes the box arity and box cell we went\n * through.\n *\n * If we have a row of three plots, we should align the top and\n * bottom variables between the three plots.\n *\n * The flattened dictionary in this case (for the top and left\n * only) should be:\n *\n * box_cell_align_top : [ 3 vars ]\n * box_cell_align_bottom : [ 3 vars ]\n *\n * We don't do left/right starting from a row, and left/right\n * edges have nothing to align with here.\n *\n * Now say we have a row of three columns, each with three\n * plots (3x3 = 9). We should align the top/bottom variables\n * across the top three, middle three, and bottom three plots,\n * as if those groupings were rows. We do this by flattening\n * starting from the row first, which gets us a dictionary only\n * of top/bottom variables.\n *\n * box_cell_align_top col-3-0- : [ 3 plots from top of columns ]\n * box_cell_align_top col-3-1- : [ 3 plots from middle of columns ]\n * box_cell_align_top col-3-2- : [ 3 plots from bottom of columns ]\n *\n * \"col-3-1-\" = 3-cell column, cell index 1.\n *\n * In three later, separate calls to\n * _align_inner_cell_edges_constraints() on each column, we'll\n * get the left/right variables:\n *\n * box_cell_align_left : [ 3 left-column plots ]\n * box_cell_align_left : [ 3 middle-column plots ]\n * box_cell_align_left : [ 3 right-column plots ]\n *\n * Now add another nesting - we have a row of three columns,\n * each with three rows, each with three plots. This is\n * arranged 3x9 = 27.\n *\n * box_cell_align_top col-3-0- : [ 9 plots from top rows of columns ]\n * box_cell_align_top col-3-1- : [ 9 plots from middle rows of columns ]\n * box_cell_align_top col-3-2- : [ 9 plots from bottom rows of columns ]\n *\n * When we make the _align_inner_cell_edges_constraints() calls on each of the three\n * columns, each column will return row-pathed values\n *\n * box_cell_align_left row-3-0-: [ 3 plots in left column of left column ]\n * box_cell_align_left row-3-1-: [ 3 plots in middle column of left column ]\n * box_cell_align_left row-3-2-: [ 3 plots in right column of left column ]\n * ... same for the middle and right columns\n *\n * Anyway in essence what we do is that we add only rows to the\n * path to left/right variables, and only columns to the path\n * to top/bottom variables.\n *\n * If we nest yet another level we would finally get paths with\n * multiple rows or multiple columns in them.\n */\n var relevant_edges;\n if (horizontal)\n relevant_edges = Box._top_bottom_inner_cell_edge_variables;\n else\n relevant_edges = Box._left_right_inner_cell_edge_variables;\n var add_path = horizontal != this._horizontal;\n var children = this.get_layoutable_children();\n var arity = children.length;\n var flattened = {};\n var cell = 0;\n for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {\n var child = children_2[_i];\n var cell_vars = void 0;\n if (child instanceof Box)\n cell_vars = child._flatten_cell_edge_variables(horizontal);\n else\n cell_vars = {};\n var all_vars = child.get_constrained_variables();\n for (var _a = 0, relevant_edges_1 = relevant_edges; _a < relevant_edges_1.length; _a++) {\n var name_1 = relevant_edges_1[_a];\n if (name_1 in all_vars)\n cell_vars[name_1] = [all_vars[name_1]];\n }\n for (var key in cell_vars) {\n var variables = cell_vars[key];\n var new_key = void 0;\n if (add_path) {\n var parsed = key.split(\" \");\n var kind = parsed[0];\n var path = parsed.length > 1 ? parsed[1] : \"\";\n var direction = this._horizontal ? \"row\" : \"col\";\n // TODO should we \"ignore\" arity-1 boxes potentially by not adding a path suffix?\n new_key = kind + \" \" + direction + \"-\" + arity + \"-\" + cell + \"-\" + path;\n }\n else\n new_key = key;\n if (new_key in flattened)\n flattened[new_key] = flattened[new_key].concat(variables);\n else\n flattened[new_key] = variables;\n }\n cell++;\n }\n return flattened;\n };\n // This should only be called on the toplevel box (twice,\n // once with horizontal=true and once with horizontal=false)\n Box.prototype._align_inner_cell_edges_constraints = function () {\n var constraints = [];\n // XXX: checking for `this.document?` is a temporary hack, because document isn't always\n // attached properly. However, if document is not attached then we know it can't be\n // a root, because otherwise add_root() would attach it. All this layout logic should\n // be part of views instead of models and use is_root, etc.\n if (this.document != null && array_1.includes(this.document.roots(), this)) {\n var flattened = this._flatten_cell_edge_variables(this._horizontal);\n for (var key in flattened) {\n var variables = flattened[key];\n if (variables.length > 1) {\n //console.log(\"constraining \", key, \" \", variables)\n var last = variables[0];\n for (var i = 1; i < variables.length; i++)\n constraints.push(solver_1.EQ(variables[i], [-1, last]));\n }\n }\n }\n return constraints;\n };\n // returns a two-item array where each item is a list of edge\n // children from the start and end respectively\n Box.prototype._find_edge_leaves = function (horizontal) {\n var children = this.get_layoutable_children();\n // console.log(` finding edge leaves in ${children.length}-${this.type}, ` +\n // `our orientation ${this._horizontal} finding ${horizontal} children `, children)\n var leaves = [[], []];\n if (children.length > 0) {\n if (this._horizontal == horizontal) {\n // note start and end may be the same\n var start = children[0];\n var end = children[children.length - 1];\n if (start instanceof Box)\n leaves[0] = leaves[0].concat(start._find_edge_leaves(horizontal)[0]);\n else\n leaves[0].push(start);\n if (end instanceof Box)\n leaves[1] = leaves[1].concat(end._find_edge_leaves(horizontal)[1]);\n else\n leaves[1].push(end);\n }\n else {\n // if we are a column and someone wants the horizontal edges,\n // we return the horizontal edges from all of our children\n for (var _i = 0, children_3 = children; _i < children_3.length; _i++) {\n var child = children_3[_i];\n if (child instanceof Box) {\n var child_leaves = child._find_edge_leaves(horizontal);\n leaves[0] = leaves[0].concat(child_leaves[0]);\n leaves[1] = leaves[1].concat(child_leaves[1]);\n }\n else {\n leaves[0].push(child);\n leaves[1].push(child);\n }\n }\n }\n }\n // console.log(\" start leaves \", leaves[0].map((leaf) -> leaf.id)\n // console.log(\" end leaves \", leaves[1].map((leaf) -> leaf.id)\n return leaves;\n };\n Box.prototype._align_outer_edges_constraints = function (horizontal) {\n // console.log(`${if horizontal then 'horizontal' else 'vertical'} outer edge constraints in ${this.get_layoutable_children().length}-${this.type}`)\n var _a = this._find_edge_leaves(horizontal), start_leaves = _a[0], end_leaves = _a[1];\n var start_variable;\n var end_variable;\n if (horizontal) {\n start_variable = 'on_edge_align_left';\n end_variable = 'on_edge_align_right';\n }\n else {\n start_variable = 'on_edge_align_top';\n end_variable = 'on_edge_align_bottom';\n }\n var collect_vars = function (leaves, name) {\n //console.log(`collecting ${name} in `, leaves)\n var edges = [];\n for (var _i = 0, leaves_1 = leaves; _i < leaves_1.length; _i++) {\n var leaf = leaves_1[_i];\n var vars = leaf.get_constrained_variables();\n if (name in vars)\n edges.push(vars[name]);\n //vars[name]['_debug'] = `${name} from ${leaf.id}`\n }\n return edges;\n };\n var start_edges = collect_vars(start_leaves, start_variable);\n var end_edges = collect_vars(end_leaves, end_variable);\n var result = [];\n var add_all_equal = function (edges) {\n if (edges.length > 1) {\n var first = edges[0];\n for (var i = 1; i < edges.length; i++) {\n var edge = edges[i];\n //console.log(` constraining ${first._debug} == ${edge._debug}`)\n result.push(solver_1.EQ([-1, first], edge));\n }\n }\n };\n add_all_equal(start_edges);\n add_all_equal(end_edges);\n // console.log(\"computed constraints \", result)\n return result;\n };\n Box.prototype._box_insets_from_child_insets = function (horizontal, child_variable_prefix, our_variable_prefix, minimum) {\n var _a = this._find_edge_leaves(horizontal), start_leaves = _a[0], end_leaves = _a[1];\n var start_variable;\n var end_variable;\n var our_start;\n var our_end;\n if (horizontal) {\n start_variable = child_variable_prefix + \"_left\";\n end_variable = child_variable_prefix + \"_right\";\n our_start = this[our_variable_prefix + \"_left\"];\n our_end = this[our_variable_prefix + \"_right\"];\n }\n else {\n start_variable = child_variable_prefix + \"_top\";\n end_variable = child_variable_prefix + \"_bottom\";\n our_start = this[our_variable_prefix + \"_top\"];\n our_end = this[our_variable_prefix + \"_bottom\"];\n }\n var result = [];\n var add_constraints = function (ours, leaves, name) {\n for (var _i = 0, leaves_2 = leaves; _i < leaves_2.length; _i++) {\n var leaf = leaves_2[_i];\n var vars = leaf.get_constrained_variables();\n if (name in vars) {\n if (minimum)\n result.push(solver_1.GE([-1, ours], vars[name]));\n else\n result.push(solver_1.EQ([-1, ours], vars[name]));\n }\n }\n };\n add_constraints(our_start, start_leaves, start_variable);\n add_constraints(our_end, end_leaves, end_variable);\n return result;\n };\n Box.prototype._box_equal_size_bounds = function (horizontal) {\n // false = box bounds equal all outer child bounds exactly\n return this._box_insets_from_child_insets(horizontal, 'box_equal_size', '_box_equal_size', false);\n };\n Box.prototype._box_cell_align_bounds = function (horizontal) {\n // false = box bounds equal all outer child bounds exactly\n return this._box_insets_from_child_insets(horizontal, 'box_cell_align', '_box_cell_align', false);\n };\n Box.prototype._box_whitespace = function (horizontal) {\n // true = box whitespace must be the minimum of child\n // whitespaces (i.e. distance from box edge to the outermost\n // child pixels)\n return this._box_insets_from_child_insets(horizontal, 'whitespace', '_whitespace', true);\n };\n Box._left_right_inner_cell_edge_variables = ['box_cell_align_left', 'box_cell_align_right'];\n Box._top_bottom_inner_cell_edge_variables = ['box_cell_align_top', 'box_cell_align_bottom'];\n return Box;\n }(layout_dom_1.LayoutDOM));\n exports.Box = Box;\n Box.initClass();\n}\n","/* models/layouts/column */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var box_1 = require(154) /* ./box */;\n var ColumnView = /** @class */ (function (_super) {\n tslib_1.__extends(ColumnView, _super);\n function ColumnView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ColumnView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-grid-column\");\n };\n return ColumnView;\n }(box_1.BoxView));\n exports.ColumnView = ColumnView;\n var Column = /** @class */ (function (_super) {\n tslib_1.__extends(Column, _super);\n function Column(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this._horizontal = false;\n return _this;\n }\n Column.initClass = function () {\n this.prototype.type = \"Column\";\n this.prototype.default_view = ColumnView;\n };\n return Column;\n }(box_1.Box));\n exports.Column = Column;\n Column.initClass();\n}\n","/* models/layouts/index */ function _(require, module, exports) {\n var box_1 = require(154) /* ./box */;\n exports.Box = box_1.Box;\n var column_1 = require(155) /* ./column */;\n exports.Column = column_1.Column;\n var layout_dom_1 = require(157) /* ./layout_dom */;\n exports.LayoutDOM = layout_dom_1.LayoutDOM;\n var row_1 = require(158) /* ./row */;\n exports.Row = row_1.Row;\n var spacer_1 = require(159) /* ./spacer */;\n exports.Spacer = spacer_1.Spacer;\n var widget_box_1 = require(160) /* ./widget_box */;\n exports.WidgetBox = widget_box_1.WidgetBox;\n}\n","/* models/layouts/layout_dom */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var layout_canvas_1 = require(11) /* core/layout/layout_canvas */;\n var solver_1 = require(13) /* core/layout/solver */;\n var build_views_1 = require(4) /* core/build_views */;\n var dom_view_1 = require(6) /* core/dom_view */;\n var LayoutDOMView = /** @class */ (function (_super) {\n tslib_1.__extends(LayoutDOMView, _super);\n function LayoutDOMView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._solver_inited = false;\n _this._idle_notified = false;\n return _this;\n }\n LayoutDOMView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n // this is a root view\n if (this.is_root)\n this._solver = new solver_1.Solver();\n this.child_views = {};\n this.build_child_views();\n };\n LayoutDOMView.prototype.remove = function () {\n for (var model_id in this.child_views) {\n var view = this.child_views[model_id];\n view.remove();\n }\n this.child_views = {};\n // remove on_resize\n _super.prototype.remove.call(this);\n };\n LayoutDOMView.prototype.has_finished = function () {\n if (!_super.prototype.has_finished.call(this))\n return false;\n for (var model_id in this.child_views) {\n var child = this.child_views[model_id];\n if (!child.has_finished())\n return false;\n }\n return true;\n };\n LayoutDOMView.prototype.notify_finished = function () {\n if (!this.is_root)\n _super.prototype.notify_finished.call(this);\n else {\n if (!this._idle_notified && this.has_finished()) {\n if (this.model.document != null) {\n this._idle_notified = true;\n this.model.document.notify_idle(this.model);\n }\n }\n }\n };\n LayoutDOMView.prototype._calc_width_height = function () {\n var measuring = this.el;\n while (measuring = measuring.parentElement) {\n // .bk-root element doesn't bring any value\n if (measuring.classList.contains(\"bk-root\"))\n continue;\n // we reached element, so use viewport size\n if (measuring == document.body) {\n var _a = dom_1.margin(document.body), left_1 = _a.left, right_1 = _a.right, top_1 = _a.top, bottom_1 = _a.bottom;\n var width_1 = document.documentElement.clientWidth - left_1 - right_1;\n var height_1 = document.documentElement.clientHeight - top_1 - bottom_1;\n return [width_1, height_1];\n }\n // stop on first element with sensible dimensions\n var _b = dom_1.padding(measuring), left = _b.left, right = _b.right, top_2 = _b.top, bottom = _b.bottom;\n var _c = measuring.getBoundingClientRect(), width = _c.width, height = _c.height;\n var inner_width = width - left - right;\n var inner_height = height - top_2 - bottom;\n switch (this.model.sizing_mode) {\n case \"scale_width\": {\n if (inner_width > 0)\n return [inner_width, inner_height > 0 ? inner_height : null];\n break;\n }\n case \"scale_height\": {\n if (inner_height > 0)\n return [inner_width > 0 ? inner_width : null, inner_height];\n break;\n }\n case \"scale_both\":\n case \"stretch_both\": {\n if (inner_width > 0 || inner_height > 0)\n return [inner_width > 0 ? inner_width : null, inner_height > 0 ? inner_height : null];\n break;\n }\n default:\n throw new Error(\"unreachable\");\n }\n }\n // this element is detached from DOM\n return [null, null];\n };\n LayoutDOMView.prototype._init_solver = function () {\n this._root_width = new solver_1.Variable(this.toString() + \".root_width\");\n this._root_height = new solver_1.Variable(this.toString() + \".root_height\");\n // XXX: this relies on the fact that missing `strength` argument results\n // in strength being NaN, which behaves like `Strength.required`. However,\n // this is banned by the API.\n this._solver.add_edit_variable(this._root_width, NaN);\n this._solver.add_edit_variable(this._root_height, NaN);\n var editables = this.model.get_all_editables();\n for (var _i = 0, editables_1 = editables; _i < editables_1.length; _i++) {\n var edit_variable = editables_1[_i];\n this._solver.add_edit_variable(edit_variable, solver_1.Strength.strong);\n }\n var constraints = this.model.get_all_constraints();\n for (var _a = 0, constraints_1 = constraints; _a < constraints_1.length; _a++) {\n var constraint = constraints_1[_a];\n this._solver.add_constraint(constraint);\n }\n var variables = this.model.get_constrained_variables();\n if (variables.width != null)\n this._solver.add_constraint(solver_1.EQ(variables.width, this._root_width));\n if (variables.height != null)\n this._solver.add_constraint(solver_1.EQ(variables.height, this._root_height));\n this._solver.update_variables();\n this._solver_inited = true;\n };\n LayoutDOMView.prototype._suggest_dims = function (width, height) {\n var _a;\n var variables = this.model.get_constrained_variables();\n if (variables.width != null || variables.height != null) {\n if (width == null || height == null)\n _a = this._calc_width_height(), width = _a[0], height = _a[1];\n if (variables.width != null && width != null)\n this._solver.suggest_value(this._root_width, width);\n if (variables.height != null && height != null)\n this._solver.suggest_value(this._root_height, height);\n this._solver.update_variables();\n }\n };\n LayoutDOMView.prototype.resize = function (width, height) {\n if (width === void 0) {\n width = null;\n }\n if (height === void 0) {\n height = null;\n }\n if (!this.is_root)\n this.root.resize(width, height);\n else\n this._do_layout(false, width, height);\n };\n LayoutDOMView.prototype.partial_layout = function () {\n if (!this.is_root)\n this.root.partial_layout();\n else\n this._do_layout(false);\n };\n LayoutDOMView.prototype.layout = function () {\n if (!this.is_root)\n this.root.layout();\n else\n this._do_layout(true);\n };\n LayoutDOMView.prototype._do_layout = function (full, width, height) {\n if (width === void 0) {\n width = null;\n }\n if (height === void 0) {\n height = null;\n }\n if (!this._solver_inited || full) {\n this._solver.clear();\n this._init_solver();\n }\n this._suggest_dims(width, height);\n // XXX: do layout twice, because there are interdependencies between views,\n // which currently cannot be resolved with one pass. The third one triggers\n // rendering and (expensive) painting.\n this._layout(); // layout (1)\n this._layout(); // layout (2)\n this._layout(true); // render & paint\n this.notify_finished();\n };\n LayoutDOMView.prototype._layout = function (final) {\n if (final === void 0) {\n final = false;\n }\n for (var _i = 0, _a = this.model.get_layoutable_children(); _i < _a.length; _i++) {\n var child = _a[_i];\n var child_view = this.child_views[child.id];\n if (child_view._layout != null)\n child_view._layout(final);\n }\n this.render();\n if (final)\n this._has_finished = true;\n };\n LayoutDOMView.prototype.rebuild_child_views = function () {\n this.solver.clear();\n this.build_child_views();\n this.layout();\n };\n LayoutDOMView.prototype.build_child_views = function () {\n var children = this.model.get_layoutable_children();\n build_views_1.build_views(this.child_views, children, { parent: this });\n dom_1.empty(this.el);\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n var child = children_1[_i];\n // Look-up the child_view in this.child_views and then append We can't just\n // read from this.child_views because then we don't get guaranteed ordering.\n // Which is a problem in non-box layouts.\n var child_view = this.child_views[child.id];\n this.el.appendChild(child_view.el);\n }\n };\n LayoutDOMView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n if (this.is_root)\n window.addEventListener(\"resize\", this);\n // XXX: this.connect(this.model.change, () => this.layout())\n this.connect(this.model.properties.sizing_mode.change, function () { return _this.layout(); });\n };\n LayoutDOMView.prototype.handleEvent = function () {\n this.resize();\n };\n LayoutDOMView.prototype.disconnect_signals = function () {\n window.removeEventListener(\"resize\", this);\n _super.prototype.disconnect_signals.call(this);\n };\n LayoutDOMView.prototype._render_classes = function () {\n this.el.className = \"\"; // removes all classes\n for (var _i = 0, _a = this.css_classes(); _i < _a.length; _i++) {\n var name_1 = _a[_i];\n this.el.classList.add(name_1);\n }\n this.el.classList.add(\"bk-layout-\" + this.model.sizing_mode);\n for (var _b = 0, _c = this.model.css_classes; _b < _c.length; _b++) {\n var cls = _c[_b];\n this.el.classList.add(cls);\n }\n };\n LayoutDOMView.prototype.render = function () {\n this._render_classes();\n switch (this.model.sizing_mode) {\n case \"fixed\": {\n // If the width or height is unset:\n // - compute it from children\n // - but then save for future use\n // (for some reason widget boxes keep shrinking if you keep computing\n // but this is more efficient and appropriate for fixed anyway).\n var width = void 0;\n if (this.model.width != null)\n width = this.model.width;\n else\n width = this.get_width();\n this.model.setv({ width: width }, { silent: true });\n var height = void 0;\n if (this.model.height != null)\n height = this.model.height;\n else\n height = this.get_height();\n this.model.setv({ height: height }, { silent: true });\n this.solver.suggest_value(this.model._width, width);\n this.solver.suggest_value(this.model._height, height);\n break;\n }\n case \"scale_width\": {\n var height = this.get_height();\n this.solver.suggest_value(this.model._height, height);\n break;\n }\n case \"scale_height\": {\n var width = this.get_width();\n this.solver.suggest_value(this.model._width, width);\n break;\n }\n case \"scale_both\": {\n var _a = this.get_width_height(), width = _a[0], height = _a[1];\n this.solver.suggest_value(this.model._width, width);\n this.solver.suggest_value(this.model._height, height);\n break;\n }\n }\n this.solver.update_variables();\n this.position();\n };\n LayoutDOMView.prototype.position = function () {\n switch (this.model.sizing_mode) {\n case \"fixed\":\n case \"scale_width\":\n case \"scale_height\": {\n this.el.style.position = \"relative\";\n this.el.style.left = \"\";\n this.el.style.top = \"\";\n break;\n }\n case \"scale_both\":\n case \"stretch_both\": {\n this.el.style.position = \"absolute\";\n this.el.style.left = this.model._dom_left.value + \"px\";\n this.el.style.top = this.model._dom_top.value + \"px\";\n break;\n }\n }\n this.el.style.width = this.model._width.value + \"px\";\n this.el.style.height = this.model._height.value + \"px\";\n };\n LayoutDOMView.prototype.get_width_height = function () {\n /**\n * Fit into enclosing DOM and preserve original aspect.\n */\n var _a = this._calc_width_height(), parent_width = _a[0], parent_height = _a[1];\n if (parent_width == null && parent_height == null)\n throw new Error(\"detached element\");\n var ar = this.model.get_aspect_ratio();\n if (parent_width != null && parent_height == null)\n return [parent_width, parent_width / ar];\n if (parent_width == null && parent_height != null)\n return [parent_height * ar, parent_height];\n var new_width_1 = parent_width;\n var new_height_1 = parent_width / ar;\n var new_width_2 = parent_height * ar;\n var new_height_2 = parent_height;\n var width;\n var height;\n if (new_width_1 < new_width_2) {\n width = new_width_1;\n height = new_height_1;\n }\n else {\n width = new_width_2;\n height = new_height_2;\n }\n return [width, height];\n };\n return LayoutDOMView;\n }(dom_view_1.DOMView));\n exports.LayoutDOMView = LayoutDOMView;\n var LayoutDOM = /** @class */ (function (_super) {\n tslib_1.__extends(LayoutDOM, _super);\n function LayoutDOM(attrs) {\n return _super.call(this, attrs) || this;\n }\n LayoutDOM.initClass = function () {\n this.prototype.type = \"LayoutDOM\";\n this.define({\n height: [p.Number],\n width: [p.Number],\n disabled: [p.Bool, false],\n sizing_mode: [p.SizingMode, \"fixed\"],\n css_classes: [p.Array, []],\n });\n };\n LayoutDOM.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._width = new solver_1.Variable(this.toString() + \".width\");\n this._height = new solver_1.Variable(this.toString() + \".height\");\n this._left = new solver_1.Variable(this.toString() + \".left\");\n this._right = new solver_1.Variable(this.toString() + \".right\");\n this._top = new solver_1.Variable(this.toString() + \".top\");\n this._bottom = new solver_1.Variable(this.toString() + \".bottom\");\n this._dom_top = new solver_1.Variable(this.toString() + \".dom_top\");\n this._dom_left = new solver_1.Variable(this.toString() + \".dom_left\");\n this._width_minus_right = new solver_1.Variable(this.toString() + \".width_minus_right\");\n this._height_minus_bottom = new solver_1.Variable(this.toString() + \".height_minus_bottom\");\n this._whitespace_top = new solver_1.Variable(this.toString() + \".whitespace_top\");\n this._whitespace_bottom = new solver_1.Variable(this.toString() + \".whitespace_bottom\");\n this._whitespace_left = new solver_1.Variable(this.toString() + \".whitespace_left\");\n this._whitespace_right = new solver_1.Variable(this.toString() + \".whitespace_right\");\n };\n Object.defineProperty(LayoutDOM.prototype, \"layout_bbox\", {\n get: function () {\n return {\n top: this._top.value,\n left: this._left.value,\n width: this._width.value,\n height: this._height.value,\n right: this._right.value,\n bottom: this._bottom.value,\n dom_top: this._dom_top.value,\n dom_left: this._dom_left.value,\n };\n },\n enumerable: true,\n configurable: true\n });\n LayoutDOM.prototype.dump_layout = function () {\n var layoutables = {};\n var pending = [this];\n var obj;\n while (obj = pending.shift()) {\n pending.push.apply(pending, obj.get_layoutable_children());\n layoutables[obj.toString()] = obj.layout_bbox;\n }\n console.table(layoutables);\n };\n LayoutDOM.prototype.get_all_constraints = function () {\n var constraints = this.get_constraints();\n for (var _i = 0, _a = this.get_layoutable_children(); _i < _a.length; _i++) {\n var child = _a[_i];\n if (child instanceof layout_canvas_1.LayoutCanvas)\n constraints = constraints.concat(child.get_constraints());\n else\n constraints = constraints.concat(child.get_all_constraints());\n }\n return constraints;\n };\n LayoutDOM.prototype.get_all_editables = function () {\n var editables = this.get_editables();\n for (var _i = 0, _a = this.get_layoutable_children(); _i < _a.length; _i++) {\n var child = _a[_i];\n if (child instanceof layout_canvas_1.LayoutCanvas)\n editables = editables.concat(child.get_editables());\n else\n editables = editables.concat(child.get_all_editables());\n }\n return editables;\n };\n LayoutDOM.prototype.get_constraints = function () {\n return [\n // Make sure things dont squeeze out of their bounding box\n solver_1.GE(this._dom_left),\n solver_1.GE(this._dom_top),\n // Plot has to be inside the width/height\n solver_1.GE(this._left),\n solver_1.GE(this._width, [-1, this._right]),\n solver_1.GE(this._top),\n solver_1.GE(this._height, [-1, this._bottom]),\n // Declare computed constraints\n solver_1.EQ(this._width_minus_right, [-1, this._width], this._right),\n solver_1.EQ(this._height_minus_bottom, [-1, this._height], this._bottom),\n ];\n };\n LayoutDOM.prototype.get_layoutable_children = function () {\n return [];\n };\n LayoutDOM.prototype.get_editables = function () {\n switch (this.sizing_mode) {\n case \"fixed\":\n return [this._height, this._width];\n case \"scale_width\":\n return [this._height];\n case \"scale_height\":\n return [this._width];\n case \"scale_both\":\n return [this._width, this._height];\n default:\n return [];\n }\n };\n LayoutDOM.prototype.get_constrained_variables = function () {\n /*\n * THE FOLLOWING ARE OPTIONAL VARS THAT\n * YOU COULD ADD INTO SUBCLASSES\n *\n * # When this widget is on the edge of a box visually,\n * # align these variables down that edge. Right/bottom\n * # are an inset from the edge.\n * on_edge_align_top : this._top\n * on_edge_align_bottom : this._height_minus_bottom\n * on_edge_align_left : this._left\n * on_edge_align_right : this._width_minus_right\n * # When this widget is in a box cell with the same \"arity\n * # path\" as a widget in another cell, align these variables\n * # between the two box cells. Right/bottom are an inset from\n * # the edge.\n * box_cell_align_top : this._top\n * box_cell_align_bottom: this._height_minus_bottom\n * box_cell_align_left : this._left\n * box_cell_align_right : this._width_minus_right\n * # When this widget is in a box, make these the same distance\n * # apart in every widget. Right/bottom are inset from the edge.\n * box_equal_size_top : this._top\n * box_equal_size_bottom: this._height_minus_bottom\n * box_equal_size_left : this._left\n * box_equal_size_right : this._width_minus_right\n */\n var vars = {\n origin_x: this._dom_left,\n origin_y: this._dom_top,\n whitespace_top: this._whitespace_top,\n whitespace_bottom: this._whitespace_bottom,\n whitespace_left: this._whitespace_left,\n whitespace_right: this._whitespace_right,\n };\n switch (this.sizing_mode) {\n case \"stretch_both\":\n vars.width = this._width;\n vars.height = this._height;\n break;\n case \"scale_width\":\n vars.width = this._width;\n break;\n case \"scale_height\":\n vars.height = this._height;\n break;\n }\n return vars;\n };\n LayoutDOM.prototype.get_aspect_ratio = function () {\n return this.width / this.height;\n };\n return LayoutDOM;\n }(model_1.Model));\n exports.LayoutDOM = LayoutDOM;\n LayoutDOM.initClass();\n}\n","/* models/layouts/row */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var box_1 = require(154) /* ./box */;\n var RowView = /** @class */ (function (_super) {\n tslib_1.__extends(RowView, _super);\n function RowView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RowView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-grid-row\");\n };\n return RowView;\n }(box_1.BoxView));\n exports.RowView = RowView;\n var Row = /** @class */ (function (_super) {\n tslib_1.__extends(Row, _super);\n function Row(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this._horizontal = true;\n return _this;\n }\n Row.initClass = function () {\n this.prototype.type = \"Row\";\n this.prototype.default_view = RowView;\n };\n return Row;\n }(box_1.Box));\n exports.Row = Row;\n Row.initClass();\n}\n","/* models/layouts/spacer */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var layout_dom_1 = require(157) /* ./layout_dom */;\n var SpacerView = /** @class */ (function (_super) {\n tslib_1.__extends(SpacerView, _super);\n function SpacerView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SpacerView.prototype.render = function () {\n _super.prototype.render.call(this);\n if (this.model.sizing_mode == \"fixed\") {\n this.el.style.width = this.model.width + \"px\";\n this.el.style.height = this.model.height + \"px\";\n }\n };\n SpacerView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-spacer-box\");\n };\n // spacer must always have some width/height\n SpacerView.prototype.get_width = function () {\n return 1;\n };\n SpacerView.prototype.get_height = function () {\n return 1;\n };\n return SpacerView;\n }(layout_dom_1.LayoutDOMView));\n exports.SpacerView = SpacerView;\n var Spacer = /** @class */ (function (_super) {\n tslib_1.__extends(Spacer, _super);\n function Spacer(attrs) {\n return _super.call(this, attrs) || this;\n }\n Spacer.initClass = function () {\n this.prototype.type = \"Spacer\";\n this.prototype.default_view = SpacerView;\n };\n Spacer.prototype.get_constrained_variables = function () {\n return tslib_1.__assign({}, _super.prototype.get_constrained_variables.call(this), { on_edge_align_top: this._top, on_edge_align_bottom: this._height_minus_bottom, on_edge_align_left: this._left, on_edge_align_right: this._width_minus_right, box_cell_align_top: this._top, box_cell_align_bottom: this._height_minus_bottom, box_cell_align_left: this._left, box_cell_align_right: this._width_minus_right, box_equal_size_top: this._top, box_equal_size_bottom: this._height_minus_bottom, box_equal_size_left: this._left, box_equal_size_right: this._width_minus_right });\n };\n return Spacer;\n }(layout_dom_1.LayoutDOM));\n exports.Spacer = Spacer;\n Spacer.initClass();\n}\n","/* models/layouts/widget_box */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var layout_dom_1 = require(157) /* ../layouts/layout_dom */;\n var WidgetBoxView = /** @class */ (function (_super) {\n tslib_1.__extends(WidgetBoxView, _super);\n function WidgetBoxView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WidgetBoxView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.children.change, function () { return _this.rebuild_child_views(); });\n };\n WidgetBoxView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-widget-box\");\n };\n WidgetBoxView.prototype.render = function () {\n this._render_classes(); // XXX: because no super()\n if (this.model.sizing_mode == 'fixed' || this.model.sizing_mode == 'scale_height') {\n var width = this.get_width();\n if (this.model._width.value != width)\n this.solver.suggest_value(this.model._width, width);\n }\n if (this.model.sizing_mode == 'fixed' || this.model.sizing_mode == 'scale_width') {\n var height = this.get_height();\n if (this.model._height.value != height)\n this.solver.suggest_value(this.model._height, height);\n }\n this.solver.update_variables();\n if (this.model.sizing_mode == 'stretch_both') {\n this.el.style.position = 'absolute';\n this.el.style.left = this.model._dom_left.value + \"px\";\n this.el.style.top = this.model._dom_top.value + \"px\";\n this.el.style.width = this.model._width.value + \"px\";\n this.el.style.height = this.model._height.value + \"px\";\n }\n else {\n // Note we DO NOT want to set a height (except in stretch_both). Widgets\n // are happier sizing themselves. We've tried to tell the layout what\n // the height is with the suggest_value. But that doesn't mean we need\n // to put it in the dom.\n var css_width = void 0;\n if (this.model._width.value - 20 > 0)\n css_width = this.model._width.value - 20 + \"px\";\n else\n css_width = \"100%\";\n this.el.style.width = css_width;\n }\n };\n WidgetBoxView.prototype.get_height = function () {\n var height = 0;\n for (var key in this.child_views) {\n var child_view = this.child_views[key];\n var el = child_view.el;\n var style = getComputedStyle(el);\n var marginTop = parseInt(style.marginTop) || 0;\n var marginBottom = parseInt(style.marginBottom) || 0;\n height += el.offsetHeight + marginTop + marginBottom;\n }\n return height + 20;\n };\n WidgetBoxView.prototype.get_width = function () {\n if (this.model.width != null)\n return this.model.width;\n else {\n var width = this.el.scrollWidth + 20;\n for (var key in this.child_views) {\n var child_view = this.child_views[key];\n // Take the max width of all the children as the constrainer.\n var child_width = child_view.el.scrollWidth;\n if (child_width > width)\n width = child_width;\n }\n return width;\n }\n };\n return WidgetBoxView;\n }(layout_dom_1.LayoutDOMView));\n exports.WidgetBoxView = WidgetBoxView;\n var WidgetBox = /** @class */ (function (_super) {\n tslib_1.__extends(WidgetBox, _super);\n function WidgetBox(attrs) {\n return _super.call(this, attrs) || this;\n }\n WidgetBox.initClass = function () {\n this.prototype.type = \"WidgetBox\";\n this.prototype.default_view = WidgetBoxView;\n this.define({\n children: [p.Array, []],\n });\n };\n WidgetBox.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n if (this.sizing_mode == 'fixed' && this.width == null) {\n this.width = 300; // Set a default for fixed.\n logging_1.logger.info(\"WidgetBox mode is fixed, but no width specified. Using default of 300.\");\n }\n };\n WidgetBox.prototype.get_constrained_variables = function () {\n var vars = tslib_1.__assign({}, _super.prototype.get_constrained_variables.call(this), { on_edge_align_top: this._top, on_edge_align_bottom: this._height_minus_bottom, on_edge_align_left: this._left, on_edge_align_right: this._width_minus_right, box_cell_align_top: this._top, box_cell_align_bottom: this._height_minus_bottom, box_cell_align_left: this._left, box_cell_align_right: this._width_minus_right, box_equal_size_top: this._top, box_equal_size_bottom: this._height_minus_bottom });\n if (this.sizing_mode != 'fixed') {\n vars.box_equal_size_left = this._left;\n vars.box_equal_size_right = this._width_minus_right;\n }\n return vars;\n };\n WidgetBox.prototype.get_layoutable_children = function () {\n return this.children;\n };\n return WidgetBox;\n }(layout_dom_1.LayoutDOM));\n exports.WidgetBox = WidgetBox;\n WidgetBox.initClass();\n}\n","/* models/mappers/categorical_color_mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var categorical_mapper_1 = require(162) /* ./categorical_mapper */;\n var color_mapper_1 = require(164) /* ./color_mapper */;\n var p = require(15) /* core/properties */;\n var CategoricalColorMapper = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalColorMapper, _super);\n function CategoricalColorMapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n CategoricalColorMapper.initClass = function () {\n this.prototype.type = \"CategoricalColorMapper\";\n this.define({\n factors: [p.Array],\n start: [p.Number, 0],\n end: [p.Number],\n });\n };\n CategoricalColorMapper.prototype._v_compute = function (data, values, palette, _a) {\n var nan_color = _a.nan_color;\n categorical_mapper_1.cat_v_compute(data, this.factors, palette, values, this.start, this.end, nan_color);\n };\n return CategoricalColorMapper;\n }(color_mapper_1.ColorMapper));\n exports.CategoricalColorMapper = CategoricalColorMapper;\n CategoricalColorMapper.initClass();\n}\n","/* models/mappers/categorical_mapper */ function _(require, module, exports) {\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n function _cat_equals(a, b) {\n if (a.length != b.length)\n return false;\n for (var i = 0, end = a.length; i < end; i++) {\n if (a[i] !== b[i])\n return false;\n }\n return true;\n }\n exports._cat_equals = _cat_equals;\n function cat_v_compute(data, factors, targets, values, start, end, extra_value) {\n var _loop_1 = function (i, N) {\n var d = data[i];\n var key = void 0;\n if (types_1.isString(d))\n key = factors.indexOf(d);\n else {\n if (start != null) {\n if (end != null)\n d = d.slice(start, end);\n else\n d = d.slice(start);\n }\n else if (end != null)\n d = d.slice(0, end);\n if (d.length == 1)\n key = factors.indexOf(d[0]);\n else\n key = array_1.findIndex(factors, function (x) { return _cat_equals(x, d); });\n }\n var value = void 0;\n if (key < 0 || key >= targets.length)\n value = extra_value;\n else\n value = targets[key];\n values[i] = value;\n };\n for (var i = 0, N = data.length; i < N; i++) {\n _loop_1(i, N);\n }\n }\n exports.cat_v_compute = cat_v_compute;\n}\n","/* models/mappers/categorical_marker_mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var categorical_mapper_1 = require(162) /* ./categorical_mapper */;\n var mapper_1 = require(169) /* ./mapper */;\n var p = require(15) /* core/properties */;\n var CategoricalMarkerMapper = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalMarkerMapper, _super);\n function CategoricalMarkerMapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n CategoricalMarkerMapper.initClass = function () {\n this.prototype.type = \"CategoricalMarkerMapper\";\n this.define({\n factors: [p.Array],\n markers: [p.Array],\n start: [p.Number, 0],\n end: [p.Number],\n default_value: [p.String, \"circle\"],\n });\n };\n CategoricalMarkerMapper.prototype.v_compute = function (xs) {\n var values = new Array(xs.length);\n categorical_mapper_1.cat_v_compute(xs, this.factors, this.markers, values, this.start, this.end, this.default_value);\n return values;\n };\n return CategoricalMarkerMapper;\n }(mapper_1.Mapper));\n exports.CategoricalMarkerMapper = CategoricalMarkerMapper;\n CategoricalMarkerMapper.initClass();\n}\n","/* models/mappers/color_mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var mapper_1 = require(169) /* ./mapper */;\n var p = require(15) /* core/properties */;\n var color_1 = require(27) /* core/util/color */;\n var compat_1 = require(28) /* core/util/compat */;\n function _convert_color(color) {\n if (color[0] != \"#\")\n color = color_1.color2hex(color);\n if (color.length != 9)\n color = color + 'ff';\n return parseInt(color.slice(1), 16);\n }\n exports._convert_color = _convert_color;\n function _convert_palette(palette) {\n var new_palette = new Uint32Array(palette.length);\n for (var i = 0, end = palette.length; i < end; i++)\n new_palette[i] = _convert_color(palette[i]);\n return new_palette;\n }\n exports._convert_palette = _convert_palette;\n function _uint32_to_rgba(values) {\n if (compat_1.is_little_endian) {\n var view = new DataView(values.buffer);\n for (var i = 0, end = values.length; i < end; i++)\n view.setUint32(i * 4, values[i]);\n }\n return new Uint8Array(values.buffer);\n }\n exports._uint32_to_rgba = _uint32_to_rgba;\n var ColorMapper = /** @class */ (function (_super) {\n tslib_1.__extends(ColorMapper, _super);\n function ColorMapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n ColorMapper.initClass = function () {\n this.prototype.type = \"ColorMapper\";\n this.define({\n palette: [p.Any],\n nan_color: [p.Color, \"gray\"],\n });\n };\n ColorMapper.prototype.v_compute = function (xs) {\n var values = new Array(xs.length);\n this._v_compute(xs, values, this.palette, this._colors(function (c) { return c; }));\n return values;\n };\n Object.defineProperty(ColorMapper.prototype, \"rgba_mapper\", {\n get: function () {\n var self = this;\n var palette = _convert_palette(this.palette);\n var colors = this._colors(_convert_color);\n return {\n v_compute: function (xs) {\n var values = new Uint32Array(xs.length);\n self._v_compute(xs, values, palette, colors);\n return _uint32_to_rgba(values);\n },\n };\n },\n enumerable: true,\n configurable: true\n });\n ColorMapper.prototype._colors = function (conv) {\n return { nan_color: conv(this.nan_color) };\n };\n return ColorMapper;\n }(mapper_1.Mapper));\n exports.ColorMapper = ColorMapper;\n ColorMapper.initClass();\n}\n","/* models/mappers/continuous_color_mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var color_mapper_1 = require(164) /* ./color_mapper */;\n var p = require(15) /* core/properties */;\n var ContinuousColorMapper = /** @class */ (function (_super) {\n tslib_1.__extends(ContinuousColorMapper, _super);\n function ContinuousColorMapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n ContinuousColorMapper.initClass = function () {\n this.prototype.type = \"ContinuousColorMapper\";\n this.define({\n high: [p.Number],\n low: [p.Number],\n high_color: [p.Color],\n low_color: [p.Color],\n });\n };\n ContinuousColorMapper.prototype._colors = function (conv) {\n return tslib_1.__assign({}, _super.prototype._colors.call(this, conv), { low_color: this.low_color != null ? conv(this.low_color) : undefined, high_color: this.high_color != null ? conv(this.high_color) : undefined });\n };\n return ContinuousColorMapper;\n }(color_mapper_1.ColorMapper));\n exports.ContinuousColorMapper = ContinuousColorMapper;\n ContinuousColorMapper.initClass();\n}\n","/* models/mappers/index */ function _(require, module, exports) {\n var categorical_color_mapper_1 = require(161) /* ./categorical_color_mapper */;\n exports.CategoricalColorMapper = categorical_color_mapper_1.CategoricalColorMapper;\n var categorical_marker_mapper_1 = require(163) /* ./categorical_marker_mapper */;\n exports.CategoricalMarkerMapper = categorical_marker_mapper_1.CategoricalMarkerMapper;\n var continuous_color_mapper_1 = require(165) /* ./continuous_color_mapper */;\n exports.ContinuousColorMapper = continuous_color_mapper_1.ContinuousColorMapper;\n var color_mapper_1 = require(164) /* ./color_mapper */;\n exports.ColorMapper = color_mapper_1.ColorMapper;\n var linear_color_mapper_1 = require(167) /* ./linear_color_mapper */;\n exports.LinearColorMapper = linear_color_mapper_1.LinearColorMapper;\n var log_color_mapper_1 = require(168) /* ./log_color_mapper */;\n exports.LogColorMapper = log_color_mapper_1.LogColorMapper;\n}\n","/* models/mappers/linear_color_mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var continuous_color_mapper_1 = require(165) /* ./continuous_color_mapper */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var LinearColorMapper = /** @class */ (function (_super) {\n tslib_1.__extends(LinearColorMapper, _super);\n function LinearColorMapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n LinearColorMapper.initClass = function () {\n this.prototype.type = \"LinearColorMapper\";\n };\n LinearColorMapper.prototype._v_compute = function (data, values, palette, colors) {\n var nan_color = colors.nan_color, low_color = colors.low_color, high_color = colors.high_color;\n var low = this.low != null ? this.low : arrayable_1.min(data);\n var high = this.high != null ? this.high : arrayable_1.max(data);\n var max_key = palette.length - 1;\n var norm_factor = 1 / (high - low);\n var normed_interval = 1 / palette.length;\n for (var i = 0, end = data.length; i < end; i++) {\n var d = data[i];\n if (isNaN(d)) {\n values[i] = nan_color;\n continue;\n }\n // This handles the edge case where d == high, since the code below maps\n // values exactly equal to high to palette.length, which is greater than\n // max_key\n if (d == high) {\n values[i] = palette[max_key];\n continue;\n }\n var normed_d = (d - low) * norm_factor;\n var key = Math.floor(normed_d / normed_interval);\n if (key < 0)\n values[i] = low_color != null ? low_color : palette[0];\n else if (key > max_key)\n values[i] = high_color != null ? high_color : palette[max_key];\n else\n values[i] = palette[key];\n }\n };\n return LinearColorMapper;\n }(continuous_color_mapper_1.ContinuousColorMapper));\n exports.LinearColorMapper = LinearColorMapper;\n LinearColorMapper.initClass();\n}\n","/* models/mappers/log_color_mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var continuous_color_mapper_1 = require(165) /* ./continuous_color_mapper */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n // Math.log1p() is not supported by any version of IE, so let's use a polyfill based on\n // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/log1p.\n var log1p = Math.log1p != null ? Math.log1p : function (x) { return Math.log(1 + x); };\n var LogColorMapper = /** @class */ (function (_super) {\n tslib_1.__extends(LogColorMapper, _super);\n function LogColorMapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n LogColorMapper.initClass = function () {\n this.prototype.type = \"LogColorMapper\";\n };\n LogColorMapper.prototype._v_compute = function (data, values, palette, colors) {\n var nan_color = colors.nan_color, low_color = colors.low_color, high_color = colors.high_color;\n var n = palette.length;\n var low = this.low != null ? this.low : arrayable_1.min(data);\n var high = this.high != null ? this.high : arrayable_1.max(data);\n var scale = n / (log1p(high) - log1p(low)); // subtract the low offset\n var max_key = palette.length - 1;\n for (var i = 0, end = data.length; i < end; i++) {\n var d = data[i];\n // Check NaN\n if (isNaN(d)) {\n values[i] = nan_color;\n continue;\n }\n if (d > high) {\n values[i] = high_color != null ? high_color : palette[max_key];\n continue;\n }\n // This handles the edge case where d == high, since the code below maps\n // values exactly equal to high to palette.length, which is greater than\n // max_key\n if (d == high) {\n values[i] = palette[max_key];\n continue;\n }\n if (d < low) {\n values[i] = low_color != null ? low_color : palette[0];\n continue;\n }\n // Get the key\n var log = log1p(d) - log1p(low); // subtract the low offset\n var key = Math.floor(log * scale);\n // Deal with upper bound\n if (key > max_key)\n key = max_key;\n values[i] = palette[key];\n }\n };\n return LogColorMapper;\n }(continuous_color_mapper_1.ContinuousColorMapper));\n exports.LogColorMapper = LogColorMapper;\n LogColorMapper.initClass();\n}\n","/* models/mappers/mapper */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var transform_1 = require(279) /* ../transforms/transform */;\n var Mapper = /** @class */ (function (_super) {\n tslib_1.__extends(Mapper, _super);\n function Mapper(attrs) {\n return _super.call(this, attrs) || this;\n }\n Mapper.initClass = function () {\n this.prototype.type = \"Mapper\";\n };\n Mapper.prototype.compute = function (_x) {\n // If it's just a single value, then a mapper doesn't really make sense.\n throw new Error(\"mapping single values is not supported\");\n };\n return Mapper;\n }(transform_1.Transform));\n exports.Mapper = Mapper;\n Mapper.initClass();\n}\n","/* models/markers/defs */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var marker_1 = require(172) /* ./marker */;\n var SQ3 = Math.sqrt(3);\n function _one_line(ctx, r) {\n ctx.moveTo(-r, 0);\n ctx.lineTo(r, 0);\n }\n function _one_x(ctx, r) {\n ctx.moveTo(-r, r);\n ctx.lineTo(r, -r);\n ctx.moveTo(-r, -r);\n ctx.lineTo(r, r);\n }\n function _one_cross(ctx, r) {\n ctx.moveTo(0, r);\n ctx.lineTo(0, -r);\n ctx.moveTo(-r, 0);\n ctx.lineTo(r, 0);\n }\n function _one_diamond(ctx, r) {\n ctx.moveTo(0, r);\n ctx.lineTo(r / 1.5, 0);\n ctx.lineTo(0, -r);\n ctx.lineTo(-r / 1.5, 0);\n ctx.closePath();\n }\n function _one_hex(ctx, r) {\n var r2 = r / 2;\n var h = SQ3 * r2;\n ctx.moveTo(r, 0);\n ctx.lineTo(r2, -h);\n ctx.lineTo(-r2, -h);\n ctx.lineTo(-r, 0);\n ctx.lineTo(-r2, h);\n ctx.lineTo(r2, h);\n ctx.closePath();\n }\n function _one_tri(ctx, r) {\n var h = r * SQ3;\n var a = h / 3;\n ctx.moveTo(-r, a);\n ctx.lineTo(r, a);\n ctx.lineTo(0, a - h);\n ctx.closePath();\n }\n function asterisk(ctx, i, r, line, _fill) {\n var r2 = r * 0.65;\n _one_cross(ctx, r);\n _one_x(ctx, r2);\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function circle(ctx, i, r, line, fill) {\n ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function circle_cross(ctx, i, r, line, fill) {\n ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n _one_cross(ctx, r);\n ctx.stroke();\n }\n }\n function circle_x(ctx, i, r, line, fill) {\n ctx.arc(0, 0, r, 0, 2 * Math.PI, false);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n _one_x(ctx, r);\n ctx.stroke();\n }\n }\n function cross(ctx, i, r, line, _fill) {\n _one_cross(ctx, r);\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function diamond(ctx, i, r, line, fill) {\n _one_diamond(ctx, r);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function diamond_cross(ctx, i, r, line, fill) {\n _one_diamond(ctx, r);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n _one_cross(ctx, r);\n ctx.stroke();\n }\n }\n function hex(ctx, i, r, line, fill) {\n _one_hex(ctx, r);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function inverted_triangle(ctx, i, r, line, fill) {\n ctx.rotate(Math.PI);\n _one_tri(ctx, r);\n ctx.rotate(-Math.PI);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function square(ctx, i, r, line, fill) {\n var size = 2 * r;\n ctx.rect(-r, -r, size, size);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function square_cross(ctx, i, r, line, fill) {\n var size = 2 * r;\n ctx.rect(-r, -r, size, size);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n _one_cross(ctx, r);\n ctx.stroke();\n }\n }\n function square_x(ctx, i, r, line, fill) {\n var size = 2 * r;\n ctx.rect(-r, -r, size, size);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n _one_x(ctx, r);\n ctx.stroke();\n }\n }\n function triangle(ctx, i, r, line, fill) {\n _one_tri(ctx, r);\n if (fill.doit) {\n fill.set_vectorize(ctx, i);\n ctx.fill();\n }\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function dash(ctx, i, r, line, _fill) {\n _one_line(ctx, r);\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function x(ctx, i, r, line, _fill) {\n _one_x(ctx, r);\n if (line.doit) {\n line.set_vectorize(ctx, i);\n ctx.stroke();\n }\n }\n function _mk_model(type, f) {\n var view = /** @class */ (function (_super) {\n tslib_1.__extends(class_1, _super);\n function class_1() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n class_1.initClass = function () {\n this.prototype._render_one = f;\n };\n return class_1;\n }(marker_1.MarkerView));\n view.initClass();\n var model = /** @class */ (function (_super) {\n tslib_1.__extends(class_2, _super);\n function class_2() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n class_2.initClass = function () {\n this.prototype.default_view = view;\n this.prototype.type = type;\n };\n return class_2;\n }(marker_1.Marker));\n model.initClass();\n return model;\n }\n // markers are final, so no need to export views\n exports.Asterisk = _mk_model('Asterisk', asterisk);\n exports.CircleCross = _mk_model('CircleCross', circle_cross);\n exports.CircleX = _mk_model('CircleX', circle_x);\n exports.Cross = _mk_model('Cross', cross);\n exports.Diamond = _mk_model('Diamond', diamond);\n exports.DiamondCross = _mk_model('DiamondCross', diamond_cross);\n exports.Hex = _mk_model('Hex', hex);\n exports.InvertedTriangle = _mk_model('InvertedTriangle', inverted_triangle);\n exports.Square = _mk_model('Square', square);\n exports.SquareCross = _mk_model('SquareCross', square_cross);\n exports.SquareX = _mk_model('SquareX', square_x);\n exports.Triangle = _mk_model('Triangle', triangle);\n exports.Dash = _mk_model('Dash', dash);\n exports.X = _mk_model('X', x);\n exports.marker_funcs = {\n asterisk: asterisk,\n circle: circle,\n circle_cross: circle_cross,\n circle_x: circle_x,\n cross: cross,\n diamond: diamond,\n diamond_cross: diamond_cross,\n hex: hex,\n inverted_triangle: inverted_triangle,\n square: square,\n square_cross: square_cross,\n square_x: square_x,\n triangle: triangle,\n dash: dash,\n x: x,\n };\n}\n","/* models/markers/index */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n tslib_1.__exportStar(require(170) /* ./defs */, exports);\n var scatter_1 = require(173) /* ./scatter */;\n exports.Scatter = scatter_1.Scatter;\n}\n","/* models/markers/marker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var xy_glyph_1 = require(146) /* ../glyphs/xy_glyph */;\n var hittest = require(9) /* core/hittest */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var MarkerView = /** @class */ (function (_super) {\n tslib_1.__extends(MarkerView, _super);\n function MarkerView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n MarkerView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, _size = _a._size, _angle = _a._angle;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]))\n continue;\n var r = _size[i] / 2;\n ctx.beginPath();\n ctx.translate(sx[i], sy[i]);\n if (_angle[i])\n ctx.rotate(_angle[i]);\n this._render_one(ctx, i, r, this.visuals.line, this.visuals.fill);\n if (_angle[i])\n ctx.rotate(-_angle[i]);\n ctx.translate(-sx[i], -sy[i]);\n }\n };\n MarkerView.prototype._mask_data = function () {\n // dilate the inner screen region by max_size and map back to data space for use in\n // spatial query\n var hr = this.renderer.plot_view.frame.bbox.h_range;\n var sx0 = hr.start - this.max_size;\n var sx1 = hr.end + this.max_size;\n var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var vr = this.renderer.plot_view.frame.bbox.v_range;\n var sy0 = vr.start - this.max_size;\n var sy1 = vr.end + this.max_size;\n var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n return this.index.indices(bbox);\n };\n MarkerView.prototype._hit_point = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n var sx0 = sx - this.max_size;\n var sx1 = sx + this.max_size;\n var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var sy0 = sy - this.max_size;\n var sy1 = sy + this.max_size;\n var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var candidates = this.index.indices(bbox);\n var hits = [];\n for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {\n var i = candidates_1[_i];\n var s2 = this._size[i] / 2;\n var dist = Math.abs(this.sx[i] - sx) + Math.abs(this.sy[i] - sy);\n if (Math.abs(this.sx[i] - sx) <= s2 && Math.abs(this.sy[i] - sy) <= s2) {\n hits.push([i, dist]);\n }\n }\n return hittest.create_hit_test_result_from_hits(hits);\n };\n MarkerView.prototype._hit_span = function (geometry) {\n var _a, _b;\n var sx = geometry.sx, sy = geometry.sy;\n var _c = this.bounds(), minX = _c.minX, minY = _c.minY, maxX = _c.maxX, maxY = _c.maxY;\n var result = hittest.create_empty_hit_test_result();\n var x0, x1;\n var y0, y1;\n if (geometry.direction == 'h') {\n y0 = minY;\n y1 = maxY;\n var ms = this.max_size / 2;\n var sx0 = sx - ms;\n var sx1 = sx + ms;\n _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n }\n else {\n x0 = minX;\n x1 = maxX;\n var ms = this.max_size / 2;\n var sy0 = sy - ms;\n var sy1 = sy + ms;\n _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n }\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var hits = this.index.indices(bbox);\n result.indices = hits;\n return result;\n };\n MarkerView.prototype._hit_rect = function (geometry) {\n var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1;\n var _a = this.renderer.xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var _b = this.renderer.yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var bbox = hittest.validate_bbox_coords([x0, x1], [y0, y1]);\n var result = hittest.create_empty_hit_test_result();\n result.indices = this.index.indices(bbox);\n return result;\n };\n MarkerView.prototype._hit_poly = function (geometry) {\n var sx = geometry.sx, sy = geometry.sy;\n // TODO (bev) use spatial index to pare candidate list\n var candidates = array_1.range(0, this.sx.length);\n var hits = [];\n for (var i = 0, end = candidates.length; i < end; i++) {\n var idx = candidates[i];\n if (hittest.point_in_poly(this.sx[i], this.sy[i], sx, sy))\n hits.push(idx);\n }\n var result = hittest.create_empty_hit_test_result();\n result.indices = hits;\n return result;\n };\n MarkerView.prototype.draw_legend_for_index = function (ctx, _a, index) {\n var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1;\n // using objects like this seems a little wonky, since the keys are coerced to\n // stings, but it works\n var len = index + 1;\n var sx = new Array(len);\n sx[index] = (x0 + x1) / 2;\n var sy = new Array(len);\n sy[index] = (y0 + y1) / 2;\n var size = new Array(len);\n size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4;\n var angle = new Array(len);\n angle[index] = 0; // don't attempt to match glyph angle\n this._render(ctx, [index], { sx: sx, sy: sy, _size: size, _angle: angle }); // XXX\n };\n return MarkerView;\n }(xy_glyph_1.XYGlyphView));\n exports.MarkerView = MarkerView;\n var Marker = /** @class */ (function (_super) {\n tslib_1.__extends(Marker, _super);\n function Marker(attrs) {\n return _super.call(this, attrs) || this;\n }\n Marker.initClass = function () {\n this.mixins(['line', 'fill']);\n this.define({\n size: [p.DistanceSpec, { units: \"screen\", value: 4 }],\n angle: [p.AngleSpec, 0],\n });\n };\n return Marker;\n }(xy_glyph_1.XYGlyph));\n exports.Marker = Marker;\n Marker.initClass();\n}\n","/* models/markers/scatter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var marker_1 = require(172) /* ./marker */;\n var defs_1 = require(170) /* ./defs */;\n var p = require(15) /* core/properties */;\n var ScatterView = /** @class */ (function (_super) {\n tslib_1.__extends(ScatterView, _super);\n function ScatterView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ScatterView.prototype._render = function (ctx, indices, _a) {\n var sx = _a.sx, sy = _a.sy, _size = _a._size, _angle = _a._angle, _marker = _a._marker;\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var i = indices_1[_i];\n if (isNaN(sx[i] + sy[i] + _size[i] + _angle[i]))\n continue;\n var r = _size[i] / 2;\n ctx.beginPath();\n ctx.translate(sx[i], sy[i]);\n if (_angle[i])\n ctx.rotate(_angle[i]);\n defs_1.marker_funcs[_marker[i]](ctx, i, r, this.visuals.line, this.visuals.fill);\n if (_angle[i])\n ctx.rotate(-_angle[i]);\n ctx.translate(-sx[i], -sy[i]);\n }\n };\n ScatterView.prototype.draw_legend_for_index = function (ctx, _a, index) {\n var x0 = _a.x0, x1 = _a.x1, y0 = _a.y0, y1 = _a.y1;\n // using objects like this seems a little wonky, since the keys are coerced to\n // stings, but it works\n var len = index + 1;\n var sx = new Array(len);\n sx[index] = (x0 + x1) / 2;\n var sy = new Array(len);\n sy[index] = (y0 + y1) / 2;\n var size = new Array(len);\n size[index] = Math.min(Math.abs(x1 - x0), Math.abs(y1 - y0)) * 0.4;\n var angle = new Array(len);\n angle[index] = 0; // don't attempt to match glyph angle\n var marker = new Array(len);\n marker[index] = this._marker[index];\n this._render(ctx, [index], { sx: sx, sy: sy, _size: size, _angle: angle, _marker: marker }); // XXX\n };\n return ScatterView;\n }(marker_1.MarkerView));\n exports.ScatterView = ScatterView;\n var Scatter = /** @class */ (function (_super) {\n tslib_1.__extends(Scatter, _super);\n function Scatter(attrs) {\n return _super.call(this, attrs) || this;\n }\n Scatter.initClass = function () {\n this.prototype.type = 'Scatter';\n this.prototype.default_view = ScatterView;\n this.define({\n marker: [p.MarkerSpec, { value: \"circle\" }],\n });\n };\n return Scatter;\n }(marker_1.Marker));\n exports.Scatter = Scatter;\n Scatter.initClass();\n}\n","/* models/plots/gmap_plot */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var logging_1 = require(14) /* core/logging */;\n var gmap_plot_canvas_1 = require(175) /* ./gmap_plot_canvas */;\n var plot_1 = require(177) /* ./plot */;\n var p = require(15) /* core/properties */;\n var model_1 = require(59) /* ../../model */;\n var range1d_1 = require(184) /* ../ranges/range1d */;\n var MapOptions = /** @class */ (function (_super) {\n tslib_1.__extends(MapOptions, _super);\n function MapOptions(attrs) {\n return _super.call(this, attrs) || this;\n }\n MapOptions.initClass = function () {\n this.prototype.type = \"MapOptions\";\n this.define({\n lat: [p.Number],\n lng: [p.Number],\n zoom: [p.Number, 12],\n });\n };\n return MapOptions;\n }(model_1.Model));\n exports.MapOptions = MapOptions;\n MapOptions.initClass();\n var GMapOptions = /** @class */ (function (_super) {\n tslib_1.__extends(GMapOptions, _super);\n function GMapOptions(attrs) {\n return _super.call(this, attrs) || this;\n }\n GMapOptions.initClass = function () {\n this.prototype.type = \"GMapOptions\";\n this.define({\n map_type: [p.String, \"roadmap\"],\n scale_control: [p.Bool, false],\n styles: [p.String],\n tilt: [p.Int, 45],\n });\n };\n return GMapOptions;\n }(MapOptions));\n exports.GMapOptions = GMapOptions;\n GMapOptions.initClass();\n var GMapPlotView = /** @class */ (function (_super) {\n tslib_1.__extends(GMapPlotView, _super);\n function GMapPlotView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return GMapPlotView;\n }(plot_1.PlotView));\n exports.GMapPlotView = GMapPlotView;\n var GMapPlot = /** @class */ (function (_super) {\n tslib_1.__extends(GMapPlot, _super);\n function GMapPlot(attrs) {\n return _super.call(this, attrs) || this;\n }\n GMapPlot.initClass = function () {\n this.prototype.type = \"GMapPlot\";\n this.prototype.default_view = GMapPlotView;\n // Set all the PlotCanvas properties as internal.\n // This seems to be necessary so that everything can initialize.\n // Feels very clumsy, but I'm not sure how the properties system wants\n // to handle something like this situation.\n this.define({\n map_options: [p.Instance],\n api_key: [p.String],\n });\n this.override({\n x_range: function () { return new range1d_1.Range1d(); },\n y_range: function () { return new range1d_1.Range1d(); },\n });\n };\n GMapPlot.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n if (!this.api_key)\n logging_1.logger.error(\"api_key is required. See https://developers.google.com/maps/documentation/javascript/get-api-key for more information on how to obtain your own.\");\n };\n GMapPlot.prototype._init_plot_canvas = function () {\n return new gmap_plot_canvas_1.GMapPlotCanvas({ plot: this });\n };\n return GMapPlot;\n }(plot_1.Plot));\n exports.GMapPlot = GMapPlot;\n GMapPlot.initClass();\n}\n","/* models/plots/gmap_plot_canvas */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var signaling_1 = require(19) /* core/signaling */;\n var projections_1 = require(33) /* core/util/projections */;\n var plot_canvas_1 = require(178) /* ./plot_canvas */;\n var gmaps_ready = new signaling_1.Signal0({}, \"gmaps_ready\");\n var load_google_api = function (api_key) {\n _bokeh_gmaps_callback = function () { return gmaps_ready.emit(); };\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = \"https://maps.googleapis.com/maps/api/js?key=\" + api_key + \"&callback=_bokeh_gmaps_callback\";\n document.body.appendChild(script);\n };\n var GMapPlotCanvasView = /** @class */ (function (_super) {\n tslib_1.__extends(GMapPlotCanvasView, _super);\n function GMapPlotCanvasView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n GMapPlotCanvasView.prototype.initialize = function (options) {\n var _this = this;\n this.pause();\n _super.prototype.initialize.call(this, options);\n this._tiles_loaded = false;\n this.zoom_count = 0;\n var _a = this.model.plot.map_options, zoom = _a.zoom, lat = _a.lat, lng = _a.lng;\n this.initial_zoom = zoom;\n this.initial_lat = lat;\n this.initial_lng = lng;\n this.canvas_view.map_el.style.position = \"absolute\";\n if (typeof google === \"undefined\" || google.maps == null) {\n if (typeof _bokeh_gmaps_callback === \"undefined\") {\n load_google_api(this.model.plot.api_key);\n }\n gmaps_ready.connect(function () { return _this.request_render(); });\n }\n this.unpause();\n };\n GMapPlotCanvasView.prototype.update_range = function (range_info) {\n // RESET -------------------------\n if (range_info == null) {\n this.map.setCenter({ lat: this.initial_lat, lng: this.initial_lng });\n this.map.setOptions({ zoom: this.initial_zoom });\n _super.prototype.update_range.call(this, null);\n // PAN ----------------------------\n }\n else if (range_info.sdx != null || range_info.sdy != null) {\n this.map.panBy(range_info.sdx || 0, range_info.sdy || 0);\n _super.prototype.update_range.call(this, range_info);\n // ZOOM ---------------------------\n }\n else if (range_info.factor != null) {\n // The zoom count decreases the sensitivity of the zoom. (We could make this user configurable)\n var zoom_change = void 0;\n if (this.zoom_count !== 10) {\n this.zoom_count += 1;\n return;\n }\n this.zoom_count = 0;\n this.pause();\n _super.prototype.update_range.call(this, range_info);\n if (range_info.factor < 0)\n zoom_change = -1;\n else\n zoom_change = 1;\n var old_map_zoom = this.map.getZoom();\n var new_map_zoom = old_map_zoom + zoom_change;\n // Zooming out too far causes problems\n if (new_map_zoom >= 2) {\n this.map.setZoom(new_map_zoom);\n // Check we haven't gone out of bounds, and if we have undo the zoom\n var _a = this._get_projected_bounds(), proj_xstart = _a[0], proj_xend = _a[1];\n if (proj_xend - proj_xstart < 0) {\n this.map.setZoom(old_map_zoom);\n }\n }\n this.unpause();\n }\n // Finally re-center\n this._set_bokeh_ranges();\n };\n GMapPlotCanvasView.prototype._build_map = function () {\n var _this = this;\n var maps = google.maps;\n this.map_types = {\n satellite: maps.MapTypeId.SATELLITE,\n terrain: maps.MapTypeId.TERRAIN,\n roadmap: maps.MapTypeId.ROADMAP,\n hybrid: maps.MapTypeId.HYBRID,\n };\n var mo = this.model.plot.map_options;\n var map_options = {\n center: new maps.LatLng(mo.lat, mo.lng),\n zoom: mo.zoom,\n disableDefaultUI: true,\n mapTypeId: this.map_types[mo.map_type],\n scaleControl: mo.scale_control,\n tilt: mo.tilt,\n };\n if (mo.styles != null)\n map_options.styles = JSON.parse(mo.styles);\n // create the map with above options in div\n this.map = new maps.Map(this.canvas_view.map_el, map_options);\n // update bokeh ranges whenever the map idles, which should be after most UI action\n maps.event.addListener(this.map, 'idle', function () { return _this._set_bokeh_ranges(); });\n // also need an event when bounds change so that map resizes trigger renders too\n maps.event.addListener(this.map, 'bounds_changed', function () { return _this._set_bokeh_ranges(); });\n maps.event.addListenerOnce(this.map, 'tilesloaded', function () { return _this._render_finished(); });\n // wire up listeners so that changes to properties are reflected\n this.connect(this.model.plot.properties.map_options.change, function () { return _this._update_options(); });\n this.connect(this.model.plot.map_options.properties.styles.change, function () { return _this._update_styles(); });\n this.connect(this.model.plot.map_options.properties.lat.change, function () { return _this._update_center('lat'); });\n this.connect(this.model.plot.map_options.properties.lng.change, function () { return _this._update_center('lng'); });\n this.connect(this.model.plot.map_options.properties.zoom.change, function () { return _this._update_zoom(); });\n this.connect(this.model.plot.map_options.properties.map_type.change, function () { return _this._update_map_type(); });\n this.connect(this.model.plot.map_options.properties.scale_control.change, function () { return _this._update_scale_control(); });\n this.connect(this.model.plot.map_options.properties.tilt.change, function () { return _this._update_tilt(); });\n };\n GMapPlotCanvasView.prototype._render_finished = function () {\n this._tiles_loaded = true;\n this.notify_finished();\n };\n GMapPlotCanvasView.prototype.has_finished = function () {\n return _super.prototype.has_finished.call(this) && this._tiles_loaded === true;\n };\n GMapPlotCanvasView.prototype._get_latlon_bounds = function () {\n var bounds = this.map.getBounds();\n var top_right = bounds.getNorthEast();\n var bottom_left = bounds.getSouthWest();\n var xstart = bottom_left.lng();\n var xend = top_right.lng();\n var ystart = bottom_left.lat();\n var yend = top_right.lat();\n return [xstart, xend, ystart, yend];\n };\n GMapPlotCanvasView.prototype._get_projected_bounds = function () {\n var _a = this._get_latlon_bounds(), xstart = _a[0], xend = _a[1], ystart = _a[2], yend = _a[3];\n var _b = projections_1.wgs84_mercator.forward([xstart, ystart]), proj_xstart = _b[0], proj_ystart = _b[1];\n var _c = projections_1.wgs84_mercator.forward([xend, yend]), proj_xend = _c[0], proj_yend = _c[1];\n return [proj_xstart, proj_xend, proj_ystart, proj_yend];\n };\n GMapPlotCanvasView.prototype._set_bokeh_ranges = function () {\n var _a = this._get_projected_bounds(), proj_xstart = _a[0], proj_xend = _a[1], proj_ystart = _a[2], proj_yend = _a[3];\n this.frame.x_range.setv({ start: proj_xstart, end: proj_xend });\n this.frame.y_range.setv({ start: proj_ystart, end: proj_yend });\n };\n GMapPlotCanvasView.prototype._update_center = function (fld) {\n var c = this.map.getCenter().toJSON();\n c[fld] = this.model.plot.map_options[fld];\n this.map.setCenter(c);\n this._set_bokeh_ranges();\n };\n GMapPlotCanvasView.prototype._update_map_type = function () {\n this.map.setOptions({ mapTypeId: this.map_types[this.model.plot.map_options.map_type] });\n };\n GMapPlotCanvasView.prototype._update_scale_control = function () {\n this.map.setOptions({ scaleControl: this.model.plot.map_options.scale_control });\n };\n GMapPlotCanvasView.prototype._update_tilt = function () {\n this.map.setOptions({ tilt: this.model.plot.map_options.tilt });\n };\n GMapPlotCanvasView.prototype._update_options = function () {\n this._update_styles();\n this._update_center('lat');\n this._update_center('lng');\n this._update_zoom();\n this._update_map_type();\n };\n GMapPlotCanvasView.prototype._update_styles = function () {\n this.map.setOptions({ styles: JSON.parse(this.model.plot.map_options.styles) });\n };\n GMapPlotCanvasView.prototype._update_zoom = function () {\n this.map.setOptions({ zoom: this.model.plot.map_options.zoom });\n this._set_bokeh_ranges();\n };\n // this method is expected and called by PlotCanvasView.render\n GMapPlotCanvasView.prototype._map_hook = function (_ctx, frame_box) {\n var left = frame_box[0], top = frame_box[1], width = frame_box[2], height = frame_box[3];\n this.canvas_view.map_el.style.top = top + \"px\";\n this.canvas_view.map_el.style.left = left + \"px\";\n this.canvas_view.map_el.style.width = width + \"px\";\n this.canvas_view.map_el.style.height = height + \"px\";\n if (this.map == null && typeof google !== \"undefined\" && google.maps != null)\n this._build_map();\n };\n // this overrides the standard _paint_empty to make the inner canvas transparent\n GMapPlotCanvasView.prototype._paint_empty = function (ctx, frame_box) {\n var ow = this.canvas._width.value;\n var oh = this.canvas._height.value;\n var left = frame_box[0], top = frame_box[1], iw = frame_box[2], ih = frame_box[3];\n ctx.clearRect(0, 0, ow, oh);\n ctx.beginPath();\n ctx.moveTo(0, 0);\n ctx.lineTo(0, oh);\n ctx.lineTo(ow, oh);\n ctx.lineTo(ow, 0);\n ctx.lineTo(0, 0);\n ctx.moveTo(left, top);\n ctx.lineTo(left + iw, top);\n ctx.lineTo(left + iw, top + ih);\n ctx.lineTo(left, top + ih);\n ctx.lineTo(left, top);\n ctx.closePath();\n ctx.fillStyle = this.model.plot.border_fill_color;\n ctx.fill();\n };\n return GMapPlotCanvasView;\n }(plot_canvas_1.PlotCanvasView));\n exports.GMapPlotCanvasView = GMapPlotCanvasView;\n var GMapPlotCanvas = /** @class */ (function (_super) {\n tslib_1.__extends(GMapPlotCanvas, _super);\n function GMapPlotCanvas(attrs) {\n return _super.call(this, attrs) || this;\n }\n GMapPlotCanvas.initClass = function () {\n this.prototype.type = 'GMapPlotCanvas';\n this.prototype.default_view = GMapPlotCanvasView;\n };\n GMapPlotCanvas.prototype.initialize = function () {\n this.use_map = true;\n _super.prototype.initialize.call(this);\n };\n return GMapPlotCanvas;\n }(plot_canvas_1.PlotCanvas));\n exports.GMapPlotCanvas = GMapPlotCanvas;\n GMapPlotCanvas.initClass();\n}\n","/* models/plots/index */ function _(require, module, exports) {\n var gmap_plot_1 = require(174) /* ./gmap_plot */;\n exports.MapOptions = gmap_plot_1.MapOptions;\n var gmap_plot_2 = require(174) /* ./gmap_plot */;\n exports.GMapOptions = gmap_plot_2.GMapOptions;\n var gmap_plot_3 = require(174) /* ./gmap_plot */;\n exports.GMapPlot = gmap_plot_3.GMapPlot;\n var gmap_plot_canvas_1 = require(175) /* ./gmap_plot_canvas */;\n exports.GMapPlotCanvas = gmap_plot_canvas_1.GMapPlotCanvas;\n var plot_1 = require(177) /* ./plot */;\n exports.Plot = plot_1.Plot;\n var plot_canvas_1 = require(178) /* ./plot_canvas */;\n exports.PlotCanvas = plot_canvas_1.PlotCanvas;\n}\n","/* models/plots/plot */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var solver_1 = require(13) /* core/layout/solver */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var signaling_1 = require(19) /* core/signaling */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var types_1 = require(44) /* core/util/types */;\n var layout_dom_1 = require(157) /* ../layouts/layout_dom */;\n var title_1 = require(75) /* ../annotations/title */;\n var linear_scale_1 = require(192) /* ../scales/linear_scale */;\n var toolbar_1 = require(268) /* ../tools/toolbar */;\n var toolbar_panel_1 = require(76) /* ../annotations/toolbar_panel */;\n var plot_canvas_1 = require(178) /* ./plot_canvas */;\n var column_data_source_1 = require(200) /* ../sources/column_data_source */;\n var glyph_renderer_1 = require(185) /* ../renderers/glyph_renderer */;\n var bokeh_events_1 = require(3) /* core/bokeh_events */;\n var data_range1d_1 = require(180) /* ../ranges/data_range1d */;\n var PlotView = /** @class */ (function (_super) {\n tslib_1.__extends(PlotView, _super);\n function PlotView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PlotView.prototype.connect_signals = function () {\n _super.prototype.connect_signals.call(this);\n // Note: Title object cannot be replaced after initialization, similar to axes, and also\n // not being able to change the sizing_mode. All of these changes require a re-initialization\n // of all constraints which we don't currently support.\n var title_msg = \"Title object cannot be replaced. Try changing properties on title to update it after initialization.\";\n this.connect(this.model.properties.title.change, function () { return logging_1.logger.warn(title_msg); });\n };\n PlotView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-plot-layout\");\n };\n PlotView.prototype.get_height = function () {\n return this.model._width.value / this.model.get_aspect_ratio();\n };\n PlotView.prototype.get_width = function () {\n return this.model._height.value * this.model.get_aspect_ratio();\n };\n PlotView.prototype.save = function (name) {\n this.plot_canvas_view.save(name);\n };\n Object.defineProperty(PlotView.prototype, \"plot_canvas_view\", {\n get: function () {\n // XXX: PlotCanvasView is not LayoutDOMView\n return this.child_views[this.model.plot_canvas.id];\n },\n enumerable: true,\n configurable: true\n });\n return PlotView;\n }(layout_dom_1.LayoutDOMView));\n exports.PlotView = PlotView;\n var Plot = /** @class */ (function (_super) {\n tslib_1.__extends(Plot, _super);\n function Plot(attrs) {\n return _super.call(this, attrs) || this;\n }\n Plot.initClass = function () {\n this.prototype.type = \"Plot\";\n this.prototype.default_view = PlotView;\n this.mixins([\"line:outline_\", \"fill:background_\", \"fill:border_\"]);\n this.define({\n toolbar: [p.Instance, function () { return new toolbar_1.Toolbar(); }],\n toolbar_location: [p.Location, 'right'],\n toolbar_sticky: [p.Boolean, true],\n plot_width: [p.Number, 600],\n plot_height: [p.Number, 600],\n title: [p.Any, function () { return new title_1.Title({ text: \"\" }); }],\n title_location: [p.Location, 'above'],\n h_symmetry: [p.Bool, true],\n v_symmetry: [p.Bool, false],\n above: [p.Array, []],\n below: [p.Array, []],\n left: [p.Array, []],\n right: [p.Array, []],\n renderers: [p.Array, []],\n x_range: [p.Instance, function () { return new data_range1d_1.DataRange1d(); }],\n extra_x_ranges: [p.Any, {}],\n y_range: [p.Instance, function () { return new data_range1d_1.DataRange1d(); }],\n extra_y_ranges: [p.Any, {}],\n x_scale: [p.Instance, function () { return new linear_scale_1.LinearScale(); }],\n y_scale: [p.Instance, function () { return new linear_scale_1.LinearScale(); }],\n lod_factor: [p.Number, 10],\n lod_interval: [p.Number, 300],\n lod_threshold: [p.Number, 2000],\n lod_timeout: [p.Number, 500],\n hidpi: [p.Bool, true],\n output_backend: [p.OutputBackend, \"canvas\"],\n min_border: [p.Number, 5],\n min_border_top: [p.Number, null],\n min_border_left: [p.Number, null],\n min_border_bottom: [p.Number, null],\n min_border_right: [p.Number, null],\n inner_width: [p.Number],\n inner_height: [p.Number],\n layout_width: [p.Number],\n layout_height: [p.Number],\n match_aspect: [p.Bool, false],\n aspect_scale: [p.Number, 1],\n });\n this.override({\n outline_line_color: \"#e5e5e5\",\n border_fill_color: \"#ffffff\",\n background_fill_color: \"#ffffff\",\n });\n bokeh_events_1.register_with_event(bokeh_events_1.UIEvent, this);\n };\n Plot.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.reset = new signaling_1.Signal0(this, \"reset\");\n for (var _i = 0, _a = object_1.values(this.extra_x_ranges).concat(this.x_range); _i < _a.length; _i++) {\n var xr = _a[_i];\n var plots = xr.plots;\n if (types_1.isArray(plots)) {\n plots = plots.concat(this);\n xr.setv({ plots: plots }, { silent: true });\n }\n }\n for (var _b = 0, _c = object_1.values(this.extra_y_ranges).concat(this.y_range); _b < _c.length; _b++) {\n var yr = _c[_b];\n var plots = yr.plots;\n if (types_1.isArray(plots)) {\n plots = plots.concat(this);\n yr.setv({ plots: plots }, { silent: true });\n }\n }\n // Min border applies to the edge of everything\n if (this.min_border != null) {\n if (this.min_border_top == null)\n this.min_border_top = this.min_border;\n if (this.min_border_bottom == null)\n this.min_border_bottom = this.min_border;\n if (this.min_border_left == null)\n this.min_border_left = this.min_border;\n if (this.min_border_right == null)\n this.min_border_right = this.min_border;\n }\n // Setup side renderers\n for (var _d = 0, _e = ['above', 'below', 'left', 'right']; _d < _e.length; _d++) {\n var side = _e[_d];\n var layout_renderers = this.getv(side);\n for (var _f = 0, layout_renderers_1 = layout_renderers; _f < layout_renderers_1.length; _f++) {\n var renderer = layout_renderers_1[_f];\n renderer.add_panel(side);\n }\n }\n this._init_title_panel();\n this._init_toolbar_panel();\n this._plot_canvas = this._init_plot_canvas();\n this.plot_canvas.toolbar = this.toolbar;\n // Set width & height to be the passed in plot_width and plot_height\n // We may need to be more subtle about this - not sure why people use one\n // or the other.\n if (this.width == null)\n this.width = this.plot_width;\n if (this.height == null)\n this.height = this.plot_height;\n };\n Plot.prototype._init_plot_canvas = function () {\n return new plot_canvas_1.PlotCanvas({ plot: this });\n };\n Plot.prototype._init_title_panel = function () {\n if (this.title != null) {\n var title = types_1.isString(this.title) ? new title_1.Title({ text: this.title }) : this.title;\n this.add_layout(title, this.title_location);\n }\n };\n Plot.prototype._init_toolbar_panel = function () {\n var _this = this;\n var tpanel = array_1.find(this.renderers, function (model) {\n return model instanceof toolbar_panel_1.ToolbarPanel && array_1.includes(model.tags, _this.id);\n });\n if (tpanel != null)\n this.remove_layout(tpanel);\n switch (this.toolbar_location) {\n case \"left\":\n case \"right\":\n case \"above\":\n case \"below\": {\n tpanel = new toolbar_panel_1.ToolbarPanel({ toolbar: this.toolbar, tags: [this.id] });\n this.toolbar.toolbar_location = this.toolbar_location;\n if (this.toolbar_sticky) {\n var models = this.getv(this.toolbar_location);\n var title = array_1.find(models, function (model) { return model instanceof title_1.Title; });\n if (title != null) {\n tpanel.set_panel(title.panel); // XXX, XXX: because find() doesn't provide narrowed types\n this.add_renderers(tpanel);\n return;\n }\n }\n this.add_layout(tpanel, this.toolbar_location);\n break;\n }\n }\n };\n Plot.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.properties.toolbar_location.change, function () { return _this._init_toolbar_panel(); });\n };\n Object.defineProperty(Plot.prototype, \"plot_canvas\", {\n get: function () {\n return this._plot_canvas;\n },\n enumerable: true,\n configurable: true\n });\n Plot.prototype._doc_attached = function () {\n this.plot_canvas.attach_document(this.document); // XXX!\n _super.prototype._doc_attached.call(this);\n };\n Plot.prototype.add_renderers = function () {\n var new_renderers = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n new_renderers[_i] = arguments[_i];\n }\n var renderers = this.renderers;\n renderers = renderers.concat(new_renderers);\n this.renderers = renderers;\n };\n Plot.prototype.add_layout = function (renderer /* XXX: Renderer */, side) {\n if (side === void 0) {\n side = \"center\";\n }\n if (renderer.props.plot != null)\n renderer.plot = this; // XXX\n if (side != \"center\") {\n var side_renderers = this.getv(side);\n side_renderers.push(renderer);\n renderer.add_panel(side); // XXX\n }\n this.add_renderers(renderer);\n };\n Plot.prototype.remove_layout = function (renderer) {\n var del = function (items) {\n array_1.removeBy(items, function (item) { return item == renderer; });\n };\n del(this.left);\n del(this.right);\n del(this.above);\n del(this.below);\n del(this.renderers);\n };\n Plot.prototype.add_glyph = function (glyph, source, extra_attrs) {\n if (source === void 0) {\n source = new column_data_source_1.ColumnDataSource();\n }\n if (extra_attrs === void 0) {\n extra_attrs = {};\n }\n var attrs = tslib_1.__assign({}, extra_attrs, { data_source: source, glyph: glyph });\n var renderer = new glyph_renderer_1.GlyphRenderer(attrs);\n this.add_renderers(renderer);\n return renderer;\n };\n Plot.prototype.add_tools = function () {\n var tools = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n tools[_i] = arguments[_i];\n }\n for (var _a = 0, tools_1 = tools; _a < tools_1.length; _a++) {\n var tool = tools_1[_a];\n if (tool.overlay != null) // XXX\n this.add_renderers(tool.overlay);\n }\n this.toolbar.tools = this.toolbar.tools.concat(tools);\n };\n Plot.prototype.get_layoutable_children = function () {\n return [this.plot_canvas];\n };\n Plot.prototype.get_constraints = function () {\n var constraints = _super.prototype.get_constraints.call(this);\n constraints.push(solver_1.EQ(this._width, [-1, this.plot_canvas._width]));\n constraints.push(solver_1.EQ(this._height, [-1, this.plot_canvas._height]));\n return constraints;\n };\n Plot.prototype.get_constrained_variables = function () {\n var vars = tslib_1.__assign({}, _super.prototype.get_constrained_variables.call(this), { on_edge_align_top: this.plot_canvas._top, on_edge_align_bottom: this.plot_canvas._height_minus_bottom, on_edge_align_left: this.plot_canvas._left, on_edge_align_right: this.plot_canvas._width_minus_right, box_cell_align_top: this.plot_canvas._top, box_cell_align_bottom: this.plot_canvas._height_minus_bottom, box_cell_align_left: this.plot_canvas._left, box_cell_align_right: this.plot_canvas._width_minus_right, box_equal_size_top: this.plot_canvas._top, box_equal_size_bottom: this.plot_canvas._height_minus_bottom });\n if (this.sizing_mode != \"fixed\") {\n vars.box_equal_size_left = this.plot_canvas._left;\n vars.box_equal_size_right = this.plot_canvas._width_minus_right;\n }\n return vars;\n };\n Object.defineProperty(Plot.prototype, \"all_renderers\", {\n get: function () {\n var renderers = this.renderers;\n for (var _i = 0, _a = this.toolbar.tools; _i < _a.length; _i++) {\n var tool = _a[_i];\n renderers = renderers.concat(tool.synthetic_renderers);\n }\n return renderers;\n },\n enumerable: true,\n configurable: true\n });\n return Plot;\n }(layout_dom_1.LayoutDOM));\n exports.Plot = Plot;\n Plot.initClass();\n}\n","/* models/plots/plot_canvas */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var canvas_1 = require(91) /* ../canvas/canvas */;\n var cartesian_frame_1 = require(92) /* ../canvas/cartesian_frame */;\n var data_range1d_1 = require(180) /* ../ranges/data_range1d */;\n var glyph_renderer_1 = require(185) /* ../renderers/glyph_renderer */;\n var layout_dom_1 = require(157) /* ../layouts/layout_dom */;\n var bokeh_events_1 = require(3) /* core/bokeh_events */;\n var signaling_1 = require(19) /* core/signaling */;\n var build_views_1 = require(4) /* core/build_views */;\n var ui_events_1 = require(20) /* core/ui_events */;\n var visuals_1 = require(49) /* core/visuals */;\n var dom_view_1 = require(6) /* core/dom_view */;\n var layout_canvas_1 = require(11) /* core/layout/layout_canvas */;\n var alignments_1 = require(10) /* core/layout/alignments */;\n var solver_1 = require(13) /* core/layout/solver */;\n var logging_1 = require(14) /* core/logging */;\n var enums = require(7) /* core/enums */;\n var p = require(15) /* core/properties */;\n var throttle_1 = require(42) /* core/util/throttle */;\n var types_1 = require(44) /* core/util/types */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var side_panel_1 = require(12) /* core/layout/side_panel */;\n var global_gl = null;\n var PlotCanvasView = /** @class */ (function (_super) {\n tslib_1.__extends(PlotCanvasView, _super);\n function PlotCanvasView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(PlotCanvasView.prototype, \"frame\", {\n // compat, to be removed\n get: function () {\n return this.model.frame;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PlotCanvasView.prototype, \"canvas\", {\n get: function () {\n return this.model.canvas;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PlotCanvasView.prototype, \"canvas_overlays\", {\n get: function () {\n return this.canvas_view.overlays_el;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PlotCanvasView.prototype, \"canvas_events\", {\n get: function () {\n return this.canvas_view.events_el;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PlotCanvasView.prototype, \"is_paused\", {\n get: function () {\n return this._is_paused != null && this._is_paused !== 0;\n },\n enumerable: true,\n configurable: true\n });\n PlotCanvasView.prototype.view_options = function () {\n return { plot_view: this, parent: this };\n };\n PlotCanvasView.prototype.pause = function () {\n if (this._is_paused == null)\n this._is_paused = 1;\n else\n this._is_paused += 1;\n };\n PlotCanvasView.prototype.unpause = function (no_render) {\n if (no_render === void 0) {\n no_render = false;\n }\n if (this._is_paused == null)\n throw new Error(\"wasn't paused\");\n this._is_paused -= 1;\n if (this._is_paused == 0 && !no_render)\n this.request_render();\n };\n PlotCanvasView.prototype.request_render = function () {\n this.request_paint();\n };\n PlotCanvasView.prototype.request_paint = function () {\n if (!this.is_paused)\n this.throttled_paint();\n };\n PlotCanvasView.prototype.reset = function () {\n this.clear_state();\n this.reset_range();\n this.reset_selection();\n this.model.plot.trigger_event(new bokeh_events_1.Reset());\n };\n PlotCanvasView.prototype.remove = function () {\n this.ui_event_bus.destroy();\n build_views_1.remove_views(this.renderer_views);\n build_views_1.remove_views(this.tool_views);\n this.canvas_view.remove();\n _super.prototype.remove.call(this);\n };\n PlotCanvasView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-plot-wrapper\");\n };\n PlotCanvasView.prototype.initialize = function (options) {\n var _this = this;\n this.pause();\n _super.prototype.initialize.call(this, options);\n this.force_paint = new signaling_1.Signal0(this, \"force_paint\");\n this.state_changed = new signaling_1.Signal0(this, \"state_changed\");\n this.lod_started = false;\n this.visuals = new visuals_1.Visuals(this.model.plot); // XXX\n this._initial_state_info = {\n selection: {},\n dimensions: {\n width: this.model.canvas._width.value,\n height: this.model.canvas._height.value,\n },\n };\n this.visibility_callbacks = [];\n this.state = { history: [], index: -1 };\n this.canvas_view = new this.canvas.default_view({ model: this.canvas, parent: this });\n this.el.appendChild(this.canvas_view.el);\n this.canvas_view.render();\n // If requested, try enabling webgl\n if (this.model.plot.output_backend == \"webgl\")\n this.init_webgl();\n this.throttled_paint = throttle_1.throttle((function () { return _this.force_paint.emit(); }), 15); // TODO (bev) configurable\n this.ui_event_bus = new ui_events_1.UIEvents(this, this.model.toolbar, this.canvas_view.events_el, this.model.plot);\n this.levels = {};\n for (var _i = 0, _a = enums.RenderLevel; _i < _a.length; _i++) {\n var level = _a[_i];\n this.levels[level] = {};\n }\n this.renderer_views = {};\n this.tool_views = {};\n this.build_levels();\n this.build_tools();\n this.update_dataranges();\n this.unpause(true);\n logging_1.logger.debug(\"PlotView initialized\");\n };\n PlotCanvasView.prototype.set_cursor = function (cursor) {\n if (cursor === void 0) {\n cursor = \"default\";\n }\n this.canvas_view.el.style.cursor = cursor;\n };\n PlotCanvasView.prototype.set_toolbar_visibility = function (visible) {\n if (visible === void 0) {\n visible = true;\n }\n this.visibility_callbacks.forEach(function (value) { return value(visible); });\n };\n PlotCanvasView.prototype.init_webgl = function () {\n // We use a global invisible canvas and gl context. By having a global context,\n // we avoid the limitation of max 16 contexts that most browsers have.\n if (global_gl == null) {\n var canvas = document.createElement('canvas');\n var opts = { premultipliedAlpha: true };\n var ctx = canvas.getContext(\"webgl\", opts) || canvas.getContext(\"experimental-webgl\", opts);\n // If WebGL is available, we store a reference to the gl canvas on\n // the ctx object, because that's what gets passed everywhere.\n if (ctx != null)\n global_gl = { canvas: canvas, ctx: ctx };\n }\n if (global_gl != null)\n this.gl = global_gl;\n else\n logging_1.logger.warn('WebGL is not supported, falling back to 2D canvas.');\n };\n PlotCanvasView.prototype.prepare_webgl = function (ratio, frame_box) {\n // Prepare WebGL for a drawing pass\n if (this.gl != null) {\n var canvas = this.canvas_view.get_canvas_element();\n // Sync canvas size\n this.gl.canvas.width = canvas.width;\n this.gl.canvas.height = canvas.height;\n // Prepare GL for drawing\n var gl = this.gl.ctx;\n gl.viewport(0, 0, this.gl.canvas.width, this.gl.canvas.height);\n gl.clearColor(0, 0, 0, 0);\n gl.clear(gl.COLOR_BUFFER_BIT || gl.DEPTH_BUFFER_BIT);\n // Clipping\n gl.enable(gl.SCISSOR_TEST);\n var sx = frame_box[0], sy = frame_box[1], w = frame_box[2], h = frame_box[3];\n var _a = this.model.canvas, xview = _a.xview, yview = _a.yview;\n var vx = xview.compute(sx);\n var vy = yview.compute(sy + h);\n gl.scissor(ratio * vx, ratio * vy, ratio * w, ratio * h); // lower left corner, width, height\n // Setup blending\n gl.enable(gl.BLEND);\n gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.ONE); // premultipliedAlpha == true\n }\n };\n //gl.blendFuncSeparate(gl.ONE_MINUS_DST_ALPHA, gl.DST_ALPHA, gl.ONE_MINUS_DST_ALPHA, gl.ONE) # Without premultipliedAlpha == false\n PlotCanvasView.prototype.blit_webgl = function (ratio) {\n // This should be called when the ctx has no state except the HIDPI transform\n var ctx = this.canvas_view.ctx;\n if (this.gl != null) {\n // Blit gl canvas into the 2D canvas. To do 1-on-1 blitting, we need\n // to remove the hidpi transform, then blit, then restore.\n // ctx.globalCompositeOperation = \"source-over\" -> OK; is the default\n logging_1.logger.debug('drawing with WebGL');\n ctx.restore();\n ctx.drawImage(this.gl.canvas, 0, 0);\n // Set back hidpi transform\n ctx.save();\n ctx.scale(ratio, ratio);\n ctx.translate(0.5, 0.5);\n }\n };\n PlotCanvasView.prototype.update_dataranges = function () {\n // Update any DataRange1ds here\n var frame = this.model.frame;\n var bounds = {};\n var log_bounds = {};\n var calculate_log_bounds = false;\n for (var _i = 0, _a = object_1.values(frame.x_ranges).concat(object_1.values(frame.y_ranges)); _i < _a.length; _i++) {\n var r_1 = _a[_i];\n if (r_1 instanceof data_range1d_1.DataRange1d) {\n if (r_1.scale_hint == \"log\")\n calculate_log_bounds = true;\n }\n }\n for (var id in this.renderer_views) {\n var view = this.renderer_views[id];\n if (view instanceof glyph_renderer_1.GlyphRendererView) {\n var bds = view.glyph.bounds();\n if (bds != null)\n bounds[id] = bds;\n if (calculate_log_bounds) {\n var log_bds = view.glyph.log_bounds();\n if (log_bds != null)\n log_bounds[id] = log_bds;\n }\n }\n }\n var follow_enabled = false;\n var has_bounds = false;\n var r;\n if (this.model.plot.match_aspect !== false && this.frame._width.value != 0 && this.frame._height.value != 0)\n r = (1 / this.model.plot.aspect_scale) * (this.frame._width.value / this.frame._height.value);\n for (var _b = 0, _c = object_1.values(frame.x_ranges); _b < _c.length; _b++) {\n var xr = _c[_b];\n if (xr instanceof data_range1d_1.DataRange1d) {\n var bounds_to_use = xr.scale_hint == \"log\" ? log_bounds : bounds;\n xr.update(bounds_to_use, 0, this.model.id, r);\n if (xr.follow) {\n follow_enabled = true;\n }\n }\n if (xr.bounds != null)\n has_bounds = true;\n }\n for (var _d = 0, _e = object_1.values(frame.y_ranges); _d < _e.length; _d++) {\n var yr = _e[_d];\n if (yr instanceof data_range1d_1.DataRange1d) {\n var bounds_to_use = yr.scale_hint == \"log\" ? log_bounds : bounds;\n yr.update(bounds_to_use, 1, this.model.id, r);\n if (yr.follow) {\n follow_enabled = true;\n }\n }\n if (yr.bounds != null)\n has_bounds = true;\n }\n if (follow_enabled && has_bounds) {\n logging_1.logger.warn('Follow enabled so bounds are unset.');\n for (var _f = 0, _g = object_1.values(frame.x_ranges); _f < _g.length; _f++) {\n var xr = _g[_f];\n xr.bounds = null;\n }\n for (var _h = 0, _j = object_1.values(frame.y_ranges); _h < _j.length; _h++) {\n var yr = _j[_h];\n yr.bounds = null;\n }\n }\n this.range_update_timestamp = Date.now();\n };\n PlotCanvasView.prototype.map_to_screen = function (x, y, x_name, y_name) {\n if (x_name === void 0) {\n x_name = \"default\";\n }\n if (y_name === void 0) {\n y_name = \"default\";\n }\n return this.frame.map_to_screen(x, y, x_name, y_name);\n };\n PlotCanvasView.prototype.push_state = function (type, new_info) {\n var _a = this.state, history = _a.history, index = _a.index;\n var prev_info = history[index] != null ? history[index].info : {};\n var info = tslib_1.__assign({}, this._initial_state_info, prev_info, new_info);\n this.state.history = this.state.history.slice(0, this.state.index + 1);\n this.state.history.push({ type: type, info: info });\n this.state.index = this.state.history.length - 1;\n this.state_changed.emit();\n };\n PlotCanvasView.prototype.clear_state = function () {\n this.state = { history: [], index: -1 };\n this.state_changed.emit();\n };\n PlotCanvasView.prototype.can_undo = function () {\n this.state.index >= 0;\n };\n PlotCanvasView.prototype.can_redo = function () {\n this.state.index < this.state.history.length - 1;\n };\n PlotCanvasView.prototype.undo = function () {\n if (this.can_undo()) {\n this.state.index -= 1;\n this._do_state_change(this.state.index);\n this.state_changed.emit();\n }\n };\n PlotCanvasView.prototype.redo = function () {\n if (this.can_redo()) {\n this.state.index += 1;\n this._do_state_change(this.state.index);\n this.state_changed.emit();\n }\n };\n PlotCanvasView.prototype._do_state_change = function (index) {\n var info = this.state.history[index] != null ? this.state.history[index].info : this._initial_state_info;\n if (info.range != null)\n this.update_range(info.range);\n if (info.selection != null)\n this.update_selection(info.selection);\n };\n PlotCanvasView.prototype.get_selection = function () {\n var selection = {};\n for (var _i = 0, _a = this.model.plot.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n if (renderer instanceof glyph_renderer_1.GlyphRenderer) {\n var selected = renderer.data_source.selected;\n selection[renderer.id] = selected;\n }\n }\n return selection;\n };\n PlotCanvasView.prototype.update_selection = function (selection) {\n for (var _i = 0, _a = this.model.plot.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n if (!(renderer instanceof glyph_renderer_1.GlyphRenderer))\n continue;\n var ds = renderer.data_source;\n if (selection != null) {\n if (selection[renderer.id] != null)\n ds.selected.update(selection[renderer.id], true, false);\n }\n else\n ds.selection_manager.clear();\n }\n };\n PlotCanvasView.prototype.reset_selection = function () {\n this.update_selection(null);\n };\n PlotCanvasView.prototype._update_ranges_together = function (range_info_iter) {\n // Get weight needed to scale the diff of the range to honor interval limits\n var weight = 1.0;\n for (var _i = 0, range_info_iter_1 = range_info_iter; _i < range_info_iter_1.length; _i++) {\n var _a = range_info_iter_1[_i], rng = _a[0], range_info = _a[1];\n weight = Math.min(weight, this._get_weight_to_constrain_interval(rng, range_info));\n }\n // Apply shared weight to all ranges\n if (weight < 1) {\n for (var _b = 0, range_info_iter_2 = range_info_iter; _b < range_info_iter_2.length; _b++) {\n var _c = range_info_iter_2[_b], rng = _c[0], range_info = _c[1];\n range_info.start = weight * range_info.start + (1 - weight) * rng.start;\n range_info.end = weight * range_info.end + (1 - weight) * rng.end;\n }\n }\n };\n PlotCanvasView.prototype._update_ranges_individually = function (range_info_iter, is_panning, is_scrolling, maintain_focus) {\n var hit_bound = false;\n for (var _i = 0, range_info_iter_3 = range_info_iter; _i < range_info_iter_3.length; _i++) {\n var _a = range_info_iter_3[_i], rng = _a[0], range_info = _a[1];\n // Limit range interval first. Note that for scroll events,\n // the interval has already been limited for all ranges simultaneously\n if (!is_scrolling) {\n var weight = this._get_weight_to_constrain_interval(rng, range_info);\n if (weight < 1) {\n range_info.start = weight * range_info.start + (1 - weight) * rng.start;\n range_info.end = weight * range_info.end + (1 - weight) * rng.end;\n }\n }\n // Prevent range from going outside limits\n // Also ensure that range keeps the same delta when panning/scrolling\n if (rng.bounds != null && rng.bounds != \"auto\") { // check `auto` for type-checking purpose\n var _b = rng.bounds, min = _b[0], max = _b[1];\n var new_interval = Math.abs(range_info.end - range_info.start);\n if (rng.is_reversed) {\n if (min != null) {\n if (min >= range_info.end) {\n hit_bound = true;\n range_info.end = min;\n if (is_panning || is_scrolling) {\n range_info.start = min + new_interval;\n }\n }\n }\n if (max != null) {\n if (max <= range_info.start) {\n hit_bound = true;\n range_info.start = max;\n if (is_panning || is_scrolling) {\n range_info.end = max - new_interval;\n }\n }\n }\n }\n else {\n if (min != null) {\n if (min >= range_info.start) {\n hit_bound = true;\n range_info.start = min;\n if (is_panning || is_scrolling) {\n range_info.end = min + new_interval;\n }\n }\n }\n if (max != null) {\n if (max <= range_info.end) {\n hit_bound = true;\n range_info.end = max;\n if (is_panning || is_scrolling) {\n range_info.start = max - new_interval;\n }\n }\n }\n }\n }\n }\n // Cancel the event when hitting a bound while scrolling. This ensures that\n // the scroll-zoom tool maintains its focus position. Setting `maintain_focus`\n // to false results in a more \"gliding\" behavior, allowing one to\n // zoom out more smoothly, at the cost of losing the focus position.\n if (is_scrolling && hit_bound && maintain_focus)\n return;\n for (var _c = 0, range_info_iter_4 = range_info_iter; _c < range_info_iter_4.length; _c++) {\n var _d = range_info_iter_4[_c], rng = _d[0], range_info = _d[1];\n rng.have_updated_interactively = true;\n if (rng.start != range_info.start || rng.end != range_info.end)\n rng.setv(range_info);\n }\n };\n PlotCanvasView.prototype._get_weight_to_constrain_interval = function (rng, range_info) {\n // Get the weight by which a range-update can be applied\n // to still honor the interval limits (including the implicit\n // max interval imposed by the bounds)\n var min_interval = rng.min_interval;\n var max_interval = rng.max_interval;\n // Express bounds as a max_interval. By doing this, the application of\n // bounds and interval limits can be applied independent from each-other.\n if (rng.bounds != null && rng.bounds != \"auto\") { // check `auto` for type-checking purpose\n var _a = rng.bounds, min = _a[0], max = _a[1];\n if (min != null && max != null) {\n var max_interval2 = Math.abs(max - min);\n max_interval = max_interval != null ? Math.min(max_interval, max_interval2) : max_interval2;\n }\n }\n var weight = 1.0;\n if (min_interval != null || max_interval != null) {\n var old_interval = Math.abs(rng.end - rng.start);\n var new_interval = Math.abs(range_info.end - range_info.start);\n if (min_interval > 0 && new_interval < min_interval) {\n weight = (old_interval - min_interval) / (old_interval - new_interval);\n }\n if (max_interval > 0 && new_interval > max_interval) {\n weight = (max_interval - old_interval) / (new_interval - old_interval);\n }\n weight = Math.max(0.0, Math.min(1.0, weight));\n }\n return weight;\n };\n PlotCanvasView.prototype.update_range = function (range_info, is_panning, is_scrolling, maintain_focus) {\n if (is_panning === void 0) {\n is_panning = false;\n }\n if (is_scrolling === void 0) {\n is_scrolling = false;\n }\n if (maintain_focus === void 0) {\n maintain_focus = true;\n }\n this.pause();\n var _a = this.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges;\n if (range_info == null) {\n for (var name_1 in x_ranges) {\n var rng = x_ranges[name_1];\n rng.reset();\n }\n for (var name_2 in y_ranges) {\n var rng = y_ranges[name_2];\n rng.reset();\n }\n this.update_dataranges();\n }\n else {\n var range_info_iter = [];\n for (var name_3 in x_ranges) {\n var rng = x_ranges[name_3];\n range_info_iter.push([rng, range_info.xrs[name_3]]);\n }\n for (var name_4 in y_ranges) {\n var rng = y_ranges[name_4];\n range_info_iter.push([rng, range_info.yrs[name_4]]);\n }\n if (is_scrolling) {\n this._update_ranges_together(range_info_iter); // apply interval bounds while keeping aspect\n }\n this._update_ranges_individually(range_info_iter, is_panning, is_scrolling, maintain_focus);\n }\n this.unpause();\n };\n PlotCanvasView.prototype.reset_range = function () {\n this.update_range(null);\n };\n PlotCanvasView.prototype.build_levels = function () {\n var renderer_models = this.model.plot.all_renderers;\n // should only bind events on NEW views\n var old_renderers = object_1.keys(this.renderer_views);\n var new_renderer_views = build_views_1.build_views(this.renderer_views, renderer_models, this.view_options());\n var renderers_to_remove = array_1.difference(old_renderers, renderer_models.map(function (model) { return model.id; }));\n for (var level in this.levels) {\n for (var _i = 0, renderers_to_remove_1 = renderers_to_remove; _i < renderers_to_remove_1.length; _i++) {\n var id = renderers_to_remove_1[_i];\n delete this.levels[level][id];\n }\n }\n for (var _a = 0, new_renderer_views_1 = new_renderer_views; _a < new_renderer_views_1.length; _a++) {\n var view = new_renderer_views_1[_a];\n this.levels[view.model.level][view.model.id] = view;\n }\n };\n PlotCanvasView.prototype.get_renderer_views = function () {\n var _this = this;\n return this.model.plot.renderers.map(function (r) { return _this.levels[r.level][r.id]; });\n };\n PlotCanvasView.prototype.build_tools = function () {\n var _this = this;\n var tool_models = this.model.plot.toolbar.tools;\n var new_tool_views = build_views_1.build_views(this.tool_views, tool_models, this.view_options());\n new_tool_views.map(function (tool_view) { return _this.ui_event_bus.register_tool(tool_view); });\n };\n PlotCanvasView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.force_paint, function () { return _this.repaint(); });\n var _a = this.model.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges;\n for (var name_5 in x_ranges) {\n var rng = x_ranges[name_5];\n this.connect(rng.change, function () { return _this.request_render(); });\n }\n for (var name_6 in y_ranges) {\n var rng = y_ranges[name_6];\n this.connect(rng.change, function () { return _this.request_render(); });\n }\n this.connect(this.model.plot.properties.renderers.change, function () { return _this.build_levels(); });\n this.connect(this.model.plot.toolbar.properties.tools.change, function () { _this.build_levels(); _this.build_tools(); });\n this.connect(this.model.plot.change, function () { return _this.request_render(); });\n this.connect(this.model.plot.reset, function () { return _this.reset(); });\n };\n PlotCanvasView.prototype.set_initial_range = function () {\n // check for good values for ranges before setting initial range\n var good_vals = true;\n var _a = this.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges;\n var xrs = {};\n var yrs = {};\n for (var name_7 in x_ranges) {\n var _b = x_ranges[name_7], start = _b.start, end = _b.end;\n if (start == null || end == null || types_1.isStrictNaN(start + end)) {\n good_vals = false;\n break;\n }\n xrs[name_7] = { start: start, end: end };\n }\n if (good_vals) {\n for (var name_8 in y_ranges) {\n var _c = y_ranges[name_8], start = _c.start, end = _c.end;\n if (start == null || end == null || types_1.isStrictNaN(start + end)) {\n good_vals = false;\n break;\n }\n yrs[name_8] = { start: start, end: end };\n }\n }\n if (good_vals) {\n this._initial_state_info.range = { xrs: xrs, yrs: yrs };\n logging_1.logger.debug(\"initial ranges set\");\n }\n else\n logging_1.logger.warn('could not set initial ranges');\n };\n PlotCanvasView.prototype.update_constraints = function () {\n this.solver.suggest_value(this.frame._width, this.canvas._width.value);\n this.solver.suggest_value(this.frame._height, this.canvas._height.value);\n for (var id in this.renderer_views) {\n var view = this.renderer_views[id];\n if (side_panel_1.isSizeableView(view) && view.model.panel != null)\n side_panel_1.update_panel_constraints(view);\n }\n this.solver.update_variables();\n };\n // XXX: bacause PlotCanvas is NOT a LayoutDOM\n PlotCanvasView.prototype._layout = function (final) {\n if (final === void 0) {\n final = false;\n }\n this.render();\n if (final) {\n this.model.plot.setv({\n inner_width: Math.round(this.frame._width.value),\n inner_height: Math.round(this.frame._height.value),\n layout_width: Math.round(this.canvas._width.value),\n layout_height: Math.round(this.canvas._height.value),\n }, { no_change: true });\n // XXX: can't be @request_paint(), because it would trigger back-and-forth\n // layout recomputing feedback loop between plots. Plots are also much more\n // responsive this way, especially in interactive mode.\n this.paint();\n }\n };\n PlotCanvasView.prototype.has_finished = function () {\n if (!_super.prototype.has_finished.call(this)) {\n return false;\n }\n for (var level in this.levels) {\n var renderer_views = this.levels[level];\n for (var id in renderer_views) {\n var view = renderer_views[id];\n if (!view.has_finished())\n return false;\n }\n }\n return true;\n };\n PlotCanvasView.prototype.render = function () {\n // Set the plot and canvas to the current model's size\n // This gets called upon solver resize events\n var width = this.model._width.value;\n var height = this.model._height.value;\n this.canvas_view.set_dims([width, height]);\n this.update_constraints();\n if (this.model.plot.match_aspect !== false && this.frame._width.value != 0 && this.frame._height.value != 0)\n this.update_dataranges();\n // This allows the plot canvas to be positioned around the toolbar\n this.el.style.position = 'absolute';\n this.el.style.left = this.model._dom_left.value + \"px\";\n this.el.style.top = this.model._dom_top.value + \"px\";\n this.el.style.width = this.model._width.value + \"px\";\n this.el.style.height = this.model._height.value + \"px\";\n };\n PlotCanvasView.prototype._needs_layout = function () {\n for (var id in this.renderer_views) {\n var view = this.renderer_views[id];\n if (side_panel_1.isSizeableView(view) && view.model.panel != null) {\n if (side_panel_1._view_sizes.get(view) != view.get_size())\n return true;\n }\n }\n return false;\n };\n PlotCanvasView.prototype.repaint = function () {\n if (this._needs_layout())\n this.parent.partial_layout(); // XXX\n else\n this.paint();\n };\n PlotCanvasView.prototype.paint = function () {\n var _this = this;\n if (this.is_paused)\n return;\n logging_1.logger.trace(\"PlotCanvas.render() for \" + this.model.id);\n // Prepare the canvas size, taking HIDPI into account. Note that this may cause a resize\n // of the canvas, which means that any previous calls to ctx.save() will be undone.\n this.canvas_view.prepare_canvas();\n var document = this.model.document;\n if (document != null) {\n var interactive_duration = document.interactive_duration();\n var plot_1 = this.model.plot;\n if (interactive_duration >= 0 && interactive_duration < plot_1.lod_interval) {\n setTimeout(function () {\n if (document.interactive_duration() > plot_1.lod_timeout) {\n document.interactive_stop(plot_1);\n }\n _this.request_render();\n }, plot_1.lod_timeout);\n }\n else\n document.interactive_stop(plot_1);\n }\n for (var id in this.renderer_views) {\n var v = this.renderer_views[id];\n if (this.range_update_timestamp == null ||\n (v instanceof glyph_renderer_1.GlyphRendererView && v.set_data_timestamp > this.range_update_timestamp)) {\n this.update_dataranges();\n break;\n }\n }\n // TODO (bev) OK this sucks, but the event from the solver update doesn't\n // reach the frame in time (sometimes) so force an update here for now\n // (mp) not only that, but models don't know about solver anymore, so\n // frame can't update its scales.\n this.model.frame.update_scales();\n var ctx = this.canvas_view.ctx;\n var ratio = this.canvas.pixel_ratio;\n // Set hidpi-transform\n ctx.save(); // Save default state, do *after* getting ratio, cause setting canvas.width resets transforms\n ctx.scale(ratio, ratio);\n ctx.translate(0.5, 0.5);\n var frame_box = [\n this.frame._left.value,\n this.frame._top.value,\n this.frame._width.value,\n this.frame._height.value,\n ];\n this._map_hook(ctx, frame_box);\n this._paint_empty(ctx, frame_box);\n this.prepare_webgl(ratio, frame_box);\n ctx.save();\n if (this.visuals.outline_line.doit) {\n this.visuals.outline_line.set_value(ctx);\n var x0 = frame_box[0], y0 = frame_box[1], w = frame_box[2], h = frame_box[3];\n // XXX: shrink outline region by 1px to make right and bottom lines visible\n // if they are on the edge of the canvas.\n if (x0 + w == this.canvas._width.value) {\n w -= 1;\n }\n if (y0 + h == this.canvas._height.value) {\n h -= 1;\n }\n ctx.strokeRect(x0, y0, w, h);\n }\n ctx.restore();\n this._paint_levels(ctx, ['image', 'underlay', 'glyph'], frame_box, true);\n this.blit_webgl(ratio);\n this._paint_levels(ctx, ['annotation'], frame_box, true);\n this._paint_levels(ctx, ['overlay'], frame_box, false);\n if (this._initial_state_info.range == null)\n this.set_initial_range();\n ctx.restore(); // Restore to default state\n if (!this._has_finished) {\n this._has_finished = true;\n this.notify_finished();\n }\n };\n PlotCanvasView.prototype._paint_levels = function (ctx, levels, clip_region, global_clip) {\n ctx.save();\n if (global_clip) {\n ctx.beginPath();\n ctx.rect.apply(ctx, clip_region);\n ctx.clip();\n }\n var indices = {};\n for (var i = 0; i < this.model.plot.renderers.length; i++) {\n var renderer = this.model.plot.renderers[i];\n indices[renderer.id] = i;\n }\n var sortKey = function (renderer_view) { return indices[renderer_view.model.id]; };\n for (var _i = 0, levels_1 = levels; _i < levels_1.length; _i++) {\n var level = levels_1[_i];\n var renderer_views = array_1.sortBy(object_1.values(this.levels[level]), sortKey);\n for (var _a = 0, renderer_views_1 = renderer_views; _a < renderer_views_1.length; _a++) {\n var renderer_view = renderer_views_1[_a];\n if (!global_clip && renderer_view.needs_clip) {\n ctx.save();\n ctx.beginPath();\n ctx.rect.apply(ctx, clip_region);\n ctx.clip();\n }\n renderer_view.render();\n if (!global_clip && renderer_view.needs_clip) {\n ctx.restore();\n }\n }\n }\n ctx.restore();\n };\n PlotCanvasView.prototype._map_hook = function (_ctx, _frame_box) { };\n PlotCanvasView.prototype._paint_empty = function (ctx, frame_box) {\n var _a = [0, 0, this.canvas_view.model._width.value, this.canvas_view.model._height.value], cx = _a[0], cy = _a[1], cw = _a[2], ch = _a[3];\n var fx = frame_box[0], fy = frame_box[1], fw = frame_box[2], fh = frame_box[3];\n ctx.clearRect(cx, cy, cw, ch);\n if (this.visuals.border_fill.doit) {\n this.visuals.border_fill.set_value(ctx);\n ctx.fillRect(cx, cy, cw, ch);\n ctx.clearRect(fx, fy, fw, fh);\n }\n if (this.visuals.background_fill.doit) {\n this.visuals.background_fill.set_value(ctx);\n ctx.fillRect(fx, fy, fw, fh);\n }\n };\n PlotCanvasView.prototype.save = function (name) {\n switch (this.model.plot.output_backend) {\n case \"canvas\":\n case \"webgl\": {\n var canvas = this.canvas_view.get_canvas_element();\n if (canvas.msToBlob != null) {\n var blob = canvas.msToBlob();\n window.navigator.msSaveBlob(blob, name);\n }\n else {\n var link = document.createElement('a');\n link.href = canvas.toDataURL('image/png');\n link.download = name + \".png\";\n link.target = \"_blank\";\n link.dispatchEvent(new MouseEvent('click'));\n }\n break;\n }\n case \"svg\": {\n var ctx = this.canvas_view._ctx;\n var svg = ctx.getSerializedSvg(true);\n var svgblob = new Blob([svg], { type: 'text/plain' });\n var downloadLink = document.createElement(\"a\");\n downloadLink.download = name + \".svg\";\n downloadLink.innerHTML = \"Download svg\";\n downloadLink.href = window.URL.createObjectURL(svgblob);\n downloadLink.onclick = function (event) { return document.body.removeChild(event.target); };\n downloadLink.style.display = \"none\";\n document.body.appendChild(downloadLink);\n downloadLink.click();\n break;\n }\n }\n };\n return PlotCanvasView;\n }(dom_view_1.DOMView));\n exports.PlotCanvasView = PlotCanvasView;\n var AbovePanel = /** @class */ (function (_super) {\n tslib_1.__extends(AbovePanel, _super);\n function AbovePanel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n AbovePanel.initClass = function () {\n this.prototype.type = \"AbovePanel\";\n };\n return AbovePanel;\n }(layout_canvas_1.LayoutCanvas));\n exports.AbovePanel = AbovePanel;\n AbovePanel.initClass();\n var BelowPanel = /** @class */ (function (_super) {\n tslib_1.__extends(BelowPanel, _super);\n function BelowPanel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BelowPanel.initClass = function () {\n this.prototype.type = \"BelowPanel\";\n };\n return BelowPanel;\n }(layout_canvas_1.LayoutCanvas));\n exports.BelowPanel = BelowPanel;\n BelowPanel.initClass();\n var LeftPanel = /** @class */ (function (_super) {\n tslib_1.__extends(LeftPanel, _super);\n function LeftPanel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LeftPanel.initClass = function () {\n this.prototype.type = \"LeftPanel\";\n };\n return LeftPanel;\n }(layout_canvas_1.LayoutCanvas));\n exports.LeftPanel = LeftPanel;\n LeftPanel.initClass();\n var RightPanel = /** @class */ (function (_super) {\n tslib_1.__extends(RightPanel, _super);\n function RightPanel() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RightPanel.initClass = function () {\n this.prototype.type = \"RightPanel\";\n };\n return RightPanel;\n }(layout_canvas_1.LayoutCanvas));\n exports.RightPanel = RightPanel;\n RightPanel.initClass();\n var PlotCanvas = /** @class */ (function (_super) {\n tslib_1.__extends(PlotCanvas, _super);\n function PlotCanvas(attrs) {\n return _super.call(this, attrs) || this;\n }\n PlotCanvas.initClass = function () {\n this.prototype.type = 'PlotCanvas';\n this.prototype.default_view = PlotCanvasView;\n this.internal({\n plot: [p.Instance],\n toolbar: [p.Instance],\n canvas: [p.Instance],\n frame: [p.Instance],\n });\n this.override({\n // We should find a way to enforce this\n sizing_mode: 'stretch_both',\n });\n };\n PlotCanvas.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.canvas = new canvas_1.Canvas({\n map: this.use_map != null ? this.use_map : false,\n use_hidpi: this.plot.hidpi,\n output_backend: this.plot.output_backend,\n });\n this.frame = new cartesian_frame_1.CartesianFrame({\n x_range: this.plot.x_range,\n extra_x_ranges: this.plot.extra_x_ranges,\n x_scale: this.plot.x_scale,\n y_range: this.plot.y_range,\n extra_y_ranges: this.plot.extra_y_ranges,\n y_scale: this.plot.y_scale,\n });\n this.above_panel = new AbovePanel();\n this.below_panel = new BelowPanel();\n this.left_panel = new LeftPanel();\n this.right_panel = new RightPanel();\n logging_1.logger.debug(\"PlotCanvas initialized\");\n };\n PlotCanvas.prototype._doc_attached = function () {\n this.canvas.attach_document(this.document);\n this.frame.attach_document(this.document);\n this.above_panel.attach_document(this.document);\n this.below_panel.attach_document(this.document);\n this.left_panel.attach_document(this.document);\n this.right_panel.attach_document(this.document);\n _super.prototype._doc_attached.call(this);\n logging_1.logger.debug(\"PlotCanvas attached to document\");\n };\n PlotCanvas.prototype.get_layoutable_children = function () {\n var children = [\n this.above_panel, this.below_panel,\n this.left_panel, this.right_panel,\n this.canvas, this.frame,\n ];\n var collect_panels = function (layout_renderers) {\n for (var _i = 0, layout_renderers_1 = layout_renderers; _i < layout_renderers_1.length; _i++) {\n var r = layout_renderers_1[_i];\n if (side_panel_1.isSizeable(r) && r.panel != null)\n children.push(r.panel);\n }\n };\n collect_panels(this.plot.above);\n collect_panels(this.plot.below);\n collect_panels(this.plot.left);\n collect_panels(this.plot.right);\n return children; // XXX: PlotCanvas should be a LayoutCanvas\n };\n PlotCanvas.prototype.get_constraints = function () {\n return _super.prototype.get_constraints.call(this).concat(this._get_constant_constraints(), this._get_side_constraints());\n };\n PlotCanvas.prototype._get_constant_constraints = function () {\n return [\n // Set the origin. Everything else is positioned absolutely wrt canvas.\n solver_1.EQ(this.canvas._left, 0),\n solver_1.EQ(this.canvas._top, 0),\n solver_1.GE(this.above_panel._top, [-1, this.canvas._top]),\n solver_1.EQ(this.above_panel._bottom, [-1, this.frame._top]),\n solver_1.EQ(this.above_panel._left, [-1, this.left_panel._right]),\n solver_1.EQ(this.above_panel._right, [-1, this.right_panel._left]),\n solver_1.EQ(this.below_panel._top, [-1, this.frame._bottom]),\n solver_1.LE(this.below_panel._bottom, [-1, this.canvas._bottom]),\n solver_1.EQ(this.below_panel._left, [-1, this.left_panel._right]),\n solver_1.EQ(this.below_panel._right, [-1, this.right_panel._left]),\n solver_1.EQ(this.left_panel._top, [-1, this.above_panel._bottom]),\n solver_1.EQ(this.left_panel._bottom, [-1, this.below_panel._top]),\n solver_1.GE(this.left_panel._left, [-1, this.canvas._left]),\n solver_1.EQ(this.left_panel._right, [-1, this.frame._left]),\n solver_1.EQ(this.right_panel._top, [-1, this.above_panel._bottom]),\n solver_1.EQ(this.right_panel._bottom, [-1, this.below_panel._top]),\n solver_1.EQ(this.right_panel._left, [-1, this.frame._right]),\n solver_1.LE(this.right_panel._right, [-1, this.canvas._right]),\n solver_1.EQ(this._top, [-1, this.above_panel._bottom]),\n solver_1.EQ(this._left, [-1, this.left_panel._right]),\n solver_1.EQ(this._height, [-1, this._bottom], [-1, this.canvas._bottom], this.below_panel._top),\n solver_1.EQ(this._width, [-1, this._right], [-1, this.canvas._right], this.right_panel._left),\n solver_1.GE(this._top, -this.plot.min_border_top),\n solver_1.GE(this._left, -this.plot.min_border_left),\n solver_1.GE(this._height, [-1, this._bottom], -this.plot.min_border_bottom),\n solver_1.GE(this._width, [-1, this._right], -this.plot.min_border_right),\n ];\n };\n PlotCanvas.prototype._get_side_constraints = function () {\n var panels = function (objs) { return objs.map(function (obj) { return obj.panel; }); };\n var above = alignments_1.vstack(this.above_panel, panels(this.plot.above));\n var below = alignments_1.vstack(this.below_panel, array_1.reversed(panels(this.plot.below)));\n var left = alignments_1.hstack(this.left_panel, panels(this.plot.left));\n var right = alignments_1.hstack(this.right_panel, array_1.reversed(panels(this.plot.right)));\n return array_1.concat([above, below, left, right]);\n };\n return PlotCanvas;\n }(layout_dom_1.LayoutDOM));\n exports.PlotCanvas = PlotCanvas;\n PlotCanvas.initClass();\n}\n","/* models/ranges/data_range */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var range_1 = require(183) /* ./range */;\n var p = require(15) /* core/properties */;\n var DataRange = /** @class */ (function (_super) {\n tslib_1.__extends(DataRange, _super);\n function DataRange(attrs) {\n return _super.call(this, attrs) || this;\n }\n DataRange.initClass = function () {\n this.prototype.type = \"DataRange\";\n this.define({\n names: [p.Array, []],\n renderers: [p.Array, []],\n });\n };\n return DataRange;\n }(range_1.Range));\n exports.DataRange = DataRange;\n DataRange.initClass();\n}\n","/* models/ranges/data_range1d */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var data_range_1 = require(179) /* ./data_range */;\n var glyph_renderer_1 = require(185) /* ../renderers/glyph_renderer */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var bbox = require(24) /* core/util/bbox */;\n var array_1 = require(21) /* core/util/array */;\n var DataRange1d = /** @class */ (function (_super) {\n tslib_1.__extends(DataRange1d, _super);\n function DataRange1d(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this._plot_bounds = {};\n _this.have_updated_interactively = false;\n return _this;\n }\n DataRange1d.initClass = function () {\n this.prototype.type = \"DataRange1d\";\n this.define({\n start: [p.Number],\n end: [p.Number],\n range_padding: [p.Number, 0.1],\n range_padding_units: [p.PaddingUnits, \"percent\"],\n flipped: [p.Bool, false],\n follow: [p.StartEnd,],\n follow_interval: [p.Number],\n default_span: [p.Number, 2],\n });\n this.internal({\n scale_hint: [p.String, 'auto'],\n });\n };\n DataRange1d.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._initial_start = this.start;\n this._initial_end = this.end;\n this._initial_range_padding = this.range_padding;\n this._initial_range_padding_units = this.range_padding_units;\n this._initial_follow = this.follow;\n this._initial_follow_interval = this.follow_interval;\n this._initial_default_span = this.default_span;\n };\n Object.defineProperty(DataRange1d.prototype, \"min\", {\n get: function () {\n return Math.min(this.start, this.end);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(DataRange1d.prototype, \"max\", {\n get: function () {\n return Math.max(this.start, this.end);\n },\n enumerable: true,\n configurable: true\n });\n DataRange1d.prototype.computed_renderers = function () {\n // TODO (bev) check that renderers actually configured with this range\n var names = this.names;\n var renderers = this.renderers;\n if (renderers.length == 0) {\n for (var _i = 0, _a = this.plots; _i < _a.length; _i++) {\n var plot = _a[_i];\n var rs = plot.renderers.filter(function (r) { return r instanceof glyph_renderer_1.GlyphRenderer; });\n renderers = renderers.concat(rs);\n }\n }\n if (names.length > 0)\n renderers = renderers.filter(function (r) { return array_1.includes(names, r.name); });\n logging_1.logger.debug(\"computed \" + renderers.length + \" renderers for DataRange1d \" + this.id);\n for (var _b = 0, renderers_1 = renderers; _b < renderers_1.length; _b++) {\n var r = renderers_1[_b];\n logging_1.logger.trace(\" - \" + r.type + \" \" + r.id);\n }\n return renderers;\n };\n DataRange1d.prototype._compute_plot_bounds = function (renderers, bounds) {\n var result = bbox.empty();\n for (var _i = 0, renderers_2 = renderers; _i < renderers_2.length; _i++) {\n var r = renderers_2[_i];\n if (bounds[r.id] != null)\n result = bbox.union(result, bounds[r.id]);\n }\n return result;\n };\n DataRange1d.prototype.adjust_bounds_for_aspect = function (bounds, ratio) {\n var result = bbox.empty();\n var width = bounds.maxX - bounds.minX;\n if (width <= 0) {\n width = 1.0;\n }\n var height = bounds.maxY - bounds.minY;\n if (height <= 0) {\n height = 1.0;\n }\n var xcenter = 0.5 * (bounds.maxX + bounds.minX);\n var ycenter = 0.5 * (bounds.maxY + bounds.minY);\n if (width < ratio * height) {\n width = ratio * height;\n }\n else {\n height = width / ratio;\n }\n result.maxX = xcenter + 0.5 * width;\n result.minX = xcenter - 0.5 * width;\n result.maxY = ycenter + 0.5 * height;\n result.minY = ycenter - 0.5 * height;\n return result;\n };\n DataRange1d.prototype._compute_min_max = function (plot_bounds, dimension) {\n var _a, _b;\n var overall = bbox.empty();\n for (var k in plot_bounds) {\n var v = plot_bounds[k];\n overall = bbox.union(overall, v);\n }\n var min, max;\n if (dimension == 0)\n _a = [overall.minX, overall.maxX], min = _a[0], max = _a[1];\n else\n _b = [overall.minY, overall.maxY], min = _b[0], max = _b[1];\n return [min, max];\n };\n DataRange1d.prototype._compute_range = function (min, max) {\n var _a;\n var range_padding = this.range_padding; // XXX: ? 0\n var start, end;\n if (this.scale_hint == \"log\") {\n if (isNaN(min) || !isFinite(min) || min <= 0) {\n if (isNaN(max) || !isFinite(max) || max <= 0)\n min = 0.1;\n else\n min = max / 100;\n logging_1.logger.warn(\"could not determine minimum data value for log axis, DataRange1d using value \" + min);\n }\n if (isNaN(max) || !isFinite(max) || max <= 0) {\n if (isNaN(min) || !isFinite(min) || min <= 0)\n max = 10;\n else\n max = min * 100;\n logging_1.logger.warn(\"could not determine maximum data value for log axis, DataRange1d using value \" + max);\n }\n var center = void 0, span = void 0;\n if (max == min) {\n span = this.default_span + 0.001;\n center = Math.log(min) / Math.log(10);\n }\n else {\n var log_min = void 0, log_max = void 0;\n if (this.range_padding_units == \"percent\") {\n log_min = Math.log(min) / Math.log(10);\n log_max = Math.log(max) / Math.log(10);\n span = (log_max - log_min) * (1 + range_padding);\n }\n else {\n log_min = Math.log(min - range_padding) / Math.log(10);\n log_max = Math.log(max + range_padding) / Math.log(10);\n span = log_max - log_min;\n }\n center = (log_min + log_max) / 2.0;\n }\n start = Math.pow(10, center - span / 2.0);\n end = Math.pow(10, center + span / 2.0);\n }\n else {\n var span = void 0;\n if (max == min)\n span = this.default_span;\n else {\n if (this.range_padding_units == \"percent\")\n span = (max - min) * (1 + range_padding);\n else\n span = (max - min) + 2 * range_padding;\n }\n var center = (max + min) / 2.0;\n start = center - span / 2.0;\n end = center + span / 2.0;\n }\n var follow_sign = +1;\n if (this.flipped) {\n _a = [end, start], start = _a[0], end = _a[1];\n follow_sign = -1;\n }\n var follow_interval = this.follow_interval;\n if (follow_interval != null && Math.abs(start - end) > follow_interval) {\n if (this.follow == 'start')\n end = start + follow_sign * follow_interval;\n else if (this.follow == 'end')\n start = end - follow_sign * follow_interval;\n }\n return [start, end];\n };\n DataRange1d.prototype.update = function (bounds, dimension, bounds_id, ratio) {\n if (this.have_updated_interactively)\n return;\n var renderers = this.computed_renderers();\n // update the raw data bounds for all renderers we care about\n var total_bounds = this._compute_plot_bounds(renderers, bounds);\n if (ratio != null)\n total_bounds = this.adjust_bounds_for_aspect(total_bounds, ratio);\n this._plot_bounds[bounds_id] = total_bounds;\n // compute the min/mix for our specified dimension\n var _a = this._compute_min_max(this._plot_bounds, dimension), min = _a[0], max = _a[1];\n // derive start, end from bounds and data range config\n var _b = this._compute_range(min, max), start = _b[0], end = _b[1];\n if (this._initial_start != null) {\n if (this.scale_hint == \"log\") {\n if (this._initial_start > 0)\n start = this._initial_start;\n }\n else\n start = this._initial_start;\n }\n if (this._initial_end != null) {\n if (this.scale_hint == \"log\") {\n if (this._initial_end > 0)\n end = this._initial_end;\n }\n else\n end = this._initial_end;\n }\n // only trigger updates when there are changes\n var _c = [this.start, this.end], _start = _c[0], _end = _c[1];\n if (start != _start || end != _end) {\n var new_range = {};\n if (start != _start)\n new_range.start = start;\n if (end != _end)\n new_range.end = end;\n this.setv(new_range);\n }\n if (this.bounds == 'auto')\n this.setv({ bounds: [start, end] }, { silent: true });\n this.change.emit();\n };\n DataRange1d.prototype.reset = function () {\n this.have_updated_interactively = false;\n // change events silenced as PlotCanvasView.update_dataranges triggers property callbacks\n this.setv({\n range_padding: this._initial_range_padding,\n range_padding_units: this._initial_range_padding_units,\n follow: this._initial_follow,\n follow_interval: this._initial_follow_interval,\n default_span: this._initial_default_span,\n }, { silent: true });\n this.change.emit();\n };\n return DataRange1d;\n }(data_range_1.DataRange));\n exports.DataRange1d = DataRange1d;\n DataRange1d.initClass();\n}\n","/* models/ranges/factor_range */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var range_1 = require(183) /* ./range */;\n var p = require(15) /* core/properties */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n function map_one_level(factors, padding, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n var mapping = {};\n for (var i = 0; i < factors.length; i++) {\n var factor = factors[i];\n if (factor in mapping)\n throw new Error(\"duplicate factor or subfactor: \" + factor);\n else\n mapping[factor] = { value: 0.5 + i * (1 + padding) + offset };\n }\n return [mapping, (factors.length - 1) * padding];\n }\n exports.map_one_level = map_one_level;\n function map_two_levels(factors, outer_pad, factor_pad, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n var mapping = {};\n var tops = {};\n var tops_order = [];\n for (var _i = 0, factors_1 = factors; _i < factors_1.length; _i++) {\n var _a = factors_1[_i], f0 = _a[0], f1 = _a[1];\n if (!(f0 in tops)) {\n tops[f0] = [];\n tops_order.push(f0);\n }\n tops[f0].push(f1);\n }\n var suboffset = offset;\n var total_subpad = 0;\n var _loop_1 = function (f0) {\n var n = tops[f0].length;\n var _a = map_one_level(tops[f0], factor_pad, suboffset), submap = _a[0], subpad = _a[1];\n total_subpad += subpad;\n var subtot = array_1.sum(tops[f0].map(function (f1) { return submap[f1].value; }));\n mapping[f0] = { value: subtot / n, mapping: submap };\n suboffset += n + outer_pad + subpad;\n };\n for (var _b = 0, tops_order_1 = tops_order; _b < tops_order_1.length; _b++) {\n var f0 = tops_order_1[_b];\n _loop_1(f0);\n }\n return [mapping, tops_order, (tops_order.length - 1) * outer_pad + total_subpad];\n }\n exports.map_two_levels = map_two_levels;\n function map_three_levels(factors, outer_pad, inner_pad, factor_pad, offset) {\n if (offset === void 0) {\n offset = 0;\n }\n var mapping = {};\n var tops = {};\n var tops_order = [];\n for (var _i = 0, factors_2 = factors; _i < factors_2.length; _i++) {\n var _a = factors_2[_i], f0 = _a[0], f1 = _a[1], f2 = _a[2];\n if (!(f0 in tops)) {\n tops[f0] = [];\n tops_order.push(f0);\n }\n tops[f0].push([f1, f2]);\n }\n var mids_order = [];\n var suboffset = offset;\n var total_subpad = 0;\n var _loop_2 = function (f0) {\n var n = tops[f0].length;\n var _a = map_two_levels(tops[f0], inner_pad, factor_pad, suboffset), submap = _a[0], submids_order = _a[1], subpad = _a[2];\n for (var _i = 0, submids_order_1 = submids_order; _i < submids_order_1.length; _i++) {\n var f1 = submids_order_1[_i];\n mids_order.push([f0, f1]);\n }\n total_subpad += subpad;\n var subtot = array_1.sum(tops[f0].map(function (_a) {\n var f1 = _a[0];\n return submap[f1].value;\n }));\n mapping[f0] = { value: subtot / n, mapping: submap };\n suboffset += n + outer_pad + subpad;\n };\n for (var _b = 0, tops_order_2 = tops_order; _b < tops_order_2.length; _b++) {\n var f0 = tops_order_2[_b];\n _loop_2(f0);\n }\n return [mapping, tops_order, mids_order, (tops_order.length - 1) * outer_pad + total_subpad];\n }\n exports.map_three_levels = map_three_levels;\n var FactorRange = /** @class */ (function (_super) {\n tslib_1.__extends(FactorRange, _super);\n function FactorRange(attrs) {\n return _super.call(this, attrs) || this;\n }\n FactorRange.initClass = function () {\n this.prototype.type = \"FactorRange\";\n this.define({\n factors: [p.Array, []],\n factor_padding: [p.Number, 0],\n subgroup_padding: [p.Number, 0.8],\n group_padding: [p.Number, 1.4],\n range_padding: [p.Number, 0],\n range_padding_units: [p.PaddingUnits, \"percent\"],\n start: [p.Number],\n end: [p.Number],\n });\n this.internal({\n levels: [p.Number],\n mids: [p.Array],\n tops: [p.Array],\n tops_groups: [p.Array],\n });\n };\n Object.defineProperty(FactorRange.prototype, \"min\", {\n get: function () {\n return this.start;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(FactorRange.prototype, \"max\", {\n get: function () {\n return this.end;\n },\n enumerable: true,\n configurable: true\n });\n FactorRange.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._init(true);\n };\n FactorRange.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.properties.factors.change, function () { return _this.reset(); });\n this.connect(this.properties.factor_padding.change, function () { return _this.reset(); });\n this.connect(this.properties.group_padding.change, function () { return _this.reset(); });\n this.connect(this.properties.subgroup_padding.change, function () { return _this.reset(); });\n this.connect(this.properties.range_padding.change, function () { return _this.reset(); });\n this.connect(this.properties.range_padding_units.change, function () { return _this.reset(); });\n };\n FactorRange.prototype.reset = function () {\n this._init(false);\n this.change.emit();\n };\n FactorRange.prototype._lookup = function (x) {\n if (x.length == 1) {\n var m = this._mapping;\n if (!m.hasOwnProperty(x[0])) {\n return NaN;\n }\n return m[x[0]].value;\n }\n else if (x.length == 2) {\n var m = this._mapping;\n if (!m.hasOwnProperty(x[0]) || !m[x[0]].mapping.hasOwnProperty(x[1])) {\n return NaN;\n }\n return m[x[0]].mapping[x[1]].value;\n }\n else if (x.length == 3) {\n var m = this._mapping;\n if (!m.hasOwnProperty(x[0]) || !m[x[0]].mapping.hasOwnProperty(x[1]) || !m[x[0]].mapping[x[1]].mapping.hasOwnProperty(x[2])) {\n return NaN;\n }\n return m[x[0]].mapping[x[1]].mapping[x[2]].value;\n }\n else\n throw new Error(\"unreachable code\");\n };\n // convert a string factor into a synthetic coordinate\n FactorRange.prototype.synthetic = function (x) {\n if (types_1.isNumber(x))\n return x;\n if (types_1.isString(x))\n return this._lookup([x]);\n var offset = 0;\n var off = x[x.length - 1];\n if (types_1.isNumber(off)) {\n offset = off;\n x = x.slice(0, -1);\n }\n return this._lookup(x) + offset;\n };\n // convert an array of string factors into synthetic coordinates\n FactorRange.prototype.v_synthetic = function (xs) {\n var _this = this;\n return arrayable_1.map(xs, function (x) { return _this.synthetic(x); });\n };\n FactorRange.prototype._init = function (silent) {\n var _a, _b, _c;\n var levels;\n var inside_padding;\n if (array_1.all(this.factors, types_1.isString)) {\n levels = 1;\n _a = map_one_level(this.factors, this.factor_padding), this._mapping = _a[0], inside_padding = _a[1];\n }\n else if (array_1.all(this.factors, function (x) { return types_1.isArray(x) && x.length == 2 && types_1.isString(x[0]) && types_1.isString(x[1]); })) {\n levels = 2;\n _b = map_two_levels(this.factors, this.group_padding, this.factor_padding), this._mapping = _b[0], this.tops = _b[1], inside_padding = _b[2];\n }\n else if (array_1.all(this.factors, function (x) { return types_1.isArray(x) && x.length == 3 && types_1.isString(x[0]) && types_1.isString(x[1]) && types_1.isString(x[2]); })) {\n levels = 3;\n _c = map_three_levels(this.factors, this.group_padding, this.subgroup_padding, this.factor_padding), this._mapping = _c[0], this.tops = _c[1], this.mids = _c[2], inside_padding = _c[3];\n }\n else\n throw new Error(\"???\");\n var start = 0;\n var end = this.factors.length + inside_padding;\n if (this.range_padding_units == \"percent\") {\n var half_span = (end - start) * this.range_padding / 2;\n start -= half_span;\n end += half_span;\n }\n else {\n start -= this.range_padding;\n end += this.range_padding;\n }\n this.setv({ start: start, end: end, levels: levels }, { silent: silent });\n if (this.bounds == \"auto\")\n this.setv({ bounds: [start, end] }, { silent: true });\n };\n return FactorRange;\n }(range_1.Range));\n exports.FactorRange = FactorRange;\n FactorRange.initClass();\n}\n","/* models/ranges/index */ function _(require, module, exports) {\n var data_range_1 = require(179) /* ./data_range */;\n exports.DataRange = data_range_1.DataRange;\n var data_range1d_1 = require(180) /* ./data_range1d */;\n exports.DataRange1d = data_range1d_1.DataRange1d;\n var factor_range_1 = require(181) /* ./factor_range */;\n exports.FactorRange = factor_range_1.FactorRange;\n var range_1 = require(183) /* ./range */;\n exports.Range = range_1.Range;\n var range1d_1 = require(184) /* ./range1d */;\n exports.Range1d = range1d_1.Range1d;\n}\n","/* models/ranges/range */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var Range = /** @class */ (function (_super) {\n tslib_1.__extends(Range, _super);\n function Range(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.have_updated_interactively = false;\n return _this;\n }\n Range.initClass = function () {\n this.prototype.type = \"Range\";\n this.define({\n callback: [p.Any],\n bounds: [p.Any],\n min_interval: [p.Any],\n max_interval: [p.Any],\n });\n this.internal({\n plots: [p.Array, []],\n });\n };\n Range.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.change, function () { return _this._emit_callback(); });\n };\n Range.prototype.reset = function () {\n /**\n * This method should be reimplemented by subclasses and ensure that\n * the callback, if exists, is executed at completion.\n */\n this.change.emit();\n };\n Range.prototype._emit_callback = function () {\n if (this.callback != null) {\n if (types_1.isFunction(this.callback))\n this.callback(this);\n else\n this.callback.execute(this, {});\n }\n };\n Object.defineProperty(Range.prototype, \"is_reversed\", {\n get: function () {\n return this.start > this.end;\n },\n enumerable: true,\n configurable: true\n });\n return Range;\n }(model_1.Model));\n exports.Range = Range;\n Range.initClass();\n}\n","/* models/ranges/range1d */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var range_1 = require(183) /* ./range */;\n var p = require(15) /* core/properties */;\n var Range1d = /** @class */ (function (_super) {\n tslib_1.__extends(Range1d, _super);\n function Range1d(attrs) {\n return _super.call(this, attrs) || this;\n }\n Range1d.initClass = function () {\n this.prototype.type = \"Range1d\";\n this.define({\n start: [p.Number, 0],\n end: [p.Number, 1],\n reset_start: [p.Number],\n reset_end: [p.Number],\n });\n };\n Range1d.prototype._set_auto_bounds = function () {\n if (this.bounds == 'auto') {\n var min = Math.min(this.reset_start, this.reset_end);\n var max = Math.max(this.reset_start, this.reset_end);\n this.setv({ bounds: [min, max] }, { silent: true });\n }\n };\n Range1d.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n if (this.reset_start == null) {\n this.reset_start = this.start;\n }\n if (this.reset_end == null) {\n this.reset_end = this.end;\n }\n this._set_auto_bounds();\n };\n Object.defineProperty(Range1d.prototype, \"min\", {\n get: function () {\n return Math.min(this.start, this.end);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Range1d.prototype, \"max\", {\n get: function () {\n return Math.max(this.start, this.end);\n },\n enumerable: true,\n configurable: true\n });\n Range1d.prototype.reset = function () {\n this._set_auto_bounds();\n if (this.start != this.reset_start || this.end != this.reset_end)\n this.setv({ start: this.reset_start, end: this.reset_end });\n else\n this.change.emit();\n };\n return Range1d;\n }(range_1.Range));\n exports.Range1d = Range1d;\n Range1d.initClass();\n}\n","/* models/renderers/glyph_renderer */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var renderer_1 = require(189) /* ./renderer */;\n var line_1 = require(130) /* ../glyphs/line */;\n var cds_view_1 = require(199) /* ../sources/cds_view */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var arrayable_1 = require(22) /* core/util/arrayable */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var factor_range_1 = require(181) /* ../ranges/factor_range */;\n var selection_defaults = {\n fill: {},\n line: {},\n };\n var decimated_defaults = {\n fill: { fill_alpha: 0.3, fill_color: \"grey\" },\n line: { line_alpha: 0.3, line_color: \"grey\" },\n };\n var nonselection_defaults = {\n fill: { fill_alpha: 0.2 },\n line: {},\n };\n var GlyphRendererView = /** @class */ (function (_super) {\n tslib_1.__extends(GlyphRendererView, _super);\n function GlyphRendererView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n GlyphRendererView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n var base_glyph = this.model.glyph;\n var has_fill = array_1.includes(base_glyph.mixins, \"fill\");\n var has_line = array_1.includes(base_glyph.mixins, \"line\");\n var glyph_attrs = object_1.clone(base_glyph.attributes);\n delete glyph_attrs.id;\n function mk_glyph(defaults) {\n var attrs = object_1.clone(glyph_attrs);\n if (has_fill)\n object_1.extend(attrs, defaults.fill);\n if (has_line)\n object_1.extend(attrs, defaults.line);\n return new base_glyph.constructor(attrs);\n }\n this.glyph = this.build_glyph_view(base_glyph);\n var selection_glyph = this.model.selection_glyph;\n if (selection_glyph == null)\n selection_glyph = mk_glyph({ fill: {}, line: {} });\n else if (selection_glyph === \"auto\")\n selection_glyph = mk_glyph(selection_defaults);\n this.selection_glyph = this.build_glyph_view(selection_glyph);\n var nonselection_glyph = this.model.nonselection_glyph;\n if ((nonselection_glyph == null))\n nonselection_glyph = mk_glyph({ fill: {}, line: {} });\n else if (nonselection_glyph === \"auto\")\n nonselection_glyph = mk_glyph(nonselection_defaults);\n this.nonselection_glyph = this.build_glyph_view(nonselection_glyph);\n var hover_glyph = this.model.hover_glyph;\n if (hover_glyph != null)\n this.hover_glyph = this.build_glyph_view(hover_glyph);\n var muted_glyph = this.model.muted_glyph;\n if (muted_glyph != null)\n this.muted_glyph = this.build_glyph_view(muted_glyph);\n var decimated_glyph = mk_glyph(decimated_defaults);\n this.decimated_glyph = this.build_glyph_view(decimated_glyph);\n this.xscale = this.plot_view.frame.xscales[this.model.x_range_name];\n this.yscale = this.plot_view.frame.yscales[this.model.y_range_name];\n this.set_data(false);\n };\n GlyphRendererView.prototype.build_glyph_view = function (model) {\n return new model.default_view({ model: model, renderer: this, plot_view: this.plot_view, parent: this }); // XXX\n };\n GlyphRendererView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.request_render(); });\n this.connect(this.model.glyph.change, function () { return _this.set_data(); });\n this.connect(this.model.data_source.change, function () { return _this.set_data(); });\n this.connect(this.model.data_source.streaming, function () { return _this.set_data(); });\n this.connect(this.model.data_source.patching, function (indices /* XXX: WHY? */) { return _this.set_data(true, indices); });\n this.connect(this.model.data_source.selected.change, function () { return _this.request_render(); });\n this.connect(this.model.data_source._select, function () { return _this.request_render(); });\n if (this.hover_glyph != null)\n this.connect(this.model.data_source.inspect, function () { return _this.request_render(); });\n this.connect(this.model.properties.view.change, function () { return _this.set_data(); });\n this.connect(this.model.view.change, function () { return _this.set_data(); });\n var _a = this.plot_model.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges;\n for (var name_1 in x_ranges) {\n var rng = x_ranges[name_1];\n if (rng instanceof factor_range_1.FactorRange)\n this.connect(rng.change, function () { return _this.set_data(); });\n }\n for (var name_2 in y_ranges) {\n var rng = y_ranges[name_2];\n if (rng instanceof factor_range_1.FactorRange)\n this.connect(rng.change, function () { return _this.set_data(); });\n }\n this.connect(this.model.glyph.transformchange, function () { return _this.set_data(); });\n };\n GlyphRendererView.prototype.have_selection_glyphs = function () {\n return this.selection_glyph != null && this.nonselection_glyph != null;\n };\n // in case of partial updates like patching, the list of indices that actually\n // changed may be passed as the \"indices\" parameter to afford any optional optimizations\n GlyphRendererView.prototype.set_data = function (request_render, indices) {\n if (request_render === void 0) {\n request_render = true;\n }\n if (indices === void 0) {\n indices = null;\n }\n var t0 = Date.now();\n var source = this.model.data_source;\n this.all_indices = this.model.view.indices;\n // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call\n // mapping functions on the base Renderer class\n this.glyph.model.setv({ x_range_name: this.model.x_range_name,\n y_range_name: this.model.y_range_name }, { silent: true });\n this.glyph.set_data(source, this.all_indices, indices);\n this.glyph.set_visuals(source);\n this.decimated_glyph.set_visuals(source);\n if (this.have_selection_glyphs()) {\n this.selection_glyph.set_visuals(source);\n this.nonselection_glyph.set_visuals(source);\n }\n if (this.hover_glyph != null)\n this.hover_glyph.set_visuals(source);\n if (this.muted_glyph != null)\n this.muted_glyph.set_visuals(source);\n var lod_factor = this.plot_model.plot.lod_factor;\n this.decimated = [];\n for (var i = 0, end = Math.floor(this.all_indices.length / lod_factor); i < end; i++) {\n this.decimated.push(i * lod_factor);\n }\n var dt = Date.now() - t0;\n logging_1.logger.debug(this.glyph.model.type + \" GlyphRenderer (\" + this.model.id + \"): set_data finished in \" + dt + \"ms\");\n this.set_data_timestamp = Date.now();\n if (request_render)\n this.request_render();\n };\n GlyphRendererView.prototype.render = function () {\n var _this = this;\n if (!this.model.visible)\n return;\n var t0 = Date.now();\n var glsupport = this.glyph.glglyph;\n this.glyph.map_data();\n var dtmap = Date.now() - t0;\n var tmask = Date.now();\n // all_indices is in full data space, indices is converted to subset space\n // either by mask_data (that uses the spatial index) or manually\n var indices = this.glyph.mask_data(this.all_indices);\n if (indices.length === this.all_indices.length) {\n indices = array_1.range(0, this.all_indices.length);\n }\n var dtmask = Date.now() - tmask;\n var ctx = this.plot_view.canvas_view.ctx;\n ctx.save();\n // selected is in full set space\n var selected = this.model.data_source.selected;\n var selected_full_indices;\n if (!selected || selected.is_empty()) {\n selected_full_indices = [];\n }\n else {\n if (this.glyph instanceof line_1.LineView && selected.selected_glyph === this.glyph.model) {\n selected_full_indices = this.model.view.convert_indices_from_subset(indices);\n }\n else {\n selected_full_indices = selected.indices;\n }\n }\n // inspected is in full set space\n var inspected = this.model.data_source.inspected;\n var inspected_full_indices;\n if (!inspected || (inspected.length === 0)) {\n inspected_full_indices = [];\n }\n else {\n if (inspected['0d'].glyph) {\n inspected_full_indices = this.model.view.convert_indices_from_subset(indices);\n }\n else if (inspected['1d'].indices.length > 0) {\n inspected_full_indices = inspected['1d'].indices;\n }\n else {\n inspected_full_indices = ((function () {\n var result = [];\n for (var _i = 0, _a = Object.keys(inspected[\"2d\"].indices); _i < _a.length; _i++) {\n var i = _a[_i];\n result.push(parseInt(i));\n }\n return result;\n })());\n }\n }\n // inspected is transformed to subset space\n var inspected_subset_indices = ((function () {\n var result = [];\n for (var _i = 0, indices_2 = indices; _i < indices_2.length; _i++) {\n var i = indices_2[_i];\n if (array_1.includes(inspected_full_indices, _this.all_indices[i]))\n result.push(i);\n }\n return result;\n })());\n var lod_threshold = this.plot_model.plot.lod_threshold;\n var glyph;\n var nonselection_glyph;\n var selection_glyph;\n if ((this.model.document != null ? this.model.document.interactive_duration() > 0 : false)\n && !glsupport && lod_threshold != null && this.all_indices.length > lod_threshold) {\n // Render decimated during interaction if too many elements and not using GL\n indices = this.decimated;\n glyph = this.decimated_glyph;\n nonselection_glyph = this.decimated_glyph;\n selection_glyph = this.selection_glyph;\n }\n else {\n glyph = this.model.muted && this.muted_glyph != null ? this.muted_glyph : this.glyph;\n nonselection_glyph = this.nonselection_glyph;\n selection_glyph = this.selection_glyph;\n }\n if (this.hover_glyph != null && inspected_subset_indices.length)\n indices = array_1.difference(indices, inspected_subset_indices);\n // Render with no selection\n var dtselect = null;\n var trender;\n if (!(selected_full_indices.length && this.have_selection_glyphs())) {\n trender = Date.now();\n if (this.glyph instanceof line_1.LineView) {\n if (this.hover_glyph && inspected_subset_indices.length)\n this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph);\n else\n glyph.render(ctx, this.all_indices, this.glyph);\n }\n else {\n glyph.render(ctx, indices, this.glyph);\n if (this.hover_glyph && inspected_subset_indices.length)\n this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph);\n }\n // Render with selection\n }\n else {\n // reset the selection mask\n var tselect = Date.now();\n var selected_mask = {};\n for (var _i = 0, selected_full_indices_1 = selected_full_indices; _i < selected_full_indices_1.length; _i++) {\n var i = selected_full_indices_1[_i];\n selected_mask[i] = true;\n }\n // intersect/different selection with render mask\n var selected_subset_indices = new Array();\n var nonselected_subset_indices = new Array();\n // now, selected is changed to subset space, except for Line glyph\n if (this.glyph instanceof line_1.LineView) {\n for (var _a = 0, _b = this.all_indices; _a < _b.length; _a++) {\n var i = _b[_a];\n if (selected_mask[i] != null)\n selected_subset_indices.push(i);\n else\n nonselected_subset_indices.push(i);\n }\n }\n else {\n for (var _c = 0, indices_1 = indices; _c < indices_1.length; _c++) {\n var i = indices_1[_c];\n if (selected_mask[this.all_indices[i]] != null)\n selected_subset_indices.push(i);\n else\n nonselected_subset_indices.push(i);\n }\n }\n dtselect = Date.now() - tselect;\n trender = Date.now();\n nonselection_glyph.render(ctx, nonselected_subset_indices, this.glyph);\n selection_glyph.render(ctx, selected_subset_indices, this.glyph);\n if (this.hover_glyph != null) {\n if (this.glyph instanceof line_1.LineView)\n this.hover_glyph.render(ctx, this.model.view.convert_indices_from_subset(inspected_subset_indices), this.glyph);\n else\n this.hover_glyph.render(ctx, inspected_subset_indices, this.glyph);\n }\n }\n var dtrender = Date.now() - trender;\n this.last_dtrender = dtrender;\n var dttot = Date.now() - t0;\n logging_1.logger.debug(this.glyph.model.type + \" GlyphRenderer (\" + this.model.id + \"): render finished in \" + dttot + \"ms\");\n logging_1.logger.trace(\" - map_data finished in : \" + dtmap + \"ms\");\n logging_1.logger.trace(\" - mask_data finished in : \" + dtmask + \"ms\");\n if (dtselect != null) {\n logging_1.logger.trace(\" - selection mask finished in : \" + dtselect + \"ms\");\n }\n logging_1.logger.trace(\" - glyph renders finished in : \" + dtrender + \"ms\");\n return ctx.restore();\n };\n GlyphRendererView.prototype.draw_legend = function (ctx, x0, x1, y0, y1, field, label, index) {\n if (index == null)\n index = this.model.get_reference_point(field, label);\n this.glyph.draw_legend_for_index(ctx, { x0: x0, x1: x1, y0: y0, y1: y1 }, index);\n };\n GlyphRendererView.prototype.hit_test = function (geometry) {\n if (!this.model.visible)\n return null;\n var hit_test_result = this.glyph.hit_test(geometry);\n // glyphs that don't have hit-testing implemented will return null\n if (hit_test_result == null)\n return null;\n return this.model.view.convert_selection_from_subset(hit_test_result);\n };\n return GlyphRendererView;\n }(renderer_1.RendererView));\n exports.GlyphRendererView = GlyphRendererView;\n var GlyphRenderer = /** @class */ (function (_super) {\n tslib_1.__extends(GlyphRenderer, _super);\n function GlyphRenderer(attrs) {\n return _super.call(this, attrs) || this;\n }\n GlyphRenderer.initClass = function () {\n this.prototype.type = 'GlyphRenderer';\n this.prototype.default_view = GlyphRendererView;\n this.define({\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n data_source: [p.Instance],\n view: [p.Instance, function () { return new cds_view_1.CDSView(); }],\n glyph: [p.Instance],\n hover_glyph: [p.Instance],\n nonselection_glyph: [p.Any, 'auto'],\n selection_glyph: [p.Any, 'auto'],\n muted_glyph: [p.Instance],\n muted: [p.Bool, false],\n });\n this.override({\n level: 'glyph',\n });\n };\n GlyphRenderer.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n if (this.view.source == null) {\n this.view.source = this.data_source;\n this.view.compute_indices();\n }\n };\n GlyphRenderer.prototype.get_reference_point = function (field, value) {\n var index = 0;\n if (field != null) {\n var data = this.data_source.get_column(field);\n if (data != null) {\n var i = arrayable_1.indexOf(data, value);\n if (i != -1)\n index = i;\n }\n }\n return index;\n };\n GlyphRenderer.prototype.get_selection_manager = function () {\n return this.data_source.selection_manager;\n };\n return GlyphRenderer;\n }(renderer_1.Renderer));\n exports.GlyphRenderer = GlyphRenderer;\n GlyphRenderer.initClass();\n}\n","/* models/renderers/graph_renderer */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var renderer_1 = require(189) /* ./renderer */;\n var graph_hit_test_policy_1 = require(147) /* ../graphs/graph_hit_test_policy */;\n var p = require(15) /* core/properties */;\n var build_views_1 = require(4) /* core/build_views */;\n var GraphRendererView = /** @class */ (function (_super) {\n tslib_1.__extends(GraphRendererView, _super);\n function GraphRendererView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n GraphRendererView.prototype.initialize = function (options) {\n var _a;\n _super.prototype.initialize.call(this, options);\n this.xscale = this.plot_view.frame.xscales[\"default\"];\n this.yscale = this.plot_view.frame.yscales[\"default\"];\n this._renderer_views = {};\n _a = build_views_1.build_views(this._renderer_views, [this.model.node_renderer, this.model.edge_renderer], this.plot_view.view_options()), this.node_view = _a[0], this.edge_view = _a[1];\n this.set_data();\n };\n GraphRendererView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.layout_provider.change, function () { return _this.set_data(); });\n this.connect(this.model.node_renderer.data_source._select, function () { return _this.set_data(); });\n this.connect(this.model.node_renderer.data_source.inspect, function () { return _this.set_data(); });\n this.connect(this.model.node_renderer.data_source.change, function () { return _this.set_data(); });\n this.connect(this.model.edge_renderer.data_source._select, function () { return _this.set_data(); });\n this.connect(this.model.edge_renderer.data_source.inspect, function () { return _this.set_data(); });\n this.connect(this.model.edge_renderer.data_source.change, function () { return _this.set_data(); });\n var _a = this.plot_model.frame, x_ranges = _a.x_ranges, y_ranges = _a.y_ranges;\n for (var name_1 in x_ranges) {\n var rng = x_ranges[name_1];\n this.connect(rng.change, function () { return _this.set_data(); });\n }\n for (var name_2 in y_ranges) {\n var rng = y_ranges[name_2];\n this.connect(rng.change, function () { return _this.set_data(); });\n }\n };\n GraphRendererView.prototype.set_data = function (request_render) {\n if (request_render === void 0) {\n request_render = true;\n }\n var _a, _b;\n // TODO (bev) this is a bit clunky, need to make sure glyphs use the correct ranges when they call\n // mapping functions on the base Renderer class\n this.node_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true });\n this.edge_view.glyph.model.setv({ x_range_name: this.model.x_range_name, y_range_name: this.model.y_range_name }, { silent: true });\n // XXX\n var node_glyph = this.node_view.glyph;\n _a = this.model.layout_provider.get_node_coordinates(this.model.node_renderer.data_source), node_glyph._x = _a[0], node_glyph._y = _a[1];\n var edge_glyph = this.edge_view.glyph;\n _b = this.model.layout_provider.get_edge_coordinates(this.model.edge_renderer.data_source), edge_glyph._xs = _b[0], edge_glyph._ys = _b[1];\n node_glyph.index_data();\n edge_glyph.index_data();\n if (request_render)\n this.request_render();\n };\n GraphRendererView.prototype.render = function () {\n this.edge_view.render();\n this.node_view.render();\n };\n return GraphRendererView;\n }(renderer_1.RendererView));\n exports.GraphRendererView = GraphRendererView;\n var GraphRenderer = /** @class */ (function (_super) {\n tslib_1.__extends(GraphRenderer, _super);\n function GraphRenderer(attrs) {\n return _super.call(this, attrs) || this;\n }\n GraphRenderer.initClass = function () {\n this.prototype.type = 'GraphRenderer';\n this.prototype.default_view = GraphRendererView;\n this.define({\n x_range_name: [p.String, 'default'],\n y_range_name: [p.String, 'default'],\n layout_provider: [p.Instance],\n node_renderer: [p.Instance],\n edge_renderer: [p.Instance],\n selection_policy: [p.Instance, function () { return new graph_hit_test_policy_1.NodesOnly(); }],\n inspection_policy: [p.Instance, function () { return new graph_hit_test_policy_1.NodesOnly(); }],\n });\n this.override({\n level: 'glyph',\n });\n };\n GraphRenderer.prototype.get_selection_manager = function () {\n return this.node_renderer.data_source.selection_manager;\n };\n return GraphRenderer;\n }(renderer_1.Renderer));\n exports.GraphRenderer = GraphRenderer;\n GraphRenderer.initClass();\n}\n","/* models/renderers/guide_renderer */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var renderer_1 = require(189) /* ./renderer */;\n var p = require(15) /* core/properties */;\n var GuideRendererView = /** @class */ (function (_super) {\n tslib_1.__extends(GuideRendererView, _super);\n function GuideRendererView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return GuideRendererView;\n }(renderer_1.RendererView));\n exports.GuideRendererView = GuideRendererView;\n var GuideRenderer = /** @class */ (function (_super) {\n tslib_1.__extends(GuideRenderer, _super);\n function GuideRenderer(attrs) {\n return _super.call(this, attrs) || this;\n }\n GuideRenderer.initClass = function () {\n this.prototype.type = \"GuideRenderer\";\n this.define({\n plot: [p.Instance],\n });\n this.override({\n level: \"overlay\",\n });\n };\n return GuideRenderer;\n }(renderer_1.Renderer));\n exports.GuideRenderer = GuideRenderer;\n GuideRenderer.initClass();\n}\n","/* models/renderers/index */ function _(require, module, exports) {\n var glyph_renderer_1 = require(185) /* ./glyph_renderer */;\n exports.GlyphRenderer = glyph_renderer_1.GlyphRenderer;\n var graph_renderer_1 = require(186) /* ./graph_renderer */;\n exports.GraphRenderer = graph_renderer_1.GraphRenderer;\n var guide_renderer_1 = require(187) /* ./guide_renderer */;\n exports.GuideRenderer = guide_renderer_1.GuideRenderer;\n var renderer_1 = require(189) /* ./renderer */;\n exports.Renderer = renderer_1.Renderer;\n}\n","/* models/renderers/renderer */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_view_1 = require(6) /* core/dom_view */;\n var visuals = require(49) /* core/visuals */;\n var p = require(15) /* core/properties */;\n var model_1 = require(59) /* ../../model */;\n // This shouldn't be a DOMView, but annotations create a mess.\n var RendererView = /** @class */ (function (_super) {\n tslib_1.__extends(RendererView, _super);\n function RendererView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RendererView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.plot_view = options.plot_view;\n this.visuals = new visuals.Visuals(this.model);\n this._has_finished = true; // XXX: should be in render() but subclasses don't respect super()\n };\n Object.defineProperty(RendererView.prototype, \"plot_model\", {\n get: function () {\n return this.plot_view.model;\n },\n enumerable: true,\n configurable: true\n });\n RendererView.prototype.request_render = function () {\n this.plot_view.request_render();\n };\n RendererView.prototype.map_to_screen = function (x, y) {\n return this.plot_view.map_to_screen(x, y, this.model.x_range_name, this.model.y_range_name);\n };\n Object.defineProperty(RendererView.prototype, \"needs_clip\", {\n get: function () {\n return false;\n },\n enumerable: true,\n configurable: true\n });\n return RendererView;\n }(dom_view_1.DOMView));\n exports.RendererView = RendererView;\n var Renderer = /** @class */ (function (_super) {\n tslib_1.__extends(Renderer, _super);\n function Renderer(attrs) {\n return _super.call(this, attrs) || this;\n }\n Renderer.initClass = function () {\n this.prototype.type = \"Renderer\";\n this.define({\n level: [p.RenderLevel],\n visible: [p.Bool, true],\n });\n };\n return Renderer;\n }(model_1.Model));\n exports.Renderer = Renderer;\n Renderer.initClass();\n}\n","/* models/scales/categorical_scale */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var linear_scale_1 = require(192) /* ./linear_scale */;\n var CategoricalScale = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalScale, _super);\n function CategoricalScale(attrs) {\n return _super.call(this, attrs) || this;\n }\n CategoricalScale.initClass = function () {\n this.prototype.type = \"CategoricalScale\";\n };\n CategoricalScale.prototype.compute = function (x) {\n return _super.prototype.compute.call(this, this.source_range.synthetic(x));\n };\n CategoricalScale.prototype.v_compute = function (xs) {\n return _super.prototype.v_compute.call(this, this.source_range.v_synthetic(xs));\n };\n return CategoricalScale;\n }(linear_scale_1.LinearScale));\n exports.CategoricalScale = CategoricalScale;\n CategoricalScale.initClass();\n}\n","/* models/scales/index */ function _(require, module, exports) {\n var categorical_scale_1 = require(190) /* ./categorical_scale */;\n exports.CategoricalScale = categorical_scale_1.CategoricalScale;\n var linear_scale_1 = require(192) /* ./linear_scale */;\n exports.LinearScale = linear_scale_1.LinearScale;\n var log_scale_1 = require(193) /* ./log_scale */;\n exports.LogScale = log_scale_1.LogScale;\n var scale_1 = require(194) /* ./scale */;\n exports.Scale = scale_1.Scale;\n}\n","/* models/scales/linear_scale */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var scale_1 = require(194) /* ./scale */;\n var LinearScale = /** @class */ (function (_super) {\n tslib_1.__extends(LinearScale, _super);\n function LinearScale(attrs) {\n return _super.call(this, attrs) || this;\n }\n LinearScale.initClass = function () {\n this.prototype.type = \"LinearScale\";\n };\n LinearScale.prototype.compute = function (x) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1];\n return factor * x + offset;\n };\n LinearScale.prototype.v_compute = function (xs) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1];\n var result = new Float64Array(xs.length);\n for (var i = 0; i < xs.length; i++)\n result[i] = factor * xs[i] + offset;\n return result;\n };\n LinearScale.prototype.invert = function (xprime) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1];\n return (xprime - offset) / factor;\n };\n LinearScale.prototype.v_invert = function (xprimes) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1];\n var result = new Float64Array(xprimes.length);\n for (var i = 0; i < xprimes.length; i++)\n result[i] = (xprimes[i] - offset) / factor;\n return result;\n };\n LinearScale.prototype._compute_state = function () {\n //\n // (t1 - t0) (t1 - t0)\n // --------- * x - --------- * s0 + t0\n // (s1 - s0) (s1 - s0)\n //\n // [ factor ] [ offset ]\n //\n var source_start = this.source_range.start;\n var source_end = this.source_range.end;\n var target_start = this.target_range.start;\n var target_end = this.target_range.end;\n var factor = (target_end - target_start) / (source_end - source_start);\n var offset = -(factor * source_start) + target_start;\n return [factor, offset];\n };\n return LinearScale;\n }(scale_1.Scale));\n exports.LinearScale = LinearScale;\n LinearScale.initClass();\n}\n","/* models/scales/log_scale */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var scale_1 = require(194) /* ./scale */;\n var LogScale = /** @class */ (function (_super) {\n tslib_1.__extends(LogScale, _super);\n function LogScale(attrs) {\n return _super.call(this, attrs) || this;\n }\n LogScale.initClass = function () {\n this.prototype.type = \"LogScale\";\n };\n LogScale.prototype.compute = function (x) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3];\n var value;\n if (inter_factor == 0)\n value = 0;\n else {\n var _x = (Math.log(x) - inter_offset) / inter_factor;\n if (isFinite(_x))\n value = _x * factor + offset;\n else\n value = NaN;\n }\n return value;\n };\n LogScale.prototype.v_compute = function (xs) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3];\n var result = new Float64Array(xs.length);\n if (inter_factor == 0) {\n for (var i = 0; i < xs.length; i++)\n result[i] = 0;\n }\n else {\n for (var i = 0; i < xs.length; i++) {\n var _x = (Math.log(xs[i]) - inter_offset) / inter_factor;\n var value = void 0;\n if (isFinite(_x))\n value = _x * factor + offset;\n else\n value = NaN;\n result[i] = value;\n }\n }\n return result;\n };\n LogScale.prototype.invert = function (xprime) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3];\n var value = (xprime - offset) / factor;\n return Math.exp(inter_factor * value + inter_offset);\n };\n LogScale.prototype.v_invert = function (xprimes) {\n var _a = this._compute_state(), factor = _a[0], offset = _a[1], inter_factor = _a[2], inter_offset = _a[3];\n var result = new Float64Array(xprimes.length);\n for (var i = 0; i < xprimes.length; i++) {\n var value = (xprimes[i] - offset) / factor;\n result[i] = Math.exp(inter_factor * value + inter_offset);\n }\n return result;\n };\n LogScale.prototype._get_safe_factor = function (orig_start, orig_end) {\n var _a;\n var start = orig_start < 0 ? 0 : orig_start;\n var end = orig_end < 0 ? 0 : orig_end;\n if (start == end) {\n if (start == 0)\n _a = [1, 10], start = _a[0], end = _a[1];\n else {\n var log_val = Math.log(start) / Math.log(10);\n start = Math.pow(10, Math.floor(log_val));\n if (Math.ceil(log_val) != Math.floor(log_val))\n end = Math.pow(10, Math.ceil(log_val));\n else\n end = Math.pow(10, Math.ceil(log_val) + 1);\n }\n }\n return [start, end];\n };\n LogScale.prototype._compute_state = function () {\n var source_start = this.source_range.start;\n var source_end = this.source_range.end;\n var target_start = this.target_range.start;\n var target_end = this.target_range.end;\n var screen_range = target_end - target_start;\n var _a = this._get_safe_factor(source_start, source_end), start = _a[0], end = _a[1];\n var inter_factor;\n var inter_offset;\n if (start == 0) {\n inter_factor = Math.log(end);\n inter_offset = 0;\n }\n else {\n inter_factor = Math.log(end) - Math.log(start);\n inter_offset = Math.log(start);\n }\n var factor = screen_range;\n var offset = target_start;\n return [factor, offset, inter_factor, inter_offset];\n };\n return LogScale;\n }(scale_1.Scale));\n exports.LogScale = LogScale;\n LogScale.initClass();\n}\n","/* models/scales/scale */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var transforms_1 = require(274) /* ../transforms */;\n var p = require(15) /* core/properties */;\n var Scale = /** @class */ (function (_super) {\n tslib_1.__extends(Scale, _super);\n function Scale(attrs) {\n return _super.call(this, attrs) || this;\n }\n Scale.initClass = function () {\n this.prototype.type = \"Scale\";\n this.internal({\n source_range: [p.Any],\n target_range: [p.Any],\n });\n };\n Scale.prototype.r_compute = function (x0, x1) {\n if (this.target_range.is_reversed)\n return [this.compute(x1), this.compute(x0)];\n else\n return [this.compute(x0), this.compute(x1)];\n };\n Scale.prototype.r_invert = function (sx0, sx1) {\n if (this.target_range.is_reversed)\n return [this.invert(sx1), this.invert(sx0)];\n else\n return [this.invert(sx0), this.invert(sx1)];\n };\n return Scale;\n }(transforms_1.Transform));\n exports.Scale = Scale;\n Scale.initClass();\n}\n","/* models/selections/index */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n tslib_1.__exportStar(require(196) /* ./interaction_policy */, exports);\n var selection_1 = require(197) /* ./selection */;\n exports.Selection = selection_1.Selection;\n}\n","/* models/selections/interaction_policy */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var SelectionPolicy = /** @class */ (function (_super) {\n tslib_1.__extends(SelectionPolicy, _super);\n function SelectionPolicy() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SelectionPolicy.prototype.do_selection = function (hit_test_result, source, final, append) {\n if (hit_test_result === null) {\n return false;\n }\n else {\n source.selected.update(hit_test_result, final, append);\n source._select.emit();\n return !source.selected.is_empty();\n }\n };\n return SelectionPolicy;\n }(model_1.Model));\n exports.SelectionPolicy = SelectionPolicy;\n SelectionPolicy.prototype.type = \"SelectionPolicy\";\n var IntersectRenderers = /** @class */ (function (_super) {\n tslib_1.__extends(IntersectRenderers, _super);\n function IntersectRenderers() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n IntersectRenderers.prototype.hit_test = function (geometry, renderer_views) {\n var hit_test_result_renderers = [];\n for (var _i = 0, renderer_views_1 = renderer_views; _i < renderer_views_1.length; _i++) {\n var r = renderer_views_1[_i];\n var result = r.hit_test(geometry);\n if (result !== null)\n hit_test_result_renderers.push(result);\n }\n if (hit_test_result_renderers.length > 0) {\n var hit_test_result = hit_test_result_renderers[0];\n for (var _a = 0, hit_test_result_renderers_1 = hit_test_result_renderers; _a < hit_test_result_renderers_1.length; _a++) {\n var hit_test_result_other = hit_test_result_renderers_1[_a];\n hit_test_result.update_through_intersection(hit_test_result_other);\n }\n return hit_test_result;\n }\n else {\n return null;\n }\n };\n return IntersectRenderers;\n }(SelectionPolicy));\n exports.IntersectRenderers = IntersectRenderers;\n IntersectRenderers.prototype.type = \"IntersectRenderers\";\n var UnionRenderers = /** @class */ (function (_super) {\n tslib_1.__extends(UnionRenderers, _super);\n function UnionRenderers() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n UnionRenderers.prototype.hit_test = function (geometry, renderer_views) {\n var hit_test_result_renderers = [];\n for (var _i = 0, renderer_views_2 = renderer_views; _i < renderer_views_2.length; _i++) {\n var r = renderer_views_2[_i];\n var result = r.hit_test(geometry);\n if (result !== null)\n hit_test_result_renderers.push(result);\n }\n if (hit_test_result_renderers.length > 0) {\n var hit_test_result = hit_test_result_renderers[0];\n for (var _a = 0, hit_test_result_renderers_2 = hit_test_result_renderers; _a < hit_test_result_renderers_2.length; _a++) {\n var hit_test_result_other = hit_test_result_renderers_2[_a];\n hit_test_result.update_through_union(hit_test_result_other);\n }\n return hit_test_result;\n }\n else {\n return null;\n }\n };\n return UnionRenderers;\n }(SelectionPolicy));\n exports.UnionRenderers = UnionRenderers;\n UnionRenderers.prototype.type = \"UnionRenderers\";\n}\n","/* models/selections/selection */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var Selection = /** @class */ (function (_super) {\n tslib_1.__extends(Selection, _super);\n function Selection(attrs) {\n return _super.call(this, attrs) || this;\n }\n Selection.initClass = function () {\n this.prototype.type = \"Selection\";\n this.define({\n indices: [p.Array, []],\n line_indices: [p.Array, []],\n multiline_indices: [p.Any, {}],\n });\n this.internal({\n final: [p.Boolean],\n selected_glyphs: [p.Array, []],\n get_view: [p.Any],\n image_indices: [p.Array, []],\n });\n };\n Selection.prototype.initialize = function () {\n var _this = this;\n _super.prototype.initialize.call(this);\n this['0d'] = { glyph: null, indices: [], flag: false, get_view: function () { return null; } };\n this['2d'] = { indices: {} };\n this['1d'] = { indices: this.indices };\n this.get_view = function () { return null; };\n this.connect(this.properties.indices.change, function () {\n return _this['1d'].indices = _this.indices;\n });\n this.connect(this.properties.line_indices.change, function () {\n _this['0d'].indices = _this.line_indices;\n if (_this.line_indices.length == 0)\n _this['0d'].flag = false;\n else\n _this['0d'].flag = true;\n });\n this.connect(this.properties.selected_glyphs.change, function () {\n return _this['0d'].glyph = _this.selected_glyph;\n });\n this.connect(this.properties.get_view.change, function () {\n return _this['0d'].get_view = _this.get_view;\n });\n this.connect(this.properties.multiline_indices.change, function () {\n return _this['2d'].indices = _this.multiline_indices;\n });\n };\n Object.defineProperty(Selection.prototype, \"selected_glyph\", {\n get: function () {\n if (this.selected_glyphs.length > 0)\n return this.selected_glyphs[0];\n else\n return null;\n },\n enumerable: true,\n configurable: true\n });\n Selection.prototype.add_to_selected_glyphs = function (glyph) {\n this.selected_glyphs.push(glyph);\n };\n Selection.prototype.update = function (selection, final, append) {\n this.final = final;\n if (append)\n this.update_through_union(selection);\n else {\n this.indices = selection.indices;\n this.line_indices = selection.line_indices;\n this.selected_glyphs = selection.selected_glyphs;\n this.get_view = selection.get_view;\n this.multiline_indices = selection.multiline_indices;\n this.image_indices = selection.image_indices;\n }\n };\n Selection.prototype.clear = function () {\n this.final = true;\n this.indices = [];\n this.line_indices = [];\n this.multiline_indices = {};\n this.get_view = function () { return null; };\n this.selected_glyphs = [];\n };\n Selection.prototype.is_empty = function () {\n return this.indices.length == 0 && this.line_indices.length == 0 && this.image_indices.length == 0;\n };\n Selection.prototype.update_through_union = function (other) {\n this.indices = array_1.union(other.indices, this.indices);\n this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n this.line_indices = array_1.union(other.line_indices, this.line_indices);\n if (!this.get_view())\n this.get_view = other.get_view;\n this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n };\n Selection.prototype.update_through_intersection = function (other) {\n this.indices = array_1.intersection(other.indices, this.indices);\n // TODO: think through and fix any logic below\n this.selected_glyphs = array_1.union(other.selected_glyphs, this.selected_glyphs);\n this.line_indices = array_1.union(other.line_indices, this.line_indices);\n if (!this.get_view())\n this.get_view = other.get_view;\n this.multiline_indices = object_1.merge(other.multiline_indices, this.multiline_indices);\n };\n return Selection;\n }(model_1.Model));\n exports.Selection = Selection;\n Selection.initClass();\n}\n","/* models/sources/ajax_data_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var remote_data_source_1 = require(205) /* ./remote_data_source */;\n var logging_1 = require(14) /* core/logging */;\n var types_1 = require(44) /* core/util/types */;\n var p = require(15) /* core/properties */;\n var AjaxDataSource = /** @class */ (function (_super) {\n tslib_1.__extends(AjaxDataSource, _super);\n function AjaxDataSource(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.initialized = false;\n return _this;\n }\n AjaxDataSource.initClass = function () {\n this.prototype.type = 'AjaxDataSource';\n this.define({\n mode: [p.String, 'replace'],\n content_type: [p.String, 'application/json'],\n adapter: [p.Any],\n http_headers: [p.Any, {}],\n max_size: [p.Number],\n method: [p.String, 'POST'],\n if_modified: [p.Bool, false],\n });\n };\n AjaxDataSource.prototype.destroy = function () {\n if (this.interval != null)\n clearInterval(this.interval);\n _super.prototype.destroy.call(this);\n };\n AjaxDataSource.prototype.setup = function () {\n var _this = this;\n if (!this.initialized) {\n this.initialized = true;\n this.get_data(this.mode);\n if (this.polling_interval) {\n var callback = function () { return _this.get_data(_this.mode, _this.max_size, _this.if_modified); };\n this.interval = setInterval(callback, this.polling_interval);\n }\n }\n };\n AjaxDataSource.prototype.get_data = function (mode, max_size, _if_modified) {\n var _this = this;\n if (max_size === void 0) {\n max_size = 0;\n }\n if (_if_modified === void 0) {\n _if_modified = false;\n }\n var xhr = this.prepare_request();\n // TODO: if_modified\n xhr.addEventListener(\"load\", function () { return _this.do_load(xhr, mode, max_size); });\n xhr.addEventListener(\"error\", function () { return _this.do_error(xhr); });\n xhr.send();\n };\n AjaxDataSource.prototype.prepare_request = function () {\n var xhr = new XMLHttpRequest();\n xhr.open(this.method, this.data_url, true);\n xhr.withCredentials = false;\n xhr.setRequestHeader(\"Content-Type\", this.content_type);\n var http_headers = this.http_headers;\n for (var name_1 in http_headers) {\n var value = http_headers[name_1];\n xhr.setRequestHeader(name_1, value);\n }\n return xhr;\n };\n AjaxDataSource.prototype.do_load = function (xhr, mode, max_size) {\n if (xhr.status === 200) {\n var raw_data = JSON.parse(xhr.responseText);\n var adapter = this.adapter;\n var data = {};\n if (adapter != null)\n if (types_1.isFunction(adapter))\n data = adapter(this, { response: raw_data });\n else\n data = adapter.execute(this, { response: raw_data });\n else\n data = raw_data;\n switch (mode) {\n case \"replace\": {\n this.data = data;\n break;\n }\n case \"append\": {\n var original_data = this.data;\n for (var _i = 0, _a = this.columns(); _i < _a.length; _i++) {\n var column = _a[_i];\n // XXX: support typed arrays\n var old_col = Array.from(original_data[column]);\n var new_col = Array.from(data[column]);\n data[column] = old_col.concat(new_col).slice(-max_size);\n }\n this.data = data;\n break;\n }\n }\n }\n };\n AjaxDataSource.prototype.do_error = function (xhr) {\n logging_1.logger.error(\"Failed to fetch JSON from \" + this.data_url + \" with code \" + xhr.status);\n };\n return AjaxDataSource;\n }(remote_data_source_1.RemoteDataSource));\n exports.AjaxDataSource = AjaxDataSource;\n AjaxDataSource.initClass();\n}\n","/* models/sources/cds_view */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var p = require(15) /* core/properties */;\n var selection_1 = require(197) /* ../selections/selection */;\n var array_1 = require(21) /* core/util/array */;\n var columnar_data_source_1 = require(201) /* ./columnar_data_source */;\n var CDSView = /** @class */ (function (_super) {\n tslib_1.__extends(CDSView, _super);\n function CDSView(attrs) {\n return _super.call(this, attrs) || this;\n }\n CDSView.initClass = function () {\n this.prototype.type = 'CDSView';\n this.define({\n filters: [p.Array, []],\n source: [p.Instance],\n });\n this.internal({\n indices: [p.Array, []],\n indices_map: [p.Any, {}],\n });\n };\n CDSView.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.compute_indices();\n };\n CDSView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.properties.filters.change, function () {\n _this.compute_indices();\n _this.change.emit();\n });\n if (this.source != null) {\n if (this.source.change != null)\n this.connect(this.source.change, function () { return _this.compute_indices(); });\n if (this.source.streaming != null)\n this.connect(this.source.streaming, function () { return _this.compute_indices(); });\n if (this.source.patching != null)\n this.connect(this.source.patching, function () { return _this.compute_indices(); });\n }\n };\n CDSView.prototype.compute_indices = function () {\n var _this = this;\n var indices = (this.filters.map(function (filter) { return filter.compute_indices(_this.source); }));\n indices = ((function () {\n var result = [];\n for (var _i = 0, indices_1 = indices; _i < indices_1.length; _i++) {\n var inds = indices_1[_i];\n if (inds != null) {\n result.push(inds);\n }\n }\n return result;\n })());\n if (indices.length > 0) {\n this.indices = array_1.intersection.apply(this, indices);\n }\n else {\n if (this.source instanceof columnar_data_source_1.ColumnarDataSource) {\n this.indices = this.source.get_indices();\n }\n }\n this.indices_map_to_subset();\n };\n CDSView.prototype.indices_map_to_subset = function () {\n this.indices_map = {};\n for (var i = 0; i < this.indices.length; i++) {\n this.indices_map[this.indices[i]] = i;\n }\n };\n CDSView.prototype.convert_selection_from_subset = function (selection_subset) {\n var _this = this;\n var selection_full = new selection_1.Selection();\n selection_full.update_through_union(selection_subset);\n var indices_1d = (selection_subset.indices.map(function (i) { return _this.indices[i]; }));\n selection_full.indices = indices_1d;\n selection_full.image_indices = selection_subset.image_indices;\n return selection_full;\n };\n CDSView.prototype.convert_selection_to_subset = function (selection_full) {\n var _this = this;\n var selection_subset = new selection_1.Selection();\n selection_subset.update_through_union(selection_full);\n var indices_1d = (selection_full.indices.map(function (i) { return _this.indices_map[i]; }));\n selection_subset.indices = indices_1d;\n selection_subset.image_indices = selection_full.image_indices;\n return selection_subset;\n };\n CDSView.prototype.convert_indices_from_subset = function (indices) {\n var _this = this;\n return indices.map(function (i) { return _this.indices[i]; });\n };\n return CDSView;\n }(model_1.Model));\n exports.CDSView = CDSView;\n CDSView.initClass();\n}\n","/* models/sources/column_data_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var columnar_data_source_1 = require(201) /* ./columnar_data_source */;\n var has_props_1 = require(8) /* core/has_props */;\n var p = require(15) /* core/properties */;\n var data_structures_1 = require(29) /* core/util/data_structures */;\n var serialization_1 = require(36) /* core/util/serialization */;\n var types_1 = require(44) /* core/util/types */;\n var typed_array = require(43) /* core/util/typed_array */;\n var object_1 = require(32) /* core/util/object */;\n var events_1 = require(51) /* document/events */;\n //exported for testing\n function stream_to_column(col, new_col, rollover) {\n if (types_1.isArray(col)) {\n var result = col.concat(new_col);\n if (rollover != null && result.length > rollover)\n return result.slice(-rollover);\n else\n return result;\n }\n else if (types_1.isTypedArray(col)) {\n var total_len = col.length + new_col.length;\n // handle rollover case for typed arrays\n if (rollover != null && total_len > rollover) {\n var start = total_len - rollover;\n var end = col.length;\n // resize col if it is shorter than the rollover length\n var result = void 0;\n if (col.length < rollover) {\n result = new (col.constructor)(rollover);\n result.set(col, 0);\n }\n else\n result = col;\n // shift values in original col to accommodate new_col\n for (var i = start, endi = end; i < endi; i++) {\n result[i - start] = result[i];\n }\n // update end values in col with new_col\n for (var i = 0, endi = new_col.length; i < endi; i++) {\n result[i + (end - start)] = new_col[i];\n }\n return result;\n }\n else {\n var tmp = new (col.constructor)(new_col);\n return typed_array.concat(col, tmp);\n }\n }\n else\n throw new Error(\"unsupported array types\");\n }\n exports.stream_to_column = stream_to_column;\n // exported for testing\n function slice(ind, length) {\n var start, step, stop;\n if (types_1.isNumber(ind)) {\n start = ind;\n stop = ind + 1;\n step = 1;\n }\n else {\n start = ind.start != null ? ind.start : 0;\n stop = ind.stop != null ? ind.stop : length;\n step = ind.step != null ? ind.step : 1;\n }\n return [start, stop, step];\n }\n exports.slice = slice;\n // exported for testing\n function patch_to_column(col, patch, shapes) {\n var patched = new data_structures_1.Set();\n var patched_range = false;\n for (var _i = 0, patch_1 = patch; _i < patch_1.length; _i++) {\n var _a = patch_1[_i], ind = _a[0], value = _a[1];\n // make the single index case look like the length-3 multi-index case\n var item = void 0, shape = void 0;\n if (types_1.isArray(ind)) {\n var i = ind[0];\n patched.add(i);\n shape = shapes[i];\n item = col[i];\n }\n else {\n if (types_1.isNumber(ind)) {\n value = [value];\n patched.add(ind);\n }\n else\n patched_range = true;\n ind = [0, 0, ind];\n shape = [1, col.length];\n item = col;\n }\n // this is basically like NumPy's \"newaxis\", inserting an empty dimension\n // makes length 2 and 3 multi-index cases uniform, so that the same code\n // can handle both\n if (ind.length === 2) {\n shape = [1, shape[0]];\n ind = [ind[0], 0, ind[1]];\n }\n // now this one nested loop handles all cases\n var flat_index = 0;\n var _b = slice(ind[1], shape[0]), istart = _b[0], istop = _b[1], istep = _b[2];\n var _c = slice(ind[2], shape[1]), jstart = _c[0], jstop = _c[1], jstep = _c[2];\n for (var i = istart; i < istop; i += istep) {\n for (var j = jstart; j < jstop; j += jstep) {\n if (patched_range) {\n patched.add(j);\n }\n item[(i * shape[1]) + j] = value[flat_index];\n flat_index++;\n }\n }\n }\n return patched;\n }\n exports.patch_to_column = patch_to_column;\n var ColumnDataSource = /** @class */ (function (_super) {\n tslib_1.__extends(ColumnDataSource, _super);\n function ColumnDataSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n ColumnDataSource.initClass = function () {\n this.prototype.type = 'ColumnDataSource';\n this.define({\n data: [p.Any, {}],\n });\n };\n ColumnDataSource.prototype.initialize = function () {\n var _a;\n _super.prototype.initialize.call(this);\n _a = serialization_1.decode_column_data(this.data), this.data = _a[0], this._shapes = _a[1];\n };\n ColumnDataSource.prototype.attributes_as_json = function (include_defaults, value_to_json) {\n if (include_defaults === void 0) {\n include_defaults = true;\n }\n if (value_to_json === void 0) {\n value_to_json = ColumnDataSource._value_to_json;\n }\n var attrs = {};\n var obj = this.serializable_attributes();\n for (var _i = 0, _a = object_1.keys(obj); _i < _a.length; _i++) {\n var key = _a[_i];\n var value = obj[key];\n if (key === 'data')\n value = serialization_1.encode_column_data(value, this._shapes);\n if (include_defaults)\n attrs[key] = value;\n else if (key in this._set_after_defaults)\n attrs[key] = value;\n }\n return value_to_json(\"attributes\", attrs, this);\n };\n ColumnDataSource._value_to_json = function (key, value, optional_parent_object) {\n if (types_1.isPlainObject(value) && key === 'data')\n return serialization_1.encode_column_data(value, optional_parent_object._shapes); // XXX: unknown vs. any\n else\n return has_props_1.HasProps._value_to_json(key, value, optional_parent_object);\n };\n ColumnDataSource.prototype.stream = function (new_data, rollover, setter_id) {\n var data = this.data;\n for (var k in new_data) {\n data[k] = stream_to_column(data[k], new_data[k], rollover);\n }\n this.setv({ data: data }, { silent: true });\n this.streaming.emit();\n if (this.document != null) {\n var hint = new events_1.ColumnsStreamedEvent(this.document, this.ref(), new_data, rollover);\n this.document._notify_change(this, 'data', null, null, { setter_id: setter_id, hint: hint });\n }\n };\n ColumnDataSource.prototype.patch = function (patches, setter_id) {\n var data = this.data;\n var patched = new data_structures_1.Set();\n for (var k in patches) {\n var patch = patches[k];\n patched = patched.union(patch_to_column(data[k], patch, this._shapes[k]));\n }\n this.setv({ data: data }, { silent: true });\n this.patching.emit(patched.values);\n if (this.document != null) {\n var hint = new events_1.ColumnsPatchedEvent(this.document, this.ref(), patches);\n this.document._notify_change(this, 'data', null, null, { setter_id: setter_id, hint: hint });\n }\n };\n return ColumnDataSource;\n }(columnar_data_source_1.ColumnarDataSource));\n exports.ColumnDataSource = ColumnDataSource;\n ColumnDataSource.initClass();\n}\n","/* models/sources/columnar_data_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var data_source_1 = require(202) /* ./data_source */;\n var signaling_1 = require(19) /* core/signaling */;\n var logging_1 = require(14) /* core/logging */;\n var selection_manager_1 = require(17) /* core/selection_manager */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var selection_1 = require(197) /* ../selections/selection */;\n var interaction_policy_1 = require(196) /* ../selections/interaction_policy */;\n var ColumnarDataSource = /** @class */ (function (_super) {\n tslib_1.__extends(ColumnarDataSource, _super);\n function ColumnarDataSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n ColumnarDataSource.prototype.get_array = function (key) {\n var column = this.data[key];\n if (column == null)\n this.data[key] = column = [];\n else if (!types_1.isArray(column))\n this.data[key] = column = Array.from(column);\n return column;\n };\n ColumnarDataSource.initClass = function () {\n this.prototype.type = 'ColumnarDataSource';\n this.define({\n selection_policy: [p.Instance, function () { return new interaction_policy_1.UnionRenderers(); }],\n });\n this.internal({\n selection_manager: [p.Instance, function (self) { return new selection_manager_1.SelectionManager({ source: self }); }],\n inspected: [p.Instance, function () { return new selection_1.Selection(); }],\n _shapes: [p.Any, {}],\n });\n };\n ColumnarDataSource.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._select = new signaling_1.Signal0(this, \"select\");\n this.inspect = new signaling_1.Signal(this, \"inspect\"); // XXX: <[indices, tool, renderer-view, source, data], this>\n this.streaming = new signaling_1.Signal0(this, \"streaming\");\n this.patching = new signaling_1.Signal(this, \"patching\");\n };\n ColumnarDataSource.prototype.get_column = function (colname) {\n var column = this.data[colname];\n return column != null ? column : null;\n };\n ColumnarDataSource.prototype.columns = function () {\n // return the column names in this data source\n return object_1.keys(this.data);\n };\n ColumnarDataSource.prototype.get_length = function (soft) {\n if (soft === void 0) {\n soft = true;\n }\n var lengths = array_1.uniq(object_1.values(this.data).map(function (v) { return v.length; }));\n switch (lengths.length) {\n case 0: {\n return null; // XXX: don't guess, treat on case-by-case basis\n }\n case 1: {\n return lengths[0];\n }\n default: {\n var msg = \"data source has columns of inconsistent lengths\";\n if (soft) {\n logging_1.logger.warn(msg);\n return lengths.sort()[0];\n }\n else\n throw new Error(msg);\n }\n }\n };\n ColumnarDataSource.prototype.get_indices = function () {\n var length = this.get_length();\n return array_1.range(0, length != null ? length : 1);\n //TODO: returns [0] when no data, should it?\n };\n ColumnarDataSource.prototype.clear = function () {\n var empty = {};\n for (var _i = 0, _a = this.columns(); _i < _a.length; _i++) {\n var col = _a[_i];\n empty[col] = new this.data[col].constructor;\n }\n this.data = empty;\n };\n return ColumnarDataSource;\n }(data_source_1.DataSource));\n exports.ColumnarDataSource = ColumnarDataSource;\n ColumnarDataSource.initClass();\n}\n","/* models/sources/data_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var selection_1 = require(197) /* ../selections/selection */;\n var DataSource = /** @class */ (function (_super) {\n tslib_1.__extends(DataSource, _super);\n function DataSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n DataSource.initClass = function () {\n this.prototype.type = \"DataSource\";\n this.define({\n selected: [p.Instance, function () { return new selection_1.Selection(); }],\n callback: [p.Any],\n });\n };\n DataSource.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.properties.selected.change, function () {\n var callback = _this.callback;\n if (callback != null) {\n if (types_1.isFunction(callback))\n callback(_this);\n else\n callback.execute(_this);\n }\n });\n };\n return DataSource;\n }(model_1.Model));\n exports.DataSource = DataSource;\n DataSource.initClass();\n}\n","/* models/sources/geojson_data_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var columnar_data_source_1 = require(201) /* ./columnar_data_source */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var GeoJSONDataSource = /** @class */ (function (_super) {\n tslib_1.__extends(GeoJSONDataSource, _super);\n function GeoJSONDataSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n GeoJSONDataSource.initClass = function () {\n this.prototype.type = 'GeoJSONDataSource';\n this.define({\n geojson: [p.Any],\n });\n this.internal({\n data: [p.Any, {}],\n });\n };\n GeoJSONDataSource.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._update_data();\n };\n GeoJSONDataSource.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.properties.geojson.change, function () { return _this._update_data(); });\n };\n GeoJSONDataSource.prototype._update_data = function () {\n this.data = this.geojson_to_column_data();\n };\n GeoJSONDataSource.prototype._get_new_list_array = function (length) {\n return array_1.range(0, length).map(function (_i) { return []; });\n };\n GeoJSONDataSource.prototype._get_new_nan_array = function (length) {\n return array_1.range(0, length).map(function (_i) { return NaN; });\n };\n GeoJSONDataSource.prototype._add_properties = function (item, data, i, item_count) {\n var properties = item.properties || {};\n for (var property in properties) {\n if (!data.hasOwnProperty(property))\n data[property] = this._get_new_nan_array(item_count);\n data[property][i] = properties[property];\n }\n };\n GeoJSONDataSource.prototype._add_geometry = function (geometry, data, i) {\n function orNaN(v) {\n return v != null ? v : NaN;\n }\n function flatten(acc, item) {\n return acc.concat([[NaN, NaN, NaN]]).concat(item);\n }\n switch (geometry.type) {\n case \"Point\": {\n var _a = geometry.coordinates, x = _a[0], y = _a[1], z = _a[2];\n data.x[i] = x;\n data.y[i] = y;\n data.z[i] = orNaN(z);\n break;\n }\n case \"LineString\": {\n var coordinates = geometry.coordinates;\n for (var j = 0; j < coordinates.length; j++) {\n var _b = coordinates[j], x = _b[0], y = _b[1], z = _b[2];\n data.xs[i][j] = x;\n data.ys[i][j] = y;\n data.zs[i][j] = orNaN(z);\n }\n break;\n }\n case \"Polygon\": {\n if (geometry.coordinates.length > 1)\n logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.');\n var exterior_ring = geometry.coordinates[0];\n for (var j = 0; j < exterior_ring.length; j++) {\n var _c = exterior_ring[j], x = _c[0], y = _c[1], z = _c[2];\n data.xs[i][j] = x;\n data.ys[i][j] = y;\n data.zs[i][j] = orNaN(z);\n }\n break;\n }\n case \"MultiPoint\": {\n logging_1.logger.warn('MultiPoint not supported in Bokeh');\n break;\n }\n case \"MultiLineString\": {\n var coordinates = geometry.coordinates.reduce(flatten);\n for (var j = 0; j < coordinates.length; j++) {\n var _d = coordinates[j], x = _d[0], y = _d[1], z = _d[2];\n data.xs[i][j] = x;\n data.ys[i][j] = y;\n data.zs[i][j] = orNaN(z);\n }\n break;\n }\n case \"MultiPolygon\": {\n var exterior_rings = [];\n for (var _e = 0, _f = geometry.coordinates; _e < _f.length; _e++) {\n var polygon = _f[_e];\n if (polygon.length > 1)\n logging_1.logger.warn('Bokeh does not support Polygons with holes in, only exterior ring used.');\n exterior_rings.push(polygon[0]);\n }\n var coordinates = exterior_rings.reduce(flatten);\n for (var j = 0; j < coordinates.length; j++) {\n var _g = coordinates[j], x = _g[0], y = _g[1], z = _g[2];\n data.xs[i][j] = x;\n data.ys[i][j] = y;\n data.zs[i][j] = orNaN(z);\n }\n break;\n }\n default:\n throw new Error(\"Invalid GeoJSON geometry type: \" + geometry.type);\n }\n };\n GeoJSONDataSource.prototype.geojson_to_column_data = function () {\n var geojson = JSON.parse(this.geojson);\n var items;\n switch (geojson.type) {\n case \"GeometryCollection\": {\n if (geojson.geometries == null)\n throw new Error('No geometries found in GeometryCollection');\n if (geojson.geometries.length === 0)\n throw new Error('geojson.geometries must have one or more items');\n items = geojson.geometries;\n break;\n }\n case \"FeatureCollection\": {\n if (geojson.features == null)\n throw new Error('No features found in FeaturesCollection');\n if (geojson.features.length == 0)\n throw new Error('geojson.features must have one or more items');\n items = geojson.features;\n break;\n }\n default:\n throw new Error('Bokeh only supports type GeometryCollection and FeatureCollection at top level');\n }\n var item_count = 0;\n for (var _a = 0, items_1 = items; _a < items_1.length; _a++) {\n var item = items_1[_a];\n var geometry = item.type === 'Feature' ? item.geometry : item;\n if (geometry.type == 'GeometryCollection')\n item_count += geometry.geometries.length;\n else\n item_count += 1;\n }\n var data = {\n x: this._get_new_nan_array(item_count),\n y: this._get_new_nan_array(item_count),\n z: this._get_new_nan_array(item_count),\n xs: this._get_new_list_array(item_count),\n ys: this._get_new_list_array(item_count),\n zs: this._get_new_list_array(item_count),\n };\n var arr_index = 0;\n for (var _b = 0, items_2 = items; _b < items_2.length; _b++) {\n var item = items_2[_b];\n var geometry = item.type == 'Feature' ? item.geometry : item;\n if (geometry.type == \"GeometryCollection\") {\n for (var _c = 0, _d = geometry.geometries; _c < _d.length; _c++) {\n var g = _d[_c];\n this._add_geometry(g, data, arr_index);\n if (item.type === 'Feature')\n this._add_properties(item, data, arr_index, item_count);\n arr_index += 1;\n }\n }\n else {\n this._add_geometry(geometry, data, arr_index);\n if (item.type === 'Feature')\n this._add_properties(item, data, arr_index, item_count);\n arr_index += 1;\n }\n }\n return data;\n };\n return GeoJSONDataSource;\n }(columnar_data_source_1.ColumnarDataSource));\n exports.GeoJSONDataSource = GeoJSONDataSource;\n GeoJSONDataSource.initClass();\n}\n","/* models/sources/index */ function _(require, module, exports) {\n var ajax_data_source_1 = require(198) /* ./ajax_data_source */;\n exports.AjaxDataSource = ajax_data_source_1.AjaxDataSource;\n var column_data_source_1 = require(200) /* ./column_data_source */;\n exports.ColumnDataSource = column_data_source_1.ColumnDataSource;\n var columnar_data_source_1 = require(201) /* ./columnar_data_source */;\n exports.ColumnarDataSource = columnar_data_source_1.ColumnarDataSource;\n var cds_view_1 = require(199) /* ./cds_view */;\n exports.CDSView = cds_view_1.CDSView;\n var data_source_1 = require(202) /* ./data_source */;\n exports.DataSource = data_source_1.DataSource;\n var geojson_data_source_1 = require(203) /* ./geojson_data_source */;\n exports.GeoJSONDataSource = geojson_data_source_1.GeoJSONDataSource;\n var remote_data_source_1 = require(205) /* ./remote_data_source */;\n exports.RemoteDataSource = remote_data_source_1.RemoteDataSource;\n}\n","/* models/sources/remote_data_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var column_data_source_1 = require(200) /* ./column_data_source */;\n var p = require(15) /* core/properties */;\n var RemoteDataSource = /** @class */ (function (_super) {\n tslib_1.__extends(RemoteDataSource, _super);\n function RemoteDataSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n RemoteDataSource.prototype.get_column = function (colname) {\n var column = this.data[colname];\n return column != null ? column : [];\n };\n RemoteDataSource.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.setup();\n };\n RemoteDataSource.initClass = function () {\n this.prototype.type = 'RemoteDataSource';\n this.define({\n data_url: [p.String],\n polling_interval: [p.Number],\n });\n };\n return RemoteDataSource;\n }(column_data_source_1.ColumnDataSource));\n exports.RemoteDataSource = RemoteDataSource;\n RemoteDataSource.initClass();\n}\n","/* models/tickers/adaptive_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var continuous_ticker_1 = require(210) /* ./continuous_ticker */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n // Forces a number x into a specified range [min_val, max_val].\n function clamp(x, min_val, max_val) {\n return Math.max(min_val, Math.min(max_val, x));\n }\n // A log function with an optional base.\n function log(x, base) {\n if (base === void 0) {\n base = Math.E;\n }\n return Math.log(x) / Math.log(base);\n }\n var AdaptiveTicker = /** @class */ (function (_super) {\n tslib_1.__extends(AdaptiveTicker, _super);\n function AdaptiveTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n AdaptiveTicker.initClass = function () {\n this.prototype.type = \"AdaptiveTicker\";\n this.define({\n base: [p.Number, 10.0],\n mantissas: [p.Array, [1, 2, 5]],\n min_interval: [p.Number, 0.0],\n max_interval: [p.Number],\n });\n };\n // These arguments control the range of possible intervals. The interval I\n // returned by get_interval() will be the one that most closely matches the\n // desired number of ticks, subject to the following constraints:\n // I = (M * B^N), where\n // M is a member of mantissas,\n // B is base,\n // and N is an integer;\n // and min_interval <= I <= max_interval.\n AdaptiveTicker.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n var prefix_mantissa = array_1.nth(this.mantissas, -1) / this.base;\n var suffix_mantissa = array_1.nth(this.mantissas, 0) * this.base;\n this.extended_mantissas = [prefix_mantissa].concat(this.mantissas, [suffix_mantissa]);\n this.base_factor = this.get_min_interval() === 0.0 ? 1.0 : this.get_min_interval();\n };\n AdaptiveTicker.prototype.get_interval = function (data_low, data_high, desired_n_ticks) {\n var data_range = data_high - data_low;\n var ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks);\n var interval_exponent = Math.floor(log(ideal_interval / this.base_factor, this.base));\n var ideal_magnitude = Math.pow(this.base, interval_exponent) * this.base_factor;\n // An untested optimization.\n // const ideal_mantissa = ideal_interval / ideal_magnitude\n // index = sortedIndex(this.extended_mantissas, ideal_mantissa)\n // candidate_mantissas = this.extended_mantissas[index..index + 1]\n var candidate_mantissas = this.extended_mantissas;\n var errors = candidate_mantissas.map(function (mantissa) {\n return Math.abs(desired_n_ticks - (data_range / (mantissa * ideal_magnitude)));\n });\n var best_mantissa = candidate_mantissas[array_1.argmin(errors)];\n var interval = best_mantissa * ideal_magnitude;\n return clamp(interval, this.get_min_interval(), this.get_max_interval());\n };\n return AdaptiveTicker;\n }(continuous_ticker_1.ContinuousTicker));\n exports.AdaptiveTicker = AdaptiveTicker;\n AdaptiveTicker.initClass();\n}\n","/* models/tickers/basic_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var adaptive_ticker_1 = require(206) /* ./adaptive_ticker */;\n var BasicTicker = /** @class */ (function (_super) {\n tslib_1.__extends(BasicTicker, _super);\n function BasicTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n BasicTicker.initClass = function () {\n this.prototype.type = \"BasicTicker\";\n };\n return BasicTicker;\n }(adaptive_ticker_1.AdaptiveTicker));\n exports.BasicTicker = BasicTicker;\n BasicTicker.initClass();\n}\n","/* models/tickers/categorical_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var ticker_1 = require(219) /* ./ticker */;\n var CategoricalTicker = /** @class */ (function (_super) {\n tslib_1.__extends(CategoricalTicker, _super);\n function CategoricalTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n CategoricalTicker.initClass = function () {\n this.prototype.type = \"CategoricalTicker\";\n };\n CategoricalTicker.prototype.get_ticks = function (start, end, range, _cross_loc, _) {\n var majors = this._collect(range.factors, range, start, end);\n var tops = this._collect(range.tops || [], range, start, end);\n var mids = this._collect(range.mids || [], range, start, end);\n return {\n major: majors,\n minor: [],\n tops: tops,\n mids: mids,\n };\n };\n CategoricalTicker.prototype._collect = function (factors, range, start, end) {\n var result = [];\n for (var _i = 0, factors_1 = factors; _i < factors_1.length; _i++) {\n var factor = factors_1[_i];\n var coord = range.synthetic(factor);\n if (coord > start && coord < end)\n result.push(factor);\n }\n return result;\n };\n return CategoricalTicker;\n }(ticker_1.Ticker));\n exports.CategoricalTicker = CategoricalTicker;\n CategoricalTicker.initClass();\n}\n","/* models/tickers/composite_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var continuous_ticker_1 = require(210) /* ./continuous_ticker */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var object_1 = require(32) /* core/util/object */;\n var CompositeTicker = /** @class */ (function (_super) {\n tslib_1.__extends(CompositeTicker, _super);\n function CompositeTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n CompositeTicker.initClass = function () {\n this.prototype.type = \"CompositeTicker\";\n this.define({\n tickers: [p.Array, []],\n });\n };\n Object.defineProperty(CompositeTicker.prototype, \"min_intervals\", {\n // The tickers should be in order of increasing interval size; specifically,\n // if S comes before T, then it should be the case that\n // S.get_max_interval() < T.get_min_interval().\n // FIXME Enforce this automatically.\n get: function () {\n return this.tickers.map(function (ticker) { return ticker.get_min_interval(); });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CompositeTicker.prototype, \"max_intervals\", {\n get: function () {\n return this.tickers.map(function (ticker) { return ticker.get_max_interval(); });\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CompositeTicker.prototype, \"min_interval\", {\n get: function () {\n return this.min_intervals[0];\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CompositeTicker.prototype, \"max_interval\", {\n get: function () {\n return this.max_intervals[0];\n },\n enumerable: true,\n configurable: true\n });\n CompositeTicker.prototype.get_best_ticker = function (data_low, data_high, desired_n_ticks) {\n var data_range = data_high - data_low;\n var ideal_interval = this.get_ideal_interval(data_low, data_high, desired_n_ticks);\n var ticker_ndxs = [\n array_1.sortedIndex(this.min_intervals, ideal_interval) - 1,\n array_1.sortedIndex(this.max_intervals, ideal_interval),\n ];\n var intervals = [\n this.min_intervals[ticker_ndxs[0]],\n this.max_intervals[ticker_ndxs[1]],\n ];\n var errors = intervals.map(function (interval) {\n return Math.abs(desired_n_ticks - (data_range / interval));\n });\n var best_ticker;\n if (object_1.isEmpty(errors.filter(function (e) { return !isNaN(e); }))) {\n // this can happen if the data isn't loaded yet, we just default to the first scale\n best_ticker = this.tickers[0];\n }\n else {\n var best_index = array_1.argmin(errors);\n var best_ticker_ndx = ticker_ndxs[best_index];\n best_ticker = this.tickers[best_ticker_ndx];\n }\n return best_ticker;\n };\n CompositeTicker.prototype.get_interval = function (data_low, data_high, desired_n_ticks) {\n var best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks);\n return best_ticker.get_interval(data_low, data_high, desired_n_ticks);\n };\n CompositeTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, cross_loc, desired_n_ticks) {\n var best_ticker = this.get_best_ticker(data_low, data_high, desired_n_ticks);\n return best_ticker.get_ticks_no_defaults(data_low, data_high, cross_loc, desired_n_ticks);\n };\n return CompositeTicker;\n }(continuous_ticker_1.ContinuousTicker));\n exports.CompositeTicker = CompositeTicker;\n CompositeTicker.initClass();\n}\n","/* models/tickers/continuous_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var ticker_1 = require(219) /* ./ticker */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var ContinuousTicker = /** @class */ (function (_super) {\n tslib_1.__extends(ContinuousTicker, _super);\n function ContinuousTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n ContinuousTicker.initClass = function () {\n this.prototype.type = \"ContinuousTicker\";\n this.define({\n num_minor_ticks: [p.Number, 5],\n desired_num_ticks: [p.Number, 6],\n });\n };\n ContinuousTicker.prototype.get_ticks = function (data_low, data_high, _range, cross_loc, _) {\n return this.get_ticks_no_defaults(data_low, data_high, cross_loc, this.desired_num_ticks);\n };\n // The version of get_ticks() that does the work (and the version that\n // should be overridden in subclasses).\n ContinuousTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, desired_n_ticks) {\n var interval = this.get_interval(data_low, data_high, desired_n_ticks);\n var start_factor = Math.floor(data_low / interval);\n var end_factor = Math.ceil(data_high / interval);\n var factors;\n if (types_1.isStrictNaN(start_factor) || types_1.isStrictNaN(end_factor))\n factors = [];\n else\n factors = array_1.range(start_factor, end_factor + 1);\n var ticks = factors.map(function (factor) { return factor * interval; })\n .filter(function (tick) { return data_low <= tick && tick <= data_high; });\n var num_minor_ticks = this.num_minor_ticks;\n var minor_ticks = [];\n if (num_minor_ticks > 0 && ticks.length > 0) {\n var minor_interval_1 = interval / num_minor_ticks;\n var minor_offsets = array_1.range(0, num_minor_ticks).map(function (i) { return i * minor_interval_1; });\n for (var _i = 0, _a = minor_offsets.slice(1); _i < _a.length; _i++) {\n var x = _a[_i];\n var mt = ticks[0] - x;\n if (data_low <= mt && mt <= data_high) {\n minor_ticks.push(mt);\n }\n }\n for (var _b = 0, ticks_1 = ticks; _b < ticks_1.length; _b++) {\n var tick = ticks_1[_b];\n for (var _c = 0, minor_offsets_1 = minor_offsets; _c < minor_offsets_1.length; _c++) {\n var x = minor_offsets_1[_c];\n var mt = tick + x;\n if (data_low <= mt && mt <= data_high) {\n minor_ticks.push(mt);\n }\n }\n }\n }\n return {\n major: ticks,\n minor: minor_ticks,\n };\n };\n // Returns the smallest interval that can be returned by get_interval().\n ContinuousTicker.prototype.get_min_interval = function () {\n return this.min_interval;\n };\n // Returns the largest interval that can be returned by get_interval().\n ContinuousTicker.prototype.get_max_interval = function () {\n return this.max_interval != null ? this.max_interval : Infinity;\n };\n // Returns the interval size that would produce exactly the number of\n // desired ticks. (In general we won't use exactly this interval, because\n // we want the ticks to be round numbers.)\n ContinuousTicker.prototype.get_ideal_interval = function (data_low, data_high, desired_n_ticks) {\n var data_range = data_high - data_low;\n return data_range / desired_n_ticks;\n };\n return ContinuousTicker;\n }(ticker_1.Ticker));\n exports.ContinuousTicker = ContinuousTicker;\n ContinuousTicker.initClass();\n}\n","/* models/tickers/datetime_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var array_1 = require(21) /* core/util/array */;\n var adaptive_ticker_1 = require(206) /* ./adaptive_ticker */;\n var composite_ticker_1 = require(209) /* ./composite_ticker */;\n var days_ticker_1 = require(212) /* ./days_ticker */;\n var months_ticker_1 = require(217) /* ./months_ticker */;\n var years_ticker_1 = require(221) /* ./years_ticker */;\n var util_1 = require(220) /* ./util */;\n var DatetimeTicker = /** @class */ (function (_super) {\n tslib_1.__extends(DatetimeTicker, _super);\n function DatetimeTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n DatetimeTicker.initClass = function () {\n this.prototype.type = \"DatetimeTicker\";\n this.override({\n num_minor_ticks: 0,\n tickers: function () {\n return [\n // Sub-second.\n new adaptive_ticker_1.AdaptiveTicker({\n mantissas: [1, 2, 5],\n base: 10,\n min_interval: 0,\n max_interval: 500 * util_1.ONE_MILLI,\n num_minor_ticks: 0,\n }),\n // Seconds, minutes.\n new adaptive_ticker_1.AdaptiveTicker({\n mantissas: [1, 2, 5, 10, 15, 20, 30],\n base: 60,\n min_interval: util_1.ONE_SECOND,\n max_interval: 30 * util_1.ONE_MINUTE,\n num_minor_ticks: 0,\n }),\n // Hours.\n new adaptive_ticker_1.AdaptiveTicker({\n mantissas: [1, 2, 4, 6, 8, 12],\n base: 24.0,\n min_interval: util_1.ONE_HOUR,\n max_interval: 12 * util_1.ONE_HOUR,\n num_minor_ticks: 0,\n }),\n // Days.\n new days_ticker_1.DaysTicker({ days: array_1.range(1, 32) }),\n new days_ticker_1.DaysTicker({ days: array_1.range(1, 31, 3) }),\n new days_ticker_1.DaysTicker({ days: [1, 8, 15, 22] }),\n new days_ticker_1.DaysTicker({ days: [1, 15] }),\n // Months.\n new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 1) }),\n new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 2) }),\n new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 4) }),\n new months_ticker_1.MonthsTicker({ months: array_1.range(0, 12, 6) }),\n // Years\n new years_ticker_1.YearsTicker({}),\n ];\n },\n });\n };\n return DatetimeTicker;\n }(composite_ticker_1.CompositeTicker));\n exports.DatetimeTicker = DatetimeTicker;\n DatetimeTicker.initClass();\n}\n","/* models/tickers/days_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var single_interval_ticker_1 = require(218) /* ./single_interval_ticker */;\n var util_1 = require(220) /* ./util */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n // Given a start and end time in millis, returns the shortest array of\n // consecutive months (as Dates) that surrounds both times.\n function date_range_by_month(start_time, end_time) {\n var start_date = util_1.last_month_no_later_than(new Date(start_time));\n var end_date = util_1.last_month_no_later_than(new Date(end_time));\n // XXX This is not a reliable technique in general, but it should be\n // safe when the day of the month is 1. (The problem case is this:\n // Mar 31 -> Apr 31, which becomes May 1.)\n end_date.setUTCMonth(end_date.getUTCMonth() + 1);\n var dates = [];\n var date = start_date;\n while (true) {\n dates.push(util_1.copy_date(date));\n date.setUTCMonth(date.getUTCMonth() + 1);\n if (date > end_date)\n break;\n }\n return dates;\n }\n var DaysTicker = /** @class */ (function (_super) {\n tslib_1.__extends(DaysTicker, _super);\n function DaysTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n DaysTicker.initClass = function () {\n this.prototype.type = \"DaysTicker\";\n this.define({\n days: [p.Array, []],\n });\n this.override({\n num_minor_ticks: 0,\n });\n };\n DaysTicker.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n var days = this.days;\n if (days.length > 1)\n this.interval = (days[1] - days[0]) * util_1.ONE_DAY;\n else\n this.interval = 31 * util_1.ONE_DAY;\n };\n DaysTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, _desired_n_ticks) {\n var month_dates = date_range_by_month(data_low, data_high);\n var days = this.days;\n var days_of_month = function (month_date, interval) {\n var current_month = month_date.getUTCMonth();\n var dates = [];\n for (var _i = 0, days_1 = days; _i < days_1.length; _i++) {\n var day = days_1[_i];\n var day_date = util_1.copy_date(month_date);\n day_date.setUTCDate(day);\n // We can't use all of the values in this.days, because they may not\n // fall within the current month. In fact, if, e.g., our month is 28 days\n // and we're marking every third day, we don't want day 28 to show up\n // because it'll be right next to the 1st of the next month. So we\n // make sure we have a bit of room before we include a day.\n // TODO (bev) The above description does not exactly work because JS Date\n // is broken and will happily consider \"Feb 28 + 3*ONE_DAY\" to have month \"2\"\n var future_date = new Date(day_date.getTime() + (interval / 2));\n if (future_date.getUTCMonth() == current_month)\n dates.push(day_date);\n }\n return dates;\n };\n var interval = this.interval;\n var day_dates = array_1.concat(month_dates.map(function (date) { return days_of_month(date, interval); }));\n var all_ticks = day_dates.map(function (day_date) { return day_date.getTime(); });\n var ticks_in_range = all_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; });\n return {\n major: ticks_in_range,\n minor: [],\n };\n };\n return DaysTicker;\n }(single_interval_ticker_1.SingleIntervalTicker));\n exports.DaysTicker = DaysTicker;\n DaysTicker.initClass();\n}\n","/* models/tickers/fixed_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var continuous_ticker_1 = require(210) /* ./continuous_ticker */;\n var p = require(15) /* core/properties */;\n var FixedTicker = /** @class */ (function (_super) {\n tslib_1.__extends(FixedTicker, _super);\n function FixedTicker(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.min_interval = 0;\n _this.max_interval = 0;\n return _this;\n }\n FixedTicker.initClass = function () {\n this.prototype.type = \"FixedTicker\";\n this.define({\n ticks: [p.Array, []],\n minor_ticks: [p.Array, []],\n });\n };\n FixedTicker.prototype.get_ticks_no_defaults = function (_data_low, _data_high, _cross_loc, _desired_n_ticks) {\n return {\n major: this.ticks,\n minor: this.minor_ticks,\n };\n };\n // XXX: whatever, because FixedTicker needs to fullfill the interface somehow\n FixedTicker.prototype.get_interval = function (_data_low, _data_high, _desired_n_ticks) {\n return 0;\n };\n return FixedTicker;\n }(continuous_ticker_1.ContinuousTicker));\n exports.FixedTicker = FixedTicker;\n FixedTicker.initClass();\n}\n","/* models/tickers/index */ function _(require, module, exports) {\n var adaptive_ticker_1 = require(206) /* ./adaptive_ticker */;\n exports.AdaptiveTicker = adaptive_ticker_1.AdaptiveTicker;\n var basic_ticker_1 = require(207) /* ./basic_ticker */;\n exports.BasicTicker = basic_ticker_1.BasicTicker;\n var categorical_ticker_1 = require(208) /* ./categorical_ticker */;\n exports.CategoricalTicker = categorical_ticker_1.CategoricalTicker;\n var composite_ticker_1 = require(209) /* ./composite_ticker */;\n exports.CompositeTicker = composite_ticker_1.CompositeTicker;\n var continuous_ticker_1 = require(210) /* ./continuous_ticker */;\n exports.ContinuousTicker = continuous_ticker_1.ContinuousTicker;\n var datetime_ticker_1 = require(211) /* ./datetime_ticker */;\n exports.DatetimeTicker = datetime_ticker_1.DatetimeTicker;\n var days_ticker_1 = require(212) /* ./days_ticker */;\n exports.DaysTicker = days_ticker_1.DaysTicker;\n var fixed_ticker_1 = require(213) /* ./fixed_ticker */;\n exports.FixedTicker = fixed_ticker_1.FixedTicker;\n var log_ticker_1 = require(215) /* ./log_ticker */;\n exports.LogTicker = log_ticker_1.LogTicker;\n var mercator_ticker_1 = require(216) /* ./mercator_ticker */;\n exports.MercatorTicker = mercator_ticker_1.MercatorTicker;\n var months_ticker_1 = require(217) /* ./months_ticker */;\n exports.MonthsTicker = months_ticker_1.MonthsTicker;\n var single_interval_ticker_1 = require(218) /* ./single_interval_ticker */;\n exports.SingleIntervalTicker = single_interval_ticker_1.SingleIntervalTicker;\n var ticker_1 = require(219) /* ./ticker */;\n exports.Ticker = ticker_1.Ticker;\n var years_ticker_1 = require(221) /* ./years_ticker */;\n exports.YearsTicker = years_ticker_1.YearsTicker;\n}\n","/* models/tickers/log_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var adaptive_ticker_1 = require(206) /* ./adaptive_ticker */;\n var array_1 = require(21) /* core/util/array */;\n var LogTicker = /** @class */ (function (_super) {\n tslib_1.__extends(LogTicker, _super);\n function LogTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n LogTicker.initClass = function () {\n this.prototype.type = \"LogTicker\";\n this.override({\n mantissas: [1, 5],\n });\n };\n LogTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, desired_n_ticks) {\n var num_minor_ticks = this.num_minor_ticks;\n var minor_ticks = [];\n var base = this.base;\n var log_low = Math.log(data_low) / Math.log(base);\n var log_high = Math.log(data_high) / Math.log(base);\n var log_interval = log_high - log_low;\n var ticks;\n if (!isFinite(log_interval)) {\n ticks = [];\n }\n else if (log_interval < 2) { // treat as linear ticker\n var interval_1 = this.get_interval(data_low, data_high, desired_n_ticks);\n var start_factor = Math.floor(data_low / interval_1);\n var end_factor = Math.ceil(data_high / interval_1);\n ticks = array_1.range(start_factor, end_factor + 1)\n .filter(function (factor) { return factor != 0; })\n .map(function (factor) { return factor * interval_1; })\n .filter(function (tick) { return data_low <= tick && tick <= data_high; });\n if (num_minor_ticks > 0 && ticks.length > 0) {\n var minor_interval_1 = interval_1 / num_minor_ticks;\n var minor_offsets = array_1.range(0, num_minor_ticks).map(function (i) { return i * minor_interval_1; });\n for (var _i = 0, _a = minor_offsets.slice(1); _i < _a.length; _i++) {\n var x = _a[_i];\n minor_ticks.push(ticks[0] - x);\n }\n for (var _b = 0, ticks_1 = ticks; _b < ticks_1.length; _b++) {\n var tick = ticks_1[_b];\n for (var _c = 0, minor_offsets_1 = minor_offsets; _c < minor_offsets_1.length; _c++) {\n var x = minor_offsets_1[_c];\n minor_ticks.push(tick + x);\n }\n }\n }\n }\n else {\n var startlog = Math.ceil(log_low * 0.999999);\n var endlog = Math.floor(log_high * 1.000001);\n var interval = Math.ceil((endlog - startlog) / 9.0);\n ticks = array_1.range(startlog - 1, endlog + 1, interval)\n .map(function (i) { return Math.pow(base, i); });\n if (num_minor_ticks > 0 && ticks.length > 0) {\n var minor_interval_2 = Math.pow(base, interval) / num_minor_ticks;\n var minor_offsets = array_1.range(1, num_minor_ticks + 1).map(function (i) { return i * minor_interval_2; });\n for (var _d = 0, minor_offsets_2 = minor_offsets; _d < minor_offsets_2.length; _d++) {\n var x = minor_offsets_2[_d];\n minor_ticks.push(ticks[0] / x);\n }\n minor_ticks.push(ticks[0]);\n for (var _e = 0, ticks_2 = ticks; _e < ticks_2.length; _e++) {\n var tick = ticks_2[_e];\n for (var _f = 0, minor_offsets_3 = minor_offsets; _f < minor_offsets_3.length; _f++) {\n var x = minor_offsets_3[_f];\n minor_ticks.push(tick * x);\n }\n }\n }\n }\n return {\n major: ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }),\n minor: minor_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; }),\n };\n };\n return LogTicker;\n }(adaptive_ticker_1.AdaptiveTicker));\n exports.LogTicker = LogTicker;\n LogTicker.initClass();\n}\n","/* models/tickers/mercator_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var basic_ticker_1 = require(207) /* ./basic_ticker */;\n var p = require(15) /* core/properties */;\n var projections_1 = require(33) /* core/util/projections */;\n var MercatorTicker = /** @class */ (function (_super) {\n tslib_1.__extends(MercatorTicker, _super);\n function MercatorTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n MercatorTicker.initClass = function () {\n this.prototype.type = \"MercatorTicker\";\n this.define({\n dimension: [p.LatLon],\n });\n };\n MercatorTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, cross_loc, desired_n_ticks) {\n var _a, _b, _c, _d, _e;\n if (this.dimension == null) {\n throw new Error(\"MercatorTicker.dimension not configured\");\n }\n _a = projections_1.clip_mercator(data_low, data_high, this.dimension), data_low = _a[0], data_high = _a[1];\n var proj_low, proj_high, proj_cross_loc;\n if (this.dimension === \"lon\") {\n _b = projections_1.wgs84_mercator.inverse([data_low, cross_loc]), proj_low = _b[0], proj_cross_loc = _b[1];\n _c = projections_1.wgs84_mercator.inverse([data_high, cross_loc]), proj_high = _c[0], proj_cross_loc = _c[1];\n }\n else {\n _d = projections_1.wgs84_mercator.inverse([cross_loc, data_low]), proj_cross_loc = _d[0], proj_low = _d[1];\n _e = projections_1.wgs84_mercator.inverse([cross_loc, data_high]), proj_cross_loc = _e[0], proj_high = _e[1];\n }\n var proj_ticks = _super.prototype.get_ticks_no_defaults.call(this, proj_low, proj_high, cross_loc, desired_n_ticks);\n var major = [];\n var minor = [];\n if (this.dimension === \"lon\") {\n for (var _i = 0, _f = proj_ticks.major; _i < _f.length; _i++) {\n var tick = _f[_i];\n if (projections_1.in_bounds(tick, 'lon')) {\n var lon = projections_1.wgs84_mercator.forward([tick, proj_cross_loc])[0];\n major.push(lon);\n }\n }\n for (var _g = 0, _h = proj_ticks.minor; _g < _h.length; _g++) {\n var tick = _h[_g];\n if (projections_1.in_bounds(tick, 'lon')) {\n var lon = projections_1.wgs84_mercator.forward([tick, proj_cross_loc])[0];\n minor.push(lon);\n }\n }\n }\n else {\n for (var _j = 0, _k = proj_ticks.major; _j < _k.length; _j++) {\n var tick = _k[_j];\n if (projections_1.in_bounds(tick, 'lat')) {\n var _l = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]), lat = _l[1];\n major.push(lat);\n }\n }\n for (var _m = 0, _o = proj_ticks.minor; _m < _o.length; _m++) {\n var tick = _o[_m];\n if (projections_1.in_bounds(tick, 'lat')) {\n var _p = projections_1.wgs84_mercator.forward([proj_cross_loc, tick]), lat = _p[1];\n minor.push(lat);\n }\n }\n }\n return {\n major: major,\n minor: minor,\n };\n };\n return MercatorTicker;\n }(basic_ticker_1.BasicTicker));\n exports.MercatorTicker = MercatorTicker;\n MercatorTicker.initClass();\n}\n","/* models/tickers/months_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var single_interval_ticker_1 = require(218) /* ./single_interval_ticker */;\n var util_1 = require(220) /* ./util */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n // Given a start and end time in millis, returns the shortest array of\n // consecutive years (as Dates) that surrounds both times.\n function date_range_by_year(start_time, end_time) {\n var start_date = util_1.last_year_no_later_than(new Date(start_time));\n var end_date = util_1.last_year_no_later_than(new Date(end_time));\n end_date.setUTCFullYear(end_date.getUTCFullYear() + 1);\n var dates = [];\n var date = start_date;\n while (true) {\n dates.push(util_1.copy_date(date));\n date.setUTCFullYear(date.getUTCFullYear() + 1);\n if (date > end_date)\n break;\n }\n return dates;\n }\n var MonthsTicker = /** @class */ (function (_super) {\n tslib_1.__extends(MonthsTicker, _super);\n function MonthsTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n MonthsTicker.initClass = function () {\n this.prototype.type = \"MonthsTicker\";\n this.define({\n months: [p.Array, []],\n });\n };\n MonthsTicker.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n var months = this.months;\n if (months.length > 1)\n this.interval = (months[1] - months[0]) * util_1.ONE_MONTH;\n else\n this.interval = 12 * util_1.ONE_MONTH;\n };\n MonthsTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, _cross_loc, _desired_n_ticks) {\n var year_dates = date_range_by_year(data_low, data_high);\n var months = this.months;\n var months_of_year = function (year_date) {\n return months.map(function (month) {\n var month_date = util_1.copy_date(year_date);\n month_date.setUTCMonth(month);\n return month_date;\n });\n };\n var month_dates = array_1.concat(year_dates.map(months_of_year));\n var all_ticks = month_dates.map(function (month_date) { return month_date.getTime(); });\n var ticks_in_range = all_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; });\n return {\n major: ticks_in_range,\n minor: [],\n };\n };\n return MonthsTicker;\n }(single_interval_ticker_1.SingleIntervalTicker));\n exports.MonthsTicker = MonthsTicker;\n MonthsTicker.initClass();\n}\n","/* models/tickers/single_interval_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var continuous_ticker_1 = require(210) /* ./continuous_ticker */;\n var p = require(15) /* core/properties */;\n var SingleIntervalTicker = /** @class */ (function (_super) {\n tslib_1.__extends(SingleIntervalTicker, _super);\n function SingleIntervalTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n SingleIntervalTicker.initClass = function () {\n this.prototype.type = \"SingleIntervalTicker\";\n this.define({\n interval: [p.Number],\n });\n };\n SingleIntervalTicker.prototype.get_interval = function (_data_low, _data_high, _n_desired_ticks) {\n return this.interval;\n };\n Object.defineProperty(SingleIntervalTicker.prototype, \"min_interval\", {\n get: function () {\n return this.interval;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SingleIntervalTicker.prototype, \"max_interval\", {\n get: function () {\n return this.interval;\n },\n enumerable: true,\n configurable: true\n });\n return SingleIntervalTicker;\n }(continuous_ticker_1.ContinuousTicker));\n exports.SingleIntervalTicker = SingleIntervalTicker;\n SingleIntervalTicker.initClass();\n}\n","/* models/tickers/ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var Ticker = /** @class */ (function (_super) {\n tslib_1.__extends(Ticker, _super);\n function Ticker(attrs) {\n return _super.call(this, attrs) || this;\n }\n Ticker.initClass = function () {\n this.prototype.type = \"Ticker\";\n };\n return Ticker;\n }(model_1.Model));\n exports.Ticker = Ticker;\n Ticker.initClass();\n}\n","/* models/tickers/util */ function _(require, module, exports) {\n // Some time constants, in milliseconds.\n exports.ONE_MILLI = 1.0;\n exports.ONE_SECOND = 1000.0;\n exports.ONE_MINUTE = 60.0 * exports.ONE_SECOND;\n exports.ONE_HOUR = 60 * exports.ONE_MINUTE;\n exports.ONE_DAY = 24 * exports.ONE_HOUR;\n exports.ONE_MONTH = 30 * exports.ONE_DAY; // An approximation, obviously.\n exports.ONE_YEAR = 365 * exports.ONE_DAY;\n // ---------------------------------------------------------------------------\n // Date/time utility functions\n // ---------------------------------------------------------------------------\n // Makes a copy of a date object.\n function copy_date(date) {\n return new Date(date.getTime());\n }\n exports.copy_date = copy_date;\n // Rounds a date down to the month.\n function last_month_no_later_than(date) {\n var new_date = copy_date(date);\n new_date.setUTCDate(1);\n new_date.setUTCHours(0);\n new_date.setUTCMinutes(0);\n new_date.setUTCSeconds(0);\n new_date.setUTCMilliseconds(0);\n return new_date;\n }\n exports.last_month_no_later_than = last_month_no_later_than;\n // Rounds a date down to the year.\n function last_year_no_later_than(date) {\n var new_date = last_month_no_later_than(date);\n new_date.setUTCMonth(0);\n return new_date;\n }\n exports.last_year_no_later_than = last_year_no_later_than;\n}\n","/* models/tickers/years_ticker */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var basic_ticker_1 = require(207) /* ./basic_ticker */;\n var single_interval_ticker_1 = require(218) /* ./single_interval_ticker */;\n var util_1 = require(220) /* ./util */;\n var YearsTicker = /** @class */ (function (_super) {\n tslib_1.__extends(YearsTicker, _super);\n function YearsTicker(attrs) {\n return _super.call(this, attrs) || this;\n }\n YearsTicker.initClass = function () {\n this.prototype.type = \"YearsTicker\";\n };\n YearsTicker.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.interval = util_1.ONE_YEAR;\n this.basic_ticker = new basic_ticker_1.BasicTicker({ num_minor_ticks: 0 });\n };\n YearsTicker.prototype.get_ticks_no_defaults = function (data_low, data_high, cross_loc, desired_n_ticks) {\n var start_year = util_1.last_year_no_later_than(new Date(data_low)).getUTCFullYear();\n var end_year = util_1.last_year_no_later_than(new Date(data_high)).getUTCFullYear();\n var years = this.basic_ticker.get_ticks_no_defaults(start_year, end_year, cross_loc, desired_n_ticks).major;\n var all_ticks = years.map(function (year) { return Date.UTC(year, 0, 1); });\n var ticks_in_range = all_ticks.filter(function (tick) { return data_low <= tick && tick <= data_high; });\n return {\n major: ticks_in_range,\n minor: [],\n };\n };\n return YearsTicker;\n }(single_interval_ticker_1.SingleIntervalTicker));\n exports.YearsTicker = YearsTicker;\n YearsTicker.initClass();\n}\n","/* models/tiles/bbox_tile_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var mercator_tile_source_1 = require(225) /* ./mercator_tile_source */;\n var p = require(15) /* core/properties */;\n var BBoxTileSource = /** @class */ (function (_super) {\n tslib_1.__extends(BBoxTileSource, _super);\n function BBoxTileSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n BBoxTileSource.initClass = function () {\n this.prototype.type = 'BBoxTileSource';\n this.define({\n use_latlon: [p.Bool, false],\n });\n };\n BBoxTileSource.prototype.get_image_url = function (x, y, z) {\n var _a, _b;\n var image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n var xmax, xmin, ymax, ymin;\n if (this.use_latlon)\n _a = this.get_tile_geographic_bounds(x, y, z), xmin = _a[0], ymin = _a[1], xmax = _a[2], ymax = _a[3];\n else\n _b = this.get_tile_meter_bounds(x, y, z), xmin = _b[0], ymin = _b[1], xmax = _b[2], ymax = _b[3];\n return image_url.replace(\"{XMIN}\", xmin.toString())\n .replace(\"{YMIN}\", ymin.toString())\n .replace(\"{XMAX}\", xmax.toString())\n .replace(\"{YMAX}\", ymax.toString());\n };\n return BBoxTileSource;\n }(mercator_tile_source_1.MercatorTileSource));\n exports.BBoxTileSource = BBoxTileSource;\n BBoxTileSource.initClass();\n}\n","/* models/tiles/image_pool */ function _(require, module, exports) {\n var types_1 = require(44) /* core/util/types */;\n var ImagePool = /** @class */ (function () {\n function ImagePool() {\n this.images = [];\n }\n ImagePool.prototype.pop = function () {\n var img = this.images.pop();\n return img != null ? img : new Image();\n };\n ImagePool.prototype.push = function (img) {\n var _a;\n if (this.images.length > 50)\n return;\n if (types_1.isArray(img))\n (_a = this.images).push.apply(_a, img);\n else\n this.images.push(img);\n };\n return ImagePool;\n }());\n exports.ImagePool = ImagePool;\n}\n","/* models/tiles/index */ function _(require, module, exports) {\n var bbox_tile_source_1 = require(222) /* ./bbox_tile_source */;\n exports.BBoxTileSource = bbox_tile_source_1.BBoxTileSource;\n var mercator_tile_source_1 = require(225) /* ./mercator_tile_source */;\n exports.MercatorTileSource = mercator_tile_source_1.MercatorTileSource;\n var quadkey_tile_source_1 = require(226) /* ./quadkey_tile_source */;\n exports.QUADKEYTileSource = quadkey_tile_source_1.QUADKEYTileSource;\n var tile_renderer_1 = require(227) /* ./tile_renderer */;\n exports.TileRenderer = tile_renderer_1.TileRenderer;\n var tile_source_1 = require(228) /* ./tile_source */;\n exports.TileSource = tile_source_1.TileSource;\n var tms_tile_source_1 = require(230) /* ./tms_tile_source */;\n exports.TMSTileSource = tms_tile_source_1.TMSTileSource;\n var wmts_tile_source_1 = require(231) /* ./wmts_tile_source */;\n exports.WMTSTileSource = wmts_tile_source_1.WMTSTileSource;\n}\n","/* models/tiles/mercator_tile_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var tile_source_1 = require(228) /* ./tile_source */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var tile_utils_1 = require(229) /* ./tile_utils */;\n var MercatorTileSource = /** @class */ (function (_super) {\n tslib_1.__extends(MercatorTileSource, _super);\n function MercatorTileSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n MercatorTileSource.initClass = function () {\n this.prototype.type = 'MercatorTileSource';\n this.define({\n snap_to_zoom: [p.Bool, false],\n wrap_around: [p.Bool, true],\n });\n this.override({\n x_origin_offset: 20037508.34,\n y_origin_offset: 20037508.34,\n initial_resolution: 156543.03392804097,\n });\n };\n MercatorTileSource.prototype.initialize = function () {\n var _this = this;\n _super.prototype.initialize.call(this);\n this._resolutions = array_1.range(this.min_zoom, this.max_zoom + 1).map(function (z) { return _this.get_resolution(z); });\n };\n MercatorTileSource.prototype._computed_initial_resolution = function () {\n if (this.initial_resolution != null)\n return this.initial_resolution;\n else {\n // TODO testing 2015-11-17, if this codepath is used it seems\n // to use 100% cpu and wedge Chrome\n return (2 * Math.PI * 6378137) / this.tile_size;\n }\n };\n MercatorTileSource.prototype.is_valid_tile = function (x, y, z) {\n if (!this.wrap_around) {\n if (x < 0 || x >= Math.pow(2, z))\n return false;\n }\n if (y < 0 || y >= Math.pow(2, z))\n return false;\n return true;\n };\n MercatorTileSource.prototype.parent_by_tile_xyz = function (x, y, z) {\n var quadkey = this.tile_xyz_to_quadkey(x, y, z);\n var parent_quadkey = quadkey.substring(0, quadkey.length - 1);\n return this.quadkey_to_tile_xyz(parent_quadkey);\n };\n MercatorTileSource.prototype.get_resolution = function (level) {\n return this._computed_initial_resolution() / Math.pow(2, level);\n };\n MercatorTileSource.prototype.get_resolution_by_extent = function (extent, height, width) {\n var x_rs = (extent[2] - extent[0]) / width;\n var y_rs = (extent[3] - extent[1]) / height;\n return [x_rs, y_rs];\n };\n MercatorTileSource.prototype.get_level_by_extent = function (extent, height, width) {\n var x_rs = (extent[2] - extent[0]) / width;\n var y_rs = (extent[3] - extent[1]) / height;\n var resolution = Math.max(x_rs, y_rs);\n var i = 0;\n for (var _i = 0, _a = this._resolutions; _i < _a.length; _i++) {\n var r = _a[_i];\n if (resolution > r) {\n if (i == 0)\n return 0;\n if (i > 0)\n return i - 1;\n }\n i += 1;\n }\n // otherwise return the highest available resolution\n return (i - 1);\n };\n MercatorTileSource.prototype.get_closest_level_by_extent = function (extent, height, width) {\n var x_rs = (extent[2] - extent[0]) / width;\n var y_rs = (extent[3] - extent[1]) / height;\n var resolution = Math.max(x_rs, y_rs);\n var closest = this._resolutions.reduce(function (previous, current) {\n if (Math.abs(current - resolution) < Math.abs(previous - resolution)) {\n return current;\n }\n return previous;\n });\n return this._resolutions.indexOf(closest);\n };\n MercatorTileSource.prototype.snap_to_zoom_level = function (extent, height, width, level) {\n var xmin = extent[0], ymin = extent[1], xmax = extent[2], ymax = extent[3];\n var desired_res = this._resolutions[level];\n var desired_x_delta = width * desired_res;\n var desired_y_delta = height * desired_res;\n if (!this.snap_to_zoom) {\n var xscale = (xmax - xmin) / desired_x_delta;\n var yscale = (ymax - ymin) / desired_y_delta;\n if (xscale > yscale) {\n desired_x_delta = (xmax - xmin);\n desired_y_delta = desired_y_delta * xscale;\n }\n else {\n desired_x_delta = desired_x_delta * yscale;\n desired_y_delta = (ymax - ymin);\n }\n }\n var x_adjust = (desired_x_delta - (xmax - xmin)) / 2;\n var y_adjust = (desired_y_delta - (ymax - ymin)) / 2;\n return [xmin - x_adjust, ymin - y_adjust, xmax + x_adjust, ymax + y_adjust];\n };\n MercatorTileSource.prototype.tms_to_wmts = function (x, y, z) {\n 'Note this works both ways';\n return [x, Math.pow(2, z) - 1 - y, z];\n };\n MercatorTileSource.prototype.wmts_to_tms = function (x, y, z) {\n 'Note this works both ways';\n return [x, Math.pow(2, z) - 1 - y, z];\n };\n MercatorTileSource.prototype.pixels_to_meters = function (px, py, level) {\n var res = this.get_resolution(level);\n var mx = (px * res) - this.x_origin_offset;\n var my = (py * res) - this.y_origin_offset;\n return [mx, my];\n };\n MercatorTileSource.prototype.meters_to_pixels = function (mx, my, level) {\n var res = this.get_resolution(level);\n var px = (mx + this.x_origin_offset) / res;\n var py = (my + this.y_origin_offset) / res;\n return [px, py];\n };\n MercatorTileSource.prototype.pixels_to_tile = function (px, py) {\n var tx = Math.ceil(px / this.tile_size);\n tx = tx === 0 ? tx : tx - 1;\n var ty = Math.max(Math.ceil(py / this.tile_size) - 1, 0);\n return [tx, ty];\n };\n MercatorTileSource.prototype.pixels_to_raster = function (px, py, level) {\n var mapSize = this.tile_size << level;\n return [px, mapSize - py];\n };\n MercatorTileSource.prototype.meters_to_tile = function (mx, my, level) {\n var _a = this.meters_to_pixels(mx, my, level), px = _a[0], py = _a[1];\n return this.pixels_to_tile(px, py);\n };\n MercatorTileSource.prototype.get_tile_meter_bounds = function (tx, ty, level) {\n // expects tms styles coordinates (bottom-left origin)\n var _a = this.pixels_to_meters(tx * this.tile_size, ty * this.tile_size, level), xmin = _a[0], ymin = _a[1];\n var _b = this.pixels_to_meters((tx + 1) * this.tile_size, (ty + 1) * this.tile_size, level), xmax = _b[0], ymax = _b[1];\n return [xmin, ymin, xmax, ymax];\n };\n MercatorTileSource.prototype.get_tile_geographic_bounds = function (tx, ty, level) {\n var bounds = this.get_tile_meter_bounds(tx, ty, level);\n var _a = tile_utils_1.meters_extent_to_geographic(bounds), minLon = _a[0], minLat = _a[1], maxLon = _a[2], maxLat = _a[3];\n return [minLon, minLat, maxLon, maxLat];\n };\n MercatorTileSource.prototype.get_tiles_by_extent = function (extent, level, tile_border) {\n if (tile_border === void 0) {\n tile_border = 1;\n }\n // unpack extent and convert to tile coordinates\n var xmin = extent[0], ymin = extent[1], xmax = extent[2], ymax = extent[3];\n var _a = this.meters_to_tile(xmin, ymin, level), txmin = _a[0], tymin = _a[1];\n var _b = this.meters_to_tile(xmax, ymax, level), txmax = _b[0], tymax = _b[1];\n // add tiles which border\n txmin -= tile_border;\n tymin -= tile_border;\n txmax += tile_border;\n tymax += tile_border;\n var tiles = [];\n for (var ty = tymax; ty >= tymin; ty--) {\n for (var tx = txmin; tx <= txmax; tx++) {\n if (this.is_valid_tile(tx, ty, level))\n tiles.push([tx, ty, level, this.get_tile_meter_bounds(tx, ty, level)]);\n }\n }\n this.sort_tiles_from_center(tiles, [txmin, tymin, txmax, tymax]);\n return tiles;\n };\n MercatorTileSource.prototype.quadkey_to_tile_xyz = function (quadKey) {\n /**\n * Computes tile x, y and z values based on quadKey.\n */\n var tileX = 0;\n var tileY = 0;\n var tileZ = quadKey.length;\n for (var i = tileZ; i > 0; i--) {\n var value = quadKey.charAt(tileZ - i);\n var mask = 1 << (i - 1);\n switch (value) {\n case '0':\n continue;\n case '1':\n tileX |= mask;\n break;\n case '2':\n tileY |= mask;\n break;\n case '3':\n tileX |= mask;\n tileY |= mask;\n break;\n default:\n throw new TypeError(\"Invalid Quadkey: \" + quadKey);\n }\n }\n return [tileX, tileY, tileZ];\n };\n MercatorTileSource.prototype.tile_xyz_to_quadkey = function (x, y, z) {\n /*\n * Computes quadkey value based on tile x, y and z values.\n */\n var quadkey = \"\";\n for (var i = z; i > 0; i--) {\n var mask = 1 << (i - 1);\n var digit = 0;\n if ((x & mask) !== 0) {\n digit += 1;\n }\n if ((y & mask) !== 0) {\n digit += 2;\n }\n quadkey += digit.toString();\n }\n return quadkey;\n };\n MercatorTileSource.prototype.children_by_tile_xyz = function (x, y, z) {\n var quadkey = this.tile_xyz_to_quadkey(x, y, z);\n var child_tile_xyz = [];\n for (var i = 0; i <= 3; i++) {\n var _a = this.quadkey_to_tile_xyz(quadkey + i.toString()), x_1 = _a[0], y_1 = _a[1], z_1 = _a[2];\n var b = this.get_tile_meter_bounds(x_1, y_1, z_1);\n child_tile_xyz.push([x_1, y_1, z_1, b]);\n }\n return child_tile_xyz;\n };\n MercatorTileSource.prototype.get_closest_parent_by_tile_xyz = function (x, y, z) {\n var _a, _b, _c;\n var world_x = this.calculate_world_x_by_tile_xyz(x, y, z);\n _a = this.normalize_xyz(x, y, z), x = _a[0], y = _a[1], z = _a[2];\n var quadkey = this.tile_xyz_to_quadkey(x, y, z);\n while (quadkey.length > 0) {\n quadkey = quadkey.substring(0, quadkey.length - 1);\n _b = this.quadkey_to_tile_xyz(quadkey), x = _b[0], y = _b[1], z = _b[2];\n _c = this.denormalize_xyz(x, y, z, world_x), x = _c[0], y = _c[1], z = _c[2];\n if (this.tile_xyz_to_key(x, y, z) in this.tiles)\n return [x, y, z];\n }\n return [0, 0, 0];\n };\n MercatorTileSource.prototype.normalize_xyz = function (x, y, z) {\n if (this.wrap_around) {\n var tile_count = Math.pow(2, z);\n return [((x % tile_count) + tile_count) % tile_count, y, z];\n }\n else {\n return [x, y, z];\n }\n };\n MercatorTileSource.prototype.denormalize_xyz = function (x, y, z, world_x) {\n return [x + (world_x * Math.pow(2, z)), y, z];\n };\n MercatorTileSource.prototype.denormalize_meters = function (meters_x, meters_y, _level, world_x) {\n return [meters_x + (world_x * 2 * Math.PI * 6378137), meters_y];\n };\n MercatorTileSource.prototype.calculate_world_x_by_tile_xyz = function (x, _y, z) {\n return Math.floor(x / Math.pow(2, z));\n };\n return MercatorTileSource;\n }(tile_source_1.TileSource));\n exports.MercatorTileSource = MercatorTileSource;\n MercatorTileSource.initClass();\n}\n","/* models/tiles/quadkey_tile_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var mercator_tile_source_1 = require(225) /* ./mercator_tile_source */;\n var QUADKEYTileSource = /** @class */ (function (_super) {\n tslib_1.__extends(QUADKEYTileSource, _super);\n function QUADKEYTileSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n QUADKEYTileSource.initClass = function () {\n this.prototype.type = 'QUADKEYTileSource';\n };\n QUADKEYTileSource.prototype.get_image_url = function (x, y, z) {\n var image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n var _a = this.tms_to_wmts(x, y, z), wx = _a[0], wy = _a[1], wz = _a[2];\n var quadKey = this.tile_xyz_to_quadkey(wx, wy, wz);\n return image_url.replace(\"{Q}\", quadKey);\n };\n return QUADKEYTileSource;\n }(mercator_tile_source_1.MercatorTileSource));\n exports.QUADKEYTileSource = QUADKEYTileSource;\n QUADKEYTileSource.initClass();\n}\n","/* models/tiles/tile_renderer */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var image_pool_1 = require(223) /* ./image_pool */;\n var wmts_tile_source_1 = require(231) /* ./wmts_tile_source */;\n var renderer_1 = require(189) /* ../renderers/renderer */;\n var range1d_1 = require(184) /* ../ranges/range1d */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var TileRendererView = /** @class */ (function (_super) {\n tslib_1.__extends(TileRendererView, _super);\n function TileRendererView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TileRendererView.prototype.initialize = function (options) {\n this.attributionEl = null;\n this._tiles = [];\n _super.prototype.initialize.call(this, options);\n };\n TileRendererView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.change, function () { return _this.request_render(); });\n };\n TileRendererView.prototype.get_extent = function () {\n return [this.x_range.start, this.y_range.start, this.x_range.end, this.y_range.end];\n };\n Object.defineProperty(TileRendererView.prototype, \"map_plot\", {\n get: function () {\n return this.plot_model.plot;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TileRendererView.prototype, \"map_canvas\", {\n get: function () {\n return this.plot_view.canvas_view.ctx;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TileRendererView.prototype, \"map_frame\", {\n get: function () {\n return this.plot_model.frame;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TileRendererView.prototype, \"x_range\", {\n get: function () {\n return this.map_plot.x_range;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(TileRendererView.prototype, \"y_range\", {\n get: function () {\n return this.map_plot.y_range;\n },\n enumerable: true,\n configurable: true\n });\n TileRendererView.prototype._set_data = function () {\n this.pool = new image_pool_1.ImagePool();\n this.extent = this.get_extent();\n this._last_height = undefined;\n this._last_width = undefined;\n };\n TileRendererView.prototype._add_attribution = function () {\n var attribution = this.model.tile_source.attribution;\n if (types_1.isString(attribution) && attribution.length > 0) {\n if (this.attributionEl == null) {\n var right = this.plot_model.canvas._right.value - this.plot_model.frame._right.value;\n var bottom = this.plot_model.canvas._bottom.value - this.plot_model.frame._bottom.value;\n var max_width = this.map_frame._width.value;\n this.attributionEl = dom_1.div({\n class: 'bk-tile-attribution',\n style: {\n position: \"absolute\",\n bottom: bottom + \"px\",\n right: right + \"px\",\n 'max-width': max_width - 4 /*padding*/ + \"px\",\n padding: \"2px\",\n 'background-color': 'rgba(255,255,255,0.5)',\n 'font-size': '7pt',\n 'font-family': 'sans-serif',\n 'line-height': '1.05',\n 'white-space': 'nowrap',\n overflow: 'hidden',\n 'text-overflow': 'ellipsis',\n },\n });\n var overlays = this.plot_view.canvas_view.events_el;\n overlays.appendChild(this.attributionEl);\n }\n this.attributionEl.innerHTML = attribution;\n this.attributionEl.title = this.attributionEl.textContent.replace(/\\s*\\n\\s*/g, \" \");\n }\n };\n TileRendererView.prototype._map_data = function () {\n this.initial_extent = this.get_extent();\n var zoom_level = this.model.tile_source.get_level_by_extent(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value);\n var new_extent = this.model.tile_source.snap_to_zoom_level(this.initial_extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level);\n this.x_range.start = new_extent[0];\n this.y_range.start = new_extent[1];\n this.x_range.end = new_extent[2];\n this.y_range.end = new_extent[3];\n if (this.x_range instanceof range1d_1.Range1d) {\n this.x_range.reset_start = new_extent[0];\n this.x_range.reset_end = new_extent[2];\n }\n if (this.y_range instanceof range1d_1.Range1d) {\n this.y_range.reset_start = new_extent[1];\n this.y_range.reset_end = new_extent[3];\n }\n this._add_attribution();\n };\n TileRendererView.prototype._on_tile_load = function (tile_data, e) {\n tile_data.img = e.target;\n tile_data.loaded = true;\n this.request_render();\n };\n TileRendererView.prototype._on_tile_cache_load = function (tile_data, e) {\n tile_data.img = e.target;\n tile_data.loaded = true;\n tile_data.finished = true;\n this.notify_finished();\n };\n TileRendererView.prototype._on_tile_error = function (tile_data) {\n tile_data.finished = true;\n };\n TileRendererView.prototype._create_tile = function (x, y, z, bounds, cache_only) {\n if (cache_only === void 0) {\n cache_only = false;\n }\n var _a = this.model.tile_source.normalize_xyz(x, y, z), nx = _a[0], ny = _a[1], nz = _a[2];\n var img = this.pool.pop();\n var tile = {\n img: img,\n tile_coords: [x, y, z],\n normalized_coords: [nx, ny, nz],\n quadkey: this.model.tile_source.tile_xyz_to_quadkey(x, y, z),\n cache_key: this.model.tile_source.tile_xyz_to_key(x, y, z),\n bounds: bounds,\n loaded: false,\n finished: false,\n x_coord: bounds[0],\n y_coord: bounds[3],\n };\n img.onload = cache_only ? this._on_tile_cache_load.bind(this, tile) : this._on_tile_load.bind(this, tile);\n img.onerror = this._on_tile_error.bind(this, tile);\n img.alt = '';\n img.src = this.model.tile_source.get_image_url(nx, ny, nz);\n this.model.tile_source.tiles[tile.cache_key] = tile;\n this._tiles.push(tile);\n };\n TileRendererView.prototype._enforce_aspect_ratio = function () {\n // brute force way of handling resize or sizing_mode event -------------------------------------------------------------\n if ((this._last_height !== this.map_frame._height.value) || (this._last_width !== this.map_frame._width.value)) {\n var extent = this.get_extent();\n var zoom_level = this.model.tile_source.get_level_by_extent(extent, this.map_frame._height.value, this.map_frame._width.value);\n var new_extent = this.model.tile_source.snap_to_zoom_level(extent, this.map_frame._height.value, this.map_frame._width.value, zoom_level);\n this.x_range.setv({ start: new_extent[0], end: new_extent[2] });\n this.y_range.setv({ start: new_extent[1], end: new_extent[3] });\n this.extent = new_extent;\n this._last_height = this.map_frame._height.value;\n this._last_width = this.map_frame._width.value;\n }\n };\n TileRendererView.prototype.has_finished = function () {\n if (!_super.prototype.has_finished.call(this)) {\n return false;\n }\n if (this._tiles.length === 0) {\n return false;\n }\n for (var _i = 0, _a = this._tiles; _i < _a.length; _i++) {\n var tile = _a[_i];\n if (!tile.finished) {\n return false;\n }\n }\n return true;\n };\n TileRendererView.prototype.render = function () {\n if (this.map_initialized == null) {\n this._set_data();\n this._map_data();\n this.map_initialized = true;\n }\n this._enforce_aspect_ratio();\n this._update();\n if (this.prefetch_timer != null) {\n clearTimeout(this.prefetch_timer);\n }\n this.prefetch_timer = setTimeout(this._prefetch_tiles.bind(this), 500);\n if (this.has_finished()) {\n this.notify_finished();\n }\n };\n TileRendererView.prototype._draw_tile = function (tile_key) {\n var tile_obj = this.model.tile_source.tiles[tile_key];\n if (tile_obj != null) {\n var _a = this.plot_view.map_to_screen([tile_obj.bounds[0]], [tile_obj.bounds[3]]), sxmin = _a[0][0], symin = _a[1][0]; // XXX: TS #20623\n var _b = this.plot_view.map_to_screen([tile_obj.bounds[2]], [tile_obj.bounds[1]]), sxmax = _b[0][0], symax = _b[1][0]; //\n var sw = sxmax - sxmin;\n var sh = symax - symin;\n var sx = sxmin;\n var sy = symin;\n var old_smoothing = this.map_canvas.getImageSmoothingEnabled();\n this.map_canvas.setImageSmoothingEnabled(this.model.smoothing);\n this.map_canvas.drawImage(tile_obj.img, sx, sy, sw, sh);\n this.map_canvas.setImageSmoothingEnabled(old_smoothing);\n tile_obj.finished = true;\n }\n };\n TileRendererView.prototype._set_rect = function () {\n var outline_width = this.plot_model.plot.properties.outline_line_width.value();\n var l = this.map_frame._left.value + (outline_width / 2);\n var t = this.map_frame._top.value + (outline_width / 2);\n var w = this.map_frame._width.value - outline_width;\n var h = this.map_frame._height.value - outline_width;\n this.map_canvas.rect(l, t, w, h);\n this.map_canvas.clip();\n };\n TileRendererView.prototype._render_tiles = function (tile_keys) {\n this.map_canvas.save();\n this._set_rect();\n this.map_canvas.globalAlpha = this.model.alpha;\n for (var _i = 0, tile_keys_1 = tile_keys; _i < tile_keys_1.length; _i++) {\n var tile_key = tile_keys_1[_i];\n this._draw_tile(tile_key);\n }\n this.map_canvas.restore();\n };\n TileRendererView.prototype._prefetch_tiles = function () {\n var tile_source = this.model.tile_source;\n var extent = this.get_extent();\n var h = this.map_frame._height.value;\n var w = this.map_frame._width.value;\n var zoom_level = this.model.tile_source.get_level_by_extent(extent, h, w);\n var tiles = this.model.tile_source.get_tiles_by_extent(extent, zoom_level);\n for (var t = 0, end = Math.min(10, tiles.length); t < end; t++) {\n var _a = tiles[t], x = _a[0], y = _a[1], z = _a[2];\n var children = this.model.tile_source.children_by_tile_xyz(x, y, z);\n for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {\n var c = children_1[_i];\n var cx = c[0], cy = c[1], cz = c[2], cbounds = c[3];\n if (tile_source.tile_xyz_to_key(cx, cy, cz) in tile_source.tiles) {\n continue;\n }\n else {\n this._create_tile(cx, cy, cz, cbounds, true);\n }\n }\n }\n };\n TileRendererView.prototype._fetch_tiles = function (tiles) {\n for (var _i = 0, tiles_1 = tiles; _i < tiles_1.length; _i++) {\n var tile = tiles_1[_i];\n var x = tile[0], y = tile[1], z = tile[2], bounds = tile[3];\n this._create_tile(x, y, z, bounds);\n }\n };\n TileRendererView.prototype._update = function () {\n var _this = this;\n var tile_source = this.model.tile_source;\n var min_zoom = tile_source.min_zoom;\n var max_zoom = tile_source.max_zoom;\n var extent = this.get_extent();\n var zooming_out = (this.extent[2] - this.extent[0]) < (extent[2] - extent[0]);\n var h = this.map_frame._height.value;\n var w = this.map_frame._width.value;\n var zoom_level = tile_source.get_level_by_extent(extent, h, w);\n var snap_back = false;\n if (zoom_level < min_zoom) {\n extent = this.extent;\n zoom_level = min_zoom;\n snap_back = true;\n }\n else if (zoom_level > max_zoom) {\n extent = this.extent;\n zoom_level = max_zoom;\n snap_back = true;\n }\n if (snap_back) {\n this.x_range.setv({ x_range: { start: extent[0], end: extent[2] } });\n this.y_range.setv({ start: extent[1], end: extent[3] });\n this.extent = extent;\n }\n this.extent = extent;\n var tiles = tile_source.get_tiles_by_extent(extent, zoom_level);\n var need_load = [];\n var cached = [];\n var parents = [];\n var children = [];\n for (var _i = 0, tiles_2 = tiles; _i < tiles_2.length; _i++) {\n var t = tiles_2[_i];\n var x = t[0], y = t[1], z = t[2];\n var key = tile_source.tile_xyz_to_key(x, y, z);\n var tile = tile_source.tiles[key];\n if (tile != null && tile.loaded) {\n cached.push(key);\n }\n else {\n if (this.model.render_parents) {\n var _a = tile_source.get_closest_parent_by_tile_xyz(x, y, z), px = _a[0], py = _a[1], pz = _a[2];\n var parent_key = tile_source.tile_xyz_to_key(px, py, pz);\n var parent_tile = tile_source.tiles[parent_key];\n if ((parent_tile != null) && parent_tile.loaded && !array_1.includes(parents, parent_key)) {\n parents.push(parent_key);\n }\n if (zooming_out) {\n var child_tiles = tile_source.children_by_tile_xyz(x, y, z);\n for (var _b = 0, child_tiles_1 = child_tiles; _b < child_tiles_1.length; _b++) {\n var _c = child_tiles_1[_b], cx = _c[0], cy = _c[1], cz = _c[2];\n var child_key = tile_source.tile_xyz_to_key(cx, cy, cz);\n if (child_key in tile_source.tiles)\n children.push(child_key);\n }\n }\n }\n }\n if (tile == null)\n need_load.push(t);\n }\n // draw stand-in parents ----------\n this._render_tiles(parents);\n this._render_tiles(children);\n // draw cached ----------\n this._render_tiles(cached);\n // fetch missing -------\n if (this.render_timer != null) {\n clearTimeout(this.render_timer);\n }\n this.render_timer = setTimeout((function () { return _this._fetch_tiles(need_load); }), 65);\n };\n return TileRendererView;\n }(renderer_1.RendererView));\n exports.TileRendererView = TileRendererView;\n var TileRenderer = /** @class */ (function (_super) {\n tslib_1.__extends(TileRenderer, _super);\n function TileRenderer(attrs) {\n return _super.call(this, attrs) || this;\n }\n TileRenderer.initClass = function () {\n this.prototype.type = 'TileRenderer';\n this.prototype.default_view = TileRendererView;\n this.define({\n alpha: [p.Number, 1.0],\n x_range_name: [p.String, \"default\"],\n y_range_name: [p.String, \"default\"],\n smoothing: [p.Bool, true],\n tile_source: [p.Instance, function () { return new wmts_tile_source_1.WMTSTileSource(); }],\n render_parents: [p.Bool, true],\n });\n this.override({\n level: 'underlay',\n });\n };\n return TileRenderer;\n }(renderer_1.Renderer));\n exports.TileRenderer = TileRenderer;\n TileRenderer.initClass();\n}\n","/* models/tiles/tile_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var image_pool_1 = require(223) /* ./image_pool */;\n var p = require(15) /* core/properties */;\n var TileSource = /** @class */ (function (_super) {\n tslib_1.__extends(TileSource, _super);\n function TileSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n TileSource.initClass = function () {\n this.prototype.type = 'TileSource';\n this.define({\n url: [p.String, ''],\n tile_size: [p.Number, 256],\n max_zoom: [p.Number, 30],\n min_zoom: [p.Number, 0],\n extra_url_vars: [p.Any, {}],\n attribution: [p.String, ''],\n x_origin_offset: [p.Number],\n y_origin_offset: [p.Number],\n initial_resolution: [p.Number],\n });\n };\n TileSource.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.tiles = {};\n this.pool = new image_pool_1.ImagePool();\n this._normalize_case();\n };\n TileSource.prototype.string_lookup_replace = function (str, lookup) {\n var result_str = str;\n for (var key in lookup) {\n var value = lookup[key];\n result_str = result_str.replace(\"{\" + key + \"}\", value);\n }\n return result_str;\n };\n TileSource.prototype._normalize_case = function () {\n /*\n * Note: should probably be refactored into subclasses.\n */\n var url = this.url\n .replace('{x}', '{X}')\n .replace('{y}', '{Y}')\n .replace('{z}', '{Z}')\n .replace('{q}', '{Q}')\n .replace('{xmin}', '{XMIN}')\n .replace('{ymin}', '{YMIN}')\n .replace('{xmax}', '{XMAX}')\n .replace('{ymax}', '{YMAX}');\n this.url = url;\n };\n TileSource.prototype.tile_xyz_to_key = function (x, y, z) {\n return x + \":\" + y + \":\" + z;\n };\n TileSource.prototype.key_to_tile_xyz = function (key) {\n var _a = key.split(':').map(function (c) { return parseInt(c); }), x = _a[0], y = _a[1], z = _a[2];\n return [x, y, z];\n };\n TileSource.prototype.sort_tiles_from_center = function (tiles, tile_extent) {\n var txmin = tile_extent[0], tymin = tile_extent[1], txmax = tile_extent[2], tymax = tile_extent[3];\n var center_x = ((txmax - txmin) / 2) + txmin;\n var center_y = ((tymax - tymin) / 2) + tymin;\n tiles.sort(function (a, b) {\n var a_distance = Math.sqrt(Math.pow(center_x - a[0], 2) + Math.pow(center_y - a[1], 2));\n var b_distance = Math.sqrt(Math.pow(center_x - b[0], 2) + Math.pow(center_y - b[1], 2));\n return a_distance - b_distance;\n });\n };\n TileSource.prototype.get_image_url = function (x, y, z) {\n var image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n return image_url.replace(\"{X}\", x.toString())\n .replace('{Y}', y.toString())\n .replace(\"{Z}\", z.toString());\n };\n return TileSource;\n }(model_1.Model));\n exports.TileSource = TileSource;\n TileSource.initClass();\n}\n","/* models/tiles/tile_utils */ function _(require, module, exports) {\n var projections_1 = require(33) /* core/util/projections */;\n function geographic_to_meters(xLon, yLat) {\n return projections_1.wgs84_mercator.forward([xLon, yLat]);\n }\n exports.geographic_to_meters = geographic_to_meters;\n function meters_to_geographic(mx, my) {\n return projections_1.wgs84_mercator.inverse([mx, my]);\n }\n exports.meters_to_geographic = meters_to_geographic;\n function geographic_extent_to_meters(extent) {\n var g_xmin = extent[0], g_ymin = extent[1], g_xmax = extent[2], g_ymax = extent[3];\n var _a = geographic_to_meters(g_xmin, g_ymin), m_xmin = _a[0], m_ymin = _a[1];\n var _b = geographic_to_meters(g_xmax, g_ymax), m_xmax = _b[0], m_ymax = _b[1];\n return [m_xmin, m_ymin, m_xmax, m_ymax];\n }\n exports.geographic_extent_to_meters = geographic_extent_to_meters;\n function meters_extent_to_geographic(extent) {\n var m_xmin = extent[0], m_ymin = extent[1], m_xmax = extent[2], m_ymax = extent[3];\n var _a = meters_to_geographic(m_xmin, m_ymin), g_xmin = _a[0], g_ymin = _a[1];\n var _b = meters_to_geographic(m_xmax, m_ymax), g_xmax = _b[0], g_ymax = _b[1];\n return [g_xmin, g_ymin, g_xmax, g_ymax];\n }\n exports.meters_extent_to_geographic = meters_extent_to_geographic;\n}\n","/* models/tiles/tms_tile_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var mercator_tile_source_1 = require(225) /* ./mercator_tile_source */;\n var TMSTileSource = /** @class */ (function (_super) {\n tslib_1.__extends(TMSTileSource, _super);\n function TMSTileSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n TMSTileSource.initClass = function () {\n this.prototype.type = 'TMSTileSource';\n };\n TMSTileSource.prototype.get_image_url = function (x, y, z) {\n var image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n return image_url.replace(\"{X}\", x.toString())\n .replace('{Y}', y.toString())\n .replace(\"{Z}\", z.toString());\n };\n return TMSTileSource;\n }(mercator_tile_source_1.MercatorTileSource));\n exports.TMSTileSource = TMSTileSource;\n TMSTileSource.initClass();\n}\n","/* models/tiles/wmts_tile_source */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var mercator_tile_source_1 = require(225) /* ./mercator_tile_source */;\n var WMTSTileSource = /** @class */ (function (_super) {\n tslib_1.__extends(WMTSTileSource, _super);\n function WMTSTileSource(attrs) {\n return _super.call(this, attrs) || this;\n }\n WMTSTileSource.initClass = function () {\n this.prototype.type = 'WMTSTileSource';\n };\n WMTSTileSource.prototype.get_image_url = function (x, y, z) {\n var image_url = this.string_lookup_replace(this.url, this.extra_url_vars);\n var _a = this.tms_to_wmts(x, y, z), wx = _a[0], wy = _a[1], wz = _a[2];\n return image_url.replace(\"{X}\", wx.toString())\n .replace('{Y}', wy.toString())\n .replace(\"{Z}\", wz.toString());\n };\n return WMTSTileSource;\n }(mercator_tile_source_1.MercatorTileSource));\n exports.WMTSTileSource = WMTSTileSource;\n WMTSTileSource.initClass();\n}\n","/* models/tools/actions/action_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var button_tool_1 = require(241) /* ../button_tool */;\n var signaling_1 = require(19) /* core/signaling */;\n var ActionToolButtonView = /** @class */ (function (_super) {\n tslib_1.__extends(ActionToolButtonView, _super);\n function ActionToolButtonView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ActionToolButtonView.prototype._clicked = function () {\n this.model.do.emit();\n };\n return ActionToolButtonView;\n }(button_tool_1.ButtonToolButtonView));\n exports.ActionToolButtonView = ActionToolButtonView;\n var ActionToolView = /** @class */ (function (_super) {\n tslib_1.__extends(ActionToolView, _super);\n function ActionToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ActionToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.do, function () { return _this.doit(); });\n };\n return ActionToolView;\n }(button_tool_1.ButtonToolView));\n exports.ActionToolView = ActionToolView;\n var ActionTool = /** @class */ (function (_super) {\n tslib_1.__extends(ActionTool, _super);\n function ActionTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.button_view = ActionToolButtonView;\n _this.do = new signaling_1.Signal0(_this, \"do\");\n return _this;\n }\n ActionTool.initClass = function () {\n this.prototype.type = \"ActionTool\";\n };\n return ActionTool;\n }(button_tool_1.ButtonTool));\n exports.ActionTool = ActionTool;\n ActionTool.initClass();\n}\n","/* models/tools/actions/custom_action */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var CustomActionButtonView = /** @class */ (function (_super) {\n tslib_1.__extends(CustomActionButtonView, _super);\n function CustomActionButtonView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CustomActionButtonView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-toolbar-button-custom-action\");\n };\n return CustomActionButtonView;\n }(action_tool_1.ActionToolButtonView));\n exports.CustomActionButtonView = CustomActionButtonView;\n var CustomActionView = /** @class */ (function (_super) {\n tslib_1.__extends(CustomActionView, _super);\n function CustomActionView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CustomActionView.prototype.doit = function () {\n var callback = this.model.callback;\n if (types_1.isFunction(callback))\n callback(this, {});\n else\n callback.execute(this, {});\n };\n return CustomActionView;\n }(action_tool_1.ActionToolView));\n exports.CustomActionView = CustomActionView;\n var CustomAction = /** @class */ (function (_super) {\n tslib_1.__extends(CustomAction, _super);\n function CustomAction(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Custom Action\";\n _this.button_view = CustomActionButtonView;\n return _this;\n }\n CustomAction.initClass = function () {\n this.prototype.type = \"CustomAction\";\n this.prototype.default_view = CustomActionView;\n this.define({\n action_tooltip: [p.String, 'Perform a Custom Action'],\n callback: [p.Any],\n icon: [p.String,],\n });\n };\n Object.defineProperty(CustomAction.prototype, \"tooltip\", {\n get: function () {\n return this.action_tooltip;\n },\n enumerable: true,\n configurable: true\n });\n return CustomAction;\n }(action_tool_1.ActionTool));\n exports.CustomAction = CustomAction;\n CustomAction.initClass();\n}\n","/* models/tools/actions/help_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var p = require(15) /* core/properties */;\n var HelpToolView = /** @class */ (function (_super) {\n tslib_1.__extends(HelpToolView, _super);\n function HelpToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n HelpToolView.prototype.doit = function () {\n window.open(this.model.redirect);\n };\n return HelpToolView;\n }(action_tool_1.ActionToolView));\n exports.HelpToolView = HelpToolView;\n var HelpTool = /** @class */ (function (_super) {\n tslib_1.__extends(HelpTool, _super);\n function HelpTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Help\";\n _this.icon = \"bk-tool-icon-help\";\n return _this;\n }\n HelpTool.initClass = function () {\n this.prototype.type = \"HelpTool\";\n this.prototype.default_view = HelpToolView;\n this.define({\n help_tooltip: [p.String, 'Click the question mark to learn more about Bokeh plot tools.'],\n redirect: [p.String, 'https://bokeh.pydata.org/en/latest/docs/user_guide/tools.html#built-in-tools'],\n });\n };\n Object.defineProperty(HelpTool.prototype, \"tooltip\", {\n get: function () {\n return this.help_tooltip;\n },\n enumerable: true,\n configurable: true\n });\n return HelpTool;\n }(action_tool_1.ActionTool));\n exports.HelpTool = HelpTool;\n HelpTool.initClass();\n}\n","/* models/tools/actions/redo_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var RedoToolView = /** @class */ (function (_super) {\n tslib_1.__extends(RedoToolView, _super);\n function RedoToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RedoToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.plot_view.state_changed, function () { return _this.model.disabled = !_this.plot_view.can_redo(); });\n };\n RedoToolView.prototype.doit = function () {\n this.plot_view.redo();\n };\n return RedoToolView;\n }(action_tool_1.ActionToolView));\n exports.RedoToolView = RedoToolView;\n var RedoTool = /** @class */ (function (_super) {\n tslib_1.__extends(RedoTool, _super);\n function RedoTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Redo\";\n _this.icon = \"bk-tool-icon-redo\";\n return _this;\n }\n RedoTool.initClass = function () {\n this.prototype.type = \"RedoTool\";\n this.prototype.default_view = RedoToolView;\n this.override({\n disabled: true,\n });\n };\n return RedoTool;\n }(action_tool_1.ActionTool));\n exports.RedoTool = RedoTool;\n RedoTool.initClass();\n}\n","/* models/tools/actions/reset_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var ResetToolView = /** @class */ (function (_super) {\n tslib_1.__extends(ResetToolView, _super);\n function ResetToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ResetToolView.prototype.doit = function () {\n this.plot_view.reset();\n };\n return ResetToolView;\n }(action_tool_1.ActionToolView));\n exports.ResetToolView = ResetToolView;\n var ResetTool = /** @class */ (function (_super) {\n tslib_1.__extends(ResetTool, _super);\n function ResetTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Reset\";\n _this.icon = \"bk-tool-icon-reset\";\n return _this;\n }\n ResetTool.initClass = function () {\n this.prototype.type = \"ResetTool\";\n this.prototype.default_view = ResetToolView;\n };\n return ResetTool;\n }(action_tool_1.ActionTool));\n exports.ResetTool = ResetTool;\n ResetTool.initClass();\n}\n","/* models/tools/actions/save_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var SaveToolView = /** @class */ (function (_super) {\n tslib_1.__extends(SaveToolView, _super);\n function SaveToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n SaveToolView.prototype.doit = function () {\n this.plot_view.save(\"bokeh_plot\");\n };\n return SaveToolView;\n }(action_tool_1.ActionToolView));\n exports.SaveToolView = SaveToolView;\n var SaveTool = /** @class */ (function (_super) {\n tslib_1.__extends(SaveTool, _super);\n function SaveTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Save\";\n _this.icon = \"bk-tool-icon-save\";\n return _this;\n }\n SaveTool.initClass = function () {\n this.prototype.type = \"SaveTool\";\n this.prototype.default_view = SaveToolView;\n };\n return SaveTool;\n }(action_tool_1.ActionTool));\n exports.SaveTool = SaveTool;\n SaveTool.initClass();\n}\n","/* models/tools/actions/undo_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var UndoToolView = /** @class */ (function (_super) {\n tslib_1.__extends(UndoToolView, _super);\n function UndoToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n UndoToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.plot_view.state_changed, function () { return _this.model.disabled = !_this.plot_view.can_undo(); });\n };\n UndoToolView.prototype.doit = function () {\n this.plot_view.undo();\n };\n return UndoToolView;\n }(action_tool_1.ActionToolView));\n exports.UndoToolView = UndoToolView;\n var UndoTool = /** @class */ (function (_super) {\n tslib_1.__extends(UndoTool, _super);\n function UndoTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Undo\";\n _this.icon = \"bk-tool-icon-undo\";\n return _this;\n }\n UndoTool.initClass = function () {\n this.prototype.type = \"UndoTool\";\n this.prototype.default_view = UndoToolView;\n this.override({\n disabled: true,\n });\n };\n return UndoTool;\n }(action_tool_1.ActionTool));\n exports.UndoTool = UndoTool;\n UndoTool.initClass();\n}\n","/* models/tools/actions/zoom_in_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var zoom_1 = require(46) /* core/util/zoom */;\n var p = require(15) /* core/properties */;\n var ZoomInToolView = /** @class */ (function (_super) {\n tslib_1.__extends(ZoomInToolView, _super);\n function ZoomInToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ZoomInToolView.prototype.doit = function () {\n var frame = this.plot_model.frame;\n var dims = this.model.dimensions;\n // restrict to axis configured in tool's dimensions property\n var h_axis = dims == 'width' || dims == 'both';\n var v_axis = dims == 'height' || dims == 'both';\n var zoom_info = zoom_1.scale_range(frame, this.model.factor, h_axis, v_axis);\n this.plot_view.push_state('zoom_out', { range: zoom_info });\n this.plot_view.update_range(zoom_info, false, true);\n if (this.model.document)\n this.model.document.interactive_start(this.plot_model.plot);\n };\n return ZoomInToolView;\n }(action_tool_1.ActionToolView));\n exports.ZoomInToolView = ZoomInToolView;\n var ZoomInTool = /** @class */ (function (_super) {\n tslib_1.__extends(ZoomInTool, _super);\n function ZoomInTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Zoom In\";\n _this.icon = \"bk-tool-icon-zoom-in\";\n return _this;\n }\n ZoomInTool.initClass = function () {\n this.prototype.type = \"ZoomInTool\";\n this.prototype.default_view = ZoomInToolView;\n this.define({\n factor: [p.Percent, 0.1],\n dimensions: [p.Dimensions, \"both\"],\n });\n };\n Object.defineProperty(ZoomInTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(this.tool_name, this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n return ZoomInTool;\n }(action_tool_1.ActionTool));\n exports.ZoomInTool = ZoomInTool;\n ZoomInTool.initClass();\n}\n","/* models/tools/actions/zoom_out_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var action_tool_1 = require(232) /* ./action_tool */;\n var zoom_1 = require(46) /* core/util/zoom */;\n var p = require(15) /* core/properties */;\n var ZoomOutToolView = /** @class */ (function (_super) {\n tslib_1.__extends(ZoomOutToolView, _super);\n function ZoomOutToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ZoomOutToolView.prototype.doit = function () {\n var frame = this.plot_model.frame;\n var dims = this.model.dimensions;\n // restrict to axis configured in tool's dimensions property\n var h_axis = dims == 'width' || dims == 'both';\n var v_axis = dims == 'height' || dims == 'both';\n // zooming out requires a negative factor to scale_range\n var zoom_info = zoom_1.scale_range(frame, -this.model.factor, h_axis, v_axis);\n this.plot_view.push_state('zoom_out', { range: zoom_info });\n this.plot_view.update_range(zoom_info, false, true);\n if (this.model.document)\n this.model.document.interactive_start(this.plot_model.plot);\n };\n return ZoomOutToolView;\n }(action_tool_1.ActionToolView));\n exports.ZoomOutToolView = ZoomOutToolView;\n var ZoomOutTool = /** @class */ (function (_super) {\n tslib_1.__extends(ZoomOutTool, _super);\n function ZoomOutTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Zoom Out\";\n _this.icon = \"bk-tool-icon-zoom-out\";\n return _this;\n }\n ZoomOutTool.initClass = function () {\n this.prototype.type = \"ZoomOutTool\";\n this.prototype.default_view = ZoomOutToolView;\n this.define({\n factor: [p.Percent, 0.1],\n dimensions: [p.Dimensions, \"both\"],\n });\n };\n Object.defineProperty(ZoomOutTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(this.tool_name, this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n return ZoomOutTool;\n }(action_tool_1.ActionTool));\n exports.ZoomOutTool = ZoomOutTool;\n ZoomOutTool.initClass();\n}\n","/* models/tools/button_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_view_1 = require(6) /* core/dom_view */;\n var tool_1 = require(266) /* ./tool */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var string_1 = require(38) /* core/util/string */;\n var types_1 = require(44) /* core/util/types */;\n var ButtonToolButtonView = /** @class */ (function (_super) {\n tslib_1.__extends(ButtonToolButtonView, _super);\n function ButtonToolButtonView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ButtonToolButtonView.prototype.initialize = function (options) {\n var _this = this;\n _super.prototype.initialize.call(this, options);\n this.connect(this.model.change, function () { return _this.render(); });\n this.el.addEventListener(\"click\", function () { return _this._clicked(); });\n this.render();\n };\n ButtonToolButtonView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-toolbar-button\");\n };\n ButtonToolButtonView.prototype.render = function () {\n dom_1.empty(this.el);\n var icon = this.model.computed_icon;\n if (types_1.isString(icon)) {\n if (string_1.startsWith(icon, \"data:image\"))\n this.el.style.backgroundImage = \"url('\" + icon + \"')\";\n else\n this.el.classList.add(icon);\n }\n this.el.title = this.model.tooltip;\n };\n return ButtonToolButtonView;\n }(dom_view_1.DOMView));\n exports.ButtonToolButtonView = ButtonToolButtonView;\n var ButtonToolView = /** @class */ (function (_super) {\n tslib_1.__extends(ButtonToolView, _super);\n function ButtonToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return ButtonToolView;\n }(tool_1.ToolView));\n exports.ButtonToolView = ButtonToolView;\n var ButtonTool = /** @class */ (function (_super) {\n tslib_1.__extends(ButtonTool, _super);\n function ButtonTool(attrs) {\n return _super.call(this, attrs) || this;\n }\n ButtonTool.initClass = function () {\n this.prototype.type = \"ButtonTool\";\n this.internal({\n disabled: [p.Boolean, false],\n });\n };\n Object.defineProperty(ButtonTool.prototype, \"tooltip\", {\n get: function () {\n return this.tool_name;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ButtonTool.prototype, \"computed_icon\", {\n get: function () {\n return this.icon;\n },\n enumerable: true,\n configurable: true\n });\n return ButtonTool;\n }(tool_1.Tool));\n exports.ButtonTool = ButtonTool;\n ButtonTool.initClass();\n}\n","/* models/tools/edit/box_edit_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var edit_tool_1 = require(243) /* ./edit_tool */;\n var BoxEditToolView = /** @class */ (function (_super) {\n tslib_1.__extends(BoxEditToolView, _super);\n function BoxEditToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BoxEditToolView.prototype._tap = function (ev) {\n if ((this._draw_basepoint != null) || (this._basepoint != null)) {\n return;\n }\n var append = ev.shiftKey;\n this._select_event(ev, append, this.model.renderers);\n };\n BoxEditToolView.prototype._keyup = function (ev) {\n if (!this.model.active || !this._mouse_in_frame) {\n return;\n }\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n if (ev.keyCode === dom_1.Keys.Backspace) {\n this._delete_selected(renderer);\n }\n else if (ev.keyCode == dom_1.Keys.Esc) {\n // Type properly once selection_manager is typed\n var cds = renderer.data_source;\n cds.selection_manager.clear();\n }\n }\n };\n BoxEditToolView.prototype._set_extent = function (_a, _b, append, emit) {\n var sx0 = _a[0], sx1 = _a[1];\n var sy0 = _b[0], sy1 = _b[1];\n if (emit === void 0) {\n emit = false;\n }\n var renderer = this.model.renderers[0];\n var frame = this.plot_model.frame;\n // Type once dataspecs are typed\n var glyph = renderer.glyph;\n var cds = renderer.data_source;\n var xscale = frame.xscales[renderer.x_range_name];\n var yscale = frame.yscales[renderer.y_range_name];\n var _c = xscale.r_invert(sx0, sx1), x0 = _c[0], x1 = _c[1];\n var _d = yscale.r_invert(sy0, sy1), y0 = _d[0], y1 = _d[1];\n var _e = [(x0 + x1) / 2., (y0 + y1) / 2.], x = _e[0], y = _e[1];\n var _f = [x1 - x0, y1 - y0], w = _f[0], h = _f[1];\n var _g = [glyph.x.field, glyph.y.field], xkey = _g[0], ykey = _g[1];\n var _h = [glyph.width.field, glyph.height.field], wkey = _h[0], hkey = _h[1];\n if (append) {\n this._pop_glyphs(cds, this.model.num_objects);\n if (xkey)\n cds.get_array(xkey).push(x);\n if (ykey)\n cds.get_array(ykey).push(y);\n if (wkey)\n cds.get_array(wkey).push(w);\n if (hkey)\n cds.get_array(hkey).push(h);\n this._pad_empty_columns(cds, [xkey, ykey, wkey, hkey]);\n }\n else {\n var index = cds.data[xkey].length - 1;\n if (xkey)\n cds.data[xkey][index] = x;\n if (ykey)\n cds.data[ykey][index] = y;\n if (wkey)\n cds.data[wkey][index] = w;\n if (hkey)\n cds.data[hkey][index] = h;\n }\n this._emit_cds_changes(cds, true, false, emit);\n };\n BoxEditToolView.prototype._update_box = function (ev, append, emit) {\n if (append === void 0) {\n append = false;\n }\n if (emit === void 0) {\n emit = false;\n }\n if (this._draw_basepoint == null) {\n return;\n }\n var curpoint = [ev.sx, ev.sy];\n var frame = this.plot_model.frame;\n var dims = this.model.dimensions;\n var limits = this.model._get_dim_limits(this._draw_basepoint, curpoint, frame, dims);\n if (limits != null) {\n var sxlim = limits[0], sylim = limits[1];\n this._set_extent(sxlim, sylim, append, emit);\n }\n };\n BoxEditToolView.prototype._doubletap = function (ev) {\n if (!this.model.active) {\n return;\n }\n if (this._draw_basepoint != null) {\n this._update_box(ev, false, true);\n this._draw_basepoint = null;\n }\n else {\n this._draw_basepoint = [ev.sx, ev.sy];\n this._select_event(ev, true, this.model.renderers);\n this._update_box(ev, true, false);\n }\n };\n BoxEditToolView.prototype._move = function (ev) {\n this._update_box(ev, false, false);\n };\n BoxEditToolView.prototype._pan_start = function (ev) {\n if (ev.shiftKey) {\n if (this._draw_basepoint != null) {\n return;\n }\n this._draw_basepoint = [ev.sx, ev.sy];\n this._update_box(ev, true, false);\n }\n else {\n if (this._basepoint != null) {\n return;\n }\n this._select_event(ev, true, this.model.renderers);\n this._basepoint = [ev.sx, ev.sy];\n }\n };\n BoxEditToolView.prototype._pan = function (ev, append, emit) {\n if (append === void 0) {\n append = false;\n }\n if (emit === void 0) {\n emit = false;\n }\n if (ev.shiftKey) {\n if (this._draw_basepoint == null) {\n return;\n }\n this._update_box(ev, append, emit);\n }\n else {\n if (this._basepoint == null) {\n return;\n }\n this._drag_points(ev, this.model.renderers);\n }\n };\n BoxEditToolView.prototype._pan_end = function (ev) {\n this._pan(ev, false, true);\n if (ev.shiftKey) {\n this._draw_basepoint = null;\n }\n else {\n this._basepoint = null;\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n this._emit_cds_changes(renderer.data_source, false, true, true);\n }\n }\n };\n return BoxEditToolView;\n }(edit_tool_1.EditToolView));\n exports.BoxEditToolView = BoxEditToolView;\n var BoxEditTool = /** @class */ (function (_super) {\n tslib_1.__extends(BoxEditTool, _super);\n function BoxEditTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Box Edit Tool\";\n _this.icon = \"bk-tool-icon-box-edit\";\n _this.event_type = [\"tap\", \"pan\", \"move\"];\n _this.default_order = 1;\n return _this;\n }\n BoxEditTool.initClass = function () {\n this.prototype.type = \"BoxEditTool\";\n this.prototype.default_view = BoxEditToolView;\n this.define({\n dimensions: [p.Dimensions, \"both\"],\n num_objects: [p.Int, 0],\n });\n };\n return BoxEditTool;\n }(edit_tool_1.EditTool));\n exports.BoxEditTool = BoxEditTool;\n BoxEditTool.initClass();\n}\n","/* models/tools/edit/edit_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var gesture_tool_1 = require(251) /* ../gestures/gesture_tool */;\n var EditToolView = /** @class */ (function (_super) {\n tslib_1.__extends(EditToolView, _super);\n function EditToolView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._mouse_in_frame = true;\n return _this;\n }\n EditToolView.prototype._move_enter = function (_e) {\n this._mouse_in_frame = true;\n };\n EditToolView.prototype._move_exit = function (_e) {\n this._mouse_in_frame = false;\n };\n EditToolView.prototype._map_drag = function (sx, sy, renderer) {\n // Maps screen to data coordinates\n var frame = this.plot_model.frame;\n if (!frame.bbox.contains(sx, sy)) {\n return null;\n }\n var x = frame.xscales[renderer.x_range_name].invert(sx);\n var y = frame.yscales[renderer.y_range_name].invert(sy);\n return [x, y];\n };\n EditToolView.prototype._delete_selected = function (renderer) {\n // Deletes all selected rows in the ColumnDataSource\n var cds = renderer.data_source;\n var indices = cds.selected.indices;\n indices.sort();\n for (var _i = 0, _a = cds.columns(); _i < _a.length; _i++) {\n var column = _a[_i];\n var values = cds.get_array(column);\n for (var index = 0; index < indices.length; index++) {\n var ind = indices[index];\n values.splice(ind - index, 1);\n }\n }\n this._emit_cds_changes(cds);\n };\n EditToolView.prototype._pop_glyphs = function (cds, num_objects) {\n // Pops rows in the CDS until only num_objects are left\n var columns = cds.columns();\n if (!num_objects || !columns.length)\n return;\n for (var _i = 0, columns_1 = columns; _i < columns_1.length; _i++) {\n var column = columns_1[_i];\n var array = cds.get_array(column);\n var drop = array.length - num_objects + 1;\n if (drop < 1)\n continue;\n if (!types_1.isArray(array)) {\n array = Array.from(array);\n cds.data[column] = array;\n }\n array.splice(0, drop);\n }\n };\n EditToolView.prototype._emit_cds_changes = function (cds, redraw, clear, emit) {\n if (redraw === void 0) {\n redraw = true;\n }\n if (clear === void 0) {\n clear = true;\n }\n if (emit === void 0) {\n emit = true;\n }\n if (clear)\n cds.selection_manager.clear();\n if (redraw)\n cds.change.emit();\n if (emit) {\n cds.data = cds.data;\n cds.properties.data.change.emit();\n }\n };\n EditToolView.prototype._drag_points = function (ev, renderers) {\n if (this._basepoint == null) {\n return;\n }\n ;\n var _a = this._basepoint, bx = _a[0], by = _a[1];\n for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) {\n var renderer = renderers_1[_i];\n var basepoint = this._map_drag(bx, by, renderer);\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null || basepoint == null) {\n continue;\n }\n var x = point[0], y = point[1];\n var px = basepoint[0], py = basepoint[1];\n var _b = [x - px, y - py], dx = _b[0], dy = _b[1];\n // Type once dataspecs are typed\n var glyph = renderer.glyph;\n var cds = renderer.data_source;\n var _c = [glyph.x.field, glyph.y.field], xkey = _c[0], ykey = _c[1];\n for (var _d = 0, _f = cds.selected.indices; _d < _f.length; _d++) {\n var index = _f[_d];\n if (xkey)\n cds.data[xkey][index] += dx;\n if (ykey)\n cds.data[ykey][index] += dy;\n }\n cds.change.emit();\n }\n this._basepoint = [ev.sx, ev.sy];\n };\n EditToolView.prototype._pad_empty_columns = function (cds, coord_columns) {\n // Pad ColumnDataSource non-coordinate columns with empty_value\n for (var _i = 0, _a = cds.columns(); _i < _a.length; _i++) {\n var column = _a[_i];\n if (!array_1.includes(coord_columns, column))\n cds.get_array(column).push(this.model.empty_value);\n }\n };\n EditToolView.prototype._select_event = function (ev, append, renderers) {\n // Process selection event on the supplied renderers and return selected renderers\n var frame = this.plot_model.frame;\n var sx = ev.sx, sy = ev.sy;\n if (!frame.bbox.contains(sx, sy)) {\n return [];\n }\n var geometry = {\n type: 'point',\n sx: sx,\n sy: sy,\n };\n var selected = [];\n for (var _i = 0, renderers_2 = renderers; _i < renderers_2.length; _i++) {\n var renderer = renderers_2[_i];\n var sm = renderer.get_selection_manager();\n var cds = renderer.data_source;\n var views = [this.plot_view.renderer_views[renderer.id]];\n var did_hit = sm.select(views, geometry, true, append);\n if (did_hit) {\n selected.push(renderer);\n }\n cds.properties.selected.change.emit();\n }\n return selected;\n };\n return EditToolView;\n }(gesture_tool_1.GestureToolView));\n exports.EditToolView = EditToolView;\n var EditTool = /** @class */ (function (_super) {\n tslib_1.__extends(EditTool, _super);\n function EditTool(attrs) {\n return _super.call(this, attrs) || this;\n }\n EditTool.initClass = function () {\n this.prototype.type = \"EditTool\";\n this.define({\n custom_icon: [p.String,],\n custom_tooltip: [p.String,],\n empty_value: [p.Any,],\n renderers: [p.Array, []],\n });\n };\n Object.defineProperty(EditTool.prototype, \"tooltip\", {\n get: function () {\n return this.custom_tooltip || this.tool_name;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(EditTool.prototype, \"computed_icon\", {\n get: function () {\n return this.custom_icon || this.icon;\n },\n enumerable: true,\n configurable: true\n });\n return EditTool;\n }(gesture_tool_1.GestureTool));\n exports.EditTool = EditTool;\n EditTool.initClass();\n}\n","/* models/tools/edit/freehand_draw_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var edit_tool_1 = require(243) /* ./edit_tool */;\n var FreehandDrawToolView = /** @class */ (function (_super) {\n tslib_1.__extends(FreehandDrawToolView, _super);\n function FreehandDrawToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n FreehandDrawToolView.prototype._draw = function (ev, mode, emit) {\n if (emit === void 0) {\n emit = false;\n }\n if (!this.model.active) {\n return;\n }\n var renderer = this.model.renderers[0];\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null) {\n return;\n }\n var x = point[0], y = point[1];\n var cds = renderer.data_source;\n var glyph = renderer.glyph;\n var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1];\n if (mode == 'new') {\n this._pop_glyphs(cds, this.model.num_objects);\n if (xkey)\n cds.get_array(xkey).push([x]);\n if (ykey)\n cds.get_array(ykey).push([y]);\n this._pad_empty_columns(cds, [xkey, ykey]);\n }\n else if (mode == 'add') {\n if (xkey) {\n var xidx = cds.data[xkey].length - 1;\n var xs = cds.get_array(xkey)[xidx];\n if (!types_1.isArray(xs)) {\n xs = Array.from(xs);\n cds.data[xkey][xidx] = xs;\n }\n xs.push(x);\n }\n if (ykey) {\n var yidx = cds.data[ykey].length - 1;\n var ys = cds.get_array(ykey)[yidx];\n if (!types_1.isArray(ys)) {\n ys = Array.from(ys);\n cds.data[ykey][yidx] = ys;\n }\n ys.push(y);\n }\n }\n this._emit_cds_changes(cds, true, true, emit);\n };\n FreehandDrawToolView.prototype._pan_start = function (ev) {\n this._draw(ev, 'new');\n };\n FreehandDrawToolView.prototype._pan = function (ev) {\n this._draw(ev, 'add');\n };\n FreehandDrawToolView.prototype._pan_end = function (ev) {\n this._draw(ev, 'add', true);\n };\n FreehandDrawToolView.prototype._tap = function (ev) {\n this._select_event(ev, ev.shiftKey, this.model.renderers);\n };\n FreehandDrawToolView.prototype._keyup = function (ev) {\n if (!this.model.active || !this._mouse_in_frame) {\n return;\n }\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n if (ev.keyCode === dom_1.Keys.Esc) {\n renderer.data_source.selection_manager.clear();\n }\n else if (ev.keyCode === dom_1.Keys.Backspace) {\n this._delete_selected(renderer);\n }\n }\n };\n return FreehandDrawToolView;\n }(edit_tool_1.EditToolView));\n exports.FreehandDrawToolView = FreehandDrawToolView;\n var FreehandDrawTool = /** @class */ (function (_super) {\n tslib_1.__extends(FreehandDrawTool, _super);\n function FreehandDrawTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Freehand Draw Tool\";\n _this.icon = \"bk-tool-icon-freehand-draw\";\n _this.event_type = [\"pan\", \"tap\"];\n _this.default_order = 3;\n return _this;\n }\n FreehandDrawTool.initClass = function () {\n this.prototype.type = \"FreehandDrawTool\";\n this.prototype.default_view = FreehandDrawToolView;\n this.define({\n num_objects: [p.Int, 0],\n });\n };\n return FreehandDrawTool;\n }(edit_tool_1.EditTool));\n exports.FreehandDrawTool = FreehandDrawTool;\n FreehandDrawTool.initClass();\n}\n","/* models/tools/edit/point_draw_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var edit_tool_1 = require(243) /* ./edit_tool */;\n var PointDrawToolView = /** @class */ (function (_super) {\n tslib_1.__extends(PointDrawToolView, _super);\n function PointDrawToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PointDrawToolView.prototype._tap = function (ev) {\n var append = ev.shiftKey;\n var renderers = this._select_event(ev, append, this.model.renderers);\n if (renderers.length || !this.model.add) {\n return;\n }\n var renderer = this.model.renderers[0];\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null) {\n return;\n }\n // Type once dataspecs are typed\n var glyph = renderer.glyph;\n var cds = renderer.data_source;\n var _a = [glyph.x.field, glyph.y.field], xkey = _a[0], ykey = _a[1];\n var x = point[0], y = point[1];\n this._pop_glyphs(cds, this.model.num_objects);\n if (xkey)\n cds.get_array(xkey).push(x);\n if (ykey)\n cds.get_array(ykey).push(y);\n this._pad_empty_columns(cds, [xkey, ykey]);\n cds.change.emit();\n cds.data = cds.data;\n cds.properties.data.change.emit();\n };\n PointDrawToolView.prototype._keyup = function (ev) {\n if (!this.model.active || !this._mouse_in_frame) {\n return;\n }\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n if (ev.keyCode === dom_1.Keys.Backspace) {\n this._delete_selected(renderer);\n }\n else if (ev.keyCode == dom_1.Keys.Esc) {\n renderer.data_source.selection_manager.clear();\n }\n }\n };\n PointDrawToolView.prototype._pan_start = function (ev) {\n if (!this.model.drag) {\n return;\n }\n this._select_event(ev, true, this.model.renderers);\n this._basepoint = [ev.sx, ev.sy];\n };\n PointDrawToolView.prototype._pan = function (ev) {\n if (!this.model.drag || this._basepoint == null) {\n return;\n }\n this._drag_points(ev, this.model.renderers);\n };\n PointDrawToolView.prototype._pan_end = function (ev) {\n if (!this.model.drag) {\n return;\n }\n this._pan(ev);\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n this._emit_cds_changes(renderer.data_source, false, true, true);\n }\n this._basepoint = null;\n };\n return PointDrawToolView;\n }(edit_tool_1.EditToolView));\n exports.PointDrawToolView = PointDrawToolView;\n var PointDrawTool = /** @class */ (function (_super) {\n tslib_1.__extends(PointDrawTool, _super);\n function PointDrawTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Point Draw Tool\";\n _this.icon = \"bk-tool-icon-point-draw\";\n _this.event_type = [\"tap\", \"pan\", \"move\"];\n _this.default_order = 2;\n return _this;\n }\n PointDrawTool.initClass = function () {\n this.prototype.type = \"PointDrawTool\";\n this.prototype.default_view = PointDrawToolView;\n this.define({\n add: [p.Bool, true],\n drag: [p.Bool, true],\n num_objects: [p.Int, 0],\n });\n };\n return PointDrawTool;\n }(edit_tool_1.EditTool));\n exports.PointDrawTool = PointDrawTool;\n PointDrawTool.initClass();\n}\n","/* models/tools/edit/poly_draw_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var poly_tool_1 = require(248) /* ./poly_tool */;\n var PolyDrawToolView = /** @class */ (function (_super) {\n tslib_1.__extends(PolyDrawToolView, _super);\n function PolyDrawToolView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._drawing = false;\n _this._initialized = false;\n return _this;\n }\n PolyDrawToolView.prototype._tap = function (ev) {\n if (this._drawing)\n this._draw(ev, 'add', true);\n else\n this._select_event(ev, ev.shiftKey, this.model.renderers);\n };\n PolyDrawToolView.prototype._draw = function (ev, mode, emit) {\n if (emit === void 0) {\n emit = false;\n }\n var _a;\n var renderer = this.model.renderers[0];\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (!this._initialized)\n this.activate(); // Ensure that activate has been called\n if (point == null) {\n return;\n }\n var x = point[0], y = point[1];\n _a = this._snap_to_vertex(ev, x, y), x = _a[0], y = _a[1];\n var cds = renderer.data_source;\n var glyph = renderer.glyph;\n var _b = [glyph.xs.field, glyph.ys.field], xkey = _b[0], ykey = _b[1];\n if (mode == 'new') {\n this._pop_glyphs(cds, this.model.num_objects);\n if (xkey)\n cds.get_array(xkey).push([x, x]);\n if (ykey)\n cds.get_array(ykey).push([y, y]);\n this._pad_empty_columns(cds, [xkey, ykey]);\n }\n else if (mode == 'edit') {\n if (xkey) {\n var xs = cds.data[xkey][cds.data[xkey].length - 1];\n xs[xs.length - 1] = x;\n }\n if (ykey) {\n var ys = cds.data[ykey][cds.data[ykey].length - 1];\n ys[ys.length - 1] = y;\n }\n }\n else if (mode == 'add') {\n if (xkey) {\n var xidx = cds.data[xkey].length - 1;\n var xs = cds.get_array(xkey)[xidx];\n var nx = xs[xs.length - 1];\n xs[xs.length - 1] = x;\n if (!types_1.isArray(xs)) {\n xs = Array.from(xs);\n cds.data[xkey][xidx] = xs;\n }\n xs.push(nx);\n }\n if (ykey) {\n var yidx = cds.data[ykey].length - 1;\n var ys = cds.get_array(ykey)[yidx];\n var ny = ys[ys.length - 1];\n ys[ys.length - 1] = y;\n if (!types_1.isArray(ys)) {\n ys = Array.from(ys);\n cds.data[ykey][yidx] = ys;\n }\n ys.push(ny);\n }\n }\n this._emit_cds_changes(cds, true, false, emit);\n };\n PolyDrawToolView.prototype._show_vertices = function () {\n var xs = [];\n var ys = [];\n for (var i = 0; i < this.model.renderers.length; i++) {\n var renderer = this.model.renderers[i];\n var cds = renderer.data_source;\n var glyph = renderer.glyph;\n var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1];\n if (xkey) {\n for (var _i = 0, _b = cds.get_array(xkey); _i < _b.length; _i++) {\n var array = _b[_i];\n Array.prototype.push.apply(xs, array);\n }\n }\n if (ykey) {\n for (var _c = 0, _d = cds.get_array(ykey); _c < _d.length; _c++) {\n var array = _d[_c];\n Array.prototype.push.apply(ys, array);\n }\n }\n if (this._drawing && (i == (this.model.renderers.length - 1))) {\n // Skip currently drawn vertex\n xs.splice(xs.length - 1, 1);\n ys.splice(ys.length - 1, 1);\n }\n }\n this._set_vertices(xs, ys);\n };\n PolyDrawToolView.prototype._doubletap = function (ev) {\n if (!this.model.active) {\n return;\n }\n if (this._drawing) {\n this._drawing = false;\n this._draw(ev, 'edit', true);\n }\n else {\n this._drawing = true;\n this._draw(ev, 'new', true);\n }\n };\n PolyDrawToolView.prototype._move = function (ev) {\n if (this._drawing) {\n this._draw(ev, 'edit');\n }\n };\n PolyDrawToolView.prototype._remove = function () {\n var renderer = this.model.renderers[0];\n var cds = renderer.data_source;\n var glyph = renderer.glyph;\n var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1];\n if (xkey) {\n var xidx = cds.data[xkey].length - 1;\n var xs = cds.get_array(xkey)[xidx];\n xs.splice(xs.length - 1, 1);\n }\n if (ykey) {\n var yidx = cds.data[ykey].length - 1;\n var ys = cds.get_array(ykey)[yidx];\n ys.splice(ys.length - 1, 1);\n }\n this._emit_cds_changes(cds);\n };\n PolyDrawToolView.prototype._keyup = function (ev) {\n if (!this.model.active || !this._mouse_in_frame) {\n return;\n }\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n if (ev.keyCode === dom_1.Keys.Backspace) {\n this._delete_selected(renderer);\n }\n else if (ev.keyCode == dom_1.Keys.Esc) {\n if (this._drawing) {\n this._remove();\n this._drawing = false;\n }\n renderer.data_source.selection_manager.clear();\n }\n }\n };\n PolyDrawToolView.prototype._pan_start = function (ev) {\n if (!this.model.drag) {\n return;\n }\n this._select_event(ev, true, this.model.renderers);\n this._basepoint = [ev.sx, ev.sy];\n };\n PolyDrawToolView.prototype._pan = function (ev) {\n if (this._basepoint == null || !this.model.drag) {\n return;\n }\n var _a = this._basepoint, bx = _a[0], by = _a[1];\n // Process polygon/line dragging\n for (var _i = 0, _b = this.model.renderers; _i < _b.length; _i++) {\n var renderer = _b[_i];\n var basepoint = this._map_drag(bx, by, renderer);\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null || basepoint == null) {\n continue;\n }\n var cds = renderer.data_source;\n // Type once dataspecs are typed\n var glyph = renderer.glyph;\n var _c = [glyph.xs.field, glyph.ys.field], xkey = _c[0], ykey = _c[1];\n if (!xkey && !ykey) {\n continue;\n }\n var x = point[0], y = point[1];\n var px = basepoint[0], py = basepoint[1];\n var _d = [x - px, y - py], dx = _d[0], dy = _d[1];\n for (var _e = 0, _f = cds.selected.indices; _e < _f.length; _e++) {\n var index = _f[_e];\n var length_1 = void 0, xs = void 0, ys = void 0;\n if (xkey)\n xs = cds.data[xkey][index];\n if (ykey) {\n ys = cds.data[ykey][index];\n length_1 = ys.length;\n }\n else {\n length_1 = xs.length;\n }\n for (var i = 0; i < length_1; i++) {\n if (xs) {\n xs[i] += dx;\n }\n if (ys) {\n ys[i] += dy;\n }\n }\n }\n cds.change.emit();\n }\n this._basepoint = [ev.sx, ev.sy];\n };\n PolyDrawToolView.prototype._pan_end = function (ev) {\n if (!this.model.drag) {\n return;\n }\n this._pan(ev);\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n this._emit_cds_changes(renderer.data_source);\n }\n this._basepoint = null;\n };\n PolyDrawToolView.prototype.activate = function () {\n var _this = this;\n if (!this.model.vertex_renderer || !this.model.active) {\n return;\n }\n this._show_vertices();\n if (!this._initialized) {\n for (var _i = 0, _a = this.model.renderers; _i < _a.length; _i++) {\n var renderer = _a[_i];\n var cds = renderer.data_source;\n cds.connect(cds.properties.data.change, function () { return _this._show_vertices(); });\n }\n }\n this._initialized = true;\n };\n PolyDrawToolView.prototype.deactivate = function () {\n if (this._drawing) {\n this._remove();\n this._drawing = false;\n }\n if (this.model.vertex_renderer)\n this._hide_vertices();\n };\n return PolyDrawToolView;\n }(poly_tool_1.PolyToolView));\n exports.PolyDrawToolView = PolyDrawToolView;\n var PolyDrawTool = /** @class */ (function (_super) {\n tslib_1.__extends(PolyDrawTool, _super);\n function PolyDrawTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Polygon Draw Tool\";\n _this.icon = \"bk-tool-icon-poly-draw\";\n _this.event_type = [\"pan\", \"tap\", \"move\"];\n _this.default_order = 3;\n return _this;\n }\n PolyDrawTool.initClass = function () {\n this.prototype.type = \"PolyDrawTool\";\n this.prototype.default_view = PolyDrawToolView;\n this.define({\n drag: [p.Bool, true],\n num_objects: [p.Int, 0],\n });\n };\n return PolyDrawTool;\n }(poly_tool_1.PolyTool));\n exports.PolyDrawTool = PolyDrawTool;\n PolyDrawTool.initClass();\n}\n","/* models/tools/edit/poly_edit_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var dom_1 = require(5) /* core/dom */;\n var types_1 = require(44) /* core/util/types */;\n var poly_tool_1 = require(248) /* ./poly_tool */;\n var PolyEditToolView = /** @class */ (function (_super) {\n tslib_1.__extends(PolyEditToolView, _super);\n function PolyEditToolView() {\n var _this = _super !== null && _super.apply(this, arguments) || this;\n _this._drawing = false;\n return _this;\n }\n PolyEditToolView.prototype._doubletap = function (ev) {\n if (!this.model.active) {\n return;\n }\n var point = this._map_drag(ev.sx, ev.sy, this.model.vertex_renderer);\n if (point == null) {\n return;\n }\n var x = point[0], y = point[1];\n // Perform hit testing\n var vertex_selected = this._select_event(ev, false, [this.model.vertex_renderer]);\n var point_cds = this.model.vertex_renderer.data_source;\n // Type once dataspecs are typed\n var point_glyph = this.model.vertex_renderer.glyph;\n var _a = [point_glyph.x.field, point_glyph.y.field], pxkey = _a[0], pykey = _a[1];\n if (vertex_selected.length && this._selected_renderer != null) {\n // Insert a new point after the selected vertex and enter draw mode\n var index = point_cds.selected.indices[0];\n if (this._drawing) {\n this._drawing = false;\n point_cds.selection_manager.clear();\n }\n else {\n point_cds.selected.indices = [index + 1];\n if (pxkey)\n point_cds.get_array(pxkey).splice(index + 1, 0, x);\n if (pykey)\n point_cds.get_array(pykey).splice(index + 1, 0, y);\n this._drawing = true;\n }\n point_cds.change.emit();\n this._emit_cds_changes(this._selected_renderer.data_source);\n }\n else {\n this._show_vertices(ev);\n }\n };\n PolyEditToolView.prototype._show_vertices = function (ev) {\n if (!this.model.active) {\n return;\n }\n var renderers = this._select_event(ev, false, this.model.renderers);\n if (!renderers.length) {\n this._set_vertices([], []);\n this._selected_renderer = null;\n this._drawing = false;\n return;\n }\n var renderer = renderers[0];\n var glyph = renderer.glyph;\n var cds = renderer.data_source;\n var index = cds.selected.indices[0];\n var _a = [glyph.xs.field, glyph.ys.field], xkey = _a[0], ykey = _a[1];\n var xs;\n var ys;\n if (xkey) {\n xs = cds.data[xkey][index];\n if (!types_1.isArray(xs))\n cds.data[xkey][index] = xs = Array.from(xs);\n }\n else {\n xs = glyph.xs.value;\n }\n if (ykey) {\n ys = cds.data[ykey][index];\n if (!types_1.isArray(ys))\n cds.data[ykey][index] = ys = Array.from(ys);\n }\n else {\n ys = glyph.ys.value;\n }\n this._selected_renderer = renderer;\n this._set_vertices(xs, ys);\n };\n PolyEditToolView.prototype._move = function (ev) {\n var _a;\n if (this._drawing && this._selected_renderer != null) {\n var renderer = this.model.vertex_renderer;\n var cds = renderer.data_source;\n var glyph = renderer.glyph;\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null) {\n return;\n }\n var x = point[0], y = point[1];\n var indices = cds.selected.indices;\n _a = this._snap_to_vertex(ev, x, y), x = _a[0], y = _a[1];\n cds.selected.indices = indices;\n var _b = [glyph.x.field, glyph.y.field], xkey = _b[0], ykey = _b[1];\n var index = indices[0];\n if (xkey)\n cds.data[xkey][index] = x;\n if (ykey)\n cds.data[ykey][index] = y;\n cds.change.emit();\n this._selected_renderer.data_source.change.emit();\n }\n };\n PolyEditToolView.prototype._tap = function (ev) {\n var _a;\n var renderer = this.model.vertex_renderer;\n var point = this._map_drag(ev.sx, ev.sy, renderer);\n if (point == null) {\n return;\n }\n else if (this._drawing && this._selected_renderer) {\n var x = point[0], y = point[1];\n var cds = renderer.data_source;\n // Type once dataspecs are typed\n var glyph = renderer.glyph;\n var _b = [glyph.x.field, glyph.y.field], xkey = _b[0], ykey = _b[1];\n var indices = cds.selected.indices;\n _a = this._snap_to_vertex(ev, x, y), x = _a[0], y = _a[1];\n var index = indices[0];\n cds.selected.indices = [index + 1];\n if (xkey) {\n var xs = cds.get_array(xkey);\n var nx = xs[index];\n xs[index] = x;\n xs.splice(index + 1, 0, nx);\n }\n if (ykey) {\n var ys = cds.get_array(ykey);\n var ny = ys[index];\n ys[index] = y;\n ys.splice(index + 1, 0, ny);\n }\n cds.change.emit();\n this._emit_cds_changes(this._selected_renderer.data_source, true, false, true);\n return;\n }\n var append = ev.shiftKey;\n this._select_event(ev, append, [renderer]);\n this._select_event(ev, append, this.model.renderers);\n };\n PolyEditToolView.prototype._remove_vertex = function () {\n if (!this._drawing || !this._selected_renderer) {\n return;\n }\n var renderer = this.model.vertex_renderer;\n var cds = renderer.data_source;\n // Type once dataspecs are typed\n var glyph = renderer.glyph;\n var index = cds.selected.indices[0];\n var _a = [glyph.x.field, glyph.y.field], xkey = _a[0], ykey = _a[1];\n if (xkey)\n cds.get_array(xkey).splice(index, 1);\n if (ykey)\n cds.get_array(ykey).splice(index, 1);\n cds.change.emit();\n this._emit_cds_changes(this._selected_renderer.data_source);\n };\n PolyEditToolView.prototype._pan_start = function (ev) {\n this._select_event(ev, true, [this.model.vertex_renderer]);\n this._basepoint = [ev.sx, ev.sy];\n };\n PolyEditToolView.prototype._pan = function (ev) {\n if (this._basepoint == null) {\n return;\n }\n this._drag_points(ev, [this.model.vertex_renderer]);\n if (this._selected_renderer) {\n this._selected_renderer.data_source.change.emit();\n }\n };\n PolyEditToolView.prototype._pan_end = function (ev) {\n if (this._basepoint == null) {\n return;\n }\n this._drag_points(ev, [this.model.vertex_renderer]);\n this._emit_cds_changes(this.model.vertex_renderer.data_source, false, true, true);\n if (this._selected_renderer) {\n this._emit_cds_changes(this._selected_renderer.data_source);\n }\n this._basepoint = null;\n };\n PolyEditToolView.prototype._keyup = function (ev) {\n if (!this.model.active || !this._mouse_in_frame) {\n return;\n }\n var renderers;\n if (this._selected_renderer) {\n renderers = [this.model.vertex_renderer];\n }\n else {\n renderers = this.model.renderers;\n }\n for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) {\n var renderer = renderers_1[_i];\n if (ev.keyCode === dom_1.Keys.Backspace) {\n this._delete_selected(renderer);\n if (this._selected_renderer) {\n this._emit_cds_changes(this._selected_renderer.data_source);\n }\n }\n else if (ev.keyCode == dom_1.Keys.Esc) {\n if (this._drawing) {\n this._remove_vertex();\n this._drawing = false;\n }\n else if (this._selected_renderer) {\n this._hide_vertices();\n }\n renderer.data_source.selection_manager.clear();\n }\n }\n };\n PolyEditToolView.prototype.deactivate = function () {\n if (!this._selected_renderer) {\n return;\n }\n else if (this._drawing) {\n this._remove_vertex();\n this._drawing = false;\n }\n this._hide_vertices();\n };\n return PolyEditToolView;\n }(poly_tool_1.PolyToolView));\n exports.PolyEditToolView = PolyEditToolView;\n var PolyEditTool = /** @class */ (function (_super) {\n tslib_1.__extends(PolyEditTool, _super);\n function PolyEditTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Poly Edit Tool\";\n _this.icon = \"bk-tool-icon-poly-edit\";\n _this.event_type = [\"tap\", \"pan\", \"move\"];\n _this.default_order = 4;\n return _this;\n }\n PolyEditTool.initClass = function () {\n this.prototype.type = \"PolyEditTool\";\n this.prototype.default_view = PolyEditToolView;\n };\n return PolyEditTool;\n }(poly_tool_1.PolyTool));\n exports.PolyEditTool = PolyEditTool;\n PolyEditTool.initClass();\n}\n","/* models/tools/edit/poly_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var edit_tool_1 = require(243) /* ./edit_tool */;\n var PolyToolView = /** @class */ (function (_super) {\n tslib_1.__extends(PolyToolView, _super);\n function PolyToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PolyToolView.prototype._set_vertices = function (xs, ys) {\n var point_glyph = this.model.vertex_renderer.glyph;\n var point_cds = this.model.vertex_renderer.data_source;\n var _a = [point_glyph.x.field, point_glyph.y.field], pxkey = _a[0], pykey = _a[1];\n if (pxkey) {\n if (types_1.isArray(xs))\n point_cds.data[pxkey] = xs;\n else\n point_glyph.x = { value: xs };\n }\n if (pykey) {\n if (types_1.isArray(ys))\n point_cds.data[pykey] = ys;\n else\n point_glyph.y = { value: ys };\n }\n this._emit_cds_changes(point_cds, true, true, false);\n };\n PolyToolView.prototype._hide_vertices = function () {\n this._set_vertices([], []);\n };\n PolyToolView.prototype._snap_to_vertex = function (ev, x, y) {\n if (this.model.vertex_renderer) {\n // If an existing vertex is hit snap to it\n var vertex_selected = this._select_event(ev, false, [this.model.vertex_renderer]);\n var point_ds = this.model.vertex_renderer.data_source;\n // Type once dataspecs are typed\n var point_glyph = this.model.vertex_renderer.glyph;\n var _a = [point_glyph.x.field, point_glyph.y.field], pxkey = _a[0], pykey = _a[1];\n if (vertex_selected.length) {\n var index = point_ds.selected.indices[0];\n if (pxkey)\n x = point_ds.data[pxkey][index];\n if (pykey)\n y = point_ds.data[pykey][index];\n point_ds.selection_manager.clear();\n }\n }\n return [x, y];\n };\n return PolyToolView;\n }(edit_tool_1.EditToolView));\n exports.PolyToolView = PolyToolView;\n var PolyTool = /** @class */ (function (_super) {\n tslib_1.__extends(PolyTool, _super);\n function PolyTool(attrs) {\n return _super.call(this, attrs) || this;\n }\n PolyTool.initClass = function () {\n this.prototype.type = \"PolyTool\";\n this.prototype.default_view = PolyToolView;\n this.define({\n vertex_renderer: [p.Instance],\n });\n };\n return PolyTool;\n }(edit_tool_1.EditTool));\n exports.PolyTool = PolyTool;\n PolyTool.initClass();\n}\n","/* models/tools/gestures/box_select_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var select_tool_1 = require(256) /* ./select_tool */;\n var box_annotation_1 = require(64) /* ../../annotations/box_annotation */;\n var p = require(15) /* core/properties */;\n var BoxSelectToolView = /** @class */ (function (_super) {\n tslib_1.__extends(BoxSelectToolView, _super);\n function BoxSelectToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BoxSelectToolView.prototype._compute_limits = function (curpoint) {\n var frame = this.plot_model.frame;\n var dims = this.model.dimensions;\n var base_point = this._base_point;\n if (this.model.origin == \"center\") {\n var cx = base_point[0], cy = base_point[1];\n var dx = curpoint[0], dy = curpoint[1];\n base_point = [cx - (dx - cx), cy - (dy - cy)];\n }\n return this.model._get_dim_limits(base_point, curpoint, frame, dims);\n };\n BoxSelectToolView.prototype._pan_start = function (ev) {\n var sx = ev.sx, sy = ev.sy;\n this._base_point = [sx, sy];\n };\n BoxSelectToolView.prototype._pan = function (ev) {\n var sx = ev.sx, sy = ev.sy;\n var curpoint = [sx, sy];\n var _a = this._compute_limits(curpoint), sxlim = _a[0], sylim = _a[1];\n this.model.overlay.update({ left: sxlim[0], right: sxlim[1], top: sylim[0], bottom: sylim[1] });\n if (this.model.select_every_mousemove) {\n var append = ev.shiftKey;\n this._do_select(sxlim, sylim, false, append);\n }\n };\n BoxSelectToolView.prototype._pan_end = function (ev) {\n var sx = ev.sx, sy = ev.sy;\n var curpoint = [sx, sy];\n var _a = this._compute_limits(curpoint), sxlim = _a[0], sylim = _a[1];\n var append = ev.shiftKey;\n this._do_select(sxlim, sylim, true, append);\n this.model.overlay.update({ left: null, right: null, top: null, bottom: null });\n this._base_point = null;\n this.plot_view.push_state('box_select', { selection: this.plot_view.get_selection() });\n };\n BoxSelectToolView.prototype._do_select = function (_a, _b, final, append) {\n var sx0 = _a[0], sx1 = _a[1];\n var sy0 = _b[0], sy1 = _b[1];\n if (append === void 0) {\n append = false;\n }\n var geometry = {\n type: 'rect',\n sx0: sx0,\n sx1: sx1,\n sy0: sy0,\n sy1: sy1,\n };\n this._select(geometry, final, append);\n };\n BoxSelectToolView.prototype._emit_callback = function (geometry) {\n var r = this.computed_renderers[0];\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[r.x_range_name];\n var yscale = frame.yscales[r.y_range_name];\n var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1;\n var _a = xscale.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var _b = yscale.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n var g = tslib_1.__assign({ x0: x0, y0: y0, x1: x1, y1: y1 }, geometry);\n this.model.callback.execute(this.model, { geometry: g });\n };\n return BoxSelectToolView;\n }(select_tool_1.SelectToolView));\n exports.BoxSelectToolView = BoxSelectToolView;\n var DEFAULT_BOX_OVERLAY = function () {\n return new box_annotation_1.BoxAnnotation({\n level: \"overlay\",\n render_mode: \"css\",\n top_units: \"screen\",\n left_units: \"screen\",\n bottom_units: \"screen\",\n right_units: \"screen\",\n fill_color: { value: \"lightgrey\" },\n fill_alpha: { value: 0.5 },\n line_color: { value: \"black\" },\n line_alpha: { value: 1.0 },\n line_width: { value: 2 },\n line_dash: { value: [4, 4] },\n });\n };\n var BoxSelectTool = /** @class */ (function (_super) {\n tslib_1.__extends(BoxSelectTool, _super);\n function BoxSelectTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Box Select\";\n _this.icon = \"bk-tool-icon-box-select\";\n _this.event_type = \"pan\";\n _this.default_order = 30;\n return _this;\n }\n BoxSelectTool.initClass = function () {\n this.prototype.type = \"BoxSelectTool\";\n this.prototype.default_view = BoxSelectToolView;\n this.define({\n dimensions: [p.Dimensions, \"both\"],\n select_every_mousemove: [p.Bool, false],\n callback: [p.Instance],\n overlay: [p.Instance, DEFAULT_BOX_OVERLAY],\n origin: [p.String, \"corner\"],\n });\n };\n Object.defineProperty(BoxSelectTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(this.tool_name, this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n return BoxSelectTool;\n }(select_tool_1.SelectTool));\n exports.BoxSelectTool = BoxSelectTool;\n BoxSelectTool.initClass();\n}\n","/* models/tools/gestures/box_zoom_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var gesture_tool_1 = require(251) /* ./gesture_tool */;\n var box_annotation_1 = require(64) /* ../../annotations/box_annotation */;\n var p = require(15) /* core/properties */;\n var BoxZoomToolView = /** @class */ (function (_super) {\n tslib_1.__extends(BoxZoomToolView, _super);\n function BoxZoomToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n BoxZoomToolView.prototype._match_aspect = function (base_point, curpoint, frame) {\n // aspect ratio of plot frame\n var a = frame.bbox.aspect;\n var hend = frame.bbox.h_range.end;\n var hstart = frame.bbox.h_range.start;\n var vend = frame.bbox.v_range.end;\n var vstart = frame.bbox.v_range.start;\n // current aspect of cursor-defined box\n var vw = Math.abs(base_point[0] - curpoint[0]);\n var vh = Math.abs(base_point[1] - curpoint[1]);\n var va = vh == 0 ? 0 : vw / vh;\n var xmod = (va >= a ? [1, va / a] : [a / va, 1])[0];\n // OK the code blocks below merit some explanation. They do:\n //\n // compute left/right, pin to frame if necessary\n // compute top/bottom (based on new left/right), pin to frame if necessary\n // recompute left/right (based on top/bottom), in case top/bottom were pinned\n // base_point[0] is left\n var left;\n var right;\n if (base_point[0] <= curpoint[0]) {\n left = base_point[0];\n right = base_point[0] + vw * xmod;\n if (right > hend)\n right = hend;\n // base_point[0] is right\n }\n else {\n right = base_point[0];\n left = base_point[0] - vw * xmod;\n if (left < hstart)\n left = hstart;\n }\n vw = Math.abs(right - left);\n // base_point[1] is bottom\n var top;\n var bottom;\n if (base_point[1] <= curpoint[1]) {\n bottom = base_point[1];\n top = base_point[1] + vw / a;\n if (top > vend)\n top = vend;\n // base_point[1] is top\n }\n else {\n top = base_point[1];\n bottom = base_point[1] - vw / a;\n if (bottom < vstart)\n bottom = vstart;\n }\n vh = Math.abs(top - bottom);\n // base_point[0] is left\n if (base_point[0] <= curpoint[0])\n right = base_point[0] + a * vh;\n // base_point[0] is right\n else\n left = base_point[0] - a * vh;\n return [[left, right], [bottom, top]];\n };\n BoxZoomToolView.prototype._compute_limits = function (curpoint) {\n var _a, _b;\n var frame = this.plot_model.frame;\n var dims = this.model.dimensions;\n var base_point = this._base_point;\n if (this.model.origin == \"center\") {\n var cx = base_point[0], cy = base_point[1];\n var dx = curpoint[0], dy = curpoint[1];\n base_point = [cx - (dx - cx), cy - (dy - cy)];\n }\n var sx;\n var sy;\n if (this.model.match_aspect && dims == 'both')\n _a = this._match_aspect(base_point, curpoint, frame), sx = _a[0], sy = _a[1];\n else\n _b = this.model._get_dim_limits(base_point, curpoint, frame, dims), sx = _b[0], sy = _b[1];\n return [sx, sy];\n };\n BoxZoomToolView.prototype._pan_start = function (ev) {\n this._base_point = [ev.sx, ev.sy];\n };\n BoxZoomToolView.prototype._pan = function (ev) {\n var curpoint = [ev.sx, ev.sy];\n var _a = this._compute_limits(curpoint), sx = _a[0], sy = _a[1];\n this.model.overlay.update({ left: sx[0], right: sx[1], top: sy[0], bottom: sy[1] });\n };\n BoxZoomToolView.prototype._pan_end = function (ev) {\n var curpoint = [ev.sx, ev.sy];\n var _a = this._compute_limits(curpoint), sx = _a[0], sy = _a[1];\n this._update(sx, sy);\n this.model.overlay.update({ left: null, right: null, top: null, bottom: null });\n this._base_point = null;\n };\n BoxZoomToolView.prototype._update = function (_a, _b) {\n var sx0 = _a[0], sx1 = _a[1];\n var sy0 = _b[0], sy1 = _b[1];\n // If the viewing window is too small, no-op: it is likely that the user did\n // not intend to make this box zoom and instead was trying to cancel out of the\n // zoom, a la matplotlib's ToolZoom. Like matplotlib, set the threshold at 5 pixels.\n if (Math.abs(sx1 - sx0) <= 5 || Math.abs(sy1 - sy0) <= 5)\n return;\n var _c = this.plot_model.frame, xscales = _c.xscales, yscales = _c.yscales;\n var xrs = {};\n for (var name_1 in xscales) {\n var scale = xscales[name_1];\n var _d = scale.r_invert(sx0, sx1), start = _d[0], end = _d[1];\n xrs[name_1] = { start: start, end: end };\n }\n var yrs = {};\n for (var name_2 in yscales) {\n var scale = yscales[name_2];\n var _e = scale.r_invert(sy0, sy1), start = _e[0], end = _e[1];\n yrs[name_2] = { start: start, end: end };\n }\n var zoom_info = {\n xrs: xrs,\n yrs: yrs,\n };\n this.plot_view.push_state('box_zoom', { range: zoom_info });\n this.plot_view.update_range(zoom_info);\n };\n return BoxZoomToolView;\n }(gesture_tool_1.GestureToolView));\n exports.BoxZoomToolView = BoxZoomToolView;\n var DEFAULT_BOX_OVERLAY = function () {\n return new box_annotation_1.BoxAnnotation({\n level: \"overlay\",\n render_mode: \"css\",\n top_units: \"screen\",\n left_units: \"screen\",\n bottom_units: \"screen\",\n right_units: \"screen\",\n fill_color: { value: \"lightgrey\" },\n fill_alpha: { value: 0.5 },\n line_color: { value: \"black\" },\n line_alpha: { value: 1.0 },\n line_width: { value: 2 },\n line_dash: { value: [4, 4] },\n });\n };\n var BoxZoomTool = /** @class */ (function (_super) {\n tslib_1.__extends(BoxZoomTool, _super);\n function BoxZoomTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Box Zoom\";\n _this.icon = \"bk-tool-icon-box-zoom\";\n _this.event_type = \"pan\";\n _this.default_order = 20;\n return _this;\n }\n BoxZoomTool.initClass = function () {\n this.prototype.type = \"BoxZoomTool\";\n this.prototype.default_view = BoxZoomToolView;\n this.define({\n dimensions: [p.Dimensions, \"both\"],\n overlay: [p.Instance, DEFAULT_BOX_OVERLAY],\n match_aspect: [p.Bool, false],\n origin: [p.String, \"corner\"],\n });\n };\n Object.defineProperty(BoxZoomTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(this.tool_name, this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n return BoxZoomTool;\n }(gesture_tool_1.GestureTool));\n exports.BoxZoomTool = BoxZoomTool;\n BoxZoomTool.initClass();\n}\n","/* models/tools/gestures/gesture_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var button_tool_1 = require(241) /* ../button_tool */;\n var on_off_button_1 = require(265) /* ../on_off_button */;\n var GestureToolView = /** @class */ (function (_super) {\n tslib_1.__extends(GestureToolView, _super);\n function GestureToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return GestureToolView;\n }(button_tool_1.ButtonToolView));\n exports.GestureToolView = GestureToolView;\n var GestureTool = /** @class */ (function (_super) {\n tslib_1.__extends(GestureTool, _super);\n function GestureTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.button_view = on_off_button_1.OnOffButtonView;\n return _this;\n }\n GestureTool.initClass = function () {\n this.prototype.type = \"GestureTool\";\n };\n return GestureTool;\n }(button_tool_1.ButtonTool));\n exports.GestureTool = GestureTool;\n GestureTool.initClass();\n}\n","/* models/tools/gestures/lasso_select_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var select_tool_1 = require(256) /* ./select_tool */;\n var poly_annotation_1 = require(71) /* ../../annotations/poly_annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var LassoSelectToolView = /** @class */ (function (_super) {\n tslib_1.__extends(LassoSelectToolView, _super);\n function LassoSelectToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n LassoSelectToolView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.data = null;\n };\n LassoSelectToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.active.change, function () { return _this._active_change(); });\n };\n LassoSelectToolView.prototype._active_change = function () {\n if (!this.model.active)\n this._clear_overlay();\n };\n LassoSelectToolView.prototype._keyup = function (ev) {\n if (ev.keyCode == dom_1.Keys.Enter)\n this._clear_overlay();\n };\n LassoSelectToolView.prototype._pan_start = function (ev) {\n var sx = ev.sx, sy = ev.sy;\n this.data = { sx: [sx], sy: [sy] };\n };\n LassoSelectToolView.prototype._pan = function (ev) {\n var _sx = ev.sx, _sy = ev.sy;\n var _a = this.plot_model.frame.bbox.clip(_sx, _sy), sx = _a[0], sy = _a[1];\n this.data.sx.push(sx);\n this.data.sy.push(sy);\n var overlay = this.model.overlay;\n overlay.update({ xs: this.data.sx, ys: this.data.sy });\n if (this.model.select_every_mousemove) {\n var append = ev.shiftKey;\n this._do_select(this.data.sx, this.data.sy, false, append);\n }\n };\n LassoSelectToolView.prototype._pan_end = function (ev) {\n this._clear_overlay();\n var append = ev.shiftKey;\n this._do_select(this.data.sx, this.data.sy, true, append);\n this.plot_view.push_state('lasso_select', { selection: this.plot_view.get_selection() });\n };\n LassoSelectToolView.prototype._clear_overlay = function () {\n this.model.overlay.update({ xs: [], ys: [] });\n };\n LassoSelectToolView.prototype._do_select = function (sx, sy, final, append) {\n var geometry = {\n type: 'poly',\n sx: sx,\n sy: sy,\n };\n this._select(geometry, final, append);\n };\n LassoSelectToolView.prototype._emit_callback = function (geometry) {\n var r = this.computed_renderers[0];\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[r.x_range_name];\n var yscale = frame.yscales[r.y_range_name];\n var x = xscale.v_invert(geometry.sx);\n var y = yscale.v_invert(geometry.sy);\n var g = tslib_1.__assign({ x: x, y: y }, geometry);\n this.model.callback.execute(this.model, { geometry: g });\n };\n return LassoSelectToolView;\n }(select_tool_1.SelectToolView));\n exports.LassoSelectToolView = LassoSelectToolView;\n var DEFAULT_POLY_OVERLAY = function () {\n return new poly_annotation_1.PolyAnnotation({\n level: \"overlay\",\n xs_units: \"screen\",\n ys_units: \"screen\",\n fill_color: { value: \"lightgrey\" },\n fill_alpha: { value: 0.5 },\n line_color: { value: \"black\" },\n line_alpha: { value: 1.0 },\n line_width: { value: 2 },\n line_dash: { value: [4, 4] },\n });\n };\n var LassoSelectTool = /** @class */ (function (_super) {\n tslib_1.__extends(LassoSelectTool, _super);\n function LassoSelectTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Lasso Select\";\n _this.icon = \"bk-tool-icon-lasso-select\";\n _this.event_type = \"pan\";\n _this.default_order = 12;\n return _this;\n }\n LassoSelectTool.initClass = function () {\n this.prototype.type = \"LassoSelectTool\";\n this.prototype.default_view = LassoSelectToolView;\n this.define({\n select_every_mousemove: [p.Bool, true],\n callback: [p.Instance],\n overlay: [p.Instance, DEFAULT_POLY_OVERLAY],\n });\n };\n return LassoSelectTool;\n }(select_tool_1.SelectTool));\n exports.LassoSelectTool = LassoSelectTool;\n LassoSelectTool.initClass();\n}\n","/* models/tools/gestures/pan_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var gesture_tool_1 = require(251) /* ./gesture_tool */;\n var p = require(15) /* core/properties */;\n var PanToolView = /** @class */ (function (_super) {\n tslib_1.__extends(PanToolView, _super);\n function PanToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PanToolView.prototype._pan_start = function (ev) {\n this.last_dx = 0;\n this.last_dy = 0;\n var sx = ev.sx, sy = ev.sy;\n var bbox = this.plot_model.frame.bbox;\n if (!bbox.contains(sx, sy)) {\n var hr = bbox.h_range;\n var vr = bbox.v_range;\n if (sx < hr.start || sx > hr.end)\n this.v_axis_only = true;\n if (sy < vr.start || sy > vr.end)\n this.h_axis_only = true;\n }\n if (this.model.document != null)\n this.model.document.interactive_start(this.plot_model.plot);\n };\n PanToolView.prototype._pan = function (ev) {\n this._update(ev.deltaX, ev.deltaY);\n if (this.model.document != null)\n this.model.document.interactive_start(this.plot_model.plot);\n };\n PanToolView.prototype._pan_end = function (_e) {\n this.h_axis_only = false;\n this.v_axis_only = false;\n if (this.pan_info != null)\n this.plot_view.push_state('pan', { range: this.pan_info });\n };\n PanToolView.prototype._update = function (dx, dy) {\n var frame = this.plot_model.frame;\n var new_dx = dx - this.last_dx;\n var new_dy = dy - this.last_dy;\n var hr = frame.bbox.h_range;\n var sx_low = hr.start - new_dx;\n var sx_high = hr.end - new_dx;\n var vr = frame.bbox.v_range;\n var sy_low = vr.start - new_dy;\n var sy_high = vr.end - new_dy;\n var dims = this.model.dimensions;\n var sx0;\n var sx1;\n var sdx;\n if ((dims == 'width' || dims == 'both') && !this.v_axis_only) {\n sx0 = sx_low;\n sx1 = sx_high;\n sdx = -new_dx;\n }\n else {\n sx0 = hr.start;\n sx1 = hr.end;\n sdx = 0;\n }\n var sy0;\n var sy1;\n var sdy;\n if ((dims == 'height' || dims == 'both') && !this.h_axis_only) {\n sy0 = sy_low;\n sy1 = sy_high;\n sdy = -new_dy;\n }\n else {\n sy0 = vr.start;\n sy1 = vr.end;\n sdy = 0;\n }\n this.last_dx = dx;\n this.last_dy = dy;\n var xscales = frame.xscales, yscales = frame.yscales;\n var xrs = {};\n for (var name_1 in xscales) {\n var scale = xscales[name_1];\n var _a = scale.r_invert(sx0, sx1), start = _a[0], end = _a[1];\n xrs[name_1] = { start: start, end: end };\n }\n var yrs = {};\n for (var name_2 in yscales) {\n var scale = yscales[name_2];\n var _b = scale.r_invert(sy0, sy1), start = _b[0], end = _b[1];\n yrs[name_2] = { start: start, end: end };\n }\n this.pan_info = {\n xrs: xrs,\n yrs: yrs,\n sdx: sdx,\n sdy: sdy,\n };\n this.plot_view.update_range(this.pan_info, true);\n };\n return PanToolView;\n }(gesture_tool_1.GestureToolView));\n exports.PanToolView = PanToolView;\n var PanTool = /** @class */ (function (_super) {\n tslib_1.__extends(PanTool, _super);\n function PanTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Pan\";\n _this.event_type = \"pan\";\n _this.default_order = 10;\n return _this;\n }\n PanTool.initClass = function () {\n this.prototype.type = \"PanTool\";\n this.prototype.default_view = PanToolView;\n this.define({\n dimensions: [p.Dimensions, \"both\"],\n });\n };\n Object.defineProperty(PanTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(\"Pan\", this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(PanTool.prototype, \"icon\", {\n get: function () {\n switch (this.dimensions) {\n case \"both\": return \"bk-tool-icon-pan\";\n case \"width\": return \"bk-tool-icon-xpan\";\n case \"height\": return \"bk-tool-icon-ypan\";\n }\n },\n enumerable: true,\n configurable: true\n });\n return PanTool;\n }(gesture_tool_1.GestureTool));\n exports.PanTool = PanTool;\n PanTool.initClass();\n}\n","/* models/tools/gestures/poly_select_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var select_tool_1 = require(256) /* ./select_tool */;\n var poly_annotation_1 = require(71) /* ../../annotations/poly_annotation */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var PolySelectToolView = /** @class */ (function (_super) {\n tslib_1.__extends(PolySelectToolView, _super);\n function PolySelectToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n PolySelectToolView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.data = { sx: [], sy: [] };\n };\n PolySelectToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.active.change, function () { return _this._active_change(); });\n };\n PolySelectToolView.prototype._active_change = function () {\n if (!this.model.active)\n this._clear_data();\n };\n PolySelectToolView.prototype._keyup = function (ev) {\n if (ev.keyCode == dom_1.Keys.Enter)\n this._clear_data();\n };\n PolySelectToolView.prototype._doubletap = function (ev) {\n var append = ev.shiftKey;\n this._do_select(this.data.sx, this.data.sy, true, append);\n this.plot_view.push_state('poly_select', { selection: this.plot_view.get_selection() });\n this._clear_data();\n };\n PolySelectToolView.prototype._clear_data = function () {\n this.data = { sx: [], sy: [] };\n this.model.overlay.update({ xs: [], ys: [] });\n };\n PolySelectToolView.prototype._tap = function (ev) {\n var sx = ev.sx, sy = ev.sy;\n var frame = this.plot_model.frame;\n if (!frame.bbox.contains(sx, sy))\n return;\n this.data.sx.push(sx);\n this.data.sy.push(sy);\n this.model.overlay.update({ xs: array_1.copy(this.data.sx), ys: array_1.copy(this.data.sy) });\n };\n PolySelectToolView.prototype._do_select = function (sx, sy, final, append) {\n var geometry = {\n type: 'poly',\n sx: sx,\n sy: sy,\n };\n this._select(geometry, final, append);\n };\n PolySelectToolView.prototype._emit_callback = function (geometry) {\n var r = this.computed_renderers[0];\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[r.x_range_name];\n var yscale = frame.yscales[r.y_range_name];\n var x = xscale.v_invert(geometry.sx);\n var y = yscale.v_invert(geometry.sy);\n var g = tslib_1.__assign({ x: x, y: y }, geometry);\n this.model.callback.execute(this.model, { geometry: g });\n };\n return PolySelectToolView;\n }(select_tool_1.SelectToolView));\n exports.PolySelectToolView = PolySelectToolView;\n var DEFAULT_POLY_OVERLAY = function () {\n return new poly_annotation_1.PolyAnnotation({\n level: \"overlay\",\n xs_units: \"screen\",\n ys_units: \"screen\",\n fill_color: { value: \"lightgrey\" },\n fill_alpha: { value: 0.5 },\n line_color: { value: \"black\" },\n line_alpha: { value: 1.0 },\n line_width: { value: 2 },\n line_dash: { value: [4, 4] },\n });\n };\n var PolySelectTool = /** @class */ (function (_super) {\n tslib_1.__extends(PolySelectTool, _super);\n function PolySelectTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Poly Select\";\n _this.icon = \"bk-tool-icon-polygon-select\";\n _this.event_type = \"tap\";\n _this.default_order = 11;\n return _this;\n }\n PolySelectTool.initClass = function () {\n this.prototype.type = \"PolySelectTool\";\n this.prototype.default_view = PolySelectToolView;\n this.define({\n callback: [p.Instance],\n overlay: [p.Instance, DEFAULT_POLY_OVERLAY],\n });\n };\n return PolySelectTool;\n }(select_tool_1.SelectTool));\n exports.PolySelectTool = PolySelectTool;\n PolySelectTool.initClass();\n}\n","/* models/tools/gestures/range_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var box_annotation_1 = require(64) /* ../../annotations/box_annotation */;\n var logging_1 = require(14) /* core/logging */;\n var p = require(15) /* core/properties */;\n var gesture_tool_1 = require(251) /* ./gesture_tool */;\n // TODO (bev) This would be better directly with BoxAnnotation, but hard\n // to test on a view. Move when \"View Models\" are implemented\n function is_near(pos, value, scale, tolerance) {\n if (value == null)\n return false;\n var svalue = scale.compute(value);\n return Math.abs(pos - svalue) < tolerance;\n }\n exports.is_near = is_near;\n // TODO (bev) This would be better directly with BoxAnnotation, but hard\n // to test on a view. Move when \"View Models\" are implemented\n function is_inside(sx, sy, xscale, yscale, overlay) {\n var result = true;\n if (overlay.left != null && overlay.right != null) {\n var x = xscale.invert(sx);\n if (x < overlay.left || x > overlay.right)\n result = false;\n }\n if (overlay.bottom != null && overlay.top != null) {\n var y = yscale.invert(sy);\n if (y < overlay.bottom || y > overlay.top)\n result = false;\n }\n return result;\n }\n exports.is_inside = is_inside;\n function compute_value(value, scale, sdelta, range) {\n var svalue = scale.compute(value);\n var new_value = scale.invert(svalue + sdelta);\n if (new_value >= range.start && new_value <= range.end)\n return new_value;\n return value;\n }\n exports.compute_value = compute_value;\n function update_range(range, scale, delta, plot_range) {\n var _a = scale.r_compute(range.start, range.end), sstart = _a[0], send = _a[1];\n var _b = scale.r_invert(sstart + delta, send + delta), start = _b[0], end = _b[1];\n if (start >= plot_range.start && start <= plot_range.end &&\n end >= plot_range.start && end <= plot_range.end) {\n range.start = start;\n range.end = end;\n }\n }\n exports.update_range = update_range;\n var RangeToolView = /** @class */ (function (_super) {\n tslib_1.__extends(RangeToolView, _super);\n function RangeToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n RangeToolView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.side = 0 /* None */;\n this.model.update_overlay_from_ranges();\n };\n RangeToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n if (this.model.x_range != null)\n this.connect(this.model.x_range.change, function () { return _this.model.update_overlay_from_ranges(); });\n if (this.model.y_range != null)\n this.connect(this.model.y_range.change, function () { return _this.model.update_overlay_from_ranges(); });\n };\n RangeToolView.prototype._pan_start = function (ev) {\n this.last_dx = 0;\n this.last_dy = 0;\n var xr = this.model.x_range;\n var yr = this.model.y_range;\n var frame = this.plot_model.frame;\n var xscale = frame.xscales.default;\n var yscale = frame.yscales.default;\n var overlay = this.model.overlay;\n var left = overlay.left, right = overlay.right, top = overlay.top, bottom = overlay.bottom;\n var tolerance = this.model.overlay.properties.line_width.value() + box_annotation_1.EDGE_TOLERANCE;\n if (xr != null && this.model.x_interaction) {\n if (is_near(ev.sx, left, xscale, tolerance))\n this.side = 1 /* Left */;\n else if (is_near(ev.sx, right, xscale, tolerance))\n this.side = 2 /* Right */;\n else if (is_inside(ev.sx, ev.sy, xscale, yscale, overlay)) {\n this.side = 3 /* LeftRight */;\n }\n }\n if (yr != null && this.model.y_interaction) {\n if (this.side == 0 /* None */ && is_near(ev.sy, bottom, yscale, tolerance))\n this.side = 4 /* Bottom */;\n if (this.side == 0 /* None */ && is_near(ev.sy, top, yscale, tolerance))\n this.side = 5 /* Top */;\n else if (is_inside(ev.sx, ev.sy, xscale, yscale, this.model.overlay)) {\n if (this.side == 3 /* LeftRight */)\n this.side = 7 /* LeftRightBottomTop */;\n else\n this.side = 6 /* BottomTop */;\n }\n }\n };\n RangeToolView.prototype._pan = function (ev) {\n var frame = this.plot_model.frame;\n var new_dx = ev.deltaX - this.last_dx;\n var new_dy = ev.deltaY - this.last_dy;\n var xr = this.model.x_range;\n var yr = this.model.y_range;\n var xscale = frame.xscales.default;\n var yscale = frame.yscales.default;\n if (xr != null) {\n if (this.side == 3 /* LeftRight */ || this.side == 7 /* LeftRightBottomTop */)\n update_range(xr, xscale, new_dx, frame.x_range);\n else if (this.side == 1 /* Left */)\n xr.start = compute_value(xr.start, xscale, new_dx, frame.x_range);\n else if (this.side == 2 /* Right */)\n xr.end = compute_value(xr.end, xscale, new_dx, frame.x_range);\n }\n if (yr != null) {\n if (this.side == 6 /* BottomTop */ || this.side == 7 /* LeftRightBottomTop */)\n update_range(yr, yscale, new_dy, frame.y_range);\n else if (this.side == 4 /* Bottom */)\n yr.start = compute_value(yr.start, yscale, new_dy, frame.y_range);\n else if (this.side == 5 /* Top */)\n yr.end = compute_value(yr.end, yscale, new_dy, frame.y_range);\n }\n this.last_dx = ev.deltaX;\n this.last_dy = ev.deltaY;\n };\n RangeToolView.prototype._pan_end = function (_ev) {\n this.side = 0 /* None */;\n };\n return RangeToolView;\n }(gesture_tool_1.GestureToolView));\n exports.RangeToolView = RangeToolView;\n var DEFAULT_RANGE_OVERLAY = function () {\n return new box_annotation_1.BoxAnnotation({\n level: \"overlay\",\n render_mode: \"css\",\n fill_color: \"lightgrey\",\n fill_alpha: { value: 0.5 },\n line_color: { value: \"black\" },\n line_alpha: { value: 1.0 },\n line_width: { value: 0.5 },\n line_dash: [2, 2],\n });\n };\n var RangeTool = /** @class */ (function (_super) {\n tslib_1.__extends(RangeTool, _super);\n function RangeTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Range Tool\";\n _this.icon = \"bk-tool-icon-range\";\n _this.event_type = \"pan\";\n _this.default_order = 1;\n return _this;\n }\n RangeTool.initClass = function () {\n this.prototype.type = \"RangeTool\";\n this.prototype.default_view = RangeToolView;\n this.define({\n x_range: [p.Instance, null],\n x_interaction: [p.Bool, true],\n y_range: [p.Instance, null],\n y_interaction: [p.Bool, true],\n overlay: [p.Instance, DEFAULT_RANGE_OVERLAY],\n });\n };\n RangeTool.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.overlay.in_cursor = \"grab\";\n this.overlay.ew_cursor = this.x_range != null && this.x_interaction ? \"ew-resize\" : null;\n this.overlay.ns_cursor = this.y_range != null && this.y_interaction ? \"ns-resize\" : null;\n };\n RangeTool.prototype.update_overlay_from_ranges = function () {\n if (this.x_range == null && this.y_range == null) {\n this.overlay.left = null;\n this.overlay.right = null;\n this.overlay.bottom = null;\n this.overlay.top = null;\n logging_1.logger.warn('RangeTool not configured with any Ranges.');\n }\n if (this.x_range == null) {\n this.overlay.left = null;\n this.overlay.right = null;\n }\n else {\n this.overlay.left = this.x_range.start;\n this.overlay.right = this.x_range.end;\n }\n if (this.y_range == null) {\n this.overlay.bottom = null;\n this.overlay.top = null;\n }\n else {\n this.overlay.bottom = this.y_range.start;\n this.overlay.top = this.y_range.end;\n }\n };\n return RangeTool;\n }(gesture_tool_1.GestureTool));\n exports.RangeTool = RangeTool;\n RangeTool.initClass();\n}\n","/* models/tools/gestures/select_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var gesture_tool_1 = require(251) /* ./gesture_tool */;\n var graph_renderer_1 = require(186) /* ../../renderers/graph_renderer */;\n var util_1 = require(271) /* ../util */;\n var p = require(15) /* core/properties */;\n var dom_1 = require(5) /* core/dom */;\n var bokeh_events_1 = require(3) /* core/bokeh_events */;\n var SelectToolView = /** @class */ (function (_super) {\n tslib_1.__extends(SelectToolView, _super);\n function SelectToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n Object.defineProperty(SelectToolView.prototype, \"computed_renderers\", {\n get: function () {\n var renderers = this.model.renderers;\n var all_renderers = this.plot_model.plot.renderers;\n var names = this.model.names;\n return util_1.compute_renderers(renderers, all_renderers, names);\n },\n enumerable: true,\n configurable: true\n });\n SelectToolView.prototype._computed_renderers_by_data_source = function () {\n var renderers_by_source = {};\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n var source_id = void 0;\n // XXX: needs typings for renderers\n if (r instanceof graph_renderer_1.GraphRenderer)\n source_id = r.node_renderer.data_source.id;\n else\n source_id = r.data_source.id;\n if (!(source_id in renderers_by_source))\n renderers_by_source[source_id] = [];\n renderers_by_source[source_id].push(r);\n }\n return renderers_by_source;\n };\n SelectToolView.prototype._keyup = function (ev) {\n if (ev.keyCode == dom_1.Keys.Esc) {\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n // XXX: needs typings for renderers\n var ds = r.data_source;\n var sm = ds.selection_manager;\n sm.clear();\n }\n this.plot_view.request_render();\n }\n };\n SelectToolView.prototype._select = function (geometry, final, append) {\n var renderers_by_source = this._computed_renderers_by_data_source();\n for (var id in renderers_by_source) {\n var renderers = renderers_by_source[id];\n var sm = renderers[0].get_selection_manager();\n var r_views = [];\n for (var _i = 0, renderers_1 = renderers; _i < renderers_1.length; _i++) {\n var r = renderers_1[_i];\n if (r.id in this.plot_view.renderer_views)\n r_views.push(this.plot_view.renderer_views[r.id]);\n }\n sm.select(r_views, geometry, final, append);\n }\n // XXX: messed up class structure\n if (this.model.callback != null)\n this._emit_callback(geometry);\n this._emit_selection_event(geometry, final);\n };\n SelectToolView.prototype._emit_selection_event = function (geometry, final) {\n if (final === void 0) {\n final = true;\n }\n var xm = this.plot_model.frame.xscales['default'];\n var ym = this.plot_model.frame.yscales['default'];\n var g; // XXX: Geometry & something\n switch (geometry.type) {\n case 'point': {\n var sx = geometry.sx, sy = geometry.sy;\n var x = xm.invert(sx);\n var y = ym.invert(sy);\n g = tslib_1.__assign({}, geometry, { x: x, y: y });\n break;\n }\n case 'rect': {\n var sx0 = geometry.sx0, sx1 = geometry.sx1, sy0 = geometry.sy0, sy1 = geometry.sy1;\n var _a = xm.r_invert(sx0, sx1), x0 = _a[0], x1 = _a[1];\n var _b = ym.r_invert(sy0, sy1), y0 = _b[0], y1 = _b[1];\n g = tslib_1.__assign({}, geometry, { x0: x0, y0: y0, x1: x1, y1: y1 });\n break;\n }\n case 'poly': {\n var sx = geometry.sx, sy = geometry.sy;\n var x = xm.v_invert(sx);\n var y = ym.v_invert(sy);\n g = tslib_1.__assign({}, geometry, { x: x, y: y });\n break;\n }\n default:\n throw new Error(\"Unrecognized selection geometry type: '\" + geometry.type + \"'\");\n }\n this.plot_model.plot.trigger_event(new bokeh_events_1.SelectionGeometry({ geometry: g, final: final }));\n };\n return SelectToolView;\n }(gesture_tool_1.GestureToolView));\n exports.SelectToolView = SelectToolView;\n var SelectTool = /** @class */ (function (_super) {\n tslib_1.__extends(SelectTool, _super);\n function SelectTool(attrs) {\n return _super.call(this, attrs) || this;\n }\n SelectTool.initClass = function () {\n this.prototype.type = \"SelectTool\";\n this.define({\n renderers: [p.Any, 'auto'],\n names: [p.Array, []],\n });\n };\n return SelectTool;\n }(gesture_tool_1.GestureTool));\n exports.SelectTool = SelectTool;\n SelectTool.initClass();\n}\n","/* models/tools/gestures/tap_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var select_tool_1 = require(256) /* ./select_tool */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var TapToolView = /** @class */ (function (_super) {\n tslib_1.__extends(TapToolView, _super);\n function TapToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n TapToolView.prototype._tap = function (ev) {\n var sx = ev.sx, sy = ev.sy;\n var geometry = {\n type: 'point',\n sx: sx,\n sy: sy,\n };\n var append = ev.shiftKey;\n this._select(geometry, true, append);\n };\n TapToolView.prototype._select = function (geometry, final, append) {\n var _this = this;\n var callback = this.model.callback;\n if (this.model.behavior == \"select\") {\n var renderers_by_source = this._computed_renderers_by_data_source();\n for (var id in renderers_by_source) {\n var renderers = renderers_by_source[id];\n var sm = renderers[0].get_selection_manager();\n var r_views = renderers.map(function (r) { return _this.plot_view.renderer_views[r.id]; });\n var did_hit = sm.select(r_views, geometry, final, append);\n if (did_hit && callback != null) {\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[renderers[0].x_range_name];\n var yscale = frame.yscales[renderers[0].y_range_name];\n var x = xscale.invert(geometry.sx);\n var y = yscale.invert(geometry.sy);\n var g = tslib_1.__assign({}, geometry, { x: x, y: y });\n var cb_data = { geometries: g, source: sm.source };\n if (types_1.isFunction(callback))\n callback(this, cb_data);\n else\n callback.execute(this, cb_data);\n }\n }\n this._emit_selection_event(geometry);\n this.plot_view.push_state('tap', { selection: this.plot_view.get_selection() });\n }\n else {\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n var sm = r.get_selection_manager();\n var did_hit = sm.inspect(this.plot_view.renderer_views[r.id], geometry);\n if (did_hit && callback != null) {\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[r.x_range_name];\n var yscale = frame.yscales[r.y_range_name];\n var x = xscale.invert(geometry.sx);\n var y = yscale.invert(geometry.sy);\n var g = tslib_1.__assign({}, geometry, { x: x, y: y });\n var cb_data = { geometries: g, source: sm.source };\n if (types_1.isFunction(callback))\n callback(this, cb_data);\n else\n callback.execute(this, cb_data);\n }\n }\n }\n };\n return TapToolView;\n }(select_tool_1.SelectToolView));\n exports.TapToolView = TapToolView;\n var TapTool = /** @class */ (function (_super) {\n tslib_1.__extends(TapTool, _super);\n function TapTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Tap\";\n _this.icon = \"bk-tool-icon-tap-select\";\n _this.event_type = \"tap\";\n _this.default_order = 10;\n return _this;\n }\n TapTool.initClass = function () {\n this.prototype.type = \"TapTool\";\n this.prototype.default_view = TapToolView;\n this.define({\n behavior: [p.String, \"select\"],\n callback: [p.Any],\n });\n };\n return TapTool;\n }(select_tool_1.SelectTool));\n exports.TapTool = TapTool;\n TapTool.initClass();\n}\n","/* models/tools/gestures/wheel_pan_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var gesture_tool_1 = require(251) /* ./gesture_tool */;\n var p = require(15) /* core/properties */;\n var WheelPanToolView = /** @class */ (function (_super) {\n tslib_1.__extends(WheelPanToolView, _super);\n function WheelPanToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WheelPanToolView.prototype._scroll = function (ev) {\n var factor = this.model.speed * ev.delta;\n // clamp the magnitude of factor, if it is > 1 bad things happen\n if (factor > 0.9)\n factor = 0.9;\n else if (factor < -0.9)\n factor = -0.9;\n this._update_ranges(factor);\n };\n WheelPanToolView.prototype._update_ranges = function (factor) {\n var frame = this.plot_model.frame;\n var hr = frame.bbox.h_range;\n var vr = frame.bbox.v_range;\n var _a = [hr.start, hr.end], sx_low = _a[0], sx_high = _a[1];\n var _b = [vr.start, vr.end], sy_low = _b[0], sy_high = _b[1];\n var sx0;\n var sx1;\n var sy0;\n var sy1;\n switch (this.model.dimension) {\n case \"height\": {\n var sy_range = Math.abs(sy_high - sy_low);\n sx0 = sx_low;\n sx1 = sx_high;\n sy0 = sy_low - sy_range * factor;\n sy1 = sy_high - sy_range * factor;\n break;\n }\n case \"width\": {\n var sx_range = Math.abs(sx_high - sx_low);\n sx0 = sx_low - sx_range * factor;\n sx1 = sx_high - sx_range * factor;\n sy0 = sy_low;\n sy1 = sy_high;\n break;\n }\n default:\n throw new Error(\"this shouldn't have happened\");\n }\n var xscales = frame.xscales, yscales = frame.yscales;\n var xrs = {};\n for (var name_1 in xscales) {\n var scale = xscales[name_1];\n var _c = scale.r_invert(sx0, sx1), start = _c[0], end = _c[1];\n xrs[name_1] = { start: start, end: end };\n }\n var yrs = {};\n for (var name_2 in yscales) {\n var scale = yscales[name_2];\n var _d = scale.r_invert(sy0, sy1), start = _d[0], end = _d[1];\n yrs[name_2] = { start: start, end: end };\n }\n // OK this sucks we can't set factor independently in each direction. It is used\n // for GMap plots, and GMap plots always preserve aspect, so effective the value\n // of 'dimensions' is ignored.\n var pan_info = {\n xrs: xrs,\n yrs: yrs,\n factor: factor,\n };\n this.plot_view.push_state('wheel_pan', { range: pan_info });\n this.plot_view.update_range(pan_info, false, true);\n if (this.model.document != null)\n this.model.document.interactive_start(this.plot_model.plot);\n };\n return WheelPanToolView;\n }(gesture_tool_1.GestureToolView));\n exports.WheelPanToolView = WheelPanToolView;\n var WheelPanTool = /** @class */ (function (_super) {\n tslib_1.__extends(WheelPanTool, _super);\n function WheelPanTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Wheel Pan\";\n _this.icon = \"bk-tool-icon-wheel-pan\";\n _this.event_type = \"scroll\";\n _this.default_order = 12;\n return _this;\n }\n WheelPanTool.initClass = function () {\n this.prototype.type = 'WheelPanTool';\n this.prototype.default_view = WheelPanToolView;\n this.define({\n dimension: [p.Dimension, \"width\"],\n });\n this.internal({\n speed: [p.Number, 1 / 1000],\n });\n };\n Object.defineProperty(WheelPanTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(this.tool_name, this.dimension);\n },\n enumerable: true,\n configurable: true\n });\n return WheelPanTool;\n }(gesture_tool_1.GestureTool));\n exports.WheelPanTool = WheelPanTool;\n WheelPanTool.initClass();\n}\n","/* models/tools/gestures/wheel_zoom_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var gesture_tool_1 = require(251) /* ./gesture_tool */;\n var zoom_1 = require(46) /* core/util/zoom */;\n var p = require(15) /* core/properties */;\n var ui_events_1 = require(20) /* core/ui_events */;\n var WheelZoomToolView = /** @class */ (function (_super) {\n tslib_1.__extends(WheelZoomToolView, _super);\n function WheelZoomToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n WheelZoomToolView.prototype._pinch = function (ev) {\n // TODO (bev) this can probably be done much better\n var sx = ev.sx, sy = ev.sy, scale = ev.scale;\n var delta;\n if (scale >= 1)\n delta = (scale - 1) * 20.0;\n else\n delta = -20.0 / scale;\n this._scroll({ type: \"mousewheel\", sx: sx, sy: sy, delta: delta });\n };\n WheelZoomToolView.prototype._scroll = function (ev) {\n var frame = this.plot_model.frame;\n var hr = frame.bbox.h_range;\n var vr = frame.bbox.v_range;\n var sx = ev.sx, sy = ev.sy;\n var dims = this.model.dimensions;\n // restrict to axis configured in tool's dimensions property and if\n // zoom origin is inside of frame range/domain\n var h_axis = (dims == 'width' || dims == 'both') && hr.start < sx && sx < hr.end;\n var v_axis = (dims == 'height' || dims == 'both') && vr.start < sy && sy < vr.end;\n if ((!h_axis || !v_axis) && !this.model.zoom_on_axis) {\n return;\n }\n var factor = this.model.speed * ev.delta;\n var zoom_info = zoom_1.scale_range(frame, factor, h_axis, v_axis, { x: sx, y: sy });\n this.plot_view.push_state('wheel_zoom', { range: zoom_info });\n this.plot_view.update_range(zoom_info, false, true, this.model.maintain_focus);\n if (this.model.document != null)\n this.model.document.interactive_start(this.plot_model.plot);\n };\n return WheelZoomToolView;\n }(gesture_tool_1.GestureToolView));\n exports.WheelZoomToolView = WheelZoomToolView;\n var WheelZoomTool = /** @class */ (function (_super) {\n tslib_1.__extends(WheelZoomTool, _super);\n function WheelZoomTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Wheel Zoom\";\n _this.icon = \"bk-tool-icon-wheel-zoom\";\n _this.event_type = ui_events_1.is_mobile ? \"pinch\" : \"scroll\";\n _this.default_order = 10;\n return _this;\n }\n WheelZoomTool.initClass = function () {\n this.prototype.type = \"WheelZoomTool\";\n this.prototype.default_view = WheelZoomToolView;\n this.define({\n dimensions: [p.Dimensions, \"both\"],\n maintain_focus: [p.Boolean, true],\n zoom_on_axis: [p.Boolean, true],\n speed: [p.Number, 1 / 600],\n });\n };\n Object.defineProperty(WheelZoomTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(this.tool_name, this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n return WheelZoomTool;\n }(gesture_tool_1.GestureTool));\n exports.WheelZoomTool = WheelZoomTool;\n WheelZoomTool.initClass();\n}\n","/* models/tools/index */ function _(require, module, exports) {\n var action_tool_1 = require(232) /* ./actions/action_tool */;\n exports.ActionTool = action_tool_1.ActionTool;\n var custom_action_1 = require(233) /* ./actions/custom_action */;\n exports.CustomAction = custom_action_1.CustomAction;\n var help_tool_1 = require(234) /* ./actions/help_tool */;\n exports.HelpTool = help_tool_1.HelpTool;\n var redo_tool_1 = require(235) /* ./actions/redo_tool */;\n exports.RedoTool = redo_tool_1.RedoTool;\n var reset_tool_1 = require(236) /* ./actions/reset_tool */;\n exports.ResetTool = reset_tool_1.ResetTool;\n var save_tool_1 = require(237) /* ./actions/save_tool */;\n exports.SaveTool = save_tool_1.SaveTool;\n var undo_tool_1 = require(238) /* ./actions/undo_tool */;\n exports.UndoTool = undo_tool_1.UndoTool;\n var zoom_in_tool_1 = require(239) /* ./actions/zoom_in_tool */;\n exports.ZoomInTool = zoom_in_tool_1.ZoomInTool;\n var zoom_out_tool_1 = require(240) /* ./actions/zoom_out_tool */;\n exports.ZoomOutTool = zoom_out_tool_1.ZoomOutTool;\n var button_tool_1 = require(241) /* ./button_tool */;\n exports.ButtonTool = button_tool_1.ButtonTool;\n var edit_tool_1 = require(243) /* ./edit/edit_tool */;\n exports.EditTool = edit_tool_1.EditTool;\n var box_edit_tool_1 = require(242) /* ./edit/box_edit_tool */;\n exports.BoxEditTool = box_edit_tool_1.BoxEditTool;\n var freehand_draw_tool_1 = require(244) /* ./edit/freehand_draw_tool */;\n exports.FreehandDrawTool = freehand_draw_tool_1.FreehandDrawTool;\n var point_draw_tool_1 = require(245) /* ./edit/point_draw_tool */;\n exports.PointDrawTool = point_draw_tool_1.PointDrawTool;\n var poly_draw_tool_1 = require(246) /* ./edit/poly_draw_tool */;\n exports.PolyDrawTool = poly_draw_tool_1.PolyDrawTool;\n var poly_tool_1 = require(248) /* ./edit/poly_tool */;\n exports.PolyTool = poly_tool_1.PolyTool;\n var poly_edit_tool_1 = require(247) /* ./edit/poly_edit_tool */;\n exports.PolyEditTool = poly_edit_tool_1.PolyEditTool;\n var box_select_tool_1 = require(249) /* ./gestures/box_select_tool */;\n exports.BoxSelectTool = box_select_tool_1.BoxSelectTool;\n var box_zoom_tool_1 = require(250) /* ./gestures/box_zoom_tool */;\n exports.BoxZoomTool = box_zoom_tool_1.BoxZoomTool;\n var gesture_tool_1 = require(251) /* ./gestures/gesture_tool */;\n exports.GestureTool = gesture_tool_1.GestureTool;\n var lasso_select_tool_1 = require(252) /* ./gestures/lasso_select_tool */;\n exports.LassoSelectTool = lasso_select_tool_1.LassoSelectTool;\n var pan_tool_1 = require(253) /* ./gestures/pan_tool */;\n exports.PanTool = pan_tool_1.PanTool;\n var poly_select_tool_1 = require(254) /* ./gestures/poly_select_tool */;\n exports.PolySelectTool = poly_select_tool_1.PolySelectTool;\n var range_tool_1 = require(255) /* ./gestures/range_tool */;\n exports.RangeTool = range_tool_1.RangeTool;\n var select_tool_1 = require(256) /* ./gestures/select_tool */;\n exports.SelectTool = select_tool_1.SelectTool;\n var tap_tool_1 = require(257) /* ./gestures/tap_tool */;\n exports.TapTool = tap_tool_1.TapTool;\n var wheel_pan_tool_1 = require(258) /* ./gestures/wheel_pan_tool */;\n exports.WheelPanTool = wheel_pan_tool_1.WheelPanTool;\n var wheel_zoom_tool_1 = require(259) /* ./gestures/wheel_zoom_tool */;\n exports.WheelZoomTool = wheel_zoom_tool_1.WheelZoomTool;\n var crosshair_tool_1 = require(261) /* ./inspectors/crosshair_tool */;\n exports.CrosshairTool = crosshair_tool_1.CrosshairTool;\n var customjs_hover_1 = require(262) /* ./inspectors/customjs_hover */;\n exports.CustomJSHover = customjs_hover_1.CustomJSHover;\n var hover_tool_1 = require(263) /* ./inspectors/hover_tool */;\n exports.HoverTool = hover_tool_1.HoverTool;\n var inspect_tool_1 = require(264) /* ./inspectors/inspect_tool */;\n exports.InspectTool = inspect_tool_1.InspectTool;\n var tool_1 = require(266) /* ./tool */;\n exports.Tool = tool_1.Tool;\n var tool_proxy_1 = require(267) /* ./tool_proxy */;\n exports.ToolProxy = tool_proxy_1.ToolProxy;\n var toolbar_1 = require(268) /* ./toolbar */;\n exports.Toolbar = toolbar_1.Toolbar;\n var toolbar_base_1 = require(269) /* ./toolbar_base */;\n exports.ToolbarBase = toolbar_base_1.ToolbarBase;\n var toolbar_box_1 = require(270) /* ./toolbar_box */;\n exports.ProxyToolbar = toolbar_box_1.ProxyToolbar;\n var toolbar_box_2 = require(270) /* ./toolbar_box */;\n exports.ToolbarBox = toolbar_box_2.ToolbarBox;\n}\n","/* models/tools/inspectors/crosshair_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var inspect_tool_1 = require(264) /* ./inspect_tool */;\n var span_1 = require(73) /* ../../annotations/span */;\n var p = require(15) /* core/properties */;\n var object_1 = require(32) /* core/util/object */;\n var CrosshairToolView = /** @class */ (function (_super) {\n tslib_1.__extends(CrosshairToolView, _super);\n function CrosshairToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n CrosshairToolView.prototype._move = function (ev) {\n if (!this.model.active)\n return;\n var sx = ev.sx, sy = ev.sy;\n if (!this.plot_model.frame.bbox.contains(sx, sy))\n this._update_spans(null, null);\n else\n this._update_spans(sx, sy);\n };\n CrosshairToolView.prototype._move_exit = function (_e) {\n this._update_spans(null, null);\n };\n CrosshairToolView.prototype._update_spans = function (x, y) {\n var dims = this.model.dimensions;\n if (dims == \"width\" || dims == \"both\")\n this.model.spans.width.computed_location = y;\n if (dims == \"height\" || dims == \"both\")\n this.model.spans.height.computed_location = x;\n };\n return CrosshairToolView;\n }(inspect_tool_1.InspectToolView));\n exports.CrosshairToolView = CrosshairToolView;\n var CrosshairTool = /** @class */ (function (_super) {\n tslib_1.__extends(CrosshairTool, _super);\n function CrosshairTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Crosshair\";\n _this.icon = \"bk-tool-icon-crosshair\";\n return _this;\n }\n CrosshairTool.initClass = function () {\n this.prototype.type = \"CrosshairTool\";\n this.prototype.default_view = CrosshairToolView;\n this.define({\n dimensions: [p.Dimensions, \"both\"],\n line_color: [p.Color, 'black'],\n line_width: [p.Number, 1],\n line_alpha: [p.Number, 1.0],\n });\n this.internal({\n location_units: [p.SpatialUnits, \"screen\"],\n render_mode: [p.RenderMode, \"css\"],\n spans: [p.Any],\n });\n };\n Object.defineProperty(CrosshairTool.prototype, \"tooltip\", {\n get: function () {\n return this._get_dim_tooltip(\"Crosshair\", this.dimensions);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CrosshairTool.prototype, \"synthetic_renderers\", {\n get: function () {\n return object_1.values(this.spans);\n },\n enumerable: true,\n configurable: true\n });\n CrosshairTool.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.spans = {\n width: new span_1.Span({\n for_hover: true,\n dimension: \"width\",\n render_mode: this.render_mode,\n location_units: this.location_units,\n line_color: this.line_color,\n line_width: this.line_width,\n line_alpha: this.line_alpha,\n }),\n height: new span_1.Span({\n for_hover: true,\n dimension: \"height\",\n render_mode: this.render_mode,\n location_units: this.location_units,\n line_color: this.line_color,\n line_width: this.line_width,\n line_alpha: this.line_alpha,\n }),\n };\n };\n return CrosshairTool;\n }(inspect_tool_1.InspectTool));\n exports.CrosshairTool = CrosshairTool;\n CrosshairTool.initClass();\n}\n","/* models/tools/inspectors/customjs_hover */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../../model */;\n var p = require(15) /* core/properties */;\n var object_1 = require(32) /* core/util/object */;\n var string_1 = require(38) /* core/util/string */;\n var CustomJSHover = /** @class */ (function (_super) {\n tslib_1.__extends(CustomJSHover, _super);\n function CustomJSHover(attrs) {\n return _super.call(this, attrs) || this;\n }\n CustomJSHover.initClass = function () {\n this.prototype.type = 'CustomJSHover';\n this.define({\n args: [p.Any, {}],\n code: [p.String, \"\"],\n });\n };\n Object.defineProperty(CustomJSHover.prototype, \"values\", {\n get: function () {\n return object_1.values(this.args);\n },\n enumerable: true,\n configurable: true\n });\n CustomJSHover.prototype._make_code = function (valname, formatname, varsname, fn) {\n // this relies on keys(args) and values(args) returning keys and values\n // in the same order\n return new (Function.bind.apply(Function, [void 0].concat(object_1.keys(this.args), [valname, formatname, varsname, \"require\", \"exports\", string_1.use_strict(fn)])))();\n };\n CustomJSHover.prototype.format = function (value, format, special_vars) {\n var formatter = this._make_code(\"value\", \"format\", \"special_vars\", this.code);\n return formatter.apply(void 0, this.values.concat([value, format, special_vars, require, exports]));\n };\n return CustomJSHover;\n }(model_1.Model));\n exports.CustomJSHover = CustomJSHover;\n CustomJSHover.initClass();\n}\n","/* models/tools/inspectors/hover_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var inspect_tool_1 = require(264) /* ./inspect_tool */;\n var tooltip_1 = require(77) /* ../../annotations/tooltip */;\n var glyph_renderer_1 = require(185) /* ../../renderers/glyph_renderer */;\n var graph_renderer_1 = require(186) /* ../../renderers/graph_renderer */;\n var util_1 = require(271) /* ../util */;\n var hittest = require(9) /* core/hittest */;\n var templating_1 = require(40) /* core/util/templating */;\n var dom_1 = require(5) /* core/dom */;\n var p = require(15) /* core/properties */;\n var color_1 = require(27) /* core/util/color */;\n var object_1 = require(32) /* core/util/object */;\n var types_1 = require(44) /* core/util/types */;\n var build_views_1 = require(4) /* core/build_views */;\n function _nearest_line_hit(i, geometry, sx, sy, dx, dy) {\n var d1 = { x: dx[i], y: dy[i] };\n var d2 = { x: dx[i + 1], y: dy[i + 1] };\n var dist1;\n var dist2;\n if (geometry.type == \"span\") {\n if (geometry.direction == \"h\") {\n dist1 = Math.abs(d1.x - sx);\n dist2 = Math.abs(d2.x - sx);\n }\n else {\n dist1 = Math.abs(d1.y - sy);\n dist2 = Math.abs(d2.y - sy);\n }\n }\n else {\n var s = { x: sx, y: sy };\n dist1 = hittest.dist_2_pts(d1, s);\n dist2 = hittest.dist_2_pts(d2, s);\n }\n if (dist1 < dist2)\n return [[d1.x, d1.y], i];\n else\n return [[d2.x, d2.y], i + 1];\n }\n exports._nearest_line_hit = _nearest_line_hit;\n function _line_hit(xs, ys, ind) {\n return [[xs[ind], ys[ind]], ind];\n }\n exports._line_hit = _line_hit;\n var HoverToolView = /** @class */ (function (_super) {\n tslib_1.__extends(HoverToolView, _super);\n function HoverToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n HoverToolView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.ttviews = {};\n };\n HoverToolView.prototype.remove = function () {\n build_views_1.remove_views(this.ttviews);\n _super.prototype.remove.call(this);\n };\n HoverToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n if (r instanceof glyph_renderer_1.GlyphRenderer)\n this.connect(r.data_source.inspect, this._update);\n else {\n this.connect(r.node_renderer.data_source.inspect, this._update);\n this.connect(r.edge_renderer.data_source.inspect, this._update);\n }\n }\n // TODO: this.connect(this.plot_model.plot.properties.renderers.change, () => this._computed_renderers = this._ttmodels = null)\n this.connect(this.model.properties.renderers.change, function () { return _this._computed_renderers = _this._ttmodels = null; });\n this.connect(this.model.properties.names.change, function () { return _this._computed_renderers = _this._ttmodels = null; });\n this.connect(this.model.properties.tooltips.change, function () { return _this._ttmodels = null; });\n };\n HoverToolView.prototype._compute_ttmodels = function () {\n var ttmodels = {};\n var tooltips = this.model.tooltips;\n if (tooltips != null) {\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n if (r instanceof glyph_renderer_1.GlyphRenderer) {\n var tooltip = new tooltip_1.Tooltip({\n custom: types_1.isString(tooltips) || types_1.isFunction(tooltips),\n attachment: this.model.attachment,\n show_arrow: this.model.show_arrow,\n });\n ttmodels[r.id] = tooltip;\n }\n else {\n var tooltip = new tooltip_1.Tooltip({\n custom: types_1.isString(tooltips) || types_1.isFunction(tooltips),\n attachment: this.model.attachment,\n show_arrow: this.model.show_arrow,\n });\n ttmodels[r.node_renderer.id] = tooltip;\n ttmodels[r.edge_renderer.id] = tooltip;\n }\n }\n }\n build_views_1.build_views(this.ttviews, object_1.values(ttmodels), { parent: this, plot_view: this.plot_view });\n return ttmodels;\n };\n Object.defineProperty(HoverToolView.prototype, \"computed_renderers\", {\n get: function () {\n if (this._computed_renderers == null) {\n var renderers = this.model.renderers;\n var all_renderers = this.plot_model.plot.renderers;\n var names = this.model.names;\n this._computed_renderers = util_1.compute_renderers(renderers, all_renderers, names);\n }\n return this._computed_renderers;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(HoverToolView.prototype, \"ttmodels\", {\n get: function () {\n if (this._ttmodels == null)\n this._ttmodels = this._compute_ttmodels();\n return this._ttmodels;\n },\n enumerable: true,\n configurable: true\n });\n HoverToolView.prototype._clear = function () {\n this._inspect(Infinity, Infinity);\n for (var rid in this.ttmodels) {\n var tt = this.ttmodels[rid];\n tt.clear();\n }\n };\n HoverToolView.prototype._move = function (ev) {\n if (!this.model.active)\n return;\n var sx = ev.sx, sy = ev.sy;\n if (!this.plot_model.frame.bbox.contains(sx, sy))\n this._clear();\n else\n this._inspect(sx, sy);\n };\n HoverToolView.prototype._move_exit = function () {\n this._clear();\n };\n HoverToolView.prototype._inspect = function (sx, sy) {\n var geometry;\n if (this.model.mode == 'mouse')\n geometry = { type: 'point', sx: sx, sy: sy };\n else {\n var direction = this.model.mode == 'vline' ? 'h' : 'v';\n geometry = { type: 'span', direction: direction, sx: sx, sy: sy };\n }\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n var sm = r.get_selection_manager();\n sm.inspect(this.plot_view.renderer_views[r.id], geometry);\n }\n if (this.model.callback != null)\n this._emit_callback(geometry);\n };\n HoverToolView.prototype._update = function (_a) {\n var renderer_view = _a[0], geometry = _a[1].geometry;\n var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;\n if (!this.model.active)\n return;\n if (!(renderer_view instanceof glyph_renderer_1.GlyphRendererView || renderer_view instanceof graph_renderer_1.GraphRendererView))\n return;\n var renderer = renderer_view.model;\n var tooltip = this.ttmodels[renderer.id];\n if (tooltip == null)\n return;\n tooltip.clear();\n var selection_manager = renderer.get_selection_manager();\n var indices = selection_manager.inspectors[renderer.id];\n if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n indices = renderer.view.convert_selection_to_subset(indices);\n if (indices.is_empty())\n return;\n var ds = selection_manager.source;\n var frame = this.plot_model.frame;\n var sx = geometry.sx, sy = geometry.sy;\n var xscale = frame.xscales[renderer.x_range_name];\n var yscale = frame.yscales[renderer.y_range_name];\n var x = xscale.invert(sx);\n var y = yscale.invert(sy);\n var glyph = renderer_view.glyph; // XXX\n for (var _i = 0, _t = indices.line_indices; _i < _t.length; _i++) {\n var i = _t[_i];\n var data_x = glyph._x[i + 1];\n var data_y = glyph._y[i + 1];\n var ii = i;\n var rx = void 0;\n var ry = void 0;\n switch (this.model.line_policy) {\n case \"interp\": { // and renderer.get_interpolation_hit?\n _b = glyph.get_interpolation_hit(i, geometry), data_x = _b[0], data_y = _b[1];\n rx = xscale.compute(data_x);\n ry = yscale.compute(data_y);\n break;\n }\n case \"prev\": {\n _c = _line_hit(glyph.sx, glyph.sy, i), _d = _c[0], rx = _d[0], ry = _d[1], ii = _c[1];\n break;\n }\n case \"next\": {\n _e = _line_hit(glyph.sx, glyph.sy, i + 1), _f = _e[0], rx = _f[0], ry = _f[1], ii = _e[1];\n break;\n }\n case \"nearest\": {\n _g = _nearest_line_hit(i, geometry, sx, sy, glyph.sx, glyph.sy), _h = _g[0], rx = _h[0], ry = _h[1], ii = _g[1];\n data_x = glyph._x[ii];\n data_y = glyph._y[ii];\n break;\n }\n default: {\n _j = [sx, sy], rx = _j[0], ry = _j[1];\n }\n }\n var vars = {\n index: ii,\n x: x,\n y: y,\n sx: sx,\n sy: sy,\n data_x: data_x,\n data_y: data_y,\n rx: rx,\n ry: ry,\n indices: indices.line_indices,\n name: renderer_view.model.name,\n };\n tooltip.add(rx, ry, this._render_tooltips(ds, ii, vars));\n }\n for (var _u = 0, _v = indices.image_indices; _u < _v.length; _u++) {\n var struct = _v[_u];\n var vars = { index: struct['index'], x: x, y: y, sx: sx, sy: sy };\n var rendered = this._render_tooltips(ds, struct, vars);\n tooltip.add(sx, sy, rendered);\n }\n for (var _w = 0, _z = indices.indices; _w < _z.length; _w++) {\n var i = _z[_w];\n // multiglyphs set additional indices, e.g. multiline_indices for different tooltips\n if (!object_1.isEmpty(indices.multiline_indices)) {\n for (var _0 = 0, _1 = indices.multiline_indices[i.toString()]; _0 < _1.length; _0++) {\n var j = _1[_0];\n var data_x = glyph._xs[i][j];\n var data_y = glyph._ys[i][j];\n var jj = j;\n var rx = void 0;\n var ry = void 0;\n switch (this.model.line_policy) {\n case \"interp\": { // and renderer.get_interpolation_hit?\n _k = glyph.get_interpolation_hit(i, j, geometry), data_x = _k[0], data_y = _k[1];\n rx = xscale.compute(data_x);\n ry = yscale.compute(data_y);\n break;\n }\n case \"prev\": {\n _l = _line_hit(glyph.sxs[i], glyph.sys[i], j), _m = _l[0], rx = _m[0], ry = _m[1], jj = _l[1];\n break;\n }\n case \"next\": {\n _o = _line_hit(glyph.sxs[i], glyph.sys[i], j + 1), _p = _o[0], rx = _p[0], ry = _p[1], jj = _o[1];\n break;\n }\n case \"nearest\": {\n _q = _nearest_line_hit(j, geometry, sx, sy, glyph.sxs[i], glyph.sys[i]), _r = _q[0], rx = _r[0], ry = _r[1], jj = _q[1];\n data_x = glyph._xs[i][jj];\n data_y = glyph._ys[i][jj];\n break;\n }\n default:\n throw new Error(\"should't have happened\");\n }\n var index = void 0;\n if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n index = renderer.view.convert_indices_from_subset([i])[0];\n else\n index = i;\n var vars = {\n index: index,\n segment_index: jj,\n x: x,\n y: y,\n sx: sx,\n sy: sy,\n data_x: data_x,\n data_y: data_y,\n indices: indices.multiline_indices,\n name: renderer_view.model.name,\n };\n tooltip.add(rx, ry, this._render_tooltips(ds, index, vars));\n }\n }\n else {\n // handle non-multiglyphs\n var data_x = glyph._x != null ? glyph._x[i] : undefined;\n var data_y = glyph._y != null ? glyph._y[i] : undefined;\n var rx = void 0;\n var ry = void 0;\n if (this.model.point_policy == 'snap_to_data') { // and renderer.glyph.sx? and renderer.glyph.sy?\n // Pass in our screen position so we can determine which patch we're\n // over if there are discontinuous patches.\n var pt = glyph.get_anchor_point(this.model.anchor, i, [sx, sy]);\n if (pt == null)\n pt = glyph.get_anchor_point(\"center\", i, [sx, sy]);\n rx = pt.x;\n ry = pt.y;\n }\n else\n _s = [sx, sy], rx = _s[0], ry = _s[1];\n var index = void 0;\n if (renderer instanceof glyph_renderer_1.GlyphRenderer)\n index = renderer.view.convert_indices_from_subset([i])[0];\n else\n index = i;\n var vars = {\n index: index,\n x: x,\n y: y,\n sx: sx,\n sy: sy,\n data_x: data_x,\n data_y: data_y,\n indices: indices.indices,\n name: renderer_view.model.name,\n };\n tooltip.add(rx, ry, this._render_tooltips(ds, index, vars));\n }\n }\n };\n HoverToolView.prototype._emit_callback = function (geometry) {\n for (var _i = 0, _a = this.computed_renderers; _i < _a.length; _i++) {\n var r = _a[_i];\n var index = r.data_source.inspected;\n var frame = this.plot_model.frame;\n var xscale = frame.xscales[r.x_range_name];\n var yscale = frame.yscales[r.y_range_name];\n var x = xscale.invert(geometry.sx);\n var y = yscale.invert(geometry.sy);\n var g = tslib_1.__assign({ x: x, y: y }, geometry);\n var callback = this.model.callback;\n var _b = [callback, { index: index, geometry: g, renderer: r }], obj = _b[0], data = _b[1];\n if (types_1.isFunction(callback))\n callback(obj, data);\n else\n callback.execute(obj, data);\n }\n };\n HoverToolView.prototype._render_tooltips = function (ds, i, vars) {\n var tooltips = this.model.tooltips;\n if (types_1.isString(tooltips)) {\n var el = dom_1.div();\n el.innerHTML = templating_1.replace_placeholders(tooltips, ds, i, this.model.formatters, vars);\n return el;\n }\n else if (types_1.isFunction(tooltips)) {\n return tooltips(ds, vars);\n }\n else {\n var rows = dom_1.div({ style: { display: \"table\", borderSpacing: \"2px\" } });\n for (var _i = 0, tooltips_1 = tooltips; _i < tooltips_1.length; _i++) {\n var _a = tooltips_1[_i], label = _a[0], value = _a[1];\n var row = dom_1.div({ style: { display: \"table-row\" } });\n rows.appendChild(row);\n var cell = void 0;\n cell = dom_1.div({ style: { display: \"table-cell\" }, class: 'bk-tooltip-row-label' }, label + \": \");\n row.appendChild(cell);\n cell = dom_1.div({ style: { display: \"table-cell\" }, class: 'bk-tooltip-row-value' });\n row.appendChild(cell);\n if (value.indexOf(\"$color\") >= 0) {\n var _b = value.match(/\\$color(\\[.*\\])?:(\\w*)/), _c = _b[1], opts = _c === void 0 ? \"\" : _c, colname = _b[2]; // XXX!\n var column = ds.get_column(colname); // XXX: change to columnar ds\n if (column == null) {\n var el_1 = dom_1.span({}, colname + \" unknown\");\n cell.appendChild(el_1);\n continue;\n }\n var hex = opts.indexOf(\"hex\") >= 0;\n var swatch = opts.indexOf(\"swatch\") >= 0;\n var color = types_1.isNumber(i) ? column[i] : null;\n if (color == null) {\n var el_2 = dom_1.span({}, \"(null)\");\n cell.appendChild(el_2);\n continue;\n }\n if (hex)\n color = color_1.color2hex(color);\n var el = dom_1.span({}, color);\n cell.appendChild(el);\n if (swatch) {\n el = dom_1.span({ class: 'bk-tooltip-color-block', style: { backgroundColor: color } }, \" \");\n cell.appendChild(el);\n }\n }\n else {\n var el = dom_1.span();\n el.innerHTML = templating_1.replace_placeholders(value.replace(\"$~\", \"$data_\"), ds, i, this.model.formatters, vars);\n cell.appendChild(el);\n }\n }\n return rows;\n }\n };\n return HoverToolView;\n }(inspect_tool_1.InspectToolView));\n exports.HoverToolView = HoverToolView;\n var HoverTool = /** @class */ (function (_super) {\n tslib_1.__extends(HoverTool, _super);\n function HoverTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.tool_name = \"Hover\";\n _this.icon = \"bk-tool-icon-hover\";\n return _this;\n }\n HoverTool.initClass = function () {\n this.prototype.type = \"HoverTool\";\n this.prototype.default_view = HoverToolView;\n this.define({\n tooltips: [p.Any, [\n [\"index\", \"$index\"],\n [\"data (x, y)\", \"($x, $y)\"],\n [\"screen (x, y)\", \"($sx, $sy)\"],\n ]],\n formatters: [p.Any, {}],\n renderers: [p.Any, 'auto'],\n names: [p.Array, []],\n mode: [p.String, 'mouse'],\n point_policy: [p.String, 'snap_to_data'],\n line_policy: [p.String, 'nearest'],\n show_arrow: [p.Boolean, true],\n anchor: [p.String, 'center'],\n attachment: [p.String, 'horizontal'],\n callback: [p.Any],\n });\n };\n return HoverTool;\n }(inspect_tool_1.InspectTool));\n exports.HoverTool = HoverTool;\n HoverTool.initClass();\n}\n","/* models/tools/inspectors/inspect_tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var button_tool_1 = require(241) /* ../button_tool */;\n var on_off_button_1 = require(265) /* ../on_off_button */;\n var p = require(15) /* core/properties */;\n var InspectToolView = /** @class */ (function (_super) {\n tslib_1.__extends(InspectToolView, _super);\n function InspectToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n return InspectToolView;\n }(button_tool_1.ButtonToolView));\n exports.InspectToolView = InspectToolView;\n var InspectTool = /** @class */ (function (_super) {\n tslib_1.__extends(InspectTool, _super);\n function InspectTool(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this.event_type = \"move\";\n return _this;\n }\n InspectTool.initClass = function () {\n this.prototype.type = \"InspectTool\";\n this.prototype.button_view = on_off_button_1.OnOffButtonView;\n this.define({\n toggleable: [p.Bool, true],\n });\n this.override({\n active: true,\n });\n };\n return InspectTool;\n }(button_tool_1.ButtonTool));\n exports.InspectTool = InspectTool;\n InspectTool.initClass();\n}\n","/* models/tools/on_off_button */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var button_tool_1 = require(241) /* ./button_tool */;\n var OnOffButtonView = /** @class */ (function (_super) {\n tslib_1.__extends(OnOffButtonView, _super);\n function OnOffButtonView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n OnOffButtonView.prototype.render = function () {\n _super.prototype.render.call(this);\n if (this.model.active)\n this.el.classList.add('bk-active');\n else\n this.el.classList.remove('bk-active');\n };\n OnOffButtonView.prototype._clicked = function () {\n var active = this.model.active;\n this.model.active = !active;\n };\n return OnOffButtonView;\n }(button_tool_1.ButtonToolButtonView));\n exports.OnOffButtonView = OnOffButtonView;\n}\n","/* models/tools/tool */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var p = require(15) /* core/properties */;\n var view_1 = require(48) /* core/view */;\n var array_1 = require(21) /* core/util/array */;\n var model_1 = require(59) /* ../../model */;\n var ToolView = /** @class */ (function (_super) {\n tslib_1.__extends(ToolView, _super);\n function ToolView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ToolView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.plot_view = options.plot_view;\n };\n Object.defineProperty(ToolView.prototype, \"plot_model\", {\n get: function () {\n return this.plot_view.model;\n },\n enumerable: true,\n configurable: true\n });\n ToolView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.active.change, function () {\n if (_this.model.active)\n _this.activate();\n else\n _this.deactivate();\n });\n };\n // activate is triggered by toolbar ui actions\n ToolView.prototype.activate = function () { };\n // deactivate is triggered by toolbar ui actions\n ToolView.prototype.deactivate = function () { };\n return ToolView;\n }(view_1.View));\n exports.ToolView = ToolView;\n var Tool = /** @class */ (function (_super) {\n tslib_1.__extends(Tool, _super);\n function Tool(attrs) {\n return _super.call(this, attrs) || this;\n }\n Tool.initClass = function () {\n this.prototype.type = \"Tool\";\n this.internal({\n active: [p.Boolean, false],\n });\n };\n Object.defineProperty(Tool.prototype, \"synthetic_renderers\", {\n get: function () {\n return [];\n },\n enumerable: true,\n configurable: true\n });\n // utility function to return a tool name, modified\n // by the active dimenions. Used by tools that have dimensions\n Tool.prototype._get_dim_tooltip = function (name, dims) {\n switch (dims) {\n case \"width\": return name + \" (x-axis)\";\n case \"height\": return name + \" (y-axis)\";\n case \"both\": return name;\n }\n };\n // utility function to get limits along both dimensions, given\n // optional dimensional constraints\n Tool.prototype._get_dim_limits = function (_a, _b, frame, dims) {\n var sx0 = _a[0], sy0 = _a[1];\n var sx1 = _b[0], sy1 = _b[1];\n var hr = frame.bbox.h_range;\n var sxlim;\n if (dims == 'width' || dims == 'both') {\n sxlim = [array_1.min([sx0, sx1]), array_1.max([sx0, sx1])];\n sxlim = [array_1.max([sxlim[0], hr.start]), array_1.min([sxlim[1], hr.end])];\n }\n else\n sxlim = [hr.start, hr.end];\n var vr = frame.bbox.v_range;\n var sylim;\n if (dims == 'height' || dims == 'both') {\n sylim = [array_1.min([sy0, sy1]), array_1.max([sy0, sy1])];\n sylim = [array_1.max([sylim[0], vr.start]), array_1.min([sylim[1], vr.end])];\n }\n else\n sylim = [vr.start, vr.end];\n return [sxlim, sylim];\n };\n return Tool;\n }(model_1.Model));\n exports.Tool = Tool;\n Tool.initClass();\n}\n","/* models/tools/tool_proxy */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var p = require(15) /* core/properties */;\n var signaling_1 = require(19) /* core/signaling */;\n var model_1 = require(59) /* ../../model */;\n var ToolProxy = /** @class */ (function (_super) {\n tslib_1.__extends(ToolProxy, _super);\n function ToolProxy(attrs) {\n return _super.call(this, attrs) || this;\n }\n ToolProxy.initClass = function () {\n this.prototype.type = \"ToolProxy\";\n this.define({\n tools: [p.Array, []],\n active: [p.Bool, false],\n disabled: [p.Bool, false],\n });\n };\n Object.defineProperty(ToolProxy.prototype, \"button_view\", {\n // Operates all the tools given only one button\n get: function () {\n return this.tools[0].button_view;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ToolProxy.prototype, \"event_type\", {\n get: function () {\n return this.tools[0].event_type;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ToolProxy.prototype, \"tooltip\", {\n get: function () {\n return this.tools[0].tooltip;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ToolProxy.prototype, \"tool_name\", {\n get: function () {\n return this.tools[0].tool_name;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ToolProxy.prototype, \"icon\", {\n get: function () {\n return this.tools[0].computed_icon;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ToolProxy.prototype, \"computed_icon\", {\n get: function () {\n return this.icon;\n },\n enumerable: true,\n configurable: true\n });\n ToolProxy.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this.do = new signaling_1.Signal0(this, \"do\");\n };\n ToolProxy.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.do, function () { return _this.doit(); });\n this.connect(this.properties.active.change, function () { return _this.set_active(); });\n };\n ToolProxy.prototype.doit = function () {\n for (var _i = 0, _a = this.tools; _i < _a.length; _i++) {\n var tool = _a[_i];\n tool.do.emit();\n }\n };\n ToolProxy.prototype.set_active = function () {\n for (var _i = 0, _a = this.tools; _i < _a.length; _i++) {\n var tool = _a[_i];\n tool.active = this.active;\n }\n };\n return ToolProxy;\n }(model_1.Model));\n exports.ToolProxy = ToolProxy;\n ToolProxy.initClass();\n}\n","/* models/tools/toolbar */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var p = require(15) /* core/properties */;\n var logging_1 = require(14) /* core/logging */;\n var types_1 = require(44) /* core/util/types */;\n var array_1 = require(21) /* core/util/array */;\n var action_tool_1 = require(232) /* ./actions/action_tool */;\n var help_tool_1 = require(234) /* ./actions/help_tool */;\n var gesture_tool_1 = require(251) /* ./gestures/gesture_tool */;\n var inspect_tool_1 = require(264) /* ./inspectors/inspect_tool */;\n var toolbar_base_1 = require(269) /* ./toolbar_base */;\n var Toolbar = /** @class */ (function (_super) {\n tslib_1.__extends(Toolbar, _super);\n function Toolbar(attrs) {\n return _super.call(this, attrs) || this;\n }\n Toolbar.initClass = function () {\n this.prototype.type = 'Toolbar';\n this.prototype.default_view = toolbar_base_1.ToolbarBaseView;\n this.define({\n active_drag: [p.Any, 'auto'],\n active_inspect: [p.Any, 'auto'],\n active_scroll: [p.Any, 'auto'],\n active_tap: [p.Any, 'auto'],\n active_multi: [p.Any, null],\n });\n };\n Toolbar.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._init_tools();\n };\n Toolbar.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.properties.tools.change, function () { return _this._init_tools(); });\n };\n Toolbar.prototype._init_tools = function () {\n var _this = this;\n var _loop_1 = function (tool) {\n if (tool instanceof inspect_tool_1.InspectTool) {\n if (!array_1.any(this_1.inspectors, function (t) { return t.id == tool.id; })) {\n this_1.inspectors = this_1.inspectors.concat([tool]);\n }\n }\n else if (tool instanceof help_tool_1.HelpTool) {\n if (!array_1.any(this_1.help, function (t) { return t.id == tool.id; })) {\n this_1.help = this_1.help.concat([tool]);\n }\n }\n else if (tool instanceof action_tool_1.ActionTool) {\n if (!array_1.any(this_1.actions, function (t) { return t.id == tool.id; })) {\n this_1.actions = this_1.actions.concat([tool]);\n }\n }\n else if (tool instanceof gesture_tool_1.GestureTool) {\n var event_types = void 0;\n var multi = void 0;\n if (types_1.isString(tool.event_type)) {\n event_types = [tool.event_type];\n multi = false;\n }\n else {\n event_types = tool.event_type || [];\n multi = true;\n }\n for (var _i = 0, event_types_1 = event_types; _i < event_types_1.length; _i++) {\n var et = event_types_1[_i];\n if (!(et in this_1.gestures)) {\n logging_1.logger.warn(\"Toolbar: unknown event type '\" + et + \"' for tool: \" + tool.type + \" (\" + tool.id + \")\");\n continue;\n }\n if (multi)\n et = \"multi\";\n if (!array_1.any(this_1.gestures[et].tools, function (t) { return t.id == tool.id; }))\n this_1.gestures[et].tools = this_1.gestures[et].tools.concat([tool]);\n this_1.connect(tool.properties.active.change, this_1._active_change.bind(this_1, tool));\n }\n }\n };\n var this_1 = this;\n for (var _i = 0, _a = this.tools; _i < _a.length; _i++) {\n var tool = _a[_i];\n _loop_1(tool);\n }\n if (this.active_inspect == 'auto') {\n // do nothing as all tools are active be default\n }\n else if (this.active_inspect instanceof inspect_tool_1.InspectTool) {\n for (var _b = 0, _c = this.inspectors; _b < _c.length; _b++) {\n var inspector = _c[_b];\n if (inspector != this.active_inspect)\n inspector.active = false;\n }\n }\n else if (types_1.isArray(this.active_inspect)) {\n for (var _d = 0, _e = this.inspectors; _d < _e.length; _d++) {\n var inspector = _e[_d];\n if (!array_1.includes(this.active_inspect, inspector))\n inspector.active = false;\n }\n }\n else if (this.active_inspect == null) {\n for (var _f = 0, _g = this.inspectors; _f < _g.length; _f++) {\n var inspector = _g[_f];\n inspector.active = false;\n }\n }\n var _activate_gesture = function (tool) {\n if (tool.active) {\n // tool was activated by a proxy, but we need to finish configuration manually\n _this._active_change(tool);\n }\n else\n tool.active = true;\n };\n for (var et in this.gestures) {\n var gesture = this.gestures[et];\n if (gesture.tools.length == 0)\n continue;\n gesture.tools = array_1.sortBy(gesture.tools, function (tool) { return tool.default_order; });\n if (et == 'tap') {\n if (this.active_tap == null)\n continue;\n if (this.active_tap == 'auto')\n _activate_gesture(gesture.tools[0]);\n else\n _activate_gesture(this.active_tap);\n }\n if (et == 'pan') {\n if (this.active_drag == null)\n continue;\n if (this.active_drag == 'auto')\n _activate_gesture(gesture.tools[0]);\n else\n _activate_gesture(this.active_drag);\n }\n if (et == 'pinch' || et == 'scroll') {\n if (this.active_scroll == null || this.active_scroll == 'auto')\n continue;\n _activate_gesture(this.active_scroll);\n }\n if (this.active_multi != null)\n _activate_gesture(this.active_multi);\n }\n };\n return Toolbar;\n }(toolbar_base_1.ToolbarBase));\n exports.Toolbar = Toolbar;\n Toolbar.initClass();\n}\n","/* models/tools/toolbar_base */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var logging_1 = require(14) /* core/logging */;\n var dom_1 = require(5) /* core/dom */;\n var build_views_1 = require(4) /* core/build_views */;\n var p = require(15) /* core/properties */;\n var dom_view_1 = require(6) /* core/dom_view */;\n var types_1 = require(44) /* core/util/types */;\n var model_1 = require(59) /* model */;\n var ToolbarViewModel = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarViewModel, _super);\n function ToolbarViewModel(attrs) {\n return _super.call(this, attrs) || this;\n }\n ToolbarViewModel.initClass = function () {\n this.prototype.type = 'ToolbarBase';\n this.define({\n _visible: [p.Bool, null],\n autohide: [p.Bool, false],\n });\n };\n Object.defineProperty(ToolbarViewModel.prototype, \"visible\", {\n get: function () {\n return (!this.autohide) ? true : (this._visible == null) ? false : this._visible;\n },\n enumerable: true,\n configurable: true\n });\n return ToolbarViewModel;\n }(model_1.Model));\n exports.ToolbarViewModel = ToolbarViewModel;\n ToolbarViewModel.initClass();\n var ToolbarBaseView = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarBaseView, _super);\n function ToolbarBaseView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ToolbarBaseView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this._tool_button_views = {};\n this._build_tool_button_views();\n this._toolbar_view_model = new ToolbarViewModel({ autohide: this.model.autohide });\n };\n ToolbarBaseView.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.model.properties.tools.change, function () { return _this._build_tool_button_views(); });\n this.connect(this.model.properties.autohide.change, function () {\n _this._toolbar_view_model.autohide = _this.model.autohide;\n _this._on_visible_change();\n });\n this.connect(this._toolbar_view_model.properties._visible.change, function () { return _this._on_visible_change(); });\n };\n ToolbarBaseView.prototype.remove = function () {\n build_views_1.remove_views(this._tool_button_views);\n _super.prototype.remove.call(this);\n };\n ToolbarBaseView.prototype._build_tool_button_views = function () {\n var tools = (this.model._proxied_tools != null ? this.model._proxied_tools : this.model.tools); // XXX\n build_views_1.build_views(this._tool_button_views, tools, { parent: this }, function (tool) { return tool.button_view; });\n };\n ToolbarBaseView.prototype.set_visibility = function (visible) {\n if (visible != this._toolbar_view_model._visible) {\n this._toolbar_view_model._visible = visible;\n }\n };\n ToolbarBaseView.prototype._on_visible_change = function () {\n var visible = this._toolbar_view_model.visible;\n var hidden_class = \"bk-toolbar-hidden\";\n if (this.el.classList.contains(hidden_class) && visible) {\n this.el.classList.remove(hidden_class);\n }\n else if (!visible) {\n this.el.classList.add(hidden_class);\n }\n };\n ToolbarBaseView.prototype.render = function () {\n var _this = this;\n dom_1.empty(this.el);\n this.el.classList.add(\"bk-toolbar\");\n this.el.classList.add(\"bk-toolbar-\" + this.model.toolbar_location);\n this._toolbar_view_model.autohide = this.model.autohide;\n this._on_visible_change();\n if (this.model.logo != null) {\n var cls = this.model.logo === \"grey\" ? \"bk-grey\" : null;\n var logo = dom_1.a({ href: \"https://bokeh.pydata.org/\", target: \"_blank\", class: [\"bk-logo\", \"bk-logo-small\", cls] });\n this.el.appendChild(logo);\n }\n var bars = [];\n var el = function (tool) {\n return _this._tool_button_views[tool.id].el;\n };\n var gestures = this.model.gestures;\n for (var et in gestures) {\n bars.push(gestures[et].tools.map(el));\n }\n bars.push(this.model.actions.map(el));\n bars.push(this.model.inspectors.filter(function (tool) { return tool.toggleable; }).map(el));\n bars.push(this.model.help.map(el));\n for (var _i = 0, bars_1 = bars; _i < bars_1.length; _i++) {\n var bar = bars_1[_i];\n if (bar.length !== 0) {\n var el_1 = dom_1.div({ class: 'bk-button-bar' }, bar);\n this.el.appendChild(el_1);\n }\n }\n };\n return ToolbarBaseView;\n }(dom_view_1.DOMView));\n exports.ToolbarBaseView = ToolbarBaseView;\n var ToolbarBase = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarBase, _super);\n function ToolbarBase(attrs) {\n return _super.call(this, attrs) || this;\n }\n ToolbarBase.initClass = function () {\n this.prototype.type = 'ToolbarBase';\n this.prototype.default_view = ToolbarBaseView;\n this.define({\n tools: [p.Array, []],\n logo: [p.String, 'normal'],\n autohide: [p.Bool, false],\n });\n this.internal({\n gestures: [p.Any, function () {\n return ({\n pan: { tools: [], active: null },\n scroll: { tools: [], active: null },\n pinch: { tools: [], active: null },\n tap: { tools: [], active: null },\n doubletap: { tools: [], active: null },\n press: { tools: [], active: null },\n rotate: { tools: [], active: null },\n move: { tools: [], active: null },\n multi: { tools: [], active: null },\n });\n }],\n actions: [p.Array, []],\n inspectors: [p.Array, []],\n help: [p.Array, []],\n toolbar_location: [p.Location, 'right'],\n });\n };\n Object.defineProperty(ToolbarBase.prototype, \"horizontal\", {\n get: function () {\n return this.toolbar_location === \"above\" || this.toolbar_location === \"below\";\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ToolbarBase.prototype, \"vertical\", {\n get: function () {\n return this.toolbar_location === \"left\" || this.toolbar_location === \"right\";\n },\n enumerable: true,\n configurable: true\n });\n ToolbarBase.prototype._active_change = function (tool) {\n var event_type = tool.event_type;\n if (event_type == null)\n return;\n var event_types = types_1.isString(event_type) ? [event_type] : event_type;\n for (var _i = 0, event_types_1 = event_types; _i < event_types_1.length; _i++) {\n var et = event_types_1[_i];\n if (tool.active) {\n var currently_active_tool = this.gestures[et].active;\n if (currently_active_tool != null && tool != currently_active_tool) {\n logging_1.logger.debug(\"Toolbar: deactivating tool: \" + currently_active_tool.type + \" (\" + currently_active_tool.id + \") for event type '\" + et + \"'\");\n currently_active_tool.active = false;\n }\n this.gestures[et].active = tool;\n logging_1.logger.debug(\"Toolbar: activating tool: \" + tool.type + \" (\" + tool.id + \") for event type '\" + et + \"'\");\n }\n else\n this.gestures[et].active = null;\n }\n };\n return ToolbarBase;\n }(model_1.Model));\n exports.ToolbarBase = ToolbarBase;\n ToolbarBase.initClass();\n}\n","/* models/tools/toolbar_box */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var p = require(15) /* core/properties */;\n var dom_1 = require(5) /* core/dom */;\n var logging_1 = require(14) /* core/logging */;\n var types_1 = require(44) /* core/util/types */;\n var array_1 = require(21) /* core/util/array */;\n var action_tool_1 = require(232) /* ./actions/action_tool */;\n var help_tool_1 = require(234) /* ./actions/help_tool */;\n var gesture_tool_1 = require(251) /* ./gestures/gesture_tool */;\n var inspect_tool_1 = require(264) /* ./inspectors/inspect_tool */;\n var toolbar_base_1 = require(269) /* ./toolbar_base */;\n var tool_proxy_1 = require(267) /* ./tool_proxy */;\n var layout_dom_1 = require(157) /* ../layouts/layout_dom */;\n var build_views_1 = require(4) /* core/build_views */;\n var ProxyToolbar = /** @class */ (function (_super) {\n tslib_1.__extends(ProxyToolbar, _super);\n function ProxyToolbar(attrs) {\n return _super.call(this, attrs) || this;\n }\n ProxyToolbar.initClass = function () {\n this.prototype.type = \"ProxyToolbar\";\n };\n ProxyToolbar.prototype.initialize = function () {\n _super.prototype.initialize.call(this);\n this._init_tools();\n this._merge_tools();\n };\n ProxyToolbar.prototype._init_tools = function () {\n var _loop_1 = function (tool) {\n if (tool instanceof inspect_tool_1.InspectTool) {\n if (!array_1.any(this_1.inspectors, function (t) { return t.id == tool.id; }))\n this_1.inspectors = this_1.inspectors.concat([tool]);\n }\n else if (tool instanceof help_tool_1.HelpTool) {\n if (!array_1.any(this_1.help, function (t) { return t.id == tool.id; }))\n this_1.help = this_1.help.concat([tool]);\n }\n else if (tool instanceof action_tool_1.ActionTool) {\n if (!array_1.any(this_1.actions, function (t) { return t.id == tool.id; }))\n this_1.actions = this_1.actions.concat([tool]);\n }\n else if (tool instanceof gesture_tool_1.GestureTool) {\n var event_types = void 0;\n var multi = void 0;\n if (types_1.isString(tool.event_type)) {\n event_types = [tool.event_type];\n multi = false;\n }\n else {\n event_types = tool.event_type || [];\n multi = true;\n }\n for (var _i = 0, event_types_1 = event_types; _i < event_types_1.length; _i++) {\n var et = event_types_1[_i];\n if (!(et in this_1.gestures)) {\n logging_1.logger.warn(\"Toolbar: unknown event type '\" + et + \"' for tool: \" + tool.type + \" (\" + tool.id + \")\");\n continue;\n }\n if (multi)\n et = \"multi\";\n if (!array_1.any(this_1.gestures[et].tools, function (t) { return t.id == tool.id; }))\n this_1.gestures[et].tools = this_1.gestures[et].tools.concat([tool]);\n }\n }\n };\n var this_1 = this;\n for (var _i = 0, _a = this.tools; _i < _a.length; _i++) {\n var tool = _a[_i];\n _loop_1(tool);\n }\n };\n ProxyToolbar.prototype._merge_tools = function () {\n var _this = this;\n var _a;\n // Go through all the tools on the toolbar and replace them with\n // a proxy e.g. PanTool, BoxSelectTool, etc.\n this._proxied_tools = [];\n var inspectors = {};\n var actions = {};\n var gestures = {};\n var new_help_tools = [];\n var new_help_urls = [];\n for (var _i = 0, _b = this.help; _i < _b.length; _i++) {\n var helptool = _b[_i];\n if (!array_1.includes(new_help_urls, helptool.redirect)) {\n new_help_tools.push(helptool);\n new_help_urls.push(helptool.redirect);\n }\n }\n (_a = this._proxied_tools).push.apply(_a, new_help_tools);\n this.help = new_help_tools;\n for (var event_type in this.gestures) {\n var gesture = this.gestures[event_type];\n if (!(event_type in gestures)) {\n gestures[event_type] = {};\n }\n for (var _c = 0, _d = gesture.tools; _c < _d.length; _c++) {\n var tool = _d[_c];\n if (!(tool.type in gestures[event_type])) {\n gestures[event_type][tool.type] = [];\n }\n gestures[event_type][tool.type].push(tool);\n }\n }\n for (var _e = 0, _f = this.inspectors; _e < _f.length; _e++) {\n var tool = _f[_e];\n if (!(tool.type in inspectors)) {\n inspectors[tool.type] = [];\n }\n inspectors[tool.type].push(tool);\n }\n for (var _g = 0, _h = this.actions; _g < _h.length; _g++) {\n var tool = _h[_g];\n if (!(tool.type in actions)) {\n actions[tool.type] = [];\n }\n actions[tool.type].push(tool);\n }\n // Add a proxy for each of the groups of tools.\n var make_proxy = function (tools, active) {\n if (active === void 0) {\n active = false;\n }\n var proxy = new tool_proxy_1.ToolProxy({ tools: tools, active: active });\n _this._proxied_tools.push(proxy);\n return proxy;\n };\n for (var event_type in gestures) {\n var gesture = this.gestures[event_type];\n gesture.tools = [];\n for (var tool_type in gestures[event_type]) {\n var tools = gestures[event_type][tool_type];\n if (tools.length > 0) {\n if (event_type == 'multi') {\n for (var _j = 0, tools_1 = tools; _j < tools_1.length; _j++) {\n var tool = tools_1[_j];\n var proxy = make_proxy([tool]);\n gesture.tools.push(proxy);\n this.connect(proxy.properties.active.change, this._active_change.bind(this, proxy));\n }\n }\n else {\n var proxy = make_proxy(tools);\n gesture.tools.push(proxy);\n this.connect(proxy.properties.active.change, this._active_change.bind(this, proxy));\n }\n }\n }\n }\n this.actions = [];\n for (var tool_type in actions) {\n var tools = actions[tool_type];\n if (tool_type == 'CustomAction') {\n for (var _k = 0, tools_2 = tools; _k < tools_2.length; _k++) {\n var tool = tools_2[_k];\n this.actions.push(make_proxy([tool]));\n }\n }\n else if (tools.length > 0) {\n this.actions.push(make_proxy(tools)); // XXX\n }\n }\n this.inspectors = [];\n for (var tool_type in inspectors) {\n var tools = inspectors[tool_type];\n if (tools.length > 0)\n this.inspectors.push(make_proxy(tools, true)); // XXX\n }\n for (var et in this.gestures) {\n var gesture = this.gestures[et];\n if (gesture.tools.length == 0)\n continue;\n gesture.tools = array_1.sortBy(gesture.tools, function (tool) { return tool.default_order; });\n if (!(et == 'pinch' || et == 'scroll' || et == 'multi'))\n gesture.tools[0].active = true;\n }\n };\n return ProxyToolbar;\n }(toolbar_base_1.ToolbarBase));\n exports.ProxyToolbar = ProxyToolbar;\n ProxyToolbar.initClass();\n var ToolbarBoxView = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarBoxView, _super);\n function ToolbarBoxView() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n ToolbarBoxView.prototype.initialize = function (options) {\n _super.prototype.initialize.call(this, options);\n this.model.toolbar.toolbar_location = this.model.toolbar_location;\n this._toolbar_views = {};\n build_views_1.build_views(this._toolbar_views, [this.model.toolbar], { parent: this });\n };\n ToolbarBoxView.prototype.remove = function () {\n build_views_1.remove_views(this._toolbar_views);\n _super.prototype.remove.call(this);\n };\n ToolbarBoxView.prototype.css_classes = function () {\n return _super.prototype.css_classes.call(this).concat(\"bk-toolbar-box\");\n };\n ToolbarBoxView.prototype.render = function () {\n _super.prototype.render.call(this);\n var toolbar = this._toolbar_views[this.model.toolbar.id];\n toolbar.render();\n dom_1.empty(this.el);\n this.el.appendChild(toolbar.el);\n };\n ToolbarBoxView.prototype.get_width = function () {\n return this.model.toolbar.vertical ? 30 : null;\n };\n ToolbarBoxView.prototype.get_height = function () {\n return this.model.toolbar.horizontal ? 30 : null;\n };\n return ToolbarBoxView;\n }(layout_dom_1.LayoutDOMView));\n exports.ToolbarBoxView = ToolbarBoxView;\n var ToolbarBox = /** @class */ (function (_super) {\n tslib_1.__extends(ToolbarBox, _super);\n function ToolbarBox(attrs) {\n return _super.call(this, attrs) || this;\n }\n ToolbarBox.initClass = function () {\n this.prototype.type = 'ToolbarBox';\n this.prototype.default_view = ToolbarBoxView;\n this.define({\n toolbar: [p.Instance],\n toolbar_location: [p.Location, \"right\"],\n });\n };\n Object.defineProperty(ToolbarBox.prototype, \"sizing_mode\", {\n // XXX: we are overriding LayoutDOM.sizing_mode here. That's a bad\n // hack, but currently every layoutable is allowed to have its\n // sizing mode configured, which is wrong. Another example of this\n // is PlotCanvas which only works with strech_both sizing mode.\n get: function () {\n switch (this.toolbar_location) {\n case \"above\":\n case \"below\": {\n return \"scale_width\";\n }\n case \"left\":\n case \"right\": {\n return \"scale_height\";\n }\n }\n },\n enumerable: true,\n configurable: true\n });\n return ToolbarBox;\n }(layout_dom_1.LayoutDOM));\n exports.ToolbarBox = ToolbarBox;\n ToolbarBox.initClass();\n}\n","/* models/tools/util */ function _(require, module, exports) {\n var array_1 = require(21) /* core/util/array */;\n var glyph_renderer_1 = require(185) /* ../renderers/glyph_renderer */;\n var graph_renderer_1 = require(186) /* ../renderers/graph_renderer */;\n function compute_renderers(renderers, all_renderers, names) {\n if (renderers == null)\n return [];\n var result;\n if (renderers == 'auto') {\n result = all_renderers.filter(function (r) {\n return r instanceof glyph_renderer_1.GlyphRenderer || r instanceof graph_renderer_1.GraphRenderer;\n });\n }\n else\n result = renderers;\n if (names.length > 0)\n result = result.filter(function (r) { return array_1.includes(names, r.name); });\n return result;\n }\n exports.compute_renderers = compute_renderers;\n}\n","/* models/transforms/customjs_transform */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var transform_1 = require(279) /* ./transform */;\n var p = require(15) /* core/properties */;\n var object_1 = require(32) /* core/util/object */;\n var string_1 = require(38) /* core/util/string */;\n var CustomJSTransform = /** @class */ (function (_super) {\n tslib_1.__extends(CustomJSTransform, _super);\n function CustomJSTransform(attrs) {\n return _super.call(this, attrs) || this;\n }\n CustomJSTransform.initClass = function () {\n this.prototype.type = 'CustomJSTransform';\n this.define({\n args: [p.Any, {}],\n func: [p.String, \"\"],\n v_func: [p.String, \"\"],\n use_strict: [p.Boolean, false],\n });\n };\n Object.defineProperty(CustomJSTransform.prototype, \"names\", {\n get: function () {\n return object_1.keys(this.args);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CustomJSTransform.prototype, \"values\", {\n get: function () {\n return object_1.values(this.args);\n },\n enumerable: true,\n configurable: true\n });\n CustomJSTransform.prototype._make_transform = function (name, func) {\n var code = this.use_strict ? string_1.use_strict(func) : func;\n return new (Function.bind.apply(Function, [void 0].concat(this.names, [name, \"require\", \"exports\", code])))();\n };\n Object.defineProperty(CustomJSTransform.prototype, \"scalar_transform\", {\n get: function () {\n return this._make_transform(\"x\", this.func);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(CustomJSTransform.prototype, \"vector_transform\", {\n get: function () {\n return this._make_transform(\"xs\", this.v_func);\n },\n enumerable: true,\n configurable: true\n });\n CustomJSTransform.prototype.compute = function (x) {\n return this.scalar_transform.apply(this, this.values.concat([x, require, {}]));\n };\n CustomJSTransform.prototype.v_compute = function (xs) {\n return this.vector_transform.apply(this, this.values.concat([xs, require, {}]));\n };\n return CustomJSTransform;\n }(transform_1.Transform));\n exports.CustomJSTransform = CustomJSTransform;\n CustomJSTransform.initClass();\n}\n","/* models/transforms/dodge */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var transform_1 = require(279) /* ./transform */;\n var factor_range_1 = require(181) /* ../ranges/factor_range */;\n var p = require(15) /* core/properties */;\n var types_1 = require(44) /* core/util/types */;\n var Dodge = /** @class */ (function (_super) {\n tslib_1.__extends(Dodge, _super);\n function Dodge(attrs) {\n return _super.call(this, attrs) || this;\n }\n Dodge.initClass = function () {\n this.prototype.type = \"Dodge\";\n this.define({\n value: [p.Number, 0],\n range: [p.Instance],\n });\n };\n // XXX: this is repeated in ./jitter.ts\n Dodge.prototype.v_compute = function (xs0) {\n var xs;\n if (this.range instanceof factor_range_1.FactorRange)\n xs = this.range.v_synthetic(xs0);\n else if (types_1.isArrayableOf(xs0, types_1.isNumber))\n xs = xs0;\n else\n throw new Error(\"unexpected\");\n var result = new Float64Array(xs.length);\n for (var i = 0; i < xs.length; i++) {\n var x = xs[i];\n result[i] = this._compute(x);\n }\n return result;\n };\n Dodge.prototype.compute = function (x) {\n if (this.range instanceof factor_range_1.FactorRange)\n return this._compute(this.range.synthetic(x));\n else if (types_1.isNumber(x))\n return this._compute(x);\n else\n throw new Error(\"unexpected\");\n };\n Dodge.prototype._compute = function (x) {\n return x + this.value;\n };\n return Dodge;\n }(transform_1.Transform));\n exports.Dodge = Dodge;\n Dodge.initClass();\n}\n","/* models/transforms/index */ function _(require, module, exports) {\n var customjs_transform_1 = require(272) /* ./customjs_transform */;\n exports.CustomJSTransform = customjs_transform_1.CustomJSTransform;\n var dodge_1 = require(273) /* ./dodge */;\n exports.Dodge = dodge_1.Dodge;\n var interpolator_1 = require(275) /* ./interpolator */;\n exports.Interpolator = interpolator_1.Interpolator;\n var jitter_1 = require(276) /* ./jitter */;\n exports.Jitter = jitter_1.Jitter;\n var linear_interpolator_1 = require(277) /* ./linear_interpolator */;\n exports.LinearInterpolator = linear_interpolator_1.LinearInterpolator;\n var step_interpolator_1 = require(278) /* ./step_interpolator */;\n exports.StepInterpolator = step_interpolator_1.StepInterpolator;\n var transform_1 = require(279) /* ./transform */;\n exports.Transform = transform_1.Transform;\n}\n","/* models/transforms/interpolator */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var transform_1 = require(279) /* ./transform */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var types_1 = require(44) /* core/util/types */;\n var Interpolator = /** @class */ (function (_super) {\n tslib_1.__extends(Interpolator, _super);\n function Interpolator(attrs) {\n var _this = _super.call(this, attrs) || this;\n _this._sorted_dirty = true;\n return _this;\n }\n Interpolator.initClass = function () {\n this.prototype.type = \"Interpolator\";\n this.define({\n x: [p.Any],\n y: [p.Any],\n data: [p.Any],\n clip: [p.Bool, true],\n });\n };\n Interpolator.prototype.connect_signals = function () {\n var _this = this;\n _super.prototype.connect_signals.call(this);\n this.connect(this.change, function () { return _this._sorted_dirty = true; });\n };\n Interpolator.prototype.v_compute = function (xs) {\n var result = new Float64Array(xs.length);\n for (var i = 0; i < xs.length; i++) {\n var x = xs[i];\n result[i] = this.compute(x);\n }\n return result;\n };\n Interpolator.prototype.sort = function (descending) {\n if (descending === void 0) {\n descending = false;\n }\n if (!this._sorted_dirty)\n return;\n var tsx;\n var tsy;\n if (types_1.isString(this.x) && types_1.isString(this.y) && this.data != null) {\n var column_names = this.data.columns();\n if (!array_1.includes(column_names, this.x))\n throw new Error(\"The x parameter does not correspond to a valid column name defined in the data parameter\");\n if (!array_1.includes(column_names, this.y))\n throw new Error(\"The y parameter does not correspond to a valid column name defined in the data parameter\");\n tsx = this.data.get_column(this.x);\n tsy = this.data.get_column(this.y);\n }\n else if (types_1.isArray(this.x) && types_1.isArray(this.y)) {\n tsx = this.x;\n tsy = this.y;\n }\n else {\n throw new Error(\"parameters 'x' and 'y' must be both either string fields or arrays\");\n }\n if (tsx.length !== tsy.length)\n throw new Error(\"The length for x and y do not match\");\n if (tsx.length < 2)\n throw new Error(\"x and y must have at least two elements to support interpolation\");\n // The following sorting code is referenced from:\n // http://stackoverflow.com/questions/11499268/sort-two-arrays-the-same-way\n var list = [];\n for (var j in tsx) {\n list.push({ x: tsx[j], y: tsy[j] });\n }\n if (descending)\n list.sort(function (a, b) { return a.x > b.x ? -1 : (a.x == b.x ? 0 : 1); });\n else\n list.sort(function (a, b) { return a.x < b.x ? -1 : (a.x == b.x ? 0 : 1); });\n this._x_sorted = [];\n this._y_sorted = [];\n for (var _i = 0, list_1 = list; _i < list_1.length; _i++) {\n var _a = list_1[_i], x = _a.x, y = _a.y;\n this._x_sorted.push(x);\n this._y_sorted.push(y);\n }\n this._sorted_dirty = false;\n };\n return Interpolator;\n }(transform_1.Transform));\n exports.Interpolator = Interpolator;\n Interpolator.initClass();\n}\n","/* models/transforms/jitter */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var transform_1 = require(279) /* ./transform */;\n var factor_range_1 = require(181) /* ../ranges/factor_range */;\n var types_1 = require(44) /* core/util/types */;\n var p = require(15) /* core/properties */;\n var bokeh_math = require(31) /* core/util/math */;\n var Jitter = /** @class */ (function (_super) {\n tslib_1.__extends(Jitter, _super);\n function Jitter(attrs) {\n return _super.call(this, attrs) || this;\n }\n Jitter.initClass = function () {\n this.prototype.type = \"Jitter\";\n this.define({\n mean: [p.Number, 0],\n width: [p.Number, 1],\n distribution: [p.Distribution, 'uniform'],\n range: [p.Instance],\n });\n this.internal({\n previous_values: [p.Array],\n });\n };\n Jitter.prototype.v_compute = function (xs0) {\n if (this.previous_values != null && this.previous_values.length == xs0.length)\n return this.previous_values;\n var xs;\n if (this.range instanceof factor_range_1.FactorRange)\n xs = this.range.v_synthetic(xs0);\n else if (types_1.isArrayableOf(xs0, types_1.isNumber))\n xs = xs0;\n else\n throw new Error(\"unexpected\");\n var result = new Float64Array(xs.length);\n for (var i = 0; i < xs.length; i++) {\n var x = xs[i];\n result[i] = this._compute(x);\n }\n this.previous_values = result;\n return result;\n };\n Jitter.prototype.compute = function (x) {\n if (this.range instanceof factor_range_1.FactorRange)\n return this._compute(this.range.synthetic(x));\n else if (types_1.isNumber(x))\n return this._compute(x);\n else\n throw new Error(\"unexpected\");\n };\n Jitter.prototype._compute = function (x) {\n switch (this.distribution) {\n case \"uniform\":\n return x + this.mean + (bokeh_math.random() - 0.5) * this.width;\n case \"normal\":\n return x + bokeh_math.rnorm(this.mean, this.width);\n }\n };\n return Jitter;\n }(transform_1.Transform));\n exports.Jitter = Jitter;\n Jitter.initClass();\n}\n","/* models/transforms/linear_interpolator */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var array_1 = require(21) /* core/util/array */;\n var interpolator_1 = require(275) /* ./interpolator */;\n var LinearInterpolator = /** @class */ (function (_super) {\n tslib_1.__extends(LinearInterpolator, _super);\n function LinearInterpolator(attrs) {\n return _super.call(this, attrs) || this;\n }\n LinearInterpolator.initClass = function () {\n this.prototype.type = \"LinearInterpolator\";\n };\n LinearInterpolator.prototype.compute = function (x) {\n this.sort(false);\n if (this.clip) {\n if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1])\n return NaN;\n }\n else {\n if (x < this._x_sorted[0])\n return this._y_sorted[0];\n if (x > this._x_sorted[this._x_sorted.length - 1])\n return this._y_sorted[this._y_sorted.length - 1];\n }\n if (x == this._x_sorted[0])\n return this._y_sorted[0];\n var ind = array_1.findLastIndex(this._x_sorted, function (num) { return num < x; });\n var x1 = this._x_sorted[ind];\n var x2 = this._x_sorted[ind + 1];\n var y1 = this._y_sorted[ind];\n var y2 = this._y_sorted[ind + 1];\n return y1 + (((x - x1) / (x2 - x1)) * (y2 - y1));\n };\n return LinearInterpolator;\n }(interpolator_1.Interpolator));\n exports.LinearInterpolator = LinearInterpolator;\n LinearInterpolator.initClass();\n}\n","/* models/transforms/step_interpolator */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var interpolator_1 = require(275) /* ./interpolator */;\n var p = require(15) /* core/properties */;\n var array_1 = require(21) /* core/util/array */;\n var StepInterpolator = /** @class */ (function (_super) {\n tslib_1.__extends(StepInterpolator, _super);\n function StepInterpolator(attrs) {\n return _super.call(this, attrs) || this;\n }\n StepInterpolator.initClass = function () {\n this.prototype.type = \"StepInterpolator\";\n this.define({\n mode: [p.StepMode, \"after\"],\n });\n };\n StepInterpolator.prototype.compute = function (x) {\n this.sort(false);\n if (this.clip) {\n if (x < this._x_sorted[0] || x > this._x_sorted[this._x_sorted.length - 1])\n return NaN;\n }\n else {\n if (x < this._x_sorted[0])\n return this._y_sorted[0];\n if (x > this._x_sorted[this._x_sorted.length - 1])\n return this._y_sorted[this._y_sorted.length - 1];\n }\n var ind;\n switch (this.mode) {\n case \"after\": {\n ind = array_1.findLastIndex(this._x_sorted, function (num) { return x >= num; });\n break;\n }\n case \"before\": {\n ind = array_1.findIndex(this._x_sorted, function (num) { return x <= num; });\n break;\n }\n case \"center\": {\n var diffs = this._x_sorted.map(function (tx) { return Math.abs(tx - x); });\n var mdiff_1 = array_1.min(diffs);\n ind = array_1.findIndex(diffs, function (num) { return mdiff_1 === num; });\n break;\n }\n default:\n throw new Error(\"unknown mode: \" + this.mode);\n }\n return ind != -1 ? this._y_sorted[ind] : NaN;\n };\n return StepInterpolator;\n }(interpolator_1.Interpolator));\n exports.StepInterpolator = StepInterpolator;\n StepInterpolator.initClass();\n}\n","/* models/transforms/transform */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n var model_1 = require(59) /* ../../model */;\n var Transform = /** @class */ (function (_super) {\n tslib_1.__extends(Transform, _super);\n function Transform(attrs) {\n return _super.call(this, attrs) || this;\n }\n Transform.initClass = function () {\n this.prototype.type = \"Transform\";\n };\n return Transform;\n }(model_1.Model));\n exports.Transform = Transform;\n Transform.initClass();\n}\n","/* polyfill */ function _(require, module, exports) {\n if (typeof WeakMap !== \"function\") {\n require(342) /* es6-weak-map/implement */;\n }\n // ref: https://github.com/bokeh/bokeh/issues/7373\n if (!Number.isInteger) {\n Number.isInteger = function (value) {\n return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;\n };\n }\n var String_proto = String.prototype;\n if (!String_proto.repeat) {\n String_proto.repeat = function (count) {\n if (this == null) {\n throw new TypeError('can\\'t convert ' + this + ' to object');\n }\n var str = '' + this;\n count = +count;\n if (count != count) {\n count = 0;\n }\n if (count < 0) {\n throw new RangeError('repeat count must be non-negative');\n }\n if (count == Infinity) {\n throw new RangeError('repeat count must be less than infinity');\n }\n count = Math.floor(count);\n if (str.length == 0 || count == 0) {\n return '';\n }\n // Ensuring count is a 31-bit integer allows us to heavily optimize the\n // main part. But anyway, most current (August 2014) browsers can't handle\n // strings 1 << 28 chars or longer, so:\n if (str.length * count >= 1 << 28) {\n throw new RangeError('repeat count must not overflow maximum string size');\n }\n var rpt = '';\n for (;;) {\n if ((count & 1) == 1) {\n rpt += str;\n }\n count >>>= 1;\n if (count == 0) {\n break;\n }\n str += str;\n }\n // Could we try:\n // return Array(count + 1).join(this);\n return rpt;\n };\n }\n // Production steps of ECMA-262, Edition 6, 22.1.2.1\n if (!Array.from) {\n Array.from = (function () {\n var toStr = Object.prototype.toString;\n var isCallable = function (fn) {\n return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n };\n var toInteger = function (value) {\n var number = Number(value);\n if (isNaN(number)) {\n return 0;\n }\n if (number === 0 || !isFinite(number)) {\n return number;\n }\n return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n };\n var maxSafeInteger = Math.pow(2, 53) - 1;\n var toLength = function (value) {\n var len = toInteger(value);\n return Math.min(Math.max(len, 0), maxSafeInteger);\n };\n // The length property of the from method is 1.\n return function from(arrayLike /*, mapFn, thisArg */) {\n // 1. Let C be the this value.\n var C = this;\n // 2. Let items be ToObject(arrayLike).\n var items = Object(arrayLike);\n // 3. ReturnIfAbrupt(items).\n if (arrayLike == null) {\n throw new TypeError('Array.from requires an array-like object - not null or undefined');\n }\n // 4. If mapfn is undefined, then let mapping be false.\n var mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n var T;\n if (typeof mapFn !== 'undefined') {\n // 5. else\n // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n if (!isCallable(mapFn)) {\n throw new TypeError('Array.from: when provided, the second argument must be a function');\n }\n // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\n if (arguments.length > 2) {\n T = arguments[2];\n }\n }\n // 10. Let lenValue be Get(items, \"length\").\n // 11. Let len be ToLength(lenValue).\n var len = toLength(items.length);\n // 13. If IsConstructor(C) is true, then\n // 13. a. Let A be the result of calling the [[Construct]] internal method\n // of C with an argument list containing the single item len.\n // 14. a. Else, Let A be ArrayCreate(len).\n var A = isCallable(C) ? Object(new C(len)) : new Array(len);\n // 16. Let k be 0.\n var k = 0;\n // 17. Repeat, while k < len… (also steps a - h)\n while (k < len) {\n var kValue = items[k];\n if (mapFn) {\n A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\n }\n else {\n A[k] = kValue;\n }\n k += 1;\n }\n // 18. Let putStatus be Put(A, \"length\", len, true).\n A.length = len;\n // 20. Return A.\n return A;\n };\n }());\n }\n}\n","/* protocol/index */ function _(require, module, exports) {\n var tslib_1 = require(391) /* tslib */;\n tslib_1.__exportStar(require(282) /* ./message */, exports);\n tslib_1.__exportStar(require(283) /* ./receiver */, exports);\n}\n","/* protocol/message */ function _(require, module, exports) {\n var string_1 = require(38) /* core/util/string */;\n var Message = /** @class */ (function () {\n function Message(header, metadata, content) {\n this.header = header;\n this.metadata = metadata;\n this.content = content;\n this.buffers = [];\n }\n Message.assemble = function (header_json, metadata_json, content_json) {\n var header = JSON.parse(header_json);\n var metadata = JSON.parse(metadata_json);\n var content = JSON.parse(content_json);\n return new Message(header, metadata, content);\n };\n Message.prototype.assemble_buffer = function (buf_header, buf_payload) {\n var nb = this.header.num_buffers != null ? this.header.num_buffers : 0;\n if (nb <= this.buffers.length)\n throw new Error(\"too many buffers received, expecting #{nb}\");\n this.buffers.push([buf_header, buf_payload]);\n };\n // not defined for BokehJS, only *receiving* buffers is supported\n // add_buffer: (buf_header, buf_payload) ->\n // write_buffers: (socket)\n Message.create = function (msgtype, metadata, content) {\n if (content === void 0) {\n content = {};\n }\n var header = Message.create_header(msgtype);\n return new Message(header, metadata, content);\n };\n Message.create_header = function (msgtype) {\n return {\n msgid: string_1.uniqueId(),\n msgtype: msgtype,\n };\n };\n Message.prototype.complete = function () {\n if (this.header != null && this.metadata != null && this.content != null) {\n if ('num_buffers' in this.header)\n return this.buffers.length === this.header.num_buffers;\n else\n return true;\n }\n else\n return false;\n };\n Message.prototype.send = function (socket) {\n var nb = this.header.num_buffers != null ? this.header.num_buffers : 0;\n if (nb > 0)\n throw new Error(\"BokehJS only supports receiving buffers, not sending\");\n var header_json = JSON.stringify(this.header);\n var metadata_json = JSON.stringify(this.metadata);\n var content_json = JSON.stringify(this.content);\n socket.send(header_json);\n socket.send(metadata_json);\n socket.send(content_json);\n };\n Message.prototype.msgid = function () {\n return this.header.msgid;\n };\n Message.prototype.msgtype = function () {\n return this.header.msgtype;\n };\n Message.prototype.reqid = function () {\n return this.header.reqid;\n };\n // return the reason we should close on bad protocol, if there is one\n Message.prototype.problem = function () {\n if (!('msgid' in this.header))\n return \"No msgid in header\";\n else if (!('msgtype' in this.header))\n return \"No msgtype in header\";\n else\n return null;\n };\n return Message;\n }());\n exports.Message = Message;\n}\n","/* protocol/receiver */ function _(require, module, exports) {\n var message_1 = require(282) /* protocol/message */;\n var Receiver = /** @class */ (function () {\n function Receiver() {\n this.message = null;\n this._partial = null;\n this._fragments = [];\n this._buf_header = null;\n this._current_consumer = this._HEADER;\n }\n Receiver.prototype.consume = function (fragment) {\n this._current_consumer(fragment);\n };\n Receiver.prototype._HEADER = function (fragment) {\n this._assume_text(fragment);\n this.message = null;\n this._partial = null;\n this._fragments = [fragment];\n this._buf_header = null;\n this._current_consumer = this._METADATA;\n };\n Receiver.prototype._METADATA = function (fragment) {\n this._assume_text(fragment);\n this._fragments.push(fragment);\n this._current_consumer = this._CONTENT;\n };\n Receiver.prototype._CONTENT = function (fragment) {\n this._assume_text(fragment);\n this._fragments.push(fragment);\n var _a = this._fragments.slice(0, 3), header_json = _a[0], metadata_json = _a[1], content_json = _a[2];\n this._partial = message_1.Message.assemble(header_json, metadata_json, content_json);\n this._check_complete();\n };\n Receiver.prototype._BUFFER_HEADER = function (fragment) {\n this._assume_text(fragment);\n this._buf_header = fragment; // XXX: assume text but Header is expected\n this._current_consumer = this._BUFFER_PAYLOAD;\n };\n Receiver.prototype._BUFFER_PAYLOAD = function (fragment) {\n this._assume_binary(fragment);\n this._partial.assemble_buffer(this._buf_header, fragment);\n this._check_complete();\n };\n Receiver.prototype._assume_text = function (fragment) {\n if (fragment instanceof ArrayBuffer)\n throw new Error(\"Expected text fragment but received binary fragment\");\n };\n Receiver.prototype._assume_binary = function (fragment) {\n if (!(fragment instanceof ArrayBuffer))\n throw new Error(\"Expected binary fragment but received text fragment\");\n };\n Receiver.prototype._check_complete = function () {\n if (this._partial.complete()) {\n this.message = this._partial;\n this._current_consumer = this._HEADER;\n }\n else\n this._current_consumer = this._BUFFER_HEADER;\n };\n return Receiver;\n }());\n exports.Receiver = Receiver;\n}\n","/* safely */ function _(require, module, exports) {\n function _burst_into_flames(error) {\n // Make box\n var box = document.createElement(\"div\");\n box.style.backgroundColor = \"#f2dede\";\n box.style.border = \"1px solid #a94442\";\n box.style.borderRadius = \"4px\";\n box.style.display = \"inline-block\";\n box.style.fontFamily = \"sans-serif\";\n box.style.marginTop = \"5px\";\n box.style.minWidth = \"200px\";\n box.style.padding = \"5px 5px 5px 10px\";\n box.classList.add(\"bokeh-error-box-into-flames\");\n // Make button\n var button = document.createElement(\"span\");\n button.style.backgroundColor = \"#a94442\";\n button.style.borderRadius = \"0px 4px 0px 0px\";\n button.style.color = \"white\";\n button.style.cursor = \"pointer\";\n button.style.cssFloat = \"right\";\n button.style.fontSize = \"0.8em\";\n button.style.margin = \"-6px -6px 0px 0px\";\n button.style.padding = \"2px 5px 4px 5px\";\n button.title = \"close\";\n button.setAttribute(\"aria-label\", \"close\");\n button.appendChild(document.createTextNode(\"x\"));\n button.addEventListener(\"click\", function () { return body.removeChild(box); });\n // Make title\n var title = document.createElement(\"h3\");\n title.style.color = \"#a94442\";\n title.style.margin = \"8px 0px 0px 0px\";\n title.style.padding = \"0px\";\n title.appendChild(document.createTextNode(\"Bokeh Error\"));\n // Make message\n var message = document.createElement(\"pre\");\n message.style.whiteSpace = \"unset\";\n message.style.overflowX = \"auto\";\n var text = error instanceof Error ? error.message : error;\n message.appendChild(document.createTextNode(text));\n // Add pieces to box\n box.appendChild(button);\n box.appendChild(title);\n box.appendChild(message);\n // Put box in doc\n var body = document.getElementsByTagName(\"body\")[0];\n body.insertBefore(box, body.firstChild);\n }\n function safely(fn, silent) {\n if (silent === void 0) {\n silent = false;\n }\n try {\n return fn();\n }\n catch (error) {\n _burst_into_flames(error);\n if (!silent)\n throw error;\n else\n return;\n }\n }\n exports.safely = safely;\n}\n","/* testing */ function _(require, module, exports) {\n // Just a dumb key/value record for collecting arbitrary info for tests\n exports.results = {};\n // Selenium has race conditions that make it difficult to read out the\n // results structure. This function deletes/creates a div that can act as\n // a semaphore. Tests should wait for the previous div to be stale, then\n // find the new div. At that point the results should be available\n function _update_test_div() {\n var body = document.getElementsByTagName(\"body\")[0];\n var col = document.getElementsByClassName(\"bokeh-test-div\");\n if (col.length == 1)\n body.removeChild(col[0]);\n delete col[0];\n var box = document.createElement(\"div\");\n box.classList.add(\"bokeh-test-div\");\n box.style.display = \"none\";\n body.insertBefore(box, body.firstChild);\n }\n function init() {\n _update_test_div();\n }\n exports.init = init;\n function record(key, value) {\n exports.results[key] = value;\n _update_test_div();\n }\n exports.record = record;\n function count(key) {\n if (exports.results[key] == undefined)\n exports.results[key] = 0;\n exports.results[key] += 1;\n _update_test_div();\n }\n exports.count = count;\n function clear() {\n for (var _i = 0, _a = Object.keys(exports.results); _i < _a.length; _i++) {\n var prop = _a[_i];\n delete exports.results[prop];\n }\n _update_test_div();\n }\n exports.clear = clear;\n}\n","/* version */ function _(require, module, exports) {\n exports.version = '1.0.1';\n}\n","/* canvas2svg/canvas2svg */ function _(require, module, exports) {\n /*!!\n * Canvas 2 Svg v1.0.21\n * A low level canvas to SVG converter. Uses a mock canvas context to build an SVG document.\n *\n * Licensed under the MIT license:\n * http://www.opensource.org/licenses/mit-license.php\n *\n * Author:\n * Kerry Liu\n *\n * Copyright (c) 2014 Gliffy Inc.\n */\n ;\n (function () {\n \"use strict\";\n var STYLES, ctx, CanvasGradient, CanvasPattern, namedEntities;\n //helper function to format a string\n function format(str, args) {\n var keys = Object.keys(args), i;\n for (i = 0; i < keys.length; i++) {\n str = str.replace(new RegExp(\"\\\\{\" + keys[i] + \"\\\\}\", \"gi\"), args[keys[i]]);\n }\n return str;\n }\n //helper function that generates a random string\n function randomString(holder) {\n var chars, randomstring, i;\n if (!holder) {\n throw new Error(\"cannot create a random attribute name for an undefined object\");\n }\n chars = \"ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz\";\n randomstring = \"\";\n do {\n randomstring = \"\";\n for (i = 0; i < 12; i++) {\n randomstring += chars[Math.floor(Math.random() * chars.length)];\n }\n } while (holder[randomstring]);\n return randomstring;\n }\n //helper function to map named to numbered entities\n function createNamedToNumberedLookup(items, radix) {\n var i, entity, lookup = {}, base10, base16;\n items = items.split(',');\n radix = radix || 10;\n // Map from named to numbered entities.\n for (i = 0; i < items.length; i += 2) {\n entity = '&' + items[i + 1] + ';';\n base10 = parseInt(items[i], radix);\n lookup[entity] = '&#' + base10 + ';';\n }\n //FF and IE need to create a regex from hex values ie   == \\xa0\n lookup[\"\\\\xa0\"] = ' ';\n return lookup;\n }\n //helper function to map canvas-textAlign to svg-textAnchor\n function getTextAnchor(textAlign) {\n //TODO: support rtl languages\n var mapping = { \"left\": \"start\", \"right\": \"end\", \"center\": \"middle\", \"start\": \"start\", \"end\": \"end\" };\n return mapping[textAlign] || mapping.start;\n }\n //helper function to map canvas-textBaseline to svg-dominantBaseline\n function getDominantBaseline(textBaseline) {\n //INFO: not supported in all browsers\n var mapping = { \"alphabetic\": \"alphabetic\", \"hanging\": \"hanging\", \"top\": \"text-before-edge\", \"bottom\": \"text-after-edge\", \"middle\": \"central\" };\n return mapping[textBaseline] || mapping.alphabetic;\n }\n // Unpack entities lookup where the numbers are in radix 32 to reduce the size\n // entity mapping courtesy of tinymce\n namedEntities = createNamedToNumberedLookup('50,nbsp,51,iexcl,52,cent,53,pound,54,curren,55,yen,56,brvbar,57,sect,58,uml,59,copy,' +\n '5a,ordf,5b,laquo,5c,not,5d,shy,5e,reg,5f,macr,5g,deg,5h,plusmn,5i,sup2,5j,sup3,5k,acute,' +\n '5l,micro,5m,para,5n,middot,5o,cedil,5p,sup1,5q,ordm,5r,raquo,5s,frac14,5t,frac12,5u,frac34,' +\n '5v,iquest,60,Agrave,61,Aacute,62,Acirc,63,Atilde,64,Auml,65,Aring,66,AElig,67,Ccedil,' +\n '68,Egrave,69,Eacute,6a,Ecirc,6b,Euml,6c,Igrave,6d,Iacute,6e,Icirc,6f,Iuml,6g,ETH,6h,Ntilde,' +\n '6i,Ograve,6j,Oacute,6k,Ocirc,6l,Otilde,6m,Ouml,6n,times,6o,Oslash,6p,Ugrave,6q,Uacute,' +\n '6r,Ucirc,6s,Uuml,6t,Yacute,6u,THORN,6v,szlig,70,agrave,71,aacute,72,acirc,73,atilde,74,auml,' +\n '75,aring,76,aelig,77,ccedil,78,egrave,79,eacute,7a,ecirc,7b,euml,7c,igrave,7d,iacute,7e,icirc,' +\n '7f,iuml,7g,eth,7h,ntilde,7i,ograve,7j,oacute,7k,ocirc,7l,otilde,7m,ouml,7n,divide,7o,oslash,' +\n '7p,ugrave,7q,uacute,7r,ucirc,7s,uuml,7t,yacute,7u,thorn,7v,yuml,ci,fnof,sh,Alpha,si,Beta,' +\n 'sj,Gamma,sk,Delta,sl,Epsilon,sm,Zeta,sn,Eta,so,Theta,sp,Iota,sq,Kappa,sr,Lambda,ss,Mu,' +\n 'st,Nu,su,Xi,sv,Omicron,t0,Pi,t1,Rho,t3,Sigma,t4,Tau,t5,Upsilon,t6,Phi,t7,Chi,t8,Psi,' +\n 't9,Omega,th,alpha,ti,beta,tj,gamma,tk,delta,tl,epsilon,tm,zeta,tn,eta,to,theta,tp,iota,' +\n 'tq,kappa,tr,lambda,ts,mu,tt,nu,tu,xi,tv,omicron,u0,pi,u1,rho,u2,sigmaf,u3,sigma,u4,tau,' +\n 'u5,upsilon,u6,phi,u7,chi,u8,psi,u9,omega,uh,thetasym,ui,upsih,um,piv,812,bull,816,hellip,' +\n '81i,prime,81j,Prime,81u,oline,824,frasl,88o,weierp,88h,image,88s,real,892,trade,89l,alefsym,' +\n '8cg,larr,8ch,uarr,8ci,rarr,8cj,darr,8ck,harr,8dl,crarr,8eg,lArr,8eh,uArr,8ei,rArr,8ej,dArr,' +\n '8ek,hArr,8g0,forall,8g2,part,8g3,exist,8g5,empty,8g7,nabla,8g8,isin,8g9,notin,8gb,ni,8gf,prod,' +\n '8gh,sum,8gi,minus,8gn,lowast,8gq,radic,8gt,prop,8gu,infin,8h0,ang,8h7,and,8h8,or,8h9,cap,8ha,cup,' +\n '8hb,int,8hk,there4,8hs,sim,8i5,cong,8i8,asymp,8j0,ne,8j1,equiv,8j4,le,8j5,ge,8k2,sub,8k3,sup,8k4,' +\n 'nsub,8k6,sube,8k7,supe,8kl,oplus,8kn,otimes,8l5,perp,8m5,sdot,8o8,lceil,8o9,rceil,8oa,lfloor,8ob,' +\n 'rfloor,8p9,lang,8pa,rang,9ea,loz,9j0,spades,9j3,clubs,9j5,hearts,9j6,diams,ai,OElig,aj,oelig,b0,' +\n 'Scaron,b1,scaron,bo,Yuml,m6,circ,ms,tilde,802,ensp,803,emsp,809,thinsp,80c,zwnj,80d,zwj,80e,lrm,' +\n '80f,rlm,80j,ndash,80k,mdash,80o,lsquo,80p,rsquo,80q,sbquo,80s,ldquo,80t,rdquo,80u,bdquo,810,dagger,' +\n '811,Dagger,81g,permil,81p,lsaquo,81q,rsaquo,85c,euro', 32);\n //Some basic mappings for attributes and default values.\n STYLES = {\n \"strokeStyle\": {\n svgAttr: \"stroke\",\n canvas: \"#000000\",\n svg: \"none\",\n apply: \"stroke\" //apply on stroke() or fill()\n },\n \"fillStyle\": {\n svgAttr: \"fill\",\n canvas: \"#000000\",\n svg: null,\n apply: \"fill\"\n },\n \"lineCap\": {\n svgAttr: \"stroke-linecap\",\n canvas: \"butt\",\n svg: \"butt\",\n apply: \"stroke\"\n },\n \"lineJoin\": {\n svgAttr: \"stroke-linejoin\",\n canvas: \"miter\",\n svg: \"miter\",\n apply: \"stroke\"\n },\n \"miterLimit\": {\n svgAttr: \"stroke-miterlimit\",\n canvas: 10,\n svg: 4,\n apply: \"stroke\"\n },\n \"lineWidth\": {\n svgAttr: \"stroke-width\",\n canvas: 1,\n svg: 1,\n apply: \"stroke\"\n },\n \"globalAlpha\": {\n svgAttr: \"opacity\",\n canvas: 1,\n svg: 1,\n apply: \"fill stroke\"\n },\n \"font\": {\n //font converts to multiple svg attributes, there is custom logic for this\n canvas: \"10px sans-serif\"\n },\n \"shadowColor\": {\n canvas: \"#000000\"\n },\n \"shadowOffsetX\": {\n canvas: 0\n },\n \"shadowOffsetY\": {\n canvas: 0\n },\n \"shadowBlur\": {\n canvas: 0\n },\n \"textAlign\": {\n canvas: \"start\"\n },\n \"textBaseline\": {\n canvas: \"alphabetic\"\n },\n \"lineDash\": {\n svgAttr: \"stroke-dasharray\",\n canvas: [],\n svg: null,\n apply: \"stroke\"\n }\n };\n /**\n *\n * @param gradientNode - reference to the gradient\n * @constructor\n */\n CanvasGradient = function (gradientNode, ctx) {\n this.__root = gradientNode;\n this.__ctx = ctx;\n };\n /**\n * Adds a color stop to the gradient root\n */\n CanvasGradient.prototype.addColorStop = function (offset, color) {\n var stop = this.__ctx.__createElement(\"stop\"), regex, matches;\n stop.setAttribute(\"offset\", offset);\n if (color.indexOf(\"rgba\") !== -1) {\n //separate alpha value, since webkit can't handle it\n regex = /rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d?\\.?\\d*)\\s*\\)/gi;\n matches = regex.exec(color);\n stop.setAttribute(\"stop-color\", format(\"rgb({r},{g},{b})\", { r: matches[1], g: matches[2], b: matches[3] }));\n stop.setAttribute(\"stop-opacity\", matches[4]);\n }\n else {\n stop.setAttribute(\"stop-color\", color);\n }\n this.__root.appendChild(stop);\n };\n CanvasPattern = function (pattern, ctx) {\n this.__root = pattern;\n this.__ctx = ctx;\n };\n /**\n * The mock canvas context\n * @param o - options include:\n * ctx - existing Context2D to wrap around\n * width - width of your canvas (defaults to 500)\n * height - height of your canvas (defaults to 500)\n * enableMirroring - enables canvas mirroring (get image data) (defaults to false)\n * document - the document object (defaults to the current document)\n */\n ctx = function (o) {\n var defaultOptions = { width: 500, height: 500, enableMirroring: false }, options;\n //keep support for this way of calling C2S: new C2S(width,height)\n if (arguments.length > 1) {\n options = defaultOptions;\n options.width = arguments[0];\n options.height = arguments[1];\n }\n else if (!o) {\n options = defaultOptions;\n }\n else {\n options = o;\n }\n if (!(this instanceof ctx)) {\n //did someone call this without new?\n return new ctx(options);\n }\n //setup options\n this.width = options.width || defaultOptions.width;\n this.height = options.height || defaultOptions.height;\n this.enableMirroring = options.enableMirroring !== undefined ? options.enableMirroring : defaultOptions.enableMirroring;\n this.canvas = this; ///point back to this instance!\n this.__document = options.document || document;\n // allow passing in an existing context to wrap around\n // if a context is passed in, we know a canvas already exist\n if (options.ctx) {\n this.__ctx = options.ctx;\n }\n else {\n this.__canvas = this.__document.createElement(\"canvas\");\n this.__ctx = this.__canvas.getContext(\"2d\");\n }\n this.__setDefaultStyles();\n this.__stack = [this.__getStyleState()];\n this.__groupStack = [];\n //the root svg element\n this.__root = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n this.__root.setAttribute(\"version\", 1.1);\n this.__root.setAttribute(\"xmlns\", \"http://www.w3.org/2000/svg\");\n this.__root.setAttributeNS(\"http://www.w3.org/2000/xmlns/\", \"xmlns:xlink\", \"http://www.w3.org/1999/xlink\");\n this.__root.setAttribute(\"width\", this.width);\n this.__root.setAttribute(\"height\", this.height);\n //make sure we don't generate the same ids in defs\n this.__ids = {};\n //defs tag\n this.__defs = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"defs\");\n this.__root.appendChild(this.__defs);\n //also add a group child. the svg element can't use the transform attribute\n this.__currentElement = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n this.__root.appendChild(this.__currentElement);\n };\n /**\n * Creates the specified svg element\n * @private\n */\n ctx.prototype.__createElement = function (elementName, properties, resetFill) {\n if (typeof properties === \"undefined\") {\n properties = {};\n }\n var element = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", elementName), keys = Object.keys(properties), i, key;\n if (resetFill) {\n //if fill or stroke is not specified, the svg element should not display. By default SVG's fill is black.\n element.setAttribute(\"fill\", \"none\");\n element.setAttribute(\"stroke\", \"none\");\n }\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n element.setAttribute(key, properties[key]);\n }\n return element;\n };\n /**\n * Applies default canvas styles to the context\n * @private\n */\n ctx.prototype.__setDefaultStyles = function () {\n //default 2d canvas context properties see:http://www.w3.org/TR/2dcontext/\n var keys = Object.keys(STYLES), i, key;\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this[key] = STYLES[key].canvas;\n }\n };\n /**\n * Applies styles on restore\n * @param styleState\n * @private\n */\n ctx.prototype.__applyStyleState = function (styleState) {\n var keys = Object.keys(styleState), i, key;\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n this[key] = styleState[key];\n }\n };\n /**\n * Gets the current style state\n * @return {Object}\n * @private\n */\n ctx.prototype.__getStyleState = function () {\n var i, styleState = {}, keys = Object.keys(STYLES), key;\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n styleState[key] = this[key];\n }\n return styleState;\n };\n /**\n * Apples the current styles to the current SVG element. On \"ctx.fill\" or \"ctx.stroke\"\n * @param type\n * @private\n */\n ctx.prototype.__applyStyleToCurrentElement = function (type) {\n var currentElement = this.__currentElement;\n var currentStyleGroup = this.__currentElementsToStyle;\n if (currentStyleGroup) {\n currentElement.setAttribute(type, \"\");\n currentElement = currentStyleGroup.element;\n currentStyleGroup.children.forEach(function (node) {\n node.setAttribute(type, \"\");\n });\n }\n var keys = Object.keys(STYLES), i, style, value, id, regex, matches;\n for (i = 0; i < keys.length; i++) {\n style = STYLES[keys[i]];\n value = this[keys[i]];\n if (style.apply) {\n //is this a gradient or pattern?\n if (value instanceof CanvasPattern) {\n //pattern\n if (value.__ctx) {\n //copy over defs\n while (value.__ctx.__defs.childNodes.length) {\n id = value.__ctx.__defs.childNodes[0].getAttribute(\"id\");\n this.__ids[id] = id;\n this.__defs.appendChild(value.__ctx.__defs.childNodes[0]);\n }\n }\n currentElement.setAttribute(style.apply, format(\"url(#{id})\", { id: value.__root.getAttribute(\"id\") }));\n }\n else if (value instanceof CanvasGradient) {\n //gradient\n currentElement.setAttribute(style.apply, format(\"url(#{id})\", { id: value.__root.getAttribute(\"id\") }));\n }\n else if (style.apply.indexOf(type) !== -1 && style.svg !== value) {\n if ((style.svgAttr === \"stroke\" || style.svgAttr === \"fill\") && value.indexOf(\"rgba\") !== -1) {\n //separate alpha value, since illustrator can't handle it\n regex = /rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d?\\.?\\d*)\\s*\\)/gi;\n matches = regex.exec(value);\n currentElement.setAttribute(style.svgAttr, format(\"rgb({r},{g},{b})\", { r: matches[1], g: matches[2], b: matches[3] }));\n //should take globalAlpha here\n var opacity = matches[4];\n var globalAlpha = this.globalAlpha;\n if (globalAlpha != null) {\n opacity *= globalAlpha;\n }\n currentElement.setAttribute(style.svgAttr + \"-opacity\", opacity);\n }\n else {\n var attr = style.svgAttr;\n if (keys[i] === 'globalAlpha') {\n attr = type + '-' + style.svgAttr;\n if (currentElement.getAttribute(attr)) {\n //fill-opacity or stroke-opacity has already been set by stroke or fill.\n continue;\n }\n }\n //otherwise only update attribute if right type, and not svg default\n currentElement.setAttribute(attr, value);\n }\n }\n }\n }\n };\n /**\n * Will return the closest group or svg node. May return the current element.\n * @private\n */\n ctx.prototype.__closestGroupOrSvg = function (node) {\n node = node || this.__currentElement;\n if (node.nodeName === \"g\" || node.nodeName === \"svg\") {\n return node;\n }\n else {\n return this.__closestGroupOrSvg(node.parentNode);\n }\n };\n /**\n * Returns the serialized value of the svg so far\n * @param fixNamedEntities - Standalone SVG doesn't support named entities, which document.createTextNode encodes.\n * If true, we attempt to find all named entities and encode it as a numeric entity.\n * @return serialized svg\n */\n ctx.prototype.getSerializedSvg = function (fixNamedEntities) {\n var serialized = new XMLSerializer().serializeToString(this.__root), keys, i, key, value, regexp, xmlns;\n //IE search for a duplicate xmnls because they didn't implement setAttributeNS correctly\n xmlns = /xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg\".+xmlns=\"http:\\/\\/www\\.w3\\.org\\/2000\\/svg/gi;\n if (xmlns.test(serialized)) {\n serialized = serialized.replace('xmlns=\"http://www.w3.org/2000/svg', 'xmlns:xlink=\"http://www.w3.org/1999/xlink');\n }\n if (fixNamedEntities) {\n keys = Object.keys(namedEntities);\n //loop over each named entity and replace with the proper equivalent.\n for (i = 0; i < keys.length; i++) {\n key = keys[i];\n value = namedEntities[key];\n regexp = new RegExp(key, \"gi\");\n if (regexp.test(serialized)) {\n serialized = serialized.replace(regexp, value);\n }\n }\n }\n return serialized;\n };\n /**\n * Returns the root svg\n * @return\n */\n ctx.prototype.getSvg = function () {\n return this.__root;\n };\n /**\n * Will generate a group tag.\n */\n ctx.prototype.save = function () {\n var group = this.__createElement(\"g\");\n var parent = this.__closestGroupOrSvg();\n this.__groupStack.push(parent);\n parent.appendChild(group);\n this.__currentElement = group;\n this.__stack.push(this.__getStyleState());\n };\n /**\n * Sets current element to parent, or just root if already root\n */\n ctx.prototype.restore = function () {\n this.__currentElement = this.__groupStack.pop();\n this.__currentElementsToStyle = null;\n //Clearing canvas will make the poped group invalid, currentElement is set to the root group node.\n if (!this.__currentElement) {\n this.__currentElement = this.__root.childNodes[1];\n }\n var state = this.__stack.pop();\n this.__applyStyleState(state);\n };\n /**\n * Helper method to add transform\n * @private\n */\n ctx.prototype.__addTransform = function (t) {\n //if the current element has siblings, add another group\n var parent = this.__closestGroupOrSvg();\n if (parent.childNodes.length > 0) {\n if (this.__currentElement.nodeName === \"path\") {\n if (!this.__currentElementsToStyle)\n this.__currentElementsToStyle = { element: parent, children: [] };\n this.__currentElementsToStyle.children.push(this.__currentElement);\n this.__applyCurrentDefaultPath();\n }\n var group = this.__createElement(\"g\");\n parent.appendChild(group);\n this.__currentElement = group;\n }\n var transform = this.__currentElement.getAttribute(\"transform\");\n if (transform) {\n transform += \" \";\n }\n else {\n transform = \"\";\n }\n transform += t;\n this.__currentElement.setAttribute(\"transform\", transform);\n };\n /**\n * scales the current element\n */\n ctx.prototype.scale = function (x, y) {\n if (y === undefined) {\n y = x;\n }\n this.__addTransform(format(\"scale({x},{y})\", { x: x, y: y }));\n };\n /**\n * rotates the current element\n */\n ctx.prototype.rotate = function (angle) {\n var degrees = (angle * 180 / Math.PI);\n this.__addTransform(format(\"rotate({angle},{cx},{cy})\", { angle: degrees, cx: 0, cy: 0 }));\n };\n /**\n * translates the current element\n */\n ctx.prototype.translate = function (x, y) {\n this.__addTransform(format(\"translate({x},{y})\", { x: x, y: y }));\n };\n /**\n * applies a transform to the current element\n */\n ctx.prototype.transform = function (a, b, c, d, e, f) {\n this.__addTransform(format(\"matrix({a},{b},{c},{d},{e},{f})\", { a: a, b: b, c: c, d: d, e: e, f: f }));\n };\n /**\n * Create a new Path Element\n */\n ctx.prototype.beginPath = function () {\n var path, parent;\n // Note that there is only one current default path, it is not part of the drawing state.\n // See also: https://html.spec.whatwg.org/multipage/scripting.html#current-default-path\n this.__currentDefaultPath = \"\";\n this.__currentPosition = {};\n path = this.__createElement(\"path\", {}, true);\n parent = this.__closestGroupOrSvg();\n parent.appendChild(path);\n this.__currentElement = path;\n };\n /**\n * Helper function to apply currentDefaultPath to current path element\n * @private\n */\n ctx.prototype.__applyCurrentDefaultPath = function () {\n var currentElement = this.__currentElement;\n if (currentElement.nodeName === \"path\") {\n currentElement.setAttribute(\"d\", this.__currentDefaultPath);\n }\n else {\n console.error(\"Attempted to apply path command to node\", currentElement.nodeName);\n }\n };\n /**\n * Helper function to add path command\n * @private\n */\n ctx.prototype.__addPathCommand = function (command) {\n this.__currentDefaultPath += \" \";\n this.__currentDefaultPath += command;\n };\n /**\n * Adds the move command to the current path element,\n * if the currentPathElement is not empty create a new path element\n */\n ctx.prototype.moveTo = function (x, y) {\n if (this.__currentElement.nodeName !== \"path\") {\n this.beginPath();\n }\n // creates a new subpath with the given point\n this.__currentPosition = { x: x, y: y };\n this.__addPathCommand(format(\"M {x} {y}\", { x: x, y: y }));\n };\n /**\n * Closes the current path\n */\n ctx.prototype.closePath = function () {\n if (this.__currentDefaultPath) {\n this.__addPathCommand(\"Z\");\n }\n };\n /**\n * Adds a line to command\n */\n ctx.prototype.lineTo = function (x, y) {\n this.__currentPosition = { x: x, y: y };\n if (this.__currentDefaultPath.indexOf('M') > -1) {\n this.__addPathCommand(format(\"L {x} {y}\", { x: x, y: y }));\n }\n else {\n this.__addPathCommand(format(\"M {x} {y}\", { x: x, y: y }));\n }\n };\n /**\n * Add a bezier command\n */\n ctx.prototype.bezierCurveTo = function (cp1x, cp1y, cp2x, cp2y, x, y) {\n this.__currentPosition = { x: x, y: y };\n this.__addPathCommand(format(\"C {cp1x} {cp1y} {cp2x} {cp2y} {x} {y}\", { cp1x: cp1x, cp1y: cp1y, cp2x: cp2x, cp2y: cp2y, x: x, y: y }));\n };\n /**\n * Adds a quadratic curve to command\n */\n ctx.prototype.quadraticCurveTo = function (cpx, cpy, x, y) {\n this.__currentPosition = { x: x, y: y };\n this.__addPathCommand(format(\"Q {cpx} {cpy} {x} {y}\", { cpx: cpx, cpy: cpy, x: x, y: y }));\n };\n /**\n * Return a new normalized vector of given vector\n */\n var normalize = function (vector) {\n var len = Math.sqrt(vector[0] * vector[0] + vector[1] * vector[1]);\n return [vector[0] / len, vector[1] / len];\n };\n /**\n * Adds the arcTo to the current path\n *\n * @see http://www.w3.org/TR/2015/WD-2dcontext-20150514/#dom-context-2d-arcto\n */\n ctx.prototype.arcTo = function (x1, y1, x2, y2, radius) {\n // Let the point (x0, y0) be the last point in the subpath.\n var x0 = this.__currentPosition && this.__currentPosition.x;\n var y0 = this.__currentPosition && this.__currentPosition.y;\n // First ensure there is a subpath for (x1, y1).\n if (typeof x0 == \"undefined\" || typeof y0 == \"undefined\") {\n return;\n }\n // Negative values for radius must cause the implementation to throw an IndexSizeError exception.\n if (radius < 0) {\n throw new Error(\"IndexSizeError: The radius provided (\" + radius + \") is negative.\");\n }\n // If the point (x0, y0) is equal to the point (x1, y1),\n // or if the point (x1, y1) is equal to the point (x2, y2),\n // or if the radius radius is zero,\n // then the method must add the point (x1, y1) to the subpath,\n // and connect that point to the previous point (x0, y0) by a straight line.\n if (((x0 === x1) && (y0 === y1))\n || ((x1 === x2) && (y1 === y2))\n || (radius === 0)) {\n this.lineTo(x1, y1);\n return;\n }\n // Otherwise, if the points (x0, y0), (x1, y1), and (x2, y2) all lie on a single straight line,\n // then the method must add the point (x1, y1) to the subpath,\n // and connect that point to the previous point (x0, y0) by a straight line.\n var unit_vec_p1_p0 = normalize([x0 - x1, y0 - y1]);\n var unit_vec_p1_p2 = normalize([x2 - x1, y2 - y1]);\n if (unit_vec_p1_p0[0] * unit_vec_p1_p2[1] === unit_vec_p1_p0[1] * unit_vec_p1_p2[0]) {\n this.lineTo(x1, y1);\n return;\n }\n // Otherwise, let The Arc be the shortest arc given by circumference of the circle that has radius radius,\n // and that has one point tangent to the half-infinite line that crosses the point (x0, y0) and ends at the point (x1, y1),\n // and that has a different point tangent to the half-infinite line that ends at the point (x1, y1), and crosses the point (x2, y2).\n // The points at which this circle touches these two lines are called the start and end tangent points respectively.\n // note that both vectors are unit vectors, so the length is 1\n var cos = (unit_vec_p1_p0[0] * unit_vec_p1_p2[0] + unit_vec_p1_p0[1] * unit_vec_p1_p2[1]);\n var theta = Math.acos(Math.abs(cos));\n // Calculate origin\n var unit_vec_p1_origin = normalize([\n unit_vec_p1_p0[0] + unit_vec_p1_p2[0],\n unit_vec_p1_p0[1] + unit_vec_p1_p2[1]\n ]);\n var len_p1_origin = radius / Math.sin(theta / 2);\n var x = x1 + len_p1_origin * unit_vec_p1_origin[0];\n var y = y1 + len_p1_origin * unit_vec_p1_origin[1];\n // Calculate start angle and end angle\n // rotate 90deg clockwise (note that y axis points to its down)\n var unit_vec_origin_start_tangent = [\n -unit_vec_p1_p0[1],\n unit_vec_p1_p0[0]\n ];\n // rotate 90deg counter clockwise (note that y axis points to its down)\n var unit_vec_origin_end_tangent = [\n unit_vec_p1_p2[1],\n -unit_vec_p1_p2[0]\n ];\n var getAngle = function (vector) {\n // get angle (clockwise) between vector and (1, 0)\n var x = vector[0];\n var y = vector[1];\n if (y >= 0) { // note that y axis points to its down\n return Math.acos(x);\n }\n else {\n return -Math.acos(x);\n }\n };\n var startAngle = getAngle(unit_vec_origin_start_tangent);\n var endAngle = getAngle(unit_vec_origin_end_tangent);\n // Connect the point (x0, y0) to the start tangent point by a straight line\n this.lineTo(x + unit_vec_origin_start_tangent[0] * radius, y + unit_vec_origin_start_tangent[1] * radius);\n // Connect the start tangent point to the end tangent point by arc\n // and adding the end tangent point to the subpath.\n this.arc(x, y, radius, startAngle, endAngle);\n };\n /**\n * Sets the stroke property on the current element\n */\n ctx.prototype.stroke = function () {\n if (this.__currentElement.nodeName === \"path\") {\n this.__currentElement.setAttribute(\"paint-order\", \"fill stroke markers\");\n }\n this.__applyCurrentDefaultPath();\n this.__applyStyleToCurrentElement(\"stroke\");\n };\n /**\n * Sets fill properties on the current element\n */\n ctx.prototype.fill = function () {\n if (this.__currentElement.nodeName === \"path\") {\n this.__currentElement.setAttribute(\"paint-order\", \"stroke fill markers\");\n }\n this.__applyCurrentDefaultPath();\n this.__applyStyleToCurrentElement(\"fill\");\n };\n /**\n * Adds a rectangle to the path.\n */\n ctx.prototype.rect = function (x, y, width, height) {\n if (this.__currentElement.nodeName !== \"path\") {\n this.beginPath();\n }\n this.moveTo(x, y);\n this.lineTo(x + width, y);\n this.lineTo(x + width, y + height);\n this.lineTo(x, y + height);\n this.lineTo(x, y);\n this.closePath();\n };\n /**\n * adds a rectangle element\n */\n ctx.prototype.fillRect = function (x, y, width, height) {\n var rect, parent;\n rect = this.__createElement(\"rect\", {\n x: x,\n y: y,\n width: width,\n height: height\n }, true);\n parent = this.__closestGroupOrSvg();\n parent.appendChild(rect);\n this.__currentElement = rect;\n this.__applyStyleToCurrentElement(\"fill\");\n };\n /**\n * Draws a rectangle with no fill\n * @param x\n * @param y\n * @param width\n * @param height\n */\n ctx.prototype.strokeRect = function (x, y, width, height) {\n var rect, parent;\n rect = this.__createElement(\"rect\", {\n x: x,\n y: y,\n width: width,\n height: height\n }, true);\n parent = this.__closestGroupOrSvg();\n parent.appendChild(rect);\n this.__currentElement = rect;\n this.__applyStyleToCurrentElement(\"stroke\");\n };\n /**\n * Clear entire canvas:\n * 1. save current transforms\n * 2. remove all the childNodes of the root g element\n */\n ctx.prototype.__clearCanvas = function () {\n var current = this.__closestGroupOrSvg(), transform = current.getAttribute(\"transform\");\n var rootGroup = this.__root.childNodes[1];\n var childNodes = rootGroup.childNodes;\n for (var i = childNodes.length - 1; i >= 0; i--) {\n if (childNodes[i]) {\n rootGroup.removeChild(childNodes[i]);\n }\n }\n this.__currentElement = rootGroup;\n //reset __groupStack as all the child group nodes are all removed.\n this.__groupStack = [];\n if (transform) {\n this.__addTransform(transform);\n }\n };\n /**\n * \"Clears\" a canvas by just drawing a white rectangle in the current group.\n */\n ctx.prototype.clearRect = function (x, y, width, height) {\n //clear entire canvas\n if (x === 0 && y === 0 && width === this.width && height === this.height) {\n this.__clearCanvas();\n return;\n }\n var rect, parent = this.__closestGroupOrSvg();\n rect = this.__createElement(\"rect\", {\n x: x,\n y: y,\n width: width,\n height: height,\n fill: \"#FFFFFF\"\n }, true);\n parent.appendChild(rect);\n };\n /**\n * Adds a linear gradient to a defs tag.\n * Returns a canvas gradient object that has a reference to it's parent def\n */\n ctx.prototype.createLinearGradient = function (x1, y1, x2, y2) {\n var grad = this.__createElement(\"linearGradient\", {\n id: randomString(this.__ids),\n x1: x1 + \"px\",\n x2: x2 + \"px\",\n y1: y1 + \"px\",\n y2: y2 + \"px\",\n \"gradientUnits\": \"userSpaceOnUse\"\n }, false);\n this.__defs.appendChild(grad);\n return new CanvasGradient(grad, this);\n };\n /**\n * Adds a radial gradient to a defs tag.\n * Returns a canvas gradient object that has a reference to it's parent def\n */\n ctx.prototype.createRadialGradient = function (x0, y0, r0, x1, y1, r1) {\n var grad = this.__createElement(\"radialGradient\", {\n id: randomString(this.__ids),\n cx: x1 + \"px\",\n cy: y1 + \"px\",\n r: r1 + \"px\",\n fx: x0 + \"px\",\n fy: y0 + \"px\",\n \"gradientUnits\": \"userSpaceOnUse\"\n }, false);\n this.__defs.appendChild(grad);\n return new CanvasGradient(grad, this);\n };\n /**\n * Parses the font string and returns svg mapping\n * @private\n */\n ctx.prototype.__parseFont = function () {\n var regex = /^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00))?)(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?(?:small|large)|medium|smaller|larger|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))(?:\\s*\\/\\s*(normal|[.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])))?\\s*([-,\\'\\\"\\sa-z0-9]+?)\\s*$/i;\n var fontPart = regex.exec(this.font);\n var data = {\n style: fontPart[1] || 'normal',\n size: fontPart[4] || '10px',\n family: fontPart[6] || 'sans-serif',\n weight: fontPart[3] || 'normal',\n decoration: fontPart[2] || 'normal',\n href: null\n };\n //canvas doesn't support underline natively, but we can pass this attribute\n if (this.__fontUnderline === \"underline\") {\n data.decoration = \"underline\";\n }\n //canvas also doesn't support linking, but we can pass this as well\n if (this.__fontHref) {\n data.href = this.__fontHref;\n }\n return data;\n };\n /**\n * Helper to link text fragments\n * @param font\n * @param element\n * @return {*}\n * @private\n */\n ctx.prototype.__wrapTextLink = function (font, element) {\n if (font.href) {\n var a = this.__createElement(\"a\");\n a.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", font.href);\n a.appendChild(element);\n return a;\n }\n return element;\n };\n /**\n * Fills or strokes text\n * @param text\n * @param x\n * @param y\n * @param action - stroke or fill\n * @private\n */\n ctx.prototype.__applyText = function (text, x, y, action) {\n var font = this.__parseFont(), parent = this.__closestGroupOrSvg(), textElement = this.__createElement(\"text\", {\n \"font-family\": font.family,\n \"font-size\": font.size,\n \"font-style\": font.style,\n \"font-weight\": font.weight,\n \"text-decoration\": font.decoration,\n \"x\": x,\n \"y\": y,\n \"text-anchor\": getTextAnchor(this.textAlign),\n \"dominant-baseline\": getDominantBaseline(this.textBaseline)\n }, true);\n textElement.appendChild(this.__document.createTextNode(text));\n this.__currentElement = textElement;\n this.__applyStyleToCurrentElement(action);\n parent.appendChild(this.__wrapTextLink(font, textElement));\n };\n /**\n * Creates a text element\n * @param text\n * @param x\n * @param y\n */\n ctx.prototype.fillText = function (text, x, y) {\n this.__applyText(text, x, y, \"fill\");\n };\n /**\n * Strokes text\n * @param text\n * @param x\n * @param y\n */\n ctx.prototype.strokeText = function (text, x, y) {\n this.__applyText(text, x, y, \"stroke\");\n };\n /**\n * No need to implement this for svg.\n * @param text\n * @return {TextMetrics}\n */\n ctx.prototype.measureText = function (text) {\n this.__ctx.font = this.font;\n return this.__ctx.measureText(text);\n };\n /**\n * Arc command!\n */\n ctx.prototype.arc = function (x, y, radius, startAngle, endAngle, counterClockwise) {\n // in canvas no circle is drawn if no angle is provided.\n if (startAngle === endAngle) {\n return;\n }\n startAngle = startAngle % (2 * Math.PI);\n endAngle = endAngle % (2 * Math.PI);\n if (startAngle === endAngle) {\n //circle time! subtract some of the angle so svg is happy (svg elliptical arc can't draw a full circle)\n endAngle = ((endAngle + (2 * Math.PI)) - 0.001 * (counterClockwise ? -1 : 1)) % (2 * Math.PI);\n }\n var endX = x + radius * Math.cos(endAngle), endY = y + radius * Math.sin(endAngle), startX = x + radius * Math.cos(startAngle), startY = y + radius * Math.sin(startAngle), sweepFlag = counterClockwise ? 0 : 1, largeArcFlag = 0, diff = endAngle - startAngle;\n // https://github.com/gliffy/canvas2svg/issues/4\n if (diff < 0) {\n diff += 2 * Math.PI;\n }\n if (counterClockwise) {\n largeArcFlag = diff > Math.PI ? 0 : 1;\n }\n else {\n largeArcFlag = diff > Math.PI ? 1 : 0;\n }\n this.lineTo(startX, startY);\n this.__addPathCommand(format(\"A {rx} {ry} {xAxisRotation} {largeArcFlag} {sweepFlag} {endX} {endY}\", { rx: radius, ry: radius, xAxisRotation: 0, largeArcFlag: largeArcFlag, sweepFlag: sweepFlag, endX: endX, endY: endY }));\n this.__currentPosition = { x: endX, y: endY };\n };\n /**\n * Generates a ClipPath from the clip command.\n */\n ctx.prototype.clip = function () {\n var group = this.__closestGroupOrSvg(), clipPath = this.__createElement(\"clipPath\"), id = randomString(this.__ids), newGroup = this.__createElement(\"g\");\n this.__applyCurrentDefaultPath();\n group.removeChild(this.__currentElement);\n clipPath.setAttribute(\"id\", id);\n clipPath.appendChild(this.__currentElement);\n this.__defs.appendChild(clipPath);\n //set the clip path to this group\n group.setAttribute(\"clip-path\", format(\"url(#{id})\", { id: id }));\n //clip paths can be scaled and transformed, we need to add another wrapper group to avoid later transformations\n // to this path\n group.appendChild(newGroup);\n this.__currentElement = newGroup;\n };\n /**\n * Draws a canvas, image or mock context to this canvas.\n * Note that all svg dom manipulation uses node.childNodes rather than node.children for IE support.\n * http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#dom-context-2d-drawimage\n */\n ctx.prototype.drawImage = function () {\n //convert arguments to a real array\n var args = Array.prototype.slice.call(arguments), image = args[0], dx, dy, dw, dh, sx = 0, sy = 0, sw, sh, parent, svg, defs, group, currentElement, svgImage, canvas, context, id;\n if (args.length === 3) {\n dx = args[1];\n dy = args[2];\n sw = image.width;\n sh = image.height;\n dw = sw;\n dh = sh;\n }\n else if (args.length === 5) {\n dx = args[1];\n dy = args[2];\n dw = args[3];\n dh = args[4];\n sw = image.width;\n sh = image.height;\n }\n else if (args.length === 9) {\n sx = args[1];\n sy = args[2];\n sw = args[3];\n sh = args[4];\n dx = args[5];\n dy = args[6];\n dw = args[7];\n dh = args[8];\n }\n else {\n throw new Error(\"Inavlid number of arguments passed to drawImage: \" + arguments.length);\n }\n parent = this.__closestGroupOrSvg();\n currentElement = this.__currentElement;\n var translateDirective = \"translate(\" + dx + \", \" + dy + \")\";\n if (image instanceof ctx) {\n //canvas2svg mock canvas context. In the future we may want to clone nodes instead.\n //also I'm currently ignoring dw, dh, sw, sh, sx, sy for a mock context.\n svg = image.getSvg().cloneNode(true);\n if (svg.childNodes && svg.childNodes.length > 1) {\n defs = svg.childNodes[0];\n while (defs.childNodes.length) {\n id = defs.childNodes[0].getAttribute(\"id\");\n this.__ids[id] = id;\n this.__defs.appendChild(defs.childNodes[0]);\n }\n group = svg.childNodes[1];\n if (group) {\n //save original transform\n var originTransform = group.getAttribute(\"transform\");\n var transformDirective;\n if (originTransform) {\n transformDirective = originTransform + \" \" + translateDirective;\n }\n else {\n transformDirective = translateDirective;\n }\n group.setAttribute(\"transform\", transformDirective);\n parent.appendChild(group);\n }\n }\n }\n else if (image.nodeName === \"IMG\") {\n svgImage = this.__createElement(\"image\");\n svgImage.setAttribute(\"width\", dw);\n svgImage.setAttribute(\"height\", dh);\n svgImage.setAttribute(\"preserveAspectRatio\", \"none\");\n if (sx || sy || sw !== image.width || sh !== image.height) {\n //crop the image using a temporary canvas\n canvas = this.__document.createElement(\"canvas\");\n canvas.width = dw;\n canvas.height = dh;\n context = canvas.getContext(\"2d\");\n context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);\n image = canvas;\n }\n svgImage.setAttribute(\"transform\", translateDirective);\n svgImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", image.nodeName === \"CANVAS\" ? image.toDataURL() : image.getAttribute(\"src\"));\n parent.appendChild(svgImage);\n }\n else if (image.nodeName === \"CANVAS\") {\n svgImage = this.__createElement(\"image\");\n svgImage.setAttribute(\"width\", dw);\n svgImage.setAttribute(\"height\", dh);\n svgImage.setAttribute(\"preserveAspectRatio\", \"none\");\n // draw canvas onto temporary canvas so that smoothing can be handled\n canvas = this.__document.createElement(\"canvas\");\n canvas.width = dw;\n canvas.height = dh;\n context = canvas.getContext(\"2d\");\n context.imageSmoothingEnabled = false;\n context.mozImageSmoothingEnabled = false;\n context.oImageSmoothingEnabled = false;\n context.webkitImageSmoothingEnabled = false;\n context.drawImage(image, sx, sy, sw, sh, 0, 0, dw, dh);\n image = canvas;\n svgImage.setAttribute(\"transform\", translateDirective);\n svgImage.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", image.toDataURL());\n parent.appendChild(svgImage);\n }\n };\n /**\n * Generates a pattern tag\n */\n ctx.prototype.createPattern = function (image, repetition) {\n var pattern = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"pattern\"), id = randomString(this.__ids), img;\n pattern.setAttribute(\"id\", id);\n pattern.setAttribute(\"width\", image.width);\n pattern.setAttribute(\"height\", image.height);\n if (image.nodeName === \"CANVAS\" || image.nodeName === \"IMG\") {\n img = this.__document.createElementNS(\"http://www.w3.org/2000/svg\", \"image\");\n img.setAttribute(\"width\", image.width);\n img.setAttribute(\"height\", image.height);\n img.setAttributeNS(\"http://www.w3.org/1999/xlink\", \"xlink:href\", image.nodeName === \"CANVAS\" ? image.toDataURL() : image.getAttribute(\"src\"));\n pattern.appendChild(img);\n this.__defs.appendChild(pattern);\n }\n else if (image instanceof ctx) {\n pattern.appendChild(image.__root.childNodes[1]);\n this.__defs.appendChild(pattern);\n }\n return new CanvasPattern(pattern, this);\n };\n ctx.prototype.setLineDash = function (dashArray) {\n if (dashArray && dashArray.length > 0) {\n this.lineDash = dashArray.join(\",\");\n }\n else {\n this.lineDash = null;\n }\n };\n /**\n * Not yet implemented\n */\n ctx.prototype.drawFocusRing = function () { };\n ctx.prototype.createImageData = function () { };\n ctx.prototype.getImageData = function () { };\n ctx.prototype.putImageData = function () { };\n ctx.prototype.globalCompositeOperation = function () { };\n ctx.prototype.setTransform = function () { };\n //add options for alternative namespace\n if (typeof window === \"object\") {\n window.C2S = ctx;\n }\n // CommonJS/Browserify\n if (typeof module === \"object\" && typeof module.exports === \"object\") {\n module.exports = ctx;\n }\n }());\n}\n","/* d/auto-bind */ function _(require, module, exports) {\n var copy = require(307) /* es5-ext/object/copy */, normalizeOptions = require(317) /* es5-ext/object/normalize-options */, ensureCallable = require(321) /* es5-ext/object/valid-callable */, map = require(316) /* es5-ext/object/map */, callable = require(321) /* es5-ext/object/valid-callable */, validValue = require(323) /* es5-ext/object/valid-value */, bind = Function.prototype.bind, defineProperty = Object.defineProperty, hasOwnProperty = Object.prototype.hasOwnProperty, define;\n define = function (name, desc, options) {\n var value = validValue(desc) && callable(desc.value), dgs;\n dgs = copy(desc);\n delete dgs.writable;\n delete dgs.value;\n dgs.get = function () {\n if (!options.overwriteDefinition && hasOwnProperty.call(this, name))\n return value;\n desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);\n defineProperty(this, name, desc);\n return this[name];\n };\n return dgs;\n };\n module.exports = function (props /*, options*/) {\n var options = normalizeOptions(arguments[1]);\n if (options.resolveContext != null)\n ensureCallable(options.resolveContext);\n return map(props, function (desc, name) { return define(name, desc, options); });\n };\n}\n","/* d/index */ function _(require, module, exports) {\n var assign = require(304) /* es5-ext/object/assign */, normalizeOpts = require(317) /* es5-ext/object/normalize-options */, isCallable = require(310) /* es5-ext/object/is-callable */, contains = require(324) /* es5-ext/string/#/contains */, d;\n d = module.exports = function (dscr, value /*, options*/) {\n var c, e, w, options, desc;\n if ((arguments.length < 2) || (typeof dscr !== 'string')) {\n options = value;\n value = dscr;\n dscr = null;\n }\n else {\n options = arguments[2];\n }\n if (dscr == null) {\n c = w = true;\n e = false;\n }\n else {\n c = contains.call(dscr, 'c');\n e = contains.call(dscr, 'e');\n w = contains.call(dscr, 'w');\n }\n desc = { value: value, configurable: c, enumerable: e, writable: w };\n return !options ? desc : assign(normalizeOpts(options), desc);\n };\n d.gs = function (dscr, get, set /*, options*/) {\n var c, e, options, desc;\n if (typeof dscr !== 'string') {\n options = set;\n set = get;\n get = dscr;\n dscr = null;\n }\n else {\n options = arguments[3];\n }\n if (get == null) {\n get = undefined;\n }\n else if (!isCallable(get)) {\n options = get;\n get = set = undefined;\n }\n else if (set == null) {\n set = undefined;\n }\n else if (!isCallable(set)) {\n options = set;\n set = undefined;\n }\n if (dscr == null) {\n c = true;\n e = false;\n }\n else {\n c = contains.call(dscr, 'c');\n e = contains.call(dscr, 'e');\n }\n desc = { get: get, set: set, configurable: c, enumerable: e };\n return !options ? desc : assign(normalizeOpts(options), desc);\n };\n}\n","/* es5-ext/array/#/clear */ function _(require, module, exports) {\n var value = require(323) /* ../../object/valid-value */;\n module.exports = function () {\n value(this).length = 0;\n return this;\n };\n}\n","/* es5-ext/array/from/index */ function _(require, module, exports) {\n module.exports = require(292) /* ./is-implemented */()\n ? Array.from\n : require(293) /* ./shim */;\n}\n","/* es5-ext/array/from/is-implemented */ function _(require, module, exports) {\n module.exports = function () {\n var from = Array.from, arr, result;\n if (typeof from !== \"function\")\n return false;\n arr = [\"raz\", \"dwa\"];\n result = from(arr);\n return Boolean(result && (result !== arr) && (result[1] === \"dwa\"));\n };\n}\n","/* es5-ext/array/from/shim */ function _(require, module, exports) {\n var iteratorSymbol = require(337) /* es6-symbol */.iterator, isArguments = require(294) /* ../../function/is-arguments */, isFunction = require(295) /* ../../function/is-function */, toPosInt = require(302) /* ../../number/to-pos-integer */, callable = require(321) /* ../../object/valid-callable */, validValue = require(323) /* ../../object/valid-value */, isValue = require(312) /* ../../object/is-value */, isString = require(327) /* ../../string/is-string */, isArray = Array.isArray, call = Function.prototype.call, desc = { configurable: true, enumerable: true, writable: true, value: null }, defineProperty = Object.defineProperty;\n // eslint-disable-next-line complexity\n module.exports = function (arrayLike /*, mapFn, thisArg*/) {\n var mapFn = arguments[1], thisArg = arguments[2], Context, i, j, arr, length, code, iterator, result, getIterator, value;\n arrayLike = Object(validValue(arrayLike));\n if (isValue(mapFn))\n callable(mapFn);\n if (!this || this === Array || !isFunction(this)) {\n // Result: Plain array\n if (!mapFn) {\n if (isArguments(arrayLike)) {\n // Source: Arguments\n length = arrayLike.length;\n if (length !== 1)\n return Array.apply(null, arrayLike);\n arr = new Array(1);\n arr[0] = arrayLike[0];\n return arr;\n }\n if (isArray(arrayLike)) {\n // Source: Array\n arr = new Array(length = arrayLike.length);\n for (i = 0; i < length; ++i)\n arr[i] = arrayLike[i];\n return arr;\n }\n }\n arr = [];\n }\n else {\n // Result: Non plain array\n Context = this;\n }\n if (!isArray(arrayLike)) {\n if ((getIterator = arrayLike[iteratorSymbol]) !== undefined) {\n // Source: Iterator\n iterator = callable(getIterator).call(arrayLike);\n if (Context)\n arr = new Context();\n result = iterator.next();\n i = 0;\n while (!result.done) {\n value = mapFn ? call.call(mapFn, thisArg, result.value, i) : result.value;\n if (Context) {\n desc.value = value;\n defineProperty(arr, i, desc);\n }\n else {\n arr[i] = value;\n }\n result = iterator.next();\n ++i;\n }\n length = i;\n }\n else if (isString(arrayLike)) {\n // Source: String\n length = arrayLike.length;\n if (Context)\n arr = new Context();\n for (i = 0, j = 0; i < length; ++i) {\n value = arrayLike[i];\n if (i + 1 < length) {\n code = value.charCodeAt(0);\n // eslint-disable-next-line max-depth\n if (code >= 0xd800 && code <= 0xdbff)\n value += arrayLike[++i];\n }\n value = mapFn ? call.call(mapFn, thisArg, value, j) : value;\n if (Context) {\n desc.value = value;\n defineProperty(arr, j, desc);\n }\n else {\n arr[j] = value;\n }\n ++j;\n }\n length = j;\n }\n }\n if (length === undefined) {\n // Source: array or array-like\n length = toPosInt(arrayLike.length);\n if (Context)\n arr = new Context(length);\n for (i = 0; i < length; ++i) {\n value = mapFn ? call.call(mapFn, thisArg, arrayLike[i], i) : arrayLike[i];\n if (Context) {\n desc.value = value;\n defineProperty(arr, i, desc);\n }\n else {\n arr[i] = value;\n }\n }\n }\n if (Context) {\n desc.value = null;\n arr.length = length;\n }\n return arr;\n };\n}\n","/* es5-ext/function/is-arguments */ function _(require, module, exports) {\n var objToString = Object.prototype.toString, id = objToString.call((function () {\n return arguments;\n })());\n module.exports = function (value) {\n return objToString.call(value) === id;\n };\n}\n","/* es5-ext/function/is-function */ function _(require, module, exports) {\n var objToString = Object.prototype.toString, id = objToString.call(require(296) /* ./noop */);\n module.exports = function (value) {\n return typeof value === \"function\" && objToString.call(value) === id;\n };\n}\n","/* es5-ext/function/noop */ function _(require, module, exports) {\n // eslint-disable-next-line no-empty-function\n module.exports = function () { };\n}\n","/* es5-ext/global */ function _(require, module, exports) {\n /* eslint strict: \"off\" */\n module.exports = (function () {\n return this;\n }());\n}\n","/* es5-ext/math/sign/index */ function _(require, module, exports) {\n module.exports = require(299) /* ./is-implemented */()\n ? Math.sign\n : require(300) /* ./shim */;\n}\n","/* es5-ext/math/sign/is-implemented */ function _(require, module, exports) {\n module.exports = function () {\n var sign = Math.sign;\n if (typeof sign !== \"function\")\n return false;\n return (sign(10) === 1) && (sign(-20) === -1);\n };\n}\n","/* es5-ext/math/sign/shim */ function _(require, module, exports) {\n module.exports = function (value) {\n value = Number(value);\n if (isNaN(value) || (value === 0))\n return value;\n return value > 0 ? 1 : -1;\n };\n}\n","/* es5-ext/number/to-integer */ function _(require, module, exports) {\n var sign = require(298) /* ../math/sign */, abs = Math.abs, floor = Math.floor;\n module.exports = function (value) {\n if (isNaN(value))\n return 0;\n value = Number(value);\n if ((value === 0) || !isFinite(value))\n return value;\n return sign(value) * floor(abs(value));\n };\n}\n","/* es5-ext/number/to-pos-integer */ function _(require, module, exports) {\n var toInteger = require(301) /* ./to-integer */, max = Math.max;\n module.exports = function (value) {\n return max(0, toInteger(value));\n };\n}\n","/* es5-ext/object/_iterate */ function _(require, module, exports) {\n var callable = require(321) /* ./valid-callable */, value = require(323) /* ./valid-value */, bind = Function.prototype.bind, call = Function.prototype.call, keys = Object.keys, objPropertyIsEnumerable = Object.prototype.propertyIsEnumerable;\n module.exports = function (method, defVal) {\n return function (obj, cb /*, thisArg, compareFn*/) {\n var list, thisArg = arguments[2], compareFn = arguments[3];\n obj = Object(value(obj));\n callable(cb);\n list = keys(obj);\n if (compareFn) {\n list.sort(typeof compareFn === \"function\" ? bind.call(compareFn, obj) : undefined);\n }\n if (typeof method !== \"function\")\n method = list[method];\n return call.call(method, list, function (key, index) {\n if (!objPropertyIsEnumerable.call(obj, key))\n return defVal;\n return call.call(cb, thisArg, obj[key], key, obj, index);\n });\n };\n };\n}\n","/* es5-ext/object/assign/index */ function _(require, module, exports) {\n module.exports = require(305) /* ./is-implemented */()\n ? Object.assign\n : require(306) /* ./shim */;\n}\n","/* es5-ext/object/assign/is-implemented */ function _(require, module, exports) {\n module.exports = function () {\n var assign = Object.assign, obj;\n if (typeof assign !== \"function\")\n return false;\n obj = { foo: \"raz\" };\n assign(obj, { bar: \"dwa\" }, { trzy: \"trzy\" });\n return (obj.foo + obj.bar + obj.trzy) === \"razdwatrzy\";\n };\n}\n","/* es5-ext/object/assign/shim */ function _(require, module, exports) {\n var keys = require(313) /* ../keys */, value = require(323) /* ../valid-value */, max = Math.max;\n module.exports = function (dest, src /*, …srcn*/) {\n var error, i, length = max(arguments.length, 2), assign;\n dest = Object(value(dest));\n assign = function (key) {\n try {\n dest[key] = src[key];\n }\n catch (e) {\n if (!error)\n error = e;\n }\n };\n for (i = 1; i < length; ++i) {\n src = arguments[i];\n keys(src).forEach(assign);\n }\n if (error !== undefined)\n throw error;\n return dest;\n };\n}\n","/* es5-ext/object/copy */ function _(require, module, exports) {\n var aFrom = require(291) /* ../array/from */, assign = require(304) /* ./assign */, value = require(323) /* ./valid-value */;\n module.exports = function (obj /*, propertyNames, options*/) {\n var copy = Object(value(obj)), propertyNames = arguments[1], options = Object(arguments[2]);\n if (copy !== obj && !propertyNames)\n return copy;\n var result = {};\n if (propertyNames) {\n aFrom(propertyNames, function (propertyName) {\n if (options.ensure || propertyName in obj)\n result[propertyName] = obj[propertyName];\n });\n }\n else {\n assign(result, obj);\n }\n return result;\n };\n}\n","/* es5-ext/object/create */ function _(require, module, exports) {\n var create = Object.create, shim;\n if (!require(319) /* ./set-prototype-of/is-implemented */()) {\n shim = require(320) /* ./set-prototype-of/shim */;\n }\n module.exports = (function () {\n var nullObject, polyProps, desc;\n if (!shim)\n return create;\n if (shim.level !== 1)\n return create;\n nullObject = {};\n polyProps = {};\n desc = {\n configurable: false,\n enumerable: false,\n writable: true,\n value: undefined\n };\n Object.getOwnPropertyNames(Object.prototype).forEach(function (name) {\n if (name === \"__proto__\") {\n polyProps[name] = {\n configurable: true,\n enumerable: false,\n writable: true,\n value: undefined\n };\n return;\n }\n polyProps[name] = desc;\n });\n Object.defineProperties(nullObject, polyProps);\n Object.defineProperty(shim, \"nullPolyfill\", {\n configurable: false,\n enumerable: false,\n writable: false,\n value: nullObject\n });\n return function (prototype, props) {\n return create(prototype === null ? nullObject : prototype, props);\n };\n }());\n}\n","/* es5-ext/object/for-each */ function _(require, module, exports) {\n module.exports = require(303) /* ./_iterate */(\"forEach\");\n}\n","/* es5-ext/object/is-callable */ function _(require, module, exports) {\n module.exports = function (obj) {\n return typeof obj === \"function\";\n };\n}\n","/* es5-ext/object/is-object */ function _(require, module, exports) {\n var isValue = require(312) /* ./is-value */;\n var map = { function: true, object: true };\n module.exports = function (value) {\n return (isValue(value) && map[typeof value]) || false;\n };\n}\n","/* es5-ext/object/is-value */ function _(require, module, exports) {\n var _undefined = require(296) /* ../function/noop */(); // Support ES3 engines\n module.exports = function (val) {\n return (val !== _undefined) && (val !== null);\n };\n}\n","/* es5-ext/object/keys/index */ function _(require, module, exports) {\n module.exports = require(314) /* ./is-implemented */()\n ? Object.keys\n : require(315) /* ./shim */;\n}\n","/* es5-ext/object/keys/is-implemented */ function _(require, module, exports) {\n module.exports = function () {\n try {\n Object.keys(\"primitive\");\n return true;\n }\n catch (e) {\n return false;\n }\n };\n}\n","/* es5-ext/object/keys/shim */ function _(require, module, exports) {\n var isValue = require(312) /* ../is-value */;\n var keys = Object.keys;\n module.exports = function (object) {\n return keys(isValue(object) ? Object(object) : object);\n };\n}\n","/* es5-ext/object/map */ function _(require, module, exports) {\n var callable = require(321) /* ./valid-callable */, forEach = require(309) /* ./for-each */, call = Function.prototype.call;\n module.exports = function (obj, cb /*, thisArg*/) {\n var result = {}, thisArg = arguments[2];\n callable(cb);\n forEach(obj, function (value, key, targetObj, index) {\n result[key] = call.call(cb, thisArg, value, key, targetObj, index);\n });\n return result;\n };\n}\n","/* es5-ext/object/normalize-options */ function _(require, module, exports) {\n var isValue = require(312) /* ./is-value */;\n var forEach = Array.prototype.forEach, create = Object.create;\n var process = function (src, obj) {\n var key;\n for (key in src)\n obj[key] = src[key];\n };\n // eslint-disable-next-line no-unused-vars\n module.exports = function (opts1 /*, …options*/) {\n var result = create(null);\n forEach.call(arguments, function (options) {\n if (!isValue(options))\n return;\n process(Object(options), result);\n });\n return result;\n };\n}\n","/* es5-ext/object/set-prototype-of/index */ function _(require, module, exports) {\n module.exports = require(319) /* ./is-implemented */()\n ? Object.setPrototypeOf\n : require(320) /* ./shim */;\n}\n","/* es5-ext/object/set-prototype-of/is-implemented */ function _(require, module, exports) {\n var create = Object.create, getPrototypeOf = Object.getPrototypeOf, plainObject = {};\n module.exports = function ( /* CustomCreate*/) {\n var setPrototypeOf = Object.setPrototypeOf, customCreate = arguments[0] || create;\n if (typeof setPrototypeOf !== \"function\")\n return false;\n return getPrototypeOf(setPrototypeOf(customCreate(null), plainObject)) === plainObject;\n };\n}\n","/* es5-ext/object/set-prototype-of/shim */ function _(require, module, exports) {\n var isObject = require(311) /* ../is-object */, value = require(323) /* ../valid-value */, objIsPrototypeOf = Object.prototype.isPrototypeOf, defineProperty = Object.defineProperty, nullDesc = {\n configurable: true,\n enumerable: false,\n writable: true,\n value: undefined\n }, validate;\n validate = function (obj, prototype) {\n value(obj);\n if (prototype === null || isObject(prototype))\n return obj;\n throw new TypeError(\"Prototype must be null or an object\");\n };\n module.exports = (function (status) {\n var fn, set;\n if (!status)\n return null;\n if (status.level === 2) {\n if (status.set) {\n set = status.set;\n fn = function (obj, prototype) {\n set.call(validate(obj, prototype), prototype);\n return obj;\n };\n }\n else {\n fn = function (obj, prototype) {\n validate(obj, prototype).__proto__ = prototype;\n return obj;\n };\n }\n }\n else {\n fn = function self(obj, prototype) {\n var isNullBase;\n validate(obj, prototype);\n isNullBase = objIsPrototypeOf.call(self.nullPolyfill, obj);\n if (isNullBase)\n delete self.nullPolyfill.__proto__;\n if (prototype === null)\n prototype = self.nullPolyfill;\n obj.__proto__ = prototype;\n if (isNullBase)\n defineProperty(self.nullPolyfill, \"__proto__\", nullDesc);\n return obj;\n };\n }\n return Object.defineProperty(fn, \"level\", {\n configurable: false,\n enumerable: false,\n writable: false,\n value: status.level\n });\n }((function () {\n var tmpObj1 = Object.create(null), tmpObj2 = {}, set, desc = Object.getOwnPropertyDescriptor(Object.prototype, \"__proto__\");\n if (desc) {\n try {\n set = desc.set; // Opera crashes at this point\n set.call(tmpObj1, tmpObj2);\n }\n catch (ignore) { }\n if (Object.getPrototypeOf(tmpObj1) === tmpObj2)\n return { set: set, level: 2 };\n }\n tmpObj1.__proto__ = tmpObj2;\n if (Object.getPrototypeOf(tmpObj1) === tmpObj2)\n return { level: 2 };\n tmpObj1 = {};\n tmpObj1.__proto__ = tmpObj2;\n if (Object.getPrototypeOf(tmpObj1) === tmpObj2)\n return { level: 1 };\n return false;\n })()));\n require(308) /* ../create */;\n}\n","/* es5-ext/object/valid-callable */ function _(require, module, exports) {\n module.exports = function (fn) {\n if (typeof fn !== \"function\")\n throw new TypeError(fn + \" is not a function\");\n return fn;\n };\n}\n","/* es5-ext/object/valid-object */ function _(require, module, exports) {\n var isObject = require(311) /* ./is-object */;\n module.exports = function (value) {\n if (!isObject(value))\n throw new TypeError(value + \" is not an Object\");\n return value;\n };\n}\n","/* es5-ext/object/valid-value */ function _(require, module, exports) {\n var isValue = require(312) /* ./is-value */;\n module.exports = function (value) {\n if (!isValue(value))\n throw new TypeError(\"Cannot use null or undefined\");\n return value;\n };\n}\n","/* es5-ext/string/#/contains/index */ function _(require, module, exports) {\n module.exports = require(325) /* ./is-implemented */()\n ? String.prototype.contains\n : require(326) /* ./shim */;\n}\n","/* es5-ext/string/#/contains/is-implemented */ function _(require, module, exports) {\n var str = \"razdwatrzy\";\n module.exports = function () {\n if (typeof str.contains !== \"function\")\n return false;\n return (str.contains(\"dwa\") === true) && (str.contains(\"foo\") === false);\n };\n}\n","/* es5-ext/string/#/contains/shim */ function _(require, module, exports) {\n var indexOf = String.prototype.indexOf;\n module.exports = function (searchString /*, position*/) {\n return indexOf.call(this, searchString, arguments[1]) > -1;\n };\n}\n","/* es5-ext/string/is-string */ function _(require, module, exports) {\n var objToString = Object.prototype.toString, id = objToString.call(\"\");\n module.exports = function (value) {\n return (typeof value === \"string\" ||\n (value &&\n typeof value === \"object\" &&\n (value instanceof String || objToString.call(value) === id)) ||\n false);\n };\n}\n","/* es5-ext/string/random-uniq */ function _(require, module, exports) {\n var generated = Object.create(null), random = Math.random;\n module.exports = function () {\n var str;\n do {\n str = random()\n .toString(36)\n .slice(2);\n } while (generated[str]);\n return str;\n };\n}\n","/* es6-iterator/array */ function _(require, module, exports) {\n var setPrototypeOf = require(318) /* es5-ext/object/set-prototype-of */, contains = require(324) /* es5-ext/string/#/contains */, d = require(289) /* d */, Symbol = require(337) /* es6-symbol */, Iterator = require(332) /* ./ */;\n var defineProperty = Object.defineProperty, ArrayIterator;\n ArrayIterator = module.exports = function (arr, kind) {\n if (!(this instanceof ArrayIterator))\n throw new TypeError(\"Constructor requires 'new'\");\n Iterator.call(this, arr);\n if (!kind)\n kind = \"value\";\n else if (contains.call(kind, \"key+value\"))\n kind = \"key+value\";\n else if (contains.call(kind, \"key\"))\n kind = \"key\";\n else\n kind = \"value\";\n defineProperty(this, \"__kind__\", d(\"\", kind));\n };\n if (setPrototypeOf)\n setPrototypeOf(ArrayIterator, Iterator);\n // Internal %ArrayIteratorPrototype% doesn't expose its constructor\n delete ArrayIterator.prototype.constructor;\n ArrayIterator.prototype = Object.create(Iterator.prototype, {\n _resolve: d(function (i) {\n if (this.__kind__ === \"value\")\n return this.__list__[i];\n if (this.__kind__ === \"key+value\")\n return [i, this.__list__[i]];\n return i;\n })\n });\n defineProperty(ArrayIterator.prototype, Symbol.toStringTag, d(\"c\", \"Array Iterator\"));\n}\n","/* es6-iterator/for-of */ function _(require, module, exports) {\n var isArguments = require(294) /* es5-ext/function/is-arguments */, callable = require(321) /* es5-ext/object/valid-callable */, isString = require(327) /* es5-ext/string/is-string */, get = require(331) /* ./get */;\n var isArray = Array.isArray, call = Function.prototype.call, some = Array.prototype.some;\n module.exports = function (iterable, cb /*, thisArg*/) {\n var mode, thisArg = arguments[2], result, doBreak, broken, i, length, char, code;\n if (isArray(iterable) || isArguments(iterable))\n mode = \"array\";\n else if (isString(iterable))\n mode = \"string\";\n else\n iterable = get(iterable);\n callable(cb);\n doBreak = function () {\n broken = true;\n };\n if (mode === \"array\") {\n some.call(iterable, function (value) {\n call.call(cb, thisArg, value, doBreak);\n return broken;\n });\n return;\n }\n if (mode === \"string\") {\n length = iterable.length;\n for (i = 0; i < length; ++i) {\n char = iterable[i];\n if (i + 1 < length) {\n code = char.charCodeAt(0);\n if (code >= 0xd800 && code <= 0xdbff)\n char += iterable[++i];\n }\n call.call(cb, thisArg, char, doBreak);\n if (broken)\n break;\n }\n return;\n }\n result = iterable.next();\n while (!result.done) {\n call.call(cb, thisArg, result.value, doBreak);\n if (broken)\n return;\n result = iterable.next();\n }\n };\n}\n","/* es6-iterator/get */ function _(require, module, exports) {\n var isArguments = require(294) /* es5-ext/function/is-arguments */, isString = require(327) /* es5-ext/string/is-string */, ArrayIterator = require(329) /* ./array */, StringIterator = require(334) /* ./string */, iterable = require(335) /* ./valid-iterable */, iteratorSymbol = require(337) /* es6-symbol */.iterator;\n module.exports = function (obj) {\n if (typeof iterable(obj)[iteratorSymbol] === \"function\")\n return obj[iteratorSymbol]();\n if (isArguments(obj))\n return new ArrayIterator(obj);\n if (isString(obj))\n return new StringIterator(obj);\n return new ArrayIterator(obj);\n };\n}\n","/* es6-iterator/index */ function _(require, module, exports) {\n var clear = require(290) /* es5-ext/array/#/clear */, assign = require(304) /* es5-ext/object/assign */, callable = require(321) /* es5-ext/object/valid-callable */, value = require(323) /* es5-ext/object/valid-value */, d = require(289) /* d */, autoBind = require(288) /* d/auto-bind */, Symbol = require(337) /* es6-symbol */;\n var defineProperty = Object.defineProperty, defineProperties = Object.defineProperties, Iterator;\n module.exports = Iterator = function (list, context) {\n if (!(this instanceof Iterator))\n throw new TypeError(\"Constructor requires 'new'\");\n defineProperties(this, {\n __list__: d(\"w\", value(list)),\n __context__: d(\"w\", context),\n __nextIndex__: d(\"w\", 0)\n });\n if (!context)\n return;\n callable(context.on);\n context.on(\"_add\", this._onAdd);\n context.on(\"_delete\", this._onDelete);\n context.on(\"_clear\", this._onClear);\n };\n // Internal %IteratorPrototype% doesn't expose its constructor\n delete Iterator.prototype.constructor;\n defineProperties(Iterator.prototype, assign({\n _next: d(function () {\n var i;\n if (!this.__list__)\n return undefined;\n if (this.__redo__) {\n i = this.__redo__.shift();\n if (i !== undefined)\n return i;\n }\n if (this.__nextIndex__ < this.__list__.length)\n return this.__nextIndex__++;\n this._unBind();\n return undefined;\n }),\n next: d(function () {\n return this._createResult(this._next());\n }),\n _createResult: d(function (i) {\n if (i === undefined)\n return { done: true, value: undefined };\n return { done: false, value: this._resolve(i) };\n }),\n _resolve: d(function (i) {\n return this.__list__[i];\n }),\n _unBind: d(function () {\n this.__list__ = null;\n delete this.__redo__;\n if (!this.__context__)\n return;\n this.__context__.off(\"_add\", this._onAdd);\n this.__context__.off(\"_delete\", this._onDelete);\n this.__context__.off(\"_clear\", this._onClear);\n this.__context__ = null;\n }),\n toString: d(function () {\n return \"[object \" + (this[Symbol.toStringTag] || \"Object\") + \"]\";\n })\n }, autoBind({\n _onAdd: d(function (index) {\n if (index >= this.__nextIndex__)\n return;\n ++this.__nextIndex__;\n if (!this.__redo__) {\n defineProperty(this, \"__redo__\", d(\"c\", [index]));\n return;\n }\n this.__redo__.forEach(function (redo, i) {\n if (redo >= index)\n this.__redo__[i] = ++redo;\n }, this);\n this.__redo__.push(index);\n }),\n _onDelete: d(function (index) {\n var i;\n if (index >= this.__nextIndex__)\n return;\n --this.__nextIndex__;\n if (!this.__redo__)\n return;\n i = this.__redo__.indexOf(index);\n if (i !== -1)\n this.__redo__.splice(i, 1);\n this.__redo__.forEach(function (redo, j) {\n if (redo > index)\n this.__redo__[j] = --redo;\n }, this);\n }),\n _onClear: d(function () {\n if (this.__redo__)\n clear.call(this.__redo__);\n this.__nextIndex__ = 0;\n })\n })));\n defineProperty(Iterator.prototype, Symbol.iterator, d(function () {\n return this;\n }));\n}\n","/* es6-iterator/is-iterable */ function _(require, module, exports) {\n var isArguments = require(294) /* es5-ext/function/is-arguments */, isValue = require(312) /* es5-ext/object/is-value */, isString = require(327) /* es5-ext/string/is-string */;\n var iteratorSymbol = require(337) /* es6-symbol */.iterator, isArray = Array.isArray;\n module.exports = function (value) {\n if (!isValue(value))\n return false;\n if (isArray(value))\n return true;\n if (isString(value))\n return true;\n if (isArguments(value))\n return true;\n return typeof value[iteratorSymbol] === \"function\";\n };\n}\n","/* es6-iterator/string */ function _(require, module, exports) {\n var setPrototypeOf = require(318) /* es5-ext/object/set-prototype-of */, d = require(289) /* d */, Symbol = require(337) /* es6-symbol */, Iterator = require(332) /* ./ */;\n var defineProperty = Object.defineProperty, StringIterator;\n StringIterator = module.exports = function (str) {\n if (!(this instanceof StringIterator))\n throw new TypeError(\"Constructor requires 'new'\");\n str = String(str);\n Iterator.call(this, str);\n defineProperty(this, \"__length__\", d(\"\", str.length));\n };\n if (setPrototypeOf)\n setPrototypeOf(StringIterator, Iterator);\n // Internal %ArrayIteratorPrototype% doesn't expose its constructor\n delete StringIterator.prototype.constructor;\n StringIterator.prototype = Object.create(Iterator.prototype, {\n _next: d(function () {\n if (!this.__list__)\n return undefined;\n if (this.__nextIndex__ < this.__length__)\n return this.__nextIndex__++;\n this._unBind();\n return undefined;\n }),\n _resolve: d(function (i) {\n var char = this.__list__[i], code;\n if (this.__nextIndex__ === this.__length__)\n return char;\n code = char.charCodeAt(0);\n if (code >= 0xd800 && code <= 0xdbff)\n return char + this.__list__[this.__nextIndex__++];\n return char;\n })\n });\n defineProperty(StringIterator.prototype, Symbol.toStringTag, d(\"c\", \"String Iterator\"));\n}\n","/* es6-iterator/valid-iterable */ function _(require, module, exports) {\n var isIterable = require(333) /* ./is-iterable */;\n module.exports = function (value) {\n if (!isIterable(value))\n throw new TypeError(value + \" is not iterable\");\n return value;\n };\n}\n","/* es6-promise/dist/es6-promise */ function _(require, module, exports) {\n /*!\n * @overview es6-promise - a tiny implementation of Promises/A+.\n * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)\n * @license Licensed under MIT license\n * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE\n * @version v4.2.4+314e4831\n */\n (function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.ES6Promise = factory());\n }(this, (function () {\n 'use strict';\n function objectOrFunction(x) {\n var type = typeof x;\n return x !== null && (type === 'object' || type === 'function');\n }\n function isFunction(x) {\n return typeof x === 'function';\n }\n var _isArray = void 0;\n if (Array.isArray) {\n _isArray = Array.isArray;\n }\n else {\n _isArray = function (x) {\n return Object.prototype.toString.call(x) === '[object Array]';\n };\n }\n var isArray = _isArray;\n var len = 0;\n var vertxNext = void 0;\n var customSchedulerFn = void 0;\n var asap = function asap(callback, arg) {\n queue[len] = callback;\n queue[len + 1] = arg;\n len += 2;\n if (len === 2) {\n // If len is 2, that means that we need to schedule an async flush.\n // If additional callbacks are queued before the queue is flushed, they\n // will be processed by this flush that we are scheduling.\n if (customSchedulerFn) {\n customSchedulerFn(flush);\n }\n else {\n scheduleFlush();\n }\n }\n };\n function setScheduler(scheduleFn) {\n customSchedulerFn = scheduleFn;\n }\n function setAsap(asapFn) {\n asap = asapFn;\n }\n var browserWindow = typeof window !== 'undefined' ? window : undefined;\n var browserGlobal = browserWindow || {};\n var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;\n var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]';\n // test for web worker but not in IE10\n var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';\n // node\n function useNextTick() {\n // node version 0.10.x displays a deprecation warning when nextTick is used recursively\n // see https://github.com/cujojs/when/issues/410 for details\n return function () {\n return process.nextTick(flush);\n };\n }\n // vertx\n function useVertxTimer() {\n if (typeof vertxNext !== 'undefined') {\n return function () {\n vertxNext(flush);\n };\n }\n return useSetTimeout();\n }\n function useMutationObserver() {\n var iterations = 0;\n var observer = new BrowserMutationObserver(flush);\n var node = document.createTextNode('');\n observer.observe(node, { characterData: true });\n return function () {\n node.data = iterations = ++iterations % 2;\n };\n }\n // web worker\n function useMessageChannel() {\n var channel = new MessageChannel();\n channel.port1.onmessage = flush;\n return function () {\n return channel.port2.postMessage(0);\n };\n }\n function useSetTimeout() {\n // Store setTimeout reference so es6-promise will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var globalSetTimeout = setTimeout;\n return function () {\n return globalSetTimeout(flush, 1);\n };\n }\n var queue = new Array(1000);\n function flush() {\n for (var i = 0; i < len; i += 2) {\n var callback = queue[i];\n var arg = queue[i + 1];\n callback(arg);\n queue[i] = undefined;\n queue[i + 1] = undefined;\n }\n len = 0;\n }\n function attemptVertx() {\n try {\n var vertx = Function('return this')().require('vertx');\n vertxNext = vertx.runOnLoop || vertx.runOnContext;\n return useVertxTimer();\n }\n catch (e) {\n return useSetTimeout();\n }\n }\n var scheduleFlush = void 0;\n // Decide what async method to use to triggering processing of queued callbacks:\n if (isNode) {\n scheduleFlush = useNextTick();\n }\n else if (BrowserMutationObserver) {\n scheduleFlush = useMutationObserver();\n }\n else if (isWorker) {\n scheduleFlush = useMessageChannel();\n }\n else if (browserWindow === undefined && typeof require === 'function') {\n scheduleFlush = attemptVertx();\n }\n else {\n scheduleFlush = useSetTimeout();\n }\n function then(onFulfillment, onRejection) {\n var parent = this;\n var child = new this.constructor(noop);\n if (child[PROMISE_ID] === undefined) {\n makePromise(child);\n }\n var _state = parent._state;\n if (_state) {\n var callback = arguments[_state - 1];\n asap(function () {\n return invokeCallback(_state, child, callback, parent._result);\n });\n }\n else {\n subscribe(parent, child, onFulfillment, onRejection);\n }\n return child;\n }\n /**\n `Promise.resolve` returns a promise that will become resolved with the\n passed `value`. It is shorthand for the following:\n \n ```javascript\n let promise = new Promise(function(resolve, reject){\n resolve(1);\n });\n \n promise.then(function(value){\n // value === 1\n });\n ```\n \n Instead of writing the above, your code now simply becomes the following:\n \n ```javascript\n let promise = Promise.resolve(1);\n \n promise.then(function(value){\n // value === 1\n });\n ```\n \n @method resolve\n @static\n @param {Any} value value that the returned promise will be resolved with\n Useful for tooling.\n @return {Promise} a promise that will become fulfilled with the given\n `value`\n */\n function resolve$1(object) {\n /*jshint validthis:true */\n var Constructor = this;\n if (object && typeof object === 'object' && object.constructor === Constructor) {\n return object;\n }\n var promise = new Constructor(noop);\n resolve(promise, object);\n return promise;\n }\n var PROMISE_ID = Math.random().toString(36).substring(2);\n function noop() { }\n var PENDING = void 0;\n var FULFILLED = 1;\n var REJECTED = 2;\n var TRY_CATCH_ERROR = { error: null };\n function selfFulfillment() {\n return new TypeError(\"You cannot resolve a promise with itself\");\n }\n function cannotReturnOwn() {\n return new TypeError('A promises callback cannot return that same promise.');\n }\n function getThen(promise) {\n try {\n return promise.then;\n }\n catch (error) {\n TRY_CATCH_ERROR.error = error;\n return TRY_CATCH_ERROR;\n }\n }\n function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {\n try {\n then$$1.call(value, fulfillmentHandler, rejectionHandler);\n }\n catch (e) {\n return e;\n }\n }\n function handleForeignThenable(promise, thenable, then$$1) {\n asap(function (promise) {\n var sealed = false;\n var error = tryThen(then$$1, thenable, function (value) {\n if (sealed) {\n return;\n }\n sealed = true;\n if (thenable !== value) {\n resolve(promise, value);\n }\n else {\n fulfill(promise, value);\n }\n }, function (reason) {\n if (sealed) {\n return;\n }\n sealed = true;\n reject(promise, reason);\n }, 'Settle: ' + (promise._label || ' unknown promise'));\n if (!sealed && error) {\n sealed = true;\n reject(promise, error);\n }\n }, promise);\n }\n function handleOwnThenable(promise, thenable) {\n if (thenable._state === FULFILLED) {\n fulfill(promise, thenable._result);\n }\n else if (thenable._state === REJECTED) {\n reject(promise, thenable._result);\n }\n else {\n subscribe(thenable, undefined, function (value) {\n return resolve(promise, value);\n }, function (reason) {\n return reject(promise, reason);\n });\n }\n }\n function handleMaybeThenable(promise, maybeThenable, then$$1) {\n if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {\n handleOwnThenable(promise, maybeThenable);\n }\n else {\n if (then$$1 === TRY_CATCH_ERROR) {\n reject(promise, TRY_CATCH_ERROR.error);\n TRY_CATCH_ERROR.error = null;\n }\n else if (then$$1 === undefined) {\n fulfill(promise, maybeThenable);\n }\n else if (isFunction(then$$1)) {\n handleForeignThenable(promise, maybeThenable, then$$1);\n }\n else {\n fulfill(promise, maybeThenable);\n }\n }\n }\n function resolve(promise, value) {\n if (promise === value) {\n reject(promise, selfFulfillment());\n }\n else if (objectOrFunction(value)) {\n handleMaybeThenable(promise, value, getThen(value));\n }\n else {\n fulfill(promise, value);\n }\n }\n function publishRejection(promise) {\n if (promise._onerror) {\n promise._onerror(promise._result);\n }\n publish(promise);\n }\n function fulfill(promise, value) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._result = value;\n promise._state = FULFILLED;\n if (promise._subscribers.length !== 0) {\n asap(publish, promise);\n }\n }\n function reject(promise, reason) {\n if (promise._state !== PENDING) {\n return;\n }\n promise._state = REJECTED;\n promise._result = reason;\n asap(publishRejection, promise);\n }\n function subscribe(parent, child, onFulfillment, onRejection) {\n var _subscribers = parent._subscribers;\n var length = _subscribers.length;\n parent._onerror = null;\n _subscribers[length] = child;\n _subscribers[length + FULFILLED] = onFulfillment;\n _subscribers[length + REJECTED] = onRejection;\n if (length === 0 && parent._state) {\n asap(publish, parent);\n }\n }\n function publish(promise) {\n var subscribers = promise._subscribers;\n var settled = promise._state;\n if (subscribers.length === 0) {\n return;\n }\n var child = void 0, callback = void 0, detail = promise._result;\n for (var i = 0; i < subscribers.length; i += 3) {\n child = subscribers[i];\n callback = subscribers[i + settled];\n if (child) {\n invokeCallback(settled, child, callback, detail);\n }\n else {\n callback(detail);\n }\n }\n promise._subscribers.length = 0;\n }\n function tryCatch(callback, detail) {\n try {\n return callback(detail);\n }\n catch (e) {\n TRY_CATCH_ERROR.error = e;\n return TRY_CATCH_ERROR;\n }\n }\n function invokeCallback(settled, promise, callback, detail) {\n var hasCallback = isFunction(callback), value = void 0, error = void 0, succeeded = void 0, failed = void 0;\n if (hasCallback) {\n value = tryCatch(callback, detail);\n if (value === TRY_CATCH_ERROR) {\n failed = true;\n error = value.error;\n value.error = null;\n }\n else {\n succeeded = true;\n }\n if (promise === value) {\n reject(promise, cannotReturnOwn());\n return;\n }\n }\n else {\n value = detail;\n succeeded = true;\n }\n if (promise._state !== PENDING) {\n // noop\n }\n else if (hasCallback && succeeded) {\n resolve(promise, value);\n }\n else if (failed) {\n reject(promise, error);\n }\n else if (settled === FULFILLED) {\n fulfill(promise, value);\n }\n else if (settled === REJECTED) {\n reject(promise, value);\n }\n }\n function initializePromise(promise, resolver) {\n try {\n resolver(function resolvePromise(value) {\n resolve(promise, value);\n }, function rejectPromise(reason) {\n reject(promise, reason);\n });\n }\n catch (e) {\n reject(promise, e);\n }\n }\n var id = 0;\n function nextId() {\n return id++;\n }\n function makePromise(promise) {\n promise[PROMISE_ID] = id++;\n promise._state = undefined;\n promise._result = undefined;\n promise._subscribers = [];\n }\n function validationError() {\n return new Error('Array Methods must be provided an Array');\n }\n var Enumerator = function () {\n function Enumerator(Constructor, input) {\n this._instanceConstructor = Constructor;\n this.promise = new Constructor(noop);\n if (!this.promise[PROMISE_ID]) {\n makePromise(this.promise);\n }\n if (isArray(input)) {\n this.length = input.length;\n this._remaining = input.length;\n this._result = new Array(this.length);\n if (this.length === 0) {\n fulfill(this.promise, this._result);\n }\n else {\n this.length = this.length || 0;\n this._enumerate(input);\n if (this._remaining === 0) {\n fulfill(this.promise, this._result);\n }\n }\n }\n else {\n reject(this.promise, validationError());\n }\n }\n Enumerator.prototype._enumerate = function _enumerate(input) {\n for (var i = 0; this._state === PENDING && i < input.length; i++) {\n this._eachEntry(input[i], i);\n }\n };\n Enumerator.prototype._eachEntry = function _eachEntry(entry, i) {\n var c = this._instanceConstructor;\n var resolve$$1 = c.resolve;\n if (resolve$$1 === resolve$1) {\n var _then = getThen(entry);\n if (_then === then && entry._state !== PENDING) {\n this._settledAt(entry._state, i, entry._result);\n }\n else if (typeof _then !== 'function') {\n this._remaining--;\n this._result[i] = entry;\n }\n else if (c === Promise$1) {\n var promise = new c(noop);\n handleMaybeThenable(promise, entry, _then);\n this._willSettleAt(promise, i);\n }\n else {\n this._willSettleAt(new c(function (resolve$$1) {\n return resolve$$1(entry);\n }), i);\n }\n }\n else {\n this._willSettleAt(resolve$$1(entry), i);\n }\n };\n Enumerator.prototype._settledAt = function _settledAt(state, i, value) {\n var promise = this.promise;\n if (promise._state === PENDING) {\n this._remaining--;\n if (state === REJECTED) {\n reject(promise, value);\n }\n else {\n this._result[i] = value;\n }\n }\n if (this._remaining === 0) {\n fulfill(promise, this._result);\n }\n };\n Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) {\n var enumerator = this;\n subscribe(promise, undefined, function (value) {\n return enumerator._settledAt(FULFILLED, i, value);\n }, function (reason) {\n return enumerator._settledAt(REJECTED, i, reason);\n });\n };\n return Enumerator;\n }();\n /**\n `Promise.all` accepts an array of promises, and returns a new promise which\n is fulfilled with an array of fulfillment values for the passed promises, or\n rejected with the reason of the first passed promise to be rejected. It casts all\n elements of the passed iterable to promises as it runs this algorithm.\n \n Example:\n \n ```javascript\n let promise1 = resolve(1);\n let promise2 = resolve(2);\n let promise3 = resolve(3);\n let promises = [ promise1, promise2, promise3 ];\n \n Promise.all(promises).then(function(array){\n // The array here would be [ 1, 2, 3 ];\n });\n ```\n \n If any of the `promises` given to `all` are rejected, the first promise\n that is rejected will be given as an argument to the returned promises's\n rejection handler. For example:\n \n Example:\n \n ```javascript\n let promise1 = resolve(1);\n let promise2 = reject(new Error(\"2\"));\n let promise3 = reject(new Error(\"3\"));\n let promises = [ promise1, promise2, promise3 ];\n \n Promise.all(promises).then(function(array){\n // Code here never runs because there are rejected promises!\n }, function(error) {\n // error.message === \"2\"\n });\n ```\n \n @method all\n @static\n @param {Array} entries array of promises\n @param {String} label optional string for labeling the promise.\n Useful for tooling.\n @return {Promise} promise that is fulfilled when all `promises` have been\n fulfilled, or rejected if any of them become rejected.\n @static\n */\n function all(entries) {\n return new Enumerator(this, entries).promise;\n }\n /**\n `Promise.race` returns a new promise which is settled in the same way as the\n first passed promise to settle.\n \n Example:\n \n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n \n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 2');\n }, 100);\n });\n \n Promise.race([promise1, promise2]).then(function(result){\n // result === 'promise 2' because it was resolved before promise1\n // was resolved.\n });\n ```\n \n `Promise.race` is deterministic in that only the state of the first\n settled promise matters. For example, even if other promises given to the\n `promises` array argument are resolved, but the first settled promise has\n become rejected before the other promises became fulfilled, the returned\n promise will become rejected:\n \n ```javascript\n let promise1 = new Promise(function(resolve, reject){\n setTimeout(function(){\n resolve('promise 1');\n }, 200);\n });\n \n let promise2 = new Promise(function(resolve, reject){\n setTimeout(function(){\n reject(new Error('promise 2'));\n }, 100);\n });\n \n Promise.race([promise1, promise2]).then(function(result){\n // Code here never runs\n }, function(reason){\n // reason.message === 'promise 2' because promise 2 became rejected before\n // promise 1 became fulfilled\n });\n ```\n \n An example real-world use case is implementing timeouts:\n \n ```javascript\n Promise.race([ajax('foo.json'), timeout(5000)])\n ```\n \n @method race\n @static\n @param {Array} promises array of promises to observe\n Useful for tooling.\n @return {Promise} a promise which settles in the same way as the first passed\n promise to settle.\n */\n function race(entries) {\n /*jshint validthis:true */\n var Constructor = this;\n if (!isArray(entries)) {\n return new Constructor(function (_, reject) {\n return reject(new TypeError('You must pass an array to race.'));\n });\n }\n else {\n return new Constructor(function (resolve, reject) {\n var length = entries.length;\n for (var i = 0; i < length; i++) {\n Constructor.resolve(entries[i]).then(resolve, reject);\n }\n });\n }\n }\n /**\n `Promise.reject` returns a promise rejected with the passed `reason`.\n It is shorthand for the following:\n \n ```javascript\n let promise = new Promise(function(resolve, reject){\n reject(new Error('WHOOPS'));\n });\n \n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n \n Instead of writing the above, your code now simply becomes the following:\n \n ```javascript\n let promise = Promise.reject(new Error('WHOOPS'));\n \n promise.then(function(value){\n // Code here doesn't run because the promise is rejected!\n }, function(reason){\n // reason.message === 'WHOOPS'\n });\n ```\n \n @method reject\n @static\n @param {Any} reason value that the returned promise will be rejected with.\n Useful for tooling.\n @return {Promise} a promise rejected with the given `reason`.\n */\n function reject$1(reason) {\n /*jshint validthis:true */\n var Constructor = this;\n var promise = new Constructor(noop);\n reject(promise, reason);\n return promise;\n }\n function needsResolver() {\n throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');\n }\n function needsNew() {\n throw new TypeError(\"Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.\");\n }\n /**\n Promise objects represent the eventual result of an asynchronous operation. The\n primary way of interacting with a promise is through its `then` method, which\n registers callbacks to receive either a promise's eventual value or the reason\n why the promise cannot be fulfilled.\n \n Terminology\n -----------\n \n - `promise` is an object or function with a `then` method whose behavior conforms to this specification.\n - `thenable` is an object or function that defines a `then` method.\n - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).\n - `exception` is a value that is thrown using the throw statement.\n - `reason` is a value that indicates why a promise was rejected.\n - `settled` the final resting state of a promise, fulfilled or rejected.\n \n A promise can be in one of three states: pending, fulfilled, or rejected.\n \n Promises that are fulfilled have a fulfillment value and are in the fulfilled\n state. Promises that are rejected have a rejection reason and are in the\n rejected state. A fulfillment value is never a thenable.\n \n Promises can also be said to *resolve* a value. If this value is also a\n promise, then the original promise's settled state will match the value's\n settled state. So a promise that *resolves* a promise that rejects will\n itself reject, and a promise that *resolves* a promise that fulfills will\n itself fulfill.\n \n \n Basic Usage:\n ------------\n \n ```js\n let promise = new Promise(function(resolve, reject) {\n // on success\n resolve(value);\n \n // on failure\n reject(reason);\n });\n \n promise.then(function(value) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n \n Advanced Usage:\n ---------------\n \n Promises shine when abstracting away asynchronous interactions such as\n `XMLHttpRequest`s.\n \n ```js\n function getJSON(url) {\n return new Promise(function(resolve, reject){\n let xhr = new XMLHttpRequest();\n \n xhr.open('GET', url);\n xhr.onreadystatechange = handler;\n xhr.responseType = 'json';\n xhr.setRequestHeader('Accept', 'application/json');\n xhr.send();\n \n function handler() {\n if (this.readyState === this.DONE) {\n if (this.status === 200) {\n resolve(this.response);\n } else {\n reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));\n }\n }\n };\n });\n }\n \n getJSON('/posts.json').then(function(json) {\n // on fulfillment\n }, function(reason) {\n // on rejection\n });\n ```\n \n Unlike callbacks, promises are great composable primitives.\n \n ```js\n Promise.all([\n getJSON('/posts'),\n getJSON('/comments')\n ]).then(function(values){\n values[0] // => postsJSON\n values[1] // => commentsJSON\n \n return values;\n });\n ```\n \n @class Promise\n @param {Function} resolver\n Useful for tooling.\n @constructor\n */\n var Promise$1 = function () {\n function Promise(resolver) {\n this[PROMISE_ID] = nextId();\n this._result = this._state = undefined;\n this._subscribers = [];\n if (noop !== resolver) {\n typeof resolver !== 'function' && needsResolver();\n this instanceof Promise ? initializePromise(this, resolver) : needsNew();\n }\n }\n /**\n The primary way of interacting with a promise is through its `then` method,\n which registers callbacks to receive either a promise's eventual value or the\n reason why the promise cannot be fulfilled.\n ```js\n findUser().then(function(user){\n // user is available\n }, function(reason){\n // user is unavailable, and you are given the reason why\n });\n ```\n Chaining\n --------\n The return value of `then` is itself a promise. This second, 'downstream'\n promise is resolved with the return value of the first promise's fulfillment\n or rejection handler, or rejected if the handler throws an exception.\n ```js\n findUser().then(function (user) {\n return user.name;\n }, function (reason) {\n return 'default name';\n }).then(function (userName) {\n // If `findUser` fulfilled, `userName` will be the user's name, otherwise it\n // will be `'default name'`\n });\n findUser().then(function (user) {\n throw new Error('Found user, but still unhappy');\n }, function (reason) {\n throw new Error('`findUser` rejected and we're unhappy');\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.\n // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.\n });\n ```\n If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.\n ```js\n findUser().then(function (user) {\n throw new PedagogicalException('Upstream error');\n }).then(function (value) {\n // never reached\n }).then(function (value) {\n // never reached\n }, function (reason) {\n // The `PedgagocialException` is propagated all the way down to here\n });\n ```\n Assimilation\n ------------\n Sometimes the value you want to propagate to a downstream promise can only be\n retrieved asynchronously. This can be achieved by returning a promise in the\n fulfillment or rejection handler. The downstream promise will then be pending\n until the returned promise is settled. This is called *assimilation*.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // The user's comments are now available\n });\n ```\n If the assimliated promise rejects, then the downstream promise will also reject.\n ```js\n findUser().then(function (user) {\n return findCommentsByAuthor(user);\n }).then(function (comments) {\n // If `findCommentsByAuthor` fulfills, we'll have the value here\n }, function (reason) {\n // If `findCommentsByAuthor` rejects, we'll have the reason here\n });\n ```\n Simple Example\n --------------\n Synchronous Example\n ```javascript\n let result;\n try {\n result = findResult();\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n findResult(function(result, err){\n if (err) {\n // failure\n } else {\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findResult().then(function(result){\n // success\n }, function(reason){\n // failure\n });\n ```\n Advanced Example\n --------------\n Synchronous Example\n ```javascript\n let author, books;\n try {\n author = findAuthor();\n books = findBooksByAuthor(author);\n // success\n } catch(reason) {\n // failure\n }\n ```\n Errback Example\n ```js\n function foundBooks(books) {\n }\n function failure(reason) {\n }\n findAuthor(function(author, err){\n if (err) {\n failure(err);\n // failure\n } else {\n try {\n findBoooksByAuthor(author, function(books, err) {\n if (err) {\n failure(err);\n } else {\n try {\n foundBooks(books);\n } catch(reason) {\n failure(reason);\n }\n }\n });\n } catch(error) {\n failure(err);\n }\n // success\n }\n });\n ```\n Promise Example;\n ```javascript\n findAuthor().\n then(findBooksByAuthor).\n then(function(books){\n // found books\n }).catch(function(reason){\n // something went wrong\n });\n ```\n @method then\n @param {Function} onFulfilled\n @param {Function} onRejected\n Useful for tooling.\n @return {Promise}\n */\n /**\n `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same\n as the catch block of a try/catch statement.\n ```js\n function findAuthor(){\n throw new Error('couldn't find that author');\n }\n // synchronous\n try {\n findAuthor();\n } catch(reason) {\n // something went wrong\n }\n // async with promises\n findAuthor().catch(function(reason){\n // something went wrong\n });\n ```\n @method catch\n @param {Function} onRejection\n Useful for tooling.\n @return {Promise}\n */\n Promise.prototype.catch = function _catch(onRejection) {\n return this.then(null, onRejection);\n };\n /**\n `finally` will be invoked regardless of the promise's fate just as native\n try/catch/finally behaves\n \n Synchronous example:\n \n ```js\n findAuthor() {\n if (Math.random() > 0.5) {\n throw new Error();\n }\n return new Author();\n }\n \n try {\n return findAuthor(); // succeed or fail\n } catch(error) {\n return findOtherAuther();\n } finally {\n // always runs\n // doesn't affect the return value\n }\n ```\n \n Asynchronous example:\n \n ```js\n findAuthor().catch(function(reason){\n return findOtherAuther();\n }).finally(function(){\n // author was either found, or not\n });\n ```\n \n @method finally\n @param {Function} callback\n @return {Promise}\n */\n Promise.prototype.finally = function _finally(callback) {\n var promise = this;\n var constructor = promise.constructor;\n return promise.then(function (value) {\n return constructor.resolve(callback()).then(function () {\n return value;\n });\n }, function (reason) {\n return constructor.resolve(callback()).then(function () {\n throw reason;\n });\n });\n };\n return Promise;\n }();\n Promise$1.prototype.then = then;\n Promise$1.all = all;\n Promise$1.race = race;\n Promise$1.resolve = resolve$1;\n Promise$1.reject = reject$1;\n Promise$1._setScheduler = setScheduler;\n Promise$1._setAsap = setAsap;\n Promise$1._asap = asap;\n /*global self*/\n function polyfill() {\n var local = void 0;\n if (typeof global !== 'undefined') {\n local = global;\n }\n else if (typeof self !== 'undefined') {\n local = self;\n }\n else {\n try {\n local = Function('return this')();\n }\n catch (e) {\n throw new Error('polyfill failed because global object is unavailable in this environment');\n }\n }\n var P = local.Promise;\n if (P) {\n var promiseToString = null;\n try {\n promiseToString = Object.prototype.toString.call(P.resolve());\n }\n catch (e) {\n // silently ignored\n }\n if (promiseToString === '[object Promise]' && !P.cast) {\n return;\n }\n }\n local.Promise = Promise$1;\n }\n // Strange compat..\n Promise$1.polyfill = polyfill;\n Promise$1.Promise = Promise$1;\n return Promise$1;\n })));\n}\n","/* es6-symbol/index */ function _(require, module, exports) {\n module.exports = require(338) /* ./is-implemented */() ? Symbol : require(340) /* ./polyfill */;\n}\n","/* es6-symbol/is-implemented */ function _(require, module, exports) {\n var validTypes = { object: true, symbol: true };\n module.exports = function () {\n var symbol;\n if (typeof Symbol !== 'function')\n return false;\n symbol = Symbol('test symbol');\n try {\n String(symbol);\n }\n catch (e) {\n return false;\n }\n // Return 'true' also for polyfills\n if (!validTypes[typeof Symbol.iterator])\n return false;\n if (!validTypes[typeof Symbol.toPrimitive])\n return false;\n if (!validTypes[typeof Symbol.toStringTag])\n return false;\n return true;\n };\n}\n","/* es6-symbol/is-symbol */ function _(require, module, exports) {\n module.exports = function (x) {\n if (!x)\n return false;\n if (typeof x === 'symbol')\n return true;\n if (!x.constructor)\n return false;\n if (x.constructor.name !== 'Symbol')\n return false;\n return (x[x.constructor.toStringTag] === 'Symbol');\n };\n}\n","/* es6-symbol/polyfill */ function _(require, module, exports) {\n var d = require(289) /* d */, validateSymbol = require(341) /* ./validate-symbol */, create = Object.create, defineProperties = Object.defineProperties, defineProperty = Object.defineProperty, objPrototype = Object.prototype, NativeSymbol, SymbolPolyfill, HiddenSymbol, globalSymbols = create(null), isNativeSafe;\n if (typeof Symbol === 'function') {\n NativeSymbol = Symbol;\n try {\n String(NativeSymbol());\n isNativeSafe = true;\n }\n catch (ignore) { }\n }\n var generateName = (function () {\n var created = create(null);\n return function (desc) {\n var postfix = 0, name, ie11BugWorkaround;\n while (created[desc + (postfix || '')])\n ++postfix;\n desc += (postfix || '');\n created[desc] = true;\n name = '@@' + desc;\n defineProperty(objPrototype, name, d.gs(null, function (value) {\n // For IE11 issue see:\n // https://connect.microsoft.com/IE/feedbackdetail/view/1928508/\n // ie11-broken-getters-on-dom-objects\n // https://github.com/medikoo/es6-symbol/issues/12\n if (ie11BugWorkaround)\n return;\n ie11BugWorkaround = true;\n defineProperty(this, name, d(value));\n ie11BugWorkaround = false;\n }));\n return name;\n };\n }());\n // Internal constructor (not one exposed) for creating Symbol instances.\n // This one is used to ensure that `someSymbol instanceof Symbol` always return false\n HiddenSymbol = function Symbol(description) {\n if (this instanceof HiddenSymbol)\n throw new TypeError('Symbol is not a constructor');\n return SymbolPolyfill(description);\n };\n // Exposed `Symbol` constructor\n // (returns instances of HiddenSymbol)\n module.exports = SymbolPolyfill = function Symbol(description) {\n var symbol;\n if (this instanceof Symbol)\n throw new TypeError('Symbol is not a constructor');\n if (isNativeSafe)\n return NativeSymbol(description);\n symbol = create(HiddenSymbol.prototype);\n description = (description === undefined ? '' : String(description));\n return defineProperties(symbol, {\n __description__: d('', description),\n __name__: d('', generateName(description))\n });\n };\n defineProperties(SymbolPolyfill, {\n for: d(function (key) {\n if (globalSymbols[key])\n return globalSymbols[key];\n return (globalSymbols[key] = SymbolPolyfill(String(key)));\n }),\n keyFor: d(function (s) {\n var key;\n validateSymbol(s);\n for (key in globalSymbols)\n if (globalSymbols[key] === s)\n return key;\n }),\n // To ensure proper interoperability with other native functions (e.g. Array.from)\n // fallback to eventual native implementation of given symbol\n hasInstance: d('', (NativeSymbol && NativeSymbol.hasInstance) || SymbolPolyfill('hasInstance')),\n isConcatSpreadable: d('', (NativeSymbol && NativeSymbol.isConcatSpreadable) ||\n SymbolPolyfill('isConcatSpreadable')),\n iterator: d('', (NativeSymbol && NativeSymbol.iterator) || SymbolPolyfill('iterator')),\n match: d('', (NativeSymbol && NativeSymbol.match) || SymbolPolyfill('match')),\n replace: d('', (NativeSymbol && NativeSymbol.replace) || SymbolPolyfill('replace')),\n search: d('', (NativeSymbol && NativeSymbol.search) || SymbolPolyfill('search')),\n species: d('', (NativeSymbol && NativeSymbol.species) || SymbolPolyfill('species')),\n split: d('', (NativeSymbol && NativeSymbol.split) || SymbolPolyfill('split')),\n toPrimitive: d('', (NativeSymbol && NativeSymbol.toPrimitive) || SymbolPolyfill('toPrimitive')),\n toStringTag: d('', (NativeSymbol && NativeSymbol.toStringTag) || SymbolPolyfill('toStringTag')),\n unscopables: d('', (NativeSymbol && NativeSymbol.unscopables) || SymbolPolyfill('unscopables'))\n });\n // Internal tweaks for real symbol producer\n defineProperties(HiddenSymbol.prototype, {\n constructor: d(SymbolPolyfill),\n toString: d('', function () { return this.__name__; })\n });\n // Proper implementation of methods exposed on Symbol.prototype\n // They won't be accessible on produced symbol instances as they derive from HiddenSymbol.prototype\n defineProperties(SymbolPolyfill.prototype, {\n toString: d(function () { return 'Symbol (' + validateSymbol(this).__description__ + ')'; }),\n valueOf: d(function () { return validateSymbol(this); })\n });\n defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toPrimitive, d('', function () {\n var symbol = validateSymbol(this);\n if (typeof symbol === 'symbol')\n return symbol;\n return symbol.toString();\n }));\n defineProperty(SymbolPolyfill.prototype, SymbolPolyfill.toStringTag, d('c', 'Symbol'));\n // Proper implementaton of toPrimitive and toStringTag for returned symbol instances\n defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toStringTag, d('c', SymbolPolyfill.prototype[SymbolPolyfill.toStringTag]));\n // Note: It's important to define `toPrimitive` as last one, as some implementations\n // implement `toPrimitive` natively without implementing `toStringTag` (or other specified symbols)\n // And that may invoke error in definition flow:\n // See: https://github.com/medikoo/es6-symbol/issues/13#issuecomment-164146149\n defineProperty(HiddenSymbol.prototype, SymbolPolyfill.toPrimitive, d('c', SymbolPolyfill.prototype[SymbolPolyfill.toPrimitive]));\n}\n","/* es6-symbol/validate-symbol */ function _(require, module, exports) {\n var isSymbol = require(339) /* ./is-symbol */;\n module.exports = function (value) {\n if (!isSymbol(value))\n throw new TypeError(value + \" is not a symbol\");\n return value;\n };\n}\n","/* es6-weak-map/implement */ function _(require, module, exports) {\n if (!require(343) /* ./is-implemented */()) {\n Object.defineProperty(require(297) /* es5-ext/global */, 'WeakMap', { value: require(345) /* ./polyfill */, configurable: true, enumerable: false,\n writable: true });\n }\n}\n","/* es6-weak-map/is-implemented */ function _(require, module, exports) {\n module.exports = function () {\n var weakMap, x;\n if (typeof WeakMap !== 'function')\n return false;\n try {\n // WebKit doesn't support arguments and crashes\n weakMap = new WeakMap([[x = {}, 'one'], [{}, 'two'], [{}, 'three']]);\n }\n catch (e) {\n return false;\n }\n if (String(weakMap) !== '[object WeakMap]')\n return false;\n if (typeof weakMap.set !== 'function')\n return false;\n if (weakMap.set({}, 1) !== weakMap)\n return false;\n if (typeof weakMap.delete !== 'function')\n return false;\n if (typeof weakMap.has !== 'function')\n return false;\n if (weakMap.get(x) !== 'one')\n return false;\n return true;\n };\n}\n","/* es6-weak-map/is-native-implemented */ function _(require, module, exports) {\n module.exports = (function () {\n if (typeof WeakMap !== 'function')\n return false;\n return (Object.prototype.toString.call(new WeakMap()) === '[object WeakMap]');\n }());\n}\n","/* es6-weak-map/polyfill */ function _(require, module, exports) {\n var setPrototypeOf = require(318) /* es5-ext/object/set-prototype-of */, object = require(322) /* es5-ext/object/valid-object */, value = require(323) /* es5-ext/object/valid-value */, randomUniq = require(328) /* es5-ext/string/random-uniq */, d = require(289) /* d */, getIterator = require(331) /* es6-iterator/get */, forOf = require(330) /* es6-iterator/for-of */, toStringTagSymbol = require(337) /* es6-symbol */.toStringTag, isNative = require(344) /* ./is-native-implemented */, isArray = Array.isArray, defineProperty = Object.defineProperty, hasOwnProperty = Object.prototype.hasOwnProperty, getPrototypeOf = Object.getPrototypeOf, WeakMapPoly;\n module.exports = WeakMapPoly = function ( /*iterable*/) {\n var iterable = arguments[0], self;\n if (!(this instanceof WeakMapPoly))\n throw new TypeError('Constructor requires \\'new\\'');\n if (isNative && setPrototypeOf && (WeakMap !== WeakMapPoly)) {\n self = setPrototypeOf(new WeakMap(), getPrototypeOf(this));\n }\n else {\n self = this;\n }\n if (iterable != null) {\n if (!isArray(iterable))\n iterable = getIterator(iterable);\n }\n defineProperty(self, '__weakMapData__', d('c', '$weakMap$' + randomUniq()));\n if (!iterable)\n return self;\n forOf(iterable, function (val) {\n value(val);\n self.set(val[0], val[1]);\n });\n return self;\n };\n if (isNative) {\n if (setPrototypeOf)\n setPrototypeOf(WeakMapPoly, WeakMap);\n WeakMapPoly.prototype = Object.create(WeakMap.prototype, {\n constructor: d(WeakMapPoly)\n });\n }\n Object.defineProperties(WeakMapPoly.prototype, {\n delete: d(function (key) {\n if (hasOwnProperty.call(object(key), this.__weakMapData__)) {\n delete key[this.__weakMapData__];\n return true;\n }\n return false;\n }),\n get: d(function (key) {\n if (hasOwnProperty.call(object(key), this.__weakMapData__)) {\n return key[this.__weakMapData__];\n }\n }),\n has: d(function (key) {\n return hasOwnProperty.call(object(key), this.__weakMapData__);\n }),\n set: d(function (key, value) {\n defineProperty(object(key), this.__weakMapData__, d('c', value));\n return this;\n }),\n toString: d(function () { return '[object WeakMap]'; })\n });\n defineProperty(WeakMapPoly.prototype, toStringTagSymbol, d('c', 'WeakMap'));\n}\n","/* flatbush/flatbush */ function _(require, module, exports) {\n (function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.Flatbush = factory());\n }(this, (function () {\n 'use strict';\n var ARRAY_TYPES = [\n Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array,\n Int32Array, Uint32Array, Float32Array, Float64Array\n ];\n var VERSION = 3; // serialized format version\n var Flatbush = function Flatbush(numItems, nodeSize, ArrayType, data) {\n var this$1 = this;\n if (numItems === undefined) {\n throw new Error('Missing required argument: numItems.');\n }\n if (isNaN(numItems) || numItems <= 0) {\n throw new Error((\"Unpexpected numItems value: \" + numItems + \".\"));\n }\n this.numItems = +numItems;\n this.nodeSize = Math.min(Math.max(+nodeSize || 16, 2), 65535);\n // calculate the total number of nodes in the R-tree to allocate space for\n // and the index of each tree level (used in search later)\n var n = numItems;\n var numNodes = n;\n this._levelBounds = [n * 4];\n do {\n n = Math.ceil(n / this$1.nodeSize);\n numNodes += n;\n this$1._levelBounds.push(numNodes * 4);\n } while (n !== 1);\n this.ArrayType = ArrayType || Float64Array;\n this.IndexArrayType = numNodes < 16384 ? Uint16Array : Uint32Array;\n var arrayTypeIndex = ARRAY_TYPES.indexOf(this.ArrayType);\n var nodesByteSize = numNodes * 4 * this.ArrayType.BYTES_PER_ELEMENT;\n if (arrayTypeIndex < 0) {\n throw new Error((\"Unexpected typed array class: \" + ArrayType + \".\"));\n }\n if (data && (data instanceof ArrayBuffer)) {\n this.data = data;\n this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes);\n this._pos = numNodes * 4;\n this.minX = this._boxes[this._pos - 4];\n this.minY = this._boxes[this._pos - 3];\n this.maxX = this._boxes[this._pos - 2];\n this.maxY = this._boxes[this._pos - 1];\n }\n else {\n this.data = new ArrayBuffer(8 + nodesByteSize + numNodes * this.IndexArrayType.BYTES_PER_ELEMENT);\n this._boxes = new this.ArrayType(this.data, 8, numNodes * 4);\n this._indices = new this.IndexArrayType(this.data, 8 + nodesByteSize, numNodes);\n this._pos = 0;\n this.minX = Infinity;\n this.minY = Infinity;\n this.maxX = -Infinity;\n this.maxY = -Infinity;\n new Uint8Array(this.data, 0, 2).set([0xfb, (VERSION << 4) + arrayTypeIndex]);\n new Uint16Array(this.data, 2, 1)[0] = nodeSize;\n new Uint32Array(this.data, 4, 1)[0] = numItems;\n }\n };\n Flatbush.from = function from(data) {\n if (!(data instanceof ArrayBuffer)) {\n throw new Error('Data must be an instance of ArrayBuffer.');\n }\n var ref = new Uint8Array(data, 0, 2);\n var magic = ref[0];\n var versionAndType = ref[1];\n if (magic !== 0xfb) {\n throw new Error('Data does not appear to be in a Flatbush format.');\n }\n if (versionAndType >> 4 !== VERSION) {\n throw new Error((\"Got v\" + (versionAndType >> 4) + \" data when expected v\" + VERSION + \".\"));\n }\n var ref$1 = new Uint16Array(data, 2, 1);\n var nodeSize = ref$1[0];\n var ref$2 = new Uint32Array(data, 4, 1);\n var numItems = ref$2[0];\n return new Flatbush(numItems, nodeSize, ARRAY_TYPES[versionAndType & 0x0f], data);\n };\n Flatbush.prototype.add = function add(minX, minY, maxX, maxY) {\n var index = this._pos >> 2;\n this._indices[index] = index;\n this._boxes[this._pos++] = minX;\n this._boxes[this._pos++] = minY;\n this._boxes[this._pos++] = maxX;\n this._boxes[this._pos++] = maxY;\n if (minX < this.minX) {\n this.minX = minX;\n }\n if (minY < this.minY) {\n this.minY = minY;\n }\n if (maxX > this.maxX) {\n this.maxX = maxX;\n }\n if (maxY > this.maxY) {\n this.maxY = maxY;\n }\n };\n Flatbush.prototype.finish = function finish() {\n var this$1 = this;\n if (this._pos >> 2 !== this.numItems) {\n throw new Error((\"Added \" + (this._pos >> 2) + \" items when expected \" + (this.numItems) + \".\"));\n }\n var width = this.maxX - this.minX;\n var height = this.maxY - this.minY;\n var hilbertValues = new Uint32Array(this.numItems);\n var hilbertMax = (1 << 16) - 1;\n // map item centers into Hilbert coordinate space and calculate Hilbert values\n for (var i = 0; i < this.numItems; i++) {\n var pos = 4 * i;\n var minX = this$1._boxes[pos++];\n var minY = this$1._boxes[pos++];\n var maxX = this$1._boxes[pos++];\n var maxY = this$1._boxes[pos++];\n var x = Math.floor(hilbertMax * ((minX + maxX) / 2 - this$1.minX) / width);\n var y = Math.floor(hilbertMax * ((minY + maxY) / 2 - this$1.minY) / height);\n hilbertValues[i] = hilbert(x, y);\n }\n // sort items by their Hilbert value (for packing later)\n sort(hilbertValues, this._boxes, this._indices, 0, this.numItems - 1);\n // generate nodes at each tree level, bottom-up\n for (var i$1 = 0, pos$1 = 0; i$1 < this._levelBounds.length - 1; i$1++) {\n var end = this$1._levelBounds[i$1];\n // generate a parent node for each block of consecutive nodes\n while (pos$1 < end) {\n var nodeMinX = Infinity;\n var nodeMinY = Infinity;\n var nodeMaxX = -Infinity;\n var nodeMaxY = -Infinity;\n var nodeIndex = pos$1;\n // calculate bbox for the new node\n for (var i$2 = 0; i$2 < this.nodeSize && pos$1 < end; i$2++) {\n var minX$1 = this$1._boxes[pos$1++];\n var minY$1 = this$1._boxes[pos$1++];\n var maxX$1 = this$1._boxes[pos$1++];\n var maxY$1 = this$1._boxes[pos$1++];\n if (minX$1 < nodeMinX) {\n nodeMinX = minX$1;\n }\n if (minY$1 < nodeMinY) {\n nodeMinY = minY$1;\n }\n if (maxX$1 > nodeMaxX) {\n nodeMaxX = maxX$1;\n }\n if (maxY$1 > nodeMaxY) {\n nodeMaxY = maxY$1;\n }\n }\n // add the new node to the tree data\n this$1._indices[this$1._pos >> 2] = nodeIndex;\n this$1._boxes[this$1._pos++] = nodeMinX;\n this$1._boxes[this$1._pos++] = nodeMinY;\n this$1._boxes[this$1._pos++] = nodeMaxX;\n this$1._boxes[this$1._pos++] = nodeMaxY;\n }\n }\n };\n Flatbush.prototype.search = function search(minX, minY, maxX, maxY, filterFn) {\n var this$1 = this;\n if (this._pos !== this._boxes.length) {\n throw new Error('Data not yet indexed - call index.finish().');\n }\n var nodeIndex = this._boxes.length - 4;\n var level = this._levelBounds.length - 1;\n var queue = [];\n var results = [];\n while (nodeIndex !== undefined) {\n // find the end index of the node\n var end = Math.min(nodeIndex + this$1.nodeSize * 4, this$1._levelBounds[level]);\n // search through child nodes\n for (var pos = nodeIndex; pos < end; pos += 4) {\n var index = this$1._indices[pos >> 2];\n // check if node bbox intersects with query bbox\n if (maxX < this$1._boxes[pos]) {\n continue;\n } // maxX < nodeMinX\n if (maxY < this$1._boxes[pos + 1]) {\n continue;\n } // maxY < nodeMinY\n if (minX > this$1._boxes[pos + 2]) {\n continue;\n } // minX > nodeMaxX\n if (minY > this$1._boxes[pos + 3]) {\n continue;\n } // minY > nodeMaxY\n if (nodeIndex < this$1.numItems * 4) {\n if (filterFn === undefined || filterFn(index)) {\n results.push(index); // leaf item\n }\n }\n else {\n queue.push(index); // node; add it to the search queue\n queue.push(level - 1);\n }\n }\n level = queue.pop();\n nodeIndex = queue.pop();\n }\n return results;\n };\n // custom quicksort that sorts bbox data alongside the hilbert values\n function sort(values, boxes, indices, left, right) {\n if (left >= right) {\n return;\n }\n var pivot = values[(left + right) >> 1];\n var i = left - 1;\n var j = right + 1;\n while (true) {\n do {\n i++;\n } while (values[i] < pivot);\n do {\n j--;\n } while (values[j] > pivot);\n if (i >= j) {\n break;\n }\n swap(values, boxes, indices, i, j);\n }\n sort(values, boxes, indices, left, j);\n sort(values, boxes, indices, j + 1, right);\n }\n // swap two values and two corresponding boxes\n function swap(values, boxes, indices, i, j) {\n var temp = values[i];\n values[i] = values[j];\n values[j] = temp;\n var k = 4 * i;\n var m = 4 * j;\n var a = boxes[k];\n var b = boxes[k + 1];\n var c = boxes[k + 2];\n var d = boxes[k + 3];\n boxes[k] = boxes[m];\n boxes[k + 1] = boxes[m + 1];\n boxes[k + 2] = boxes[m + 2];\n boxes[k + 3] = boxes[m + 3];\n boxes[m] = a;\n boxes[m + 1] = b;\n boxes[m + 2] = c;\n boxes[m + 3] = d;\n var e = indices[i];\n indices[i] = indices[j];\n indices[j] = e;\n }\n // Fast Hilbert curve algorithm by http://threadlocalmutex.com/\n // Ported from C++ https://github.com/rawrunprotected/hilbert_curves (public domain)\n function hilbert(x, y) {\n var a = x ^ y;\n var b = 0xFFFF ^ a;\n var c = 0xFFFF ^ (x | y);\n var d = x & (y ^ 0xFFFF);\n var A = a | (b >> 1);\n var B = (a >> 1) ^ a;\n var C = ((c >> 1) ^ (b & (d >> 1))) ^ c;\n var D = ((a & (c >> 1)) ^ (d >> 1)) ^ d;\n a = A;\n b = B;\n c = C;\n d = D;\n A = ((a & (a >> 2)) ^ (b & (b >> 2)));\n B = ((a & (b >> 2)) ^ (b & ((a ^ b) >> 2)));\n C ^= ((a & (c >> 2)) ^ (b & (d >> 2)));\n D ^= ((b & (c >> 2)) ^ ((a ^ b) & (d >> 2)));\n a = A;\n b = B;\n c = C;\n d = D;\n A = ((a & (a >> 4)) ^ (b & (b >> 4)));\n B = ((a & (b >> 4)) ^ (b & ((a ^ b) >> 4)));\n C ^= ((a & (c >> 4)) ^ (b & (d >> 4)));\n D ^= ((b & (c >> 4)) ^ ((a ^ b) & (d >> 4)));\n a = A;\n b = B;\n c = C;\n d = D;\n C ^= ((a & (c >> 8)) ^ (b & (d >> 8)));\n D ^= ((b & (c >> 8)) ^ ((a ^ b) & (d >> 8)));\n a = C ^ (C >> 1);\n b = D ^ (D >> 1);\n var i0 = x ^ y;\n var i1 = b | (0xFFFF ^ (i0 | a));\n i0 = (i0 | (i0 << 8)) & 0x00FF00FF;\n i0 = (i0 | (i0 << 4)) & 0x0F0F0F0F;\n i0 = (i0 | (i0 << 2)) & 0x33333333;\n i0 = (i0 | (i0 << 1)) & 0x55555555;\n i1 = (i1 | (i1 << 8)) & 0x00FF00FF;\n i1 = (i1 | (i1 << 4)) & 0x0F0F0F0F;\n i1 = (i1 | (i1 << 2)) & 0x33333333;\n i1 = (i1 | (i1 << 1)) & 0x55555555;\n return ((i1 << 1) | i0) >>> 0;\n }\n return Flatbush;\n })));\n}\n","/* hammerjs/hammer */ function _(require, module, exports) {\n /*! Hammer.JS - v2.0.7 - 2016-04-22\n * http://hammerjs.github.io/\n *\n * Copyright (c) 2016 Jorik Tangelder;\n * Licensed under the MIT license */\n (function (window, document, exportName, undefined) {\n 'use strict';\n var VENDOR_PREFIXES = ['', 'webkit', 'Moz', 'MS', 'ms', 'o'];\n var TEST_ELEMENT = document.createElement('div');\n var TYPE_FUNCTION = 'function';\n var round = Math.round;\n var abs = Math.abs;\n var now = Date.now;\n /**\n * set a timeout with a given scope\n * @param {Function} fn\n * @param {Number} timeout\n * @param {Object} context\n * @returns {number}\n */\n function setTimeoutContext(fn, timeout, context) {\n return setTimeout(bindFn(fn, context), timeout);\n }\n /**\n * if the argument is an array, we want to execute the fn on each entry\n * if it aint an array we don't want to do a thing.\n * this is used by all the methods that accept a single and array argument.\n * @param {*|Array} arg\n * @param {String} fn\n * @param {Object} [context]\n * @returns {Boolean}\n */\n function invokeArrayArg(arg, fn, context) {\n if (Array.isArray(arg)) {\n each(arg, context[fn], context);\n return true;\n }\n return false;\n }\n /**\n * walk objects and arrays\n * @param {Object} obj\n * @param {Function} iterator\n * @param {Object} context\n */\n function each(obj, iterator, context) {\n var i;\n if (!obj) {\n return;\n }\n if (obj.forEach) {\n obj.forEach(iterator, context);\n }\n else if (obj.length !== undefined) {\n i = 0;\n while (i < obj.length) {\n iterator.call(context, obj[i], i, obj);\n i++;\n }\n }\n else {\n for (i in obj) {\n obj.hasOwnProperty(i) && iterator.call(context, obj[i], i, obj);\n }\n }\n }\n /**\n * wrap a method with a deprecation warning and stack trace\n * @param {Function} method\n * @param {String} name\n * @param {String} message\n * @returns {Function} A new function wrapping the supplied method.\n */\n function deprecate(method, name, message) {\n var deprecationMessage = 'DEPRECATED METHOD: ' + name + '\\n' + message + ' AT \\n';\n return function () {\n var e = new Error('get-stack-trace');\n var stack = e && e.stack ? e.stack.replace(/^[^\\(]+?[\\n$]/gm, '')\n .replace(/^\\s+at\\s+/gm, '')\n .replace(/^Object.\\s*\\(/gm, '{anonymous}()@') : 'Unknown Stack Trace';\n var log = window.console && (window.console.warn || window.console.log);\n if (log) {\n log.call(window.console, deprecationMessage, stack);\n }\n return method.apply(this, arguments);\n };\n }\n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} target\n * @param {...Object} objects_to_assign\n * @returns {Object} target\n */\n var assign;\n if (typeof Object.assign !== 'function') {\n assign = function assign(target) {\n if (target === undefined || target === null) {\n throw new TypeError('Cannot convert undefined or null to object');\n }\n var output = Object(target);\n for (var index = 1; index < arguments.length; index++) {\n var source = arguments[index];\n if (source !== undefined && source !== null) {\n for (var nextKey in source) {\n if (source.hasOwnProperty(nextKey)) {\n output[nextKey] = source[nextKey];\n }\n }\n }\n }\n return output;\n };\n }\n else {\n assign = Object.assign;\n }\n /**\n * extend object.\n * means that properties in dest will be overwritten by the ones in src.\n * @param {Object} dest\n * @param {Object} src\n * @param {Boolean} [merge=false]\n * @returns {Object} dest\n */\n var extend = deprecate(function extend(dest, src, merge) {\n var keys = Object.keys(src);\n var i = 0;\n while (i < keys.length) {\n if (!merge || (merge && dest[keys[i]] === undefined)) {\n dest[keys[i]] = src[keys[i]];\n }\n i++;\n }\n return dest;\n }, 'extend', 'Use `assign`.');\n /**\n * merge the values from src in the dest.\n * means that properties that exist in dest will not be overwritten by src\n * @param {Object} dest\n * @param {Object} src\n * @returns {Object} dest\n */\n var merge = deprecate(function merge(dest, src) {\n return extend(dest, src, true);\n }, 'merge', 'Use `assign`.');\n /**\n * simple class inheritance\n * @param {Function} child\n * @param {Function} base\n * @param {Object} [properties]\n */\n function inherit(child, base, properties) {\n var baseP = base.prototype, childP;\n childP = child.prototype = Object.create(baseP);\n childP.constructor = child;\n childP._super = baseP;\n if (properties) {\n assign(childP, properties);\n }\n }\n /**\n * simple function bind\n * @param {Function} fn\n * @param {Object} context\n * @returns {Function}\n */\n function bindFn(fn, context) {\n return function boundFn() {\n return fn.apply(context, arguments);\n };\n }\n /**\n * let a boolean value also be a function that must return a boolean\n * this first item in args will be used as the context\n * @param {Boolean|Function} val\n * @param {Array} [args]\n * @returns {Boolean}\n */\n function boolOrFn(val, args) {\n if (typeof val == TYPE_FUNCTION) {\n return val.apply(args ? args[0] || undefined : undefined, args);\n }\n return val;\n }\n /**\n * use the val2 when val1 is undefined\n * @param {*} val1\n * @param {*} val2\n * @returns {*}\n */\n function ifUndefined(val1, val2) {\n return (val1 === undefined) ? val2 : val1;\n }\n /**\n * addEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function addEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.addEventListener(type, handler, false);\n });\n }\n /**\n * removeEventListener with multiple events at once\n * @param {EventTarget} target\n * @param {String} types\n * @param {Function} handler\n */\n function removeEventListeners(target, types, handler) {\n each(splitStr(types), function (type) {\n target.removeEventListener(type, handler, false);\n });\n }\n /**\n * find if a node is in the given parent\n * @method hasParent\n * @param {HTMLElement} node\n * @param {HTMLElement} parent\n * @return {Boolean} found\n */\n function hasParent(node, parent) {\n while (node) {\n if (node == parent) {\n return true;\n }\n node = node.parentNode;\n }\n return false;\n }\n /**\n * small indexOf wrapper\n * @param {String} str\n * @param {String} find\n * @returns {Boolean} found\n */\n function inStr(str, find) {\n return str.indexOf(find) > -1;\n }\n /**\n * split string on whitespace\n * @param {String} str\n * @returns {Array} words\n */\n function splitStr(str) {\n return str.trim().split(/\\s+/g);\n }\n /**\n * find if a array contains the object using indexOf or a simple polyFill\n * @param {Array} src\n * @param {String} find\n * @param {String} [findByKey]\n * @return {Boolean|Number} false when not found, or the index\n */\n function inArray(src, find, findByKey) {\n if (src.indexOf && !findByKey) {\n return src.indexOf(find);\n }\n else {\n var i = 0;\n while (i < src.length) {\n if ((findByKey && src[i][findByKey] == find) || (!findByKey && src[i] === find)) {\n return i;\n }\n i++;\n }\n return -1;\n }\n }\n /**\n * convert array-like objects to real arrays\n * @param {Object} obj\n * @returns {Array}\n */\n function toArray(obj) {\n return Array.prototype.slice.call(obj, 0);\n }\n /**\n * unique array with objects based on a key (like 'id') or just by the array's value\n * @param {Array} src [{id:1},{id:2},{id:1}]\n * @param {String} [key]\n * @param {Boolean} [sort=False]\n * @returns {Array} [{id:1},{id:2}]\n */\n function uniqueArray(src, key, sort) {\n var results = [];\n var values = [];\n var i = 0;\n while (i < src.length) {\n var val = key ? src[i][key] : src[i];\n if (inArray(values, val) < 0) {\n results.push(src[i]);\n }\n values[i] = val;\n i++;\n }\n if (sort) {\n if (!key) {\n results = results.sort();\n }\n else {\n results = results.sort(function sortUniqueArray(a, b) {\n return a[key] > b[key];\n });\n }\n }\n return results;\n }\n /**\n * get the prefixed property\n * @param {Object} obj\n * @param {String} property\n * @returns {String|Undefined} prefixed\n */\n function prefixed(obj, property) {\n var prefix, prop;\n var camelProp = property[0].toUpperCase() + property.slice(1);\n var i = 0;\n while (i < VENDOR_PREFIXES.length) {\n prefix = VENDOR_PREFIXES[i];\n prop = (prefix) ? prefix + camelProp : property;\n if (prop in obj) {\n return prop;\n }\n i++;\n }\n return undefined;\n }\n /**\n * get a unique id\n * @returns {number} uniqueId\n */\n var _uniqueId = 1;\n function uniqueId() {\n return _uniqueId++;\n }\n /**\n * get the window object of an element\n * @param {HTMLElement} element\n * @returns {DocumentView|Window}\n */\n function getWindowForElement(element) {\n var doc = element.ownerDocument || element;\n return (doc.defaultView || doc.parentWindow || window);\n }\n var MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android/i;\n var SUPPORT_TOUCH = ('ontouchstart' in window);\n var SUPPORT_POINTER_EVENTS = prefixed(window, 'PointerEvent') !== undefined;\n var SUPPORT_ONLY_TOUCH = SUPPORT_TOUCH && MOBILE_REGEX.test(navigator.userAgent);\n var INPUT_TYPE_TOUCH = 'touch';\n var INPUT_TYPE_PEN = 'pen';\n var INPUT_TYPE_MOUSE = 'mouse';\n var INPUT_TYPE_KINECT = 'kinect';\n var COMPUTE_INTERVAL = 25;\n var INPUT_START = 1;\n var INPUT_MOVE = 2;\n var INPUT_END = 4;\n var INPUT_CANCEL = 8;\n var DIRECTION_NONE = 1;\n var DIRECTION_LEFT = 2;\n var DIRECTION_RIGHT = 4;\n var DIRECTION_UP = 8;\n var DIRECTION_DOWN = 16;\n var DIRECTION_HORIZONTAL = DIRECTION_LEFT | DIRECTION_RIGHT;\n var DIRECTION_VERTICAL = DIRECTION_UP | DIRECTION_DOWN;\n var DIRECTION_ALL = DIRECTION_HORIZONTAL | DIRECTION_VERTICAL;\n var PROPS_XY = ['x', 'y'];\n var PROPS_CLIENT_XY = ['clientX', 'clientY'];\n /**\n * create new input type manager\n * @param {Manager} manager\n * @param {Function} callback\n * @returns {Input}\n * @constructor\n */\n function Input(manager, callback) {\n var self = this;\n this.manager = manager;\n this.callback = callback;\n this.element = manager.element;\n this.target = manager.options.inputTarget;\n // smaller wrapper around the handler, for the scope and the enabled state of the manager,\n // so when disabled the input events are completely bypassed.\n this.domHandler = function (ev) {\n if (boolOrFn(manager.options.enable, [manager])) {\n self.handler(ev);\n }\n };\n this.init();\n }\n Input.prototype = {\n /**\n * should handle the inputEvent data and trigger the callback\n * @virtual\n */\n handler: function () { },\n /**\n * bind the events\n */\n init: function () {\n this.evEl && addEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && addEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && addEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n },\n /**\n * unbind the events\n */\n destroy: function () {\n this.evEl && removeEventListeners(this.element, this.evEl, this.domHandler);\n this.evTarget && removeEventListeners(this.target, this.evTarget, this.domHandler);\n this.evWin && removeEventListeners(getWindowForElement(this.element), this.evWin, this.domHandler);\n }\n };\n /**\n * create new input type manager\n * called by the Manager constructor\n * @param {Hammer} manager\n * @returns {Input}\n */\n function createInputInstance(manager) {\n var Type;\n var inputClass = manager.options.inputClass;\n if (inputClass) {\n Type = inputClass;\n }\n else if (SUPPORT_POINTER_EVENTS) {\n Type = PointerEventInput;\n }\n else if (SUPPORT_ONLY_TOUCH) {\n Type = TouchInput;\n }\n else if (!SUPPORT_TOUCH) {\n Type = MouseInput;\n }\n else {\n Type = TouchMouseInput;\n }\n return new (Type)(manager, inputHandler);\n }\n /**\n * handle input events\n * @param {Manager} manager\n * @param {String} eventType\n * @param {Object} input\n */\n function inputHandler(manager, eventType, input) {\n var pointersLen = input.pointers.length;\n var changedPointersLen = input.changedPointers.length;\n var isFirst = (eventType & INPUT_START && (pointersLen - changedPointersLen === 0));\n var isFinal = (eventType & (INPUT_END | INPUT_CANCEL) && (pointersLen - changedPointersLen === 0));\n input.isFirst = !!isFirst;\n input.isFinal = !!isFinal;\n if (isFirst) {\n manager.session = {};\n }\n // source event is the normalized value of the domEvents\n // like 'touchstart, mouseup, pointerdown'\n input.eventType = eventType;\n // compute scale, rotation etc\n computeInputData(manager, input);\n // emit secret event\n manager.emit('hammer.input', input);\n manager.recognize(input);\n manager.session.prevInput = input;\n }\n /**\n * extend the data with some usable properties like scale, rotate, velocity etc\n * @param {Object} manager\n * @param {Object} input\n */\n function computeInputData(manager, input) {\n var session = manager.session;\n var pointers = input.pointers;\n var pointersLength = pointers.length;\n // store the first input to calculate the distance and direction\n if (!session.firstInput) {\n session.firstInput = simpleCloneInputData(input);\n }\n // to compute scale and rotation we need to store the multiple touches\n if (pointersLength > 1 && !session.firstMultiple) {\n session.firstMultiple = simpleCloneInputData(input);\n }\n else if (pointersLength === 1) {\n session.firstMultiple = false;\n }\n var firstInput = session.firstInput;\n var firstMultiple = session.firstMultiple;\n var offsetCenter = firstMultiple ? firstMultiple.center : firstInput.center;\n var center = input.center = getCenter(pointers);\n input.timeStamp = now();\n input.deltaTime = input.timeStamp - firstInput.timeStamp;\n input.angle = getAngle(offsetCenter, center);\n input.distance = getDistance(offsetCenter, center);\n computeDeltaXY(session, input);\n input.offsetDirection = getDirection(input.deltaX, input.deltaY);\n var overallVelocity = getVelocity(input.deltaTime, input.deltaX, input.deltaY);\n input.overallVelocityX = overallVelocity.x;\n input.overallVelocityY = overallVelocity.y;\n input.overallVelocity = (abs(overallVelocity.x) > abs(overallVelocity.y)) ? overallVelocity.x : overallVelocity.y;\n input.scale = firstMultiple ? getScale(firstMultiple.pointers, pointers) : 1;\n input.rotation = firstMultiple ? getRotation(firstMultiple.pointers, pointers) : 0;\n input.maxPointers = !session.prevInput ? input.pointers.length : ((input.pointers.length >\n session.prevInput.maxPointers) ? input.pointers.length : session.prevInput.maxPointers);\n computeIntervalInputData(session, input);\n // find the correct target\n var target = manager.element;\n if (hasParent(input.srcEvent.target, target)) {\n target = input.srcEvent.target;\n }\n input.target = target;\n }\n function computeDeltaXY(session, input) {\n var center = input.center;\n var offset = session.offsetDelta || {};\n var prevDelta = session.prevDelta || {};\n var prevInput = session.prevInput || {};\n if (input.eventType === INPUT_START || prevInput.eventType === INPUT_END) {\n prevDelta = session.prevDelta = {\n x: prevInput.deltaX || 0,\n y: prevInput.deltaY || 0\n };\n offset = session.offsetDelta = {\n x: center.x,\n y: center.y\n };\n }\n input.deltaX = prevDelta.x + (center.x - offset.x);\n input.deltaY = prevDelta.y + (center.y - offset.y);\n }\n /**\n * velocity is calculated every x ms\n * @param {Object} session\n * @param {Object} input\n */\n function computeIntervalInputData(session, input) {\n var last = session.lastInterval || input, deltaTime = input.timeStamp - last.timeStamp, velocity, velocityX, velocityY, direction;\n if (input.eventType != INPUT_CANCEL && (deltaTime > COMPUTE_INTERVAL || last.velocity === undefined)) {\n var deltaX = input.deltaX - last.deltaX;\n var deltaY = input.deltaY - last.deltaY;\n var v = getVelocity(deltaTime, deltaX, deltaY);\n velocityX = v.x;\n velocityY = v.y;\n velocity = (abs(v.x) > abs(v.y)) ? v.x : v.y;\n direction = getDirection(deltaX, deltaY);\n session.lastInterval = input;\n }\n else {\n // use latest velocity info if it doesn't overtake a minimum period\n velocity = last.velocity;\n velocityX = last.velocityX;\n velocityY = last.velocityY;\n direction = last.direction;\n }\n input.velocity = velocity;\n input.velocityX = velocityX;\n input.velocityY = velocityY;\n input.direction = direction;\n }\n /**\n * create a simple clone from the input used for storage of firstInput and firstMultiple\n * @param {Object} input\n * @returns {Object} clonedInputData\n */\n function simpleCloneInputData(input) {\n // make a simple copy of the pointers because we will get a reference if we don't\n // we only need clientXY for the calculations\n var pointers = [];\n var i = 0;\n while (i < input.pointers.length) {\n pointers[i] = {\n clientX: round(input.pointers[i].clientX),\n clientY: round(input.pointers[i].clientY)\n };\n i++;\n }\n return {\n timeStamp: now(),\n pointers: pointers,\n center: getCenter(pointers),\n deltaX: input.deltaX,\n deltaY: input.deltaY\n };\n }\n /**\n * get the center of all the pointers\n * @param {Array} pointers\n * @return {Object} center contains `x` and `y` properties\n */\n function getCenter(pointers) {\n var pointersLength = pointers.length;\n // no need to loop when only one touch\n if (pointersLength === 1) {\n return {\n x: round(pointers[0].clientX),\n y: round(pointers[0].clientY)\n };\n }\n var x = 0, y = 0, i = 0;\n while (i < pointersLength) {\n x += pointers[i].clientX;\n y += pointers[i].clientY;\n i++;\n }\n return {\n x: round(x / pointersLength),\n y: round(y / pointersLength)\n };\n }\n /**\n * calculate the velocity between two points. unit is in px per ms.\n * @param {Number} deltaTime\n * @param {Number} x\n * @param {Number} y\n * @return {Object} velocity `x` and `y`\n */\n function getVelocity(deltaTime, x, y) {\n return {\n x: x / deltaTime || 0,\n y: y / deltaTime || 0\n };\n }\n /**\n * get the direction between two points\n * @param {Number} x\n * @param {Number} y\n * @return {Number} direction\n */\n function getDirection(x, y) {\n if (x === y) {\n return DIRECTION_NONE;\n }\n if (abs(x) >= abs(y)) {\n return x < 0 ? DIRECTION_LEFT : DIRECTION_RIGHT;\n }\n return y < 0 ? DIRECTION_UP : DIRECTION_DOWN;\n }\n /**\n * calculate the absolute distance between two points\n * @param {Object} p1 {x, y}\n * @param {Object} p2 {x, y}\n * @param {Array} [props] containing x and y keys\n * @return {Number} distance\n */\n function getDistance(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];\n return Math.sqrt((x * x) + (y * y));\n }\n /**\n * calculate the angle between two coordinates\n * @param {Object} p1\n * @param {Object} p2\n * @param {Array} [props] containing x and y keys\n * @return {Number} angle\n */\n function getAngle(p1, p2, props) {\n if (!props) {\n props = PROPS_XY;\n }\n var x = p2[props[0]] - p1[props[0]], y = p2[props[1]] - p1[props[1]];\n return Math.atan2(y, x) * 180 / Math.PI;\n }\n /**\n * calculate the rotation degrees between two pointersets\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} rotation\n */\n function getRotation(start, end) {\n return getAngle(end[1], end[0], PROPS_CLIENT_XY) + getAngle(start[1], start[0], PROPS_CLIENT_XY);\n }\n /**\n * calculate the scale factor between two pointersets\n * no scale is 1, and goes down to 0 when pinched together, and bigger when pinched out\n * @param {Array} start array of pointers\n * @param {Array} end array of pointers\n * @return {Number} scale\n */\n function getScale(start, end) {\n return getDistance(end[0], end[1], PROPS_CLIENT_XY) / getDistance(start[0], start[1], PROPS_CLIENT_XY);\n }\n var MOUSE_INPUT_MAP = {\n mousedown: INPUT_START,\n mousemove: INPUT_MOVE,\n mouseup: INPUT_END\n };\n var MOUSE_ELEMENT_EVENTS = 'mousedown';\n var MOUSE_WINDOW_EVENTS = 'mousemove mouseup';\n /**\n * Mouse events input\n * @constructor\n * @extends Input\n */\n function MouseInput() {\n this.evEl = MOUSE_ELEMENT_EVENTS;\n this.evWin = MOUSE_WINDOW_EVENTS;\n this.pressed = false; // mousedown state\n Input.apply(this, arguments);\n }\n inherit(MouseInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function MEhandler(ev) {\n var eventType = MOUSE_INPUT_MAP[ev.type];\n // on start we want to have the left mouse button down\n if (eventType & INPUT_START && ev.button === 0) {\n this.pressed = true;\n }\n if (eventType & INPUT_MOVE && ev.which !== 1) {\n eventType = INPUT_END;\n }\n // mouse must be down\n if (!this.pressed) {\n return;\n }\n if (eventType & INPUT_END) {\n this.pressed = false;\n }\n this.callback(this.manager, eventType, {\n pointers: [ev],\n changedPointers: [ev],\n pointerType: INPUT_TYPE_MOUSE,\n srcEvent: ev\n });\n }\n });\n var POINTER_INPUT_MAP = {\n pointerdown: INPUT_START,\n pointermove: INPUT_MOVE,\n pointerup: INPUT_END,\n pointercancel: INPUT_CANCEL,\n pointerout: INPUT_CANCEL\n };\n // in IE10 the pointer types is defined as an enum\n var IE10_POINTER_TYPE_ENUM = {\n 2: INPUT_TYPE_TOUCH,\n 3: INPUT_TYPE_PEN,\n 4: INPUT_TYPE_MOUSE,\n 5: INPUT_TYPE_KINECT // see https://twitter.com/jacobrossi/status/480596438489890816\n };\n var POINTER_ELEMENT_EVENTS = 'pointerdown';\n var POINTER_WINDOW_EVENTS = 'pointermove pointerup pointercancel';\n // IE10 has prefixed support, and case-sensitive\n if (window.MSPointerEvent && !window.PointerEvent) {\n POINTER_ELEMENT_EVENTS = 'MSPointerDown';\n POINTER_WINDOW_EVENTS = 'MSPointerMove MSPointerUp MSPointerCancel';\n }\n /**\n * Pointer events input\n * @constructor\n * @extends Input\n */\n function PointerEventInput() {\n this.evEl = POINTER_ELEMENT_EVENTS;\n this.evWin = POINTER_WINDOW_EVENTS;\n Input.apply(this, arguments);\n this.store = (this.manager.session.pointerEvents = []);\n }\n inherit(PointerEventInput, Input, {\n /**\n * handle mouse events\n * @param {Object} ev\n */\n handler: function PEhandler(ev) {\n var store = this.store;\n var removePointer = false;\n var eventTypeNormalized = ev.type.toLowerCase().replace('ms', '');\n var eventType = POINTER_INPUT_MAP[eventTypeNormalized];\n var pointerType = IE10_POINTER_TYPE_ENUM[ev.pointerType] || ev.pointerType;\n var isTouch = (pointerType == INPUT_TYPE_TOUCH);\n // get index of the event in the store\n var storeIndex = inArray(store, ev.pointerId, 'pointerId');\n // start and mouse must be down\n if (eventType & INPUT_START && (ev.button === 0 || isTouch)) {\n if (storeIndex < 0) {\n store.push(ev);\n storeIndex = store.length - 1;\n }\n }\n else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n removePointer = true;\n }\n // it not found, so the pointer hasn't been down (so it's probably a hover)\n if (storeIndex < 0) {\n return;\n }\n // update the event in the store\n store[storeIndex] = ev;\n this.callback(this.manager, eventType, {\n pointers: store,\n changedPointers: [ev],\n pointerType: pointerType,\n srcEvent: ev\n });\n if (removePointer) {\n // remove from the store\n store.splice(storeIndex, 1);\n }\n }\n });\n var SINGLE_TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n var SINGLE_TOUCH_TARGET_EVENTS = 'touchstart';\n var SINGLE_TOUCH_WINDOW_EVENTS = 'touchstart touchmove touchend touchcancel';\n /**\n * Touch events input\n * @constructor\n * @extends Input\n */\n function SingleTouchInput() {\n this.evTarget = SINGLE_TOUCH_TARGET_EVENTS;\n this.evWin = SINGLE_TOUCH_WINDOW_EVENTS;\n this.started = false;\n Input.apply(this, arguments);\n }\n inherit(SingleTouchInput, Input, {\n handler: function TEhandler(ev) {\n var type = SINGLE_TOUCH_INPUT_MAP[ev.type];\n // should we handle the touch events?\n if (type === INPUT_START) {\n this.started = true;\n }\n if (!this.started) {\n return;\n }\n var touches = normalizeSingleTouches.call(this, ev, type);\n // when done, reset the started state\n if (type & (INPUT_END | INPUT_CANCEL) && touches[0].length - touches[1].length === 0) {\n this.started = false;\n }\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function normalizeSingleTouches(ev, type) {\n var all = toArray(ev.touches);\n var changed = toArray(ev.changedTouches);\n if (type & (INPUT_END | INPUT_CANCEL)) {\n all = uniqueArray(all.concat(changed), 'identifier', true);\n }\n return [all, changed];\n }\n var TOUCH_INPUT_MAP = {\n touchstart: INPUT_START,\n touchmove: INPUT_MOVE,\n touchend: INPUT_END,\n touchcancel: INPUT_CANCEL\n };\n var TOUCH_TARGET_EVENTS = 'touchstart touchmove touchend touchcancel';\n /**\n * Multi-user touch events input\n * @constructor\n * @extends Input\n */\n function TouchInput() {\n this.evTarget = TOUCH_TARGET_EVENTS;\n this.targetIds = {};\n Input.apply(this, arguments);\n }\n inherit(TouchInput, Input, {\n handler: function MTEhandler(ev) {\n var type = TOUCH_INPUT_MAP[ev.type];\n var touches = getTouches.call(this, ev, type);\n if (!touches) {\n return;\n }\n this.callback(this.manager, type, {\n pointers: touches[0],\n changedPointers: touches[1],\n pointerType: INPUT_TYPE_TOUCH,\n srcEvent: ev\n });\n }\n });\n /**\n * @this {TouchInput}\n * @param {Object} ev\n * @param {Number} type flag\n * @returns {undefined|Array} [all, changed]\n */\n function getTouches(ev, type) {\n var allTouches = toArray(ev.touches);\n var targetIds = this.targetIds;\n // when there is only one touch, the process can be simplified\n if (type & (INPUT_START | INPUT_MOVE) && allTouches.length === 1) {\n targetIds[allTouches[0].identifier] = true;\n return [allTouches, allTouches];\n }\n var i, targetTouches, changedTouches = toArray(ev.changedTouches), changedTargetTouches = [], target = this.target;\n // get target touches from touches\n targetTouches = allTouches.filter(function (touch) {\n return hasParent(touch.target, target);\n });\n // collect touches\n if (type === INPUT_START) {\n i = 0;\n while (i < targetTouches.length) {\n targetIds[targetTouches[i].identifier] = true;\n i++;\n }\n }\n // filter changed touches to only contain touches that exist in the collected target ids\n i = 0;\n while (i < changedTouches.length) {\n if (targetIds[changedTouches[i].identifier]) {\n changedTargetTouches.push(changedTouches[i]);\n }\n // cleanup removed touches\n if (type & (INPUT_END | INPUT_CANCEL)) {\n delete targetIds[changedTouches[i].identifier];\n }\n i++;\n }\n if (!changedTargetTouches.length) {\n return;\n }\n return [\n // merge targetTouches with changedTargetTouches so it contains ALL touches, including 'end' and 'cancel'\n uniqueArray(targetTouches.concat(changedTargetTouches), 'identifier', true),\n changedTargetTouches\n ];\n }\n /**\n * Combined touch and mouse input\n *\n * Touch has a higher priority then mouse, and while touching no mouse events are allowed.\n * This because touch devices also emit mouse events while doing a touch.\n *\n * @constructor\n * @extends Input\n */\n var DEDUP_TIMEOUT = 2500;\n var DEDUP_DISTANCE = 25;\n function TouchMouseInput() {\n Input.apply(this, arguments);\n var handler = bindFn(this.handler, this);\n this.touch = new TouchInput(this.manager, handler);\n this.mouse = new MouseInput(this.manager, handler);\n this.primaryTouch = null;\n this.lastTouches = [];\n }\n inherit(TouchMouseInput, Input, {\n /**\n * handle mouse and touch events\n * @param {Hammer} manager\n * @param {String} inputEvent\n * @param {Object} inputData\n */\n handler: function TMEhandler(manager, inputEvent, inputData) {\n var isTouch = (inputData.pointerType == INPUT_TYPE_TOUCH), isMouse = (inputData.pointerType == INPUT_TYPE_MOUSE);\n if (isMouse && inputData.sourceCapabilities && inputData.sourceCapabilities.firesTouchEvents) {\n return;\n }\n // when we're in a touch event, record touches to de-dupe synthetic mouse event\n if (isTouch) {\n recordTouches.call(this, inputEvent, inputData);\n }\n else if (isMouse && isSyntheticEvent.call(this, inputData)) {\n return;\n }\n this.callback(manager, inputEvent, inputData);\n },\n /**\n * remove the event listeners\n */\n destroy: function destroy() {\n this.touch.destroy();\n this.mouse.destroy();\n }\n });\n function recordTouches(eventType, eventData) {\n if (eventType & INPUT_START) {\n this.primaryTouch = eventData.changedPointers[0].identifier;\n setLastTouch.call(this, eventData);\n }\n else if (eventType & (INPUT_END | INPUT_CANCEL)) {\n setLastTouch.call(this, eventData);\n }\n }\n function setLastTouch(eventData) {\n var touch = eventData.changedPointers[0];\n if (touch.identifier === this.primaryTouch) {\n var lastTouch = { x: touch.clientX, y: touch.clientY };\n this.lastTouches.push(lastTouch);\n var lts = this.lastTouches;\n var removeLastTouch = function () {\n var i = lts.indexOf(lastTouch);\n if (i > -1) {\n lts.splice(i, 1);\n }\n };\n setTimeout(removeLastTouch, DEDUP_TIMEOUT);\n }\n }\n function isSyntheticEvent(eventData) {\n var x = eventData.srcEvent.clientX, y = eventData.srcEvent.clientY;\n for (var i = 0; i < this.lastTouches.length; i++) {\n var t = this.lastTouches[i];\n var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);\n if (dx <= DEDUP_DISTANCE && dy <= DEDUP_DISTANCE) {\n return true;\n }\n }\n return false;\n }\n var PREFIXED_TOUCH_ACTION = prefixed(TEST_ELEMENT.style, 'touchAction');\n var NATIVE_TOUCH_ACTION = PREFIXED_TOUCH_ACTION !== undefined;\n // magical touchAction value\n var TOUCH_ACTION_COMPUTE = 'compute';\n var TOUCH_ACTION_AUTO = 'auto';\n var TOUCH_ACTION_MANIPULATION = 'manipulation'; // not implemented\n var TOUCH_ACTION_NONE = 'none';\n var TOUCH_ACTION_PAN_X = 'pan-x';\n var TOUCH_ACTION_PAN_Y = 'pan-y';\n var TOUCH_ACTION_MAP = getTouchActionProps();\n /**\n * Touch Action\n * sets the touchAction property or uses the js alternative\n * @param {Manager} manager\n * @param {String} value\n * @constructor\n */\n function TouchAction(manager, value) {\n this.manager = manager;\n this.set(value);\n }\n TouchAction.prototype = {\n /**\n * set the touchAction value on the element or enable the polyfill\n * @param {String} value\n */\n set: function (value) {\n // find out the touch-action by the event handlers\n if (value == TOUCH_ACTION_COMPUTE) {\n value = this.compute();\n }\n if (NATIVE_TOUCH_ACTION && this.manager.element.style && TOUCH_ACTION_MAP[value]) {\n this.manager.element.style[PREFIXED_TOUCH_ACTION] = value;\n }\n this.actions = value.toLowerCase().trim();\n },\n /**\n * just re-set the touchAction value\n */\n update: function () {\n this.set(this.manager.options.touchAction);\n },\n /**\n * compute the value for the touchAction property based on the recognizer's settings\n * @returns {String} value\n */\n compute: function () {\n var actions = [];\n each(this.manager.recognizers, function (recognizer) {\n if (boolOrFn(recognizer.options.enable, [recognizer])) {\n actions = actions.concat(recognizer.getTouchAction());\n }\n });\n return cleanTouchActions(actions.join(' '));\n },\n /**\n * this method is called on each input cycle and provides the preventing of the browser behavior\n * @param {Object} input\n */\n preventDefaults: function (input) {\n var srcEvent = input.srcEvent;\n var direction = input.offsetDirection;\n // if the touch action did prevented once this session\n if (this.manager.session.prevented) {\n srcEvent.preventDefault();\n return;\n }\n var actions = this.actions;\n var hasNone = inStr(actions, TOUCH_ACTION_NONE) && !TOUCH_ACTION_MAP[TOUCH_ACTION_NONE];\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_Y];\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X) && !TOUCH_ACTION_MAP[TOUCH_ACTION_PAN_X];\n if (hasNone) {\n //do not prevent defaults if this is a tap gesture\n var isTapPointer = input.pointers.length === 1;\n var isTapMovement = input.distance < 2;\n var isTapTouchTime = input.deltaTime < 250;\n if (isTapPointer && isTapMovement && isTapTouchTime) {\n return;\n }\n }\n if (hasPanX && hasPanY) {\n // `pan-x pan-y` means browser handles all scrolling/panning, do not prevent\n return;\n }\n if (hasNone ||\n (hasPanY && direction & DIRECTION_HORIZONTAL) ||\n (hasPanX && direction & DIRECTION_VERTICAL)) {\n return this.preventSrc(srcEvent);\n }\n },\n /**\n * call preventDefault to prevent the browser's default behavior (scrolling in most cases)\n * @param {Object} srcEvent\n */\n preventSrc: function (srcEvent) {\n this.manager.session.prevented = true;\n srcEvent.preventDefault();\n }\n };\n /**\n * when the touchActions are collected they are not a valid value, so we need to clean things up. *\n * @param {String} actions\n * @returns {*}\n */\n function cleanTouchActions(actions) {\n // none\n if (inStr(actions, TOUCH_ACTION_NONE)) {\n return TOUCH_ACTION_NONE;\n }\n var hasPanX = inStr(actions, TOUCH_ACTION_PAN_X);\n var hasPanY = inStr(actions, TOUCH_ACTION_PAN_Y);\n // if both pan-x and pan-y are set (different recognizers\n // for different directions, e.g. horizontal pan but vertical swipe?)\n // we need none (as otherwise with pan-x pan-y combined none of these\n // recognizers will work, since the browser would handle all panning\n if (hasPanX && hasPanY) {\n return TOUCH_ACTION_NONE;\n }\n // pan-x OR pan-y\n if (hasPanX || hasPanY) {\n return hasPanX ? TOUCH_ACTION_PAN_X : TOUCH_ACTION_PAN_Y;\n }\n // manipulation\n if (inStr(actions, TOUCH_ACTION_MANIPULATION)) {\n return TOUCH_ACTION_MANIPULATION;\n }\n return TOUCH_ACTION_AUTO;\n }\n function getTouchActionProps() {\n if (!NATIVE_TOUCH_ACTION) {\n return false;\n }\n var touchMap = {};\n var cssSupports = window.CSS && window.CSS.supports;\n ['auto', 'manipulation', 'pan-y', 'pan-x', 'pan-x pan-y', 'none'].forEach(function (val) {\n // If css.supports is not supported but there is native touch-action assume it supports\n // all values. This is the case for IE 10 and 11.\n touchMap[val] = cssSupports ? window.CSS.supports('touch-action', val) : true;\n });\n return touchMap;\n }\n /**\n * Recognizer flow explained; *\n * All recognizers have the initial state of POSSIBLE when a input session starts.\n * The definition of a input session is from the first input until the last input, with all it's movement in it. *\n * Example session for mouse-input: mousedown -> mousemove -> mouseup\n *\n * On each recognizing cycle (see Manager.recognize) the .recognize() method is executed\n * which determines with state it should be.\n *\n * If the recognizer has the state FAILED, CANCELLED or RECOGNIZED (equals ENDED), it is reset to\n * POSSIBLE to give it another change on the next cycle.\n *\n * Possible\n * |\n * +-----+---------------+\n * | |\n * +-----+-----+ |\n * | | |\n * Failed Cancelled |\n * +-------+------+\n * | |\n * Recognized Began\n * |\n * Changed\n * |\n * Ended/Recognized\n */\n var STATE_POSSIBLE = 1;\n var STATE_BEGAN = 2;\n var STATE_CHANGED = 4;\n var STATE_ENDED = 8;\n var STATE_RECOGNIZED = STATE_ENDED;\n var STATE_CANCELLED = 16;\n var STATE_FAILED = 32;\n /**\n * Recognizer\n * Every recognizer needs to extend from this class.\n * @constructor\n * @param {Object} options\n */\n function Recognizer(options) {\n this.options = assign({}, this.defaults, options || {});\n this.id = uniqueId();\n this.manager = null;\n // default is enable true\n this.options.enable = ifUndefined(this.options.enable, true);\n this.state = STATE_POSSIBLE;\n this.simultaneous = {};\n this.requireFail = [];\n }\n Recognizer.prototype = {\n /**\n * @virtual\n * @type {Object}\n */\n defaults: {},\n /**\n * set options\n * @param {Object} options\n * @return {Recognizer}\n */\n set: function (options) {\n assign(this.options, options);\n // also update the touchAction, in case something changed about the directions/enabled state\n this.manager && this.manager.touchAction.update();\n return this;\n },\n /**\n * recognize simultaneous with an other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n recognizeWith: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'recognizeWith', this)) {\n return this;\n }\n var simultaneous = this.simultaneous;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (!simultaneous[otherRecognizer.id]) {\n simultaneous[otherRecognizer.id] = otherRecognizer;\n otherRecognizer.recognizeWith(this);\n }\n return this;\n },\n /**\n * drop the simultaneous link. it doesnt remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRecognizeWith: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRecognizeWith', this)) {\n return this;\n }\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n delete this.simultaneous[otherRecognizer.id];\n return this;\n },\n /**\n * recognizer can only run when an other is failing\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n requireFailure: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'requireFailure', this)) {\n return this;\n }\n var requireFail = this.requireFail;\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n if (inArray(requireFail, otherRecognizer) === -1) {\n requireFail.push(otherRecognizer);\n otherRecognizer.requireFailure(this);\n }\n return this;\n },\n /**\n * drop the requireFailure link. it does not remove the link on the other recognizer.\n * @param {Recognizer} otherRecognizer\n * @returns {Recognizer} this\n */\n dropRequireFailure: function (otherRecognizer) {\n if (invokeArrayArg(otherRecognizer, 'dropRequireFailure', this)) {\n return this;\n }\n otherRecognizer = getRecognizerByNameIfManager(otherRecognizer, this);\n var index = inArray(this.requireFail, otherRecognizer);\n if (index > -1) {\n this.requireFail.splice(index, 1);\n }\n return this;\n },\n /**\n * has require failures boolean\n * @returns {boolean}\n */\n hasRequireFailures: function () {\n return this.requireFail.length > 0;\n },\n /**\n * if the recognizer can recognize simultaneous with an other recognizer\n * @param {Recognizer} otherRecognizer\n * @returns {Boolean}\n */\n canRecognizeWith: function (otherRecognizer) {\n return !!this.simultaneous[otherRecognizer.id];\n },\n /**\n * You should use `tryEmit` instead of `emit` directly to check\n * that all the needed recognizers has failed before emitting.\n * @param {Object} input\n */\n emit: function (input) {\n var self = this;\n var state = this.state;\n function emit(event) {\n self.manager.emit(event, input);\n }\n // 'panstart' and 'panmove'\n if (state < STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n emit(self.options.event); // simple 'eventName' events\n if (input.additionalEvent) { // additional event(panleft, panright, pinchin, pinchout...)\n emit(input.additionalEvent);\n }\n // panend and pancancel\n if (state >= STATE_ENDED) {\n emit(self.options.event + stateStr(state));\n }\n },\n /**\n * Check that all the require failure recognizers has failed,\n * if true, it emits a gesture event,\n * otherwise, setup the state to FAILED.\n * @param {Object} input\n */\n tryEmit: function (input) {\n if (this.canEmit()) {\n return this.emit(input);\n }\n // it's failing anyway\n this.state = STATE_FAILED;\n },\n /**\n * can we emit?\n * @returns {boolean}\n */\n canEmit: function () {\n var i = 0;\n while (i < this.requireFail.length) {\n if (!(this.requireFail[i].state & (STATE_FAILED | STATE_POSSIBLE))) {\n return false;\n }\n i++;\n }\n return true;\n },\n /**\n * update the recognizer\n * @param {Object} inputData\n */\n recognize: function (inputData) {\n // make a new copy of the inputData\n // so we can change the inputData without messing up the other recognizers\n var inputDataClone = assign({}, inputData);\n // is is enabled and allow recognizing?\n if (!boolOrFn(this.options.enable, [this, inputDataClone])) {\n this.reset();\n this.state = STATE_FAILED;\n return;\n }\n // reset when we've reached the end\n if (this.state & (STATE_RECOGNIZED | STATE_CANCELLED | STATE_FAILED)) {\n this.state = STATE_POSSIBLE;\n }\n this.state = this.process(inputDataClone);\n // the recognizer has recognized a gesture\n // so trigger an event\n if (this.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED | STATE_CANCELLED)) {\n this.tryEmit(inputDataClone);\n }\n },\n /**\n * return the state of the recognizer\n * the actual recognizing happens in this method\n * @virtual\n * @param {Object} inputData\n * @returns {Const} STATE\n */\n process: function (inputData) { },\n /**\n * return the preferred touch-action\n * @virtual\n * @returns {Array}\n */\n getTouchAction: function () { },\n /**\n * called when the gesture isn't allowed to recognize\n * like when another is being recognized or it is disabled\n * @virtual\n */\n reset: function () { }\n };\n /**\n * get a usable string, used as event postfix\n * @param {Const} state\n * @returns {String} state\n */\n function stateStr(state) {\n if (state & STATE_CANCELLED) {\n return 'cancel';\n }\n else if (state & STATE_ENDED) {\n return 'end';\n }\n else if (state & STATE_CHANGED) {\n return 'move';\n }\n else if (state & STATE_BEGAN) {\n return 'start';\n }\n return '';\n }\n /**\n * direction cons to string\n * @param {Const} direction\n * @returns {String}\n */\n function directionStr(direction) {\n if (direction == DIRECTION_DOWN) {\n return 'down';\n }\n else if (direction == DIRECTION_UP) {\n return 'up';\n }\n else if (direction == DIRECTION_LEFT) {\n return 'left';\n }\n else if (direction == DIRECTION_RIGHT) {\n return 'right';\n }\n return '';\n }\n /**\n * get a recognizer by name if it is bound to a manager\n * @param {Recognizer|String} otherRecognizer\n * @param {Recognizer} recognizer\n * @returns {Recognizer}\n */\n function getRecognizerByNameIfManager(otherRecognizer, recognizer) {\n var manager = recognizer.manager;\n if (manager) {\n return manager.get(otherRecognizer);\n }\n return otherRecognizer;\n }\n /**\n * This recognizer is just used as a base for the simple attribute recognizers.\n * @constructor\n * @extends Recognizer\n */\n function AttrRecognizer() {\n Recognizer.apply(this, arguments);\n }\n inherit(AttrRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof AttrRecognizer\n */\n defaults: {\n /**\n * @type {Number}\n * @default 1\n */\n pointers: 1\n },\n /**\n * Used to check if it the recognizer receives valid input, like input.distance > 10.\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {Boolean} recognized\n */\n attrTest: function (input) {\n var optionPointers = this.options.pointers;\n return optionPointers === 0 || input.pointers.length === optionPointers;\n },\n /**\n * Process the input and return the state for the recognizer\n * @memberof AttrRecognizer\n * @param {Object} input\n * @returns {*} State\n */\n process: function (input) {\n var state = this.state;\n var eventType = input.eventType;\n var isRecognized = state & (STATE_BEGAN | STATE_CHANGED);\n var isValid = this.attrTest(input);\n // on cancel input and we've recognized before, return STATE_CANCELLED\n if (isRecognized && (eventType & INPUT_CANCEL || !isValid)) {\n return state | STATE_CANCELLED;\n }\n else if (isRecognized || isValid) {\n if (eventType & INPUT_END) {\n return state | STATE_ENDED;\n }\n else if (!(state & STATE_BEGAN)) {\n return STATE_BEGAN;\n }\n return state | STATE_CHANGED;\n }\n return STATE_FAILED;\n }\n });\n /**\n * Pan\n * Recognized when the pointer is down and moved in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function PanRecognizer() {\n AttrRecognizer.apply(this, arguments);\n this.pX = null;\n this.pY = null;\n }\n inherit(PanRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PanRecognizer\n */\n defaults: {\n event: 'pan',\n threshold: 10,\n pointers: 1,\n direction: DIRECTION_ALL\n },\n getTouchAction: function () {\n var direction = this.options.direction;\n var actions = [];\n if (direction & DIRECTION_HORIZONTAL) {\n actions.push(TOUCH_ACTION_PAN_Y);\n }\n if (direction & DIRECTION_VERTICAL) {\n actions.push(TOUCH_ACTION_PAN_X);\n }\n return actions;\n },\n directionTest: function (input) {\n var options = this.options;\n var hasMoved = true;\n var distance = input.distance;\n var direction = input.direction;\n var x = input.deltaX;\n var y = input.deltaY;\n // lock to axis?\n if (!(direction & options.direction)) {\n if (options.direction & DIRECTION_HORIZONTAL) {\n direction = (x === 0) ? DIRECTION_NONE : (x < 0) ? DIRECTION_LEFT : DIRECTION_RIGHT;\n hasMoved = x != this.pX;\n distance = Math.abs(input.deltaX);\n }\n else {\n direction = (y === 0) ? DIRECTION_NONE : (y < 0) ? DIRECTION_UP : DIRECTION_DOWN;\n hasMoved = y != this.pY;\n distance = Math.abs(input.deltaY);\n }\n }\n input.direction = direction;\n return hasMoved && distance > options.threshold && direction & options.direction;\n },\n attrTest: function (input) {\n return AttrRecognizer.prototype.attrTest.call(this, input) &&\n (this.state & STATE_BEGAN || (!(this.state & STATE_BEGAN) && this.directionTest(input)));\n },\n emit: function (input) {\n this.pX = input.deltaX;\n this.pY = input.deltaY;\n var direction = directionStr(input.direction);\n if (direction) {\n input.additionalEvent = this.options.event + direction;\n }\n this._super.emit.call(this, input);\n }\n });\n /**\n * Pinch\n * Recognized when two or more pointers are moving toward (zoom-in) or away from each other (zoom-out).\n * @constructor\n * @extends AttrRecognizer\n */\n function PinchRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(PinchRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'pinch',\n threshold: 0,\n pointers: 2\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_NONE];\n },\n attrTest: function (input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.scale - 1) > this.options.threshold || this.state & STATE_BEGAN);\n },\n emit: function (input) {\n if (input.scale !== 1) {\n var inOut = input.scale < 1 ? 'in' : 'out';\n input.additionalEvent = this.options.event + inOut;\n }\n this._super.emit.call(this, input);\n }\n });\n /**\n * Press\n * Recognized when the pointer is down for x ms without any movement.\n * @constructor\n * @extends Recognizer\n */\n function PressRecognizer() {\n Recognizer.apply(this, arguments);\n this._timer = null;\n this._input = null;\n }\n inherit(PressRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PressRecognizer\n */\n defaults: {\n event: 'press',\n pointers: 1,\n time: 251,\n threshold: 9 // a minimal movement is ok, but keep it low\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_AUTO];\n },\n process: function (input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTime = input.deltaTime > options.time;\n this._input = input;\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (!validMovement || !validPointers || (input.eventType & (INPUT_END | INPUT_CANCEL) && !validTime)) {\n this.reset();\n }\n else if (input.eventType & INPUT_START) {\n this.reset();\n this._timer = setTimeoutContext(function () {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.time, this);\n }\n else if (input.eventType & INPUT_END) {\n return STATE_RECOGNIZED;\n }\n return STATE_FAILED;\n },\n reset: function () {\n clearTimeout(this._timer);\n },\n emit: function (input) {\n if (this.state !== STATE_RECOGNIZED) {\n return;\n }\n if (input && (input.eventType & INPUT_END)) {\n this.manager.emit(this.options.event + 'up', input);\n }\n else {\n this._input.timeStamp = now();\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n /**\n * Rotate\n * Recognized when two or more pointer are moving in a circular motion.\n * @constructor\n * @extends AttrRecognizer\n */\n function RotateRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(RotateRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof RotateRecognizer\n */\n defaults: {\n event: 'rotate',\n threshold: 0,\n pointers: 2\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_NONE];\n },\n attrTest: function (input) {\n return this._super.attrTest.call(this, input) &&\n (Math.abs(input.rotation) > this.options.threshold || this.state & STATE_BEGAN);\n }\n });\n /**\n * Swipe\n * Recognized when the pointer is moving fast (velocity), with enough distance in the allowed direction.\n * @constructor\n * @extends AttrRecognizer\n */\n function SwipeRecognizer() {\n AttrRecognizer.apply(this, arguments);\n }\n inherit(SwipeRecognizer, AttrRecognizer, {\n /**\n * @namespace\n * @memberof SwipeRecognizer\n */\n defaults: {\n event: 'swipe',\n threshold: 10,\n velocity: 0.3,\n direction: DIRECTION_HORIZONTAL | DIRECTION_VERTICAL,\n pointers: 1\n },\n getTouchAction: function () {\n return PanRecognizer.prototype.getTouchAction.call(this);\n },\n attrTest: function (input) {\n var direction = this.options.direction;\n var velocity;\n if (direction & (DIRECTION_HORIZONTAL | DIRECTION_VERTICAL)) {\n velocity = input.overallVelocity;\n }\n else if (direction & DIRECTION_HORIZONTAL) {\n velocity = input.overallVelocityX;\n }\n else if (direction & DIRECTION_VERTICAL) {\n velocity = input.overallVelocityY;\n }\n return this._super.attrTest.call(this, input) &&\n direction & input.offsetDirection &&\n input.distance > this.options.threshold &&\n input.maxPointers == this.options.pointers &&\n abs(velocity) > this.options.velocity && input.eventType & INPUT_END;\n },\n emit: function (input) {\n var direction = directionStr(input.offsetDirection);\n if (direction) {\n this.manager.emit(this.options.event + direction, input);\n }\n this.manager.emit(this.options.event, input);\n }\n });\n /**\n * A tap is ecognized when the pointer is doing a small tap/click. Multiple taps are recognized if they occur\n * between the given interval and position. The delay option can be used to recognize multi-taps without firing\n * a single tap.\n *\n * The eventData from the emitted event contains the property `tapCount`, which contains the amount of\n * multi-taps being recognized.\n * @constructor\n * @extends Recognizer\n */\n function TapRecognizer() {\n Recognizer.apply(this, arguments);\n // previous time and center,\n // used for tap counting\n this.pTime = false;\n this.pCenter = false;\n this._timer = null;\n this._input = null;\n this.count = 0;\n }\n inherit(TapRecognizer, Recognizer, {\n /**\n * @namespace\n * @memberof PinchRecognizer\n */\n defaults: {\n event: 'tap',\n pointers: 1,\n taps: 1,\n interval: 300,\n time: 250,\n threshold: 9,\n posThreshold: 10 // a multi-tap can be a bit off the initial position\n },\n getTouchAction: function () {\n return [TOUCH_ACTION_MANIPULATION];\n },\n process: function (input) {\n var options = this.options;\n var validPointers = input.pointers.length === options.pointers;\n var validMovement = input.distance < options.threshold;\n var validTouchTime = input.deltaTime < options.time;\n this.reset();\n if ((input.eventType & INPUT_START) && (this.count === 0)) {\n return this.failTimeout();\n }\n // we only allow little movement\n // and we've reached an end event, so a tap is possible\n if (validMovement && validTouchTime && validPointers) {\n if (input.eventType != INPUT_END) {\n return this.failTimeout();\n }\n var validInterval = this.pTime ? (input.timeStamp - this.pTime < options.interval) : true;\n var validMultiTap = !this.pCenter || getDistance(this.pCenter, input.center) < options.posThreshold;\n this.pTime = input.timeStamp;\n this.pCenter = input.center;\n if (!validMultiTap || !validInterval) {\n this.count = 1;\n }\n else {\n this.count += 1;\n }\n this._input = input;\n // if tap count matches we have recognized it,\n // else it has began recognizing...\n var tapCount = this.count % options.taps;\n if (tapCount === 0) {\n // no failing requirements, immediately trigger the tap event\n // or wait as long as the multitap interval to trigger\n if (!this.hasRequireFailures()) {\n return STATE_RECOGNIZED;\n }\n else {\n this._timer = setTimeoutContext(function () {\n this.state = STATE_RECOGNIZED;\n this.tryEmit();\n }, options.interval, this);\n return STATE_BEGAN;\n }\n }\n }\n return STATE_FAILED;\n },\n failTimeout: function () {\n this._timer = setTimeoutContext(function () {\n this.state = STATE_FAILED;\n }, this.options.interval, this);\n return STATE_FAILED;\n },\n reset: function () {\n clearTimeout(this._timer);\n },\n emit: function () {\n if (this.state == STATE_RECOGNIZED) {\n this._input.tapCount = this.count;\n this.manager.emit(this.options.event, this._input);\n }\n }\n });\n /**\n * Simple way to create a manager with a default set of recognizers.\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Hammer(element, options) {\n options = options || {};\n options.recognizers = ifUndefined(options.recognizers, Hammer.defaults.preset);\n return new Manager(element, options);\n }\n /**\n * @const {string}\n */\n Hammer.VERSION = '2.0.7';\n /**\n * default settings\n * @namespace\n */\n Hammer.defaults = {\n /**\n * set if DOM events are being triggered.\n * But this is slower and unused by simple implementations, so disabled by default.\n * @type {Boolean}\n * @default false\n */\n domEvents: false,\n /**\n * The value for the touchAction property/fallback.\n * When set to `compute` it will magically set the correct value based on the added recognizers.\n * @type {String}\n * @default compute\n */\n touchAction: TOUCH_ACTION_COMPUTE,\n /**\n * @type {Boolean}\n * @default true\n */\n enable: true,\n /**\n * EXPERIMENTAL FEATURE -- can be removed/changed\n * Change the parent input target element.\n * If Null, then it is being set the to main element.\n * @type {Null|EventTarget}\n * @default null\n */\n inputTarget: null,\n /**\n * force an input class\n * @type {Null|Function}\n * @default null\n */\n inputClass: null,\n /**\n * Default recognizer setup when calling `Hammer()`\n * When creating a new Manager these will be skipped.\n * @type {Array}\n */\n preset: [\n // RecognizerClass, options, [recognizeWith, ...], [requireFailure, ...]\n [RotateRecognizer, { enable: false }],\n [PinchRecognizer, { enable: false }, ['rotate']],\n [SwipeRecognizer, { direction: DIRECTION_HORIZONTAL }],\n [PanRecognizer, { direction: DIRECTION_HORIZONTAL }, ['swipe']],\n [TapRecognizer],\n [TapRecognizer, { event: 'doubletap', taps: 2 }, ['tap']],\n [PressRecognizer]\n ],\n /**\n * Some CSS properties can be used to improve the working of Hammer.\n * Add them to this method and they will be set when creating a new Manager.\n * @namespace\n */\n cssProps: {\n /**\n * Disables text selection to improve the dragging gesture. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userSelect: 'none',\n /**\n * Disable the Windows Phone grippers when pressing an element.\n * @type {String}\n * @default 'none'\n */\n touchSelect: 'none',\n /**\n * Disables the default callout shown when you touch and hold a touch target.\n * On iOS, when you touch and hold a touch target such as a link, Safari displays\n * a callout containing information about the link. This property allows you to disable that callout.\n * @type {String}\n * @default 'none'\n */\n touchCallout: 'none',\n /**\n * Specifies whether zooming is enabled. Used by IE10>\n * @type {String}\n * @default 'none'\n */\n contentZooming: 'none',\n /**\n * Specifies that an entire element should be draggable instead of its contents. Mainly for desktop browsers.\n * @type {String}\n * @default 'none'\n */\n userDrag: 'none',\n /**\n * Overrides the highlight color shown when the user taps a link or a JavaScript\n * clickable element in iOS. This property obeys the alpha value, if specified.\n * @type {String}\n * @default 'rgba(0,0,0,0)'\n */\n tapHighlightColor: 'rgba(0,0,0,0)'\n }\n };\n var STOP = 1;\n var FORCED_STOP = 2;\n /**\n * Manager\n * @param {HTMLElement} element\n * @param {Object} [options]\n * @constructor\n */\n function Manager(element, options) {\n this.options = assign({}, Hammer.defaults, options || {});\n this.options.inputTarget = this.options.inputTarget || element;\n this.handlers = {};\n this.session = {};\n this.recognizers = [];\n this.oldCssProps = {};\n this.element = element;\n this.input = createInputInstance(this);\n this.touchAction = new TouchAction(this, this.options.touchAction);\n toggleCssProps(this, true);\n each(this.options.recognizers, function (item) {\n var recognizer = this.add(new (item[0])(item[1]));\n item[2] && recognizer.recognizeWith(item[2]);\n item[3] && recognizer.requireFailure(item[3]);\n }, this);\n }\n Manager.prototype = {\n /**\n * set options\n * @param {Object} options\n * @returns {Manager}\n */\n set: function (options) {\n assign(this.options, options);\n // Options that need a little more setup\n if (options.touchAction) {\n this.touchAction.update();\n }\n if (options.inputTarget) {\n // Clean up existing event listeners and reinitialize\n this.input.destroy();\n this.input.target = options.inputTarget;\n this.input.init();\n }\n return this;\n },\n /**\n * stop recognizing for this session.\n * This session will be discarded, when a new [input]start event is fired.\n * When forced, the recognizer cycle is stopped immediately.\n * @param {Boolean} [force]\n */\n stop: function (force) {\n this.session.stopped = force ? FORCED_STOP : STOP;\n },\n /**\n * run the recognizers!\n * called by the inputHandler function on every movement of the pointers (touches)\n * it walks through all the recognizers and tries to detect the gesture that is being made\n * @param {Object} inputData\n */\n recognize: function (inputData) {\n var session = this.session;\n if (session.stopped) {\n return;\n }\n // run the touch-action polyfill\n this.touchAction.preventDefaults(inputData);\n var recognizer;\n var recognizers = this.recognizers;\n // this holds the recognizer that is being recognized.\n // so the recognizer's state needs to be BEGAN, CHANGED, ENDED or RECOGNIZED\n // if no recognizer is detecting a thing, it is set to `null`\n var curRecognizer = session.curRecognizer;\n // reset when the last recognizer is recognized\n // or when we're in a new session\n if (!curRecognizer || (curRecognizer && curRecognizer.state & STATE_RECOGNIZED)) {\n curRecognizer = session.curRecognizer = null;\n }\n var i = 0;\n while (i < recognizers.length) {\n recognizer = recognizers[i];\n // find out if we are allowed try to recognize the input for this one.\n // 1. allow if the session is NOT forced stopped (see the .stop() method)\n // 2. allow if we still haven't recognized a gesture in this session, or the this recognizer is the one\n // that is being recognized.\n // 3. allow if the recognizer is allowed to run simultaneous with the current recognized recognizer.\n // this can be setup with the `recognizeWith()` method on the recognizer.\n if (session.stopped !== FORCED_STOP && ( // 1\n !curRecognizer || recognizer == curRecognizer || // 2\n recognizer.canRecognizeWith(curRecognizer))) { // 3\n recognizer.recognize(inputData);\n }\n else {\n recognizer.reset();\n }\n // if the recognizer has been recognizing the input as a valid gesture, we want to store this one as the\n // current active recognizer. but only if we don't already have an active recognizer\n if (!curRecognizer && recognizer.state & (STATE_BEGAN | STATE_CHANGED | STATE_ENDED)) {\n curRecognizer = session.curRecognizer = recognizer;\n }\n i++;\n }\n },\n /**\n * get a recognizer by its event name.\n * @param {Recognizer|String} recognizer\n * @returns {Recognizer|Null}\n */\n get: function (recognizer) {\n if (recognizer instanceof Recognizer) {\n return recognizer;\n }\n var recognizers = this.recognizers;\n for (var i = 0; i < recognizers.length; i++) {\n if (recognizers[i].options.event == recognizer) {\n return recognizers[i];\n }\n }\n return null;\n },\n /**\n * add a recognizer to the manager\n * existing recognizers with the same event name will be removed\n * @param {Recognizer} recognizer\n * @returns {Recognizer|Manager}\n */\n add: function (recognizer) {\n if (invokeArrayArg(recognizer, 'add', this)) {\n return this;\n }\n // remove existing\n var existing = this.get(recognizer.options.event);\n if (existing) {\n this.remove(existing);\n }\n this.recognizers.push(recognizer);\n recognizer.manager = this;\n this.touchAction.update();\n return recognizer;\n },\n /**\n * remove a recognizer by name or instance\n * @param {Recognizer|String} recognizer\n * @returns {Manager}\n */\n remove: function (recognizer) {\n if (invokeArrayArg(recognizer, 'remove', this)) {\n return this;\n }\n recognizer = this.get(recognizer);\n // let's make sure this recognizer exists\n if (recognizer) {\n var recognizers = this.recognizers;\n var index = inArray(recognizers, recognizer);\n if (index !== -1) {\n recognizers.splice(index, 1);\n this.touchAction.update();\n }\n }\n return this;\n },\n /**\n * bind event\n * @param {String} events\n * @param {Function} handler\n * @returns {EventEmitter} this\n */\n on: function (events, handler) {\n if (events === undefined) {\n return;\n }\n if (handler === undefined) {\n return;\n }\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n handlers[event] = handlers[event] || [];\n handlers[event].push(handler);\n });\n return this;\n },\n /**\n * unbind event, leave emit blank to remove all handlers\n * @param {String} events\n * @param {Function} [handler]\n * @returns {EventEmitter} this\n */\n off: function (events, handler) {\n if (events === undefined) {\n return;\n }\n var handlers = this.handlers;\n each(splitStr(events), function (event) {\n if (!handler) {\n delete handlers[event];\n }\n else {\n handlers[event] && handlers[event].splice(inArray(handlers[event], handler), 1);\n }\n });\n return this;\n },\n /**\n * emit event to the listeners\n * @param {String} event\n * @param {Object} data\n */\n emit: function (event, data) {\n // we also want to trigger dom events\n if (this.options.domEvents) {\n triggerDomEvent(event, data);\n }\n // no handlers, so skip it all\n var handlers = this.handlers[event] && this.handlers[event].slice();\n if (!handlers || !handlers.length) {\n return;\n }\n data.type = event;\n data.preventDefault = function () {\n data.srcEvent.preventDefault();\n };\n var i = 0;\n while (i < handlers.length) {\n handlers[i](data);\n i++;\n }\n },\n /**\n * destroy the manager and unbinds all events\n * it doesn't unbind dom events, that is the user own responsibility\n */\n destroy: function () {\n this.element && toggleCssProps(this, false);\n this.handlers = {};\n this.session = {};\n this.input.destroy();\n this.element = null;\n }\n };\n /**\n * add/remove the css properties as defined in manager.options.cssProps\n * @param {Manager} manager\n * @param {Boolean} add\n */\n function toggleCssProps(manager, add) {\n var element = manager.element;\n if (!element.style) {\n return;\n }\n var prop;\n each(manager.options.cssProps, function (value, name) {\n prop = prefixed(element.style, name);\n if (add) {\n manager.oldCssProps[prop] = element.style[prop];\n element.style[prop] = value;\n }\n else {\n element.style[prop] = manager.oldCssProps[prop] || '';\n }\n });\n if (!add) {\n manager.oldCssProps = {};\n }\n }\n /**\n * trigger dom event\n * @param {String} event\n * @param {Object} data\n */\n function triggerDomEvent(event, data) {\n var gestureEvent = document.createEvent('Event');\n gestureEvent.initEvent(event, true, true);\n gestureEvent.gesture = data;\n data.target.dispatchEvent(gestureEvent);\n }\n assign(Hammer, {\n INPUT_START: INPUT_START,\n INPUT_MOVE: INPUT_MOVE,\n INPUT_END: INPUT_END,\n INPUT_CANCEL: INPUT_CANCEL,\n STATE_POSSIBLE: STATE_POSSIBLE,\n STATE_BEGAN: STATE_BEGAN,\n STATE_CHANGED: STATE_CHANGED,\n STATE_ENDED: STATE_ENDED,\n STATE_RECOGNIZED: STATE_RECOGNIZED,\n STATE_CANCELLED: STATE_CANCELLED,\n STATE_FAILED: STATE_FAILED,\n DIRECTION_NONE: DIRECTION_NONE,\n DIRECTION_LEFT: DIRECTION_LEFT,\n DIRECTION_RIGHT: DIRECTION_RIGHT,\n DIRECTION_UP: DIRECTION_UP,\n DIRECTION_DOWN: DIRECTION_DOWN,\n DIRECTION_HORIZONTAL: DIRECTION_HORIZONTAL,\n DIRECTION_VERTICAL: DIRECTION_VERTICAL,\n DIRECTION_ALL: DIRECTION_ALL,\n Manager: Manager,\n Input: Input,\n TouchAction: TouchAction,\n TouchInput: TouchInput,\n MouseInput: MouseInput,\n PointerEventInput: PointerEventInput,\n TouchMouseInput: TouchMouseInput,\n SingleTouchInput: SingleTouchInput,\n Recognizer: Recognizer,\n AttrRecognizer: AttrRecognizer,\n Tap: TapRecognizer,\n Pan: PanRecognizer,\n Swipe: SwipeRecognizer,\n Pinch: PinchRecognizer,\n Rotate: RotateRecognizer,\n Press: PressRecognizer,\n on: addEventListeners,\n off: removeEventListeners,\n each: each,\n merge: merge,\n extend: extend,\n assign: assign,\n inherit: inherit,\n bindFn: bindFn,\n prefixed: prefixed\n });\n // this prevents errors when Hammer is loaded in the presence of an AMD\n // style loader but by script tag, not by the loader.\n var freeGlobal = (typeof window !== 'undefined' ? window : (typeof self !== 'undefined' ? self : {})); // jshint ignore:line\n freeGlobal.Hammer = Hammer;\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return Hammer;\n });\n }\n else if (typeof module != 'undefined' && module.exports) {\n module.exports = Hammer;\n }\n else {\n window[exportName] = Hammer;\n }\n })(window, document, 'Hammer');\n}\n","/* kiwi/build/constraint */ function _(require, module, exports) {\n var strength_1 = require(353) /* ./strength */;\n /**\n * An enum defining the linear constraint operators.\n */\n var Operator;\n (function (Operator) {\n Operator[Operator[\"Le\"] = 0] = \"Le\";\n Operator[Operator[\"Ge\"] = 1] = \"Ge\";\n Operator[Operator[\"Eq\"] = 2] = \"Eq\"; // ==\n })(Operator = exports.Operator || (exports.Operator = {}));\n /**\n * A linear constraint equation.\n *\n * A constraint equation is composed of an expression, an operator,\n * and a strength. The RHS of the equation is implicitly zero.\n *\n * @class\n */\n var Constraint = (function () {\n /**\n * Construct a new Constraint.\n *\n * @param expression The constraint expression.\n * @param operator The equation operator.\n * @param strength The strength of the constraint.\n */\n function Constraint(expression, operator, strength) {\n if (strength === void 0) {\n strength = strength_1.Strength.required;\n }\n this._id = CnId++;\n this._operator = operator;\n this._expression = expression;\n this._strength = strength_1.Strength.clip(strength);\n }\n /**\n * A static constraint comparison function.\n */\n Constraint.Compare = function (a, b) {\n return a.id - b.id;\n };\n Constraint.prototype.toString = function () {\n var _this = this;\n var op = function () {\n switch (_this._operator) {\n case Operator.Le: return \"<=\";\n case Operator.Ge: return \">=\";\n case Operator.Eq: return \"==\";\n }\n };\n return this._expression + \" \" + op() + \" 0\";\n };\n Object.defineProperty(Constraint.prototype, \"id\", {\n /**\n * Returns the unique id number of the constraint.\n */\n get: function () {\n return this._id;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Constraint.prototype, \"expression\", {\n /**\n * Returns the expression of the constraint.\n */\n get: function () {\n return this._expression;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Constraint.prototype, \"op\", {\n /**\n * Returns the relational operator of the constraint.\n */\n get: function () {\n return this._operator;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Constraint.prototype, \"strength\", {\n /**\n * Returns the strength of the constraint.\n */\n get: function () {\n return this._strength;\n },\n enumerable: true,\n configurable: true\n });\n return Constraint;\n }());\n exports.Constraint = Constraint;\n /**\n * The internal constraint id counter.\n */\n var CnId = 0;\n}\n","/* kiwi/build/expression */ function _(require, module, exports) {\n var tsu_1 = require(357) /* ./tsu */;\n var variable_1 = require(360) /* ./variable */;\n var maptype_1 = require(351) /* ./maptype */;\n /**\n * An expression of variable terms and a constant.\n *\n * @class\n */\n var Expression = (function () {\n function Expression() {\n var parsed = parseArgs(arguments);\n this._terms = parsed.terms;\n this._constant = parsed.constant;\n }\n Expression.prototype.toString = function () {\n var terms = [];\n tsu_1.forEach(this._terms, function (pair) {\n terms.push([pair.first, pair.second]);\n });\n var first = true;\n var s = \"\";\n for (var _i = 0, terms_1 = terms; _i < terms_1.length; _i++) {\n var _a = terms_1[_i], v = _a[0], c_1 = _a[1];\n if (first) {\n first = false;\n if (c_1 == 1)\n s += \"\" + v;\n else if (c_1 == -1)\n s += \"-\" + v;\n else\n s += c_1 + \"*\" + v;\n }\n else {\n if (c_1 == 1)\n s += \" + \" + v;\n else if (c_1 == -1)\n s += \" - \" + v;\n else if (c_1 >= 0)\n s += \" + \" + c_1 + v;\n else\n s += \" - \" + -c_1 + v;\n }\n }\n var c = this.constant;\n if (c < 0)\n s += \" - \" + -c;\n else if (c > 0)\n s += \" + \" + c;\n return s;\n };\n Object.defineProperty(Expression.prototype, \"terms\", {\n /**\n * Returns the mapping of terms in the expression.\n *\n * This *must* be treated as const.\n */\n get: function () {\n return this._terms;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Expression.prototype, \"constant\", {\n /**\n * Returns the constant of the expression.\n */\n get: function () {\n return this._constant;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Expression.prototype, \"value\", {\n /**\n * Returns the computed value of the expression.\n */\n get: function () {\n var result = this._constant;\n tsu_1.forEach(this._terms, function (pair) {\n result += pair.first.value * pair.second;\n });\n return result;\n },\n enumerable: true,\n configurable: true\n });\n return Expression;\n }());\n exports.Expression = Expression;\n /**\n * An internal argument parsing function.\n */\n function parseArgs(args) {\n var constant = 0.0;\n var factory = function () { return 0.0; };\n var terms = maptype_1.createMap(variable_1.Variable.Compare);\n for (var i = 0, n = args.length; i < n; ++i) {\n var item = args[i];\n if (typeof item === \"number\") {\n constant += item;\n }\n else if (item instanceof variable_1.Variable) {\n terms.setDefault(item, factory).second += 1.0;\n }\n else if (item instanceof Array) {\n if (item.length !== 2) {\n throw new Error(\"array must have length 2\");\n }\n var value = item[0];\n var variable = item[1];\n if (typeof value !== \"number\") {\n throw new Error(\"array item 0 must be a number\");\n }\n if (!(variable instanceof variable_1.Variable)) {\n throw new Error(\"array item 1 must be a variable\");\n }\n terms.setDefault(variable, factory).second += value;\n }\n else {\n throw new Error(\"invalid Expression argument: \" + JSON.stringify(item));\n }\n }\n return { terms: terms, constant: constant };\n }\n}\n","/* kiwi/build/index */ function _(require, module, exports) {\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014, Nucleic Development Team.\n |\n | Distributed under the terms of the Modified BSD License.\n |\n | The full license is in the file COPYING.txt, distributed with this software.\n |----------------------------------------------------------------------------*/\n function __export(m) {\n for (var p in m)\n if (!exports.hasOwnProperty(p))\n exports[p] = m[p];\n }\n __export(require(360) /* ./variable */);\n __export(require(349) /* ./expression */);\n __export(require(348) /* ./constraint */);\n __export(require(353) /* ./strength */);\n __export(require(352) /* ./solver */);\n}\n","/* kiwi/build/maptype */ function _(require, module, exports) {\n var tsu_1 = require(357) /* ./tsu */;\n function createMap(compare) {\n return new tsu_1.AssociativeArray(compare);\n }\n exports.createMap = createMap;\n}\n","/* kiwi/build/solver */ function _(require, module, exports) {\n var variable_1 = require(360) /* ./variable */;\n var expression_1 = require(349) /* ./expression */;\n var constraint_1 = require(348) /* ./constraint */;\n var strength_1 = require(353) /* ./strength */;\n var maptype_1 = require(351) /* ./maptype */;\n var tsu_1 = require(357) /* ./tsu */;\n /**\n * The constraint solver class.\n *\n * @class\n */\n var Solver = (function () {\n /**\n * Construct a new Solver.\n */\n function Solver() {\n this._cnMap = createCnMap();\n this._rowMap = createRowMap();\n this._varMap = createVarMap();\n this._editMap = createEditMap();\n this._infeasibleRows = [];\n this._objective = new Row();\n this._artificial = null;\n this._idTick = 0;\n }\n /**\n * Add a constraint to the solver.\n */\n Solver.prototype.addConstraint = function (constraint) {\n var cnPair = this._cnMap.find(constraint);\n if (cnPair !== undefined) {\n throw new Error(\"duplicate constraint\");\n }\n // Creating a row causes symbols to be reserved for the variables\n // in the constraint. If this method exits with an exception,\n // then its possible those variables will linger in the var map.\n // Since its likely that those variables will be used in other\n // constraints and since exceptional conditions are uncommon,\n // i'm not too worried about aggressive cleanup of the var map.\n var data = this._createRow(constraint);\n var row = data.row;\n var tag = data.tag;\n var subject = this._chooseSubject(row, tag);\n // If chooseSubject couldnt find a valid entering symbol, one\n // last option is available if the entire row is composed of\n // dummy variables. If the constant of the row is zero, then\n // this represents redundant constraints and the new dummy\n // marker can enter the basis. If the constant is non-zero,\n // then it represents an unsatisfiable constraint.\n if (subject.type() === SymbolType.Invalid && row.allDummies()) {\n if (!nearZero(row.constant())) {\n var names = [];\n for (var _i = 0, _a = constraint.expression.terms._array; _i < _a.length; _i++) {\n var item = _a[_i];\n names.push(item.first.name);\n }\n var op = ['LE', 'GE', 'EQ'][constraint.op];\n throw new Error(\"unsatisfiable constraint [\" + names.join(\",\") + \"] operator: \" + op);\n }\n else {\n subject = tag.marker;\n }\n }\n // If an entering symbol still isn't found, then the row must\n // be added using an artificial variable. If that fails, then\n // the row represents an unsatisfiable constraint.\n if (subject.type() === SymbolType.Invalid) {\n if (!this._addWithArtificialVariable(row)) {\n throw new Error(\"unsatisfiable constraint\");\n }\n }\n else {\n row.solveFor(subject);\n this._substitute(subject, row);\n this._rowMap.insert(subject, row);\n }\n this._cnMap.insert(constraint, tag);\n // Optimizing after each constraint is added performs less\n // aggregate work due to a smaller average system size. It\n // also ensures the solver remains in a consistent state.\n this._optimize(this._objective);\n };\n /**\n * Remove a constraint from the solver.\n */\n Solver.prototype.removeConstraint = function (constraint, silent) {\n if (silent === void 0) {\n silent = false;\n }\n var cnPair = this._cnMap.erase(constraint);\n if (cnPair === undefined) {\n if (silent)\n return;\n else\n throw new Error(\"unknown constraint\");\n }\n // Remove the error effects from the objective function\n // *before* pivoting, or substitutions into the objective\n // will lead to incorrect solver results.\n this._removeConstraintEffects(constraint, cnPair.second);\n // If the marker is basic, simply drop the row. Otherwise,\n // pivot the marker into the basis and then drop the row.\n var marker = cnPair.second.marker;\n var rowPair = this._rowMap.erase(marker);\n if (rowPair === undefined) {\n var leaving = this._getMarkerLeavingSymbol(marker);\n if (leaving.type() === SymbolType.Invalid) {\n throw new Error(\"failed to find leaving row\");\n }\n rowPair = this._rowMap.erase(leaving);\n rowPair.second.solveForEx(leaving, marker);\n this._substitute(marker, rowPair.second);\n }\n // Optimizing after each constraint is removed ensures that the\n // solver remains consistent. It makes the solver api easier to\n // use at a small tradeoff for speed.\n this._optimize(this._objective);\n };\n /**\n * Test whether the solver contains the constraint.\n */\n Solver.prototype.hasConstraint = function (constraint) {\n return this._cnMap.contains(constraint);\n };\n /**\n * Add an edit variable to the solver.\n */\n Solver.prototype.addEditVariable = function (variable, strength) {\n var editPair = this._editMap.find(variable);\n if (editPair !== undefined) {\n throw new Error(\"duplicate edit variable: \" + variable.name);\n }\n strength = strength_1.Strength.clip(strength);\n if (strength === strength_1.Strength.required) {\n throw new Error(\"bad required strength\");\n }\n var expr = new expression_1.Expression(variable);\n var cn = new constraint_1.Constraint(expr, constraint_1.Operator.Eq, strength);\n this.addConstraint(cn);\n var tag = this._cnMap.find(cn).second;\n var info = { tag: tag, constraint: cn, constant: 0.0 };\n this._editMap.insert(variable, info);\n };\n /**\n * Remove an edit variable from the solver.\n */\n Solver.prototype.removeEditVariable = function (variable, silent) {\n if (silent === void 0) {\n silent = false;\n }\n var editPair = this._editMap.erase(variable);\n if (editPair === undefined) {\n if (silent)\n return;\n else\n throw new Error(\"unknown edit variable: \" + variable.name);\n }\n this.removeConstraint(editPair.second.constraint, silent);\n };\n /**\n * Test whether the solver contains the edit variable.\n */\n Solver.prototype.hasEditVariable = function (variable) {\n return this._editMap.contains(variable);\n };\n /**\n * Suggest the value of an edit variable.\n */\n Solver.prototype.suggestValue = function (variable, value) {\n var editPair = this._editMap.find(variable);\n if (editPair === undefined) {\n throw new Error(\"unknown edit variable: \" + variable.name);\n }\n var rows = this._rowMap;\n var info = editPair.second;\n var delta = value - info.constant;\n info.constant = value;\n // Check first if the positive error variable is basic.\n var marker = info.tag.marker;\n var rowPair = rows.find(marker);\n if (rowPair !== undefined) {\n if (rowPair.second.add(-delta) < 0.0) {\n this._infeasibleRows.push(marker);\n }\n this._dualOptimize();\n return;\n }\n // Check next if the negative error variable is basic.\n var other = info.tag.other;\n rowPair = rows.find(other);\n if (rowPair !== undefined) {\n if (rowPair.second.add(delta) < 0.0) {\n this._infeasibleRows.push(other);\n }\n this._dualOptimize();\n return;\n }\n // Otherwise update each row where the error variables exist.\n for (var i = 0, n = rows.size(); i < n; ++i) {\n var rowPair_1 = rows.itemAt(i);\n var row = rowPair_1.second;\n var coeff = row.coefficientFor(marker);\n if (coeff !== 0.0 && row.add(delta * coeff) < 0.0 &&\n rowPair_1.first.type() !== SymbolType.External) {\n this._infeasibleRows.push(rowPair_1.first);\n }\n }\n this._dualOptimize();\n };\n /**\n * Update the values of the variables.\n */\n Solver.prototype.updateVariables = function () {\n var vars = this._varMap;\n var rows = this._rowMap;\n for (var i = 0, n = vars.size(); i < n; ++i) {\n var pair = vars.itemAt(i);\n var rowPair = rows.find(pair.second);\n var c = 0;\n if (rowPair !== undefined) {\n c = rowPair.second.constant();\n // Normalize -0 to 0. Note that c === -0 is the same as c === 0, so we set c to zero\n // for both kinds of zeros. One would preferably use Object.is(c, -0), but that's not\n // widely supported yet.\n if (c === -0)\n c = 0;\n }\n pair.first.setValue(c);\n }\n };\n Solver.prototype.getConstraints = function () {\n var constraints = [];\n tsu_1.forEach(this._cnMap, function (pair) {\n constraints.push(pair.first);\n });\n return constraints;\n };\n Object.defineProperty(Solver.prototype, \"numConstraints\", {\n get: function () {\n return this._cnMap.size();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Solver.prototype, \"numEditVariables\", {\n get: function () {\n return this._editMap.size();\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Get the symbol for the given variable.\n *\n * If a symbol does not exist for the variable, one will be created.\n */\n Solver.prototype._getVarSymbol = function (variable) {\n var _this = this;\n var factory = function () { return _this._makeSymbol(SymbolType.External); };\n return this._varMap.setDefault(variable, factory).second;\n };\n /**\n * Create a new Row object for the given constraint.\n *\n * The terms in the constraint will be converted to cells in the row.\n * Any term in the constraint with a coefficient of zero is ignored.\n * This method uses the `_getVarSymbol` method to get the symbol for\n * the variables added to the row. If the symbol for a given cell\n * variable is basic, the cell variable will be substituted with the\n * basic row.\n *\n * The necessary slack and error variables will be added to the row.\n * If the constant for the row is negative, the sign for the row\n * will be inverted so the constant becomes positive.\n *\n * Returns the created Row and the tag for tracking the constraint.\n */\n Solver.prototype._createRow = function (constraint) {\n var expr = constraint.expression;\n var row = new Row(expr.constant);\n // Substitute the current basic variables into the row.\n var terms = expr.terms;\n for (var i = 0, n = terms.size(); i < n; ++i) {\n var termPair = terms.itemAt(i);\n if (!nearZero(termPair.second)) {\n var symbol = this._getVarSymbol(termPair.first);\n var basicPair = this._rowMap.find(symbol);\n if (basicPair !== undefined) {\n row.insertRow(basicPair.second, termPair.second);\n }\n else {\n row.insertSymbol(symbol, termPair.second);\n }\n }\n }\n // Add the necessary slack, error, and dummy variables.\n var objective = this._objective;\n var strength = constraint.strength;\n var tag = { marker: INVALID_SYMBOL, other: INVALID_SYMBOL };\n switch (constraint.op) {\n case constraint_1.Operator.Le:\n case constraint_1.Operator.Ge:\n {\n var coeff = constraint.op === constraint_1.Operator.Le ? 1.0 : -1.0;\n var slack = this._makeSymbol(SymbolType.Slack);\n tag.marker = slack;\n row.insertSymbol(slack, coeff);\n if (strength < strength_1.Strength.required) {\n var error = this._makeSymbol(SymbolType.Error);\n tag.other = error;\n row.insertSymbol(error, -coeff);\n objective.insertSymbol(error, strength);\n }\n break;\n }\n case constraint_1.Operator.Eq:\n {\n if (strength < strength_1.Strength.required) {\n var errplus = this._makeSymbol(SymbolType.Error);\n var errminus = this._makeSymbol(SymbolType.Error);\n tag.marker = errplus;\n tag.other = errminus;\n row.insertSymbol(errplus, -1.0); // v = eplus - eminus\n row.insertSymbol(errminus, 1.0); // v - eplus + eminus = 0\n objective.insertSymbol(errplus, strength);\n objective.insertSymbol(errminus, strength);\n }\n else {\n var dummy = this._makeSymbol(SymbolType.Dummy);\n tag.marker = dummy;\n row.insertSymbol(dummy);\n }\n break;\n }\n }\n // Ensure the row has a positive constant.\n if (row.constant() < 0.0) {\n row.reverseSign();\n }\n return { row: row, tag: tag };\n };\n /**\n * Choose the subject for solving for the row.\n *\n * This method will choose the best subject for using as the solve\n * target for the row. An invalid symbol will be returned if there\n * is no valid target.\n *\n * The symbols are chosen according to the following precedence:\n *\n * 1) The first symbol representing an external variable.\n * 2) A negative slack or error tag variable.\n *\n * If a subject cannot be found, an invalid symbol will be returned.\n */\n Solver.prototype._chooseSubject = function (row, tag) {\n var cells = row.cells();\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n if (pair.first.type() === SymbolType.External) {\n return pair.first;\n }\n }\n var type = tag.marker.type();\n if (type === SymbolType.Slack || type === SymbolType.Error) {\n if (row.coefficientFor(tag.marker) < 0.0) {\n return tag.marker;\n }\n }\n type = tag.other.type();\n if (type === SymbolType.Slack || type === SymbolType.Error) {\n if (row.coefficientFor(tag.other) < 0.0) {\n return tag.other;\n }\n }\n return INVALID_SYMBOL;\n };\n /**\n * Add the row to the tableau using an artificial variable.\n *\n * This will return false if the constraint cannot be satisfied.\n */\n Solver.prototype._addWithArtificialVariable = function (row) {\n // Create and add the artificial variable to the tableau.\n var art = this._makeSymbol(SymbolType.Slack);\n this._rowMap.insert(art, row.copy());\n this._artificial = row.copy();\n // Optimize the artificial objective. This is successful\n // only if the artificial objective is optimized to zero.\n this._optimize(this._artificial);\n var success = nearZero(this._artificial.constant());\n this._artificial = null;\n // If the artificial variable is basic, pivot the row so that\n // it becomes non-basic. If the row is constant, exit early.\n var pair = this._rowMap.erase(art);\n if (pair !== undefined) {\n var basicRow = pair.second;\n if (basicRow.isConstant()) {\n return success;\n }\n var entering = this._anyPivotableSymbol(basicRow);\n if (entering.type() === SymbolType.Invalid) {\n return false; // unsatisfiable (will this ever happen?)\n }\n basicRow.solveForEx(art, entering);\n this._substitute(entering, basicRow);\n this._rowMap.insert(entering, basicRow);\n }\n // Remove the artificial variable from the tableau.\n var rows = this._rowMap;\n for (var i = 0, n = rows.size(); i < n; ++i) {\n rows.itemAt(i).second.removeSymbol(art);\n }\n this._objective.removeSymbol(art);\n return success;\n };\n /**\n * Substitute the parametric symbol with the given row.\n *\n * This method will substitute all instances of the parametric symbol\n * in the tableau and the objective function with the given row.\n */\n Solver.prototype._substitute = function (symbol, row) {\n var rows = this._rowMap;\n for (var i = 0, n = rows.size(); i < n; ++i) {\n var pair = rows.itemAt(i);\n pair.second.substitute(symbol, row);\n if (pair.second.constant() < 0.0 &&\n pair.first.type() !== SymbolType.External) {\n this._infeasibleRows.push(pair.first);\n }\n }\n this._objective.substitute(symbol, row);\n if (this._artificial) {\n this._artificial.substitute(symbol, row);\n }\n };\n /**\n * Optimize the system for the given objective function.\n *\n * This method performs iterations of Phase 2 of the simplex method\n * until the objective function reaches a minimum.\n */\n Solver.prototype._optimize = function (objective) {\n while (true) {\n var entering = this._getEnteringSymbol(objective);\n if (entering.type() === SymbolType.Invalid) {\n return;\n }\n var leaving = this._getLeavingSymbol(entering);\n if (leaving.type() === SymbolType.Invalid) {\n throw new Error(\"the objective is unbounded\");\n }\n // pivot the entering symbol into the basis\n var row = this._rowMap.erase(leaving).second;\n row.solveForEx(leaving, entering);\n this._substitute(entering, row);\n this._rowMap.insert(entering, row);\n }\n };\n /**\n * Optimize the system using the dual of the simplex method.\n *\n * The current state of the system should be such that the objective\n * function is optimal, but not feasible. This method will perform\n * an iteration of the dual simplex method to make the solution both\n * optimal and feasible.\n */\n Solver.prototype._dualOptimize = function () {\n var rows = this._rowMap;\n var infeasible = this._infeasibleRows;\n while (infeasible.length !== 0) {\n var leaving = infeasible.pop();\n var pair = rows.find(leaving);\n if (pair !== undefined && pair.second.constant() < 0.0) {\n var entering = this._getDualEnteringSymbol(pair.second);\n if (entering.type() === SymbolType.Invalid) {\n throw new Error(\"dual optimize failed\");\n }\n // pivot the entering symbol into the basis\n var row = pair.second;\n rows.erase(leaving);\n row.solveForEx(leaving, entering);\n this._substitute(entering, row);\n rows.insert(entering, row);\n }\n }\n };\n /**\n * Compute the entering variable for a pivot operation.\n *\n * This method will return first symbol in the objective function which\n * is non-dummy and has a coefficient less than zero. If no symbol meets\n * the criteria, it means the objective function is at a minimum, and an\n * invalid symbol is returned.\n */\n Solver.prototype._getEnteringSymbol = function (objective) {\n var cells = objective.cells();\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n var symbol = pair.first;\n if (pair.second < 0.0 && symbol.type() !== SymbolType.Dummy) {\n return symbol;\n }\n }\n return INVALID_SYMBOL;\n };\n /**\n * Compute the entering symbol for the dual optimize operation.\n *\n * This method will return the symbol in the row which has a positive\n * coefficient and yields the minimum ratio for its respective symbol\n * in the objective function. The provided row *must* be infeasible.\n * If no symbol is found which meats the criteria, an invalid symbol\n * is returned.\n */\n Solver.prototype._getDualEnteringSymbol = function (row) {\n var ratio = Number.MAX_VALUE;\n var entering = INVALID_SYMBOL;\n var cells = row.cells();\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n var symbol = pair.first;\n var c = pair.second;\n if (c > 0.0 && symbol.type() !== SymbolType.Dummy) {\n var coeff = this._objective.coefficientFor(symbol);\n var r = coeff / c;\n if (r < ratio) {\n ratio = r;\n entering = symbol;\n }\n }\n }\n return entering;\n };\n /**\n * Compute the symbol for pivot exit row.\n *\n * This method will return the symbol for the exit row in the row\n * map. If no appropriate exit symbol is found, an invalid symbol\n * will be returned. This indicates that the objective function is\n * unbounded.\n */\n Solver.prototype._getLeavingSymbol = function (entering) {\n var ratio = Number.MAX_VALUE;\n var found = INVALID_SYMBOL;\n var rows = this._rowMap;\n for (var i = 0, n = rows.size(); i < n; ++i) {\n var pair = rows.itemAt(i);\n var symbol = pair.first;\n if (symbol.type() !== SymbolType.External) {\n var row = pair.second;\n var temp = row.coefficientFor(entering);\n if (temp < 0.0) {\n var temp_ratio = -row.constant() / temp;\n if (temp_ratio < ratio) {\n ratio = temp_ratio;\n found = symbol;\n }\n }\n }\n }\n return found;\n };\n /**\n * Compute the leaving symbol for a marker variable.\n *\n * This method will return a symbol corresponding to a basic row\n * which holds the given marker variable. The row will be chosen\n * according to the following precedence:\n *\n * 1) The row with a restricted basic varible and a negative coefficient\n * for the marker with the smallest ratio of -constant / coefficient.\n *\n * 2) The row with a restricted basic variable and the smallest ratio\n * of constant / coefficient.\n *\n * 3) The last unrestricted row which contains the marker.\n *\n * If the marker does not exist in any row, an invalid symbol will be\n * returned. This indicates an internal solver error since the marker\n * *should* exist somewhere in the tableau.\n */\n Solver.prototype._getMarkerLeavingSymbol = function (marker) {\n var dmax = Number.MAX_VALUE;\n var r1 = dmax;\n var r2 = dmax;\n var invalid = INVALID_SYMBOL;\n var first = invalid;\n var second = invalid;\n var third = invalid;\n var rows = this._rowMap;\n for (var i = 0, n = rows.size(); i < n; ++i) {\n var pair = rows.itemAt(i);\n var row = pair.second;\n var c = row.coefficientFor(marker);\n if (c === 0.0) {\n continue;\n }\n var symbol = pair.first;\n if (symbol.type() === SymbolType.External) {\n third = symbol;\n }\n else if (c < 0.0) {\n var r = -row.constant() / c;\n if (r < r1) {\n r1 = r;\n first = symbol;\n }\n }\n else {\n var r = row.constant() / c;\n if (r < r2) {\n r2 = r;\n second = symbol;\n }\n }\n }\n if (first !== invalid) {\n return first;\n }\n if (second !== invalid) {\n return second;\n }\n return third;\n };\n /**\n * Remove the effects of a constraint on the objective function.\n */\n Solver.prototype._removeConstraintEffects = function (cn, tag) {\n if (tag.marker.type() === SymbolType.Error) {\n this._removeMarkerEffects(tag.marker, cn.strength);\n }\n if (tag.other.type() === SymbolType.Error) {\n this._removeMarkerEffects(tag.other, cn.strength);\n }\n };\n /**\n * Remove the effects of an error marker on the objective function.\n */\n Solver.prototype._removeMarkerEffects = function (marker, strength) {\n var pair = this._rowMap.find(marker);\n if (pair !== undefined) {\n this._objective.insertRow(pair.second, -strength);\n }\n else {\n this._objective.insertSymbol(marker, -strength);\n }\n };\n /**\n * Get the first Slack or Error symbol in the row.\n *\n * If no such symbol is present, an invalid symbol will be returned.\n */\n Solver.prototype._anyPivotableSymbol = function (row) {\n var cells = row.cells();\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n var type = pair.first.type();\n if (type === SymbolType.Slack || type === SymbolType.Error) {\n return pair.first;\n }\n }\n return INVALID_SYMBOL;\n };\n /**\n * Returns a new Symbol of the given type.\n */\n Solver.prototype._makeSymbol = function (type) {\n return new Symbol(type, this._idTick++);\n };\n return Solver;\n }());\n exports.Solver = Solver;\n /**\n * Test whether a value is approximately zero.\n */\n function nearZero(value) {\n var eps = 1.0e-8;\n return value < 0.0 ? -value < eps : value < eps;\n }\n /**\n * An internal function for creating a constraint map.\n */\n function createCnMap() {\n return maptype_1.createMap(constraint_1.Constraint.Compare);\n }\n /**\n * An internal function for creating a row map.\n */\n function createRowMap() {\n return maptype_1.createMap(Symbol.Compare);\n }\n /**\n * An internal function for creating a variable map.\n */\n function createVarMap() {\n return maptype_1.createMap(variable_1.Variable.Compare);\n }\n /**\n * An internal function for creating an edit map.\n */\n function createEditMap() {\n return maptype_1.createMap(variable_1.Variable.Compare);\n }\n /**\n * An enum defining the available symbol types.\n */\n var SymbolType;\n (function (SymbolType) {\n SymbolType[SymbolType[\"Invalid\"] = 0] = \"Invalid\";\n SymbolType[SymbolType[\"External\"] = 1] = \"External\";\n SymbolType[SymbolType[\"Slack\"] = 2] = \"Slack\";\n SymbolType[SymbolType[\"Error\"] = 3] = \"Error\";\n SymbolType[SymbolType[\"Dummy\"] = 4] = \"Dummy\";\n })(SymbolType || (SymbolType = {}));\n /**\n * An internal class representing a symbol in the solver.\n */\n var Symbol = (function () {\n /**\n * Construct a new Symbol\n *\n * @param [type] The type of the symbol.\n * @param [id] The unique id number of the symbol.\n */\n function Symbol(type, id) {\n this._id = id;\n this._type = type;\n }\n /**\n * The static Symbol comparison function.\n */\n Symbol.Compare = function (a, b) {\n return a.id() - b.id();\n };\n /**\n * Returns the unique id number of the symbol.\n */\n Symbol.prototype.id = function () {\n return this._id;\n };\n /**\n * Returns the type of the symbol.\n */\n Symbol.prototype.type = function () {\n return this._type;\n };\n return Symbol;\n }());\n /**\n * A static invalid symbol\n */\n var INVALID_SYMBOL = new Symbol(SymbolType.Invalid, -1);\n /**\n * An internal row class used by the solver.\n */\n var Row = (function () {\n /**\n * Construct a new Row.\n */\n function Row(constant) {\n if (constant === void 0) {\n constant = 0.0;\n }\n this._cellMap = maptype_1.createMap(Symbol.Compare);\n this._constant = constant;\n }\n /**\n * Returns the mapping of symbols to coefficients.\n */\n Row.prototype.cells = function () {\n return this._cellMap;\n };\n /**\n * Returns the constant for the row.\n */\n Row.prototype.constant = function () {\n return this._constant;\n };\n /**\n * Returns true if the row is a constant value.\n */\n Row.prototype.isConstant = function () {\n return this._cellMap.empty();\n };\n /**\n * Returns true if the Row has all dummy symbols.\n */\n Row.prototype.allDummies = function () {\n var cells = this._cellMap;\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n if (pair.first.type() !== SymbolType.Dummy) {\n return false;\n }\n }\n return true;\n };\n /**\n * Create a copy of the row.\n */\n Row.prototype.copy = function () {\n var theCopy = new Row(this._constant);\n theCopy._cellMap = this._cellMap.copy();\n return theCopy;\n };\n /**\n * Add a constant value to the row constant.\n *\n * Returns the new value of the constant.\n */\n Row.prototype.add = function (value) {\n return this._constant += value;\n };\n /**\n * Insert the symbol into the row with the given coefficient.\n *\n * If the symbol already exists in the row, the coefficient\n * will be added to the existing coefficient. If the resulting\n * coefficient is zero, the symbol will be removed from the row.\n */\n Row.prototype.insertSymbol = function (symbol, coefficient) {\n if (coefficient === void 0) {\n coefficient = 1.0;\n }\n var pair = this._cellMap.setDefault(symbol, function () { return 0.0; });\n if (nearZero(pair.second += coefficient)) {\n this._cellMap.erase(symbol);\n }\n };\n /**\n * Insert a row into this row with a given coefficient.\n *\n * The constant and the cells of the other row will be\n * multiplied by the coefficient and added to this row. Any\n * cell with a resulting coefficient of zero will be removed\n * from the row.\n */\n Row.prototype.insertRow = function (other, coefficient) {\n if (coefficient === void 0) {\n coefficient = 1.0;\n }\n this._constant += other._constant * coefficient;\n var cells = other._cellMap;\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n this.insertSymbol(pair.first, pair.second * coefficient);\n }\n };\n /**\n * Remove a symbol from the row.\n */\n Row.prototype.removeSymbol = function (symbol) {\n this._cellMap.erase(symbol);\n };\n /**\n * Reverse the sign of the constant and cells in the row.\n */\n Row.prototype.reverseSign = function () {\n this._constant = -this._constant;\n var cells = this._cellMap;\n for (var i = 0, n = cells.size(); i < n; ++i) {\n var pair = cells.itemAt(i);\n pair.second = -pair.second;\n }\n };\n /**\n * Solve the row for the given symbol.\n *\n * This method assumes the row is of the form\n * a * x + b * y + c = 0 and (assuming solve for x) will modify\n * the row to represent the right hand side of\n * x = -b/a * y - c / a. The target symbol will be removed from\n * the row, and the constant and other cells will be multiplied\n * by the negative inverse of the target coefficient.\n *\n * The given symbol *must* exist in the row.\n */\n Row.prototype.solveFor = function (symbol) {\n var cells = this._cellMap;\n var pair = cells.erase(symbol);\n var coeff = -1.0 / pair.second;\n this._constant *= coeff;\n for (var i = 0, n = cells.size(); i < n; ++i) {\n cells.itemAt(i).second *= coeff;\n }\n };\n /**\n * Solve the row for the given symbols.\n *\n * This method assumes the row is of the form\n * x = b * y + c and will solve the row such that\n * y = x / b - c / b. The rhs symbol will be removed from the\n * row, the lhs added, and the result divided by the negative\n * inverse of the rhs coefficient.\n *\n * The lhs symbol *must not* exist in the row, and the rhs\n * symbol must* exist in the row.\n */\n Row.prototype.solveForEx = function (lhs, rhs) {\n this.insertSymbol(lhs, -1.0);\n this.solveFor(rhs);\n };\n /**\n * Returns the coefficient for the given symbol.\n */\n Row.prototype.coefficientFor = function (symbol) {\n var pair = this._cellMap.find(symbol);\n return pair !== undefined ? pair.second : 0.0;\n };\n /**\n * Substitute a symbol with the data from another row.\n *\n * Given a row of the form a * x + b and a substitution of the\n * form x = 3 * y + c the row will be updated to reflect the\n * expression 3 * a * y + a * c + b.\n *\n * If the symbol does not exist in the row, this is a no-op.\n */\n Row.prototype.substitute = function (symbol, row) {\n var pair = this._cellMap.erase(symbol);\n if (pair !== undefined) {\n this.insertRow(row, pair.second);\n }\n };\n return Row;\n }());\n}\n","/* kiwi/build/strength */ function _(require, module, exports) {\n var Strength;\n (function (Strength) {\n /**\n * Create a new symbolic strength.\n */\n function create(a, b, c, w) {\n if (w === void 0) {\n w = 1.0;\n }\n var result = 0.0;\n result += Math.max(0.0, Math.min(1000.0, a * w)) * 1000000.0;\n result += Math.max(0.0, Math.min(1000.0, b * w)) * 1000.0;\n result += Math.max(0.0, Math.min(1000.0, c * w));\n return result;\n }\n Strength.create = create;\n /**\n * The 'required' symbolic strength.\n */\n Strength.required = create(1000.0, 1000.0, 1000.0);\n /**\n * The 'strong' symbolic strength.\n */\n Strength.strong = create(1.0, 0.0, 0.0);\n /**\n * The 'medium' symbolic strength.\n */\n Strength.medium = create(0.0, 1.0, 0.0);\n /**\n * The 'weak' symbolic strength.\n */\n Strength.weak = create(0.0, 0.0, 1.0);\n /**\n * Clip a symbolic strength to the allowed min and max.\n */\n function clip(value) {\n return Math.max(0.0, Math.min(Strength.required, value));\n }\n Strength.clip = clip;\n })(Strength = exports.Strength || (exports.Strength = {}));\n}\n","/* kiwi/build/tsu/algorithm */ function _(require, module, exports) {\n var iterator_1 = require(358) /* ./iterator */;\n /**\n * Perform a lower bound search on a sorted array.\n *\n * @param array The array of sorted items to search.\n * @param value The value to located in the array.\n * @param compare The value comparison function.\n * @returns The index of the first element in the array which\n * compares greater than or equal to the given value.\n */\n function lowerBound(array, value, compare) {\n var begin = 0;\n var n = array.length;\n var half;\n var middle;\n while (n > 0) {\n half = n >> 1;\n middle = begin + half;\n if (compare(array[middle], value) < 0) {\n begin = middle + 1;\n n -= half + 1;\n }\n else {\n n = half;\n }\n }\n return begin;\n }\n exports.lowerBound = lowerBound;\n /**\n * Perform a binary search on a sorted array.\n *\n * @param array The array of sorted items to search.\n * @param value The value to located in the array.\n * @param compare The value comparison function.\n * @returns The index of the found item, or -1.\n */\n function binarySearch(array, value, compare) {\n var index = lowerBound(array, value, compare);\n if (index === array.length) {\n return -1;\n }\n var item = array[index];\n if (compare(item, value) !== 0) {\n return -1;\n }\n return index;\n }\n exports.binarySearch = binarySearch;\n /**\n * Perform a binary find on a sorted array.\n *\n * @param array The array of sorted items to search.\n * @param value The value to located in the array.\n * @param compare The value comparison function.\n * @returns The found item in the array, or undefined.\n */\n function binaryFind(array, value, compare) {\n var index = lowerBound(array, value, compare);\n if (index === array.length) {\n return undefined;\n }\n var item = array[index];\n if (compare(item, value) !== 0) {\n return undefined;\n }\n return item;\n }\n exports.binaryFind = binaryFind;\n function asSet(items, compare) {\n var array = iterator_1.asArray(items);\n var n = array.length;\n if (n <= 1) {\n return array;\n }\n array.sort(compare);\n var result = [array[0]];\n for (var i = 1, j = 0; i < n; ++i) {\n var item = array[i];\n if (compare(result[j], item) !== 0) {\n result.push(item);\n ++j;\n }\n }\n return result;\n }\n exports.asSet = asSet;\n /**\n * Test whether a two sorted arrays sets are disjoint.\n *\n * @param first The first sorted array set.\n * @param second The second sorted array set.\n * @param compare The value comparison function.\n * @returns true if the sets are disjoint, false otherwise.\n */\n function setIsDisjoint(first, second, compare) {\n var i = 0, j = 0;\n var len1 = first.length;\n var len2 = second.length;\n while (i < len1 && j < len2) {\n var v = compare(first[i], second[j]);\n if (v < 0) {\n ++i;\n }\n else if (v > 0) {\n ++j;\n }\n else {\n return false;\n }\n }\n return true;\n }\n exports.setIsDisjoint = setIsDisjoint;\n /**\n * Test whether one sorted array set is the subset of another.\n *\n * @param first The potential subset.\n * @param second The potential superset.\n * @param compare The value comparison function.\n * @returns true if the first set is a subset of the second.\n */\n function setIsSubset(first, second, compare) {\n var len1 = first.length;\n var len2 = second.length;\n if (len1 > len2) {\n return false;\n }\n var i = 0, j = 0;\n while (i < len1 && j < len2) {\n var v = compare(first[i], second[j]);\n if (v < 0) {\n return false;\n }\n else if (v > 0) {\n ++j;\n }\n else {\n ++i;\n ++j;\n }\n }\n if (i < len1) {\n return false;\n }\n return true;\n }\n exports.setIsSubset = setIsSubset;\n /**\n * Create the set union of two sorted set arrays.\n var j = 0;\n *\n * @param first The first sorted array set.\n * @param second The second sorted array set.\n * @param compare The value comparison function.\n * @returns The set union of the two arrays.\n */\n function setUnion(first, second, compare) {\n var i = 0, j = 0;\n var len1 = first.length;\n var len2 = second.length;\n var merged = [];\n while (i < len1 && j < len2) {\n var a = first[i];\n var b = second[j];\n var v = compare(a, b);\n if (v < 0) {\n merged.push(a);\n ++i;\n }\n else if (v > 0) {\n merged.push(b);\n ++j;\n }\n else {\n merged.push(a);\n ++i;\n ++j;\n }\n }\n while (i < len1) {\n merged.push(first[i]);\n ++i;\n }\n while (j < len2) {\n merged.push(second[j]);\n ++j;\n }\n return merged;\n }\n exports.setUnion = setUnion;\n /**\n * Create a set intersection of two sorted set arrays.\n *\n * @param first The first sorted array set.\n * @param second The second sorted array set.\n * @param compare The value comparison function.\n * @returns The set intersection of the two arrays.\n */\n function setIntersection(first, second, compare) {\n var i = 0, j = 0;\n var len1 = first.length;\n var len2 = second.length;\n var merged = [];\n while (i < len1 && j < len2) {\n var a = first[i];\n var b = second[j];\n var v = compare(a, b);\n if (v < 0) {\n ++i;\n }\n else if (v > 0) {\n ++j;\n }\n else {\n merged.push(a);\n ++i;\n ++j;\n }\n }\n return merged;\n }\n exports.setIntersection = setIntersection;\n /**\n * Create a set difference of two sorted set arrays.\n *\n * @param first The first sorted array set.\n * @param second The second sorted array set.\n * @param compare The value comparison function.\n * @returns The set difference of the two arrays.\n */\n function setDifference(first, second, compare) {\n var i = 0, j = 0;\n var len1 = first.length;\n var len2 = second.length;\n var merged = [];\n while (i < len1 && j < len2) {\n var a = first[i];\n var b = second[j];\n var v = compare(a, b);\n if (v < 0) {\n merged.push(a);\n ++i;\n }\n else if (v > 0) {\n ++j;\n }\n else {\n ++i;\n ++j;\n }\n }\n while (i < len1) {\n merged.push(first[i]);\n ++i;\n }\n return merged;\n }\n exports.setDifference = setDifference;\n /**\n * Create a set symmetric difference of two sorted set arrays.\n *\n * @param first The first sorted array set.\n * @param second The second sorted array set.\n * @param compare The value comparison function.\n * @returns The set symmetric difference of the two arrays.\n */\n function setSymmetricDifference(first, second, compare) {\n var i = 0, j = 0;\n var len1 = first.length;\n var len2 = second.length;\n var merged = [];\n while (i < len1 && j < len2) {\n var a = first[i];\n var b = second[j];\n var v = compare(a, b);\n if (v < 0) {\n merged.push(a);\n ++i;\n }\n else if (v > 0) {\n merged.push(b);\n ++j;\n }\n else {\n ++i;\n ++j;\n }\n }\n while (i < len1) {\n merged.push(first[i]);\n ++i;\n }\n while (j < len2) {\n merged.push(second[j]);\n ++j;\n }\n return merged;\n }\n exports.setSymmetricDifference = setSymmetricDifference;\n}\n","/* kiwi/build/tsu/array_base */ function _(require, module, exports) {\n var iterator_1 = require(358) /* ./iterator */;\n /**\n * A base class for implementing array-based data structures.\n *\n * @class\n */\n var ArrayBase = (function () {\n function ArrayBase() {\n /*\n * The internal data array.\n *\n * @protected\n */\n this._array = [];\n }\n /**\n * Returns the number of items in the array.\n */\n ArrayBase.prototype.size = function () {\n return this._array.length;\n };\n /**\n * Returns true if the array is empty.\n */\n ArrayBase.prototype.empty = function () {\n return this._array.length === 0;\n };\n /**\n * Returns the item at the given array index.\n *\n * @param index The integer index of the desired item.\n */\n ArrayBase.prototype.itemAt = function (index) {\n return this._array[index];\n };\n /**\n * Removes and returns the item at the given index.\n *\n * @param index The integer index of the desired item.\n */\n ArrayBase.prototype.takeAt = function (index) {\n return this._array.splice(index, 1)[0];\n };\n /**\n * Clear the internal contents of array.\n */\n ArrayBase.prototype.clear = function () {\n this._array = [];\n };\n /**\n * Swap this array's contents with another array.\n *\n * @param other The array base to use for the swap.\n */\n ArrayBase.prototype.swap = function (other) {\n var array = this._array;\n this._array = other._array;\n other._array = array;\n };\n /**\n * Returns an iterator over the array of items.\n */\n ArrayBase.prototype.__iter__ = function () {\n return iterator_1.iter(this._array);\n };\n /**\n * Returns a reverse iterator over the array of items.\n */\n ArrayBase.prototype.__reversed__ = function () {\n return iterator_1.reversed(this._array);\n };\n return ArrayBase;\n }());\n exports.ArrayBase = ArrayBase;\n}\n","/* kiwi/build/tsu/associative_array */ function _(require, module, exports) {\n /*-----------------------------------------------------------------------------\n | Copyright (c) 2014, Nucleic Development Team.\n |\n | Distributed under the terms of the Modified BSD License.\n |\n | The full license is in the file COPYING.txt, distributed with this software.\n |----------------------------------------------------------------------------*/\n var __extends = (this && this.__extends) || (function () {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p]; };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n })();\n var pair_1 = require(359) /* ./pair */;\n var array_base_1 = require(355) /* ./array_base */;\n var algorithm_1 = require(354) /* ./algorithm */;\n var iterator_1 = require(358) /* ./iterator */;\n /**\n * A mapping container build on a sorted array.\n *\n * @class\n */\n var AssociativeArray = (function (_super) {\n __extends(AssociativeArray, _super);\n /**\n * Construct a new AssociativeArray.\n *\n * @param compare The key comparison function.\n */\n function AssociativeArray(compare) {\n var _this = _super.call(this) || this;\n _this._compare = compare;\n _this._wrapped = wrapCompare(compare);\n return _this;\n }\n /**\n * Returns the key comparison function used by this array.\n */\n AssociativeArray.prototype.comparitor = function () {\n return this._compare;\n };\n /**\n * Return the array index of the given key, or -1.\n *\n * @param key The key to locate in the array.\n */\n AssociativeArray.prototype.indexOf = function (key) {\n return algorithm_1.binarySearch(this._array, key, this._wrapped);\n };\n /**\n * Returns true if the key is in the array, false otherwise.\n *\n * @param key The key to locate in the array.\n */\n AssociativeArray.prototype.contains = function (key) {\n return algorithm_1.binarySearch(this._array, key, this._wrapped) >= 0;\n };\n /**\n * Returns the pair associated with the given key, or undefined.\n *\n * @param key The key to locate in the array.\n */\n AssociativeArray.prototype.find = function (key) {\n return algorithm_1.binaryFind(this._array, key, this._wrapped);\n };\n /**\n * Returns the pair associated with the key if it exists.\n *\n * If the key does not exist, a new pair will be created and\n * inserted using the value created by the given factory.\n *\n * @param key The key to locate in the array.\n * @param factory The function which creates the default value.\n */\n AssociativeArray.prototype.setDefault = function (key, factory) {\n var array = this._array;\n var index = algorithm_1.lowerBound(array, key, this._wrapped);\n if (index === array.length) {\n var pair = new pair_1.Pair(key, factory());\n array.push(pair);\n return pair;\n }\n var currPair = array[index];\n if (this._compare(currPair.first, key) !== 0) {\n var pair = new pair_1.Pair(key, factory());\n array.splice(index, 0, pair);\n return pair;\n }\n return currPair;\n };\n /**\n * Insert the pair into the array and return the pair.\n *\n * This will overwrite any existing entry in the array.\n *\n * @param key The key portion of the pair.\n * @param value The value portion of the pair.\n */\n AssociativeArray.prototype.insert = function (key, value) {\n var array = this._array;\n var index = algorithm_1.lowerBound(array, key, this._wrapped);\n if (index === array.length) {\n var pair = new pair_1.Pair(key, value);\n array.push(pair);\n return pair;\n }\n var currPair = array[index];\n if (this._compare(currPair.first, key) !== 0) {\n var pair = new pair_1.Pair(key, value);\n array.splice(index, 0, pair);\n return pair;\n }\n currPair.second = value;\n return currPair;\n };\n AssociativeArray.prototype.update = function (object) {\n var _this = this;\n if (object instanceof AssociativeArray) {\n this._array = merge(this._array, object._array, this._compare);\n }\n else {\n iterator_1.forEach(object, function (pair) {\n _this.insert(pair.first, pair.second);\n });\n }\n };\n /**\n * Removes and returns the pair for the given key, or undefined.\n *\n * @param key The key to remove from the map.\n */\n AssociativeArray.prototype.erase = function (key) {\n var array = this._array;\n var index = algorithm_1.binarySearch(array, key, this._wrapped);\n if (index < 0) {\n return undefined;\n }\n return array.splice(index, 1)[0];\n };\n /**\n * Create a copy of this associative array.\n */\n AssociativeArray.prototype.copy = function () {\n var theCopy = new AssociativeArray(this._compare);\n var copyArray = theCopy._array;\n var thisArray = this._array;\n for (var i = 0, n = thisArray.length; i < n; ++i) {\n copyArray.push(thisArray[i].copy());\n }\n return theCopy;\n };\n return AssociativeArray;\n }(array_base_1.ArrayBase));\n exports.AssociativeArray = AssociativeArray;\n /**\n * An internal which wraps a comparison key function.\n */\n function wrapCompare(cmp) {\n return function (pair, value) {\n return cmp(pair.first, value);\n };\n }\n /**\n * An internal function which merges two ordered pair arrays.\n */\n function merge(first, second, compare) {\n var i = 0, j = 0;\n var len1 = first.length;\n var len2 = second.length;\n var merged = [];\n while (i < len1 && j < len2) {\n var a = first[i];\n var b = second[j];\n var v = compare(a.first, b.first);\n if (v < 0) {\n merged.push(a.copy());\n ++i;\n }\n else if (v > 0) {\n merged.push(b.copy());\n ++j;\n }\n else {\n merged.push(b.copy());\n ++i;\n ++j;\n }\n }\n while (i < len1) {\n merged.push(first[i].copy());\n ++i;\n }\n while (j < len2) {\n merged.push(second[j].copy());\n ++j;\n }\n return merged;\n }\n}\n","/* kiwi/build/tsu/index */ function _(require, module, exports) {\n function __export(m) {\n for (var p in m)\n if (!exports.hasOwnProperty(p))\n exports[p] = m[p];\n }\n __export(require(354) /* ./algorithm */);\n __export(require(355) /* ./array_base */);\n __export(require(356) /* ./associative_array */);\n __export(require(358) /* ./iterator */);\n __export(require(359) /* ./pair */);\n}\n","/* kiwi/build/tsu/iterator */ function _(require, module, exports) {\n /**\n * An iterator for an array of items.\n */\n var ArrayIterator = (function () {\n /*\n * Construct a new ArrayIterator.\n *\n * @param array The array of items to iterate.\n * @param [index] The index at which to start iteration.\n */\n function ArrayIterator(array, index) {\n if (typeof index === \"undefined\") {\n index = 0;\n }\n this._array = array;\n this._index = Math.max(0, Math.min(index, array.length));\n }\n /**\n * Returns the next item from the iterator or undefined.\n */\n ArrayIterator.prototype.__next__ = function () {\n return this._array[this._index++];\n };\n /**\n * Returns this same iterator.\n */\n ArrayIterator.prototype.__iter__ = function () {\n return this;\n };\n return ArrayIterator;\n }());\n exports.ArrayIterator = ArrayIterator;\n /**\n * A reverse iterator for an array of items.\n */\n var ReverseArrayIterator = (function () {\n /**\n * Construct a new ReverseArrayIterator.\n *\n * @param array The array of items to iterate.\n * @param [index] The index at which to start iteration.\n */\n function ReverseArrayIterator(array, index) {\n if (typeof index === \"undefined\") {\n index = array.length;\n }\n this._array = array;\n this._index = Math.max(0, Math.min(index, array.length));\n }\n /**\n * Returns the next item from the iterator or undefined.\n */\n ReverseArrayIterator.prototype.__next__ = function () {\n return this._array[--this._index];\n };\n /**\n * Returns this same iterator.\n */\n ReverseArrayIterator.prototype.__iter__ = function () {\n return this;\n };\n return ReverseArrayIterator;\n }());\n exports.ReverseArrayIterator = ReverseArrayIterator;\n function iter(object) {\n if (object instanceof Array) {\n return new ArrayIterator(object);\n }\n return object.__iter__();\n }\n exports.iter = iter;\n function reversed(object) {\n if (object instanceof Array) {\n return new ReverseArrayIterator(object);\n }\n return object.__reversed__();\n }\n exports.reversed = reversed;\n /**\n * Returns the next value from an iterator, or undefined.\n */\n function next(iterator) {\n return iterator.__next__();\n }\n exports.next = next;\n function asArray(object) {\n if (object instanceof Array) {\n return object.slice();\n }\n var value;\n var array = [];\n var it = object.__iter__();\n while ((value = it.__next__()) !== undefined) {\n array.push(value);\n }\n return array;\n }\n exports.asArray = asArray;\n function forEach(object, callback) {\n if (object instanceof Array) {\n for (var i = 0, n = object.length; i < n; ++i) {\n if (callback(object[i]) === false) {\n return;\n }\n }\n }\n else {\n var value;\n var it = object.__iter__();\n while ((value = it.__next__()) !== undefined) {\n if (callback(value) === false) {\n return;\n }\n }\n }\n }\n exports.forEach = forEach;\n function map(object, callback) {\n var result = [];\n if (object instanceof Array) {\n for (var i = 0, n = object.length; i < n; ++i) {\n result.push(callback(object[i]));\n }\n }\n else {\n var value;\n var it = object.__iter__();\n while ((value = it.__next__()) !== undefined) {\n result.push(callback(value));\n }\n }\n return result;\n }\n exports.map = map;\n function filter(object, callback) {\n var value;\n var result = [];\n if (object instanceof Array) {\n for (var i = 0, n = object.length; i < n; ++i) {\n value = object[i];\n if (callback(value)) {\n result.push(value);\n }\n }\n }\n else {\n var it = object.__iter__();\n while ((value = it.__next__()) !== undefined) {\n if (callback(value)) {\n result.push(value);\n }\n }\n }\n return result;\n }\n exports.filter = filter;\n}\n","/* kiwi/build/tsu/pair */ function _(require, module, exports) {\n /**\n * A class which defines a generic pair object.\n */\n var Pair = (function () {\n /**\n * Construct a new Pair object.\n *\n * @param first The first item of the pair.\n * @param second The second item of the pair.\n */\n function Pair(first, second) {\n this.first = first;\n this.second = second;\n }\n /**\n * Create a copy of the pair.\n */\n Pair.prototype.copy = function () {\n return new Pair(this.first, this.second);\n };\n return Pair;\n }());\n exports.Pair = Pair;\n}\n","/* kiwi/build/variable */ function _(require, module, exports) {\n /**\n * The primary user constraint variable.\n *\n * @class\n */\n var Variable = (function () {\n /**\n * Construct a new Variable\n *\n * @param [name] The name to associated with the variable.\n */\n function Variable(name) {\n if (name === void 0) {\n name = \"\";\n }\n this._value = 0.0;\n this._context = null;\n this._id = VarId++;\n this._name = name;\n }\n /**\n * A static variable comparison function.\n */\n Variable.Compare = function (a, b) {\n return a.id - b.id;\n };\n Variable.prototype.toString = function () {\n return this._name;\n };\n Object.defineProperty(Variable.prototype, \"id\", {\n /**\n * Returns the unique id number of the variable.\n */\n get: function () {\n return this._id;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Variable.prototype, \"name\", {\n /**\n * Returns the name of the variable.\n */\n get: function () {\n return this._name;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Set the name of the variable.\n */\n Variable.prototype.setName = function (name) {\n this._name = name;\n };\n Object.defineProperty(Variable.prototype, \"context\", {\n /**\n * Returns the user context object of the variable.\n */\n get: function () {\n return this._context;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Set the user context object of the variable.\n */\n Variable.prototype.setContext = function (context) {\n this._context = context;\n };\n Object.defineProperty(Variable.prototype, \"value\", {\n /**\n * Returns the value of the variable.\n */\n get: function () {\n return this._value;\n },\n enumerable: true,\n configurable: true\n });\n /**\n * Set the value of the variable.\n */\n Variable.prototype.setValue = function (value) {\n this._value = value;\n };\n return Variable;\n }());\n exports.Variable = Variable;\n /**\n * The internal variable id counter.\n */\n var VarId = 0;\n}\n","/* numbro/numbro */ function _(require, module, exports) {\n /*!\n * numbro.js\n * version : 1.6.2\n * author : Företagsplatsen AB\n * license : MIT\n * http://www.foretagsplatsen.se\n */\n /************************************\n Constants\n ************************************/\n var numbro, VERSION = '1.6.2', \n // internal storage for culture config files\n cultures = {}, \n // Todo: Remove in 2.0.0\n languages = cultures, currentCulture = 'en-US', zeroFormat = null, defaultFormat = '0,0', defaultCurrencyFormat = '0$', \n // check for nodeJS\n hasModule = (typeof module !== 'undefined' && module.exports), \n // default culture\n enUS = {\n delimiters: {\n thousands: ',',\n decimal: '.'\n },\n abbreviations: {\n thousand: 'k',\n million: 'm',\n billion: 'b',\n trillion: 't'\n },\n ordinal: function (number) {\n var b = number % 10;\n return (~~(number % 100 / 10) === 1) ? 'th' :\n (b === 1) ? 'st' :\n (b === 2) ? 'nd' :\n (b === 3) ? 'rd' : 'th';\n },\n currency: {\n symbol: '$',\n position: 'prefix'\n },\n defaults: {\n currencyFormat: ',0000 a'\n },\n formats: {\n fourDigits: '0000 a',\n fullWithTwoDecimals: '$ ,0.00',\n fullWithTwoDecimalsNoCurrency: ',0.00'\n }\n };\n /************************************\n Constructors\n ************************************/\n // Numbro prototype object\n function Numbro(number) {\n this._value = number;\n }\n function zeroes(count) {\n var i, ret = '';\n for (i = 0; i < count; i++) {\n ret += '0';\n }\n return ret;\n }\n /**\n * Implementation of toFixed() for numbers with exponent > 21\n *\n *\n */\n function toFixedLarge(value, precision) {\n var mantissa, beforeDec, afterDec, exponent, str;\n str = value.toString();\n mantissa = str.split('e')[0];\n exponent = str.split('e')[1];\n beforeDec = mantissa.split('.')[0];\n afterDec = mantissa.split('.')[1] || '';\n str = beforeDec + afterDec + zeroes(exponent - afterDec.length);\n if (precision > 0) {\n str += '.' + zeroes(precision);\n }\n return str;\n }\n /**\n * Implementation of toFixed() that treats floats more like decimals\n *\n * Fixes binary rounding issues (eg. (0.615).toFixed(2) === '0.61') that present\n * problems for accounting- and finance-related software.\n */\n function toFixed(value, precision, roundingFunction, optionals) {\n var power = Math.pow(10, precision), optionalsRegExp, output;\n if (value.toFixed(0).search('e') > -1) {\n // Above 1e21, toFixed returns scientific notation, which\n // is useless and unexpected\n output = toFixedLarge(value, precision);\n }\n else {\n //roundingFunction = (roundingFunction !== undefined ? roundingFunction : Math.round);\n // Multiply up by precision, round accurately, then divide and use native toFixed():\n output = (roundingFunction(value * power) / power).toFixed(precision);\n }\n if (optionals) {\n optionalsRegExp = new RegExp('0{1,' + optionals + '}$');\n output = output.replace(optionalsRegExp, '');\n }\n return output;\n }\n /************************************\n Formatting\n ************************************/\n // determine what type of formatting we need to do\n function formatNumbro(value, format, roundingFunction) {\n var output;\n // TODO: do something with `language`\n // figure out what kind of format we are dealing with\n if (format.indexOf('$') > -1) { // currency!!!!!\n output = formatCurrency(value, format, roundingFunction);\n }\n else if (format.indexOf('%') > -1) { // percentage\n output = formatPercentage(value, format, roundingFunction);\n }\n else if (format.indexOf(':') > -1) { // time\n output = formatTime(value);\n }\n else { // plain ol' numbers or bytes\n output = formatNumber(value, format, roundingFunction);\n }\n // return string\n return output;\n }\n function formatCurrency(value, originalFormat, roundingFunction) {\n var format = originalFormat, symbolIndex = format.indexOf('$'), openParenIndex = format.indexOf('('), plusSignIndex = format.indexOf('+'), minusSignIndex = format.indexOf('-'), space = '', decimalSeparator = '', spliceIndex, output;\n if (format.indexOf('$') === -1) {\n // Use defaults instead of the format provided\n if (cultures[currentCulture].currency.position === 'infix') {\n decimalSeparator = cultures[currentCulture].currency.symbol;\n if (cultures[currentCulture].currency.spaceSeparated) {\n decimalSeparator = ' ' + decimalSeparator + ' ';\n }\n }\n else if (cultures[currentCulture].currency.spaceSeparated) {\n space = ' ';\n }\n }\n else {\n // check for space before or after currency\n if (format.indexOf(' $') > -1) {\n space = ' ';\n format = format.replace(' $', '');\n }\n else if (format.indexOf('$ ') > -1) {\n space = ' ';\n format = format.replace('$ ', '');\n }\n else {\n format = format.replace('$', '');\n }\n }\n // Format The Number\n output = formatNumber(value, format, roundingFunction, decimalSeparator);\n if (originalFormat.indexOf('$') === -1) {\n // Use defaults instead of the format provided\n switch (cultures[currentCulture].currency.position) {\n case 'postfix':\n if (output.indexOf(')') > -1) {\n output = output.split('');\n output.splice(-1, 0, space + cultures[currentCulture].currency.symbol);\n output = output.join('');\n }\n else {\n output = output + space + cultures[currentCulture].currency.symbol;\n }\n break;\n case 'infix':\n break;\n case 'prefix':\n if (output.indexOf('(') > -1 || output.indexOf('-') > -1) {\n output = output.split('');\n spliceIndex = Math.max(openParenIndex, minusSignIndex) + 1;\n output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space);\n output = output.join('');\n }\n else {\n output = cultures[currentCulture].currency.symbol + space + output;\n }\n break;\n default:\n throw Error('Currency position should be among [\"prefix\", \"infix\", \"postfix\"]');\n }\n }\n else {\n // position the symbol\n if (symbolIndex <= 1) {\n if (output.indexOf('(') > -1 || output.indexOf('+') > -1 || output.indexOf('-') > -1) {\n output = output.split('');\n spliceIndex = 1;\n if (symbolIndex < openParenIndex || symbolIndex < plusSignIndex || symbolIndex < minusSignIndex) {\n // the symbol appears before the \"(\", \"+\" or \"-\"\n spliceIndex = 0;\n }\n output.splice(spliceIndex, 0, cultures[currentCulture].currency.symbol + space);\n output = output.join('');\n }\n else {\n output = cultures[currentCulture].currency.symbol + space + output;\n }\n }\n else {\n if (output.indexOf(')') > -1) {\n output = output.split('');\n output.splice(-1, 0, space + cultures[currentCulture].currency.symbol);\n output = output.join('');\n }\n else {\n output = output + space + cultures[currentCulture].currency.symbol;\n }\n }\n }\n return output;\n }\n function formatPercentage(value, format, roundingFunction) {\n var space = '', output;\n value = value * 100;\n // check for space before %\n if (format.indexOf(' %') > -1) {\n space = ' ';\n format = format.replace(' %', '');\n }\n else {\n format = format.replace('%', '');\n }\n output = formatNumber(value, format, roundingFunction);\n if (output.indexOf(')') > -1) {\n output = output.split('');\n output.splice(-1, 0, space + '%');\n output = output.join('');\n }\n else {\n output = output + space + '%';\n }\n return output;\n }\n function formatTime(value) {\n var hours = Math.floor(value / 60 / 60), minutes = Math.floor((value - (hours * 60 * 60)) / 60), seconds = Math.round(value - (hours * 60 * 60) - (minutes * 60));\n return hours + ':' +\n ((minutes < 10) ? '0' + minutes : minutes) + ':' +\n ((seconds < 10) ? '0' + seconds : seconds);\n }\n function formatNumber(value, format, roundingFunction, sep) {\n var negP = false, signed = false, optDec = false, abbr = '', i, abbrK = false, // force abbreviation to thousands\n abbrM = false, // force abbreviation to millions\n abbrB = false, // force abbreviation to billions\n abbrT = false, // force abbreviation to trillions\n abbrForce = false, // force abbreviation\n bytes = '', ord = '', abs = Math.abs(value), binarySuffixes = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'], decimalSuffixes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'], min, max, power, totalLength, length, minimumPrecision, pow, w, intPrecision, precision, prefix, postfix, thousands, d = '', forcedNeg = false, neg = false, indexOpenP, size, indexMinus, paren = '', minlen;\n // check if number is zero and a custom zero format has been set\n if (value === 0 && zeroFormat !== null) {\n return zeroFormat;\n }\n if (!isFinite(value)) {\n return '' + value;\n }\n if (format.indexOf('{') === 0) {\n var end = format.indexOf('}');\n if (end === -1) {\n throw Error('Format should also contain a \"}\"');\n }\n prefix = format.slice(1, end);\n format = format.slice(end + 1);\n }\n else {\n prefix = '';\n }\n if (format.indexOf('}') === format.length - 1) {\n var start = format.indexOf('{');\n if (start === -1) {\n throw Error('Format should also contain a \"{\"');\n }\n postfix = format.slice(start + 1, -1);\n format = format.slice(0, start + 1);\n }\n else {\n postfix = '';\n }\n // check for min length\n var info;\n if (format.indexOf('.') === -1) {\n info = format.match(/([0-9]+).*/);\n }\n else {\n info = format.match(/([0-9]+)\\..*/);\n }\n minlen = info === null ? -1 : info[1].length;\n // see if we should use parentheses for negative number or if we should prefix with a sign\n // if both are present we default to parentheses\n if (format.indexOf('-') !== -1) {\n forcedNeg = true;\n }\n if (format.indexOf('(') > -1) {\n negP = true;\n format = format.slice(1, -1);\n }\n else if (format.indexOf('+') > -1) {\n signed = true;\n format = format.replace(/\\+/g, '');\n }\n // see if abbreviation is wanted\n if (format.indexOf('a') > -1) {\n intPrecision = format.split('.')[0].match(/[0-9]+/g) || ['0'];\n intPrecision = parseInt(intPrecision[0], 10);\n // check if abbreviation is specified\n abbrK = format.indexOf('aK') >= 0;\n abbrM = format.indexOf('aM') >= 0;\n abbrB = format.indexOf('aB') >= 0;\n abbrT = format.indexOf('aT') >= 0;\n abbrForce = abbrK || abbrM || abbrB || abbrT;\n // check for space before abbreviation\n if (format.indexOf(' a') > -1) {\n abbr = ' ';\n format = format.replace(' a', '');\n }\n else {\n format = format.replace('a', '');\n }\n totalLength = Math.floor(Math.log(abs) / Math.LN10) + 1;\n minimumPrecision = totalLength % 3;\n minimumPrecision = minimumPrecision === 0 ? 3 : minimumPrecision;\n if (intPrecision && abs !== 0) {\n length = Math.floor(Math.log(abs) / Math.LN10) + 1 - intPrecision;\n pow = 3 * ~~((Math.min(intPrecision, totalLength) - minimumPrecision) / 3);\n abs = abs / Math.pow(10, pow);\n if (format.indexOf('.') === -1 && intPrecision > 3) {\n format += '[.]';\n size = length === 0 ? 0 : 3 * ~~(length / 3) - length;\n size = size < 0 ? size + 3 : size;\n for (i = 0; i < size; i++) {\n format += '0';\n }\n }\n }\n if (Math.floor(Math.log(Math.abs(value)) / Math.LN10) + 1 !== intPrecision) {\n if (abs >= Math.pow(10, 12) && !abbrForce || abbrT) {\n // trillion\n abbr = abbr + cultures[currentCulture].abbreviations.trillion;\n value = value / Math.pow(10, 12);\n }\n else if (abs < Math.pow(10, 12) && abs >= Math.pow(10, 9) && !abbrForce || abbrB) {\n // billion\n abbr = abbr + cultures[currentCulture].abbreviations.billion;\n value = value / Math.pow(10, 9);\n }\n else if (abs < Math.pow(10, 9) && abs >= Math.pow(10, 6) && !abbrForce || abbrM) {\n // million\n abbr = abbr + cultures[currentCulture].abbreviations.million;\n value = value / Math.pow(10, 6);\n }\n else if (abs < Math.pow(10, 6) && abs >= Math.pow(10, 3) && !abbrForce || abbrK) {\n // thousand\n abbr = abbr + cultures[currentCulture].abbreviations.thousand;\n value = value / Math.pow(10, 3);\n }\n }\n }\n // see if we are formatting binary bytes\n if (format.indexOf('b') > -1) {\n // check for space before\n if (format.indexOf(' b') > -1) {\n bytes = ' ';\n format = format.replace(' b', '');\n }\n else {\n format = format.replace('b', '');\n }\n for (power = 0; power <= binarySuffixes.length; power++) {\n min = Math.pow(1024, power);\n max = Math.pow(1024, power + 1);\n if (value >= min && value < max) {\n bytes = bytes + binarySuffixes[power];\n if (min > 0) {\n value = value / min;\n }\n break;\n }\n }\n }\n // see if we are formatting decimal bytes\n if (format.indexOf('d') > -1) {\n // check for space before\n if (format.indexOf(' d') > -1) {\n bytes = ' ';\n format = format.replace(' d', '');\n }\n else {\n format = format.replace('d', '');\n }\n for (power = 0; power <= decimalSuffixes.length; power++) {\n min = Math.pow(1000, power);\n max = Math.pow(1000, power + 1);\n if (value >= min && value < max) {\n bytes = bytes + decimalSuffixes[power];\n if (min > 0) {\n value = value / min;\n }\n break;\n }\n }\n }\n // see if ordinal is wanted\n if (format.indexOf('o') > -1) {\n // check for space before\n if (format.indexOf(' o') > -1) {\n ord = ' ';\n format = format.replace(' o', '');\n }\n else {\n format = format.replace('o', '');\n }\n if (cultures[currentCulture].ordinal) {\n ord = ord + cultures[currentCulture].ordinal(value);\n }\n }\n if (format.indexOf('[.]') > -1) {\n optDec = true;\n format = format.replace('[.]', '.');\n }\n w = value.toString().split('.')[0];\n precision = format.split('.')[1];\n thousands = format.indexOf(',');\n if (precision) {\n if (precision.indexOf('*') !== -1) {\n d = toFixed(value, value.toString().split('.')[1].length, roundingFunction);\n }\n else {\n if (precision.indexOf('[') > -1) {\n precision = precision.replace(']', '');\n precision = precision.split('[');\n d = toFixed(value, (precision[0].length + precision[1].length), roundingFunction, precision[1].length);\n }\n else {\n d = toFixed(value, precision.length, roundingFunction);\n }\n }\n w = d.split('.')[0];\n if (d.split('.')[1].length) {\n var p = sep ? abbr + sep : cultures[currentCulture].delimiters.decimal;\n d = p + d.split('.')[1];\n }\n else {\n d = '';\n }\n if (optDec && Number(d.slice(1)) === 0) {\n d = '';\n }\n }\n else {\n w = toFixed(value, null, roundingFunction);\n }\n // format number\n if (w.indexOf('-') > -1) {\n w = w.slice(1);\n neg = true;\n }\n if (w.length < minlen) {\n w = new Array(minlen - w.length + 1).join('0') + w;\n }\n if (thousands > -1) {\n w = w.toString().replace(/(\\d)(?=(\\d{3})+(?!\\d))/g, '$1' +\n cultures[currentCulture].delimiters.thousands);\n }\n if (format.indexOf('.') === 0) {\n w = '';\n }\n indexOpenP = format.indexOf('(');\n indexMinus = format.indexOf('-');\n if (indexOpenP < indexMinus) {\n paren = ((negP && neg) ? '(' : '') + (((forcedNeg && neg) || (!negP && neg)) ? '-' : '');\n }\n else {\n paren = (((forcedNeg && neg) || (!negP && neg)) ? '-' : '') + ((negP && neg) ? '(' : '');\n }\n return prefix +\n paren + ((!neg && signed && value !== 0) ? '+' : '') +\n w + d +\n ((ord) ? ord : '') +\n ((abbr && !sep) ? abbr : '') +\n ((bytes) ? bytes : '') +\n ((negP && neg) ? ')' : '') +\n postfix;\n }\n /************************************\n Top Level Functions\n ************************************/\n numbro = function (input) {\n if (numbro.isNumbro(input)) {\n input = input.value();\n }\n else if (input === 0 || typeof input === 'undefined') {\n input = 0;\n }\n else if (!Number(input)) {\n input = numbro.fn.unformat(input);\n }\n return new Numbro(Number(input));\n };\n // version number\n numbro.version = VERSION;\n // compare numbro object\n numbro.isNumbro = function (obj) {\n return obj instanceof Numbro;\n };\n /**\n * This function allow the user to set a new language with a fallback if\n * the language does not exist. If no fallback language is provided,\n * it fallbacks to english.\n *\n * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n * `setCulture` should be used instead.\n */\n numbro.setLanguage = function (newLanguage, fallbackLanguage) {\n console.warn('`setLanguage` is deprecated since version 1.6.0. Use `setCulture` instead');\n var key = newLanguage, prefix = newLanguage.split('-')[0], matchingLanguage = null;\n if (!languages[key]) {\n Object.keys(languages).forEach(function (language) {\n if (!matchingLanguage && language.split('-')[0] === prefix) {\n matchingLanguage = language;\n }\n });\n key = matchingLanguage || fallbackLanguage || 'en-US';\n }\n chooseCulture(key);\n };\n /**\n * This function allow the user to set a new culture with a fallback if\n * the culture does not exist. If no fallback culture is provided,\n * it fallbacks to \"en-US\".\n */\n numbro.setCulture = function (newCulture, fallbackCulture) {\n var key = newCulture, suffix = newCulture.split('-')[1], matchingCulture = null;\n if (!cultures[key]) {\n if (suffix) {\n Object.keys(cultures).forEach(function (language) {\n if (!matchingCulture && language.split('-')[1] === suffix) {\n matchingCulture = language;\n }\n });\n }\n key = matchingCulture || fallbackCulture || 'en-US';\n }\n chooseCulture(key);\n };\n /**\n * This function will load languages and then set the global language. If\n * no arguments are passed in, it will simply return the current global\n * language key.\n *\n * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n * `culture` should be used instead.\n */\n numbro.language = function (key, values) {\n console.warn('`language` is deprecated since version 1.6.0. Use `culture` instead');\n if (!key) {\n return currentCulture;\n }\n if (key && !values) {\n if (!languages[key]) {\n throw new Error('Unknown language : ' + key);\n }\n chooseCulture(key);\n }\n if (values || !languages[key]) {\n setCulture(key, values);\n }\n return numbro;\n };\n /**\n * This function will load cultures and then set the global culture. If\n * no arguments are passed in, it will simply return the current global\n * culture code.\n */\n numbro.culture = function (code, values) {\n if (!code) {\n return currentCulture;\n }\n if (code && !values) {\n if (!cultures[code]) {\n throw new Error('Unknown culture : ' + code);\n }\n chooseCulture(code);\n }\n if (values || !cultures[code]) {\n setCulture(code, values);\n }\n return numbro;\n };\n /**\n * This function provides access to the loaded language data. If\n * no arguments are passed in, it will simply return the current\n * global language object.\n *\n * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n * `culture` should be used instead.\n */\n numbro.languageData = function (key) {\n console.warn('`languageData` is deprecated since version 1.6.0. Use `cultureData` instead');\n if (!key) {\n return languages[currentCulture];\n }\n if (!languages[key]) {\n throw new Error('Unknown language : ' + key);\n }\n return languages[key];\n };\n /**\n * This function provides access to the loaded culture data. If\n * no arguments are passed in, it will simply return the current\n * global culture object.\n */\n numbro.cultureData = function (code) {\n if (!code) {\n return cultures[currentCulture];\n }\n if (!cultures[code]) {\n throw new Error('Unknown culture : ' + code);\n }\n return cultures[code];\n };\n numbro.culture('en-US', enUS);\n /**\n * @deprecated Since in version 1.6.0. It will be deleted in version 2.0\n * `cultures` should be used instead.\n */\n numbro.languages = function () {\n console.warn('`languages` is deprecated since version 1.6.0. Use `cultures` instead');\n return languages;\n };\n numbro.cultures = function () {\n return cultures;\n };\n numbro.zeroFormat = function (format) {\n zeroFormat = typeof (format) === 'string' ? format : null;\n };\n numbro.defaultFormat = function (format) {\n defaultFormat = typeof (format) === 'string' ? format : '0.0';\n };\n numbro.defaultCurrencyFormat = function (format) {\n defaultCurrencyFormat = typeof (format) === 'string' ? format : '0$';\n };\n numbro.validate = function (val, culture) {\n var _decimalSep, _thousandSep, _currSymbol, _valArray, _abbrObj, _thousandRegEx, cultureData, temp;\n //coerce val to string\n if (typeof val !== 'string') {\n val += '';\n if (console.warn) {\n console.warn('Numbro.js: Value is not string. It has been co-erced to: ', val);\n }\n }\n //trim whitespaces from either sides\n val = val.trim();\n //if val is just digits return true\n if (!!val.match(/^\\d+$/)) {\n return true;\n }\n //if val is empty return false\n if (val === '') {\n return false;\n }\n //get the decimal and thousands separator from numbro.cultureData\n try {\n //check if the culture is understood by numbro. if not, default it to current culture\n cultureData = numbro.cultureData(culture);\n }\n catch (e) {\n cultureData = numbro.cultureData(numbro.culture());\n }\n //setup the delimiters and currency symbol based on culture\n _currSymbol = cultureData.currency.symbol;\n _abbrObj = cultureData.abbreviations;\n _decimalSep = cultureData.delimiters.decimal;\n if (cultureData.delimiters.thousands === '.') {\n _thousandSep = '\\\\.';\n }\n else {\n _thousandSep = cultureData.delimiters.thousands;\n }\n // validating currency symbol\n temp = val.match(/^[^\\d]+/);\n if (temp !== null) {\n val = val.substr(1);\n if (temp[0] !== _currSymbol) {\n return false;\n }\n }\n //validating abbreviation symbol\n temp = val.match(/[^\\d]+$/);\n if (temp !== null) {\n val = val.slice(0, -1);\n if (temp[0] !== _abbrObj.thousand && temp[0] !== _abbrObj.million &&\n temp[0] !== _abbrObj.billion && temp[0] !== _abbrObj.trillion) {\n return false;\n }\n }\n _thousandRegEx = new RegExp(_thousandSep + '{2}');\n if (!val.match(/[^\\d.,]/g)) {\n _valArray = val.split(_decimalSep);\n if (_valArray.length > 2) {\n return false;\n }\n else {\n if (_valArray.length < 2) {\n return (!!_valArray[0].match(/^\\d+.*\\d$/) && !_valArray[0].match(_thousandRegEx));\n }\n else {\n if (_valArray[0].length === 1) {\n return (!!_valArray[0].match(/^\\d+$/) &&\n !_valArray[0].match(_thousandRegEx) &&\n !!_valArray[1].match(/^\\d+$/));\n }\n else {\n return (!!_valArray[0].match(/^\\d+.*\\d$/) &&\n !_valArray[0].match(_thousandRegEx) &&\n !!_valArray[1].match(/^\\d+$/));\n }\n }\n }\n }\n return false;\n };\n /************************************\n Helpers\n ************************************/\n function setCulture(code, values) {\n cultures[code] = values;\n }\n function chooseCulture(code) {\n currentCulture = code;\n var defaults = cultures[code].defaults;\n if (defaults && defaults.format) {\n numbro.defaultFormat(defaults.format);\n }\n if (defaults && defaults.currencyFormat) {\n numbro.defaultCurrencyFormat(defaults.currencyFormat);\n }\n }\n function format(input, formatString, language, roundingFunction) {\n if (language != null && language !== numbro.culture()) {\n numbro.setCulture(language);\n }\n return formatNumbro(Number(input), formatString != null ? formatString : defaultFormat, roundingFunction == null ? Math.round : roundingFunction);\n }\n module.exports = { \"format\": format };\n}\n","/* proj4/lib/Proj */ function _(require, module, exports) {\n var parseCode = require(382) /* ./parseCode */;\n var extend = require(380) /* ./extend */;\n var projections = require(384) /* ./projections */;\n var deriveConstants = require(379) /* ./deriveConstants */;\n var Datum = require(370) /* ./constants/Datum */;\n var datum = require(375) /* ./datum */;\n function Projection(srsCode, callback) {\n if (!(this instanceof Projection)) {\n return new Projection(srsCode);\n }\n callback = callback || function (error) {\n if (error) {\n throw error;\n }\n };\n var json = parseCode(srsCode);\n if (typeof json !== 'object') {\n callback(srsCode);\n return;\n }\n var ourProj = Projection.projections.get(json.projName);\n if (!ourProj) {\n callback(srsCode);\n return;\n }\n if (json.datumCode && json.datumCode !== 'none') {\n var datumDef = Datum[json.datumCode];\n if (datumDef) {\n json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;\n json.ellps = datumDef.ellipse;\n json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;\n }\n }\n json.k0 = json.k0 || 1.0;\n json.axis = json.axis || 'enu';\n var sphere = deriveConstants.sphere(json.a, json.b, json.rf, json.ellps, json.sphere);\n var ecc = deriveConstants.eccentricity(sphere.a, sphere.b, sphere.rf, json.R_A);\n var datumObj = json.datum || datum(json.datumCode, json.datum_params, sphere.a, sphere.b, ecc.es, ecc.ep2);\n extend(this, json); // transfer everything over from the projection because we don't know what we'll need\n extend(this, ourProj); // transfer all the methods from the projection\n // copy the 4 things over we calulated in deriveConstants.sphere\n this.a = sphere.a;\n this.b = sphere.b;\n this.rf = sphere.rf;\n this.sphere = sphere.sphere;\n // copy the 3 things we calculated in deriveConstants.eccentricity\n this.es = ecc.es;\n this.e = ecc.e;\n this.ep2 = ecc.ep2;\n // add in the datum object\n this.datum = datumObj;\n // init the projection\n this.init();\n // legecy callback from back in the day when it went to spatialreference.org\n callback(null, this);\n }\n Projection.projections = projections;\n Projection.projections.start();\n module.exports = Projection;\n}\n","/* proj4/lib/adjust_axis */ function _(require, module, exports) {\n module.exports = function (crs, denorm, point) {\n var xin = point.x, yin = point.y, zin = point.z || 0.0;\n var v, t, i;\n var out = {};\n for (i = 0; i < 3; i++) {\n if (denorm && i === 2 && point.z === undefined) {\n continue;\n }\n if (i === 0) {\n v = xin;\n t = 'x';\n }\n else if (i === 1) {\n v = yin;\n t = 'y';\n }\n else {\n v = zin;\n t = 'z';\n }\n switch (crs.axis[i]) {\n case 'e':\n out[t] = v;\n break;\n case 'w':\n out[t] = -v;\n break;\n case 'n':\n out[t] = v;\n break;\n case 's':\n out[t] = -v;\n break;\n case 'u':\n if (point[t] !== undefined) {\n out.z = v;\n }\n break;\n case 'd':\n if (point[t] !== undefined) {\n out.z = -v;\n }\n break;\n default:\n //console.log(\"ERROR: unknow axis (\"+crs.axis[i]+\") - check definition of \"+crs.projName);\n return null;\n }\n }\n return out;\n };\n}\n","/* proj4/lib/common/adjust_lon */ function _(require, module, exports) {\n var TWO_PI = Math.PI * 2;\n // SPI is slightly greater than Math.PI, so values that exceed the -180..180\n // degree range by a tiny amount don't get wrapped. This prevents points that\n // have drifted from their original location along the 180th meridian (due to\n // floating point error) from changing their sign.\n var SPI = 3.14159265359;\n var sign = require(367) /* ./sign */;\n module.exports = function (x) {\n return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));\n };\n}\n","/* proj4/lib/common/msfnz */ function _(require, module, exports) {\n module.exports = function (eccent, sinphi, cosphi) {\n var con = eccent * sinphi;\n return cosphi / (Math.sqrt(1 - con * con));\n };\n}\n","/* proj4/lib/common/phi2z */ function _(require, module, exports) {\n var HALF_PI = Math.PI / 2;\n module.exports = function (eccent, ts) {\n var eccnth = 0.5 * eccent;\n var con, dphi;\n var phi = HALF_PI - 2 * Math.atan(ts);\n for (var i = 0; i <= 15; i++) {\n con = eccent * Math.sin(phi);\n dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;\n phi += dphi;\n if (Math.abs(dphi) <= 0.0000000001) {\n return phi;\n }\n }\n //console.log(\"phi2z has NoConvergence\");\n return -9999;\n };\n}\n","/* proj4/lib/common/sign */ function _(require, module, exports) {\n module.exports = function (x) {\n return x < 0 ? -1 : 1;\n };\n}\n","/* proj4/lib/common/toPoint */ function _(require, module, exports) {\n module.exports = function (array) {\n var out = {\n x: array[0],\n y: array[1]\n };\n if (array.length > 2) {\n out.z = array[2];\n }\n if (array.length > 3) {\n out.m = array[3];\n }\n return out;\n };\n}\n","/* proj4/lib/common/tsfnz */ function _(require, module, exports) {\n var HALF_PI = Math.PI / 2;\n module.exports = function (eccent, phi, sinphi) {\n var con = eccent * sinphi;\n var com = 0.5 * eccent;\n con = Math.pow(((1 - con) / (1 + con)), com);\n return (Math.tan(0.5 * (HALF_PI - phi)) / con);\n };\n}\n","/* proj4/lib/constants/Datum */ function _(require, module, exports) {\n exports.wgs84 = {\n towgs84: \"0,0,0\",\n ellipse: \"WGS84\",\n datumName: \"WGS84\"\n };\n exports.ch1903 = {\n towgs84: \"674.374,15.056,405.346\",\n ellipse: \"bessel\",\n datumName: \"swiss\"\n };\n exports.ggrs87 = {\n towgs84: \"-199.87,74.79,246.62\",\n ellipse: \"GRS80\",\n datumName: \"Greek_Geodetic_Reference_System_1987\"\n };\n exports.nad83 = {\n towgs84: \"0,0,0\",\n ellipse: \"GRS80\",\n datumName: \"North_American_Datum_1983\"\n };\n exports.nad27 = {\n nadgrids: \"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat\",\n ellipse: \"clrk66\",\n datumName: \"North_American_Datum_1927\"\n };\n exports.potsdam = {\n towgs84: \"606.0,23.0,413.0\",\n ellipse: \"bessel\",\n datumName: \"Potsdam Rauenberg 1950 DHDN\"\n };\n exports.carthage = {\n towgs84: \"-263.0,6.0,431.0\",\n ellipse: \"clark80\",\n datumName: \"Carthage 1934 Tunisia\"\n };\n exports.hermannskogel = {\n towgs84: \"653.0,-212.0,449.0\",\n ellipse: \"bessel\",\n datumName: \"Hermannskogel\"\n };\n exports.ire65 = {\n towgs84: \"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15\",\n ellipse: \"mod_airy\",\n datumName: \"Ireland 1965\"\n };\n exports.rassadiran = {\n towgs84: \"-133.63,-157.5,-158.62\",\n ellipse: \"intl\",\n datumName: \"Rassadiran\"\n };\n exports.nzgd49 = {\n towgs84: \"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993\",\n ellipse: \"intl\",\n datumName: \"New Zealand Geodetic Datum 1949\"\n };\n exports.osgb36 = {\n towgs84: \"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894\",\n ellipse: \"airy\",\n datumName: \"Airy 1830\"\n };\n exports.s_jtsk = {\n towgs84: \"589,76,480\",\n ellipse: 'bessel',\n datumName: 'S-JTSK (Ferro)'\n };\n exports.beduaram = {\n towgs84: '-106,-87,188',\n ellipse: 'clrk80',\n datumName: 'Beduaram'\n };\n exports.gunung_segara = {\n towgs84: '-403,684,41',\n ellipse: 'bessel',\n datumName: 'Gunung Segara Jakarta'\n };\n exports.rnb72 = {\n towgs84: \"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1\",\n ellipse: \"intl\",\n datumName: \"Reseau National Belge 1972\"\n };\n}\n","/* proj4/lib/constants/Ellipsoid */ function _(require, module, exports) {\n exports.MERIT = {\n a: 6378137.0,\n rf: 298.257,\n ellipseName: \"MERIT 1983\"\n };\n exports.SGS85 = {\n a: 6378136.0,\n rf: 298.257,\n ellipseName: \"Soviet Geodetic System 85\"\n };\n exports.GRS80 = {\n a: 6378137.0,\n rf: 298.257222101,\n ellipseName: \"GRS 1980(IUGG, 1980)\"\n };\n exports.IAU76 = {\n a: 6378140.0,\n rf: 298.257,\n ellipseName: \"IAU 1976\"\n };\n exports.airy = {\n a: 6377563.396,\n b: 6356256.910,\n ellipseName: \"Airy 1830\"\n };\n exports.APL4 = {\n a: 6378137,\n rf: 298.25,\n ellipseName: \"Appl. Physics. 1965\"\n };\n exports.NWL9D = {\n a: 6378145.0,\n rf: 298.25,\n ellipseName: \"Naval Weapons Lab., 1965\"\n };\n exports.mod_airy = {\n a: 6377340.189,\n b: 6356034.446,\n ellipseName: \"Modified Airy\"\n };\n exports.andrae = {\n a: 6377104.43,\n rf: 300.0,\n ellipseName: \"Andrae 1876 (Den., Iclnd.)\"\n };\n exports.aust_SA = {\n a: 6378160.0,\n rf: 298.25,\n ellipseName: \"Australian Natl & S. Amer. 1969\"\n };\n exports.GRS67 = {\n a: 6378160.0,\n rf: 298.2471674270,\n ellipseName: \"GRS 67(IUGG 1967)\"\n };\n exports.bessel = {\n a: 6377397.155,\n rf: 299.1528128,\n ellipseName: \"Bessel 1841\"\n };\n exports.bess_nam = {\n a: 6377483.865,\n rf: 299.1528128,\n ellipseName: \"Bessel 1841 (Namibia)\"\n };\n exports.clrk66 = {\n a: 6378206.4,\n b: 6356583.8,\n ellipseName: \"Clarke 1866\"\n };\n exports.clrk80 = {\n a: 6378249.145,\n rf: 293.4663,\n ellipseName: \"Clarke 1880 mod.\"\n };\n exports.clrk58 = {\n a: 6378293.645208759,\n rf: 294.2606763692654,\n ellipseName: \"Clarke 1858\"\n };\n exports.CPM = {\n a: 6375738.7,\n rf: 334.29,\n ellipseName: \"Comm. des Poids et Mesures 1799\"\n };\n exports.delmbr = {\n a: 6376428.0,\n rf: 311.5,\n ellipseName: \"Delambre 1810 (Belgium)\"\n };\n exports.engelis = {\n a: 6378136.05,\n rf: 298.2566,\n ellipseName: \"Engelis 1985\"\n };\n exports.evrst30 = {\n a: 6377276.345,\n rf: 300.8017,\n ellipseName: \"Everest 1830\"\n };\n exports.evrst48 = {\n a: 6377304.063,\n rf: 300.8017,\n ellipseName: \"Everest 1948\"\n };\n exports.evrst56 = {\n a: 6377301.243,\n rf: 300.8017,\n ellipseName: \"Everest 1956\"\n };\n exports.evrst69 = {\n a: 6377295.664,\n rf: 300.8017,\n ellipseName: \"Everest 1969\"\n };\n exports.evrstSS = {\n a: 6377298.556,\n rf: 300.8017,\n ellipseName: \"Everest (Sabah & Sarawak)\"\n };\n exports.fschr60 = {\n a: 6378166.0,\n rf: 298.3,\n ellipseName: \"Fischer (Mercury Datum) 1960\"\n };\n exports.fschr60m = {\n a: 6378155.0,\n rf: 298.3,\n ellipseName: \"Fischer 1960\"\n };\n exports.fschr68 = {\n a: 6378150.0,\n rf: 298.3,\n ellipseName: \"Fischer 1968\"\n };\n exports.helmert = {\n a: 6378200.0,\n rf: 298.3,\n ellipseName: \"Helmert 1906\"\n };\n exports.hough = {\n a: 6378270.0,\n rf: 297.0,\n ellipseName: \"Hough\"\n };\n exports.intl = {\n a: 6378388.0,\n rf: 297.0,\n ellipseName: \"International 1909 (Hayford)\"\n };\n exports.kaula = {\n a: 6378163.0,\n rf: 298.24,\n ellipseName: \"Kaula 1961\"\n };\n exports.lerch = {\n a: 6378139.0,\n rf: 298.257,\n ellipseName: \"Lerch 1979\"\n };\n exports.mprts = {\n a: 6397300.0,\n rf: 191.0,\n ellipseName: \"Maupertius 1738\"\n };\n exports.new_intl = {\n a: 6378157.5,\n b: 6356772.2,\n ellipseName: \"New International 1967\"\n };\n exports.plessis = {\n a: 6376523.0,\n rf: 6355863.0,\n ellipseName: \"Plessis 1817 (France)\"\n };\n exports.krass = {\n a: 6378245.0,\n rf: 298.3,\n ellipseName: \"Krassovsky, 1942\"\n };\n exports.SEasia = {\n a: 6378155.0,\n b: 6356773.3205,\n ellipseName: \"Southeast Asia\"\n };\n exports.walbeck = {\n a: 6376896.0,\n b: 6355834.8467,\n ellipseName: \"Walbeck\"\n };\n exports.WGS60 = {\n a: 6378165.0,\n rf: 298.3,\n ellipseName: \"WGS 60\"\n };\n exports.WGS66 = {\n a: 6378145.0,\n rf: 298.25,\n ellipseName: \"WGS 66\"\n };\n exports.WGS7 = {\n a: 6378135.0,\n rf: 298.26,\n ellipseName: \"WGS 72\"\n };\n exports.WGS84 = {\n a: 6378137.0,\n rf: 298.257223563,\n ellipseName: \"WGS 84\"\n };\n exports.sphere = {\n a: 6370997.0,\n b: 6370997.0,\n ellipseName: \"Normal Sphere (r=6370997)\"\n };\n}\n","/* proj4/lib/constants/PrimeMeridian */ function _(require, module, exports) {\n exports.greenwich = 0.0; //\"0dE\",\n exports.lisbon = -9.131906111111; //\"9d07'54.862\\\"W\",\n exports.paris = 2.337229166667; //\"2d20'14.025\\\"E\",\n exports.bogota = -74.080916666667; //\"74d04'51.3\\\"W\",\n exports.madrid = -3.687938888889; //\"3d41'16.58\\\"W\",\n exports.rome = 12.452333333333; //\"12d27'8.4\\\"E\",\n exports.bern = 7.439583333333; //\"7d26'22.5\\\"E\",\n exports.jakarta = 106.807719444444; //\"106d48'27.79\\\"E\",\n exports.ferro = -17.666666666667; //\"17d40'W\",\n exports.brussels = 4.367975; //\"4d22'4.71\\\"E\",\n exports.stockholm = 18.058277777778; //\"18d3'29.8\\\"E\",\n exports.athens = 23.7163375; //\"23d42'58.815\\\"E\",\n exports.oslo = 10.722916666667; //\"10d43'22.5\\\"E\"\n}\n","/* proj4/lib/constants/units */ function _(require, module, exports) {\n exports.ft = { to_meter: 0.3048 };\n exports['us-ft'] = { to_meter: 1200 / 3937 };\n}\n","/* proj4/lib/core */ function _(require, module, exports) {\n var proj = require(362) /* ./Proj */;\n var transform = require(387) /* ./transform */;\n var wgs84 = proj('WGS84');\n function transformer(from, to, coords) {\n var transformedArray;\n if (Array.isArray(coords)) {\n transformedArray = transform(from, to, coords);\n if (coords.length === 3) {\n return [transformedArray.x, transformedArray.y, transformedArray.z];\n }\n else {\n return [transformedArray.x, transformedArray.y];\n }\n }\n else {\n return transform(from, to, coords);\n }\n }\n function checkProj(item) {\n if (item instanceof proj) {\n return item;\n }\n if (item.oProj) {\n return item.oProj;\n }\n return proj(item);\n }\n function proj4(fromProj, toProj, coord) {\n fromProj = checkProj(fromProj);\n var single = false;\n var obj;\n if (typeof toProj === 'undefined') {\n toProj = fromProj;\n fromProj = wgs84;\n single = true;\n }\n else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {\n coord = toProj;\n toProj = fromProj;\n fromProj = wgs84;\n single = true;\n }\n toProj = checkProj(toProj);\n if (coord) {\n return transformer(fromProj, toProj, coord);\n }\n else {\n obj = {\n forward: function (coords) {\n return transformer(fromProj, toProj, coords);\n },\n inverse: function (coords) {\n return transformer(toProj, fromProj, coords);\n }\n };\n if (single) {\n obj.oProj = toProj;\n }\n return obj;\n }\n }\n module.exports = proj4;\n}\n","/* proj4/lib/datum */ function _(require, module, exports) {\n var PJD_3PARAM = 1;\n var PJD_7PARAM = 2;\n var PJD_WGS84 = 4; // WGS84 or equivalent\n var PJD_NODATUM = 5; // WGS84 or equivalent\n var SEC_TO_RAD = 4.84813681109535993589914102357e-6;\n function datum(datumCode, datum_params, a, b, es, ep2) {\n var out = {};\n out.datum_type = PJD_WGS84; //default setting\n if (datumCode && datumCode === 'none') {\n out.datum_type = PJD_NODATUM;\n }\n if (datum_params) {\n out.datum_params = datum_params.map(parseFloat);\n if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {\n out.datum_type = PJD_3PARAM;\n }\n if (out.datum_params.length > 3) {\n if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {\n out.datum_type = PJD_7PARAM;\n out.datum_params[3] *= SEC_TO_RAD;\n out.datum_params[4] *= SEC_TO_RAD;\n out.datum_params[5] *= SEC_TO_RAD;\n out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;\n }\n }\n }\n out.a = a; //datum object also uses these values\n out.b = b;\n out.es = es;\n out.ep2 = ep2;\n return out;\n }\n module.exports = datum;\n}\n","/* proj4/lib/datumUtils */ function _(require, module, exports) {\n var PJD_3PARAM = 1;\n var PJD_7PARAM = 2;\n var HALF_PI = Math.PI / 2;\n exports.compareDatums = function (source, dest) {\n if (source.datum_type !== dest.datum_type) {\n return false; // false, datums are not equal\n }\n else if (source.a !== dest.a || Math.abs(this.es - dest.es) > 0.000000000050) {\n // the tolerence for es is to ensure that GRS80 and WGS84\n // are considered identical\n return false;\n }\n else if (source.datum_type === PJD_3PARAM) {\n return (this.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2]);\n }\n else if (source.datum_type === PJD_7PARAM) {\n return (source.datum_params[0] === dest.datum_params[0] && source.datum_params[1] === dest.datum_params[1] && source.datum_params[2] === dest.datum_params[2] && source.datum_params[3] === dest.datum_params[3] && source.datum_params[4] === dest.datum_params[4] && source.datum_params[5] === dest.datum_params[5] && source.datum_params[6] === dest.datum_params[6]);\n }\n else {\n return true; // datums are equal\n }\n }; // cs_compare_datums()\n /*\n * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates\n * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),\n * according to the current ellipsoid parameters.\n *\n * Latitude : Geodetic latitude in radians (input)\n * Longitude : Geodetic longitude in radians (input)\n * Height : Geodetic height, in meters (input)\n * X : Calculated Geocentric X coordinate, in meters (output)\n * Y : Calculated Geocentric Y coordinate, in meters (output)\n * Z : Calculated Geocentric Z coordinate, in meters (output)\n *\n */\n exports.geodeticToGeocentric = function (p, es, a) {\n var Longitude = p.x;\n var Latitude = p.y;\n var Height = p.z ? p.z : 0; //Z value not always supplied\n var Rn; /* Earth radius at location */\n var Sin_Lat; /* Math.sin(Latitude) */\n var Sin2_Lat; /* Square of Math.sin(Latitude) */\n var Cos_Lat; /* Math.cos(Latitude) */\n /*\n ** Don't blow up if Latitude is just a little out of the value\n ** range as it may just be a rounding issue. Also removed longitude\n ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.\n */\n if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {\n Latitude = -HALF_PI;\n }\n else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {\n Latitude = HALF_PI;\n }\n else if ((Latitude < -HALF_PI) || (Latitude > HALF_PI)) {\n /* Latitude out of range */\n //..reportError('geocent:lat out of range:' + Latitude);\n return null;\n }\n if (Longitude > Math.PI) {\n Longitude -= (2 * Math.PI);\n }\n Sin_Lat = Math.sin(Latitude);\n Cos_Lat = Math.cos(Latitude);\n Sin2_Lat = Sin_Lat * Sin_Lat;\n Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));\n return {\n x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),\n y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),\n z: ((Rn * (1 - es)) + Height) * Sin_Lat\n };\n }; // cs_geodetic_to_geocentric()\n exports.geocentricToGeodetic = function (p, es, a, b) {\n /* local defintions and variables */\n /* end-criterium of loop, accuracy of sin(Latitude) */\n var genau = 1e-12;\n var genau2 = (genau * genau);\n var maxiter = 30;\n var P; /* distance between semi-minor axis and location */\n var RR; /* distance between center and location */\n var CT; /* sin of geocentric latitude */\n var ST; /* cos of geocentric latitude */\n var RX;\n var RK;\n var RN; /* Earth radius at location */\n var CPHI0; /* cos of start or old geodetic latitude in iterations */\n var SPHI0; /* sin of start or old geodetic latitude in iterations */\n var CPHI; /* cos of searched geodetic latitude */\n var SPHI; /* sin of searched geodetic latitude */\n var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */\n var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */\n var X = p.x;\n var Y = p.y;\n var Z = p.z ? p.z : 0.0; //Z value not always supplied\n var Longitude;\n var Latitude;\n var Height;\n P = Math.sqrt(X * X + Y * Y);\n RR = Math.sqrt(X * X + Y * Y + Z * Z);\n /* special cases for latitude and longitude */\n if (P / a < genau) {\n /* special case, if P=0. (X=0., Y=0.) */\n Longitude = 0.0;\n /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis\n * of ellipsoid (=center of mass), Latitude becomes PI/2 */\n if (RR / a < genau) {\n Latitude = HALF_PI;\n Height = -b;\n return {\n x: p.x,\n y: p.y,\n z: p.z\n };\n }\n }\n else {\n /* ellipsoidal (geodetic) longitude\n * interval: -PI < Longitude <= +PI */\n Longitude = Math.atan2(Y, X);\n }\n /* --------------------------------------------------------------\n * Following iterative algorithm was developped by\n * \"Institut for Erdmessung\", University of Hannover, July 1988.\n * Internet: www.ife.uni-hannover.de\n * Iterative computation of CPHI,SPHI and Height.\n * Iteration of CPHI and SPHI to 10**-12 radian resp.\n * 2*10**-7 arcsec.\n * --------------------------------------------------------------\n */\n CT = Z / RR;\n ST = P / RR;\n RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);\n CPHI0 = ST * (1.0 - es) * RX;\n SPHI0 = CT * RX;\n iter = 0;\n /* loop to find sin(Latitude) resp. Latitude\n * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */\n do {\n iter++;\n RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);\n /* ellipsoidal (geodetic) height */\n Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);\n RK = es * RN / (RN + Height);\n RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);\n CPHI = ST * (1.0 - RK) * RX;\n SPHI = CT * RX;\n SDPHI = SPHI * CPHI0 - CPHI * SPHI0;\n CPHI0 = CPHI;\n SPHI0 = SPHI;\n } while (SDPHI * SDPHI > genau2 && iter < maxiter);\n /* ellipsoidal (geodetic) latitude */\n Latitude = Math.atan(SPHI / Math.abs(CPHI));\n return {\n x: Longitude,\n y: Latitude,\n z: Height\n };\n }; // cs_geocentric_to_geodetic()\n /****************************************************************/\n // pj_geocentic_to_wgs84( p )\n // p = point to transform in geocentric coordinates (x,y,z)\n /** point object, nothing fancy, just allows values to be\n passed back and forth by reference rather than by value.\n Other point classes may be used as long as they have\n x and y properties, which will get modified in the transform method.\n */\n exports.geocentricToWgs84 = function (p, datum_type, datum_params) {\n if (datum_type === PJD_3PARAM) {\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x + datum_params[0],\n y: p.y + datum_params[1],\n z: p.z + datum_params[2],\n };\n }\n else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n // if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,\n y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,\n z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF\n };\n }\n }; // cs_geocentric_to_wgs84\n /****************************************************************/\n // pj_geocentic_from_wgs84()\n // coordinate system definition,\n // point to transform in geocentric coordinates (x,y,z)\n exports.geocentricFromWgs84 = function (p, datum_type, datum_params) {\n if (datum_type === PJD_3PARAM) {\n //if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: p.x - datum_params[0],\n y: p.y - datum_params[1],\n z: p.z - datum_params[2],\n };\n }\n else if (datum_type === PJD_7PARAM) {\n var Dx_BF = datum_params[0];\n var Dy_BF = datum_params[1];\n var Dz_BF = datum_params[2];\n var Rx_BF = datum_params[3];\n var Ry_BF = datum_params[4];\n var Rz_BF = datum_params[5];\n var M_BF = datum_params[6];\n var x_tmp = (p.x - Dx_BF) / M_BF;\n var y_tmp = (p.y - Dy_BF) / M_BF;\n var z_tmp = (p.z - Dz_BF) / M_BF;\n //if( x[io] === HUGE_VAL )\n // continue;\n return {\n x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,\n y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,\n z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp\n };\n } //cs_geocentric_from_wgs84()\n };\n}\n","/* proj4/lib/datum_transform */ function _(require, module, exports) {\n var PJD_3PARAM = 1;\n var PJD_7PARAM = 2;\n var PJD_NODATUM = 5; // WGS84 or equivalent\n var datum = require(376) /* ./datumUtils */;\n function checkParams(type) {\n return (type === PJD_3PARAM || type === PJD_7PARAM);\n }\n module.exports = function (source, dest, point) {\n // Short cut if the datums are identical.\n if (datum.compareDatums(source, dest)) {\n return point; // in this case, zero is sucess,\n // whereas cs_compare_datums returns 1 to indicate TRUE\n // confusing, should fix this\n }\n // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest\n if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {\n return point;\n }\n // If this datum requires grid shifts, then apply it to geodetic coordinates.\n // Do we need to go through geocentric coordinates?\n if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {\n return point;\n }\n // Convert to geocentric coordinates.\n point = datum.geodeticToGeocentric(point, source.es, source.a);\n // Convert between datums\n if (checkParams(source.datum_type)) {\n point = datum.geocentricToWgs84(point, source.datum_type, source.datum_params);\n }\n if (checkParams(dest.datum_type)) {\n point = datum.geocentricFromWgs84(point, dest.datum_type, dest.datum_params);\n }\n return datum.geocentricToGeodetic(point, dest.es, dest.a, dest.b);\n };\n}\n","/* proj4/lib/defs */ function _(require, module, exports) {\n var globals = require(381) /* ./global */;\n var parseProj = require(383) /* ./projString */;\n var wkt = require(388) /* ./wkt */;\n function defs(name) {\n /*global console*/\n var that = this;\n if (arguments.length === 2) {\n var def = arguments[1];\n if (typeof def === 'string') {\n if (def.charAt(0) === '+') {\n defs[name] = parseProj(arguments[1]);\n }\n else {\n defs[name] = wkt(arguments[1]);\n }\n }\n else {\n defs[name] = def;\n }\n }\n else if (arguments.length === 1) {\n if (Array.isArray(name)) {\n return name.map(function (v) {\n if (Array.isArray(v)) {\n defs.apply(that, v);\n }\n else {\n defs(v);\n }\n });\n }\n else if (typeof name === 'string') {\n if (name in defs) {\n return defs[name];\n }\n }\n else if ('EPSG' in name) {\n defs['EPSG:' + name.EPSG] = name;\n }\n else if ('ESRI' in name) {\n defs['ESRI:' + name.ESRI] = name;\n }\n else if ('IAU2000' in name) {\n defs['IAU2000:' + name.IAU2000] = name;\n }\n else {\n console.log(name);\n }\n return;\n }\n }\n globals(defs);\n module.exports = defs;\n}\n","/* proj4/lib/deriveConstants */ function _(require, module, exports) {\n // ellipoid pj_set_ell.c\n var SIXTH = 0.1666666666666666667;\n /* 1/6 */\n var RA4 = 0.04722222222222222222;\n /* 17/360 */\n var RA6 = 0.02215608465608465608;\n var EPSLN = 1.0e-10;\n var Ellipsoid = require(371) /* ./constants/Ellipsoid */;\n exports.eccentricity = function (a, b, rf, R_A) {\n var a2 = a * a; // used in geocentric\n var b2 = b * b; // used in geocentric\n var es = (a2 - b2) / a2; // e ^ 2\n var e = 0;\n if (R_A) {\n a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));\n a2 = a * a;\n es = 0;\n }\n else {\n e = Math.sqrt(es); // eccentricity\n }\n var ep2 = (a2 - b2) / b2; // used in geocentric\n return {\n es: es,\n e: e,\n ep2: ep2\n };\n };\n exports.sphere = function (a, b, rf, ellps, sphere) {\n if (!a) { // do we have an ellipsoid?\n var ellipse = Ellipsoid[ellps];\n if (!ellipse) {\n ellipse = Ellipsoid.WGS84;\n }\n a = ellipse.a;\n b = ellipse.b;\n rf = ellipse.rf;\n }\n if (rf && !b) {\n b = (1.0 - 1.0 / rf) * a;\n }\n if (rf === 0 || Math.abs(a - b) < EPSLN) {\n sphere = true;\n b = a;\n }\n return {\n a: a,\n b: b,\n rf: rf,\n sphere: sphere\n };\n };\n}\n","/* proj4/lib/extend */ function _(require, module, exports) {\n module.exports = function (destination, source) {\n destination = destination || {};\n var value, property;\n if (!source) {\n return destination;\n }\n for (property in source) {\n value = source[property];\n if (value !== undefined) {\n destination[property] = value;\n }\n }\n return destination;\n };\n}\n","/* proj4/lib/global */ function _(require, module, exports) {\n module.exports = function (defs) {\n defs('EPSG:4326', \"+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees\");\n defs('EPSG:4269', \"+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees\");\n defs('EPSG:3857', \"+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs\");\n defs.WGS84 = defs['EPSG:4326'];\n defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857\n defs.GOOGLE = defs['EPSG:3857'];\n defs['EPSG:900913'] = defs['EPSG:3857'];\n defs['EPSG:102113'] = defs['EPSG:3857'];\n };\n}\n","/* proj4/lib/parseCode */ function _(require, module, exports) {\n var defs = require(378) /* ./defs */;\n var wkt = require(388) /* ./wkt */;\n var projStr = require(383) /* ./projString */;\n function testObj(code) {\n return typeof code === 'string';\n }\n function testDef(code) {\n return code in defs;\n }\n var codeWords = ['GEOGCS', 'GEOCCS', 'PROJCS', 'LOCAL_CS'];\n function testWKT(code) {\n return codeWords.some(function (word) {\n return code.indexOf(word) > -1;\n });\n }\n function testProj(code) {\n return code[0] === '+';\n }\n function parse(code) {\n if (testObj(code)) {\n //check to see if this is a WKT string\n if (testDef(code)) {\n return defs[code];\n }\n if (testWKT(code)) {\n return wkt(code);\n }\n if (testProj(code)) {\n return projStr(code);\n }\n }\n else {\n return code;\n }\n }\n module.exports = parse;\n}\n","/* proj4/lib/projString */ function _(require, module, exports) {\n var D2R = 0.01745329251994329577;\n var PrimeMeridian = require(372) /* ./constants/PrimeMeridian */;\n var units = require(373) /* ./constants/units */;\n module.exports = function (defData) {\n var self = {};\n var paramObj = defData.split('+').map(function (v) {\n return v.trim();\n }).filter(function (a) {\n return a;\n }).reduce(function (p, a) {\n var split = a.split('=');\n split.push(true);\n p[split[0].toLowerCase()] = split[1];\n return p;\n }, {});\n var paramName, paramVal, paramOutname;\n var params = {\n proj: 'projName',\n datum: 'datumCode',\n rf: function (v) {\n self.rf = parseFloat(v);\n },\n lat_0: function (v) {\n self.lat0 = v * D2R;\n },\n lat_1: function (v) {\n self.lat1 = v * D2R;\n },\n lat_2: function (v) {\n self.lat2 = v * D2R;\n },\n lat_ts: function (v) {\n self.lat_ts = v * D2R;\n },\n lon_0: function (v) {\n self.long0 = v * D2R;\n },\n lon_1: function (v) {\n self.long1 = v * D2R;\n },\n lon_2: function (v) {\n self.long2 = v * D2R;\n },\n alpha: function (v) {\n self.alpha = parseFloat(v) * D2R;\n },\n lonc: function (v) {\n self.longc = v * D2R;\n },\n x_0: function (v) {\n self.x0 = parseFloat(v);\n },\n y_0: function (v) {\n self.y0 = parseFloat(v);\n },\n k_0: function (v) {\n self.k0 = parseFloat(v);\n },\n k: function (v) {\n self.k0 = parseFloat(v);\n },\n a: function (v) {\n self.a = parseFloat(v);\n },\n b: function (v) {\n self.b = parseFloat(v);\n },\n r_a: function () {\n self.R_A = true;\n },\n zone: function (v) {\n self.zone = parseInt(v, 10);\n },\n south: function () {\n self.utmSouth = true;\n },\n towgs84: function (v) {\n self.datum_params = v.split(\",\").map(function (a) {\n return parseFloat(a);\n });\n },\n to_meter: function (v) {\n self.to_meter = parseFloat(v);\n },\n units: function (v) {\n self.units = v;\n if (units[v]) {\n self.to_meter = units[v].to_meter;\n }\n },\n from_greenwich: function (v) {\n self.from_greenwich = v * D2R;\n },\n pm: function (v) {\n self.from_greenwich = (PrimeMeridian[v] ? PrimeMeridian[v] : parseFloat(v)) * D2R;\n },\n nadgrids: function (v) {\n if (v === '@null') {\n self.datumCode = 'none';\n }\n else {\n self.nadgrids = v;\n }\n },\n axis: function (v) {\n var legalAxis = \"ewnsud\";\n if (v.length === 3 && legalAxis.indexOf(v.substr(0, 1)) !== -1 && legalAxis.indexOf(v.substr(1, 1)) !== -1 && legalAxis.indexOf(v.substr(2, 1)) !== -1) {\n self.axis = v;\n }\n }\n };\n for (paramName in paramObj) {\n paramVal = paramObj[paramName];\n if (paramName in params) {\n paramOutname = params[paramName];\n if (typeof paramOutname === 'function') {\n paramOutname(paramVal);\n }\n else {\n self[paramOutname] = paramVal;\n }\n }\n else {\n self[paramName] = paramVal;\n }\n }\n if (typeof self.datumCode === 'string' && self.datumCode !== \"WGS84\") {\n self.datumCode = self.datumCode.toLowerCase();\n }\n return self;\n };\n}\n","/* proj4/lib/projections */ function _(require, module, exports) {\n var projs = [\n require(386) /* ./projections/merc */,\n require(385) /* ./projections/longlat */\n ];\n var names = {};\n var projStore = [];\n function add(proj, i) {\n var len = projStore.length;\n if (!proj.names) {\n console.log(i);\n return true;\n }\n projStore[len] = proj;\n proj.names.forEach(function (n) {\n names[n.toLowerCase()] = len;\n });\n return this;\n }\n exports.add = add;\n exports.get = function (name) {\n if (!name) {\n return false;\n }\n var n = name.toLowerCase();\n if (typeof names[n] !== 'undefined' && projStore[names[n]]) {\n return projStore[names[n]];\n }\n };\n exports.start = function () {\n projs.forEach(add);\n };\n}\n","/* proj4/lib/projections/longlat */ function _(require, module, exports) {\n exports.init = function () {\n //no-op for longlat\n };\n function identity(pt) {\n return pt;\n }\n exports.forward = identity;\n exports.inverse = identity;\n exports.names = [\"longlat\", \"identity\"];\n}\n","/* proj4/lib/projections/merc */ function _(require, module, exports) {\n var msfnz = require(365) /* ../common/msfnz */;\n var HALF_PI = Math.PI / 2;\n var EPSLN = 1.0e-10;\n var R2D = 57.29577951308232088;\n var adjust_lon = require(364) /* ../common/adjust_lon */;\n var FORTPI = Math.PI / 4;\n var tsfnz = require(369) /* ../common/tsfnz */;\n var phi2z = require(366) /* ../common/phi2z */;\n exports.init = function () {\n var con = this.b / this.a;\n this.es = 1 - con * con;\n if (!('x0' in this)) {\n this.x0 = 0;\n }\n if (!('y0' in this)) {\n this.y0 = 0;\n }\n this.e = Math.sqrt(this.es);\n if (this.lat_ts) {\n if (this.sphere) {\n this.k0 = Math.cos(this.lat_ts);\n }\n else {\n this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));\n }\n }\n else {\n if (!this.k0) {\n if (this.k) {\n this.k0 = this.k;\n }\n else {\n this.k0 = 1;\n }\n }\n }\n };\n /* Mercator forward equations--mapping lat,long to x,y\n --------------------------------------------------*/\n exports.forward = function (p) {\n var lon = p.x;\n var lat = p.y;\n // convert to radians\n if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {\n return null;\n }\n var x, y;\n if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {\n return null;\n }\n else {\n if (this.sphere) {\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);\n y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));\n }\n else {\n var sinphi = Math.sin(lat);\n var ts = tsfnz(this.e, lat, sinphi);\n x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);\n y = this.y0 - this.a * this.k0 * Math.log(ts);\n }\n p.x = x;\n p.y = y;\n return p;\n }\n };\n /* Mercator inverse equations--mapping x,y to lat/long\n --------------------------------------------------*/\n exports.inverse = function (p) {\n var x = p.x - this.x0;\n var y = p.y - this.y0;\n var lon, lat;\n if (this.sphere) {\n lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));\n }\n else {\n var ts = Math.exp(-y / (this.a * this.k0));\n lat = phi2z(this.e, ts);\n if (lat === -9999) {\n return null;\n }\n }\n lon = adjust_lon(this.long0 + x / (this.a * this.k0));\n p.x = lon;\n p.y = lat;\n return p;\n };\n exports.names = [\"Mercator\", \"Popular Visualisation Pseudo Mercator\", \"Mercator_1SP\", \"Mercator_Auxiliary_Sphere\", \"merc\"];\n}\n","/* proj4/lib/transform */ function _(require, module, exports) {\n var D2R = 0.01745329251994329577;\n var R2D = 57.29577951308232088;\n var PJD_3PARAM = 1;\n var PJD_7PARAM = 2;\n var datum_transform = require(377) /* ./datum_transform */;\n var adjust_axis = require(363) /* ./adjust_axis */;\n var proj = require(362) /* ./Proj */;\n var toPoint = require(368) /* ./common/toPoint */;\n function checkNotWGS(source, dest) {\n return ((source.datum.datum_type === PJD_3PARAM || source.datum.datum_type === PJD_7PARAM) && dest.datumCode !== 'WGS84') || ((dest.datum.datum_type === PJD_3PARAM || dest.datum.datum_type === PJD_7PARAM) && source.datumCode !== 'WGS84');\n }\n module.exports = function transform(source, dest, point) {\n var wgs84;\n if (Array.isArray(point)) {\n point = toPoint(point);\n }\n // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84\n if (source.datum && dest.datum && checkNotWGS(source, dest)) {\n wgs84 = new proj('WGS84');\n point = transform(source, wgs84, point);\n source = wgs84;\n }\n // DGR, 2010/11/12\n if (source.axis !== 'enu') {\n point = adjust_axis(source, false, point);\n }\n // Transform source points to long/lat, if they aren't already.\n if (source.projName === 'longlat') {\n point = {\n x: point.x * D2R,\n y: point.y * D2R\n };\n }\n else {\n if (source.to_meter) {\n point = {\n x: point.x * source.to_meter,\n y: point.y * source.to_meter\n };\n }\n point = source.inverse(point); // Convert Cartesian to longlat\n }\n // Adjust for the prime meridian if necessary\n if (source.from_greenwich) {\n point.x += source.from_greenwich;\n }\n // Convert datums if needed, and if possible.\n point = datum_transform(source.datum, dest.datum, point);\n // Adjust for the prime meridian if necessary\n if (dest.from_greenwich) {\n point = {\n x: point.x - dest.grom_greenwich,\n y: point.y\n };\n }\n if (dest.projName === 'longlat') {\n // convert radians to decimal degrees\n point = {\n x: point.x * R2D,\n y: point.y * R2D\n };\n }\n else { // else project\n point = dest.forward(point);\n if (dest.to_meter) {\n point = {\n x: point.x / dest.to_meter,\n y: point.y / dest.to_meter\n };\n }\n }\n // DGR, 2010/11/12\n if (dest.axis !== 'enu') {\n return adjust_axis(dest, true, point);\n }\n return point;\n };\n}\n","/* proj4/lib/wkt */ function _(require, module, exports) {\n var D2R = 0.01745329251994329577;\n var extend = require(380) /* ./extend */;\n function mapit(obj, key, v) {\n obj[key] = v.map(function (aa) {\n var o = {};\n sExpr(aa, o);\n return o;\n }).reduce(function (a, b) {\n return extend(a, b);\n }, {});\n }\n function sExpr(v, obj) {\n var key;\n if (!Array.isArray(v)) {\n obj[v] = true;\n return;\n }\n else {\n key = v.shift();\n if (key === 'PARAMETER') {\n key = v.shift();\n }\n if (v.length === 1) {\n if (Array.isArray(v[0])) {\n obj[key] = {};\n sExpr(v[0], obj[key]);\n }\n else {\n obj[key] = v[0];\n }\n }\n else if (!v.length) {\n obj[key] = true;\n }\n else if (key === 'TOWGS84') {\n obj[key] = v;\n }\n else {\n obj[key] = {};\n if (['UNIT', 'PRIMEM', 'VERT_DATUM'].indexOf(key) > -1) {\n obj[key] = {\n name: v[0].toLowerCase(),\n convert: v[1]\n };\n if (v.length === 3) {\n obj[key].auth = v[2];\n }\n }\n else if (key === 'SPHEROID') {\n obj[key] = {\n name: v[0],\n a: v[1],\n rf: v[2]\n };\n if (v.length === 4) {\n obj[key].auth = v[3];\n }\n }\n else if (['GEOGCS', 'GEOCCS', 'DATUM', 'VERT_CS', 'COMPD_CS', 'LOCAL_CS', 'FITTED_CS', 'LOCAL_DATUM'].indexOf(key) > -1) {\n v[0] = ['name', v[0]];\n mapit(obj, key, v);\n }\n else if (v.every(function (aa) {\n return Array.isArray(aa);\n })) {\n mapit(obj, key, v);\n }\n else {\n sExpr(v, obj[key]);\n }\n }\n }\n }\n function rename(obj, params) {\n var outName = params[0];\n var inName = params[1];\n if (!(outName in obj) && (inName in obj)) {\n obj[outName] = obj[inName];\n if (params.length === 3) {\n obj[outName] = params[2](obj[outName]);\n }\n }\n }\n function d2r(input) {\n return input * D2R;\n }\n function cleanWKT(wkt) {\n if (wkt.type === 'GEOGCS') {\n wkt.projName = 'longlat';\n }\n else if (wkt.type === 'LOCAL_CS') {\n wkt.projName = 'identity';\n wkt.local = true;\n }\n else {\n if (typeof wkt.PROJECTION === \"object\") {\n wkt.projName = Object.keys(wkt.PROJECTION)[0];\n }\n else {\n wkt.projName = wkt.PROJECTION;\n }\n }\n if (wkt.UNIT) {\n wkt.units = wkt.UNIT.name.toLowerCase();\n if (wkt.units === 'metre') {\n wkt.units = 'meter';\n }\n if (wkt.UNIT.convert) {\n if (wkt.type === 'GEOGCS') {\n if (wkt.DATUM && wkt.DATUM.SPHEROID) {\n wkt.to_meter = parseFloat(wkt.UNIT.convert, 10) * wkt.DATUM.SPHEROID.a;\n }\n }\n else {\n wkt.to_meter = parseFloat(wkt.UNIT.convert, 10);\n }\n }\n }\n if (wkt.GEOGCS) {\n //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){\n // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;\n //}\n if (wkt.GEOGCS.DATUM) {\n wkt.datumCode = wkt.GEOGCS.DATUM.name.toLowerCase();\n }\n else {\n wkt.datumCode = wkt.GEOGCS.name.toLowerCase();\n }\n if (wkt.datumCode.slice(0, 2) === 'd_') {\n wkt.datumCode = wkt.datumCode.slice(2);\n }\n if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {\n wkt.datumCode = 'nzgd49';\n }\n if (wkt.datumCode === \"wgs_1984\") {\n if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {\n wkt.sphere = true;\n }\n wkt.datumCode = 'wgs84';\n }\n if (wkt.datumCode.slice(-6) === '_ferro') {\n wkt.datumCode = wkt.datumCode.slice(0, -6);\n }\n if (wkt.datumCode.slice(-8) === '_jakarta') {\n wkt.datumCode = wkt.datumCode.slice(0, -8);\n }\n if (~wkt.datumCode.indexOf('belge')) {\n wkt.datumCode = \"rnb72\";\n }\n if (wkt.GEOGCS.DATUM && wkt.GEOGCS.DATUM.SPHEROID) {\n wkt.ellps = wkt.GEOGCS.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\\_18/, 'clrk');\n if (wkt.ellps.toLowerCase().slice(0, 13) === \"international\") {\n wkt.ellps = 'intl';\n }\n wkt.a = wkt.GEOGCS.DATUM.SPHEROID.a;\n wkt.rf = parseFloat(wkt.GEOGCS.DATUM.SPHEROID.rf, 10);\n }\n if (~wkt.datumCode.indexOf('osgb_1936')) {\n wkt.datumCode = \"osgb36\";\n }\n }\n if (wkt.b && !isFinite(wkt.b)) {\n wkt.b = wkt.a;\n }\n function toMeter(input) {\n var ratio = wkt.to_meter || 1;\n return parseFloat(input, 10) * ratio;\n }\n var renamer = function (a) {\n return rename(wkt, a);\n };\n var list = [\n ['standard_parallel_1', 'Standard_Parallel_1'],\n ['standard_parallel_2', 'Standard_Parallel_2'],\n ['false_easting', 'False_Easting'],\n ['false_northing', 'False_Northing'],\n ['central_meridian', 'Central_Meridian'],\n ['latitude_of_origin', 'Latitude_Of_Origin'],\n ['latitude_of_origin', 'Central_Parallel'],\n ['scale_factor', 'Scale_Factor'],\n ['k0', 'scale_factor'],\n ['latitude_of_center', 'Latitude_of_center'],\n ['lat0', 'latitude_of_center', d2r],\n ['longitude_of_center', 'Longitude_Of_Center'],\n ['longc', 'longitude_of_center', d2r],\n ['x0', 'false_easting', toMeter],\n ['y0', 'false_northing', toMeter],\n ['long0', 'central_meridian', d2r],\n ['lat0', 'latitude_of_origin', d2r],\n ['lat0', 'standard_parallel_1', d2r],\n ['lat1', 'standard_parallel_1', d2r],\n ['lat2', 'standard_parallel_2', d2r],\n ['alpha', 'azimuth', d2r],\n ['srsCode', 'name']\n ];\n list.forEach(renamer);\n if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === \"Lambert_Azimuthal_Equal_Area\")) {\n wkt.long0 = wkt.longc;\n }\n if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {\n wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);\n wkt.lat_ts = wkt.lat1;\n }\n }\n module.exports = function (wkt, self) {\n var lisp = JSON.parse((\",\" + wkt).replace(/\\s*\\,\\s*([A-Z_0-9]+?)(\\[)/g, ',[\"$1\",').slice(1).replace(/\\s*\\,\\s*([A-Z_0-9]+?)\\]/g, ',\"$1\"]').replace(/,\\[\"VERTCS\".+/, ''));\n var type = lisp.shift();\n var name = lisp.shift();\n lisp.unshift(['name', name]);\n lisp.unshift(['type', type]);\n lisp.unshift('output');\n var obj = {};\n sExpr(lisp, obj);\n cleanWKT(obj.output);\n return extend(self, obj.output);\n };\n}\n","/* sprintf-js/src/sprintf */ function _(require, module, exports) {\n /* global window, exports, define */\n !function () {\n 'use strict';\n var re = {\n not_string: /[^s]/,\n not_bool: /[^t]/,\n not_type: /[^T]/,\n not_primitive: /[^v]/,\n number: /[diefg]/,\n numeric_arg: /[bcdiefguxX]/,\n json: /[j]/,\n not_json: /[^j]/,\n text: /^[^\\x25]+/,\n modulo: /^\\x25{2}/,\n placeholder: /^\\x25(?:([1-9]\\d*)\\$|\\(([^\\)]+)\\))?(\\+)?(0|'[^$])?(-)?(\\d+)?(?:\\.(\\d+))?([b-gijostTuvxX])/,\n key: /^([a-z_][a-z_\\d]*)/i,\n key_access: /^\\.([a-z_][a-z_\\d]*)/i,\n index_access: /^\\[(\\d+)\\]/,\n sign: /^[\\+\\-]/\n };\n function sprintf(key) {\n // `arguments` is not an array, but should be fine for this call\n return sprintf_format(sprintf_parse(key), arguments);\n }\n function vsprintf(fmt, argv) {\n return sprintf.apply(null, [fmt].concat(argv || []));\n }\n function sprintf_format(parse_tree, argv) {\n var cursor = 1, tree_length = parse_tree.length, arg, output = '', i, k, match, pad, pad_character, pad_length, is_positive, sign;\n for (i = 0; i < tree_length; i++) {\n if (typeof parse_tree[i] === 'string') {\n output += parse_tree[i];\n }\n else if (Array.isArray(parse_tree[i])) {\n match = parse_tree[i]; // convenience purposes only\n if (match[2]) { // keyword argument\n arg = argv[cursor];\n for (k = 0; k < match[2].length; k++) {\n if (!arg.hasOwnProperty(match[2][k])) {\n throw new Error(sprintf('[sprintf] property \"%s\" does not exist', match[2][k]));\n }\n arg = arg[match[2][k]];\n }\n }\n else if (match[1]) { // positional argument (explicit)\n arg = argv[match[1]];\n }\n else { // positional argument (implicit)\n arg = argv[cursor++];\n }\n if (re.not_type.test(match[8]) && re.not_primitive.test(match[8]) && arg instanceof Function) {\n arg = arg();\n }\n if (re.numeric_arg.test(match[8]) && (typeof arg !== 'number' && isNaN(arg))) {\n throw new TypeError(sprintf('[sprintf] expecting number but found %T', arg));\n }\n if (re.number.test(match[8])) {\n is_positive = arg >= 0;\n }\n switch (match[8]) {\n case 'b':\n arg = parseInt(arg, 10).toString(2);\n break;\n case 'c':\n arg = String.fromCharCode(parseInt(arg, 10));\n break;\n case 'd':\n case 'i':\n arg = parseInt(arg, 10);\n break;\n case 'j':\n arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0);\n break;\n case 'e':\n arg = match[7] ? parseFloat(arg).toExponential(match[7]) : parseFloat(arg).toExponential();\n break;\n case 'f':\n arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg);\n break;\n case 'g':\n arg = match[7] ? String(Number(arg.toPrecision(match[7]))) : parseFloat(arg);\n break;\n case 'o':\n arg = (parseInt(arg, 10) >>> 0).toString(8);\n break;\n case 's':\n arg = String(arg);\n arg = (match[7] ? arg.substring(0, match[7]) : arg);\n break;\n case 't':\n arg = String(!!arg);\n arg = (match[7] ? arg.substring(0, match[7]) : arg);\n break;\n case 'T':\n arg = Object.prototype.toString.call(arg).slice(8, -1).toLowerCase();\n arg = (match[7] ? arg.substring(0, match[7]) : arg);\n break;\n case 'u':\n arg = parseInt(arg, 10) >>> 0;\n break;\n case 'v':\n arg = arg.valueOf();\n arg = (match[7] ? arg.substring(0, match[7]) : arg);\n break;\n case 'x':\n arg = (parseInt(arg, 10) >>> 0).toString(16);\n break;\n case 'X':\n arg = (parseInt(arg, 10) >>> 0).toString(16).toUpperCase();\n break;\n }\n if (re.json.test(match[8])) {\n output += arg;\n }\n else {\n if (re.number.test(match[8]) && (!is_positive || match[3])) {\n sign = is_positive ? '+' : '-';\n arg = arg.toString().replace(re.sign, '');\n }\n else {\n sign = '';\n }\n pad_character = match[4] ? match[4] === '0' ? '0' : match[4].charAt(1) : ' ';\n pad_length = match[6] - (sign + arg).length;\n pad = match[6] ? (pad_length > 0 ? pad_character.repeat(pad_length) : '') : '';\n output += match[5] ? sign + arg + pad : (pad_character === '0' ? sign + pad + arg : pad + sign + arg);\n }\n }\n }\n return output;\n }\n var sprintf_cache = Object.create(null);\n function sprintf_parse(fmt) {\n if (sprintf_cache[fmt]) {\n return sprintf_cache[fmt];\n }\n var _fmt = fmt, match, parse_tree = [], arg_names = 0;\n while (_fmt) {\n if ((match = re.text.exec(_fmt)) !== null) {\n parse_tree.push(match[0]);\n }\n else if ((match = re.modulo.exec(_fmt)) !== null) {\n parse_tree.push('%');\n }\n else if ((match = re.placeholder.exec(_fmt)) !== null) {\n if (match[2]) {\n arg_names |= 1;\n var field_list = [], replacement_field = match[2], field_match = [];\n if ((field_match = re.key.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {\n if ((field_match = re.key_access.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n }\n else if ((field_match = re.index_access.exec(replacement_field)) !== null) {\n field_list.push(field_match[1]);\n }\n else {\n throw new SyntaxError('[sprintf] failed to parse named argument key');\n }\n }\n }\n else {\n throw new SyntaxError('[sprintf] failed to parse named argument key');\n }\n match[2] = field_list;\n }\n else {\n arg_names |= 2;\n }\n if (arg_names === 3) {\n throw new Error('[sprintf] mixing positional and named placeholders is not (yet) supported');\n }\n parse_tree.push(match);\n }\n else {\n throw new SyntaxError('[sprintf] unexpected placeholder');\n }\n _fmt = _fmt.substring(match[0].length);\n }\n return sprintf_cache[fmt] = parse_tree;\n }\n /**\n * export to either browser or node.js\n */\n /* eslint-disable quote-props */\n if (typeof exports !== 'undefined') {\n exports['sprintf'] = sprintf;\n exports['vsprintf'] = vsprintf;\n }\n if (typeof window !== 'undefined') {\n window['sprintf'] = sprintf;\n window['vsprintf'] = vsprintf;\n if (typeof define === 'function' && define['amd']) {\n define(function () {\n return {\n 'sprintf': sprintf,\n 'vsprintf': vsprintf\n };\n });\n }\n }\n /* eslint-enable quote-props */\n }();\n}\n","/* timezone/index */ function _(require, module, exports) {\n !function (definition) {\n if (typeof module == \"object\" && module.exports)\n module.exports = definition();\n else if (typeof define == \"function\")\n define(definition);\n else\n this.tz = definition();\n }(function () {\n /*\n function die () {\n console.log.apply(console, __slice.call(arguments, 0));\n return process.exit(1);\n }\n \n function say () { return console.log.apply(console, __slice.call(arguments, 0)) }\n */\n function actualize(entry, rule, year) {\n var actualized, date = rule.day[1];\n do {\n actualized = new Date(Date.UTC(year, rule.month, Math.abs(date++)));\n } while (rule.day[0] < 7 && actualized.getUTCDay() != rule.day[0]);\n actualized = {\n clock: rule.clock,\n sort: actualized.getTime(),\n rule: rule,\n save: rule.save * 6e4,\n offset: entry.offset\n };\n actualized[actualized.clock] = actualized.sort + rule.time * 6e4;\n if (actualized.posix) {\n actualized.wallclock = actualized[actualized.clock] + (entry.offset + rule.saved);\n }\n else {\n actualized.posix = actualized[actualized.clock] - (entry.offset + rule.saved);\n }\n return actualized;\n }\n function find(request, clock, time) {\n var i, I, entry, found, zone = request[request.zone], actualized = [], abbrev, rules, j, year = new Date(time).getUTCFullYear(), off = 1;\n for (i = 1, I = zone.length; i < I; i++)\n if (zone[i][clock] <= time)\n break;\n entry = zone[i];\n if (entry.rules) {\n rules = request[entry.rules];\n for (j = year + 1; j >= year - off; --j)\n for (i = 0, I = rules.length; i < I; i++)\n if (rules[i].from <= j && j <= rules[i].to)\n actualized.push(actualize(entry, rules[i], j));\n else if (rules[i].to < j && off == 1)\n off = j - rules[i].to;\n actualized.sort(function (a, b) { return a.sort - b.sort; });\n for (i = 0, I = actualized.length; i < I; i++) {\n if (time >= actualized[i][clock] && actualized[i][actualized[i].clock] > entry[actualized[i].clock])\n found = actualized[i];\n }\n }\n if (found) {\n if (abbrev = /^(.*)\\/(.*)$/.exec(entry.format)) {\n found.abbrev = abbrev[found.save ? 2 : 1];\n }\n else {\n found.abbrev = entry.format.replace(/%s/, found.rule.letter);\n }\n }\n return found || entry;\n }\n function convertToWallclock(request, posix) {\n if (request.zone == \"UTC\")\n return posix;\n request.entry = find(request, \"posix\", posix);\n return posix + request.entry.offset + request.entry.save;\n }\n function convertToPOSIX(request, wallclock) {\n if (request.zone == \"UTC\")\n return wallclock;\n var entry, diff;\n request.entry = entry = find(request, \"wallclock\", wallclock);\n diff = wallclock - entry.wallclock;\n return 0 < diff && diff < entry.save ? null : wallclock - entry.offset - entry.save;\n }\n function adjust(request, posix, match) {\n var increment = +(match[1] + 1) // conversion necessary for week day addition\n , offset = match[2] * increment, index = UNITS.indexOf(match[3].toLowerCase()), date;\n if (index > 9) {\n posix += offset * TIME[index - 10];\n }\n else {\n date = new Date(convertToWallclock(request, posix));\n if (index < 7) {\n while (offset) {\n date.setUTCDate(date.getUTCDate() + increment);\n if (date.getUTCDay() == index)\n offset -= increment;\n }\n }\n else if (index == 7) {\n date.setUTCFullYear(date.getUTCFullYear() + offset);\n }\n else if (index == 8) {\n date.setUTCMonth(date.getUTCMonth() + offset);\n }\n else {\n date.setUTCDate(date.getUTCDate() + offset);\n }\n if ((posix = convertToPOSIX(request, date.getTime())) == null) {\n posix = convertToPOSIX(request, date.getTime() + 864e5 * increment) - 864e5 * increment;\n }\n }\n return posix;\n }\n function convert(vargs) {\n if (!vargs.length)\n return \"1.0.13\";\n var request = Object.create(this), adjustments = [], i, I, $, argument, date;\n for (i = 0; i < vargs.length; i++) { // leave the for loop alone, it works.\n argument = vargs[i];\n // https://twitter.com/bigeasy/status/215112186572439552\n if (Array.isArray(argument)) {\n if (!i && !isNaN(argument[1])) {\n date = argument;\n }\n else {\n argument.splice.apply(vargs, [i--, 1].concat(argument));\n }\n }\n else if (isNaN(argument)) {\n $ = typeof argument;\n if ($ == \"string\") {\n if (~argument.indexOf(\"%\")) {\n request.format = argument;\n }\n else if (!i && argument == \"*\") {\n date = argument;\n }\n else if (!i && ($ = /^(\\d{4})-(\\d{2})-(\\d{2})(?:[T\\s](\\d{2}):(\\d{2})(?::(\\d{2})(?:\\.(\\d+))?)?(Z|(([+-])(\\d{2}(:\\d{2}){0,2})))?)?$/.exec(argument))) {\n date = [];\n date.push.apply(date, $.slice(1, 8));\n if ($[9]) {\n date.push($[10] + 1);\n date.push.apply(date, $[11].split(/:/));\n }\n else if ($[8]) {\n date.push(1);\n }\n }\n else if (/^\\w{2,3}_\\w{2}$/.test(argument)) {\n request.locale = argument;\n }\n else if ($ = UNIT_RE.exec(argument)) {\n adjustments.push($);\n }\n else {\n request.zone = argument;\n }\n }\n else if ($ == \"function\") {\n if ($ = argument.call(request))\n return $;\n }\n else if (/^\\w{2,3}_\\w{2}$/.test(argument.name)) {\n request[argument.name] = argument;\n }\n else if (argument.zones) {\n for ($ in argument.zones)\n request[$] = argument.zones[$];\n for ($ in argument.rules)\n request[$] = argument.rules[$];\n }\n }\n else if (!i) {\n date = argument;\n }\n }\n if (!request[request.locale])\n delete request.locale;\n if (!request[request.zone])\n delete request.zone;\n if (date != null) {\n if (date == \"*\") {\n date = request.clock();\n }\n else if (Array.isArray(date)) {\n $ = [];\n I = !date[7];\n for (i = 0; i < 11; i++)\n $[i] = +(date[i] || 0); // conversion necessary for decrement\n --$[1]; // Grr..\n date = Date.UTC.apply(Date.UTC, $) + -$[7] * ($[8] * 36e5 + $[9] * 6e4 + $[10] * 1e3);\n }\n else {\n date = Math.floor(date);\n }\n if (!isNaN(date)) {\n if (I)\n date = convertToPOSIX(request, date);\n if (date == null)\n return date;\n for (i = 0, I = adjustments.length; i < I; i++) {\n date = adjust(request, date, adjustments[i]);\n }\n if (!request.format)\n return date;\n $ = new Date(convertToWallclock(request, date));\n return request.format.replace(/%([-0_^]?)(:{0,3})(\\d*)(.)/g, function (value, flag, colons, padding, specifier) {\n var f, fill = \"0\", pad;\n if (f = request[specifier]) {\n value = String(f.call(request, $, date, flag, colons.length));\n if ((flag || f.style) == \"_\")\n fill = \" \";\n pad = flag == \"-\" ? 0 : f.pad || 0;\n while (value.length < pad)\n value = fill + value;\n pad = flag == \"-\" ? 0 : padding || f.pad;\n while (value.length < pad)\n value = fill + value;\n if (specifier == \"N\" && pad < value.length)\n value = value.slice(0, pad);\n if (flag == \"^\")\n value = value.toUpperCase();\n }\n return value;\n });\n }\n }\n return function () { return request.convert(arguments); };\n }\n var context = { clock: function () { return +(new Date()); },\n zone: \"UTC\",\n entry: { abbrev: \"UTC\", offset: 0, save: 0 },\n UTC: 1,\n z: function (date, posix, flag, delimiters) {\n var offset = this.entry.offset + this.entry.save, seconds = Math.abs(offset / 1000), parts = [], part = 3600, i, z;\n for (i = 0; i < 3; i++) {\n parts.push((\"0\" + Math.floor(seconds / part)).slice(-2));\n seconds %= part;\n part /= 60;\n }\n if (flag == \"^\" && !offset)\n return \"Z\";\n if (flag == \"^\")\n delimiters = 3;\n if (delimiters == 3) {\n z = parts.join(\":\");\n z = z.replace(/:00$/, \"\");\n if (flag != \"^\")\n z = z.replace(/:00$/, \"\");\n }\n else if (delimiters) {\n z = parts.slice(0, delimiters + 1).join(\":\");\n if (flag == \"^\")\n z = z.replace(/:00$/, \"\");\n }\n else {\n z = parts.slice(0, 2).join(\"\");\n }\n z = (offset < 0 ? \"-\" : \"+\") + z;\n z = z.replace(/([-+])(0)/, { \"_\": \" $1\", \"-\": \"$1\" }[flag] || \"$1$2\");\n return z;\n },\n \"%\": function (date) { return \"%\"; },\n n: function (date) { return \"\\n\"; },\n t: function (date) { return \"\\t\"; },\n U: function (date) { return weekOfYear(date, 0); },\n W: function (date) { return weekOfYear(date, 1); },\n V: function (date) { return isoWeek(date)[0]; },\n G: function (date) { return isoWeek(date)[1]; },\n g: function (date) { return isoWeek(date)[1] % 100; },\n j: function (date) { return Math.floor((date.getTime() - Date.UTC(date.getUTCFullYear(), 0)) / 864e5) + 1; },\n s: function (date) { return Math.floor(date.getTime() / 1000); },\n C: function (date) { return Math.floor(date.getUTCFullYear() / 100); },\n N: function (date) { return date.getTime() % 1000 * 1000000; },\n m: function (date) { return date.getUTCMonth() + 1; },\n Y: function (date) { return date.getUTCFullYear(); },\n y: function (date) { return date.getUTCFullYear() % 100; },\n H: function (date) { return date.getUTCHours(); },\n M: function (date) { return date.getUTCMinutes(); },\n S: function (date) { return date.getUTCSeconds(); },\n e: function (date) { return date.getUTCDate(); },\n d: function (date) { return date.getUTCDate(); },\n u: function (date) { return date.getUTCDay() || 7; },\n w: function (date) { return date.getUTCDay(); },\n l: function (date) { return date.getUTCHours() % 12 || 12; },\n I: function (date) { return date.getUTCHours() % 12 || 12; },\n k: function (date) { return date.getUTCHours(); },\n Z: function (date) { return this.entry.abbrev; },\n a: function (date) { return this[this.locale].day.abbrev[date.getUTCDay()]; },\n A: function (date) { return this[this.locale].day.full[date.getUTCDay()]; },\n h: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; },\n b: function (date) { return this[this.locale].month.abbrev[date.getUTCMonth()]; },\n B: function (date) { return this[this.locale].month.full[date.getUTCMonth()]; },\n P: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)].toLowerCase(); },\n p: function (date) { return this[this.locale].meridiem[Math.floor(date.getUTCHours() / 12)]; },\n R: function (date, posix) { return this.convert([posix, \"%H:%M\"]); },\n T: function (date, posix) { return this.convert([posix, \"%H:%M:%S\"]); },\n D: function (date, posix) { return this.convert([posix, \"%m/%d/%y\"]); },\n F: function (date, posix) { return this.convert([posix, \"%Y-%m-%d\"]); },\n x: function (date, posix) { return this.convert([posix, this[this.locale].date]); },\n r: function (date, posix) { return this.convert([posix, this[this.locale].time12 || '%I:%M:%S']); },\n X: function (date, posix) { return this.convert([posix, this[this.locale].time24]); },\n c: function (date, posix) { return this.convert([posix, this[this.locale].dateTime]); },\n convert: convert,\n locale: \"en_US\",\n en_US: {\n date: \"%m/%d/%Y\",\n time24: \"%I:%M:%S %p\",\n time12: \"%I:%M:%S %p\",\n dateTime: \"%a %d %b %Y %I:%M:%S %p %Z\",\n meridiem: [\"AM\", \"PM\"],\n month: {\n abbrev: \"Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec\".split(\"|\"),\n full: \"January|February|March|April|May|June|July|August|September|October|November|December\".split(\"|\")\n },\n day: {\n abbrev: \"Sun|Mon|Tue|Wed|Thu|Fri|Sat\".split(\"|\"),\n full: \"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday\".split(\"|\")\n }\n }\n };\n var UNITS = \"Sunday|Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|year|month|day|hour|minute|second|millisecond\", UNIT_RE = new RegExp(\"^\\\\s*([+-])(\\\\d+)\\\\s+(\" + UNITS + \")s?\\\\s*$\", \"i\"), TIME = [36e5, 6e4, 1e3, 1];\n UNITS = UNITS.toLowerCase().split(\"|\");\n \"delmHMSUWVgCIky\".replace(/./g, function (e) { context[e].pad = 2; });\n context.N.pad = 9;\n context.j.pad = 3;\n context.k.style = \"_\";\n context.l.style = \"_\";\n context.e.style = \"_\";\n function weekOfYear(date, startOfWeek) {\n var diff, nyd, weekStart;\n nyd = new Date(Date.UTC(date.getUTCFullYear(), 0));\n diff = Math.floor((date.getTime() - nyd.getTime()) / 864e5);\n if (nyd.getUTCDay() == startOfWeek) {\n weekStart = 0;\n }\n else {\n weekStart = 7 - nyd.getUTCDay() + startOfWeek;\n if (weekStart == 8) {\n weekStart = 1;\n }\n }\n return diff >= weekStart ? Math.floor((diff - weekStart) / 7) + 1 : 0;\n }\n function isoWeek(date) {\n var nyd, nyy, week;\n nyy = date.getUTCFullYear();\n nyd = new Date(Date.UTC(nyy, 0)).getUTCDay();\n week = weekOfYear(date, 1) + (nyd > 1 && nyd <= 4 ? 1 : 0);\n if (!week) {\n nyy = date.getUTCFullYear() - 1;\n nyd = new Date(Date.UTC(nyy, 0)).getUTCDay();\n week = nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29) ? 53 : 52;\n return [week, date.getUTCFullYear() - 1];\n }\n else if (week == 53 && !(nyd == 4 || (nyd == 3 && new Date(nyy, 1, 29).getDate() == 29))) {\n return [1, date.getUTCFullYear() + 1];\n }\n else {\n return [week, date.getUTCFullYear()];\n }\n }\n return function () { return context.convert(arguments); };\n });\n}\n","/* tslib/tslib */ function _(require, module, exports) {\n /*! *****************************************************************************\n Copyright (c) Microsoft Corporation. All rights reserved.\n Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use\n this file except in compliance with the License. You may obtain a copy of the\n License at http://www.apache.org/licenses/LICENSE-2.0\n \n THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n MERCHANTABLITY OR NON-INFRINGEMENT.\n \n See the Apache Version 2.0 License for specific language governing permissions\n and limitations under the License.\n ***************************************************************************** */\n /* global global, define, System, Reflect, Promise */\n var __extends;\n var __assign;\n var __rest;\n var __decorate;\n var __param;\n var __metadata;\n var __awaiter;\n var __generator;\n var __exportStar;\n var __values;\n var __read;\n var __spread;\n var __await;\n var __asyncGenerator;\n var __asyncDelegator;\n var __asyncValues;\n var __makeTemplateObject;\n var __importStar;\n var __importDefault;\n (function (factory) {\n var root = typeof global === \"object\" ? global : typeof self === \"object\" ? self : typeof this === \"object\" ? this : {};\n if (typeof define === \"function\" && define.amd) {\n define(\"tslib\", [\"exports\"], function (exports) { factory(createExporter(root, createExporter(exports))); });\n }\n else if (typeof module === \"object\" && typeof module.exports === \"object\") {\n factory(createExporter(root, createExporter(module.exports)));\n }\n else {\n factory(createExporter(root));\n }\n function createExporter(exports, previous) {\n if (exports !== root) {\n if (typeof Object.create === \"function\") {\n Object.defineProperty(exports, \"__esModule\", { value: true });\n }\n else {\n exports.__esModule = true;\n }\n }\n return function (id, v) { return exports[id] = previous ? previous(id, v) : v; };\n }\n })(function (exporter) {\n var extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b)\n if (b.hasOwnProperty(p))\n d[p] = b[p]; };\n __extends = function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n __assign = Object.assign || function (t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n __rest = function (s, e) {\n var t = {};\n for (var p in s)\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++)\n if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };\n __decorate = function (decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\")\n r = Reflect.decorate(decorators, target, key, desc);\n else\n for (var i = decorators.length - 1; i >= 0; i--)\n if (d = decorators[i])\n r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n };\n __param = function (paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); };\n };\n __metadata = function (metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\")\n return Reflect.metadata(metadataKey, metadataValue);\n };\n __awaiter = function (thisArg, _arguments, P, generator) {\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try {\n step(generator.next(value));\n }\n catch (e) {\n reject(e);\n } }\n function rejected(value) { try {\n step(generator[\"throw\"](value));\n }\n catch (e) {\n reject(e);\n } }\n function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n };\n __generator = function (thisArg, body) {\n var _ = { label: 0, sent: function () { if (t[0] & 1)\n throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function () { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f)\n throw new TypeError(\"Generator is already executing.\");\n while (_)\n try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done)\n return t;\n if (y = 0, t)\n op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0:\n case 1:\n t = op;\n break;\n case 4:\n _.label++;\n return { value: op[1], done: false };\n case 5:\n _.label++;\n y = op[1];\n op = [0];\n continue;\n case 7:\n op = _.ops.pop();\n _.trys.pop();\n continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {\n _ = 0;\n continue;\n }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) {\n _.label = op[1];\n break;\n }\n if (op[0] === 6 && _.label < t[1]) {\n _.label = t[1];\n t = op;\n break;\n }\n if (t && _.label < t[2]) {\n _.label = t[2];\n _.ops.push(op);\n break;\n }\n if (t[2])\n _.ops.pop();\n _.trys.pop();\n continue;\n }\n op = body.call(thisArg, _);\n }\n catch (e) {\n op = [6, e];\n y = 0;\n }\n finally {\n f = t = 0;\n }\n if (op[0] & 5)\n throw op[1];\n return { value: op[0] ? op[1] : void 0, done: true };\n }\n };\n __exportStar = function (m, exports) {\n for (var p in m)\n if (!exports.hasOwnProperty(p))\n exports[p] = m[p];\n };\n __values = function (o) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator], i = 0;\n if (m)\n return m.call(o);\n return {\n next: function () {\n if (o && i >= o.length)\n o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n };\n __read = function (o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m)\n return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done)\n ar.push(r.value);\n }\n catch (error) {\n e = { error: error };\n }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"]))\n m.call(i);\n }\n finally {\n if (e)\n throw e.error;\n }\n }\n return ar;\n };\n __spread = function () {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n };\n __await = function (v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n };\n __asyncGenerator = function (thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator)\n throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\n function verb(n) { if (g[n])\n i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\n function resume(n, v) { try {\n step(g[n](v));\n }\n catch (e) {\n settle(q[0][3], e);\n } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length)\n resume(q[0][0], q[0][1]); }\n };\n __asyncDelegator = function (o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\n };\n __asyncValues = function (o) {\n if (!Symbol.asyncIterator)\n throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function (v) { resolve({ value: v, done: d }); }, reject); }\n };\n __makeTemplateObject = function (cooked, raw) {\n if (Object.defineProperty) {\n Object.defineProperty(cooked, \"raw\", { value: raw });\n }\n else {\n cooked.raw = raw;\n }\n return cooked;\n };\n __importStar = function (mod) {\n if (mod && mod.__esModule)\n return mod;\n var result = {};\n if (mod != null)\n for (var k in mod)\n if (Object.hasOwnProperty.call(mod, k))\n result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n };\n __importDefault = function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n };\n exporter(\"__extends\", __extends);\n exporter(\"__assign\", __assign);\n exporter(\"__rest\", __rest);\n exporter(\"__decorate\", __decorate);\n exporter(\"__param\", __param);\n exporter(\"__metadata\", __metadata);\n exporter(\"__awaiter\", __awaiter);\n exporter(\"__generator\", __generator);\n exporter(\"__exportStar\", __exportStar);\n exporter(\"__values\", __values);\n exporter(\"__read\", __read);\n exporter(\"__spread\", __spread);\n exporter(\"__await\", __await);\n exporter(\"__asyncGenerator\", __asyncGenerator);\n exporter(\"__asyncDelegator\", __asyncDelegator);\n exporter(\"__asyncValues\", __asyncValues);\n exporter(\"__makeTemplateObject\", __makeTemplateObject);\n exporter(\"__importStar\", __importStar);\n exporter(\"__importDefault\", __importDefault);\n });\n}\n"]}