/******/ (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
/******/ 		var threw = true;
/******/ 		try {
/******/ 			modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/ 			threw = false;
/******/ 		} finally {
/******/ 			if(threw) delete installedModules[moduleId];
/******/ 		}
/******/
/******/ 		// 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 = "iVCi");
/******/ })
/************************************************************************/
/******/ ({

/***/ "iVCi":
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// CONCATENATED MODULE: ./resource/histogram/types.ts
let Modes;

(function (Modes) {
  Modes["Offset"] = "offset";
  Modes["Overlay"] = "overlay";
})(Modes || (Modes = {}));
// CONCATENATED MODULE: ./resource/histogram/chart.ts
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }

const baseOptions = {
  legend: {
    data: []
  }
};
const options = {
  overlay: _objectSpread(_objectSpread({}, baseOptions), {}, {
    axisPointer: {
      link: [{
        xAxisIndex: 'all'
      }],
      show: true,
      snap: true,
      triggerTooltip: true
    },
    yAxis: {
      axisLine: {
        onZero: false
      }
    }
  }),
  offset: _objectSpread(_objectSpread({}, baseOptions), {}, {
    visualMap: {
      type: 'continuous',
      show: false,
      dimension: 1,
      inRange: {
        colorLightness: [0.5, 0.8],
        colorSaturation: [0.5, 0.8]
      }
    },
    // Fix echarts type bug
    xAxis: {
      axisLine: {
        onZero: false
      }
    },
    yAxis: {
      axisLine: {
        onZero: false
      },
      inverse: true,
      splitLine: {
        show: false
      }
    }
  })
};
// CONCATENATED MODULE: ./resource/histogram/data.ts


function computeHistogram(data, min, max, binsNum = 30) {
  if (min === max) {
    // Create bins even if all the data has a single value.
    max = min * 1.1 + 1;
    min = min / 1.1 - 1;
  }

  const stepWidth = (max - min) / binsNum;
  const range = [];

  for (let i = min; i < max; i += stepWidth) {
    range.push(i);
  }

  let itemIndex = 0;
  return range.map(binLeft => {
    const binRight = binLeft + stepWidth;
    let yValue = 0;

    while (itemIndex < data.length) {
      const itemRight = Math.min(max, data[itemIndex].right);
      const itemLeft = Math.max(min, data[itemIndex].left);
      const overlap = Math.min(itemRight, binRight) - Math.max(itemLeft, binLeft);
      const count = overlap / (itemRight - itemLeft) * data[itemIndex].count;

      if (overlap > 0) {
        yValue += count;
      } // If `itemRight` is bigger than `binRight`, then this bin is
      // finished and there also has data for the next bin, so don't increment
      // `itemIndex`.


      if (itemRight > binRight) {
        break;
      }

      itemIndex++;
    }

    return {
      x: binLeft,
      dx: stepWidth,
      y: yValue
    };
  });
}

function transform({
  data,
  mode
}) {
  const temp = data.map(([time, step, items]) => ({
    time,
    step,
    min: Math.min(...items.map(item => item[0])),
    max: Math.max(...items.map(item => item[1])),
    items: items.map(([left, right, count]) => ({
      left,
      right,
      count
    }))
  }));
  const min = Math.min(...temp.map(({
    min
  }) => min));
  const max = Math.max(...temp.map(({
    max
  }) => max));
  const overlay = temp.map(({
    time,
    step,
    items
  }) => computeHistogram(items, min, max).map(({
    x,
    dx,
    y
  }) => [time, step, x + dx / 2, Math.floor(y)]));

  if (mode === Modes.Overlay) {
    return {
      min,
      max,
      data: overlay
    };
  }

  if (mode === Modes.Offset) {
    let minStep = Infinity;
    let maxStep = -Infinity;
    let minZ = Infinity;
    let maxZ = -Infinity;
    const offset = overlay.map(items => {
      const step = items[0][1];
      step > maxStep && (maxStep = step);
      step < minStep && (minStep = step);
      return items.reduce((m, [,, x, y]) => {
        y > maxZ && (maxZ = y);
        y < minZ && (minZ = y);
        return [...m, x, step, y];
      }, []);
    });
    return {
      minX: min,
      maxX: max,
      minZ,
      maxZ,
      minStep,
      maxStep,
      data: offset
    };
  }

  return undefined;
}
// CONCATENATED MODULE: ./resource/histogram/index.ts

const modes = [Modes.Offset, Modes.Overlay];



// CONCATENATED MODULE: ./utils/worker.ts
/* harmony default export */ var worker = (handler => self.addEventListener('message', ({
  data
}) => {
  self.postMessage(handler(data));
}));
// CONCATENATED MODULE: /Users/Peter/Baidu/ai/PaddlePaddle/VisualDL/frontend/node_modules/next/dist/build/webpack/loaders/next-babel-loader.js??ref--4!./worker/histogram/transform.worker.ts


worker(transform);

/***/ })

/******/ });