import { __extends } from "../../../node_modules/tslib/tslib.es6.mjs";
import ComponentView from "../../view/Component.mjs";
import GridModel from "../../coord/cartesian/GridModel.mjs";
import "../../util/graphic.mjs";
import { defaults } from "../../../../../../zrender@5.4.4/node_modules/zrender/lib/core/util.mjs";
import { CartesianAxisModel } from "../../coord/cartesian/AxisModel.mjs";
import axisModelCreator from "../../coord/axisModelCreator.mjs";
import Grid from "../../coord/cartesian/Grid.mjs";
import { CartesianXAxisView, CartesianYAxisView } from "../axis/CartesianAxisView.mjs";
import Rect from "../../../../../../zrender@5.4.4/node_modules/zrender/lib/graphic/shape/Rect.mjs";
var GridView = (
  /** @class */
  function(_super) {
    __extends(GridView2, _super);
    function GridView2() {
      var _this = _super !== null && _super.apply(this, arguments) || this;
      _this.type = "grid";
      return _this;
    }
    GridView2.prototype.render = function(gridModel, ecModel) {
      this.group.removeAll();
      if (gridModel.get("show")) {
        this.group.add(new Rect({
          shape: gridModel.coordinateSystem.getRect(),
          style: defaults({
            fill: gridModel.get("backgroundColor")
          }, gridModel.getItemStyle()),
          silent: true,
          z2: -1
        }));
      }
    };
    GridView2.type = "grid";
    return GridView2;
  }(ComponentView)
);
var extraOption = {
  // gridIndex: 0,
  // gridId: '',
  offset: 0
};
function install(registers) {
  registers.registerComponentView(GridView);
  registers.registerComponentModel(GridModel);
  registers.registerCoordinateSystem("cartesian2d", Grid);
  axisModelCreator(registers, "x", CartesianAxisModel, extraOption);
  axisModelCreator(registers, "y", CartesianAxisModel, extraOption);
  registers.registerComponentView(CartesianXAxisView);
  registers.registerComponentView(CartesianYAxisView);
  registers.registerPreprocessor(function(option) {
    if (option.xAxis && option.yAxis && !option.grid) {
      option.grid = {};
    }
  });
}
export {
  install
};
