@deephaven/embed-chart 0.42.1-beta.0 → 0.42.1-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"App-b3d16b21.js","sources":["../../../chart/dist/plotly/Plotly.js","../../../chart/dist/ChartModel.js","../../../chart/dist/ChartTheme.js","../../../chart/dist/ChartUtils.js","../../../chart/dist/Chart.js","../../../chart/dist/FigureChartModel.js","../../../chart/dist/ChartModelFactory.js","../../src/App.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable global-require */\n// Create a partial plot with only the kinds of charts we need\n// https://github.com/plotly/plotly.js/#modules\n\n// Plotly types don't export anything other than core, so ignore the import type errors\nimport Plotly from 'plotly.js/lib/core.js';\n// @ts-ignore\nimport bar from 'plotly.js/lib/bar.js';\n// @ts-ignore\nimport histogram from 'plotly.js/lib/histogram.js';\n// @ts-ignore\nimport pie from 'plotly.js/lib/pie.js';\n// @ts-ignore\nimport ohlc from 'plotly.js/lib/ohlc.js';\n// @ts-ignore\nimport scattergl from 'plotly.js/lib/scattergl.js';\n// @ts-ignore\nimport treemap from 'plotly.js/lib/treemap.js';\n\n// Load in the trace types we need/support\nPlotly.register([bar, histogram, pie, ohlc, scattergl, treemap]);\nexport default Plotly;\n//# sourceMappingURL=Plotly.js.map","function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n\n/**\n * Model for a Chart\n * All of these methods should return very quickly.\n * If data needs to be loaded asynchronously, return something immediately, then trigger an event for the chart to refresh.\n */\nclass ChartModel {\n constructor(dh) {\n _defineProperty(this, \"dh\", void 0);\n _defineProperty(this, \"listeners\", void 0);\n _defineProperty(this, \"formatter\", void 0);\n _defineProperty(this, \"rect\", void 0);\n _defineProperty(this, \"isDownsamplingDisabled\", void 0);\n _defineProperty(this, \"title\", void 0);\n this.dh = dh;\n this.listeners = [];\n this.isDownsamplingDisabled = false;\n }\n getData() {\n return [];\n }\n getDefaultTitle() {\n return '';\n }\n getLayout() {\n return {};\n }\n getFilterColumnMap() {\n return new Map();\n }\n isFilterRequired() {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setFilter(filter) {}\n\n /**\n * Close this model, clean up any underlying subscriptions\n */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n close() {}\n\n /**\n * Set the formatter to use when charting the data.\n * @param formatter The formatter to use to format the charting data\n */\n setFormatter(formatter) {\n this.formatter = formatter;\n }\n\n /**\n * Disable downsampling\n * @param isDownsamplingDisabled True if downsampling should be disabled\n */\n setDownsamplingDisabled(isDownsamplingDisabled) {\n this.isDownsamplingDisabled = isDownsamplingDisabled;\n }\n\n /**\n * Set the dimensions of the plot. May be needed to evaluate some of the percents\n * @param rect The bounding rectangle of the plot\n */\n setDimensions(rect) {\n this.rect = rect;\n }\n setTitle(title) {\n this.title = title;\n }\n\n /**\n * Subscribe to this ChartModel and start listening for all events.\n * @param callback Callback when an event occurs\n */\n subscribe(callback) {\n this.listeners.push(callback);\n }\n unsubscribe(callback) {\n this.listeners = this.listeners.filter(listener => listener !== callback);\n }\n fireEvent(event) {\n for (var i = 0; i < this.listeners.length; i += 1) {\n this.listeners[i](event);\n }\n }\n fireUpdate(data) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_UPDATED, {\n detail: data\n }));\n }\n fireDisconnect() {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DISCONNECT));\n }\n fireReconnect() {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_RECONNECT));\n }\n fireDownsampleStart(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLESTARTED, {\n detail\n }));\n }\n fireDownsampleFinish(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLEFINISHED, {\n detail\n }));\n }\n fireDownsampleFail(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLEFAILED, {\n detail\n }));\n }\n fireDownsampleNeeded(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLENEEDED, {\n detail\n }));\n }\n fireLoadFinished() {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_LOADFINISHED));\n }\n}\n_defineProperty(ChartModel, \"EVENT_UPDATED\", 'ChartModel.EVENT_UPDATED');\n_defineProperty(ChartModel, \"EVENT_DISCONNECT\", 'ChartModel.EVENT_DISCONNECT');\n_defineProperty(ChartModel, \"EVENT_RECONNECT\", 'ChartModel.EVENT_RECONNECT');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLESTARTED\", 'ChartModel.EVENT_DOWNSAMPLESTARTED');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLEFINISHED\", 'ChartModel.EVENT_DOWNSAMPLEFINISHED');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLEFAILED\", 'ChartModel.EVENT_DOWNSAMPLEFAILED');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLENEEDED\", 'ChartModel.EVENT_DOWNSAMPLENEEDED');\n_defineProperty(ChartModel, \"EVENT_LOADFINISHED\", 'ChartModel.EVENT_LOADFINISHED');\nexport default ChartModel;\n//# sourceMappingURL=ChartModel.js.map","import ChartTheme from \"./ChartTheme.module.css\";\nexport default Object.freeze({\n paper_bgcolor: ChartTheme['paper-bgcolor'],\n plot_bgcolor: ChartTheme['plot-bgcolor'],\n title_color: ChartTheme['title-color'],\n colorway: ChartTheme.colorway,\n gridcolor: ChartTheme.gridcolor,\n linecolor: ChartTheme.linecolor,\n zerolinecolor: ChartTheme.zerolinecolor,\n activecolor: ChartTheme.activecolor,\n rangebgcolor: ChartTheme.rangebgcolor,\n area_color: ChartTheme['area-color'],\n trend_color: ChartTheme['trend-color'],\n line_color: ChartTheme['line-color'],\n error_band_line_color: ChartTheme['error-band-line-color'],\n error_band_fill_color: ChartTheme['error-band-fill-color'],\n ohlc_increasing: ChartTheme['ohlc-increasing'],\n ohlc_decreasing: ChartTheme['ohlc-decreasing']\n});\n//# sourceMappingURL=ChartTheme.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport Log from '@deephaven/log';\nimport { TableUtils } from '@deephaven/jsapi-utils';\nimport set from 'lodash.set';\nimport { assertNotNull } from '@deephaven/utils';\nimport ChartTheme from \"./ChartTheme.js\";\nvar log = Log.module('ChartUtils');\nvar BUSINESS_COLUMN_TYPE = 'io.deephaven.time.DateTime';\nvar MILLIS_PER_HOUR = 3600000;\nvar NANOS_PER_MILLI = 1000000;\nfunction isDateWrapper(value) {\n return value.asDate !== undefined;\n}\nfunction isLongWrapper(value) {\n return value.asNumber !== undefined;\n}\nfunction isDateTimeColumnFormatter(value) {\n return value.dhTimeZone !== undefined;\n}\nfunction isRangedPlotlyAxis(value) {\n return value != null && value.range != null && (value.autorange === false || value.autorange === undefined);\n}\nclass ChartUtils {\n /**\n * Generate the plotly error bar data from the passed in data.\n * Iris passes in the values as absolute, plotly needs them as relative.\n * @param x The main data array\n * @param xLow The absolute low values\n * @param xHigh\n *\n * @returns The error_x object required by plotly, or null if none is required\n */\n static getPlotlyErrorBars(x, xLow, xHigh) {\n var array = xHigh.map((value, i) => value - x[i]);\n var arrayminus = xLow.map((value, i) => x[i] - value);\n return {\n type: 'data',\n symmetric: false,\n array,\n arrayminus\n };\n }\n static convertNumberPrefix(prefix) {\n return prefix.replace(/\\u00A4\\u00A4/g, 'USD').replace(/\\u00A4/g, '$');\n }\n static getPlotlyNumberFormat(formatter, columnType, formatPattern) {\n if (!formatPattern) {\n return null;\n }\n\n // We translate java formatting: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html\n // Into d3 number formatting: https://github.com/d3/d3-format\n // We can't translate number formatting exactly, but should be able to translate the most common cases\n // First split it into the subpatterns; currently only handling the positive subpattern, ignoring the rest\n var subpatterns = formatPattern.split(';');\n var matchArray = subpatterns[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\\.?)(0*)(#*)(E?0*)(%?)(.*)/);\n assertNotNull(matchArray);\n var [, prefix, placeholderDigits, zeroDigits,, decimalDigits, optionalDecimalDigits, numberType, percentSign, suffix] = matchArray;\n var paddingLength = zeroDigits.replace(',', '').length;\n var isCommaSeparated = placeholderDigits.indexOf(',') >= 0 || zeroDigits.indexOf(',') >= 0;\n var comma = isCommaSeparated ? ',' : '';\n var plotlyNumberType = numberType != null && numberType !== '' ? 'e' : 'f';\n var type = percentSign !== '' ? percentSign : plotlyNumberType;\n var decimalLength = decimalDigits.length + optionalDecimalDigits.length;\n // IDS-4565 Plotly uses an older version of d3 which doesn't support the trim option or negative brackets\n // If plotly updates it's d3 version, this should be re-enabled\n // const trimOption = optionalDecimalDigits.length > 0 ? '~' : '';\n var trimOption = '';\n var tickformat = \"0\".concat(paddingLength).concat(comma, \".\").concat(decimalLength).concat(trimOption).concat(type);\n var tickprefix = ChartUtils.convertNumberPrefix(prefix);\n // prefix and suffix are processed the same\n var ticksuffix = ChartUtils.convertNumberPrefix(suffix);\n return {\n tickformat,\n tickprefix,\n ticksuffix,\n automargin: true\n };\n }\n\n /**\n * Adds tick spacing for an axis that has gapBetweenMajorTicks defined.\n *\n * @param axisFormat the current axis format, may be null\n * @param axis the current axis\n * @param isDateType indicates if the columns is a date type\n */\n static addTickSpacing(axisFormat, axis, isDateType) {\n var {\n gapBetweenMajorTicks\n } = axis;\n if (gapBetweenMajorTicks > 0) {\n var updatedFormat = axisFormat || {};\n var tickSpacing = gapBetweenMajorTicks;\n if (isDateType) {\n // Need to convert from nanoseconds to milliseconds\n tickSpacing = gapBetweenMajorTicks / NANOS_PER_MILLI;\n }\n if (axis.log) {\n tickSpacing = Math.log(tickSpacing);\n }\n // Note that tickmode defaults to 'auto'\n updatedFormat.tickmode = 'linear';\n updatedFormat.dtick = tickSpacing;\n return updatedFormat;\n }\n return axisFormat;\n }\n\n /**\n * Retrieve the data source for a given axis in a chart\n * @param chart The chart to get the source for\n * @param axis The axis to find the source for\n * @returns The first source matching this axis\n */\n static getSourceForAxis(chart, axis) {\n for (var i = 0; i < chart.series.length; i += 1) {\n var series = chart.series[i];\n for (var j = 0; j < series.sources.length; j += 1) {\n var source = series.sources[j];\n if (source.axis === axis) {\n return source;\n }\n }\n }\n return null;\n }\n\n /**\n * Get visibility setting for the series object\n * @param name The series name to get the visibility for\n * @param settings Chart settings\n * @returns True for visible series and 'legendonly' for hidden\n */\n static getSeriesVisibility(name, settings) {\n if (settings != null && settings.hiddenSeries != null && settings.hiddenSeries.includes(name)) {\n return 'legendonly';\n }\n return true;\n }\n\n /**\n * Get hidden labels array from chart settings\n * @param settings Chart settings\n * @returns Array of hidden series names\n */\n static getHiddenLabels(settings) {\n if (settings !== null && settings !== void 0 && settings.hiddenSeries) {\n return [...settings.hiddenSeries];\n }\n return [];\n }\n\n /**\n * Create a default series data object. Apply styling to the object afterward.\n * @returns A simple series data object with no styling\n */\n static makeSeriesData(type, mode, name, showLegend) {\n var orientation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ChartUtils.ORIENTATION.VERTICAL;\n return {\n type,\n mode,\n name,\n orientation,\n showlegend: showLegend !== null && showLegend !== void 0 ? showLegend : undefined\n };\n }\n\n /**\n * Get the Plotly marker symbol for the provided Deephaven shape\n * Deephaven shapes: https://deephaven.io/enterprise/docs/plotting/visual-formatting/#point-formatting\n * Plotly shapes: https://plotly.com/javascript/reference/scattergl/#scattergl-marker-symbol\n * Table of plotly shapes: https://plotly.com/python/marker-style/#custom-marker-symbols\n * @param deephavenShape Deephaven shape to get the marker symbol for\n */\n static getMarkerSymbol(deephavenShape) {\n switch (deephavenShape) {\n case 'SQUARE':\n return 'square';\n case 'CIRCLE':\n return 'circle';\n case 'DIAMOND':\n return 'diamond';\n case 'UP_TRIANGLE':\n return 'triangle-up';\n case 'DOWN_TRIANGLE':\n return 'triangle-down';\n case 'RIGHT_TRIANGLE':\n return 'triangle-right';\n case 'LEFT_TRIANGLE':\n return 'triangle-left';\n // There don't seem to be any plotly equivalents for ellipse or rectangles\n // Rectangles could be `line-ew`, `line-ns`, or `hourglass` and `bowtie` instead?\n // Ellipse could be `asterisk` or `diamond-wide` instead?\n // Just throw an error, we've already got a bunch of types.\n case 'ELLIPSE':\n case 'HORIZONTAL_RECTANGLE':\n case 'VERTICAL_RECTANGLE':\n default:\n throw new Error(\"Unrecognized shape \".concat(deephavenShape));\n }\n }\n\n /**\n * Get all axes for a given `Figure`. Iterates through all charts axes and concatenates them.\n * @param figure Figure to get all axes for\n */\n static getAllAxes(figure) {\n return figure.charts.reduce((axes, chart) => [...axes, ...chart.axes], []);\n }\n\n /**\n * Retrieve the chart that contains the passed in series from the figure\n * @param figure The figure to retrieve the chart from\n * @param series The series to get the chart for\n */\n static getChartForSeries(figure, series) {\n var {\n charts\n } = figure;\n for (var i = 0; i < charts.length; i += 1) {\n var _chart = charts[i];\n for (var j = 0; j < _chart.series.length; j += 1) {\n if (series === _chart.series[j]) {\n return _chart;\n }\n }\n }\n return null;\n }\n\n /**\n * Get an object mapping axis to their ranges\n * @param layout The plotly layout object to get the ranges from\n * @returns An object mapping the axis name to it's range\n */\n static getLayoutRanges(layout) {\n var ranges = {};\n var keys = Object.keys(layout).filter(key => key.indexOf('axis') >= 0);\n for (var i = 0; i < keys.length; i += 1) {\n var key = keys[i];\n var value = layout[key];\n if (isRangedPlotlyAxis(value)) {\n // Only want to add the range if it's not autoranged\n ranges[key] = [...value.range];\n }\n }\n return ranges;\n }\n static getAxisLayoutProperty(axisProperty, axisIndex) {\n var axisIndexString = axisIndex > 0 ? \"\".concat(axisIndex + 1) : '';\n return \"\".concat(axisProperty !== null && axisProperty !== void 0 ? axisProperty : '', \"axis\").concat(axisIndexString);\n }\n\n /**\n * Converts an open or close period to a declimal. e.g '09:30\" to 9.5\n *\n * @param period the open or close value of the period\n */\n static periodToDecimal(period) {\n var values = period.split(':');\n return Number(values[0]) + Number(values[1]) / 60;\n }\n\n /**\n * Groups an array and returns a map\n * @param array The object to group\n * @param property The property name to group by\n * @returns A map containing the items grouped by their values for the property\n */\n static groupArray(array, property) {\n return array.reduce((result, item) => {\n var _result$get;\n var key = item[property];\n var group = (_result$get = result.get(key)) !== null && _result$get !== void 0 ? _result$get : [];\n group.push(item);\n result.set(key, group);\n return result;\n }, new Map());\n }\n\n /**\n * Parses the colorway property of a theme and returns an array of colors\n * Theme could have a single string with space separated colors or an array of strings representing the colorway\n * @param theme The theme to get colorway from\n * @returns Colorway array for the theme\n */\n static getColorwayFromTheme() {\n var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ChartTheme;\n var colorway = [];\n if (theme.colorway) {\n if (Array.isArray(theme.colorway)) {\n colorway = theme.colorway;\n } else if (typeof theme.colorway === 'string') {\n colorway = theme.colorway.split(' ');\n } else {\n log.warn(\"Unable to handle colorway property: \".concat(theme.colorway));\n }\n }\n return colorway;\n }\n static titleFromSettings(settings) {\n var {\n series,\n xAxis,\n title = \"\".concat((series !== null && series !== void 0 ? series : []).join(', '), \" by \").concat(xAxis)\n } = settings;\n return title;\n }\n constructor(dh) {\n _defineProperty(this, \"dh\", void 0);\n _defineProperty(this, \"daysOfWeek\", void 0);\n this.dh = dh;\n this.daysOfWeek = Object.freeze(dh.calendar.DayOfWeek.values());\n }\n\n /**\n * Retrieve the axis formats from the provided figure.\n * Currently defaults to just the x/y axes.\n * @param figure The figure to get the axis formats for\n * @param formatter The formatter to use when getting the axis format\n * @returns A map of axis layout property names to axis formats\n */\n getAxisFormats(figure, formatter) {\n var _this = this;\n var axisFormats = new Map();\n var nullFormat = {\n tickformat: null,\n ticksuffix: null\n };\n var allAxes = ChartUtils.getAllAxes(figure);\n var axisTypeMap = ChartUtils.groupArray(allAxes, 'type');\n var {\n charts\n } = figure;\n for (var i = 0; i < charts.length; i += 1) {\n var _chart2 = charts[i];\n for (var j = 0; j < _chart2.series.length; j += 1) {\n var series = _chart2.series[j];\n var {\n sources\n } = series;\n var axisSources = sources.filter(source => source.axis);\n var _loop = function _loop() {\n var source = axisSources[k];\n var {\n axis\n } = source;\n var {\n type: axisType\n } = axis;\n var typeAxes = axisTypeMap.get(axisType);\n assertNotNull(typeAxes);\n var axisIndex = typeAxes.indexOf(axis);\n var axisProperty = _this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);\n if (axisFormats.has(axisLayoutProperty)) {\n log.debug(\"\".concat(axisLayoutProperty, \" already added.\"));\n } else {\n log.debug(\"Adding \".concat(axisLayoutProperty, \" to axisFormats.\"));\n var axisFormat = _this.getPlotlyAxisFormat(source, formatter);\n if (axisFormat === null) {\n axisFormats.set(axisLayoutProperty, nullFormat);\n } else {\n axisFormats.set(axisLayoutProperty, axisFormat);\n var {\n businessCalendar\n } = axis;\n if (businessCalendar != null) {\n var rangebreaks = [];\n var {\n businessPeriods,\n businessDays,\n holidays,\n timeZone: calendarTimeZone\n } = businessCalendar;\n var typeFormatter = formatter === null || formatter === void 0 ? void 0 : formatter.getColumnTypeFormatter(BUSINESS_COLUMN_TYPE);\n var formatterTimeZone;\n if (isDateTimeColumnFormatter(typeFormatter)) {\n formatterTimeZone = typeFormatter.dhTimeZone;\n }\n var timeZoneDiff = formatterTimeZone ? (calendarTimeZone.standardOffset - formatterTimeZone.standardOffset) / 60 : 0;\n if (holidays.length > 0) {\n rangebreaks.push(..._this.createRangeBreakValuesFromHolidays(holidays, calendarTimeZone, formatterTimeZone));\n }\n businessPeriods.forEach(period => rangebreaks.push({\n pattern: 'hour',\n bounds: [ChartUtils.periodToDecimal(period.close) + timeZoneDiff, ChartUtils.periodToDecimal(period.open) + timeZoneDiff]\n }));\n // If there are seven business days, then there is no weekend\n if (businessDays.length < _this.daysOfWeek.length) {\n _this.createBoundsFromDays(businessDays).forEach(weekendBounds => rangebreaks.push({\n pattern: 'day of week',\n bounds: weekendBounds\n }));\n }\n axisFormat.rangebreaks = rangebreaks;\n }\n if (axisFormats.size === _chart2.axes.length) {\n return {\n v: axisFormats\n };\n }\n }\n }\n }\n };\n for (var k = 0; k < axisSources.length; k += 1) {\n var _ret = _loop();\n if (typeof _ret === \"object\") return _ret.v;\n }\n }\n }\n return axisFormats;\n }\n\n /**\n * Converts the Iris plot style into a plotly chart type\n * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle\n * @param isBusinessTime If the plot is using business time for an axis\n */\n getPlotlyChartType(plotStyle, isBusinessTime) {\n var {\n dh\n } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.SCATTER:\n // scattergl mode is more performant, but doesn't support the rangebreaks we need for businessTime calendars\n return !isBusinessTime ? 'scattergl' : 'scatter';\n case dh.plot.SeriesPlotStyle.LINE:\n // There is also still some artifacting bugs with scattergl: https://github.com/plotly/plotly.js/issues/3522\n // The artifacting only occurs on line plots, which we can draw with fairly decent performance using SVG paths\n // Once the above plotly issue is fixed, scattergl should be used here (when !isBusinessTime)\n return 'scatter';\n case dh.plot.SeriesPlotStyle.BAR:\n case dh.plot.SeriesPlotStyle.STACKED_BAR:\n return 'bar';\n case dh.plot.SeriesPlotStyle.PIE:\n return 'pie';\n case dh.plot.SeriesPlotStyle.TREEMAP:\n return 'treemap';\n case dh.plot.SeriesPlotStyle.HISTOGRAM:\n return 'histogram';\n case dh.plot.SeriesPlotStyle.OHLC:\n return 'ohlc';\n default:\n return undefined;\n }\n }\n\n /**\n * Converts the Iris plot style into a plotly chart mode\n * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle.*\n * @param areLinesVisible Whether lines are visible or not\n * @param areShapesVisible Whether shapes are visible or not\n */\n getPlotlyChartMode(plotStyle, areLinesVisible, areShapesVisible) {\n var {\n dh\n } = this;\n var modes = new Set();\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.SCATTER:\n // Default to only showing shapes in scatter plots\n if (areLinesVisible !== null && areLinesVisible !== void 0 ? areLinesVisible : false) {\n modes.add(ChartUtils.MODE_LINES);\n }\n if (areShapesVisible !== null && areShapesVisible !== void 0 ? areShapesVisible : true) {\n modes.add(ChartUtils.MODE_MARKERS);\n }\n break;\n case dh.plot.SeriesPlotStyle.LINE:\n // Default to only showing lines in line series\n if (areLinesVisible !== null && areLinesVisible !== void 0 ? areLinesVisible : true) {\n modes.add(ChartUtils.MODE_LINES);\n }\n if (areShapesVisible !== null && areShapesVisible !== void 0 ? areShapesVisible : false) {\n modes.add(ChartUtils.MODE_MARKERS);\n }\n break;\n default:\n break;\n }\n return modes.size > 0 ? [...modes].join('+') : undefined;\n }\n\n /**\n * Get the property to set on the series data for plotly\n * @param plotStyle The plot style of the series\n * @param sourceType The source type for the series\n */\n getPlotlyProperty(plotStyle, sourceType) {\n var {\n dh\n } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.PIE:\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'labels';\n case dh.plot.SourceType.Y:\n return 'values';\n default:\n break;\n }\n break;\n case dh.plot.SeriesPlotStyle.OHLC:\n switch (sourceType) {\n case dh.plot.SourceType.TIME:\n return 'x';\n default:\n break;\n }\n break;\n case dh.plot.SeriesPlotStyle.TREEMAP:\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'ids';\n case dh.plot.SourceType.Y:\n return 'values';\n case dh.plot.SourceType.LABEL:\n return 'labels';\n case dh.plot.SourceType.PARENT:\n return 'parents';\n case dh.plot.SourceType.COLOR:\n return 'marker.colors';\n default:\n break;\n }\n break;\n default:\n break;\n }\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'x';\n case dh.plot.SourceType.Y:\n return 'y';\n case dh.plot.SourceType.Z:\n return 'z';\n case dh.plot.SourceType.X_LOW:\n return 'xLow';\n case dh.plot.SourceType.X_HIGH:\n return 'xHigh';\n case dh.plot.SourceType.Y_LOW:\n return 'yLow';\n case dh.plot.SourceType.Y_HIGH:\n return 'yHigh';\n case dh.plot.SourceType.TIME:\n return 'time';\n case dh.plot.SourceType.OPEN:\n return 'open';\n case dh.plot.SourceType.HIGH:\n return 'high';\n case dh.plot.SourceType.LOW:\n return 'low';\n case dh.plot.SourceType.CLOSE:\n return 'close';\n case dh.plot.SourceType.SHAPE:\n return 'shape';\n case dh.plot.SourceType.SIZE:\n return 'size';\n case dh.plot.SourceType.LABEL:\n return 'label';\n case dh.plot.SourceType.COLOR:\n return 'color';\n case dh.plot.SourceType.PARENT:\n return 'parent';\n case dh.plot.SourceType.HOVER_TEXT:\n return 'hovertext';\n case dh.plot.SourceType.TEXT:\n return 'text';\n default:\n throw new Error(\"Unrecognized source type: \".concat(sourceType));\n }\n }\n getPlotlySeriesOrientation(series) {\n var _sources$, _sources$$axis;\n var {\n dh\n } = this;\n var {\n sources\n } = series;\n if (sources.length === 2 && ((_sources$ = sources[0]) === null || _sources$ === void 0 ? void 0 : (_sources$$axis = _sources$.axis) === null || _sources$$axis === void 0 ? void 0 : _sources$$axis.type) === dh.plot.AxisType.Y) {\n return ChartUtils.ORIENTATION.HORIZONTAL;\n }\n return ChartUtils.ORIENTATION.VERTICAL;\n }\n\n /**\n * Create a data series (trace) for use with plotly\n * @param series The series to create the series data with\n * @param axisTypeMap The map of axes grouped by type\n * @param seriesVisibility Visibility setting for the series\n * @param theme The theme properties for the plot. See ChartTheme.js for an example\n * @returns The series data (trace) object for use with plotly.\n */\n makeSeriesDataFromSeries(series, axisTypeMap, seriesVisibility) {\n var showLegend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var theme = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ChartTheme;\n var {\n name,\n isLinesVisible,\n isShapesVisible,\n plotStyle,\n lineColor,\n shapeColor,\n sources,\n shape,\n shapeSize\n } = series;\n var isBusinessTime = sources.some(source => {\n var _source$axis;\n return (_source$axis = source.axis) === null || _source$axis === void 0 ? void 0 : _source$axis.businessCalendar;\n });\n var type = this.getChartType(plotStyle, isBusinessTime);\n var mode = this.getPlotlyChartMode(plotStyle, isLinesVisible !== null && isLinesVisible !== void 0 ? isLinesVisible : undefined, isShapesVisible !== null && isShapesVisible !== void 0 ? isShapesVisible : undefined);\n var orientation = this.getPlotlySeriesOrientation(series);\n var seriesData = ChartUtils.makeSeriesData(type, mode, name, showLegend, orientation);\n this.addSourcesToSeriesData(seriesData, plotStyle, sources, axisTypeMap);\n this.addStylingToSeriesData(seriesData, plotStyle, theme, lineColor, shapeColor, shape, shapeSize, seriesVisibility);\n return seriesData;\n }\n addSourcesToSeriesData(seriesDataParam, plotStyle, sources, axisTypeMap) {\n var seriesData = seriesDataParam;\n for (var k = 0; k < sources.length; k += 1) {\n var source = sources[k];\n var {\n axis: _axis,\n type: sourceType\n } = source;\n var dataAttributeName = this.getPlotlyProperty(plotStyle, sourceType);\n set(seriesData, dataAttributeName, []);\n var axisProperty = _axis != null ? this.getAxisPropertyName(_axis.type) : null;\n if (axisProperty != null) {\n var axes = axisTypeMap.get(_axis.type);\n if (axes) {\n var axisIndex = axes.indexOf(_axis);\n var axisIndexString = axisIndex > 0 ? \"\".concat(axisIndex + 1) : '';\n seriesData[\"\".concat(axisProperty, \"axis\")] = \"\".concat(axisProperty).concat(axisIndexString);\n }\n }\n }\n }\n addStylingToSeriesData(seriesDataParam, plotStyle) {\n var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ChartTheme;\n var lineColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var shapeColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;\n var shape = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;\n var shapeSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;\n var seriesVisibility = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;\n var {\n dh\n } = this;\n var seriesData = seriesDataParam;\n // Add some empty objects so we can fill them in later with details without checking for existence\n seriesData.marker = {\n line: {}\n }; // border line width on markers\n seriesData.line = {\n width: 1 // default line width for lines, should eventually be able to override\n };\n\n if (plotStyle === dh.plot.SeriesPlotStyle.AREA) {\n seriesData.fill = 'tozeroy';\n } else if (plotStyle === dh.plot.SeriesPlotStyle.STACKED_AREA) {\n seriesData.stackgroup = 'stack';\n } else if (plotStyle === dh.plot.SeriesPlotStyle.STEP) {\n seriesData.line.shape = 'hv'; // plot.ly horizontal then vertical step styling\n } else if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {\n // The default histfunc in plotly is 'count', but the data passed up from the API provides explicit x/y values and bins\n // Since it's converted to bar, just set the widths of each bar\n seriesData.width = [];\n if (seriesData.marker.line !== undefined) {\n Object.assign(seriesData.marker.line, {\n color: theme.paper_bgcolor,\n width: 1\n });\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.OHLC) {\n seriesData.increasing = {\n line: {\n color: theme.ohlc_increasing\n }\n };\n seriesData.decreasing = {\n line: {\n color: theme.ohlc_decreasing\n }\n };\n } else if (plotStyle === dh.plot.SeriesPlotStyle.PIE) {\n seriesData.textinfo = 'label+percent';\n\n // TODO Open DefinitelyTyped/Plotly PR to mark family and size as optional\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/lib/traces/pie.d.ts#L6\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n seriesData.outsidetextfont = {\n color: theme.title_color\n };\n } else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {\n seriesData.hoverinfo = 'text';\n seriesData.textinfo = 'label+text';\n seriesData.tiling = {\n packing: 'squarify',\n pad: 0\n };\n seriesData.textposition = 'middle center';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n seriesData.outsidetextfont = {\n color: theme.title_color\n };\n }\n if (lineColor != null) {\n if (plotStyle === dh.plot.SeriesPlotStyle.BAR) {\n seriesData.marker.color = lineColor;\n } else {\n seriesData.line.color = lineColor;\n }\n }\n if (shapeColor != null) {\n seriesData.marker.color = shapeColor;\n }\n if (shape != null && shape.length > 0) {\n try {\n seriesData.marker.symbol = ChartUtils.getMarkerSymbol(shape);\n } catch (e) {\n log.warn('Unable to handle shape', shape, ':', e);\n }\n }\n if (shapeSize != null) {\n seriesData.marker.size = shapeSize * ChartUtils.DEFAULT_MARKER_SIZE;\n }\n\n // Skipping pie charts\n // Pie slice visibility is configured in chart layout instead of series data\n if (seriesVisibility != null && plotStyle !== dh.plot.SeriesPlotStyle.PIE) {\n seriesData.visible = seriesVisibility;\n }\n }\n getChartType(plotStyle, isBusinessTime) {\n var {\n dh\n } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.HISTOGRAM:\n // When reading data from the `Figure`, it already provides bins and values, so rather than using\n // plot.ly to calculate the bins and sum values, just convert it to a bar chart\n return 'bar';\n default:\n return this.getPlotlyChartType(plotStyle, isBusinessTime);\n }\n }\n\n /**\n * Return the plotly axis property name\n * @param axisType The axis type to get the property name for\n */\n getAxisPropertyName(axisType) {\n var {\n dh\n } = this;\n switch (axisType) {\n case dh.plot.AxisType.X:\n return 'x';\n case dh.plot.AxisType.Y:\n return 'y';\n default:\n return null;\n }\n }\n\n /**\n * Returns the plotly \"side\" value for the provided axis position\n * @param axisPosition The Iris AxisPosition of the axis\n */\n getAxisSide(axisPosition) {\n var {\n dh\n } = this;\n switch (axisPosition) {\n case dh.plot.AxisPosition.BOTTOM:\n return 'bottom';\n case dh.plot.AxisPosition.TOP:\n return 'top';\n case dh.plot.AxisPosition.LEFT:\n return 'left';\n case dh.plot.AxisPosition.RIGHT:\n return 'right';\n default:\n return undefined;\n }\n }\n\n /**\n * Update the layout with all the axes information for the provided figure\n * @param figure Figure to update the axes for\n * @param layoutParam Layout object to update in place\n * @param chartAxisRangeParser Function to retrieve the axis range parser\n * @param plotWidth Width of the plot in pixels\n * @param plotHeight Height of the plot in pixels\n * @param theme Theme used for displaying the plot\n */\n updateFigureAxes(layoutParam, figure, chartAxisRangeParser) {\n var plotWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var plotHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var theme = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ChartTheme;\n var layout = layoutParam;\n var figureAxes = ChartUtils.getAllAxes(figure);\n for (var i = 0; i < figure.charts.length; i += 1) {\n var _chart3 = figure.charts[i];\n var axisRangeParser = chartAxisRangeParser === null || chartAxisRangeParser === void 0 ? void 0 : chartAxisRangeParser(_chart3);\n var bounds = this.getChartBounds(figure, _chart3, plotWidth, plotHeight);\n this.updateLayoutAxes(layout, _chart3.axes, figureAxes, plotWidth, plotHeight, bounds, axisRangeParser, theme);\n }\n this.removeStaleAxes(layout, figureAxes);\n }\n getChartBounds(figure, chart, plotWidth, plotHeight) {\n var _axisPositionMap$get;\n var {\n dh\n } = this;\n var {\n cols,\n rows\n } = figure;\n var {\n column,\n colspan,\n row,\n rowspan\n } = chart;\n var endColumn = column + colspan;\n var endRow = row + rowspan;\n var columnSize = 1 / cols;\n var rowSize = 1 / rows;\n var xMarginSize = ChartUtils.AXIS_SIZE_PX / plotWidth;\n var yMarginSize = ChartUtils.AXIS_SIZE_PX / plotHeight;\n var bounds = {\n // Need to invert the row positioning so the first one defined shows up on top instead of the bottom, since coordinates start in bottom left\n bottom: (rows - endRow) * rowSize + (endRow < rows ? yMarginSize / 2 : 0),\n top: (rows - row) * rowSize - (row > 0 ? yMarginSize / 2 : 0),\n left: column * columnSize + (column > 0 ? xMarginSize / 2 : 0),\n right: endColumn * columnSize - (endColumn < cols ? xMarginSize / 2 : 0)\n };\n\n // Adjust the bounds based on where the legend is\n // For now, always assume the legend is shown on the right\n var axisPositionMap = ChartUtils.groupArray(chart.axes, 'position');\n var rightAxes = (_axisPositionMap$get = axisPositionMap.get(dh.plot.AxisPosition.RIGHT)) !== null && _axisPositionMap$get !== void 0 ? _axisPositionMap$get : [];\n if (rightAxes.length > 0) {\n if (plotWidth > 0) {\n bounds.right -= (bounds.right - bounds.left) * Math.max(0, Math.min(ChartUtils.LEGEND_WIDTH_PX / plotWidth, ChartUtils.MAX_LEGEND_SIZE));\n } else {\n bounds.right -= (bounds.right - bounds.left) * ChartUtils.DEFAULT_AXIS_SIZE;\n }\n }\n return bounds;\n }\n getPlotlyDateFormat(formatter, columnType, formatPattern) {\n var {\n dh\n } = this;\n var tickformat = formatPattern == null ? undefined : formatPattern.replace('%', '%%').replace(/S{9}/g, '%9f').replace(/S{8}/g, '%8f').replace(/S{7}/g, '%7f').replace(/S{6}/g, '%6f').replace(/S{5}/g, '%5f').replace(/S{4}/g, '%4f').replace(/S{3}/g, '%3f').replace(/S{2}/g, '%2f').replace(/S{1}/g, '%1f').replace(/y{4}/g, '%Y').replace(/y{2}/g, '%y').replace(/M{4}/g, '%B').replace(/M{3}/g, '%b').replace(/M{2}/g, '%m').replace(/M{1}/g, '%-m').replace(/E{4,}/g, '%A').replace(/E{1,}/g, '%a').replace(/d{2}/g, '%d').replace(/([^%]|^)d{1}/g, '$1%-d').replace(/H{2}/g, '%H').replace(/h{2}/g, '%I').replace(/h{1}/g, '%-I').replace(/m{2}/g, '%M').replace(/s{2}/g, '%S').replace(\"'T'\", 'T').replace(' z', ''); // timezone added as suffix if necessary\n\n var ticksuffix;\n var dataFormatter = formatter === null || formatter === void 0 ? void 0 : formatter.getColumnTypeFormatter(columnType);\n if (dataFormatter != null && isDateTimeColumnFormatter(dataFormatter) && dataFormatter.dhTimeZone != null && dataFormatter.showTimeZone) {\n ticksuffix = dh.i18n.DateTimeFormat.format(' z', new Date(), dataFormatter.dhTimeZone);\n }\n return {\n tickformat,\n ticksuffix,\n automargin: true\n };\n }\n\n /**\n * Gets the plotly axis formatting information from the source passed in\n * @param source The Source to get the formatter information from\n * @param formatter The current formatter for formatting data\n */\n getPlotlyAxisFormat(source) {\n var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var {\n dh\n } = this;\n var {\n axis,\n columnType\n } = source;\n var {\n formatPattern\n } = axis;\n var axisFormat = null;\n if (TableUtils.isDateType(columnType)) {\n axisFormat = this.getPlotlyDateFormat(formatter, columnType, formatPattern);\n axisFormat = ChartUtils.addTickSpacing(axisFormat, axis, true);\n } else if (TableUtils.isNumberType(columnType)) {\n axisFormat = ChartUtils.getPlotlyNumberFormat(formatter, columnType, formatPattern);\n axisFormat = ChartUtils.addTickSpacing(axisFormat, axis, false);\n }\n if (axis.formatType === dh.plot.AxisFormatType.CATEGORY) {\n if (axisFormat) {\n axisFormat.type = 'category';\n } else {\n axisFormat = {\n type: 'category',\n tickformat: undefined,\n ticksuffix: undefined\n };\n }\n }\n return axisFormat;\n }\n\n /**\n * Updates the axes positions and sizes in the layout object provided.\n * If the axis did not exist in the layout previously, it is created and added.\n * Any axis that no longer exists in axes is removed.\n * With Downsampling enabled, will also update the range on the axis itself as appropriate\n * @param layoutParam The layout object to update\n * @param chartAxes The chart axes to update the layout with\n * @param figureAxes All figure axes to update the layout with\n * @param plotWidth The width of the plot to calculate the axis sizes for\n * @param plotHeight The height of the plot to calculate the axis sizes for\n * @param bounds The bounds for this set of axes\n * @param axisRangeParser A function to retrieve the range parser for a given axis\n */\n updateLayoutAxes(layoutParam, chartAxes, figureAxes) {\n var plotWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var plotHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var bounds = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {\n left: 0,\n top: 0,\n right: 1,\n bottom: 1\n };\n var axisRangeParser = arguments.length > 6 ? arguments[6] : undefined;\n var theme = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ChartTheme;\n var {\n dh\n } = this;\n var xAxisSize = plotWidth > 0 ? Math.max(ChartUtils.MIN_AXIS_SIZE, Math.min(ChartUtils.AXIS_SIZE_PX / plotHeight, ChartUtils.MAX_AXIS_SIZE)) : ChartUtils.DEFAULT_AXIS_SIZE;\n var yAxisSize = plotHeight > 0 ? Math.max(ChartUtils.MIN_AXIS_SIZE, Math.min(ChartUtils.AXIS_SIZE_PX / plotWidth, ChartUtils.MAX_AXIS_SIZE)) : ChartUtils.DEFAULT_AXIS_SIZE;\n var layout = layoutParam;\n var axisPositionMap = ChartUtils.groupArray(chartAxes, 'position');\n var axisTypeMap = ChartUtils.groupArray(chartAxes, 'type');\n var axisTypes = [...axisTypeMap.keys()];\n var figureAxisTypeMap = ChartUtils.groupArray(figureAxes, 'type');\n for (var j = 0; j < axisTypes.length; j += 1) {\n var axisType = axisTypes[j];\n var axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n var typeAxes = axisTypeMap.get(axisType);\n var figureTypeAxes = figureAxisTypeMap.get(axisType);\n var isYAxis = axisType === dh.plot.AxisType.Y;\n var plotSize = isYAxis ? plotHeight : plotWidth;\n assertNotNull(typeAxes);\n assertNotNull(figureTypeAxes);\n for (var chartAxisIndex = 0; chartAxisIndex < typeAxes.length; chartAxisIndex += 1) {\n var _axis2 = typeAxes[chartAxisIndex];\n var figureAxisIndex = figureTypeAxes.indexOf(_axis2);\n var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, figureAxisIndex);\n if (layout[axisLayoutProperty] == null) {\n layout[axisLayoutProperty] = this.makeLayoutAxis(axisType, theme);\n }\n var layoutAxis = layout[axisLayoutProperty];\n if (layoutAxis != null) {\n this.updateLayoutAxis(layoutAxis, _axis2, chartAxisIndex, axisPositionMap, xAxisSize, yAxisSize, bounds);\n var {\n range: _range,\n autorange\n } = layoutAxis;\n if (axisRangeParser != null && _range !== undefined && (autorange === undefined || autorange === false)) {\n var rangeParser = axisRangeParser(_axis2);\n var [rangeStart, rangeEnd] = rangeParser(_range);\n log.debug('Setting downsample range', plotSize, rangeStart, rangeEnd);\n _axis2.range(plotSize, rangeStart, rangeEnd);\n } else {\n _axis2.range(plotSize);\n }\n }\n }\n }\n }\n }\n\n /**\n * Remove any axes from the layout param that no longer belong to any series\n * @param layoutParam Layout object to remove stale axes from\n * @param axes All axes in the figure\n */\n removeStaleAxes(layoutParam, axes) {\n var layout = layoutParam;\n var figureAxisTypeMap = ChartUtils.groupArray(axes, 'type');\n var figureAxisTypes = [...figureAxisTypeMap.keys()];\n for (var i = 0; i < figureAxisTypes.length; i += 1) {\n var axisType = figureAxisTypes[i];\n var typeAxes = figureAxisTypeMap.get(axisType);\n assertNotNull(typeAxes);\n var axisIndex = typeAxes.length;\n // Delete any axes that may no longer exist\n var axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);\n while (layout[axisLayoutProperty] != null) {\n delete layout[axisLayoutProperty];\n axisIndex += 1;\n axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);\n }\n }\n }\n }\n\n /**\n * Updates the layout axis object in place\n * @param layoutAxisParam The plotly layout axis param\n * @param axis The Iris Axis to update the plotly layout with\n * @param axisIndex The type index for this axis\n * @param axisPositionMap All the axes mapped by position\n * @param axisSize The size of each axis in percent\n * @param bounds The bounds of the axes domains\n */\n updateLayoutAxis(layoutAxisParam, axis, axisIndex, axisPositionMap, xAxisSize, yAxisSize, bounds) {\n var _axis$label;\n var {\n dh\n } = this;\n var isYAxis = axis.type === dh.plot.AxisType.Y;\n var axisSize = isYAxis ? yAxisSize : xAxisSize;\n var layoutAxis = layoutAxisParam;\n // Enterprise API returns null for empty axis labels\n // Passing null title text to Plotly results in incorrect axis position, DH-9164\n var label = (_axis$label = axis.label) !== null && _axis$label !== void 0 ? _axis$label : '';\n if (layoutAxis.title !== undefined && typeof layoutAxis.title !== 'string') {\n layoutAxis.title.text = label;\n } else {\n layoutAxis.title = {\n text: label\n };\n }\n if (axis.log) {\n layoutAxis.type = 'log';\n }\n layoutAxis.side = this.getAxisSide(axis.position);\n if (axisIndex > 0) {\n var _this$getAxisProperty, _axisPositionMap$get2;\n layoutAxis.overlaying = (_this$getAxisProperty = this.getAxisPropertyName(axis.type)) !== null && _this$getAxisProperty !== void 0 ? _this$getAxisProperty : undefined;\n var positionAxes = (_axisPositionMap$get2 = axisPositionMap.get(axis.position)) !== null && _axisPositionMap$get2 !== void 0 ? _axisPositionMap$get2 : [];\n var sideIndex = positionAxes.indexOf(axis);\n if (sideIndex > 0) {\n layoutAxis.anchor = 'free';\n if (axis.position === dh.plot.AxisPosition.RIGHT) {\n layoutAxis.position = bounds.right + (sideIndex - positionAxes.length + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.TOP) {\n layoutAxis.position = bounds.top + (sideIndex - positionAxes.length + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.BOTTOM) {\n layoutAxis.position = bounds.bottom + (positionAxes.length - sideIndex + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.LEFT) {\n layoutAxis.position = bounds.left + (positionAxes.length - sideIndex + 1) * axisSize;\n }\n }\n } else if (axis.type === dh.plot.AxisType.X) {\n var leftAxes = axisPositionMap.get(dh.plot.AxisPosition.LEFT) || [];\n var rightAxes = axisPositionMap.get(dh.plot.AxisPosition.RIGHT) || [];\n var left = Math.max(bounds.left, bounds.left + (leftAxes.length - 1) * yAxisSize);\n var right = Math.min(bounds.right - (rightAxes.length - 1) * yAxisSize, bounds.right);\n layoutAxis.domain = [left, right];\n } else if (axis.type === dh.plot.AxisType.Y) {\n var bottomAxes = axisPositionMap.get(dh.plot.AxisPosition.BOTTOM) || [];\n var topAxes = axisPositionMap.get(dh.plot.AxisPosition.TOP) || [];\n var bottom = Math.max(bounds.bottom, bounds.bottom + (bottomAxes.length - 1) * xAxisSize);\n var top = Math.min(bounds.top - (topAxes.length - 1) * xAxisSize, bounds.top);\n layoutAxis.domain = [bottom, top];\n }\n }\n\n /**\n * Creates range break bounds for plotly from business days.\n * For example a standard business week of ['MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY']\n * will result in [[6,1]] meaning close on Saturday and open on Monday.\n * If you remove Wednesday from the array, then you get two closures [[6, 1], [3, 4]]\n *\n * @param businessDays the days to display on the x-axis\n */\n createBoundsFromDays(businessDays) {\n var businessDaysInt = businessDays.map(day => this.daysOfWeek.indexOf(day));\n var nonBusinessDaysInt = this.daysOfWeek.filter(day => !businessDays.includes(day)).map(day => this.daysOfWeek.indexOf(day));\n // These are the days when business reopens (e.g. Monday after a weekend)\n var reopenDays = new Set();\n nonBusinessDaysInt.forEach(closed => {\n for (var i = closed + 1; i < closed + this.daysOfWeek.length; i += 1) {\n var adjustedDay = i % this.daysOfWeek.length;\n if (businessDaysInt.includes(adjustedDay)) {\n reopenDays.add(adjustedDay);\n break;\n }\n }\n });\n var boundsArray = [];\n // For each reopen day, find the furthest previous closed day\n reopenDays.forEach(open => {\n for (var i = open - 1; i > open - this.daysOfWeek.length; i -= 1) {\n var adjustedDay = i < 0 ? i + this.daysOfWeek.length : i;\n if (businessDaysInt.includes(adjustedDay)) {\n var closedDay = (adjustedDay + 1) % 7;\n boundsArray.push([closedDay, open]);\n break;\n }\n }\n });\n return boundsArray;\n }\n\n /**\n * Creates an array of range breaks for all holidays.\n *\n * @param holidays an array of holidays\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createRangeBreakValuesFromHolidays(holidays, calendarTimeZone, formatterTimeZone) {\n var fullHolidays = [];\n var partialHolidays = [];\n holidays.forEach(holiday => {\n if (holiday.businessPeriods.length > 0) {\n partialHolidays.push(...this.createPartialHoliday(holiday, calendarTimeZone, formatterTimeZone));\n } else {\n fullHolidays.push(this.createFullHoliday(holiday, calendarTimeZone, formatterTimeZone));\n }\n });\n return [{\n values: fullHolidays\n }, ...partialHolidays];\n }\n\n /**\n * Creates the range break value for a full holiday. A full holiday is day that has no business periods.\n *\n * @param holiday the full holiday\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createFullHoliday(holiday, calendarTimeZone, formatterTimeZone) {\n return this.adjustDateForTimeZone(\"\".concat(holiday.date.toString(), \" 00:00:00.000000\"), calendarTimeZone, formatterTimeZone);\n }\n\n /**\n * Creates the range break for a partial holiday. A partial holiday is holiday with business periods\n * that are different than the default business periods.\n *\n * @param holiday the partial holiday\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createPartialHoliday(holiday, calendarTimeZone, formatterTimeZone) {\n // If a holiday has business periods {open1, close1} and {open2, close2}\n // This will generate range breaks for:\n // closed from 00:00 to open1\n // closed from close1 to open2\n // closed from close2 to 23:59:59.999999\n var dateString = holiday.date.toString();\n var closedPeriods = ['00:00'];\n holiday.businessPeriods.forEach(period => {\n closedPeriods.push(period.open);\n closedPeriods.push(period.close);\n });\n // To go up to 23:59:59.999999, we calculate the dvalue using 24 - close\n closedPeriods.push('24:00');\n var rangeBreaks = [];\n for (var i = 0; i < closedPeriods.length; i += 2) {\n var startClose = closedPeriods[i];\n var endClose = closedPeriods[i + 1];\n // Skip over any periods where start and close are the same (zero hours)\n if (startClose !== endClose) {\n var values = [this.adjustDateForTimeZone(\"\".concat(dateString, \" \").concat(startClose, \":00.000000\"), calendarTimeZone, formatterTimeZone)];\n var dvalue = MILLIS_PER_HOUR * (ChartUtils.periodToDecimal(endClose) - ChartUtils.periodToDecimal(startClose));\n rangeBreaks.push({\n values,\n dvalue\n });\n }\n }\n return rangeBreaks;\n }\n\n /**\n * Adjusts a date string from the calendar time zone to the formatter time zone.\n *\n * @param dateString the date string\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n adjustDateForTimeZone(dateString, calendarTimeZone, formatterTimeZone) {\n if (formatterTimeZone && formatterTimeZone.standardOffset !== calendarTimeZone.standardOffset) {\n return this.unwrapValue(this.wrapValue(dateString, BUSINESS_COLUMN_TYPE, calendarTimeZone), formatterTimeZone);\n }\n return dateString;\n }\n\n /**\n * Creates the Figure settings from the Chart Builder settings\n * This should be deprecated at some point, and have Chart Builder create the figure settings directly.\n * This logic will still need to exist to translate existing charts, but could be part of a migration script\n * to translate the data.\n * Change when we decide to add more functionality to the Chart Builder.\n * @param settings The chart builder settings\n * @param settings.title The title for this figure\n * @param settings.xAxis The name of the column to use for the x-axis\n * @param settings.series The name of the columns to use for the series of this figure\n * @param settings.type The plot style for this figure\n */\n makeFigureSettings(settings, table) {\n var {\n dh\n } = this;\n var {\n series,\n xAxis: settingsAxis,\n type\n } = settings;\n var title = ChartUtils.titleFromSettings(settings);\n var xAxis = {\n formatType: \"\".concat(dh.plot.AxisFormatType.NUMBER),\n type: \"\".concat(dh.plot.AxisType.X),\n position: \"\".concat(dh.plot.AxisPosition.BOTTOM)\n };\n var yAxis = {\n formatType: \"\".concat(dh.plot.AxisFormatType.NUMBER),\n type: \"\".concat(dh.plot.AxisType.Y),\n position: \"\".concat(dh.plot.AxisPosition.LEFT)\n };\n return {\n charts: [{\n chartType: \"\".concat(dh.plot.ChartType.XY),\n axes: [xAxis, yAxis],\n series: (series !== null && series !== void 0 ? series : []).map(name => ({\n plotStyle: \"\".concat(type),\n name,\n dataSources: [{\n type: \"\".concat(dh.plot.SourceType.X),\n columnName: settingsAxis !== null && settingsAxis !== void 0 ? settingsAxis : '',\n axis: xAxis,\n table\n }, {\n type: \"\".concat(dh.plot.SourceType.Y),\n columnName: name,\n axis: yAxis,\n table\n }]\n }))\n }],\n title\n };\n }\n\n /**\n * Unwraps a value provided from API to a value plotly can understand\n * Eg. Unwraps DateWrapper, LongWrapper objects.\n */\n unwrapValue(value, timeZone) {\n var {\n dh\n } = this;\n if (value != null) {\n if (isDateWrapper(value)) {\n return dh.i18n.DateTimeFormat.format(ChartUtils.DATE_FORMAT, value, timeZone);\n }\n if (isLongWrapper(value)) {\n return value.asNumber();\n }\n }\n return value;\n }\n\n /**\n *\n * @param value The value to wrap up\n * @param columnType The type of column this value is from\n * @param timeZone The time zone if applicable\n */\n wrapValue(value, columnType) {\n var timeZone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var {\n dh\n } = this;\n if (TableUtils.isDateType(columnType) && typeof value === 'string') {\n // Need to limit the format to the actual length of the string range set in plotly\n // Otherwise parse will fail\n var text = value;\n var format = ChartUtils.DATE_FORMAT.substr(0, value.length);\n var date = dh.i18n.DateTimeFormat.parse(format, text);\n if (!timeZone) {\n return date;\n }\n\n // IDS-5994 Due to date parsing, time zone, and daylight savings shenanigans, we need\n // to pass the actual offset with the time to have it parse correctly.\n // However, the offset can change based on the date because of Daylight Savings\n // So we end up parsing the date multiple times. And curse daylight savings.\n var tzFormat = \"\".concat(format, \" Z\");\n var estimatedOffset = dh.i18n.DateTimeFormat.format('Z', date, timeZone);\n var estimatedDate = dh.i18n.DateTimeFormat.parse(tzFormat, \"\".concat(text, \" \").concat(estimatedOffset));\n var offset = dh.i18n.DateTimeFormat.format('Z', estimatedDate, timeZone);\n return dh.i18n.DateTimeFormat.parse(tzFormat, \"\".concat(text, \" \").concat(offset));\n }\n return value;\n }\n makeLayoutAxis(type) {\n var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ChartTheme;\n var {\n dh\n } = this;\n var axis = {\n automargin: true,\n gridcolor: theme.gridcolor,\n linecolor: theme.linecolor,\n rangeslider: {\n visible: false\n },\n showline: true,\n ticklen: 5,\n // act as padding, can't find a tick padding\n tickcolor: theme.paper_bgcolor,\n // hide ticks as padding\n tickfont: {\n color: theme.zerolinecolor\n },\n title: {\n font: {\n color: theme.title_color\n }\n }\n };\n if (type === dh.plot.AxisType.X) {\n Object.assign(axis, {\n showgrid: true\n });\n } else if (type === dh.plot.AxisType.Y) {\n Object.assign(axis, {\n zerolinecolor: theme.zerolinecolor,\n zerolinewidth: 2\n });\n }\n return axis;\n }\n makeDefaultLayout() {\n var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ChartTheme;\n var {\n dh\n } = this;\n var layout = _objectSpread(_objectSpread({}, theme), {}, {\n autosize: true,\n colorway: ChartUtils.getColorwayFromTheme(theme),\n font: {\n family: \"'Fira Sans', sans-serif\",\n color: theme.title_color\n },\n title: {\n font: {\n color: theme.title_color\n },\n yanchor: 'top',\n pad: _objectSpread({}, ChartUtils.DEFAULT_TITLE_PADDING),\n y: 1\n },\n legend: {\n font: {\n color: theme.title_color\n }\n },\n margin: _objectSpread({}, ChartUtils.DEFAULT_MARGIN),\n xaxis: this.makeLayoutAxis(dh.plot.AxisType.X, theme),\n yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme),\n polar: {\n angularaxis: this.makeLayoutAxis(dh.plot.AxisType.SHAPE, theme),\n radialaxis: this.makeLayoutAxis(dh.plot.AxisType.SHAPE, theme),\n bgcolor: theme.plot_bgcolor\n },\n scene: {\n xaxis: this.makeLayoutAxis(dh.plot.AxisType.X, theme),\n yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme),\n zaxis: this.makeLayoutAxis(dh.plot.AxisType.Z, theme)\n }\n });\n layout.datarevision = 0;\n return layout;\n }\n\n /**\n * Hydrate settings from a JSONable object\n * @param settings Dehydrated settings\n */\n hydrateSettings(settings) {\n var {\n dh\n } = this;\n return _objectSpread(_objectSpread({}, settings), {}, {\n type: settings.type != null ? dh.plot.SeriesPlotStyle[settings.type] : undefined\n });\n }\n}\n_defineProperty(ChartUtils, \"DEFAULT_AXIS_SIZE\", 0.15);\n_defineProperty(ChartUtils, \"MIN_AXIS_SIZE\", 0.025);\n_defineProperty(ChartUtils, \"MAX_AXIS_SIZE\", 0.2);\n_defineProperty(ChartUtils, \"AXIS_SIZE_PX\", 75);\n_defineProperty(ChartUtils, \"LEGEND_WIDTH_PX\", 50);\n_defineProperty(ChartUtils, \"MAX_LEGEND_SIZE\", 0.25);\n_defineProperty(ChartUtils, \"ORIENTATION\", Object.freeze({\n HORIZONTAL: 'h',\n VERTICAL: 'v'\n}));\n_defineProperty(ChartUtils, \"DATE_FORMAT\", 'yyyy-MM-dd HH:mm:ss.SSSSSS');\n_defineProperty(ChartUtils, \"DEFAULT_MARGIN\", Object.freeze({\n l: 60,\n r: 50,\n t: 30,\n b: 60,\n pad: 0\n}));\n_defineProperty(ChartUtils, \"DEFAULT_TITLE_PADDING\", Object.freeze({\n t: 8\n}));\n_defineProperty(ChartUtils, \"SUBTITLE_LINE_HEIGHT\", 25);\n_defineProperty(ChartUtils, \"DEFAULT_MARKER_SIZE\", 6);\n_defineProperty(ChartUtils, \"MODE_MARKERS\", 'markers');\n_defineProperty(ChartUtils, \"MODE_LINES\", 'lines');\nexport default ChartUtils;\n//# sourceMappingURL=ChartUtils.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport React, { Component } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';\nimport { Formatter, FormatterUtils, DateUtils } from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport createPlotlyComponent from 'react-plotly.js/factory.js';\nimport Plotly from \"./plotly/Plotly.js\";\nimport ChartModel from \"./ChartModel.js\";\nimport ChartUtils from \"./ChartUtils.js\";\nimport \"./Chart.css\";\nvar log = Log.module('Chart');\nexport class Chart extends Component {\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon) {\n var [width,,,, path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n var stringPath = \"\".concat(path);\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: \"matrix(1, 0, 0, 1, 0, 0)\"\n };\n }\n static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n return isDownsamplingDisabled ? 'Downsampling disabled, click to enable' : 'Downsampling enabled, click to disable';\n }\n static downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n constructor(props) {\n super(props);\n _defineProperty(this, \"currentSeries\", void 0);\n _defineProperty(this, \"PlotComponent\", void 0);\n _defineProperty(this, \"plot\", void 0);\n _defineProperty(this, \"plotWrapper\", void 0);\n _defineProperty(this, \"columnFormats\", void 0);\n _defineProperty(this, \"dateTimeFormatterOptions\", void 0);\n _defineProperty(this, \"decimalFormatOptions\", void 0);\n _defineProperty(this, \"integerFormatOptions\", void 0);\n _defineProperty(this, \"rect\", void 0);\n _defineProperty(this, \"ranges\", void 0);\n _defineProperty(this, \"isSubscribed\", void 0);\n _defineProperty(this, \"isLoadedFired\", void 0);\n _defineProperty(this, \"getCachedConfig\", memoize((downsamplingError, isDownsampleFinished, isDownsampleInProgress, isDownsamplingDisabled, data) => {\n var customButtons = [];\n var hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: \"Downsampling failed: \".concat(downsamplingError),\n title: 'Downsampling failed',\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning'\n });\n }\n if (isDownsampleFinished || isDownsampleInProgress || isDownsamplingDisabled || hasDownsampleError) {\n var name = Chart.downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled);\n var attr = Chart.downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled);\n var icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n title: 'Downsampling status',\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr\n });\n }\n var has2D = data.some(_ref => {\n var {\n type\n } = _ref;\n return type != null && !type.includes('3d');\n });\n var has3D = data.some(_ref2 => {\n var {\n type\n } = _ref2;\n return type != null && type.includes('3d');\n });\n var buttons2D = ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'];\n var buttons3D = ['orbitRotation', 'tableRotation', 'resetCameraDefault3d'];\n return {\n displaylogo: false,\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n // Each array gets grouped together in the mode bar\n modeBarButtons: [customButtons, ['toImage'], ['zoom2d', 'pan2d'],\n // These work the same for both 2d and 3d\n [...(has2D ? buttons2D : []), ...(has3D ? buttons3D : [])]]\n };\n }));\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n this.PlotComponent = createPlotlyComponent(props.Plotly);\n this.plot = /*#__PURE__*/React.createRef();\n this.plotWrapper = /*#__PURE__*/React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0\n },\n revision: 0\n };\n }\n componentDidMount() {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n this.initData();\n this.initFormatter();\n var {\n isActive\n } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n componentDidUpdate(prevProps) {\n var {\n isActive,\n settings\n } = this.props;\n this.updateFormatterSettings(settings);\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n componentWillUnmount() {\n this.unsubscribe();\n }\n getPlotRect() {\n var _this$plotWrapper$cur, _this$plotWrapper$cur2;\n return (_this$plotWrapper$cur = (_this$plotWrapper$cur2 = this.plotWrapper.current) === null || _this$plotWrapper$cur2 === void 0 ? void 0 : _this$plotWrapper$cur2.getBoundingClientRect()) !== null && _this$plotWrapper$cur !== void 0 ? _this$plotWrapper$cur : null;\n }\n initData() {\n var {\n model\n } = this.props;\n var {\n layout\n } = this.state;\n this.setState({\n data: model.getData(),\n layout: _objectSpread(_objectSpread({}, layout), model.getLayout())\n });\n }\n subscribe() {\n if (this.isSubscribed) {\n return;\n }\n var {\n model\n } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n unsubscribe() {\n if (!this.isSubscribed) {\n return;\n }\n var {\n model\n } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n handleAfterPlot() {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n handleDownsampleClick() {\n this.setState(_ref3 => {\n var {\n isDownsamplingDisabled\n } = _ref3;\n return {\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled\n };\n }, () => {\n var {\n model\n } = this.props;\n var {\n isDownsamplingDisabled\n } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n });\n }\n handleModelEvent(event) {\n var {\n type,\n detail\n } = event;\n log.debug2('Received data update', type, detail);\n switch (type) {\n case ChartModel.EVENT_UPDATED:\n {\n this.currentSeries += 1;\n this.setState(state => {\n var {\n layout,\n revision\n } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1\n };\n });\n var {\n onUpdate\n } = this.props;\n onUpdate({\n isLoading: !this.isLoadedFired\n });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED:\n {\n var {\n onUpdate: _onUpdate\n } = this.props;\n this.isLoadedFired = true;\n _onUpdate({\n isLoading: false\n });\n break;\n }\n case ChartModel.EVENT_DISCONNECT:\n {\n var {\n onDisconnect\n } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT:\n {\n var {\n onReconnect\n } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED:\n {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED:\n {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED:\n {\n var _detail$message;\n var downsamplingError = (_detail$message = detail.message) !== null && _detail$message !== void 0 ? _detail$message : detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError\n });\n var {\n onError\n } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n handlePlotUpdate(figure) {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n var {\n layout\n } = figure;\n var ranges = ChartUtils.getLayoutRanges(layout);\n var isRangesChanged = !deepEqual(ranges, this.ranges);\n if (isRangesChanged) {\n this.ranges = ranges;\n this.updateModelDimensions(true);\n }\n }\n handleRelayout(changes) {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n var {\n onSettingsChanged\n } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n var hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({\n hiddenSeries\n });\n }\n this.updateModelDimensions();\n }\n handleRestyle(_ref4) {\n var [changes, seriesIndexes] = _ref4;\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n var {\n data\n } = this.state;\n var {\n onSettingsChanged\n } = this.props;\n if (data != null) {\n var hiddenSeries = data.reduce((acc, _ref5) => {\n var {\n name,\n visible\n } = _ref5;\n return name != null && visible === 'legendonly' ? [...acc, name] : acc;\n }, []);\n onSettingsChanged({\n hiddenSeries\n });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions() {\n var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n var isRectChanged = !this.rect || this.rect.width !== rect.width || this.rect.height !== rect.height;\n if (isRectChanged || force) {\n this.rect = rect;\n var {\n isActive,\n model\n } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n initFormatter() {\n var {\n settings\n } = this.props;\n this.updateFormatterSettings(settings);\n }\n updateFormatterSettings(settings) {\n var columnFormats = FormatterUtils.getColumnFormats(settings);\n var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);\n var {\n decimalFormatOptions = {},\n integerFormatOptions = {}\n } = settings;\n if (!deepEqual(this.columnFormats, columnFormats) || !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) || !deepEqual(this.decimalFormatOptions, decimalFormatOptions) || !deepEqual(this.integerFormatOptions, integerFormatOptions)) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n updateFormatter() {\n var {\n model\n } = this.props;\n var formatter = new Formatter(model.dh, this.columnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);\n model.setFormatter(formatter);\n }\n updateDimensions() {\n var rect = this.getPlotRect();\n var {\n Plotly: PlotlyProp\n } = this.props;\n if (this.plot.current != null && rect != null && rect.width > 0 && rect.height > 0) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n PlotlyProp.relayout(this.plot.current.el, {\n autosize: true\n }).catch(e => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n render() {\n var {\n PlotComponent\n } = this;\n var {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision\n } = this.state;\n var config = this.getCachedConfig(downsamplingError, isDownsampleFinished, isDownsampleInProgress, isDownsamplingDisabled, data !== null && data !== void 0 ? data : []);\n var isPlotShown = data != null;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"h-100 w-100 chart-wrapper\",\n ref: this.plotWrapper\n }, isPlotShown && /*#__PURE__*/React.createElement(PlotComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n , {\n ref: this.plot,\n data: data,\n layout: layout,\n revision: revision,\n config: config,\n onAfterPlot: this.handleAfterPlot,\n onError: log.error,\n onRelayout: this.handleRelayout,\n onUpdate: this.handlePlotUpdate,\n onRestyle: this.handleRestyle,\n useResizeHandler: true,\n style: {\n height: '100%',\n width: '100%'\n }\n }));\n }\n}\n_defineProperty(Chart, \"defaultProps\", {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: []\n },\n Plotly,\n onDisconnect: () => undefined,\n onReconnect: () => undefined,\n onUpdate: () => undefined,\n onError: () => undefined,\n onSettingsChanged: () => undefined\n});\nexport default Chart;\n//# sourceMappingURL=Chart.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/* eslint class-methods-use-this: \"off\" */\nimport memoize from 'memoizee';\nimport debounce from 'lodash.debounce';\nimport set from 'lodash.set';\nimport Log from '@deephaven/log';\nimport ChartModel from \"./ChartModel.js\";\nimport ChartUtils from \"./ChartUtils.js\";\nimport ChartTheme from \"./ChartTheme.js\";\nvar log = Log.module('FigureChartModel');\n\n/**\n * Takes a Figure object from a widget to make a model for a chart\n */\nclass FigureChartModel extends ChartModel {\n /**\n * @param dh JSAPI instance\n * @param figure The figure object created by the API\n * @param settings Chart settings\n */\n constructor(dh, figure) {\n var _this;\n var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var theme = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ChartTheme;\n super(dh);\n _this = this;\n _defineProperty(this, \"chartUtils\", void 0);\n _defineProperty(this, \"dh\", void 0);\n _defineProperty(this, \"figure\", void 0);\n _defineProperty(this, \"settings\", void 0);\n _defineProperty(this, \"theme\", void 0);\n _defineProperty(this, \"data\", void 0);\n _defineProperty(this, \"layout\", void 0);\n _defineProperty(this, \"seriesDataMap\", void 0);\n _defineProperty(this, \"pendingSeries\", void 0);\n _defineProperty(this, \"oneClicks\", void 0);\n _defineProperty(this, \"filterColumnMap\", void 0);\n _defineProperty(this, \"lastFilter\", void 0);\n _defineProperty(this, \"isConnected\", void 0);\n _defineProperty(this, \"seriesToProcess\", void 0);\n _defineProperty(this, \"addPendingSeries\", debounce(() => {\n var axes = ChartUtils.getAllAxes(this.figure);\n var {\n pendingSeries\n } = this;\n var _loop = function _loop() {\n var _chart$showLegend;\n var series = pendingSeries[i];\n var chart = _this.figure.charts.find(c => c.series.includes(series));\n _this.addSeries(series, axes, (_chart$showLegend = chart === null || chart === void 0 ? void 0 : chart.showLegend) !== null && _chart$showLegend !== void 0 ? _chart$showLegend : null);\n series.subscribe();\n // We'll get an update with the data after subscribing\n };\n for (var i = 0; i < pendingSeries.length; i += 1) {\n _loop();\n }\n this.pendingSeries = [];\n }, FigureChartModel.ADD_SERIES_DEBOUNCE));\n _defineProperty(this, \"getTimeZone\", memoize((columnType, formatter) => {\n if (formatter != null) {\n var dataFormatter = formatter.getColumnTypeFormatter(columnType);\n if (dataFormatter != null) {\n return dataFormatter.dhTimeZone;\n }\n }\n return undefined;\n }));\n _defineProperty(this, \"getValueTranslator\", memoize((columnType, formatter) => {\n var timeZone = this.getTimeZone(columnType, formatter);\n return value => this.chartUtils.unwrapValue(value, timeZone);\n }));\n _defineProperty(this, \"getValueParser\", memoize((columnType, formatter) => {\n var timeZone = this.getTimeZone(columnType, formatter);\n return value => this.chartUtils.wrapValue(value, columnType, timeZone);\n }));\n _defineProperty(this, \"getRangeParser\", memoize((columnType, formatter) => range => {\n var [rangeStart, rangeEnd] = range;\n var valueParser = this.getValueParser(columnType, formatter);\n rangeStart = valueParser(rangeStart);\n rangeEnd = valueParser(rangeEnd);\n return [rangeStart, rangeEnd];\n }));\n _defineProperty(this, \"getAxisRangeParser\", memoize((chart, formatter) => axis => {\n var source = ChartUtils.getSourceForAxis(chart, axis);\n if (source != null) {\n return this.getRangeParser(source.columnType, formatter);\n }\n return range => range;\n }));\n this.handleFigureUpdated = this.handleFigureUpdated.bind(this);\n this.handleFigureDisconnected = this.handleFigureDisconnected.bind(this);\n this.handleFigureReconnected = this.handleFigureReconnected.bind(this);\n this.handleFigureSeriesAdded = this.handleFigureSeriesAdded.bind(this);\n this.handleDownsampleStart = this.handleDownsampleStart.bind(this);\n this.handleDownsampleFinish = this.handleDownsampleFinish.bind(this);\n this.handleDownsampleFail = this.handleDownsampleFail.bind(this);\n this.handleDownsampleNeeded = this.handleDownsampleNeeded.bind(this);\n this.handleRequestFailed = this.handleRequestFailed.bind(this);\n this.dh = dh;\n this.chartUtils = new ChartUtils(dh);\n this.figure = figure;\n this.settings = settings;\n this.theme = theme;\n this.data = [];\n var template = {\n data: {},\n layout: this.chartUtils.makeDefaultLayout(theme)\n };\n this.layout = {\n grid: {\n rows: figure.rows,\n columns: figure.cols,\n pattern: 'independent'\n },\n template\n };\n this.seriesDataMap = new Map();\n this.pendingSeries = [];\n this.oneClicks = [];\n this.filterColumnMap = new Map();\n this.lastFilter = new Map();\n this.isConnected = true; // Assume figure is connected to start\n this.seriesToProcess = new Set();\n this.setTitle(this.getDefaultTitle());\n this.initAllSeries();\n this.updateAxisPositions();\n this.startListeningFigure();\n }\n close() {\n this.figure.close();\n this.addPendingSeries.cancel();\n this.stopListeningFigure();\n }\n getDefaultTitle() {\n if (this.figure.charts.length > 0) {\n var chart = this.figure.charts[0];\n return chart.title;\n }\n return '';\n }\n initAllSeries() {\n this.oneClicks = [];\n this.filterColumnMap.clear();\n var {\n charts\n } = this.figure;\n var axes = ChartUtils.getAllAxes(this.figure);\n var activeSeriesNames = [];\n for (var i = 0; i < charts.length; i += 1) {\n var chart = charts[i];\n for (var j = 0; j < chart.series.length; j += 1) {\n var series = chart.series[j];\n activeSeriesNames.push(series.name);\n this.addSeries(series, axes, chart.showLegend);\n }\n }\n\n // Remove any series that no longer exist\n var allSeriesNames = [...this.seriesDataMap.keys()];\n var inactiveSeriesNames = allSeriesNames.filter(seriesName => activeSeriesNames.indexOf(seriesName) < 0);\n for (var _i = 0; _i < inactiveSeriesNames.length; _i += 1) {\n var seriesName = inactiveSeriesNames[_i];\n this.seriesDataMap.delete(seriesName);\n }\n this.seriesToProcess = new Set([...this.seriesDataMap.keys()]);\n }\n\n /**\n * Add a series to the model\n * @param series Series object to add\n * @param axes All the axis in this figure\n * @param showLegend Whether this series should show the legend or not\n */\n addSeries(series, axes, showLegend) {\n var {\n dh\n } = this;\n var axisTypeMap = ChartUtils.groupArray(axes, 'type');\n var seriesData = this.chartUtils.makeSeriesDataFromSeries(series, axisTypeMap, ChartUtils.getSeriesVisibility(series.name, this.settings), showLegend, this.theme);\n this.seriesDataMap.set(series.name, seriesData);\n this.data = [...this.seriesDataMap.values()];\n if (series.plotStyle === dh.plot.SeriesPlotStyle.STACKED_BAR) {\n this.layout.barmode = 'stack';\n } else if (series.plotStyle === dh.plot.SeriesPlotStyle.PIE) {\n this.layout.hiddenlabels = ChartUtils.getHiddenLabels(this.settings);\n }\n\n // We only want to force hide the legend if there is only one series that is not a PIE\n // Right now this means that if the user only has one series, they cannot explicitly show the legend until deephaven-core#3254 is implemented\n // TODO: deephaven-core#3254, once done, this can be removed.\n this.layout.showlegend = this.data.length > 1 || series.plotStyle === dh.plot.SeriesPlotStyle.PIE ? showLegend !== null && showLegend !== void 0 ? showLegend : undefined : false;\n if (series.oneClick != null) {\n var {\n oneClick\n } = series;\n var {\n columns\n } = oneClick;\n for (var i = 0; i < columns.length; i += 1) {\n this.filterColumnMap.set(columns[i].name, columns[i]);\n }\n this.oneClicks.push(oneClick);\n }\n this.updateLayoutFormats();\n }\n\n // We need to debounce adding series so we subscribe to them all in the same tick\n // This should no longer be necessary after IDS-5049 lands\n\n subscribe(callback) {\n super.subscribe(callback);\n if (this.listeners.length === 1) {\n // Need to initialize the series here as we may have missed some series when not subscribed\n this.initAllSeries();\n this.subscribeFigure();\n }\n }\n unsubscribe(callback) {\n super.unsubscribe(callback);\n if (this.listeners.length === 0) {\n this.unsubscribeFigure();\n }\n }\n subscribeFigure() {\n if (!this.isConnected) {\n log.debug('Ignoring subscribe when figure in disconnected state');\n return;\n }\n this.figure.subscribe(this.isDownsamplingDisabled ? this.dh.plot.DownsampleOptions.DISABLE : this.dh.plot.DownsampleOptions.DEFAULT);\n }\n unsubscribeFigure() {\n this.figure.unsubscribe();\n }\n startListeningFigure() {\n var {\n dh\n } = this;\n this.figure.addEventListener(dh.plot.Figure.EVENT_UPDATED, this.handleFigureUpdated);\n this.figure.addEventListener(dh.plot.Figure.EVENT_SERIES_ADDED, this.handleFigureSeriesAdded);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DISCONNECT, this.handleFigureDisconnected);\n this.figure.addEventListener(dh.plot.Figure.EVENT_RECONNECT, this.handleFigureReconnected);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLESTARTED, this.handleDownsampleStart);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFINISHED, this.handleDownsampleFinish);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFAILED, this.handleDownsampleFail);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLENEEDED, this.handleDownsampleNeeded);\n this.figure.addEventListener(dh.Client.EVENT_REQUEST_FAILED, this.handleRequestFailed);\n }\n stopListeningFigure() {\n var {\n dh\n } = this;\n this.figure.removeEventListener(dh.plot.Figure.EVENT_UPDATED, this.handleFigureUpdated);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_SERIES_ADDED, this.handleFigureSeriesAdded);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DISCONNECT, this.handleFigureDisconnected);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_RECONNECT, this.handleFigureReconnected);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLESTARTED, this.handleDownsampleStart);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFINISHED, this.handleDownsampleFinish);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFAILED, this.handleDownsampleFail);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLENEEDED, this.handleDownsampleNeeded);\n this.figure.removeEventListener(dh.Client.EVENT_REQUEST_FAILED, this.handleRequestFailed);\n }\n handleDownsampleStart(event) {\n log.debug('Downsample started', event);\n this.fireDownsampleStart(event.detail);\n }\n handleDownsampleFinish(event) {\n log.debug('Downsample finished', event);\n this.fireDownsampleFinish(event.detail);\n }\n handleDownsampleFail(event) {\n log.error('Downsample failed', event);\n this.fireDownsampleFail(event.detail);\n }\n handleDownsampleNeeded(event) {\n log.info('Downsample needed', event);\n this.fireDownsampleNeeded(event.detail);\n }\n handleFigureUpdated(event) {\n var {\n detail: figureUpdateEvent\n } = event;\n var {\n series: seriesArray\n } = figureUpdateEvent;\n log.debug2('handleFigureUpdated', seriesArray);\n for (var i = 0; i < seriesArray.length; i += 1) {\n var series = seriesArray[i];\n log.debug2('handleFigureUpdated updating series', series.name);\n var {\n sources\n } = series;\n for (var j = 0; j < sources.length; j += 1) {\n var source = sources[j];\n var {\n columnType,\n type\n } = source;\n var valueTranslator = this.getValueTranslator(columnType, this.formatter);\n var dataArray = figureUpdateEvent.getArray(series, type, valueTranslator);\n this.setDataArrayForSeries(series, type, dataArray);\n }\n this.seriesToProcess.delete(series.name);\n if (this.seriesToProcess.size === 0) {\n this.fireLoadFinished();\n }\n this.cleanSeries(series);\n }\n var {\n data\n } = this;\n this.fireUpdate(data);\n }\n handleRequestFailed(event) {\n log.error('Request failed', event);\n }\n\n /**\n * Resubscribe to the figure, should be done if settings change\n */\n resubscribe() {\n if (this.listeners.length > 0) {\n this.unsubscribeFigure();\n this.subscribeFigure();\n }\n }\n setFormatter(formatter) {\n super.setFormatter(formatter);\n this.updateLayoutFormats();\n\n // Unsubscribe and resubscribe to trigger a data update\n // Data may need to be translated again because of the new formatter\n this.resubscribe();\n }\n setDownsamplingDisabled(isDownsamplingDisabled) {\n super.setDownsamplingDisabled(isDownsamplingDisabled);\n this.resubscribe();\n }\n handleFigureDisconnected(event) {\n log.debug('Figure disconnected', event);\n this.isConnected = false;\n if (this.listeners.length > 0) {\n this.unsubscribeFigure();\n }\n this.fireDisconnect();\n }\n handleFigureReconnected(event) {\n log.debug('Figure reconnected', event);\n this.isConnected = true;\n\n // It's possible the series have changed completely, as the query could have been changed\n this.initAllSeries();\n this.fireReconnect();\n if (this.listeners.length > 0) {\n this.subscribeFigure();\n }\n }\n handleFigureSeriesAdded(event) {\n var {\n detail: series\n } = event;\n log.debug('handleFigureSeriesAdded', series);\n this.pendingSeries.push(series);\n this.addPendingSeries();\n }\n setDimensions(rect) {\n super.setDimensions(rect);\n this.updateAxisPositions();\n }\n setTitle(title) {\n var _match$length, _match;\n super.setTitle(title);\n\n // Need to recalculate the padding based on how many lines of text the title is\n // Plotly doesn't handle positioning it correctly, and it's an undocumented feature\n var subtitleCount = (_match$length = (_match = (title !== null && title !== void 0 ? title : '').match(/<br>/g)) === null || _match === void 0 ? void 0 : _match.length) !== null && _match$length !== void 0 ? _match$length : 0;\n var margin = ChartUtils.DEFAULT_MARGIN.t + subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT;\n if (this.layout.margin) {\n this.layout.margin.t = margin;\n } else {\n this.layout.margin = {\n t: margin\n };\n }\n if (typeof this.layout.title === 'string') {\n this.layout.title = title;\n } else {\n this.layout.title = _objectSpread({}, this.layout.title);\n this.layout.title.text = title;\n this.layout.title.pad = _objectSpread({}, this.layout.title.pad);\n this.layout.title.pad.t = ChartUtils.DEFAULT_TITLE_PADDING.t + subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT * 0.5;\n }\n }\n getPlotWidth() {\n var _this$layout$margin$l, _this$layout$margin, _this$layout$margin$r, _this$layout$margin2;\n if (!this.rect || !this.rect.width) {\n return 0;\n }\n return Math.max(this.rect.width - ((_this$layout$margin$l = (_this$layout$margin = this.layout.margin) === null || _this$layout$margin === void 0 ? void 0 : _this$layout$margin.l) !== null && _this$layout$margin$l !== void 0 ? _this$layout$margin$l : 0) - ((_this$layout$margin$r = (_this$layout$margin2 = this.layout.margin) === null || _this$layout$margin2 === void 0 ? void 0 : _this$layout$margin2.r) !== null && _this$layout$margin$r !== void 0 ? _this$layout$margin$r : 0), 0);\n }\n getPlotHeight() {\n var _this$layout$margin$t, _this$layout$margin3, _this$layout$margin$b, _this$layout$margin4;\n if (!this.rect || !this.rect.height) {\n return 0;\n }\n return Math.max(this.rect.height - ((_this$layout$margin$t = (_this$layout$margin3 = this.layout.margin) === null || _this$layout$margin3 === void 0 ? void 0 : _this$layout$margin3.t) !== null && _this$layout$margin$t !== void 0 ? _this$layout$margin$t : 0) - ((_this$layout$margin$b = (_this$layout$margin4 = this.layout.margin) === null || _this$layout$margin4 === void 0 ? void 0 : _this$layout$margin4.b) !== null && _this$layout$margin$b !== void 0 ? _this$layout$margin$b : 0), 0);\n }\n updateAxisPositions() {\n var plotWidth = this.getPlotWidth();\n var plotHeight = this.getPlotHeight();\n this.chartUtils.updateFigureAxes(this.layout, this.figure, chart => this.getAxisRangeParser(chart, this.formatter), plotWidth, plotHeight, this.theme);\n }\n\n /**\n * Updates the format patterns used\n */\n updateLayoutFormats() {\n if (!this.formatter) {\n return;\n }\n var axisFormats = this.chartUtils.getAxisFormats(this.figure, this.formatter);\n axisFormats.forEach((axisFormat, axisLayoutProperty) => {\n log.debug(\"Assigning \".concat(axisLayoutProperty), this.layout[axisLayoutProperty], axisFormat);\n var props = this.layout[axisLayoutProperty];\n if (props != null) {\n Object.assign(props, axisFormat);\n } else {\n log.debug(\"Ignoring null layout.\".concat(axisLayoutProperty));\n }\n });\n }\n\n /**\n * Set a specific array for the array of series properties specified.\n * @param series The series to set the data array for.\n * @param sourceType The source type within that series to set the data for.\n * @param dataArray The array to use for the data for this series source.\n */\n setDataArrayForSeries(series, sourceType, dataArray) {\n var {\n name,\n plotStyle\n } = series;\n var seriesData = this.seriesDataMap.get(name);\n var property = this.chartUtils.getPlotlyProperty(plotStyle, sourceType);\n if (seriesData) {\n set(seriesData, property, dataArray);\n }\n }\n\n /**\n * After setting all the data in the series data, we may need to adjust some other properties\n * Eg. Calculating the width from the xLow/xHigh values; Plot.ly uses `width` instead of a low/high\n * value for x.\n * @param series The series to clean the data for\n */\n cleanSeries(series) {\n var {\n dh\n } = this;\n var {\n name,\n plotStyle\n } = series;\n var seriesData = this.seriesDataMap.get(name);\n if (seriesData == null) {\n return;\n }\n if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {\n var {\n xLow,\n xHigh\n } = seriesData;\n if (xLow && xHigh && xLow.length === xHigh.length) {\n var width = [];\n for (var i = 0; i < xLow.length; i += 1) {\n width.push(xHigh[i] - xLow[i]);\n }\n seriesData.width = width;\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.LINE) {\n var {\n x,\n xLow: _xLow,\n xHigh: _xHigh,\n y,\n yLow,\n yHigh\n } = seriesData;\n if (_xLow && _xHigh && _xLow !== x) {\n seriesData.error_x = ChartUtils.getPlotlyErrorBars(x, _xLow, _xHigh);\n }\n if (yLow && yHigh && yLow !== y) {\n seriesData.error_y = ChartUtils.getPlotlyErrorBars(y, yLow, yHigh);\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {\n var {\n ids,\n labels\n } = seriesData;\n if (ids !== undefined && labels === undefined) {\n // If the user only provided IDs, we assign the IDs to the labels property as well automatically\n // Plotly uses the labels primarily, which from our API perspective seems kind of backwards\n seriesData.labels = ids;\n }\n }\n }\n getData() {\n return this.data;\n }\n getLayout() {\n return this.layout;\n }\n getFilterColumnMap() {\n return new Map(this.filterColumnMap);\n }\n isFilterRequired() {\n return this.oneClicks.find(oneClick => oneClick.requireAllFiltersToDisplay) != null;\n }\n\n /**\n * Sets the filter on the model. Will only set the values that have changed.\n * @param filterMap Map of filter column names to values\n */\n setFilter(filterMap) {\n var _this2 = this;\n if (this.oneClicks.length === 0) {\n log.warn('Trying to set a filter, but no one click!');\n return;\n }\n log.debug('setFilter', filterMap);\n var _loop2 = function _loop2() {\n var oneClick = _this2.oneClicks[i];\n var {\n columns\n } = oneClick;\n // Need to get all the keys in case a filter was removed\n var keys = new Set([...filterMap.keys(), ..._this2.lastFilter.keys()]);\n keys.forEach(key => {\n var value = filterMap.get(key);\n if (_this2.lastFilter.get(key) !== value && columns.find(column => column.name === key) != null) {\n oneClick.setValueForColumn(key, value);\n }\n });\n };\n for (var i = 0; i < this.oneClicks.length; i += 1) {\n _loop2();\n }\n this.lastFilter = new Map(filterMap);\n }\n setFigure(figure) {\n this.close();\n this.figure = figure;\n this.setTitle(this.getDefaultTitle());\n this.initAllSeries();\n this.updateAxisPositions();\n this.startListeningFigure();\n if (this.listeners.length > 0) {\n this.subscribeFigure();\n }\n }\n updateSettings(settings) {\n this.settings = settings;\n }\n}\n_defineProperty(FigureChartModel, \"ADD_SERIES_DEBOUNCE\", 50);\nexport default FigureChartModel;\n//# sourceMappingURL=FigureChartModel.js.map","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nimport ChartUtils from \"./ChartUtils.js\";\nimport FigureChartModel from \"./FigureChartModel.js\";\nimport ChartTheme from \"./ChartTheme.js\";\nclass ChartModelFactory {\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The ChartModel Promise representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static makeModelFromSettings(dh, settings, table) {\n var _arguments = arguments;\n return _asyncToGenerator(function* () {\n var theme = _arguments.length > 3 && _arguments[3] !== undefined ? _arguments[3] : ChartTheme;\n var figure = yield ChartModelFactory.makeFigureFromSettings(dh, settings, table);\n return new FigureChartModel(dh, figure, settings, theme);\n })();\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @returns The Figure created with the settings provided\n */\n static makeFigureFromSettings(dh, settings, table) {\n return _asyncToGenerator(function* () {\n // Copy the table first and then re-apply the filters from the original table\n // When we add table linking we'll want to listen to the original table and update\n // the copied table with any changes that occur.\n // The table gets owned by the Figure that gets created, which closes the table\n var tableCopy = yield table.copy();\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n return dh.plot.Figure.create(new ChartUtils(dh).makeFigureSettings(settings, tableCopy));\n })();\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param figure The figure to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The FigureChartModel representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static makeModel(dh, settings, figure) {\n var _arguments2 = arguments;\n return _asyncToGenerator(function* () {\n var theme = _arguments2.length > 3 && _arguments2[3] !== undefined ? _arguments2[3] : ChartTheme;\n return new FigureChartModel(dh, figure, settings, theme);\n })();\n }\n}\nexport default ChartModelFactory;\n//# sourceMappingURL=ChartModelFactory.js.map","import React, { useEffect, useMemo, useState } from 'react';\nimport { Chart, ChartModel, ChartModelFactory } from '@deephaven/chart'; // chart is used to display Deephaven charts\nimport { ContextMenuRoot, LoadingOverlay } from '@deephaven/components'; // Use the loading spinner from the Deephaven components package\nimport type { dh as DhType, IdeConnection } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport './App.scss'; // Styles for in this app\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { useConnection } from '@deephaven/app-utils';\n\nconst log = Log.module('EmbedChart.App');\n\n/**\n * Load an existing Deephaven figure with the connection provided\n * @param dh JSAPI instance\n * @param connection The Deephaven session object\n * @param name Name of the figure to load\n * @returns Deephaven figure\n */\nasync function loadFigure(dh: DhType, connection: IdeConnection, name: string) {\n log.info(`Fetching figure ${name}...`);\n\n const definition = { name, type: dh.VariableType.FIGURE };\n return connection.getObject(definition);\n}\n\n/**\n * A functional React component that displays a Deephaven figure using the @deephaven/chart package.\n * It will attempt to open and display the figure specified with the `name` parameter, expecting it to be present on the server.\n * E.g. http://localhost:3000/?name=myFigure will attempt to open a figure `myFigure`\n * If no query param is provided, it will display an error.\n * By default, tries to connect to the server defined in the VITE_CORE_API_URL variable, which is set to http://localhost:10000/jsapi\n * See create-react-app docs for how to update these env vars: https://create-react-app.dev/docs/adding-custom-environment-variables/\n */\nfunction App(): JSX.Element {\n const [model, setModel] = useState<ChartModel>();\n const [error, setError] = useState<string>();\n const [isLoading, setIsLoading] = useState(true);\n const searchParams = useMemo(\n () => new URLSearchParams(window.location.search),\n []\n );\n const connection = useConnection();\n const dh = useApi();\n\n useEffect(\n function initializeApp() {\n async function initApp() {\n try {\n // Get the table name from the query param `name`.\n const name = searchParams.get('name');\n\n if (name == null) {\n throw new Error('No name param provided');\n }\n\n log.debug('Loading figure', name, '...');\n\n // Load the figure up.\n const figure = await loadFigure(dh, connection, name);\n\n // Create the `ChartModel` for use with the `Chart` component\n log.debug(`Creating model...`);\n\n const newModel = await ChartModelFactory.makeModel(\n dh,\n undefined,\n figure\n );\n\n setModel(newModel);\n\n log.debug('Figure successfully loaded!');\n } catch (e: unknown) {\n log.error('Unable to load figure', e);\n setError(`${e}`);\n }\n setIsLoading(false);\n }\n initApp();\n },\n [dh, connection, searchParams]\n );\n\n const isLoaded = model != null;\n\n return (\n <div className=\"App\">\n {isLoaded && <Chart model={model} />}\n {!isLoaded && (\n <LoadingOverlay\n isLoaded={isLoaded}\n isLoading={isLoading}\n errorMessage={error ?? null}\n />\n )}\n <ContextMenuRoot />\n </div>\n );\n}\n\nexport default App;\n"],"names":["Plotly","bar","histogram","pie","ohlc","scattergl","treemap","_defineProperty","obj","key","value","_toPropertyKey","arg","_toPrimitive","input","hint","prim","res","ChartModel","dh","filter","formatter","isDownsamplingDisabled","rect","title","callback","listener","event","i","data","detail","ChartModel$1","ChartTheme","ownKeys","object","enumerableOnly","keys","symbols","sym","_objectSpread","target","source","log","Log","BUSINESS_COLUMN_TYPE","MILLIS_PER_HOUR","NANOS_PER_MILLI","isDateWrapper","isLongWrapper","isDateTimeColumnFormatter","isRangedPlotlyAxis","ChartUtils","x","xLow","xHigh","array","arrayminus","prefix","columnType","formatPattern","subpatterns","matchArray","assertNotNull","placeholderDigits","zeroDigits","decimalDigits","optionalDecimalDigits","numberType","percentSign","suffix","paddingLength","isCommaSeparated","comma","plotlyNumberType","type","decimalLength","trimOption","tickformat","tickprefix","ticksuffix","axisFormat","axis","isDateType","gapBetweenMajorTicks","updatedFormat","tickSpacing","chart","series","j","name","settings","mode","showLegend","orientation","deephavenShape","figure","axes","charts","_chart","layout","ranges","axisProperty","axisIndex","axisIndexString","period","values","property","result","item","_result$get","group","theme","colorway","xAxis","_this","axisFormats","nullFormat","allAxes","axisTypeMap","_chart2","sources","axisSources","_loop","k","axisType","typeAxes","axisLayoutProperty","businessCalendar","rangebreaks","businessPeriods","businessDays","holidays","calendarTimeZone","typeFormatter","formatterTimeZone","timeZoneDiff","weekendBounds","_ret","plotStyle","isBusinessTime","areLinesVisible","areShapesVisible","modes","sourceType","_sources$","_sources$$axis","seriesVisibility","isLinesVisible","isShapesVisible","lineColor","shapeColor","shape","shapeSize","_source$axis","seriesData","seriesDataParam","_axis","dataAttributeName","set","e","axisPosition","layoutParam","chartAxisRangeParser","plotWidth","plotHeight","figureAxes","_chart3","axisRangeParser","bounds","_axisPositionMap$get","cols","rows","column","colspan","row","rowspan","endColumn","endRow","columnSize","rowSize","xMarginSize","yMarginSize","axisPositionMap","rightAxes","dataFormatter","TableUtils","chartAxes","xAxisSize","yAxisSize","axisTypes","figureAxisTypeMap","figureTypeAxes","isYAxis","plotSize","chartAxisIndex","_axis2","figureAxisIndex","layoutAxis","_range","autorange","rangeParser","rangeStart","rangeEnd","figureAxisTypes","layoutAxisParam","_axis$label","axisSize","label","_this$getAxisProperty","_axisPositionMap$get2","positionAxes","sideIndex","leftAxes","left","right","bottomAxes","topAxes","bottom","top","businessDaysInt","day","nonBusinessDaysInt","reopenDays","closed","adjustedDay","boundsArray","open","closedDay","fullHolidays","partialHolidays","holiday","dateString","closedPeriods","rangeBreaks","startClose","endClose","dvalue","table","settingsAxis","yAxis","timeZone","text","format","date","tzFormat","estimatedOffset","estimatedDate","offset","ChartUtils$1","Chart","Component","faIcon","width","path","stringPath","isDownsampleInProgress","props","memoize","downsamplingError","isDownsampleFinished","customButtons","hasDownsampleError","dhWarningFilled","attr","icon","vsLoading","dhGraphLineDown","has2D","_ref","has3D","_ref2","buttons2D","buttons3D","createPlotlyComponent","React","isActive","prevProps","_this$plotWrapper$cur","_this$plotWrapper$cur2","model","_ref3","state","revision","onUpdate","_onUpdate","onDisconnect","onReconnect","_detail$message","onError","isRangesChanged","deepEqual","changes","onSettingsChanged","hiddenSeries","_ref4","seriesIndexes","acc","_ref5","visible","force","isRectChanged","columnFormats","FormatterUtils","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","Formatter","PlotlyProp","PlotComponent","config","isPlotShown","DateUtils","Chart$1","FigureChartModel","debounce","pendingSeries","_chart$showLegend","c","range","valueParser","template","activeSeriesNames","allSeriesNames","inactiveSeriesNames","seriesName","_i","oneClick","columns","figureUpdateEvent","seriesArray","valueTranslator","dataArray","_match$length","_match","subtitleCount","margin","_this$layout$margin$l","_this$layout$margin","_this$layout$margin$r","_this$layout$margin2","_this$layout$margin$t","_this$layout$margin3","_this$layout$margin$b","_this$layout$margin4","_xLow","_xHigh","y","yLow","yHigh","ids","labels","filterMap","_this2","_loop2","FigureChartModel$1","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","_asyncToGenerator","fn","self","args","err","ChartModelFactory","_arguments","tableCopy","_arguments2","ChartModelFactory$1","loadFigure","connection","definition","App","setModel","useState","setError","isLoading","setIsLoading","searchParams","useMemo","useConnection","useApi","useEffect","initApp","newModel","isLoaded","jsxs","jsx","LoadingOverlay","ContextMenuRoot"],"mappings":"gZAqBAA,GAAO,SAAS,CAACC,GAAKC,GAAWC,GAAKC,GAAMC,GAAWC,EAAO,CAAC,ECrB/D,SAASC,EAAgBC,EAAKC,EAAKC,EAAO,CAAE,OAAAD,EAAME,GAAeF,CAAG,EAAOA,KAAOD,EAAO,OAAO,eAAeA,EAAKC,EAAK,CAAE,MAAOC,EAAO,WAAY,GAAM,aAAc,GAAM,SAAU,EAAM,CAAA,EAAYF,EAAIC,CAAG,EAAIC,EAAgBF,CAAM,CAC5O,SAASG,GAAeC,EAAK,CAAE,IAAIH,EAAMI,GAAaD,EAAK,QAAQ,EAAG,OAAO,OAAOH,GAAQ,SAAWA,EAAM,OAAOA,CAAG,CAAI,CAC3H,SAASI,GAAaC,EAAOC,EAAM,CAAE,GAAI,OAAOD,GAAU,UAAYA,IAAU,KAAM,OAAOA,EAAO,IAAIE,EAAOF,EAAM,OAAO,WAAW,EAAG,GAAIE,IAAS,OAAW,CAAE,IAAIC,EAAMD,EAAK,KAAKF,EAAOC,GAAQ,SAAS,EAAG,GAAI,OAAOE,GAAQ,SAAU,OAAOA,EAAK,MAAM,IAAI,UAAU,8CAA8C,EAAK,OAAQF,IAAS,SAAW,OAAS,QAAQD,CAAK,CAAI,CASzX,MAAMI,CAAW,CACf,YAAYC,EAAI,CACdZ,EAAgB,KAAM,KAAM,M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AAImW,EAAY7R,CAAI,EAGpD/C,EAAI,MAAM,mBAAmB,EAEvB,MAAA0V,EAAW,MAAMpB,GAAkB,UACvC7V,EACA,OACA4E,CAAA,EAGF0R,EAASW,CAAQ,EAEjB1V,EAAI,MAAM,6BAA6B,QAChCqH,GACHrH,EAAA,MAAM,wBAAyBqH,CAAC,EACpC4N,EAAS,GAAG5N,GAAG,CACjB,CACA8N,EAAa,EAAK,CACpB,CACQM,GACV,EACA,CAAChX,EAAImW,EAAYQ,CAAY,CAAA,EAG/B,MAAMO,EAAW9G,GAAS,KAGxB,OAAA+G,GAAA,KAAC,MAAI,CAAA,UAAU,MACZ,SAAA,CAAYD,GAAAE,GAAA,IAAC9I,IAAM,MAAA8B,CAAc,CAAA,EACjC,CAAC8G,GACAE,GAAA,IAACC,GAAA,CACC,SAAAH,EACA,UAAAT,EACA,aAAclB,GAAS,IAAA,CACzB,SAED+B,GAAgB,EAAA,CACnB,CAAA,CAAA,CAEJ"}
1
+ {"version":3,"file":"App-701d18dd.js","sources":["../../../chart/dist/plotly/Plotly.js","../../../chart/dist/ChartModel.js","../../../chart/dist/ChartTheme.js","../../../chart/dist/ChartUtils.js","../../../chart/dist/Chart.js","../../../chart/dist/FigureChartModel.js","../../../chart/dist/ChartModelFactory.js","../../src/App.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/ban-ts-comment */\n/* eslint-disable global-require */\n// Create a partial plot with only the kinds of charts we need\n// https://github.com/plotly/plotly.js/#modules\n\n// Plotly types don't export anything other than core, so ignore the import type errors\nimport Plotly from 'plotly.js/lib/core.js';\n// @ts-ignore\nimport bar from 'plotly.js/lib/bar.js';\n// @ts-ignore\nimport histogram from 'plotly.js/lib/histogram.js';\n// @ts-ignore\nimport pie from 'plotly.js/lib/pie.js';\n// @ts-ignore\nimport ohlc from 'plotly.js/lib/ohlc.js';\n// @ts-ignore\nimport scattergl from 'plotly.js/lib/scattergl.js';\n// @ts-ignore\nimport treemap from 'plotly.js/lib/treemap.js';\n\n// Load in the trace types we need/support\nPlotly.register([bar, histogram, pie, ohlc, scattergl, treemap]);\nexport default Plotly;\n//# sourceMappingURL=Plotly.js.map","function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/* eslint class-methods-use-this: \"off\" */\n/* eslint no-unused-vars: \"off\" */\n\n/**\n * Model for a Chart\n * All of these methods should return very quickly.\n * If data needs to be loaded asynchronously, return something immediately, then trigger an event for the chart to refresh.\n */\nclass ChartModel {\n constructor(dh) {\n _defineProperty(this, \"dh\", void 0);\n _defineProperty(this, \"listeners\", void 0);\n _defineProperty(this, \"formatter\", void 0);\n _defineProperty(this, \"rect\", void 0);\n _defineProperty(this, \"isDownsamplingDisabled\", void 0);\n _defineProperty(this, \"title\", void 0);\n this.dh = dh;\n this.listeners = [];\n this.isDownsamplingDisabled = false;\n }\n getData() {\n return [];\n }\n getDefaultTitle() {\n return '';\n }\n getLayout() {\n return {};\n }\n getFilterColumnMap() {\n return new Map();\n }\n isFilterRequired() {\n return false;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n setFilter(filter) {}\n\n /**\n * Close this model, clean up any underlying subscriptions\n */\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n close() {}\n\n /**\n * Set the formatter to use when charting the data.\n * @param formatter The formatter to use to format the charting data\n */\n setFormatter(formatter) {\n this.formatter = formatter;\n }\n\n /**\n * Disable downsampling\n * @param isDownsamplingDisabled True if downsampling should be disabled\n */\n setDownsamplingDisabled(isDownsamplingDisabled) {\n this.isDownsamplingDisabled = isDownsamplingDisabled;\n }\n\n /**\n * Set the dimensions of the plot. May be needed to evaluate some of the percents\n * @param rect The bounding rectangle of the plot\n */\n setDimensions(rect) {\n this.rect = rect;\n }\n setTitle(title) {\n this.title = title;\n }\n\n /**\n * Subscribe to this ChartModel and start listening for all events.\n * @param callback Callback when an event occurs\n */\n subscribe(callback) {\n this.listeners.push(callback);\n }\n unsubscribe(callback) {\n this.listeners = this.listeners.filter(listener => listener !== callback);\n }\n fireEvent(event) {\n for (var i = 0; i < this.listeners.length; i += 1) {\n this.listeners[i](event);\n }\n }\n fireUpdate(data) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_UPDATED, {\n detail: data\n }));\n }\n fireDisconnect() {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DISCONNECT));\n }\n fireReconnect() {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_RECONNECT));\n }\n fireDownsampleStart(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLESTARTED, {\n detail\n }));\n }\n fireDownsampleFinish(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLEFINISHED, {\n detail\n }));\n }\n fireDownsampleFail(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLEFAILED, {\n detail\n }));\n }\n fireDownsampleNeeded(detail) {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_DOWNSAMPLENEEDED, {\n detail\n }));\n }\n fireLoadFinished() {\n this.fireEvent(new CustomEvent(ChartModel.EVENT_LOADFINISHED));\n }\n}\n_defineProperty(ChartModel, \"EVENT_UPDATED\", 'ChartModel.EVENT_UPDATED');\n_defineProperty(ChartModel, \"EVENT_DISCONNECT\", 'ChartModel.EVENT_DISCONNECT');\n_defineProperty(ChartModel, \"EVENT_RECONNECT\", 'ChartModel.EVENT_RECONNECT');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLESTARTED\", 'ChartModel.EVENT_DOWNSAMPLESTARTED');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLEFINISHED\", 'ChartModel.EVENT_DOWNSAMPLEFINISHED');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLEFAILED\", 'ChartModel.EVENT_DOWNSAMPLEFAILED');\n_defineProperty(ChartModel, \"EVENT_DOWNSAMPLENEEDED\", 'ChartModel.EVENT_DOWNSAMPLENEEDED');\n_defineProperty(ChartModel, \"EVENT_LOADFINISHED\", 'ChartModel.EVENT_LOADFINISHED');\nexport default ChartModel;\n//# sourceMappingURL=ChartModel.js.map","import ChartTheme from \"./ChartTheme.module.css\";\nexport default Object.freeze({\n paper_bgcolor: ChartTheme['paper-bgcolor'],\n plot_bgcolor: ChartTheme['plot-bgcolor'],\n title_color: ChartTheme['title-color'],\n colorway: ChartTheme.colorway,\n gridcolor: ChartTheme.gridcolor,\n linecolor: ChartTheme.linecolor,\n zerolinecolor: ChartTheme.zerolinecolor,\n activecolor: ChartTheme.activecolor,\n rangebgcolor: ChartTheme.rangebgcolor,\n area_color: ChartTheme['area-color'],\n trend_color: ChartTheme['trend-color'],\n line_color: ChartTheme['line-color'],\n error_band_line_color: ChartTheme['error-band-line-color'],\n error_band_fill_color: ChartTheme['error-band-fill-color'],\n ohlc_increasing: ChartTheme['ohlc-increasing'],\n ohlc_decreasing: ChartTheme['ohlc-decreasing']\n});\n//# sourceMappingURL=ChartTheme.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport Log from '@deephaven/log';\nimport { TableUtils } from '@deephaven/jsapi-utils';\nimport set from 'lodash.set';\nimport { assertNotNull } from '@deephaven/utils';\nimport ChartTheme from \"./ChartTheme.js\";\nvar log = Log.module('ChartUtils');\nvar BUSINESS_COLUMN_TYPE = 'io.deephaven.time.DateTime';\nvar MILLIS_PER_HOUR = 3600000;\nvar NANOS_PER_MILLI = 1000000;\nfunction isDateWrapper(value) {\n return value.asDate !== undefined;\n}\nfunction isLongWrapper(value) {\n return value.asNumber !== undefined;\n}\nfunction isDateTimeColumnFormatter(value) {\n return value.dhTimeZone !== undefined;\n}\nfunction isRangedPlotlyAxis(value) {\n return value != null && value.range != null && (value.autorange === false || value.autorange === undefined);\n}\nclass ChartUtils {\n /**\n * Generate the plotly error bar data from the passed in data.\n * Iris passes in the values as absolute, plotly needs them as relative.\n * @param x The main data array\n * @param xLow The absolute low values\n * @param xHigh\n *\n * @returns The error_x object required by plotly, or null if none is required\n */\n static getPlotlyErrorBars(x, xLow, xHigh) {\n var array = xHigh.map((value, i) => value - x[i]);\n var arrayminus = xLow.map((value, i) => x[i] - value);\n return {\n type: 'data',\n symmetric: false,\n array,\n arrayminus\n };\n }\n static convertNumberPrefix(prefix) {\n return prefix.replace(/\\u00A4\\u00A4/g, 'USD').replace(/\\u00A4/g, '$');\n }\n static getPlotlyNumberFormat(formatter, columnType, formatPattern) {\n if (!formatPattern) {\n return null;\n }\n\n // We translate java formatting: https://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html\n // Into d3 number formatting: https://github.com/d3/d3-format\n // We can't translate number formatting exactly, but should be able to translate the most common cases\n // First split it into the subpatterns; currently only handling the positive subpattern, ignoring the rest\n var subpatterns = formatPattern.split(';');\n var matchArray = subpatterns[0].match(/^([^#,0.]*)([#,]*)([0,]*)(\\.?)(0*)(#*)(E?0*)(%?)(.*)/);\n assertNotNull(matchArray);\n var [, prefix, placeholderDigits, zeroDigits,, decimalDigits, optionalDecimalDigits, numberType, percentSign, suffix] = matchArray;\n var paddingLength = zeroDigits.replace(',', '').length;\n var isCommaSeparated = placeholderDigits.indexOf(',') >= 0 || zeroDigits.indexOf(',') >= 0;\n var comma = isCommaSeparated ? ',' : '';\n var plotlyNumberType = numberType != null && numberType !== '' ? 'e' : 'f';\n var type = percentSign !== '' ? percentSign : plotlyNumberType;\n var decimalLength = decimalDigits.length + optionalDecimalDigits.length;\n // IDS-4565 Plotly uses an older version of d3 which doesn't support the trim option or negative brackets\n // If plotly updates it's d3 version, this should be re-enabled\n // const trimOption = optionalDecimalDigits.length > 0 ? '~' : '';\n var trimOption = '';\n var tickformat = \"0\".concat(paddingLength).concat(comma, \".\").concat(decimalLength).concat(trimOption).concat(type);\n var tickprefix = ChartUtils.convertNumberPrefix(prefix);\n // prefix and suffix are processed the same\n var ticksuffix = ChartUtils.convertNumberPrefix(suffix);\n return {\n tickformat,\n tickprefix,\n ticksuffix,\n automargin: true\n };\n }\n\n /**\n * Adds tick spacing for an axis that has gapBetweenMajorTicks defined.\n *\n * @param axisFormat the current axis format, may be null\n * @param axis the current axis\n * @param isDateType indicates if the columns is a date type\n */\n static addTickSpacing(axisFormat, axis, isDateType) {\n var {\n gapBetweenMajorTicks\n } = axis;\n if (gapBetweenMajorTicks > 0) {\n var updatedFormat = axisFormat || {};\n var tickSpacing = gapBetweenMajorTicks;\n if (isDateType) {\n // Need to convert from nanoseconds to milliseconds\n tickSpacing = gapBetweenMajorTicks / NANOS_PER_MILLI;\n }\n if (axis.log) {\n tickSpacing = Math.log(tickSpacing);\n }\n // Note that tickmode defaults to 'auto'\n updatedFormat.tickmode = 'linear';\n updatedFormat.dtick = tickSpacing;\n return updatedFormat;\n }\n return axisFormat;\n }\n\n /**\n * Retrieve the data source for a given axis in a chart\n * @param chart The chart to get the source for\n * @param axis The axis to find the source for\n * @returns The first source matching this axis\n */\n static getSourceForAxis(chart, axis) {\n for (var i = 0; i < chart.series.length; i += 1) {\n var series = chart.series[i];\n for (var j = 0; j < series.sources.length; j += 1) {\n var source = series.sources[j];\n if (source.axis === axis) {\n return source;\n }\n }\n }\n return null;\n }\n\n /**\n * Get visibility setting for the series object\n * @param name The series name to get the visibility for\n * @param settings Chart settings\n * @returns True for visible series and 'legendonly' for hidden\n */\n static getSeriesVisibility(name, settings) {\n if (settings != null && settings.hiddenSeries != null && settings.hiddenSeries.includes(name)) {\n return 'legendonly';\n }\n return true;\n }\n\n /**\n * Get hidden labels array from chart settings\n * @param settings Chart settings\n * @returns Array of hidden series names\n */\n static getHiddenLabels(settings) {\n if (settings !== null && settings !== void 0 && settings.hiddenSeries) {\n return [...settings.hiddenSeries];\n }\n return [];\n }\n\n /**\n * Create a default series data object. Apply styling to the object afterward.\n * @returns A simple series data object with no styling\n */\n static makeSeriesData(type, mode, name, showLegend) {\n var orientation = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ChartUtils.ORIENTATION.VERTICAL;\n return {\n type,\n mode,\n name,\n orientation,\n showlegend: showLegend !== null && showLegend !== void 0 ? showLegend : undefined\n };\n }\n\n /**\n * Get the Plotly marker symbol for the provided Deephaven shape\n * Deephaven shapes: https://deephaven.io/enterprise/docs/plotting/visual-formatting/#point-formatting\n * Plotly shapes: https://plotly.com/javascript/reference/scattergl/#scattergl-marker-symbol\n * Table of plotly shapes: https://plotly.com/python/marker-style/#custom-marker-symbols\n * @param deephavenShape Deephaven shape to get the marker symbol for\n */\n static getMarkerSymbol(deephavenShape) {\n switch (deephavenShape) {\n case 'SQUARE':\n return 'square';\n case 'CIRCLE':\n return 'circle';\n case 'DIAMOND':\n return 'diamond';\n case 'UP_TRIANGLE':\n return 'triangle-up';\n case 'DOWN_TRIANGLE':\n return 'triangle-down';\n case 'RIGHT_TRIANGLE':\n return 'triangle-right';\n case 'LEFT_TRIANGLE':\n return 'triangle-left';\n // There don't seem to be any plotly equivalents for ellipse or rectangles\n // Rectangles could be `line-ew`, `line-ns`, or `hourglass` and `bowtie` instead?\n // Ellipse could be `asterisk` or `diamond-wide` instead?\n // Just throw an error, we've already got a bunch of types.\n case 'ELLIPSE':\n case 'HORIZONTAL_RECTANGLE':\n case 'VERTICAL_RECTANGLE':\n default:\n throw new Error(\"Unrecognized shape \".concat(deephavenShape));\n }\n }\n\n /**\n * Get all axes for a given `Figure`. Iterates through all charts axes and concatenates them.\n * @param figure Figure to get all axes for\n */\n static getAllAxes(figure) {\n return figure.charts.reduce((axes, chart) => [...axes, ...chart.axes], []);\n }\n\n /**\n * Retrieve the chart that contains the passed in series from the figure\n * @param figure The figure to retrieve the chart from\n * @param series The series to get the chart for\n */\n static getChartForSeries(figure, series) {\n var {\n charts\n } = figure;\n for (var i = 0; i < charts.length; i += 1) {\n var _chart = charts[i];\n for (var j = 0; j < _chart.series.length; j += 1) {\n if (series === _chart.series[j]) {\n return _chart;\n }\n }\n }\n return null;\n }\n\n /**\n * Get an object mapping axis to their ranges\n * @param layout The plotly layout object to get the ranges from\n * @returns An object mapping the axis name to it's range\n */\n static getLayoutRanges(layout) {\n var ranges = {};\n var keys = Object.keys(layout).filter(key => key.indexOf('axis') >= 0);\n for (var i = 0; i < keys.length; i += 1) {\n var key = keys[i];\n var value = layout[key];\n if (isRangedPlotlyAxis(value)) {\n // Only want to add the range if it's not autoranged\n ranges[key] = [...value.range];\n }\n }\n return ranges;\n }\n static getAxisLayoutProperty(axisProperty, axisIndex) {\n var axisIndexString = axisIndex > 0 ? \"\".concat(axisIndex + 1) : '';\n return \"\".concat(axisProperty !== null && axisProperty !== void 0 ? axisProperty : '', \"axis\").concat(axisIndexString);\n }\n\n /**\n * Converts an open or close period to a declimal. e.g '09:30\" to 9.5\n *\n * @param period the open or close value of the period\n */\n static periodToDecimal(period) {\n var values = period.split(':');\n return Number(values[0]) + Number(values[1]) / 60;\n }\n\n /**\n * Groups an array and returns a map\n * @param array The object to group\n * @param property The property name to group by\n * @returns A map containing the items grouped by their values for the property\n */\n static groupArray(array, property) {\n return array.reduce((result, item) => {\n var _result$get;\n var key = item[property];\n var group = (_result$get = result.get(key)) !== null && _result$get !== void 0 ? _result$get : [];\n group.push(item);\n result.set(key, group);\n return result;\n }, new Map());\n }\n\n /**\n * Parses the colorway property of a theme and returns an array of colors\n * Theme could have a single string with space separated colors or an array of strings representing the colorway\n * @param theme The theme to get colorway from\n * @returns Colorway array for the theme\n */\n static getColorwayFromTheme() {\n var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ChartTheme;\n var colorway = [];\n if (theme.colorway) {\n if (Array.isArray(theme.colorway)) {\n colorway = theme.colorway;\n } else if (typeof theme.colorway === 'string') {\n colorway = theme.colorway.split(' ');\n } else {\n log.warn(\"Unable to handle colorway property: \".concat(theme.colorway));\n }\n }\n return colorway;\n }\n static titleFromSettings(settings) {\n var {\n series,\n xAxis,\n title = \"\".concat((series !== null && series !== void 0 ? series : []).join(', '), \" by \").concat(xAxis)\n } = settings;\n return title;\n }\n constructor(dh) {\n _defineProperty(this, \"dh\", void 0);\n _defineProperty(this, \"daysOfWeek\", void 0);\n this.dh = dh;\n this.daysOfWeek = Object.freeze(dh.calendar.DayOfWeek.values());\n }\n\n /**\n * Retrieve the axis formats from the provided figure.\n * Currently defaults to just the x/y axes.\n * @param figure The figure to get the axis formats for\n * @param formatter The formatter to use when getting the axis format\n * @returns A map of axis layout property names to axis formats\n */\n getAxisFormats(figure, formatter) {\n var _this = this;\n var axisFormats = new Map();\n var nullFormat = {\n tickformat: null,\n ticksuffix: null\n };\n var allAxes = ChartUtils.getAllAxes(figure);\n var axisTypeMap = ChartUtils.groupArray(allAxes, 'type');\n var {\n charts\n } = figure;\n for (var i = 0; i < charts.length; i += 1) {\n var _chart2 = charts[i];\n for (var j = 0; j < _chart2.series.length; j += 1) {\n var series = _chart2.series[j];\n var {\n sources\n } = series;\n var axisSources = sources.filter(source => source.axis);\n var _loop = function _loop() {\n var source = axisSources[k];\n var {\n axis\n } = source;\n var {\n type: axisType\n } = axis;\n var typeAxes = axisTypeMap.get(axisType);\n assertNotNull(typeAxes);\n var axisIndex = typeAxes.indexOf(axis);\n var axisProperty = _this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);\n if (axisFormats.has(axisLayoutProperty)) {\n log.debug(\"\".concat(axisLayoutProperty, \" already added.\"));\n } else {\n log.debug(\"Adding \".concat(axisLayoutProperty, \" to axisFormats.\"));\n var axisFormat = _this.getPlotlyAxisFormat(source, formatter);\n if (axisFormat === null) {\n axisFormats.set(axisLayoutProperty, nullFormat);\n } else {\n axisFormats.set(axisLayoutProperty, axisFormat);\n var {\n businessCalendar\n } = axis;\n if (businessCalendar != null) {\n var rangebreaks = [];\n var {\n businessPeriods,\n businessDays,\n holidays,\n timeZone: calendarTimeZone\n } = businessCalendar;\n var typeFormatter = formatter === null || formatter === void 0 ? void 0 : formatter.getColumnTypeFormatter(BUSINESS_COLUMN_TYPE);\n var formatterTimeZone;\n if (isDateTimeColumnFormatter(typeFormatter)) {\n formatterTimeZone = typeFormatter.dhTimeZone;\n }\n var timeZoneDiff = formatterTimeZone ? (calendarTimeZone.standardOffset - formatterTimeZone.standardOffset) / 60 : 0;\n if (holidays.length > 0) {\n rangebreaks.push(..._this.createRangeBreakValuesFromHolidays(holidays, calendarTimeZone, formatterTimeZone));\n }\n businessPeriods.forEach(period => rangebreaks.push({\n pattern: 'hour',\n bounds: [ChartUtils.periodToDecimal(period.close) + timeZoneDiff, ChartUtils.periodToDecimal(period.open) + timeZoneDiff]\n }));\n // If there are seven business days, then there is no weekend\n if (businessDays.length < _this.daysOfWeek.length) {\n _this.createBoundsFromDays(businessDays).forEach(weekendBounds => rangebreaks.push({\n pattern: 'day of week',\n bounds: weekendBounds\n }));\n }\n axisFormat.rangebreaks = rangebreaks;\n }\n if (axisFormats.size === _chart2.axes.length) {\n return {\n v: axisFormats\n };\n }\n }\n }\n }\n };\n for (var k = 0; k < axisSources.length; k += 1) {\n var _ret = _loop();\n if (typeof _ret === \"object\") return _ret.v;\n }\n }\n }\n return axisFormats;\n }\n\n /**\n * Converts the Iris plot style into a plotly chart type\n * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle\n * @param isBusinessTime If the plot is using business time for an axis\n */\n getPlotlyChartType(plotStyle, isBusinessTime) {\n var {\n dh\n } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.SCATTER:\n // scattergl mode is more performant, but doesn't support the rangebreaks we need for businessTime calendars\n return !isBusinessTime ? 'scattergl' : 'scatter';\n case dh.plot.SeriesPlotStyle.LINE:\n // There is also still some artifacting bugs with scattergl: https://github.com/plotly/plotly.js/issues/3522\n // The artifacting only occurs on line plots, which we can draw with fairly decent performance using SVG paths\n // Once the above plotly issue is fixed, scattergl should be used here (when !isBusinessTime)\n return 'scatter';\n case dh.plot.SeriesPlotStyle.BAR:\n case dh.plot.SeriesPlotStyle.STACKED_BAR:\n return 'bar';\n case dh.plot.SeriesPlotStyle.PIE:\n return 'pie';\n case dh.plot.SeriesPlotStyle.TREEMAP:\n return 'treemap';\n case dh.plot.SeriesPlotStyle.HISTOGRAM:\n return 'histogram';\n case dh.plot.SeriesPlotStyle.OHLC:\n return 'ohlc';\n default:\n return undefined;\n }\n }\n\n /**\n * Converts the Iris plot style into a plotly chart mode\n * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle.*\n * @param areLinesVisible Whether lines are visible or not\n * @param areShapesVisible Whether shapes are visible or not\n */\n getPlotlyChartMode(plotStyle, areLinesVisible, areShapesVisible) {\n var {\n dh\n } = this;\n var modes = new Set();\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.SCATTER:\n // Default to only showing shapes in scatter plots\n if (areLinesVisible !== null && areLinesVisible !== void 0 ? areLinesVisible : false) {\n modes.add(ChartUtils.MODE_LINES);\n }\n if (areShapesVisible !== null && areShapesVisible !== void 0 ? areShapesVisible : true) {\n modes.add(ChartUtils.MODE_MARKERS);\n }\n break;\n case dh.plot.SeriesPlotStyle.LINE:\n // Default to only showing lines in line series\n if (areLinesVisible !== null && areLinesVisible !== void 0 ? areLinesVisible : true) {\n modes.add(ChartUtils.MODE_LINES);\n }\n if (areShapesVisible !== null && areShapesVisible !== void 0 ? areShapesVisible : false) {\n modes.add(ChartUtils.MODE_MARKERS);\n }\n break;\n default:\n break;\n }\n return modes.size > 0 ? [...modes].join('+') : undefined;\n }\n\n /**\n * Get the property to set on the series data for plotly\n * @param plotStyle The plot style of the series\n * @param sourceType The source type for the series\n */\n getPlotlyProperty(plotStyle, sourceType) {\n var {\n dh\n } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.PIE:\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'labels';\n case dh.plot.SourceType.Y:\n return 'values';\n default:\n break;\n }\n break;\n case dh.plot.SeriesPlotStyle.OHLC:\n switch (sourceType) {\n case dh.plot.SourceType.TIME:\n return 'x';\n default:\n break;\n }\n break;\n case dh.plot.SeriesPlotStyle.TREEMAP:\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'ids';\n case dh.plot.SourceType.Y:\n return 'values';\n case dh.plot.SourceType.LABEL:\n return 'labels';\n case dh.plot.SourceType.PARENT:\n return 'parents';\n case dh.plot.SourceType.COLOR:\n return 'marker.colors';\n default:\n break;\n }\n break;\n default:\n break;\n }\n switch (sourceType) {\n case dh.plot.SourceType.X:\n return 'x';\n case dh.plot.SourceType.Y:\n return 'y';\n case dh.plot.SourceType.Z:\n return 'z';\n case dh.plot.SourceType.X_LOW:\n return 'xLow';\n case dh.plot.SourceType.X_HIGH:\n return 'xHigh';\n case dh.plot.SourceType.Y_LOW:\n return 'yLow';\n case dh.plot.SourceType.Y_HIGH:\n return 'yHigh';\n case dh.plot.SourceType.TIME:\n return 'time';\n case dh.plot.SourceType.OPEN:\n return 'open';\n case dh.plot.SourceType.HIGH:\n return 'high';\n case dh.plot.SourceType.LOW:\n return 'low';\n case dh.plot.SourceType.CLOSE:\n return 'close';\n case dh.plot.SourceType.SHAPE:\n return 'shape';\n case dh.plot.SourceType.SIZE:\n return 'size';\n case dh.plot.SourceType.LABEL:\n return 'label';\n case dh.plot.SourceType.COLOR:\n return 'color';\n case dh.plot.SourceType.PARENT:\n return 'parent';\n case dh.plot.SourceType.HOVER_TEXT:\n return 'hovertext';\n case dh.plot.SourceType.TEXT:\n return 'text';\n default:\n throw new Error(\"Unrecognized source type: \".concat(sourceType));\n }\n }\n getPlotlySeriesOrientation(series) {\n var _sources$, _sources$$axis;\n var {\n dh\n } = this;\n var {\n sources\n } = series;\n if (sources.length === 2 && ((_sources$ = sources[0]) === null || _sources$ === void 0 ? void 0 : (_sources$$axis = _sources$.axis) === null || _sources$$axis === void 0 ? void 0 : _sources$$axis.type) === dh.plot.AxisType.Y) {\n return ChartUtils.ORIENTATION.HORIZONTAL;\n }\n return ChartUtils.ORIENTATION.VERTICAL;\n }\n\n /**\n * Create a data series (trace) for use with plotly\n * @param series The series to create the series data with\n * @param axisTypeMap The map of axes grouped by type\n * @param seriesVisibility Visibility setting for the series\n * @param theme The theme properties for the plot. See ChartTheme.js for an example\n * @returns The series data (trace) object for use with plotly.\n */\n makeSeriesDataFromSeries(series, axisTypeMap, seriesVisibility) {\n var showLegend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var theme = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : ChartTheme;\n var {\n name,\n isLinesVisible,\n isShapesVisible,\n plotStyle,\n lineColor,\n shapeColor,\n sources,\n shape,\n shapeSize\n } = series;\n var isBusinessTime = sources.some(source => {\n var _source$axis;\n return (_source$axis = source.axis) === null || _source$axis === void 0 ? void 0 : _source$axis.businessCalendar;\n });\n var type = this.getChartType(plotStyle, isBusinessTime);\n var mode = this.getPlotlyChartMode(plotStyle, isLinesVisible !== null && isLinesVisible !== void 0 ? isLinesVisible : undefined, isShapesVisible !== null && isShapesVisible !== void 0 ? isShapesVisible : undefined);\n var orientation = this.getPlotlySeriesOrientation(series);\n var seriesData = ChartUtils.makeSeriesData(type, mode, name, showLegend, orientation);\n this.addSourcesToSeriesData(seriesData, plotStyle, sources, axisTypeMap);\n this.addStylingToSeriesData(seriesData, plotStyle, theme, lineColor, shapeColor, shape, shapeSize, seriesVisibility);\n return seriesData;\n }\n addSourcesToSeriesData(seriesDataParam, plotStyle, sources, axisTypeMap) {\n var seriesData = seriesDataParam;\n for (var k = 0; k < sources.length; k += 1) {\n var source = sources[k];\n var {\n axis: _axis,\n type: sourceType\n } = source;\n var dataAttributeName = this.getPlotlyProperty(plotStyle, sourceType);\n set(seriesData, dataAttributeName, []);\n var axisProperty = _axis != null ? this.getAxisPropertyName(_axis.type) : null;\n if (axisProperty != null) {\n var axes = axisTypeMap.get(_axis.type);\n if (axes) {\n var axisIndex = axes.indexOf(_axis);\n var axisIndexString = axisIndex > 0 ? \"\".concat(axisIndex + 1) : '';\n seriesData[\"\".concat(axisProperty, \"axis\")] = \"\".concat(axisProperty).concat(axisIndexString);\n }\n }\n }\n }\n addStylingToSeriesData(seriesDataParam, plotStyle) {\n var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ChartTheme;\n var lineColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;\n var shapeColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;\n var shape = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;\n var shapeSize = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;\n var seriesVisibility = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;\n var {\n dh\n } = this;\n var seriesData = seriesDataParam;\n // Add some empty objects so we can fill them in later with details without checking for existence\n seriesData.marker = {\n line: {}\n }; // border line width on markers\n seriesData.line = {\n width: 1 // default line width for lines, should eventually be able to override\n };\n\n if (plotStyle === dh.plot.SeriesPlotStyle.AREA) {\n seriesData.fill = 'tozeroy';\n } else if (plotStyle === dh.plot.SeriesPlotStyle.STACKED_AREA) {\n seriesData.stackgroup = 'stack';\n } else if (plotStyle === dh.plot.SeriesPlotStyle.STEP) {\n seriesData.line.shape = 'hv'; // plot.ly horizontal then vertical step styling\n } else if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {\n // The default histfunc in plotly is 'count', but the data passed up from the API provides explicit x/y values and bins\n // Since it's converted to bar, just set the widths of each bar\n seriesData.width = [];\n if (seriesData.marker.line !== undefined) {\n Object.assign(seriesData.marker.line, {\n color: theme.paper_bgcolor,\n width: 1\n });\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.OHLC) {\n seriesData.increasing = {\n line: {\n color: theme.ohlc_increasing\n }\n };\n seriesData.decreasing = {\n line: {\n color: theme.ohlc_decreasing\n }\n };\n } else if (plotStyle === dh.plot.SeriesPlotStyle.PIE) {\n seriesData.textinfo = 'label+percent';\n\n // TODO Open DefinitelyTyped/Plotly PR to mark family and size as optional\n // https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/lib/traces/pie.d.ts#L6\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n seriesData.outsidetextfont = {\n color: theme.title_color\n };\n } else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {\n seriesData.hoverinfo = 'text';\n seriesData.textinfo = 'label+text';\n seriesData.tiling = {\n packing: 'squarify',\n pad: 0\n };\n seriesData.textposition = 'middle center';\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n seriesData.outsidetextfont = {\n color: theme.title_color\n };\n }\n if (lineColor != null) {\n if (plotStyle === dh.plot.SeriesPlotStyle.BAR) {\n seriesData.marker.color = lineColor;\n } else {\n seriesData.line.color = lineColor;\n }\n }\n if (shapeColor != null) {\n seriesData.marker.color = shapeColor;\n }\n if (shape != null && shape.length > 0) {\n try {\n seriesData.marker.symbol = ChartUtils.getMarkerSymbol(shape);\n } catch (e) {\n log.warn('Unable to handle shape', shape, ':', e);\n }\n }\n if (shapeSize != null) {\n seriesData.marker.size = shapeSize * ChartUtils.DEFAULT_MARKER_SIZE;\n }\n\n // Skipping pie charts\n // Pie slice visibility is configured in chart layout instead of series data\n if (seriesVisibility != null && plotStyle !== dh.plot.SeriesPlotStyle.PIE) {\n seriesData.visible = seriesVisibility;\n }\n }\n getChartType(plotStyle, isBusinessTime) {\n var {\n dh\n } = this;\n switch (plotStyle) {\n case dh.plot.SeriesPlotStyle.HISTOGRAM:\n // When reading data from the `Figure`, it already provides bins and values, so rather than using\n // plot.ly to calculate the bins and sum values, just convert it to a bar chart\n return 'bar';\n default:\n return this.getPlotlyChartType(plotStyle, isBusinessTime);\n }\n }\n\n /**\n * Return the plotly axis property name\n * @param axisType The axis type to get the property name for\n */\n getAxisPropertyName(axisType) {\n var {\n dh\n } = this;\n switch (axisType) {\n case dh.plot.AxisType.X:\n return 'x';\n case dh.plot.AxisType.Y:\n return 'y';\n default:\n return null;\n }\n }\n\n /**\n * Returns the plotly \"side\" value for the provided axis position\n * @param axisPosition The Iris AxisPosition of the axis\n */\n getAxisSide(axisPosition) {\n var {\n dh\n } = this;\n switch (axisPosition) {\n case dh.plot.AxisPosition.BOTTOM:\n return 'bottom';\n case dh.plot.AxisPosition.TOP:\n return 'top';\n case dh.plot.AxisPosition.LEFT:\n return 'left';\n case dh.plot.AxisPosition.RIGHT:\n return 'right';\n default:\n return undefined;\n }\n }\n\n /**\n * Update the layout with all the axes information for the provided figure\n * @param figure Figure to update the axes for\n * @param layoutParam Layout object to update in place\n * @param chartAxisRangeParser Function to retrieve the axis range parser\n * @param plotWidth Width of the plot in pixels\n * @param plotHeight Height of the plot in pixels\n * @param theme Theme used for displaying the plot\n */\n updateFigureAxes(layoutParam, figure, chartAxisRangeParser) {\n var plotWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var plotHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var theme = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : ChartTheme;\n var layout = layoutParam;\n var figureAxes = ChartUtils.getAllAxes(figure);\n for (var i = 0; i < figure.charts.length; i += 1) {\n var _chart3 = figure.charts[i];\n var axisRangeParser = chartAxisRangeParser === null || chartAxisRangeParser === void 0 ? void 0 : chartAxisRangeParser(_chart3);\n var bounds = this.getChartBounds(figure, _chart3, plotWidth, plotHeight);\n this.updateLayoutAxes(layout, _chart3.axes, figureAxes, plotWidth, plotHeight, bounds, axisRangeParser, theme);\n }\n this.removeStaleAxes(layout, figureAxes);\n }\n getChartBounds(figure, chart, plotWidth, plotHeight) {\n var _axisPositionMap$get;\n var {\n dh\n } = this;\n var {\n cols,\n rows\n } = figure;\n var {\n column,\n colspan,\n row,\n rowspan\n } = chart;\n var endColumn = column + colspan;\n var endRow = row + rowspan;\n var columnSize = 1 / cols;\n var rowSize = 1 / rows;\n var xMarginSize = ChartUtils.AXIS_SIZE_PX / plotWidth;\n var yMarginSize = ChartUtils.AXIS_SIZE_PX / plotHeight;\n var bounds = {\n // Need to invert the row positioning so the first one defined shows up on top instead of the bottom, since coordinates start in bottom left\n bottom: (rows - endRow) * rowSize + (endRow < rows ? yMarginSize / 2 : 0),\n top: (rows - row) * rowSize - (row > 0 ? yMarginSize / 2 : 0),\n left: column * columnSize + (column > 0 ? xMarginSize / 2 : 0),\n right: endColumn * columnSize - (endColumn < cols ? xMarginSize / 2 : 0)\n };\n\n // Adjust the bounds based on where the legend is\n // For now, always assume the legend is shown on the right\n var axisPositionMap = ChartUtils.groupArray(chart.axes, 'position');\n var rightAxes = (_axisPositionMap$get = axisPositionMap.get(dh.plot.AxisPosition.RIGHT)) !== null && _axisPositionMap$get !== void 0 ? _axisPositionMap$get : [];\n if (rightAxes.length > 0) {\n if (plotWidth > 0) {\n bounds.right -= (bounds.right - bounds.left) * Math.max(0, Math.min(ChartUtils.LEGEND_WIDTH_PX / plotWidth, ChartUtils.MAX_LEGEND_SIZE));\n } else {\n bounds.right -= (bounds.right - bounds.left) * ChartUtils.DEFAULT_AXIS_SIZE;\n }\n }\n return bounds;\n }\n getPlotlyDateFormat(formatter, columnType, formatPattern) {\n var {\n dh\n } = this;\n var tickformat = formatPattern == null ? undefined : formatPattern.replace('%', '%%').replace(/S{9}/g, '%9f').replace(/S{8}/g, '%8f').replace(/S{7}/g, '%7f').replace(/S{6}/g, '%6f').replace(/S{5}/g, '%5f').replace(/S{4}/g, '%4f').replace(/S{3}/g, '%3f').replace(/S{2}/g, '%2f').replace(/S{1}/g, '%1f').replace(/y{4}/g, '%Y').replace(/y{2}/g, '%y').replace(/M{4}/g, '%B').replace(/M{3}/g, '%b').replace(/M{2}/g, '%m').replace(/M{1}/g, '%-m').replace(/E{4,}/g, '%A').replace(/E{1,}/g, '%a').replace(/d{2}/g, '%d').replace(/([^%]|^)d{1}/g, '$1%-d').replace(/H{2}/g, '%H').replace(/h{2}/g, '%I').replace(/h{1}/g, '%-I').replace(/m{2}/g, '%M').replace(/s{2}/g, '%S').replace(\"'T'\", 'T').replace(' z', ''); // timezone added as suffix if necessary\n\n var ticksuffix;\n var dataFormatter = formatter === null || formatter === void 0 ? void 0 : formatter.getColumnTypeFormatter(columnType);\n if (dataFormatter != null && isDateTimeColumnFormatter(dataFormatter) && dataFormatter.dhTimeZone != null && dataFormatter.showTimeZone) {\n ticksuffix = dh.i18n.DateTimeFormat.format(' z', new Date(), dataFormatter.dhTimeZone);\n }\n return {\n tickformat,\n ticksuffix,\n automargin: true\n };\n }\n\n /**\n * Gets the plotly axis formatting information from the source passed in\n * @param source The Source to get the formatter information from\n * @param formatter The current formatter for formatting data\n */\n getPlotlyAxisFormat(source) {\n var formatter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var {\n dh\n } = this;\n var {\n axis,\n columnType\n } = source;\n var {\n formatPattern\n } = axis;\n var axisFormat = null;\n if (TableUtils.isDateType(columnType)) {\n axisFormat = this.getPlotlyDateFormat(formatter, columnType, formatPattern);\n axisFormat = ChartUtils.addTickSpacing(axisFormat, axis, true);\n } else if (TableUtils.isNumberType(columnType)) {\n axisFormat = ChartUtils.getPlotlyNumberFormat(formatter, columnType, formatPattern);\n axisFormat = ChartUtils.addTickSpacing(axisFormat, axis, false);\n }\n if (axis.formatType === dh.plot.AxisFormatType.CATEGORY) {\n if (axisFormat) {\n axisFormat.type = 'category';\n } else {\n axisFormat = {\n type: 'category',\n tickformat: undefined,\n ticksuffix: undefined\n };\n }\n }\n return axisFormat;\n }\n\n /**\n * Updates the axes positions and sizes in the layout object provided.\n * If the axis did not exist in the layout previously, it is created and added.\n * Any axis that no longer exists in axes is removed.\n * With Downsampling enabled, will also update the range on the axis itself as appropriate\n * @param layoutParam The layout object to update\n * @param chartAxes The chart axes to update the layout with\n * @param figureAxes All figure axes to update the layout with\n * @param plotWidth The width of the plot to calculate the axis sizes for\n * @param plotHeight The height of the plot to calculate the axis sizes for\n * @param bounds The bounds for this set of axes\n * @param axisRangeParser A function to retrieve the range parser for a given axis\n */\n updateLayoutAxes(layoutParam, chartAxes, figureAxes) {\n var plotWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;\n var plotHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;\n var bounds = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {\n left: 0,\n top: 0,\n right: 1,\n bottom: 1\n };\n var axisRangeParser = arguments.length > 6 ? arguments[6] : undefined;\n var theme = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : ChartTheme;\n var {\n dh\n } = this;\n var xAxisSize = plotWidth > 0 ? Math.max(ChartUtils.MIN_AXIS_SIZE, Math.min(ChartUtils.AXIS_SIZE_PX / plotHeight, ChartUtils.MAX_AXIS_SIZE)) : ChartUtils.DEFAULT_AXIS_SIZE;\n var yAxisSize = plotHeight > 0 ? Math.max(ChartUtils.MIN_AXIS_SIZE, Math.min(ChartUtils.AXIS_SIZE_PX / plotWidth, ChartUtils.MAX_AXIS_SIZE)) : ChartUtils.DEFAULT_AXIS_SIZE;\n var layout = layoutParam;\n var axisPositionMap = ChartUtils.groupArray(chartAxes, 'position');\n var axisTypeMap = ChartUtils.groupArray(chartAxes, 'type');\n var axisTypes = [...axisTypeMap.keys()];\n var figureAxisTypeMap = ChartUtils.groupArray(figureAxes, 'type');\n for (var j = 0; j < axisTypes.length; j += 1) {\n var axisType = axisTypes[j];\n var axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n var typeAxes = axisTypeMap.get(axisType);\n var figureTypeAxes = figureAxisTypeMap.get(axisType);\n var isYAxis = axisType === dh.plot.AxisType.Y;\n var plotSize = isYAxis ? plotHeight : plotWidth;\n assertNotNull(typeAxes);\n assertNotNull(figureTypeAxes);\n for (var chartAxisIndex = 0; chartAxisIndex < typeAxes.length; chartAxisIndex += 1) {\n var _axis2 = typeAxes[chartAxisIndex];\n var figureAxisIndex = figureTypeAxes.indexOf(_axis2);\n var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, figureAxisIndex);\n if (layout[axisLayoutProperty] == null) {\n layout[axisLayoutProperty] = this.makeLayoutAxis(axisType, theme);\n }\n var layoutAxis = layout[axisLayoutProperty];\n if (layoutAxis != null) {\n this.updateLayoutAxis(layoutAxis, _axis2, chartAxisIndex, axisPositionMap, xAxisSize, yAxisSize, bounds);\n var {\n range: _range,\n autorange\n } = layoutAxis;\n if (axisRangeParser != null && _range !== undefined && (autorange === undefined || autorange === false)) {\n var rangeParser = axisRangeParser(_axis2);\n var [rangeStart, rangeEnd] = rangeParser(_range);\n log.debug('Setting downsample range', plotSize, rangeStart, rangeEnd);\n _axis2.range(plotSize, rangeStart, rangeEnd);\n } else {\n _axis2.range(plotSize);\n }\n }\n }\n }\n }\n }\n\n /**\n * Remove any axes from the layout param that no longer belong to any series\n * @param layoutParam Layout object to remove stale axes from\n * @param axes All axes in the figure\n */\n removeStaleAxes(layoutParam, axes) {\n var layout = layoutParam;\n var figureAxisTypeMap = ChartUtils.groupArray(axes, 'type');\n var figureAxisTypes = [...figureAxisTypeMap.keys()];\n for (var i = 0; i < figureAxisTypes.length; i += 1) {\n var axisType = figureAxisTypes[i];\n var typeAxes = figureAxisTypeMap.get(axisType);\n assertNotNull(typeAxes);\n var axisIndex = typeAxes.length;\n // Delete any axes that may no longer exist\n var axisProperty = this.getAxisPropertyName(axisType);\n if (axisProperty != null) {\n var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);\n while (layout[axisLayoutProperty] != null) {\n delete layout[axisLayoutProperty];\n axisIndex += 1;\n axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);\n }\n }\n }\n }\n\n /**\n * Updates the layout axis object in place\n * @param layoutAxisParam The plotly layout axis param\n * @param axis The Iris Axis to update the plotly layout with\n * @param axisIndex The type index for this axis\n * @param axisPositionMap All the axes mapped by position\n * @param axisSize The size of each axis in percent\n * @param bounds The bounds of the axes domains\n */\n updateLayoutAxis(layoutAxisParam, axis, axisIndex, axisPositionMap, xAxisSize, yAxisSize, bounds) {\n var _axis$label;\n var {\n dh\n } = this;\n var isYAxis = axis.type === dh.plot.AxisType.Y;\n var axisSize = isYAxis ? yAxisSize : xAxisSize;\n var layoutAxis = layoutAxisParam;\n // Enterprise API returns null for empty axis labels\n // Passing null title text to Plotly results in incorrect axis position, DH-9164\n var label = (_axis$label = axis.label) !== null && _axis$label !== void 0 ? _axis$label : '';\n if (layoutAxis.title !== undefined && typeof layoutAxis.title !== 'string') {\n layoutAxis.title.text = label;\n } else {\n layoutAxis.title = {\n text: label\n };\n }\n if (axis.log) {\n layoutAxis.type = 'log';\n }\n layoutAxis.side = this.getAxisSide(axis.position);\n if (axisIndex > 0) {\n var _this$getAxisProperty, _axisPositionMap$get2;\n layoutAxis.overlaying = (_this$getAxisProperty = this.getAxisPropertyName(axis.type)) !== null && _this$getAxisProperty !== void 0 ? _this$getAxisProperty : undefined;\n var positionAxes = (_axisPositionMap$get2 = axisPositionMap.get(axis.position)) !== null && _axisPositionMap$get2 !== void 0 ? _axisPositionMap$get2 : [];\n var sideIndex = positionAxes.indexOf(axis);\n if (sideIndex > 0) {\n layoutAxis.anchor = 'free';\n if (axis.position === dh.plot.AxisPosition.RIGHT) {\n layoutAxis.position = bounds.right + (sideIndex - positionAxes.length + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.TOP) {\n layoutAxis.position = bounds.top + (sideIndex - positionAxes.length + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.BOTTOM) {\n layoutAxis.position = bounds.bottom + (positionAxes.length - sideIndex + 1) * axisSize;\n } else if (axis.position === dh.plot.AxisPosition.LEFT) {\n layoutAxis.position = bounds.left + (positionAxes.length - sideIndex + 1) * axisSize;\n }\n }\n } else if (axis.type === dh.plot.AxisType.X) {\n var leftAxes = axisPositionMap.get(dh.plot.AxisPosition.LEFT) || [];\n var rightAxes = axisPositionMap.get(dh.plot.AxisPosition.RIGHT) || [];\n var left = Math.max(bounds.left, bounds.left + (leftAxes.length - 1) * yAxisSize);\n var right = Math.min(bounds.right - (rightAxes.length - 1) * yAxisSize, bounds.right);\n layoutAxis.domain = [left, right];\n } else if (axis.type === dh.plot.AxisType.Y) {\n var bottomAxes = axisPositionMap.get(dh.plot.AxisPosition.BOTTOM) || [];\n var topAxes = axisPositionMap.get(dh.plot.AxisPosition.TOP) || [];\n var bottom = Math.max(bounds.bottom, bounds.bottom + (bottomAxes.length - 1) * xAxisSize);\n var top = Math.min(bounds.top - (topAxes.length - 1) * xAxisSize, bounds.top);\n layoutAxis.domain = [bottom, top];\n }\n }\n\n /**\n * Creates range break bounds for plotly from business days.\n * For example a standard business week of ['MONDAY','TUESDAY','WEDNESDAY','THURSDAY','FRIDAY']\n * will result in [[6,1]] meaning close on Saturday and open on Monday.\n * If you remove Wednesday from the array, then you get two closures [[6, 1], [3, 4]]\n *\n * @param businessDays the days to display on the x-axis\n */\n createBoundsFromDays(businessDays) {\n var businessDaysInt = businessDays.map(day => this.daysOfWeek.indexOf(day));\n var nonBusinessDaysInt = this.daysOfWeek.filter(day => !businessDays.includes(day)).map(day => this.daysOfWeek.indexOf(day));\n // These are the days when business reopens (e.g. Monday after a weekend)\n var reopenDays = new Set();\n nonBusinessDaysInt.forEach(closed => {\n for (var i = closed + 1; i < closed + this.daysOfWeek.length; i += 1) {\n var adjustedDay = i % this.daysOfWeek.length;\n if (businessDaysInt.includes(adjustedDay)) {\n reopenDays.add(adjustedDay);\n break;\n }\n }\n });\n var boundsArray = [];\n // For each reopen day, find the furthest previous closed day\n reopenDays.forEach(open => {\n for (var i = open - 1; i > open - this.daysOfWeek.length; i -= 1) {\n var adjustedDay = i < 0 ? i + this.daysOfWeek.length : i;\n if (businessDaysInt.includes(adjustedDay)) {\n var closedDay = (adjustedDay + 1) % 7;\n boundsArray.push([closedDay, open]);\n break;\n }\n }\n });\n return boundsArray;\n }\n\n /**\n * Creates an array of range breaks for all holidays.\n *\n * @param holidays an array of holidays\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createRangeBreakValuesFromHolidays(holidays, calendarTimeZone, formatterTimeZone) {\n var fullHolidays = [];\n var partialHolidays = [];\n holidays.forEach(holiday => {\n if (holiday.businessPeriods.length > 0) {\n partialHolidays.push(...this.createPartialHoliday(holiday, calendarTimeZone, formatterTimeZone));\n } else {\n fullHolidays.push(this.createFullHoliday(holiday, calendarTimeZone, formatterTimeZone));\n }\n });\n return [{\n values: fullHolidays\n }, ...partialHolidays];\n }\n\n /**\n * Creates the range break value for a full holiday. A full holiday is day that has no business periods.\n *\n * @param holiday the full holiday\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createFullHoliday(holiday, calendarTimeZone, formatterTimeZone) {\n return this.adjustDateForTimeZone(\"\".concat(holiday.date.toString(), \" 00:00:00.000000\"), calendarTimeZone, formatterTimeZone);\n }\n\n /**\n * Creates the range break for a partial holiday. A partial holiday is holiday with business periods\n * that are different than the default business periods.\n *\n * @param holiday the partial holiday\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n createPartialHoliday(holiday, calendarTimeZone, formatterTimeZone) {\n // If a holiday has business periods {open1, close1} and {open2, close2}\n // This will generate range breaks for:\n // closed from 00:00 to open1\n // closed from close1 to open2\n // closed from close2 to 23:59:59.999999\n var dateString = holiday.date.toString();\n var closedPeriods = ['00:00'];\n holiday.businessPeriods.forEach(period => {\n closedPeriods.push(period.open);\n closedPeriods.push(period.close);\n });\n // To go up to 23:59:59.999999, we calculate the dvalue using 24 - close\n closedPeriods.push('24:00');\n var rangeBreaks = [];\n for (var i = 0; i < closedPeriods.length; i += 2) {\n var startClose = closedPeriods[i];\n var endClose = closedPeriods[i + 1];\n // Skip over any periods where start and close are the same (zero hours)\n if (startClose !== endClose) {\n var values = [this.adjustDateForTimeZone(\"\".concat(dateString, \" \").concat(startClose, \":00.000000\"), calendarTimeZone, formatterTimeZone)];\n var dvalue = MILLIS_PER_HOUR * (ChartUtils.periodToDecimal(endClose) - ChartUtils.periodToDecimal(startClose));\n rangeBreaks.push({\n values,\n dvalue\n });\n }\n }\n return rangeBreaks;\n }\n\n /**\n * Adjusts a date string from the calendar time zone to the formatter time zone.\n *\n * @param dateString the date string\n * @param calendarTimeZone the time zone for the business calendar\n * @param formatterTimeZone the time zone for the formatter\n */\n adjustDateForTimeZone(dateString, calendarTimeZone, formatterTimeZone) {\n if (formatterTimeZone && formatterTimeZone.standardOffset !== calendarTimeZone.standardOffset) {\n return this.unwrapValue(this.wrapValue(dateString, BUSINESS_COLUMN_TYPE, calendarTimeZone), formatterTimeZone);\n }\n return dateString;\n }\n\n /**\n * Creates the Figure settings from the Chart Builder settings\n * This should be deprecated at some point, and have Chart Builder create the figure settings directly.\n * This logic will still need to exist to translate existing charts, but could be part of a migration script\n * to translate the data.\n * Change when we decide to add more functionality to the Chart Builder.\n * @param settings The chart builder settings\n * @param settings.title The title for this figure\n * @param settings.xAxis The name of the column to use for the x-axis\n * @param settings.series The name of the columns to use for the series of this figure\n * @param settings.type The plot style for this figure\n */\n makeFigureSettings(settings, table) {\n var {\n dh\n } = this;\n var {\n series,\n xAxis: settingsAxis,\n type\n } = settings;\n var title = ChartUtils.titleFromSettings(settings);\n var xAxis = {\n formatType: \"\".concat(dh.plot.AxisFormatType.NUMBER),\n type: \"\".concat(dh.plot.AxisType.X),\n position: \"\".concat(dh.plot.AxisPosition.BOTTOM)\n };\n var yAxis = {\n formatType: \"\".concat(dh.plot.AxisFormatType.NUMBER),\n type: \"\".concat(dh.plot.AxisType.Y),\n position: \"\".concat(dh.plot.AxisPosition.LEFT)\n };\n return {\n charts: [{\n chartType: \"\".concat(dh.plot.ChartType.XY),\n axes: [xAxis, yAxis],\n series: (series !== null && series !== void 0 ? series : []).map(name => ({\n plotStyle: \"\".concat(type),\n name,\n dataSources: [{\n type: \"\".concat(dh.plot.SourceType.X),\n columnName: settingsAxis !== null && settingsAxis !== void 0 ? settingsAxis : '',\n axis: xAxis,\n table\n }, {\n type: \"\".concat(dh.plot.SourceType.Y),\n columnName: name,\n axis: yAxis,\n table\n }]\n }))\n }],\n title\n };\n }\n\n /**\n * Unwraps a value provided from API to a value plotly can understand\n * Eg. Unwraps DateWrapper, LongWrapper objects.\n */\n unwrapValue(value, timeZone) {\n var {\n dh\n } = this;\n if (value != null) {\n if (isDateWrapper(value)) {\n return dh.i18n.DateTimeFormat.format(ChartUtils.DATE_FORMAT, value, timeZone);\n }\n if (isLongWrapper(value)) {\n return value.asNumber();\n }\n }\n return value;\n }\n\n /**\n *\n * @param value The value to wrap up\n * @param columnType The type of column this value is from\n * @param timeZone The time zone if applicable\n */\n wrapValue(value, columnType) {\n var timeZone = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n var {\n dh\n } = this;\n if (TableUtils.isDateType(columnType) && typeof value === 'string') {\n // Need to limit the format to the actual length of the string range set in plotly\n // Otherwise parse will fail\n var text = value;\n var format = ChartUtils.DATE_FORMAT.substr(0, value.length);\n var date = dh.i18n.DateTimeFormat.parse(format, text);\n if (!timeZone) {\n return date;\n }\n\n // IDS-5994 Due to date parsing, time zone, and daylight savings shenanigans, we need\n // to pass the actual offset with the time to have it parse correctly.\n // However, the offset can change based on the date because of Daylight Savings\n // So we end up parsing the date multiple times. And curse daylight savings.\n var tzFormat = \"\".concat(format, \" Z\");\n var estimatedOffset = dh.i18n.DateTimeFormat.format('Z', date, timeZone);\n var estimatedDate = dh.i18n.DateTimeFormat.parse(tzFormat, \"\".concat(text, \" \").concat(estimatedOffset));\n var offset = dh.i18n.DateTimeFormat.format('Z', estimatedDate, timeZone);\n return dh.i18n.DateTimeFormat.parse(tzFormat, \"\".concat(text, \" \").concat(offset));\n }\n return value;\n }\n makeLayoutAxis(type) {\n var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ChartTheme;\n var {\n dh\n } = this;\n var axis = {\n automargin: true,\n gridcolor: theme.gridcolor,\n linecolor: theme.linecolor,\n rangeslider: {\n visible: false\n },\n showline: true,\n ticklen: 5,\n // act as padding, can't find a tick padding\n tickcolor: theme.paper_bgcolor,\n // hide ticks as padding\n tickfont: {\n color: theme.zerolinecolor\n },\n title: {\n font: {\n color: theme.title_color\n }\n }\n };\n if (type === dh.plot.AxisType.X) {\n Object.assign(axis, {\n showgrid: true\n });\n } else if (type === dh.plot.AxisType.Y) {\n Object.assign(axis, {\n zerolinecolor: theme.zerolinecolor,\n zerolinewidth: 2\n });\n }\n return axis;\n }\n makeDefaultLayout() {\n var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ChartTheme;\n var {\n dh\n } = this;\n var layout = _objectSpread(_objectSpread({}, theme), {}, {\n autosize: true,\n colorway: ChartUtils.getColorwayFromTheme(theme),\n font: {\n family: \"'Fira Sans', sans-serif\",\n color: theme.title_color\n },\n title: {\n font: {\n color: theme.title_color\n },\n yanchor: 'top',\n pad: _objectSpread({}, ChartUtils.DEFAULT_TITLE_PADDING),\n y: 1\n },\n legend: {\n font: {\n color: theme.title_color\n }\n },\n margin: _objectSpread({}, ChartUtils.DEFAULT_MARGIN),\n xaxis: this.makeLayoutAxis(dh.plot.AxisType.X, theme),\n yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme),\n polar: {\n angularaxis: this.makeLayoutAxis(dh.plot.AxisType.SHAPE, theme),\n radialaxis: this.makeLayoutAxis(dh.plot.AxisType.SHAPE, theme),\n bgcolor: theme.plot_bgcolor\n },\n scene: {\n xaxis: this.makeLayoutAxis(dh.plot.AxisType.X, theme),\n yaxis: this.makeLayoutAxis(dh.plot.AxisType.Y, theme),\n zaxis: this.makeLayoutAxis(dh.plot.AxisType.Z, theme)\n }\n });\n layout.datarevision = 0;\n return layout;\n }\n\n /**\n * Hydrate settings from a JSONable object\n * @param settings Dehydrated settings\n */\n hydrateSettings(settings) {\n var {\n dh\n } = this;\n return _objectSpread(_objectSpread({}, settings), {}, {\n type: settings.type != null ? dh.plot.SeriesPlotStyle[settings.type] : undefined\n });\n }\n}\n_defineProperty(ChartUtils, \"DEFAULT_AXIS_SIZE\", 0.15);\n_defineProperty(ChartUtils, \"MIN_AXIS_SIZE\", 0.025);\n_defineProperty(ChartUtils, \"MAX_AXIS_SIZE\", 0.2);\n_defineProperty(ChartUtils, \"AXIS_SIZE_PX\", 75);\n_defineProperty(ChartUtils, \"LEGEND_WIDTH_PX\", 50);\n_defineProperty(ChartUtils, \"MAX_LEGEND_SIZE\", 0.25);\n_defineProperty(ChartUtils, \"ORIENTATION\", Object.freeze({\n HORIZONTAL: 'h',\n VERTICAL: 'v'\n}));\n_defineProperty(ChartUtils, \"DATE_FORMAT\", 'yyyy-MM-dd HH:mm:ss.SSSSSS');\n_defineProperty(ChartUtils, \"DEFAULT_MARGIN\", Object.freeze({\n l: 60,\n r: 50,\n t: 30,\n b: 60,\n pad: 0\n}));\n_defineProperty(ChartUtils, \"DEFAULT_TITLE_PADDING\", Object.freeze({\n t: 8\n}));\n_defineProperty(ChartUtils, \"SUBTITLE_LINE_HEIGHT\", 25);\n_defineProperty(ChartUtils, \"DEFAULT_MARKER_SIZE\", 6);\n_defineProperty(ChartUtils, \"MODE_MARKERS\", 'markers');\n_defineProperty(ChartUtils, \"MODE_LINES\", 'lines');\nexport default ChartUtils;\n//# sourceMappingURL=ChartUtils.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\nimport React, { Component } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport { vsLoading, dhGraphLineDown, dhWarningFilled } from '@deephaven/icons';\nimport { Formatter, FormatterUtils, DateUtils } from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport createPlotlyComponent from 'react-plotly.js/factory.js';\nimport Plotly from \"./plotly/Plotly.js\";\nimport ChartModel from \"./ChartModel.js\";\nimport ChartUtils from \"./ChartUtils.js\";\nimport \"./Chart.css\";\nvar log = Log.module('Chart');\nexport class Chart extends Component {\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon) {\n var [width,,,, path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n var stringPath = \"\".concat(path);\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: \"matrix(1, 0, 0, 1, 0, 0)\"\n };\n }\n static downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n return isDownsamplingDisabled ? 'Downsampling disabled, click to enable' : 'Downsampling enabled, click to disable';\n }\n static downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled) {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n constructor(props) {\n super(props);\n _defineProperty(this, \"currentSeries\", void 0);\n _defineProperty(this, \"PlotComponent\", void 0);\n _defineProperty(this, \"plot\", void 0);\n _defineProperty(this, \"plotWrapper\", void 0);\n _defineProperty(this, \"columnFormats\", void 0);\n _defineProperty(this, \"dateTimeFormatterOptions\", void 0);\n _defineProperty(this, \"decimalFormatOptions\", void 0);\n _defineProperty(this, \"integerFormatOptions\", void 0);\n _defineProperty(this, \"rect\", void 0);\n _defineProperty(this, \"ranges\", void 0);\n _defineProperty(this, \"isSubscribed\", void 0);\n _defineProperty(this, \"isLoadedFired\", void 0);\n _defineProperty(this, \"getCachedConfig\", memoize((downsamplingError, isDownsampleFinished, isDownsampleInProgress, isDownsamplingDisabled, data) => {\n var customButtons = [];\n var hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: \"Downsampling failed: \".concat(downsamplingError),\n title: 'Downsampling failed',\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning'\n });\n }\n if (isDownsampleFinished || isDownsampleInProgress || isDownsamplingDisabled || hasDownsampleError) {\n var name = Chart.downsampleButtonTitle(isDownsampleInProgress, isDownsamplingDisabled);\n var attr = Chart.downsampleButtonAttr(isDownsampleInProgress, isDownsamplingDisabled);\n var icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n title: 'Downsampling status',\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr\n });\n }\n var has2D = data.some(_ref => {\n var {\n type\n } = _ref;\n return type != null && !type.includes('3d');\n });\n var has3D = data.some(_ref2 => {\n var {\n type\n } = _ref2;\n return type != null && type.includes('3d');\n });\n var buttons2D = ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'];\n var buttons3D = ['orbitRotation', 'tableRotation', 'resetCameraDefault3d'];\n return {\n displaylogo: false,\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n // Each array gets grouped together in the mode bar\n modeBarButtons: [customButtons, ['toImage'], ['zoom2d', 'pan2d'],\n // These work the same for both 2d and 3d\n [...(has2D ? buttons2D : []), ...(has3D ? buttons3D : [])]]\n };\n }));\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n this.PlotComponent = createPlotlyComponent(props.Plotly);\n this.plot = /*#__PURE__*/React.createRef();\n this.plotWrapper = /*#__PURE__*/React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0\n },\n revision: 0\n };\n }\n componentDidMount() {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n this.initData();\n this.initFormatter();\n var {\n isActive\n } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n componentDidUpdate(prevProps) {\n var {\n isActive,\n settings\n } = this.props;\n this.updateFormatterSettings(settings);\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n componentWillUnmount() {\n this.unsubscribe();\n }\n getPlotRect() {\n var _this$plotWrapper$cur, _this$plotWrapper$cur2;\n return (_this$plotWrapper$cur = (_this$plotWrapper$cur2 = this.plotWrapper.current) === null || _this$plotWrapper$cur2 === void 0 ? void 0 : _this$plotWrapper$cur2.getBoundingClientRect()) !== null && _this$plotWrapper$cur !== void 0 ? _this$plotWrapper$cur : null;\n }\n initData() {\n var {\n model\n } = this.props;\n var {\n layout\n } = this.state;\n this.setState({\n data: model.getData(),\n layout: _objectSpread(_objectSpread({}, layout), model.getLayout())\n });\n }\n subscribe() {\n if (this.isSubscribed) {\n return;\n }\n var {\n model\n } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n unsubscribe() {\n if (!this.isSubscribed) {\n return;\n }\n var {\n model\n } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n handleAfterPlot() {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n handleDownsampleClick() {\n this.setState(_ref3 => {\n var {\n isDownsamplingDisabled\n } = _ref3;\n return {\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled\n };\n }, () => {\n var {\n model\n } = this.props;\n var {\n isDownsamplingDisabled\n } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n });\n }\n handleModelEvent(event) {\n var {\n type,\n detail\n } = event;\n log.debug2('Received data update', type, detail);\n switch (type) {\n case ChartModel.EVENT_UPDATED:\n {\n this.currentSeries += 1;\n this.setState(state => {\n var {\n layout,\n revision\n } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1\n };\n });\n var {\n onUpdate\n } = this.props;\n onUpdate({\n isLoading: !this.isLoadedFired\n });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED:\n {\n var {\n onUpdate: _onUpdate\n } = this.props;\n this.isLoadedFired = true;\n _onUpdate({\n isLoading: false\n });\n break;\n }\n case ChartModel.EVENT_DISCONNECT:\n {\n var {\n onDisconnect\n } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT:\n {\n var {\n onReconnect\n } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED:\n {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED:\n {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED:\n {\n var _detail$message;\n var downsamplingError = (_detail$message = detail.message) !== null && _detail$message !== void 0 ? _detail$message : detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError\n });\n var {\n onError\n } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n handlePlotUpdate(figure) {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n var {\n layout\n } = figure;\n var ranges = ChartUtils.getLayoutRanges(layout);\n var isRangesChanged = !deepEqual(ranges, this.ranges);\n if (isRangesChanged) {\n this.ranges = ranges;\n this.updateModelDimensions(true);\n }\n }\n handleRelayout(changes) {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n var {\n onSettingsChanged\n } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n var hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({\n hiddenSeries\n });\n }\n this.updateModelDimensions();\n }\n handleRestyle(_ref4) {\n var [changes, seriesIndexes] = _ref4;\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n var {\n data\n } = this.state;\n var {\n onSettingsChanged\n } = this.props;\n if (data != null) {\n var hiddenSeries = data.reduce((acc, _ref5) => {\n var {\n name,\n visible\n } = _ref5;\n return name != null && visible === 'legendonly' ? [...acc, name] : acc;\n }, []);\n onSettingsChanged({\n hiddenSeries\n });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions() {\n var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n var isRectChanged = !this.rect || this.rect.width !== rect.width || this.rect.height !== rect.height;\n if (isRectChanged || force) {\n this.rect = rect;\n var {\n isActive,\n model\n } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n initFormatter() {\n var {\n settings\n } = this.props;\n this.updateFormatterSettings(settings);\n }\n updateFormatterSettings(settings) {\n var columnFormats = FormatterUtils.getColumnFormats(settings);\n var dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(settings);\n var {\n decimalFormatOptions = {},\n integerFormatOptions = {}\n } = settings;\n if (!deepEqual(this.columnFormats, columnFormats) || !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) || !deepEqual(this.decimalFormatOptions, decimalFormatOptions) || !deepEqual(this.integerFormatOptions, integerFormatOptions)) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n updateFormatter() {\n var {\n model\n } = this.props;\n var formatter = new Formatter(model.dh, this.columnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);\n model.setFormatter(formatter);\n }\n updateDimensions() {\n var rect = this.getPlotRect();\n var {\n Plotly: PlotlyProp\n } = this.props;\n if (this.plot.current != null && rect != null && rect.width > 0 && rect.height > 0) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n PlotlyProp.relayout(this.plot.current.el, {\n autosize: true\n }).catch(e => {\n log.debug('Unable to resize, promise rejected', e);\n });\n }\n }\n render() {\n var {\n PlotComponent\n } = this;\n var {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision\n } = this.state;\n var config = this.getCachedConfig(downsamplingError, isDownsampleFinished, isDownsampleInProgress, isDownsamplingDisabled, data !== null && data !== void 0 ? data : []);\n var isPlotShown = data != null;\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"h-100 w-100 chart-wrapper\",\n ref: this.plotWrapper\n }, isPlotShown && /*#__PURE__*/React.createElement(PlotComponent\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n , {\n ref: this.plot,\n data: data,\n layout: layout,\n revision: revision,\n config: config,\n onAfterPlot: this.handleAfterPlot,\n onError: log.error,\n onRelayout: this.handleRelayout,\n onUpdate: this.handlePlotUpdate,\n onRestyle: this.handleRestyle,\n useResizeHandler: true,\n style: {\n height: '100%',\n width: '100%'\n }\n }));\n }\n}\n_defineProperty(Chart, \"defaultProps\", {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: []\n },\n Plotly,\n onDisconnect: () => undefined,\n onReconnect: () => undefined,\n onUpdate: () => undefined,\n onError: () => undefined,\n onSettingsChanged: () => undefined\n});\nexport default Chart;\n//# sourceMappingURL=Chart.js.map","function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\nfunction _toPropertyKey(arg) { var key = _toPrimitive(arg, \"string\"); return typeof key === \"symbol\" ? key : String(key); }\nfunction _toPrimitive(input, hint) { if (typeof input !== \"object\" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || \"default\"); if (typeof res !== \"object\") return res; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (hint === \"string\" ? String : Number)(input); }\n/* eslint class-methods-use-this: \"off\" */\nimport memoize from 'memoizee';\nimport debounce from 'lodash.debounce';\nimport set from 'lodash.set';\nimport Log from '@deephaven/log';\nimport ChartModel from \"./ChartModel.js\";\nimport ChartUtils from \"./ChartUtils.js\";\nimport ChartTheme from \"./ChartTheme.js\";\nvar log = Log.module('FigureChartModel');\n\n/**\n * Takes a Figure object from a widget to make a model for a chart\n */\nclass FigureChartModel extends ChartModel {\n /**\n * @param dh JSAPI instance\n * @param figure The figure object created by the API\n * @param settings Chart settings\n */\n constructor(dh, figure) {\n var _this;\n var settings = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var theme = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ChartTheme;\n super(dh);\n _this = this;\n _defineProperty(this, \"chartUtils\", void 0);\n _defineProperty(this, \"dh\", void 0);\n _defineProperty(this, \"figure\", void 0);\n _defineProperty(this, \"settings\", void 0);\n _defineProperty(this, \"theme\", void 0);\n _defineProperty(this, \"data\", void 0);\n _defineProperty(this, \"layout\", void 0);\n _defineProperty(this, \"seriesDataMap\", void 0);\n _defineProperty(this, \"pendingSeries\", void 0);\n _defineProperty(this, \"oneClicks\", void 0);\n _defineProperty(this, \"filterColumnMap\", void 0);\n _defineProperty(this, \"lastFilter\", void 0);\n _defineProperty(this, \"isConnected\", void 0);\n _defineProperty(this, \"seriesToProcess\", void 0);\n _defineProperty(this, \"addPendingSeries\", debounce(() => {\n var axes = ChartUtils.getAllAxes(this.figure);\n var {\n pendingSeries\n } = this;\n var _loop = function _loop() {\n var _chart$showLegend;\n var series = pendingSeries[i];\n var chart = _this.figure.charts.find(c => c.series.includes(series));\n _this.addSeries(series, axes, (_chart$showLegend = chart === null || chart === void 0 ? void 0 : chart.showLegend) !== null && _chart$showLegend !== void 0 ? _chart$showLegend : null);\n series.subscribe();\n // We'll get an update with the data after subscribing\n };\n for (var i = 0; i < pendingSeries.length; i += 1) {\n _loop();\n }\n this.pendingSeries = [];\n }, FigureChartModel.ADD_SERIES_DEBOUNCE));\n _defineProperty(this, \"getTimeZone\", memoize((columnType, formatter) => {\n if (formatter != null) {\n var dataFormatter = formatter.getColumnTypeFormatter(columnType);\n if (dataFormatter != null) {\n return dataFormatter.dhTimeZone;\n }\n }\n return undefined;\n }));\n _defineProperty(this, \"getValueTranslator\", memoize((columnType, formatter) => {\n var timeZone = this.getTimeZone(columnType, formatter);\n return value => this.chartUtils.unwrapValue(value, timeZone);\n }));\n _defineProperty(this, \"getValueParser\", memoize((columnType, formatter) => {\n var timeZone = this.getTimeZone(columnType, formatter);\n return value => this.chartUtils.wrapValue(value, columnType, timeZone);\n }));\n _defineProperty(this, \"getRangeParser\", memoize((columnType, formatter) => range => {\n var [rangeStart, rangeEnd] = range;\n var valueParser = this.getValueParser(columnType, formatter);\n rangeStart = valueParser(rangeStart);\n rangeEnd = valueParser(rangeEnd);\n return [rangeStart, rangeEnd];\n }));\n _defineProperty(this, \"getAxisRangeParser\", memoize((chart, formatter) => axis => {\n var source = ChartUtils.getSourceForAxis(chart, axis);\n if (source != null) {\n return this.getRangeParser(source.columnType, formatter);\n }\n return range => range;\n }));\n this.handleFigureUpdated = this.handleFigureUpdated.bind(this);\n this.handleFigureDisconnected = this.handleFigureDisconnected.bind(this);\n this.handleFigureReconnected = this.handleFigureReconnected.bind(this);\n this.handleFigureSeriesAdded = this.handleFigureSeriesAdded.bind(this);\n this.handleDownsampleStart = this.handleDownsampleStart.bind(this);\n this.handleDownsampleFinish = this.handleDownsampleFinish.bind(this);\n this.handleDownsampleFail = this.handleDownsampleFail.bind(this);\n this.handleDownsampleNeeded = this.handleDownsampleNeeded.bind(this);\n this.handleRequestFailed = this.handleRequestFailed.bind(this);\n this.dh = dh;\n this.chartUtils = new ChartUtils(dh);\n this.figure = figure;\n this.settings = settings;\n this.theme = theme;\n this.data = [];\n var template = {\n data: {},\n layout: this.chartUtils.makeDefaultLayout(theme)\n };\n this.layout = {\n grid: {\n rows: figure.rows,\n columns: figure.cols,\n pattern: 'independent'\n },\n template\n };\n this.seriesDataMap = new Map();\n this.pendingSeries = [];\n this.oneClicks = [];\n this.filterColumnMap = new Map();\n this.lastFilter = new Map();\n this.isConnected = true; // Assume figure is connected to start\n this.seriesToProcess = new Set();\n this.setTitle(this.getDefaultTitle());\n this.initAllSeries();\n this.updateAxisPositions();\n this.startListeningFigure();\n }\n close() {\n this.figure.close();\n this.addPendingSeries.cancel();\n this.stopListeningFigure();\n }\n getDefaultTitle() {\n if (this.figure.charts.length > 0) {\n var chart = this.figure.charts[0];\n return chart.title;\n }\n return '';\n }\n initAllSeries() {\n this.oneClicks = [];\n this.filterColumnMap.clear();\n var {\n charts\n } = this.figure;\n var axes = ChartUtils.getAllAxes(this.figure);\n var activeSeriesNames = [];\n for (var i = 0; i < charts.length; i += 1) {\n var chart = charts[i];\n for (var j = 0; j < chart.series.length; j += 1) {\n var series = chart.series[j];\n activeSeriesNames.push(series.name);\n this.addSeries(series, axes, chart.showLegend);\n }\n }\n\n // Remove any series that no longer exist\n var allSeriesNames = [...this.seriesDataMap.keys()];\n var inactiveSeriesNames = allSeriesNames.filter(seriesName => activeSeriesNames.indexOf(seriesName) < 0);\n for (var _i = 0; _i < inactiveSeriesNames.length; _i += 1) {\n var seriesName = inactiveSeriesNames[_i];\n this.seriesDataMap.delete(seriesName);\n }\n this.seriesToProcess = new Set([...this.seriesDataMap.keys()]);\n }\n\n /**\n * Add a series to the model\n * @param series Series object to add\n * @param axes All the axis in this figure\n * @param showLegend Whether this series should show the legend or not\n */\n addSeries(series, axes, showLegend) {\n var {\n dh\n } = this;\n var axisTypeMap = ChartUtils.groupArray(axes, 'type');\n var seriesData = this.chartUtils.makeSeriesDataFromSeries(series, axisTypeMap, ChartUtils.getSeriesVisibility(series.name, this.settings), showLegend, this.theme);\n this.seriesDataMap.set(series.name, seriesData);\n this.data = [...this.seriesDataMap.values()];\n if (series.plotStyle === dh.plot.SeriesPlotStyle.STACKED_BAR) {\n this.layout.barmode = 'stack';\n } else if (series.plotStyle === dh.plot.SeriesPlotStyle.PIE) {\n this.layout.hiddenlabels = ChartUtils.getHiddenLabels(this.settings);\n }\n\n // We only want to force hide the legend if there is only one series that is not a PIE\n // Right now this means that if the user only has one series, they cannot explicitly show the legend until deephaven-core#3254 is implemented\n // TODO: deephaven-core#3254, once done, this can be removed.\n this.layout.showlegend = this.data.length > 1 || series.plotStyle === dh.plot.SeriesPlotStyle.PIE ? showLegend !== null && showLegend !== void 0 ? showLegend : undefined : false;\n if (series.oneClick != null) {\n var {\n oneClick\n } = series;\n var {\n columns\n } = oneClick;\n for (var i = 0; i < columns.length; i += 1) {\n this.filterColumnMap.set(columns[i].name, columns[i]);\n }\n this.oneClicks.push(oneClick);\n }\n this.updateLayoutFormats();\n }\n\n // We need to debounce adding series so we subscribe to them all in the same tick\n // This should no longer be necessary after IDS-5049 lands\n\n subscribe(callback) {\n super.subscribe(callback);\n if (this.listeners.length === 1) {\n // Need to initialize the series here as we may have missed some series when not subscribed\n this.initAllSeries();\n this.subscribeFigure();\n }\n }\n unsubscribe(callback) {\n super.unsubscribe(callback);\n if (this.listeners.length === 0) {\n this.unsubscribeFigure();\n }\n }\n subscribeFigure() {\n if (!this.isConnected) {\n log.debug('Ignoring subscribe when figure in disconnected state');\n return;\n }\n this.figure.subscribe(this.isDownsamplingDisabled ? this.dh.plot.DownsampleOptions.DISABLE : this.dh.plot.DownsampleOptions.DEFAULT);\n }\n unsubscribeFigure() {\n this.figure.unsubscribe();\n }\n startListeningFigure() {\n var {\n dh\n } = this;\n this.figure.addEventListener(dh.plot.Figure.EVENT_UPDATED, this.handleFigureUpdated);\n this.figure.addEventListener(dh.plot.Figure.EVENT_SERIES_ADDED, this.handleFigureSeriesAdded);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DISCONNECT, this.handleFigureDisconnected);\n this.figure.addEventListener(dh.plot.Figure.EVENT_RECONNECT, this.handleFigureReconnected);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLESTARTED, this.handleDownsampleStart);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFINISHED, this.handleDownsampleFinish);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFAILED, this.handleDownsampleFail);\n this.figure.addEventListener(dh.plot.Figure.EVENT_DOWNSAMPLENEEDED, this.handleDownsampleNeeded);\n this.figure.addEventListener(dh.Client.EVENT_REQUEST_FAILED, this.handleRequestFailed);\n }\n stopListeningFigure() {\n var {\n dh\n } = this;\n this.figure.removeEventListener(dh.plot.Figure.EVENT_UPDATED, this.handleFigureUpdated);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_SERIES_ADDED, this.handleFigureSeriesAdded);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DISCONNECT, this.handleFigureDisconnected);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_RECONNECT, this.handleFigureReconnected);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLESTARTED, this.handleDownsampleStart);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFINISHED, this.handleDownsampleFinish);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLEFAILED, this.handleDownsampleFail);\n this.figure.removeEventListener(dh.plot.Figure.EVENT_DOWNSAMPLENEEDED, this.handleDownsampleNeeded);\n this.figure.removeEventListener(dh.Client.EVENT_REQUEST_FAILED, this.handleRequestFailed);\n }\n handleDownsampleStart(event) {\n log.debug('Downsample started', event);\n this.fireDownsampleStart(event.detail);\n }\n handleDownsampleFinish(event) {\n log.debug('Downsample finished', event);\n this.fireDownsampleFinish(event.detail);\n }\n handleDownsampleFail(event) {\n log.error('Downsample failed', event);\n this.fireDownsampleFail(event.detail);\n }\n handleDownsampleNeeded(event) {\n log.info('Downsample needed', event);\n this.fireDownsampleNeeded(event.detail);\n }\n handleFigureUpdated(event) {\n var {\n detail: figureUpdateEvent\n } = event;\n var {\n series: seriesArray\n } = figureUpdateEvent;\n log.debug2('handleFigureUpdated', seriesArray);\n for (var i = 0; i < seriesArray.length; i += 1) {\n var series = seriesArray[i];\n log.debug2('handleFigureUpdated updating series', series.name);\n var {\n sources\n } = series;\n for (var j = 0; j < sources.length; j += 1) {\n var source = sources[j];\n var {\n columnType,\n type\n } = source;\n var valueTranslator = this.getValueTranslator(columnType, this.formatter);\n var dataArray = figureUpdateEvent.getArray(series, type, valueTranslator);\n this.setDataArrayForSeries(series, type, dataArray);\n }\n this.seriesToProcess.delete(series.name);\n if (this.seriesToProcess.size === 0) {\n this.fireLoadFinished();\n }\n this.cleanSeries(series);\n }\n var {\n data\n } = this;\n this.fireUpdate(data);\n }\n handleRequestFailed(event) {\n log.error('Request failed', event);\n }\n\n /**\n * Resubscribe to the figure, should be done if settings change\n */\n resubscribe() {\n if (this.listeners.length > 0) {\n this.unsubscribeFigure();\n this.subscribeFigure();\n }\n }\n setFormatter(formatter) {\n super.setFormatter(formatter);\n this.updateLayoutFormats();\n\n // Unsubscribe and resubscribe to trigger a data update\n // Data may need to be translated again because of the new formatter\n this.resubscribe();\n }\n setDownsamplingDisabled(isDownsamplingDisabled) {\n super.setDownsamplingDisabled(isDownsamplingDisabled);\n this.resubscribe();\n }\n handleFigureDisconnected(event) {\n log.debug('Figure disconnected', event);\n this.isConnected = false;\n if (this.listeners.length > 0) {\n this.unsubscribeFigure();\n }\n this.fireDisconnect();\n }\n handleFigureReconnected(event) {\n log.debug('Figure reconnected', event);\n this.isConnected = true;\n\n // It's possible the series have changed completely, as the query could have been changed\n this.initAllSeries();\n this.fireReconnect();\n if (this.listeners.length > 0) {\n this.subscribeFigure();\n }\n }\n handleFigureSeriesAdded(event) {\n var {\n detail: series\n } = event;\n log.debug('handleFigureSeriesAdded', series);\n this.pendingSeries.push(series);\n this.addPendingSeries();\n }\n setDimensions(rect) {\n super.setDimensions(rect);\n this.updateAxisPositions();\n }\n setTitle(title) {\n var _match$length, _match;\n super.setTitle(title);\n\n // Need to recalculate the padding based on how many lines of text the title is\n // Plotly doesn't handle positioning it correctly, and it's an undocumented feature\n var subtitleCount = (_match$length = (_match = (title !== null && title !== void 0 ? title : '').match(/<br>/g)) === null || _match === void 0 ? void 0 : _match.length) !== null && _match$length !== void 0 ? _match$length : 0;\n var margin = ChartUtils.DEFAULT_MARGIN.t + subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT;\n if (this.layout.margin) {\n this.layout.margin.t = margin;\n } else {\n this.layout.margin = {\n t: margin\n };\n }\n if (typeof this.layout.title === 'string') {\n this.layout.title = title;\n } else {\n this.layout.title = _objectSpread({}, this.layout.title);\n this.layout.title.text = title;\n this.layout.title.pad = _objectSpread({}, this.layout.title.pad);\n this.layout.title.pad.t = ChartUtils.DEFAULT_TITLE_PADDING.t + subtitleCount * ChartUtils.SUBTITLE_LINE_HEIGHT * 0.5;\n }\n }\n getPlotWidth() {\n var _this$layout$margin$l, _this$layout$margin, _this$layout$margin$r, _this$layout$margin2;\n if (!this.rect || !this.rect.width) {\n return 0;\n }\n return Math.max(this.rect.width - ((_this$layout$margin$l = (_this$layout$margin = this.layout.margin) === null || _this$layout$margin === void 0 ? void 0 : _this$layout$margin.l) !== null && _this$layout$margin$l !== void 0 ? _this$layout$margin$l : 0) - ((_this$layout$margin$r = (_this$layout$margin2 = this.layout.margin) === null || _this$layout$margin2 === void 0 ? void 0 : _this$layout$margin2.r) !== null && _this$layout$margin$r !== void 0 ? _this$layout$margin$r : 0), 0);\n }\n getPlotHeight() {\n var _this$layout$margin$t, _this$layout$margin3, _this$layout$margin$b, _this$layout$margin4;\n if (!this.rect || !this.rect.height) {\n return 0;\n }\n return Math.max(this.rect.height - ((_this$layout$margin$t = (_this$layout$margin3 = this.layout.margin) === null || _this$layout$margin3 === void 0 ? void 0 : _this$layout$margin3.t) !== null && _this$layout$margin$t !== void 0 ? _this$layout$margin$t : 0) - ((_this$layout$margin$b = (_this$layout$margin4 = this.layout.margin) === null || _this$layout$margin4 === void 0 ? void 0 : _this$layout$margin4.b) !== null && _this$layout$margin$b !== void 0 ? _this$layout$margin$b : 0), 0);\n }\n updateAxisPositions() {\n var plotWidth = this.getPlotWidth();\n var plotHeight = this.getPlotHeight();\n this.chartUtils.updateFigureAxes(this.layout, this.figure, chart => this.getAxisRangeParser(chart, this.formatter), plotWidth, plotHeight, this.theme);\n }\n\n /**\n * Updates the format patterns used\n */\n updateLayoutFormats() {\n if (!this.formatter) {\n return;\n }\n var axisFormats = this.chartUtils.getAxisFormats(this.figure, this.formatter);\n axisFormats.forEach((axisFormat, axisLayoutProperty) => {\n log.debug(\"Assigning \".concat(axisLayoutProperty), this.layout[axisLayoutProperty], axisFormat);\n var props = this.layout[axisLayoutProperty];\n if (props != null) {\n Object.assign(props, axisFormat);\n } else {\n log.debug(\"Ignoring null layout.\".concat(axisLayoutProperty));\n }\n });\n }\n\n /**\n * Set a specific array for the array of series properties specified.\n * @param series The series to set the data array for.\n * @param sourceType The source type within that series to set the data for.\n * @param dataArray The array to use for the data for this series source.\n */\n setDataArrayForSeries(series, sourceType, dataArray) {\n var {\n name,\n plotStyle\n } = series;\n var seriesData = this.seriesDataMap.get(name);\n var property = this.chartUtils.getPlotlyProperty(plotStyle, sourceType);\n if (seriesData) {\n set(seriesData, property, dataArray);\n }\n }\n\n /**\n * After setting all the data in the series data, we may need to adjust some other properties\n * Eg. Calculating the width from the xLow/xHigh values; Plot.ly uses `width` instead of a low/high\n * value for x.\n * @param series The series to clean the data for\n */\n cleanSeries(series) {\n var {\n dh\n } = this;\n var {\n name,\n plotStyle\n } = series;\n var seriesData = this.seriesDataMap.get(name);\n if (seriesData == null) {\n return;\n }\n if (plotStyle === dh.plot.SeriesPlotStyle.HISTOGRAM) {\n var {\n xLow,\n xHigh\n } = seriesData;\n if (xLow && xHigh && xLow.length === xHigh.length) {\n var width = [];\n for (var i = 0; i < xLow.length; i += 1) {\n width.push(xHigh[i] - xLow[i]);\n }\n seriesData.width = width;\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.LINE) {\n var {\n x,\n xLow: _xLow,\n xHigh: _xHigh,\n y,\n yLow,\n yHigh\n } = seriesData;\n if (_xLow && _xHigh && _xLow !== x) {\n seriesData.error_x = ChartUtils.getPlotlyErrorBars(x, _xLow, _xHigh);\n }\n if (yLow && yHigh && yLow !== y) {\n seriesData.error_y = ChartUtils.getPlotlyErrorBars(y, yLow, yHigh);\n }\n } else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {\n var {\n ids,\n labels\n } = seriesData;\n if (ids !== undefined && labels === undefined) {\n // If the user only provided IDs, we assign the IDs to the labels property as well automatically\n // Plotly uses the labels primarily, which from our API perspective seems kind of backwards\n seriesData.labels = ids;\n }\n }\n }\n getData() {\n return this.data;\n }\n getLayout() {\n return this.layout;\n }\n getFilterColumnMap() {\n return new Map(this.filterColumnMap);\n }\n isFilterRequired() {\n return this.oneClicks.find(oneClick => oneClick.requireAllFiltersToDisplay) != null;\n }\n\n /**\n * Sets the filter on the model. Will only set the values that have changed.\n * @param filterMap Map of filter column names to values\n */\n setFilter(filterMap) {\n var _this2 = this;\n if (this.oneClicks.length === 0) {\n log.warn('Trying to set a filter, but no one click!');\n return;\n }\n log.debug('setFilter', filterMap);\n var _loop2 = function _loop2() {\n var oneClick = _this2.oneClicks[i];\n var {\n columns\n } = oneClick;\n // Need to get all the keys in case a filter was removed\n var keys = new Set([...filterMap.keys(), ..._this2.lastFilter.keys()]);\n keys.forEach(key => {\n var value = filterMap.get(key);\n if (_this2.lastFilter.get(key) !== value && columns.find(column => column.name === key) != null) {\n oneClick.setValueForColumn(key, value);\n }\n });\n };\n for (var i = 0; i < this.oneClicks.length; i += 1) {\n _loop2();\n }\n this.lastFilter = new Map(filterMap);\n }\n setFigure(figure) {\n this.close();\n this.figure = figure;\n this.setTitle(this.getDefaultTitle());\n this.initAllSeries();\n this.updateAxisPositions();\n this.startListeningFigure();\n if (this.listeners.length > 0) {\n this.subscribeFigure();\n }\n }\n updateSettings(settings) {\n this.settings = settings;\n }\n}\n_defineProperty(FigureChartModel, \"ADD_SERIES_DEBOUNCE\", 50);\nexport default FigureChartModel;\n//# sourceMappingURL=FigureChartModel.js.map","function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\nimport ChartUtils from \"./ChartUtils.js\";\nimport FigureChartModel from \"./FigureChartModel.js\";\nimport ChartTheme from \"./ChartTheme.js\";\nclass ChartModelFactory {\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The ChartModel Promise representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static makeModelFromSettings(dh, settings, table) {\n var _arguments = arguments;\n return _asyncToGenerator(function* () {\n var theme = _arguments.length > 3 && _arguments[3] !== undefined ? _arguments[3] : ChartTheme;\n var figure = yield ChartModelFactory.makeFigureFromSettings(dh, settings, table);\n return new FigureChartModel(dh, figure, settings, theme);\n })();\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @returns The Figure created with the settings provided\n */\n static makeFigureFromSettings(dh, settings, table) {\n return _asyncToGenerator(function* () {\n // Copy the table first and then re-apply the filters from the original table\n // When we add table linking we'll want to listen to the original table and update\n // the copied table with any changes that occur.\n // The table gets owned by the Figure that gets created, which closes the table\n var tableCopy = yield table.copy();\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n return dh.plot.Figure.create(new ChartUtils(dh).makeFigureSettings(settings, tableCopy));\n })();\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param figure The figure to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The FigureChartModel representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static makeModel(dh, settings, figure) {\n var _arguments2 = arguments;\n return _asyncToGenerator(function* () {\n var theme = _arguments2.length > 3 && _arguments2[3] !== undefined ? _arguments2[3] : ChartTheme;\n return new FigureChartModel(dh, figure, settings, theme);\n })();\n }\n}\nexport default ChartModelFactory;\n//# sourceMappingURL=ChartModelFactory.js.map","import React, { useEffect, useMemo, useState } from 'react';\nimport { Chart, ChartModel, ChartModelFactory } from '@deephaven/chart'; // chart is used to display Deephaven charts\nimport { ContextMenuRoot, LoadingOverlay } from '@deephaven/components'; // Use the loading spinner from the Deephaven components package\nimport type { dh as DhType, IdeConnection } from '@deephaven/jsapi-types';\nimport Log from '@deephaven/log';\nimport './App.scss'; // Styles for in this app\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { useConnection } from '@deephaven/app-utils';\n\nconst log = Log.module('EmbedChart.App');\n\n/**\n * Load an existing Deephaven figure with the connection provided\n * @param dh JSAPI instance\n * @param connection The Deephaven session object\n * @param name Name of the figure to load\n * @returns Deephaven figure\n */\nasync function loadFigure(dh: DhType, connection: IdeConnection, name: string) {\n log.info(`Fetching figure ${name}...`);\n\n const definition = { name, type: dh.VariableType.FIGURE };\n return connection.getObject(definition);\n}\n\n/**\n * A functional React component that displays a Deephaven figure using the @deephaven/chart package.\n * It will attempt to open and display the figure specified with the `name` parameter, expecting it to be present on the server.\n * E.g. http://localhost:3000/?name=myFigure will attempt to open a figure `myFigure`\n * If no query param is provided, it will display an error.\n * By default, tries to connect to the server defined in the VITE_CORE_API_URL variable, which is set to http://localhost:10000/jsapi\n * See create-react-app docs for how to update these env vars: https://create-react-app.dev/docs/adding-custom-environment-variables/\n */\nfunction App(): JSX.Element {\n const [model, setModel] = useState<ChartModel>();\n const [error, setError] = useState<string>();\n const [isLoading, setIsLoading] = useState(true);\n const searchParams = useMemo(\n () => new URLSearchParams(window.location.search),\n []\n );\n const connection = useConnection();\n const dh = useApi();\n\n useEffect(\n function initializeApp() {\n async function initApp() {\n try {\n // Get the table name from the query param `name`.\n const name = searchParams.get('name');\n\n if (name == null) {\n throw new Error('No name param provided');\n }\n\n log.debug('Loading figure', name, '...');\n\n // Load the figure up.\n const figure = await loadFigure(dh, connection, name);\n\n // Create the `ChartModel` for use with the `Chart` component\n log.debug(`Creating model...`);\n\n const newModel = await ChartModelFactory.makeModel(\n dh,\n undefined,\n figure\n );\n\n setModel(newModel);\n\n log.debug('Figure successfully loaded!');\n } catch (e: unknown) {\n log.error('Unable to load figure', e);\n setError(`${e}`);\n }\n setIsLoading(false);\n }\n initApp();\n },\n [dh, connection, searchParams]\n );\n\n const isLoaded = model != null;\n\n return (\n <div className=\"App\">\n {isLoaded && <Chart model={model} />}\n {!isLoaded && (\n <LoadingOverlay\n isLoaded={isLoaded}\n isLoading={isLoading}\n errorMessage={error ?? null}\n />\n )}\n <ContextMenuRoot />\n </div>\n );\n}\n\nexport default App;\n"],"names":["Plotly","bar","histogram","pie","ohlc","scattergl","treemap","_defineProperty","obj","key","value","_toPropertyKey","arg","_toPrimitive","input","hint","prim","res","ChartModel","dh","filter","formatter","isDownsamplingDisabled","rect","title","callback","listener","event","i","data","detail","ChartModel$1","ChartTheme","ownKeys","object","enumerableOnly","keys","symbols","sym","_objectSpread","target","source","log","Log","BUSINESS_COLUMN_TYPE","MILLIS_PER_HOUR","NANOS_PER_MILLI","isDateWrapper","isLongWrapper","isDateTimeColumnFormatter","isRangedPlotlyAxis","ChartUtils","x","xLow","xHigh","array","arrayminus","prefix","columnType","formatPattern","subpatterns","matchArray","assertNotNull","placeholderDigits","zeroDigits","decimalDigits","optionalDecimalDigits","numberType","percentSign","suffix","paddingLength","isCommaSeparated","comma","plotlyNumberType","type","decimalLength","trimOption","tickformat","tickprefix","ticksuffix","axisFormat","axis","isDateType","gapBetweenMajorTicks","updatedFormat","tickSpacing","chart","series","j","name","settings","mode","showLegend","orientation","deephavenShape","figure","axes","charts","_chart","layout","ranges","axisProperty","axisIndex","axisIndexString","period","values","property","result","item","_result$get","group","theme","colorway","xAxis","_this","axisFormats","nullFormat","allAxes","axisTypeMap","_chart2","sources","axisSources","_loop","k","axisType","typeAxes","axisLayoutProperty","businessCalendar","rangebreaks","businessPeriods","businessDays","holidays","calendarTimeZone","typeFormatter","formatterTimeZone","timeZoneDiff","weekendBounds","_ret","plotStyle","isBusinessTime","areLinesVisible","areShapesVisible","modes","sourceType","_sources$","_sources$$axis","seriesVisibility","isLinesVisible","isShapesVisible","lineColor","shapeColor","shape","shapeSize","_source$axis","seriesData","seriesDataParam","_axis","dataAttributeName","set","e","axisPosition","layoutParam","chartAxisRangeParser","plotWidth","plotHeight","figureAxes","_chart3","axisRangeParser","bounds","_axisPositionMap$get","cols","rows","column","colspan","row","rowspan","endColumn","endRow","columnSize","rowSize","xMarginSize","yMarginSize","axisPositionMap","rightAxes","dataFormatter","TableUtils","chartAxes","xAxisSize","yAxisSize","axisTypes","figureAxisTypeMap","figureTypeAxes","isYAxis","plotSize","chartAxisIndex","_axis2","figureAxisIndex","layoutAxis","_range","autorange","rangeParser","rangeStart","rangeEnd","figureAxisTypes","layoutAxisParam","_axis$label","axisSize","label","_this$getAxisProperty","_axisPositionMap$get2","positionAxes","sideIndex","leftAxes","left","right","bottomAxes","topAxes","bottom","top","businessDaysInt","day","nonBusinessDaysInt","reopenDays","closed","adjustedDay","boundsArray","open","closedDay","fullHolidays","partialHolidays","holiday","dateString","closedPeriods","rangeBreaks","startClose","endClose","dvalue","table","settingsAxis","yAxis","timeZone","text","format","date","tzFormat","estimatedOffset","estimatedDate","offset","ChartUtils$1","Chart","Component","faIcon","width","path","stringPath","isDownsampleInProgress","props","memoize","downsamplingError","isDownsampleFinished","customButtons","hasDownsampleError","dhWarningFilled","attr","icon","vsLoading","dhGraphLineDown","has2D","_ref","has3D","_ref2","buttons2D","buttons3D","createPlotlyComponent","React","isActive","prevProps","_this$plotWrapper$cur","_this$plotWrapper$cur2","model","_ref3","state","revision","onUpdate","_onUpdate","onDisconnect","onReconnect","_detail$message","onError","isRangesChanged","deepEqual","changes","onSettingsChanged","hiddenSeries","_ref4","seriesIndexes","acc","_ref5","visible","force","isRectChanged","columnFormats","FormatterUtils","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","Formatter","PlotlyProp","PlotComponent","config","isPlotShown","DateUtils","Chart$1","FigureChartModel","debounce","pendingSeries","_chart$showLegend","c","range","valueParser","template","activeSeriesNames","allSeriesNames","inactiveSeriesNames","seriesName","_i","oneClick","columns","figureUpdateEvent","seriesArray","valueTranslator","dataArray","_match$length","_match","subtitleCount","margin","_this$layout$margin$l","_this$layout$margin","_this$layout$margin$r","_this$layout$margin2","_this$layout$margin$t","_this$layout$margin3","_this$layout$margin$b","_this$layout$margin4","_xLow","_xHigh","y","yLow","yHigh","ids","labels","filterMap","_this2","_loop2","FigureChartModel$1","asyncGeneratorStep","gen","resolve","reject","_next","_throw","info","error","_asyncToGenerator","fn","self","args","err","ChartModelFactory","_arguments","tableCopy","_arguments2","ChartModelFactory$1","loadFigure","connection","definition","App","setModel","useState","setError","isLoading","setIsLoading","searchParams","useMemo","useConnection","useApi","useEffect","initApp","newModel","isLoaded","jsxs","jsx","LoadingOverlay","ContextMenuRoot"],"mappings":"gZAqBAA,GAAO,SAAS,CAACC,GAAKC,GAAWC,GAAKC,GAAMC,GAAWC,EAAO,CAAC,ECrB/D,SAASC,EAAgBC,EAAKC,EAAKC,EAAO,CAAE,OAAAD,EAAME,GAAeF,CAAG,EAAOA,KAAOD,EAAO,OAAO,eAAeA,EAAKC,EAAK,CAAE,MAAOC,EAAO,WAAY,GAAM,aAAc,GAAM,SAAU,EAAM,CAAA,EAAYF,EAAIC,CAAG,EAAIC,EAAgBF,CAAM,CAC5O,SAASG,GAAeC,EAAK,CAAE,IAAIH,EAAMI,GAAaD,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