import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
import _defineProperty from '@babel/runtime/helpers/defineProperty';
import _omit from '../../node_modules/lodash-es/omit.js';
import capitalize from '../../node_modules/lodash-es/capitalize.js';
import isEmpty from '../../node_modules/lodash-es/isEmpty.js';
import isNil from '../../node_modules/lodash-es/isNil.js';
import 'core-js/modules/es.symbol.js';
import 'core-js/modules/es.array.concat.js';
import 'core-js/modules/es.array.filter.js';
import 'core-js/modules/es.array.includes.js';
import 'core-js/modules/es.array.iterator.js';
import 'core-js/modules/es.array.map.js';
import 'core-js/modules/es.object.get-own-property-descriptor.js';
import 'core-js/modules/es.object.get-own-property-descriptors.js';
import 'core-js/modules/es.object.keys.js';
import 'core-js/modules/es.object.to-string.js';
import 'core-js/modules/es.set.js';
import 'core-js/modules/es.string.includes.js';
import 'core-js/modules/es.string.iterator.js';
import 'core-js/modules/web.dom-collections.for-each.js';
import 'core-js/modules/web.dom-collections.iterator.js';
import dayjs, { DAYJS_INPUT_FORMATS } from '../../utils/dayjs.js';
import { BAR_CHART_TYPES, BAR_CHART_LAYOUTS, CARD_SIZES } from '../../constants/LayoutConstants.js';
import { CHART_COLORS } from '../../constants/CardPropTypes.js';
import { convertStringsToDOMElement } from '../../utils/componentUtilityFunctions.js';

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }

/**
 * Generate fake, sample values for isEditable preview state
 * @param {Array<Object>} series dataSourceId declarations
 * @param {string} timeDataSourceId, time-based attribute to group by
 * @param {string} timeGrain time interval to make sample data for
 * @param {string} categoryDataSourceId, in case of grouped/stacked charts, the field to group by
 */
var generateSampleValues = function generateSampleValues(series, timeDataSourceId) {
  var timeGrain = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
  var timeRange = arguments.length > 3 ? arguments[3] : undefined;
  var categoryDataSourceId = arguments.length > 4 ? arguments[4] : undefined;
  // determine interval type
  var timeRangeType = timeRange !== null && timeRange !== void 0 && timeRange.includes('this') ? 'periodToDate' : 'rolling';
  // for month timeGrains, we need to determine whether to show 3 for a quarter or 12 for a year
  var timeRangeInterval = timeRange !== null && timeRange !== void 0 && timeRange.includes('Quarter') ? 'quarter' : timeRange;
  var count = 7;
  switch (timeGrain) {
    case 'hour':
      count = 24;
      break;
    case 'day':
      count = 7;
      break;
    case 'week':
      count = 4;
      break;
    case 'month':
      count = timeRangeInterval === 'quarter' ? 3 : 12;
      break;
    case 'year':
      count = 5;
      break;
    default:
      count = 7;
      break;
  }
  if (timeDataSourceId) {
    return series.reduce(function (sampleData, _ref) {
      var dataSourceId = _ref.dataSourceId;
      var now = timeRangeType === 'periodToDate' // handle "this" intervals like "this week"
      ? dayjs().startOf(timeRangeInterval).subtract(1, timeGrain) : dayjs().subtract(count, timeGrain);
      // eslint-disable-next-line no-plusplus
      var _loop = function _loop() {
        var nextTimeStamp = now.add(1, timeGrain).valueOf();
        if (categoryDataSourceId) {
          var _loop2 = function _loop2() {
            var value = _defineProperty({}, categoryDataSourceId, "Sample ".concat(k + 1));
            series.forEach(function (datasource) {
              value[timeDataSourceId] = nextTimeStamp;
              value[datasource.dataSourceId] = Math.random() * 100;
            });
            sampleData.push(value);
          };
          // 4 random datasets
          // eslint-disable-next-line no-plusplus
          for (var k = 0; k < 4; k++) {
            _loop2();
          }
        } else {
          // otherwise we need explicit row
          sampleData.push(_defineProperty(_defineProperty({}, timeDataSourceId, nextTimeStamp), dataSourceId, Math.random() * 100));
        }
      };
      for (var i = 0; i < count; i++) {
        _loop();
      }
      return sampleData;
    }, []);
  }
  var sampleData = [];
  // eslint-disable-next-line no-plusplus
  var _loop3 = function _loop3() {
    var value = _defineProperty({}, categoryDataSourceId, "Sample ".concat(i + 1));
    series.forEach(function (datasource) {
      value[datasource.dataSourceId] = Math.random() * 100;
    });
    sampleData.push(value);
  };
  for (var i = 0; i < 4; i++) {
    _loop3();
  }
  return sampleData;
};

/**
 * Generate fake, sample values for isDashboardPreview state. This is needed to preview
 * data grouped by the categoryDataSourceId prop
 * @param {Array<Object>} values a list of metrics and the dimension values to group them by
 *
 * @returns {Array} array of value objects to show in the chart
 *
 * TODO: this should probably get refactored to be one generateSampleValues function
 */
var generateSampleValuesForEditor = function generateSampleValuesForEditor(series, timeDataSourceId) {
  var timeGrain = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'day';
  var timeRange = arguments.length > 3 ? arguments[3] : undefined;
  var categoryDataSourceId = arguments.length > 4 ? arguments[4] : undefined;
  var availableDimensions = arguments.length > 5 ? arguments[5] : undefined;
  // determine interval type
  var timeRangeType = timeRange !== null && timeRange !== void 0 && timeRange.includes('this') ? 'periodToDate' : 'rolling';
  // for month timeGrains, we need to determine whether to show 3 for a quarter or 12 for a year
  var timeRangeInterval = timeRange !== null && timeRange !== void 0 && timeRange.includes('Quarter') ? 'quarter' : timeRange;
  var count = 7;
  switch (timeGrain) {
    case 'hour':
      count = 24;
      break;
    case 'day':
      count = 7;
      break;
    case 'week':
      count = 4;
      break;
    case 'month':
      count = timeRangeInterval === 'quarter' ? 3 : 12;
      break;
    case 'year':
      count = 5;
      break;
    default:
      count = 7;
      break;
  }

  // need to remove the label if it is a categorized timeseries bar chart
  var dimensions = [];
  if (availableDimensions && availableDimensions[categoryDataSourceId]) {
    availableDimensions[categoryDataSourceId].forEach(function (value) {
      dimensions.push({
        dimension: categoryDataSourceId,
        value: value
      });
    });
  }
  if (timeDataSourceId) {
    var sampleData = [];
    series.forEach(function (_ref2) {
      var dataSourceId = _ref2.dataSourceId;
      var now = timeRangeType === 'periodToDate' // handle "this" intervals like "this week"
      ? dayjs().startOf(timeRangeInterval).subtract(1, timeGrain) : dayjs().subtract(count, timeGrain);
      // create 4 random dataSets
      // eslint-disable-next-line no-plusplus
      var _loop4 = function _loop4() {
        var nextTimeStamp = now.add(1, timeGrain).valueOf();
        // include dimension category if there is one
        if (categoryDataSourceId) {
          dimensions.forEach(function (dimension) {
            sampleData.push(_defineProperty(_defineProperty(_defineProperty({}, timeDataSourceId, nextTimeStamp), dataSourceId, Math.random() * 100), dimension.dimension, dimension.value));
          });
        } else {
          // otherwise we need explicit row
          sampleData.push(_defineProperty(_defineProperty({}, timeDataSourceId, nextTimeStamp), dataSourceId, Math.random() * 100));
        }
      };
      for (var i = 0; i < count; i++) {
        _loop4();
      }
    });
    return sampleData;
  }

  // for every dimension value, create a value object that contains sample data for each metric
  var valuesGeneratedByDimensions = dimensions.map(function (dimension) {
    var value = _defineProperty({}, dimension.dimension, dimension.value);
    series.forEach(function (metric) {
      value[metric.dataSourceId] = Math.random() * 100;
    });
    return value;
  });
  return valuesGeneratedByDimensions;
};

/**
 * Translates our raw data into a language the carbon-charts understand
 * @param {Array<Object>} series, the definition of the plotted series
 * @param {string} series.dataSourceId, the numeric field that identifies the value to display in the main axis
 * @param {string} series.label, the displayed name of the dataset
 * @param {array} values, the array of values from our data layer
 * @param {string} categoryDataSourceId, in case of grouped/stacked charts, the field to group by
 * @param {string} timeDataSourceId, time-based attribute to group by
 * @param {string} type of chart i.e. simple, grouped, stacked
 *
 * @returns {array} of formatted values: [group: string, value: number, key: string, date: date]
 */
var formatChartData = function formatChartData(seriesArg, values, categoryDataSourceId, timeDataSourceId, type, isDashboardPreview) {
  var series = seriesArg;
  // need to remove the label if it is a categorized timeseries bar chart in the dashboard editor
  if (type === BAR_CHART_TYPES.STACKED && timeDataSourceId && categoryDataSourceId && isDashboardPreview) {
    series = series.map(function (item) {
      return _omit(item, 'label');
    });
  }
  var data = values !== null && values !== void 0 ? values : [];
  if (!isNil(values) && !isEmpty(series)) {
    data = [];
    // grouped or stacked
    if (type === BAR_CHART_TYPES.GROUPED || type === BAR_CHART_TYPES.STACKED) {
      var uniqueDatasetNames;
      var groupedData;
      // Get the unique values for each x-label grouping
      if (timeDataSourceId && type !== BAR_CHART_TYPES.GROUPED) {
        uniqueDatasetNames = _toConsumableArray(new Set(values.map(function (val) {
          return val[timeDataSourceId];
        })));
        groupedData = uniqueDatasetNames.map(function (name) {
          return values.filter(function (val) {
            return val[timeDataSourceId] === name;
          });
        });
      } else {
        uniqueDatasetNames = _toConsumableArray(new Set(values.map(function (val) {
          return val[categoryDataSourceId];
        })));
        groupedData = uniqueDatasetNames.map(function (group) {
          return values.filter(function (val) {
            return val[categoryDataSourceId] === group;
          });
        });
      }
      groupedData.forEach(function (group) {
        group.forEach(function (value) {
          series.forEach(function (dataset) {
            // if value is null, don't add it to the formatted chartData
            if (!isNil(value[dataset.dataSourceId]) && (!isNil(value[categoryDataSourceId]) || !isNil(dataset.label)) && (timeDataSourceId && type !== BAR_CHART_TYPES.GROUPED ? !isNil(value[timeDataSourceId]) : !isNil(value[categoryDataSourceId]))) {
              data.push(_objectSpread({
                // if there's a dataset label, use it
                group: dataset.label ? dataset.label : value[categoryDataSourceId],
                // bar this data belongs to
                value: value[dataset.dataSourceId]
              }, timeDataSourceId && type !== BAR_CHART_TYPES.GROUPED ? {
                date: dayjs.tz(value[timeDataSourceId]).toDate(),
                key: value[timeDataSourceId]
              } : {
                key: value[categoryDataSourceId]
              }));
            }
          });
        });
      });
    } // single bars and not time-based
    else if (categoryDataSourceId && Array.isArray(values)) {
      var _uniqueDatasetNames = _toConsumableArray(new Set(values.map(function (val) {
        return val[categoryDataSourceId];
      })));
      var labeledData = _uniqueDatasetNames.map(function (name) {
        return values.filter(function (val) {
          return val[categoryDataSourceId] === name;
        });
      });
      labeledData.forEach(function (dataset) {
        dataset.forEach(function (value) {
          // if value is null, don't add it to the formatted chartData
          if (!isNil(value[series[0].dataSourceId] && value[categoryDataSourceId])) {
            data.push({
              group: value[categoryDataSourceId],
              // bar this data belongs to
              value: value[series[0].dataSourceId] // there should only be one series here because its a simple bar
            });
          }
        });
      });
    } // single bars and time-based
    else if (Array.isArray(values)) {
      var _uniqueDatasetNames2 = _toConsumableArray(new Set(values.map(function (val) {
        return val[timeDataSourceId];
      })));
      var _labeledData = _uniqueDatasetNames2.map(function (name) {
        return values.filter(function (val) {
          return val[timeDataSourceId] === name;
        });
      });
      _labeledData.forEach(function (dataset) {
        dataset.forEach(function (value) {
          // if value is null, don't add it to the formatted chartData
          if (!isNil(value[series[0].dataSourceId])) {
            data.push({
              // Use the label if one exists
              group: series[0].label ? series[0].label : series[0].dataSourceId,
              // bar this data belongs to
              value: value[series[0].dataSourceId],
              // there should only be one series here because its a simple bar
              date: dayjs.tz(value[timeDataSourceId]).toDate()
            });
          }
        });
      });
    }
  }
  return isDashboardPreview && isEmpty(series) ? [] : data;
};

/**
 * Maps values to left and bottom axes based on whether layout is vertical
 * or horizontal, and if the series is grouped or time-based
 *
 * @param {Object} series the definition of the plotted series
 * @param {string} layout vertical or horizontal
 * @param {string} categoryDataSourceId attribute to be grouped / categorized by
 * @param {string} timeDatasourceId time-based attribute
 * @param {string} type of chart i.e. simple, grouped, stacked
 *
 * @returns {object} { bottomAxesMapsTo: string, leftAxesMapsTo: string }
 */
var mapValuesToAxes = function mapValuesToAxes(layout, categoryDataSourceId, timeDataSourceId, type) {
  // Determine which values the axes map to
  var bottomAxesMapsTo;
  var leftAxesMapsTo;
  if (layout === BAR_CHART_LAYOUTS.VERTICAL) {
    // if vertical and time-based
    if (timeDataSourceId) {
      bottomAxesMapsTo = 'date';
      leftAxesMapsTo = 'value';
    } // if vertical and group-based
    else if (categoryDataSourceId && type !== BAR_CHART_TYPES.SIMPLE) {
      bottomAxesMapsTo = 'key';
      leftAxesMapsTo = 'value';
    } // if vertical and not group or time-based
    else {
      bottomAxesMapsTo = 'group';
      leftAxesMapsTo = 'value';
    }
  } // if horizontal and time-based
  else if (timeDataSourceId) {
    bottomAxesMapsTo = 'value';
    leftAxesMapsTo = 'date';
  } // if horizontal and group-based
  else if (categoryDataSourceId && type !== BAR_CHART_TYPES.SIMPLE) {
    bottomAxesMapsTo = 'value';
    leftAxesMapsTo = 'key';
  } // if horizontal, not time-based or group
  else {
    bottomAxesMapsTo = 'value';
    leftAxesMapsTo = 'group';
  }
  return {
    bottomAxesMapsTo: bottomAxesMapsTo,
    leftAxesMapsTo: leftAxesMapsTo
  };
};

/**
 * Formats and maps the colors to their corresponding datasets in the carbon charts tabular data format
 * If there are no colors or incomplete colors set, carbon charts will use their default colors
 * @param {Array} series an array of dataset group classifications
 * @param {Array || string || Object} series[i].color
 * @param {Array<string>} datasetNames unique dataset bar names to be used if color is an object
 *
 * @returns {Object} colors - formatted
 */
var formatColors = function formatColors(series, datasetNames, isDashboardPreview, type) {
  // first set the carbon charts config defaults
  var colors = {
    scale: {}
  };
  if (isDashboardPreview && type === BAR_CHART_TYPES.SIMPLE) {
    datasetNames.forEach(function (dataset) {
      if (series[0].color) {
        colors.scale[dataset] = series[0].color;
      }
    });
    return colors;
  }

  // if color is an array, order doesn't matter so just map as many as possible
  if (series[0] && Array.isArray(series[0].color)) {
    series[0].color.forEach(function (color, index) {
      colors.scale[datasetNames[index]] = color;
    });
  } else {
    series.forEach(function (dataset) {
      if (dataset.color) {
        // if its a string, set the color to this line
        if (typeof dataset.color === 'string') {
          colors.scale[dataset.label] = dataset.color;
        } // If its an object, use it, but the keys must match the labels provided from series.label
        else {
          colors.scale = dataset.color;
        }
      }
    });
  }
  datasetNames.forEach(function (dataset, index) {
    // if the colors aren't set, give them a default color
    if (!colors.scale[dataset]) {
      colors.scale[dataset] = CHART_COLORS[index % CHART_COLORS.length];
    }
  });
  return colors;
};

/**
 * Extends default tooltip with additional date information if the graph is time-based
 *
 * This function is a bit more hacky than TimeSeriesCard because carbon charts formats it differently
 * TODO: remove the hackiness once this issue is solved: https://github.com/carbon-design-system/carbon-charts/issues/657
 *
 * @param {object} data data object for this particular datapoint
 * @param {string} defaultTooltip Default HTML generated for this tooltip that needs to be marked up
 * @param {object} _datum of the hovered element
 * @param {string} timeDatasourceId time-based attribute
 * @param {bool} showTimeInGMT
 * @param {string} tooltipDataFormatPattern
 * @param {string} timezone
 */
var handleTooltip = function handleTooltip(dataOrHoveredElement, defaultTooltip, _datum, timeDataSourceId, showTimeInGMT) {
  var tooltipDateFormatPattern = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : DAYJS_INPUT_FORMATS.SECONDS;
  var locale = arguments.length > 6 ? arguments[6] : undefined;
  var timezone = arguments.length > 7 ? arguments[7] : undefined;
  dayjs.locale(locale);
  var data = dataOrHoveredElement.__data__ // eslint-disable-line no-underscore-dangle
  ? dataOrHoveredElement.__data__ // eslint-disable-line no-underscore-dangle
  : dataOrHoveredElement;
  var typedData = Array.isArray(data) ? data[0] : data;
  var _convertStringsToDOME = convertStringsToDOMElement([defaultTooltip]),
    _convertStringsToDOME2 = _slicedToArray(_convertStringsToDOME, 1),
    parsedTooltip = _convertStringsToDOME2[0];

  // If theres a time attribute, add an extra list item with the formatted date
  if (timeDataSourceId) {
    // generate the formatted label
    var timestamp = typedData === null || typedData === void 0 ? void 0 : typedData.date;
    var dateLabel = timestamp ? "<li class='datapoint-tooltip'>\n            <p class='label'>\n              ".concat((showTimeInGMT ? dayjs.utc(timestamp) : dayjs(timestamp).tz(timezone)).format(tooltipDateFormatPattern), "</p>\n          </li>") : '';
    var _convertStringsToDOME3 = convertStringsToDOMElement([dateLabel]),
      _convertStringsToDOME4 = _slicedToArray(_convertStringsToDOME3, 1),
      parsedDateLabel = _convertStringsToDOME4[0];

    // First remove carbon charts default Date tooltip
    // the first <li> will always be carbon chart's Dates row in this case, replace with our date format <li>
    parsedTooltip.querySelector('li:first-child').replaceWith(parsedDateLabel.querySelector('li'));
  }
  return parsedTooltip.innerHTML;
};

/**
 * Generates table columns for the isExpanded state StatefulTable
 *
 * @param {string} timeDatasourceId time-based attribute
 * @param {string} categoryDataSourceId attribute to be grouped / categorized by
 * @param {string} type of chart i.e. simple, grouped, stacked
 * @param {Array<string>} uniqueDatasetNames  unique dataset bar names
 * @param {string} defaultFilterStringPlaceholdText i18n
 */
var generateTableColumns = function generateTableColumns(timeDataSourceId, categoryDataSourceId, type, uniqueDatasetNames, defaultFilterStringPlaceholdText) {
  var tableColumns = [];
  // In expanded mode we show the data underneath the barchart in a table so need to build the columns
  // First column is timestamp if there is one
  if (timeDataSourceId) {
    tableColumns.push({
      id: timeDataSourceId,
      name: capitalize(timeDataSourceId),
      isSortable: true,
      type: 'TIMESTAMP'
    });
  } else if (categoryDataSourceId && type !== BAR_CHART_TYPES.SIMPLE) {
    tableColumns.push({
      id: categoryDataSourceId,
      name: capitalize(categoryDataSourceId),
      isSortable: true
    });
  }

  // then the rest in series order
  tableColumns = tableColumns.concat(uniqueDatasetNames.map(function (datasetName) {
    return _objectSpread({
      id: datasetName,
      name: capitalize(datasetName),
      isSortable: true
    }, defaultFilterStringPlaceholdText ? {
      filter: {
        placeholderText: defaultFilterStringPlaceholdText
      }
    } : '');
  }));
  return tableColumns;
};

/**
 * Generates table data for isExpanded StatefulTable state
 * If data is time-based, the first column should be timeDataSourceId
 * If its a simple, non timebased chart, only 1 row should be returned
 * If its grouped and non timebased, the categoryDataSourceId should be the first column
 *
 * @param {string} timeDatasourceId time-based attribute
 * @param {string} categoryDataSourceId attribute to be grouped / categorized by
 * @param {string} type of chart i.e. simple, grouped, stacked
 * @param {Array<Object>} values values before they are formatted for charting
 * @param {Array<Object>} chartData values after they are formatted for charting
 * @param {string} defaultDateFormatPattern date format pattern
 * @param {string} timezone timezone to use for formatting dates
 */
var formatTableData = function formatTableData(timeDataSourceId, categoryDataSourceId, type, values, chartData) {
  var defaultDateFormatPattern = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : DAYJS_INPUT_FORMATS.SECONDS;
  var tableData = [];
  if (!isNil(values) && !isNil(chartData)) {
    if (timeDataSourceId) {
      // First get all of the unique timestamps
      var uniqueTimestamps = _toConsumableArray(new Set(values.map(function (val) {
        return val[timeDataSourceId];
      })));
      // For each unique timestamp, get the unique value for each dataset group
      // Each table row will consist of 1 timestamp and the corresponding values
      // of each dataset group for that timestamp
      uniqueTimestamps.forEach(function (timestamp, index) {
        var barTimeValue = {};
        var filteredData = chartData.filter(function (data) {
          var _data$date;
          return ((_data$date = data.date) === null || _data$date === void 0 ? void 0 : _data$date.valueOf()) === timestamp;
        });
        filteredData.forEach(function (val) {
          barTimeValue[val.group] = val.value;
        });
        tableData.push({
          id: "dataindex-".concat(index),
          values: _objectSpread(_objectSpread({}, barTimeValue), {}, _defineProperty({}, timeDataSourceId, dayjs.tz(timestamp).format(defaultDateFormatPattern))),
          isSelectable: false
        });
      });
    } else if (type === BAR_CHART_TYPES.SIMPLE) {
      var simpleBarValue = {};
      chartData.forEach(function (value) {
        // There's only 1 row if its a simple non-timebased graph
        simpleBarValue[value.group] = value.value;
      });
      tableData.push({
        id: "dataindex-1",
        values: _objectSpread({}, simpleBarValue),
        isSelectable: false
      });
    } // Format the tableData for grouped and stacked charts that are NOT time-based
    else {
      // First get all of the unique keys
      var uniqueKeys = _toConsumableArray(new Set(values.map(function (val) {
        return val[categoryDataSourceId];
      })));
      // For each unique key, get the unique value for each dataset group
      // Each table row will consist of 1 key and the corresponding values
      // of each dataset group for that key
      uniqueKeys.forEach(function (key, index) {
        var groupBarValue = {};
        var filteredData = chartData.filter(function (data) {
          return data.key === key;
        });
        filteredData.forEach(function (val) {
          groupBarValue[val.group] = val.value;
        });
        tableData.push({
          id: "dataindex-".concat(index),
          values: _objectSpread(_objectSpread({}, groupBarValue), {}, _defineProperty({}, categoryDataSourceId, key)),
          isSelectable: false
        });
      });
    }
  }
  return tableData;
};
var getMaxTicksPerSize = function getMaxTicksPerSize(sizeProp) {
  switch (sizeProp) {
    case CARD_SIZES.MEDIUMTHIN:
      return 2;
    case CARD_SIZES.MEDIUM:
      return 4;
    case CARD_SIZES.MEDIUMWIDE:
    case CARD_SIZES.LARGE:
    case CARD_SIZES.LARGETHIN:
      return 6;
    case CARD_SIZES.LARGEWIDE:
      return 14;
    default:
      return 10;
  }
};

export { formatChartData, formatColors, formatTableData, generateSampleValues, generateSampleValuesForEditor, generateTableColumns, getMaxTicksPerSize, handleTooltip, mapValuesToAxes };
