"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));

var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));

var _deepEqual = require("../utils/deep-equal");

var LayerExtension = function () {
  function LayerExtension(opts) {
    (0, _classCallCheck2.default)(this, LayerExtension);
    this.opts = void 0;

    if (opts) {
      this.opts = opts;
    }
  }

  var _proto = LayerExtension.prototype;

  _proto.equals = function equals(extension) {
    if (this === extension) {
      return true;
    }

    return this.constructor === extension.constructor && (0, _deepEqual.deepEqual)(this.opts, extension.opts, 1);
  };

  _proto.getShaders = function getShaders(extension) {
    return null;
  };

  _proto.getSubLayerProps = function getSubLayerProps(extension) {
    var _ref = extension.constructor,
        defaultProps = _ref.defaultProps;
    var newProps = {
      updateTriggers: {}
    };

    for (var key in defaultProps) {
      if (key in this.props) {
        var propDef = defaultProps[key];
        var propValue = this.props[key];
        newProps[key] = propValue;

        if (propDef && propDef.type === 'accessor') {
          newProps.updateTriggers[key] = this.props.updateTriggers[key];

          if (typeof propValue === 'function') {
            newProps[key] = this.getSubLayerAccessor(propValue);
          }
        }
      }
    }

    return newProps;
  };

  _proto.initializeState = function initializeState(context, extension) {};

  _proto.updateState = function updateState(params, extension) {};

  _proto.onNeedsRedraw = function onNeedsRedraw(extension) {};

  _proto.getNeedsPickingBuffer = function getNeedsPickingBuffer(extension) {
    return false;
  };

  _proto.draw = function draw(params, extension) {};

  _proto.finalizeState = function finalizeState(context, extension) {};

  (0, _createClass2.default)(LayerExtension, null, [{
    key: "componentName",
    get: function get() {
      return Object.prototype.hasOwnProperty.call(this, 'extensionName') ? this.extensionName : '';
    }
  }]);
  return LayerExtension;
}();

exports.default = LayerExtension;
LayerExtension.defaultProps = {};
LayerExtension.extensionName = 'LayerExtension';
//# sourceMappingURL=layer-extension.js.map