
/*
* 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";
/* global Uint32Array, Float64Array, Float32Array */
import SeriesModel from '../../model/Series.js';
import createSeriesData from '../helper/createSeriesData.js';
import * as zrUtil from 'tvrender/lib/core/util.js';
;
var MinePolyLinesSeriesModel = /** @class */function (_super) {
  __extends(MinePolyLinesSeriesModel, _super);
  function MinePolyLinesSeriesModel() {
    var _this = _super !== null && _super.apply(this, arguments) || this;
    _this.type = MinePolyLinesSeriesModel.type;
    _this.xFilterMode = 'weakFilter';
    _this.ignoreStyleOnData = true;
    _this.dataIndexById = {};
    return _this;
  }
  MinePolyLinesSeriesModel.prototype.getInitialData = function (option) {
    if (process.env.NODE_ENV !== 'production') {
      var coordSys = option.coordinateSystem;
      if (coordSys !== 'polar' && coordSys !== 'cartesian2d') {
        throw new Error('MinePolyLines not support coordinateSystem besides cartesian and polar');
      }
    }
    this.computedDataIndexById(option);
    return createSeriesData(null, this, {
      useEncodeDefaulter: true
    });
  };
  MinePolyLinesSeriesModel.prototype.getZLevelKey = function () {
    // Each progressive series has individual key.
    return this.getData().count() > this.getProgressiveThreshold() ? this.id : '';
  };
  MinePolyLinesSeriesModel.prototype.computedDataIndexById = function (option) {
    var dataIndexById = {};
    zrUtil.each(option.data, function (item, index) {
      dataIndexById[item.id] = index;
    });
    this.dataIndexById = dataIndexById;
  };
  MinePolyLinesSeriesModel.prototype.getResetData = function (data) {
    var mergeIdById = {};
    var mergeData = zrUtil.filter(data, function (item) {
      mergeIdById[item.id] = 1;
      return !item.isDelete;
    });
    var newData = zrUtil.filter(this.option.data, function (item) {
      if (mergeIdById[item.id]) {
        return false;
      }
      return true;
    });
    this.option.data = newData.concat(mergeData).slice(-this.option.limit);
    return this.option.data;
  };
  MinePolyLinesSeriesModel.type = 'series.minePolyLines';
  MinePolyLinesSeriesModel.dependencies = ['grid', 'polar'];
  MinePolyLinesSeriesModel.defaultOption = {
    coordinateSystem: 'cartesian2d',
    // zlevel: 0,
    z: 2,
    z2: 0,
    legendHoverLink: true,
    // Cartesian coordinate system
    xAxisIndex: 0,
    yAxisIndex: 0,
    dimensions: ['x1', 'x2', 'y1', 'y2'],
    encode: {
      x: ['x1', 'x2'],
      y: ['y1', 'y2']
    },
    baseDim: 'y1',
    emphasis: {
      emphasisState: {
        // hoverLayer: true,
        zlevel: 1
      }
    },
    large: true,
    // Available when large is true
    largeThreshold: 600,
    clip: true,
    limit: 50
  };
  return MinePolyLinesSeriesModel;
}(SeriesModel);
export default MinePolyLinesSeriesModel;