/*!
 * Copyright © 2024 Splunk Inc.
 * SPLUNK CONFIDENTIAL – Use or disclosure of this material in whole or
 * in part without a valid written license from Splunk Inc. is PROHIBITED.
 */
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 61);
/******/ })
/************************************************************************/
/******/ ({

/***/ 0:
/***/ (function(module, exports) {

module.exports = require("lodash");

/***/ }),

/***/ 3:
/***/ (function(module, exports) {

module.exports = require("@babel/runtime/helpers/toConsumableArray");

/***/ }),

/***/ 61:
/***/ (function(module, exports, __webpack_require__) {

"use strict";


var _toConsumableArray = __webpack_require__(3);

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getTrellisDataSourcesBySplitMode = exports.dataSourcesSplitByModeStatsorUnknown = exports.dataSourcesSplitByModeChart = exports.dataSourcesSplitByModeTimechart = exports.dataSourcesSplitByAggregationsStats = exports.dataSourcesSplitByAggregationsTimechartAndChart = exports.dataSourcesSplitByAggregationsUnknown = exports.AGGREGATIONS = void 0;

var lodash_1 = __webpack_require__(0);

var trellisUtils_1 = __webpack_require__(62);

exports.AGGREGATIONS = 'aggregations';
/**
 * There can be certain SPL cmds that can produce dataSource without a specific field meta info (like group_by_rank, split_by_field etc),
 * to categorize it,
 * Example1:- `index = "_internal" | chart count`
 * Example2:- `index=_internal | chart avg(count), max(count)`
 * Example3:- `index = "_internal" | stats count`
 * Example4:- `index=_internal | stats avg(count), max(count)`
 */

var dataSourcesSplitByAggregationsUnknown = function dataSourcesSplitByAggregationsUnknown(dataSource) {
  var _a, _b, _c, _d;

  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
  var splitDataSources = null;
  var errorCode = null;

  if (fields && fields.length) {
    splitDataSources = {};

    for (var i = 0; i < fields.length; i += 1) {
      var fieldName = fields[i].name;

      if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
        splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
        splitDataSources[fieldName].primary.data.fields = [fields[i]];
        splitDataSources[fieldName].primary.data.columns = [columns[i]];
      }
    }
  } else {
    errorCode = 'INVALID_SPLIT_BY_FIELD';
  }

  return {
    splitDataSources: splitDataSources,
    errorCode: errorCode
  };
};

exports.dataSourcesSplitByAggregationsUnknown = dataSourcesSplitByAggregationsUnknown;

var dataSourcesSplitByAggregationsTimechartAndChart = function dataSourcesSplitByAggregationsTimechartAndChart(dataSource) {
  var _a, _b, _c, _d;

  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
  var splitDataSources = null;
  var splitByFields = [];
  var errorCode = null;

  if (typeof fields[0] !== 'string') {
    splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
  }

  if (splitByFields && splitByFields.length > 0) {
    splitDataSources = {};
    splitByFields.forEach(function (splitByField) {
      splitDataSources[splitByField] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
      splitDataSources[splitByField].primary.data.fields = [fields[0]];
      splitDataSources[splitByField].primary.data.columns = [columns[0]];
      fields.forEach(function (field, idx) {
        var fieldName = field === null || field === void 0 ? void 0 : field.name;

        if (fieldName !== '_time' && !(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_')) && field.data_source === splitByField) {
          splitDataSources[splitByField].primary.data.fields.push(field);
          splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
        }
      });
    });
  } else if ((!splitByFields || !splitByFields.length) && fields.length > 1) {
    // handle where data_source doesnot exist in fields
    // example1 :- index=_internal | timechart count
    // example2 :- index=_internal |  timechart max(count) avg(count)
    splitDataSources = {};

    for (var i = 1; i < fields.length; i += 1) {
      var fieldName = fields[i].name;

      if (!(fieldName === null || fieldName === void 0 ? void 0 : fieldName.startsWith('_'))) {
        splitDataSources[fieldName] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
        splitDataSources[fieldName].primary.data.fields = [fields[0], fields[i]];
        splitDataSources[fieldName].primary.data.columns = [columns[0], columns[i]];
      }
    }
  } else {
    errorCode = 'INVALID_SPLIT_BY_FIELD';
  }

  return {
    splitDataSources: splitDataSources,
    errorCode: errorCode
  };
};

exports.dataSourcesSplitByAggregationsTimechartAndChart = dataSourcesSplitByAggregationsTimechartAndChart;

var dataSourcesSplitByAggregationsStats = function dataSourcesSplitByAggregationsStats(dataSource) {
  var _a, _b, _c, _d;

  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
  var splitDataSources = null;
  var splitByFields = [];
  var errorCode = null;

  if (typeof fields[0] !== 'string') {
    splitByFields = (0, trellisUtils_1.extractDataSourceAggregationKeysStats)(fields);
  }

  if (splitByFields && splitByFields.length > 0) {
    splitDataSources = {};
    splitByFields.forEach(function (splitByField) {
      splitDataSources[splitByField] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
      splitDataSources[splitByField].primary.data.fields = [fields[0]];
      splitDataSources[splitByField].primary.data.columns = [columns[0]];
      var idx = fields.findIndex(function (field) {
        return field.name === splitByField;
      });

      if (idx > 0) {
        splitDataSources[splitByField].primary.data.fields.push(fields[idx]);
        splitDataSources[splitByField].primary.data.columns.push(columns[idx]);
      }
    });
  } else {
    errorCode = 'INVALID_SPLIT_BY_FIELD';
  }

  return {
    splitDataSources: splitDataSources,
    errorCode: errorCode
  };
};

exports.dataSourcesSplitByAggregationsStats = dataSourcesSplitByAggregationsStats;

var dataSourcesSplitByModeTimechart = function dataSourcesSplitByModeTimechart(dataSource, splitBy) {
  var _a, _b, _c, _d, _e;

  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
  var splitDataSources = null;
  var splitByFields = [];
  var errorCode = null;

  if (typeof fields[0] !== 'string') {
    splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
  }

  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
    splitDataSources = {};
    var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
    var valueKeys = [];

    for (var i = 1; i < fields.length; i += 1) {
      // not including internal fields
      if (!((_e = fields[i].name) === null || _e === void 0 ? void 0 : _e.startsWith('_'))) {
        valueKeys.push(fields[i].splitby_value ? fields[i].splitby_value : fields[i].name);
      }
    }

    valueKeys.forEach(function (val) {
      splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
      splitDataSources[val].primary.data.fields = [{
        name: fields[0].name
      }].concat(_toConsumableArray(dataSourceKeys.map(function (k) {
        return {
          name: k
        };
      })));
      splitDataSources[val].primary.data.columns = [_toConsumableArray(columns[0])];
      dataSourceKeys.forEach(function (dsKey) {
        fields.forEach(function (field, idx) {
          if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
            splitDataSources[val].primary.data.columns.push(_toConsumableArray(columns[idx]));
          }
        });
      });
    });
  } else {
    errorCode = 'INVALID_SPLIT_BY_FIELD';
  }

  return {
    splitDataSources: splitDataSources,
    errorCode: errorCode
  };
};

exports.dataSourcesSplitByModeTimechart = dataSourcesSplitByModeTimechart;

var dataSourcesSplitByModeChart = function dataSourcesSplitByModeChart(dataSource, splitBy) {
  var _a, _b, _c, _d;

  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
  var splitDataSources = null;
  var splitByFields = [];
  var errorCode = null;

  if (typeof fields[0] !== 'string') {
    splitByFields = (0, trellisUtils_1.extractSplitByFieldsChartFields)(fields);
  }

  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
    splitDataSources = {};
    var splitByFieldIdx = splitByFields.findIndex(function (f) {
      return f === splitBy;
    });
    var otherSplitBy = splitByFields.filter(function (f) {
      return f !== splitBy;
    });
    var dataSourceKeys = (0, trellisUtils_1.extractDataSourceAggregationKeysChart)(fields);
    var nonDataSourceAggregations = [];

    if (!dataSourceKeys.length && fields[0].groupby_rank === '0' && fields.length && !fields[1].groupby_rank) {
      /* check for another aggregation scenario where no key 'data_source' will be returned (applies for both chart and stats cmd)
      For example :-
      index=_internal | chart count by status
      index = "_internal" | chart max(count) avg(count) by status
      index = "_internal" |  stats max(count) avg(count) by status
      where field meta info is in this format -
       "fields": [
              {
                  "name": "status",
                  "groupby_rank": "0"
              },
              {
                  "name": "max(count)"
              },
              {
                  "name": "avg(count)"
              }
          ]
       */
      for (var i = 1; i < fields.length; i += 1) {
        nonDataSourceAggregations.push(fields[i].name);
      }
    }

    if (splitByFieldIdx === 0) {
      // if splitBy is the first field, split row wise
      var valueKeys = (0, lodash_1.cloneDeep)(columns[0]);
      valueKeys.forEach(function (val, idx) {
        splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
        splitDataSources[val].primary.data.fields = [];

        if (otherSplitBy.length) {
          splitDataSources[val].primary.data.fields = [{
            name: otherSplitBy[0]
          }]; // there can only be one otherSplitBy for chart cmd
        }

        if (dataSourceKeys.length) {
          (function () {
            var columnValues = [[]];
            splitDataSources[val].primary.data.fields = [].concat(_toConsumableArray(splitDataSources[val].primary.data.fields), _toConsumableArray(dataSourceKeys.map(function (k) {
              return {
                name: k
              };
            })));
            dataSourceKeys.forEach(function () {
              columnValues.push([]);
            });
            /**
             * There can be chart SPL cmd where there are multiple data_source keys in the field meta info.
             * For eg - index = "_internal" | chart avg(count) max(count) by status , user) can result in fields and columns as below where "data_source" keys are "avg(count)" and "max(count)"
             * 'fields' : [
                    {
                        "name": "status",
                        "groupby_rank": "0"
                    },
                    {
                        "name": "avg(count): userA",
                        "data_source": "avg(count)",
                        "splitby_field": "user",
                        "splitby_value": "userA"
                    },
                    {
                        "name": "avg(count): userB",
                        "data_source": "avg(count)",
                        "splitby_field": "user",
                        "splitby_value": "userB"
                    },
                    {
                        "name": "avg(count): userC",
                        "data_source": "avg(count)",
                        "splitby_field": "user",
                        "splitby_value": "userC"
                    },
                    {
                        "name": "max(count): userA",
                        "data_source": "max(count)",
                        "splitby_field": "user",
                        "splitby_value": "userA"
                    },
                    {
                        "name": "max(count): userB",
                        "data_source": "max(count)",
                        "splitby_field": "user",
                        "splitby_value": "userB"
                    },
                    {
                        "name": "max(count): userC",
                        "data_source": "max(count)",
                        "splitby_field": "user",
                        "splitby_value": "userC"
                    },
                ]
                'columns' : [['200','303','304','400'], ['1','2','3','4'], ['10','20','30','40'], ['100','200','300','400'], ['5','6','7','8'], ['50','60','70','80'],['500','600','700','800']]
                 In this case when we split row wise, the data_source keys for userA appears in indices [1, 4, ..], the data_source keys for userB appears in indices [2, 5, ..]
                The resulting dataSplit for status '200', will have the fields => ['user','avg(count)', 'max(count)'] columns  => [['userA', 'userB', 'userC'],['1','10','100'], ['5', '50', '500'] ]
                 For the example above for..loop below will iterate from i= 1 to 3 (Math.ceil((fields.length - 1) / dataSourceKeys.length)). Exclude i = 0 as first column is the splitBy input.
                Since there are 2 data_source keys 'avg(count)' and 'max(count)', dataSourceKeys.forEach loop will collect individual arrays specific to the columnValues[indx] as below.
                columnValues[0] =  ['userA', 'userB', 'userC']
                columnValues[1] = ['1','10','100']
                columnValues[2] = ['5', '50', '500']
             */

            var _loop = function _loop(_i) {
              columnValues[0].push(fields[_i].splitby_value ? fields[_i].splitby_value : fields[_i].name);
              dataSourceKeys.forEach(function (dskey, dsIndx) {
                var mul = (fields.length - 1) / dataSourceKeys.length; // This line does the index calculation

                columnValues[dsIndx + 1].push(columns[_i + dsIndx * mul][idx]);
              });
            };

            for (var _i = 1; _i <= Math.ceil((fields.length - 1) / dataSourceKeys.length); _i += 1) {
              _loop(_i);
            }

            splitDataSources[val].primary.data.columns = columnValues;
          })();
        } else if (nonDataSourceAggregations.length) {
          // There can be SPL where data_source field metainfo is not available and needs special handling
          // For eg :-
          // index=_internal |  chart count by status
          // index = "_internal" | chart max(count) avg(count) by status
          // index = "_internal" |  stats max(count) avg(count) by status
          var columnValues = [];
          fields.forEach(function (aggregationField, fieldIdx) {
            if (fieldIdx > 0) {
              splitDataSources[val].primary.data.fields.push(aggregationField);
              columnValues.push([columns[fieldIdx][idx]]);
            }
          });
          splitDataSources[val].primary.data.columns = columnValues;
        }
      });
    } else {
      // split column wise
      var _valueKeys = [];

      for (var _i2 = 1; _i2 < fields.length; _i2 += 1) {
        _valueKeys.push(fields[_i2].splitby_value ? fields[_i2].splitby_value : fields[_i2].name);
      }

      _valueKeys.forEach(function (val) {
        splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
        splitDataSources[val].primary.data.fields = [{
          name: otherSplitBy[0]
        }].concat(_toConsumableArray(dataSourceKeys.map(function (k) {
          return {
            name: k
          };
        })));
        splitDataSources[val].primary.data.columns = [_toConsumableArray(columns[0])];
        dataSourceKeys.forEach(function (dsKey) {
          fields.forEach(function (field, idx) {
            if (field.data_source === dsKey && (field.splitby_value === val || field.name === val)) {
              splitDataSources[val].primary.data.columns.push(_toConsumableArray(columns[idx]));
            }
          });
        });
      });
    }
  } else {
    errorCode = 'INVALID_SPLIT_BY_FIELD';
  }

  return {
    splitDataSources: splitDataSources,
    errorCode: errorCode
  };
};

exports.dataSourcesSplitByModeChart = dataSourcesSplitByModeChart;
/**
 * This method does datasplitting for 'stats' and generic cmds('makeresults','table' etc - categoried as 'unknown' splitMode).
 * The main difference is for 'stats' cmd possible splitBy fields have 'group_by_rank' in field meta info, whereas for 'unknown' cmd it can be any fieldnames
 */

var dataSourcesSplitByModeStatsorUnknown = function dataSourcesSplitByModeStatsorUnknown(dataSource, splitBy, splitMode) {
  var _a, _b, _c, _d, _e, _f;

  var fields = (_b = (_a = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.fields;
  var columns = (_d = (_c = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.columns;
  var splitDataSources = null;
  var splitByFields = [];
  var errorCode = null;

  if (typeof fields[0] !== 'string') {
    splitByFields = splitMode !== trellisUtils_1.UNKNOWN ? (0, trellisUtils_1.extractSplitByFieldsForStats)(fields) : (0, trellisUtils_1.extractSplitByFieldsForUnknown)(fields);
  }

  var splitByIndex = fields === null || fields === void 0 ? void 0 : fields.findIndex(function (field) {
    return field === splitBy || field.name === splitBy;
  });

  if (splitByFields && splitByFields.indexOf(splitBy) > -1) {
    var splitByColumn = (_f = (_e = dataSource === null || dataSource === void 0 ? void 0 : dataSource.primary) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.columns[splitByIndex];
    splitDataSources = {};
    splitByColumn.forEach(function (val, idx) {
      if (!splitDataSources[val]) {
        splitDataSources[val] = [idx];
      } else {
        splitDataSources[val].push(idx);
      }
    });
    var cloneFields = (0, lodash_1.cloneDeep)(fields);
    cloneFields.splice(splitByIndex, 1);
    var valueKeys = Object.keys(splitDataSources);
    valueKeys.forEach(function (val) {
      var valIndices = (0, lodash_1.cloneDeep)(splitDataSources[val]);
      splitDataSources[val] = (0, lodash_1.cloneDeep)((0, lodash_1.omit)(dataSource, ['primary.data.fields', 'primary.data.columns']));
      splitDataSources[val].primary.data.fields = cloneFields;
      splitDataSources[val].primary.data.columns = [];
      columns.forEach(function (col, idx) {
        if (idx !== splitByIndex) {
          var newCol = valIndices.map(function (valIdx) {
            return col[valIdx];
          });
          splitDataSources[val].primary.data.columns.push(newCol);
        }
      });
    });
  } else {
    errorCode = 'INVALID_SPLIT_BY_FIELD';
  }

  return {
    splitDataSources: splitDataSources,
    errorCode: errorCode
  };
};

exports.dataSourcesSplitByModeStatsorUnknown = dataSourcesSplitByModeStatsorUnknown;

var getTrellisDataSourcesBySplitMode = function getTrellisDataSourcesBySplitMode(splitMode, dataSources, trellisSplitBy) {
  var result = null;

  try {
    if (splitMode === trellisUtils_1.TIMECHART) {
      result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeTimechart)(dataSources, trellisSplitBy);
    } else if (splitMode === trellisUtils_1.STATS) {
      result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsStats)(dataSources) : (0, exports.dataSourcesSplitByModeStatsorUnknown)(dataSources, trellisSplitBy, trellisUtils_1.STATS);
    } else if (splitMode === trellisUtils_1.CHART) {
      result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsTimechartAndChart)(dataSources) : (0, exports.dataSourcesSplitByModeChart)(dataSources, trellisSplitBy);
    } else if (splitMode === trellisUtils_1.UNKNOWN) {
      result = trellisSplitBy === exports.AGGREGATIONS ? (0, exports.dataSourcesSplitByAggregationsUnknown)(dataSources) : (0, exports.dataSourcesSplitByModeStatsorUnknown)(dataSources, trellisSplitBy, trellisUtils_1.UNKNOWN);
    }
  } catch (ex) {
    console.error('getTrellisDataSourcesBySplitMode ', ex);
    result = {
      splitDataSources: null,
      errorCode: 'UNKNOWN'
    };
  }

  return result;
};

exports.getTrellisDataSourcesBySplitMode = getTrellisDataSourcesBySplitMode;

/***/ }),

/***/ 62:
/***/ (function(module, exports) {

module.exports = require("@splunk/visualizations-shared/trellisUtils");

/***/ })

/******/ });
//# sourceMappingURL=trellisUtils.js.map