
/*
* 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.
 */

/*
* 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.
*/
import { __extends } from "tslib";
import * as zrUtil from 'tvrender/lib/core/util.js';
import ChartView from '../../view/Chart.js';
import { createClipPath } from '../helper/createClipPathFromCoordSys.js';
import NormalBoxPath from '../candlePlot/NormalBoxPath.js';
import WickPath from '../candlePlot/WickPath.js';
import { getECData } from '../../util/innerStore.js';
import { toggleHoverEmphasis } from '../../util/states.js';
// const SKIP_PROPS = ['color', 'borderColor'] as const;
var HeikinAshiView = /** @class */function (_super) {
  __extends(HeikinAshiView, _super);
  function HeikinAshiView() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = HeikinAshiView.type;
    return _this;
  }
  HeikinAshiView.prototype.render = function (seriesModel, ecModel, api) {
    // If there is clipPath created in large mode. Remove it.
    // this.group.removeClipPath();
    // Clear previously rendered progressive elements.
    this._progressiveEls = null;
    // this._updateDrawMode(seriesModel);
    this._renderNormal(seriesModel);
  };
  // eachRendered(cb: (el: Element) => boolean | void) {
  //     graphic.traverseElements(this._progressiveEls || this.group, cb);
  // }
  HeikinAshiView.prototype._renderNormal = function (seriesModel) {
    var data = seriesModel.getData();
    // const oldData = this._data;
    var group = this.group;
    group.removeAll();
    var emphasisState = seriesModel.get('emphasis').emphasisState;
    var info = seriesModel.get('info');
    var groupId = seriesModel.get('groupId');
    // const emphasisStyle = emphasis.itemStyle || {};
    var isSimpleBox = data.getLayout('isSimpleBox');
    var bodyPointsByColor = data.getLayout('bodyPointsByColor');
    var wickPointsByColor = data.getLayout('wickPointsByColor');
    var isMobile = seriesModel.get('isMobile');
    zrUtil.each(wickPointsByColor, function (points, key) {
      var stroke = key.split(':')[0];
      var el = new WickPath({
        shape: {
          points: points,
          isMobile: isMobile,
          stroke: stroke !== 'none' ? stroke : ''
        },
        style: {
          stroke: stroke
        }
      });
      el.states.emphasis = emphasisState;
      el.info = info;
      group.add(el);
    });
    zrUtil.each(bodyPointsByColor, function (points, key) {
      var _a = key.split(':'),
        fill = _a[0],
        stroke = _a[1];
      var el = new NormalBoxPath({
        shape: {
          points: points,
          isSimpleBox: isSimpleBox,
          fill: fill !== 'none' ? fill : '',
          isMobile: isMobile,
          // stroke: !isSimpleBox || stroke === 'none' ? '' : stroke,
          stroke: stroke === 'none' ? '' : stroke
        },
        style: {
          fill: isSimpleBox ? 'none' : fill,
          // stroke: 'none',
          stroke: stroke
        }
      });
      group.add(el);
      el.states.emphasis = emphasisState;
      el.info = info;
    });
    // const coordSys = seriesModel.coordinateSystem;
    var clipPath = seriesModel.get('clip', true) ? createClipPath(seriesModel.coordinateSystem, false, seriesModel) : null;
    if (clipPath) {
      this.group.setClipPath(clipPath);
    } else {
      this.group.removeClipPath();
    }
    toggleHoverEmphasis(this.group, null, null, false);
    getECData(this.group).groupId = groupId;
  };
  HeikinAshiView.prototype.remove = function (ecModel) {
    this._clear();
  };
  HeikinAshiView.prototype._clear = function () {
    this.group.removeAll();
    // this._data = null;
  };

  HeikinAshiView.type = 'heikinAshi';
  return HeikinAshiView;
}(ChartView);
export default HeikinAshiView;