
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

var candleArr = ['candlestick', 'candlePlot', 'barPlot', 'heikinAshi', 'volPath'];
function isCandle(type) {
  return candleArr.includes(type);
}
var plotsArr = ['labels', 'linesPlot', 'charPlot', 'arrowsPlot', 'line'];
function isPlot(type) {
  return plotsArr.includes(type);
}
function formatUpdateData(seriesModel, item, index) {
  if (seriesModel.subType === 'heikinAshi') {
    var lastData = seriesModel.option.data[index - 1];
    var _a = item,
      time = _a[0],
      o = _a[1],
      c = _a[2],
      l = _a[3],
      h = _a[4];
    if (lastData) {
      var data = lastData.value || lastData;
      var prevDataO = data[1];
      var prevDataC = data[2];
      var hAO = (prevDataO + prevDataC) / 2;
      var hAC = (o + c + h + l) / 4;
      var hAL = Math.min(hAO, hAC, l);
      var hAH = Math.max(hAO, hAC, h);
      return [time, hAO, hAC, hAL, hAH, c];
    } else {
      var hAO = (o + c) / 2;
      var hAC = (o + c + h + l) / 4;
      var hAL = Math.min(hAO, hAC, l);
      var hAH = Math.max(hAO, hAC, h);
      return [time, hAO, hAC, hAL, hAH, c];
    }
  }
  return item;
}
export { isCandle, isPlot, formatUpdateData };