"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const tslib_es6 = require("../../../node_modules/tslib/tslib.es6.js");
const Component = require("../../view/Component.js");
const GridModel = require("../../coord/cartesian/GridModel.js");
require("../../util/graphic.js");
const util = require("../../../../../../zrender@5.4.4/node_modules/zrender/lib/core/util.js");
const AxisModel = require("../../coord/cartesian/AxisModel.js");
const axisModelCreator = require("../../coord/axisModelCreator.js");
const Grid = require("../../coord/cartesian/Grid.js");
const CartesianAxisView = require("../axis/CartesianAxisView.js");
const Rect = require("../../../../../../zrender@5.4.4/node_modules/zrender/lib/graphic/shape/Rect.js");
var GridView = (
  /** @class */
  function(_super) {
    tslib_es6.__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.default({
          shape: gridModel.coordinateSystem.getRect(),
          style: util.defaults({
            fill: gridModel.get("backgroundColor")
          }, gridModel.getItemStyle()),
          silent: true,
          z2: -1
        }));
      }
    };
    GridView2.type = "grid";
    return GridView2;
  }(Component.default)
);
var extraOption = {
  // gridIndex: 0,
  // gridId: '',
  offset: 0
};
function install(registers) {
  registers.registerComponentView(GridView);
  registers.registerComponentModel(GridModel.default);
  registers.registerCoordinateSystem("cartesian2d", Grid.default);
  axisModelCreator.default(registers, "x", AxisModel.CartesianAxisModel, extraOption);
  axisModelCreator.default(registers, "y", AxisModel.CartesianAxisModel, extraOption);
  registers.registerComponentView(CartesianAxisView.CartesianXAxisView);
  registers.registerComponentView(CartesianAxisView.CartesianYAxisView);
  registers.registerPreprocessor(function(option) {
    if (option.xAxis && option.yAxis && !option.grid) {
      option.grid = {};
    }
  });
}
exports.install = install;
